/* ============================================================
   6.5.2 — Va último: pisa lo anterior sin tocar la lógica.
   ============================================================ */

/* ---------------- Rendimiento al escribir ----------------
   Las pantallas que entran encima (Notas, Ayuda, Configuración, detalle de una nota) se calculan y se pintan
   aparte: lo que crece adentro (un cuadro de texto mientras se escribe) ya no obliga a recalcular la página
   entera que queda tapada atrás. */
.notas-page-overlay, .nota-detalle-overlay{ contain: layout paint style; }

/* Con una pantalla encima (body.hay-overlay, ver el MutationObserver de navStack en app.js) se pausan las
   animaciones que laten sin parar atrás: repintaban la página tapada en cada cuadro. */
body.hay-overlay .ini-prox-pulso,
body.hay-overlay .ini-prox-pulso::after,
body.hay-overlay .stat-chart-ahora-halo,
body.hay-overlay nav.tabs .sidebar-link-reservas-label::after{ animation-play-state: paused; }

/* El punto de "próximo turno" late con transform/opacity (lo mueve la placa de video) en vez de animar
   box-shadow, que se repintaba en cada cuadro. */
.ini-prox-pulso{ position:relative; box-shadow:none; animation:none; }
.ini-prox-pulso::after{
  content:''; position:absolute; inset:0; border-radius:50%; background: var(--accent-vivido);
  animation: v652-pulso 2s ease-out infinite; will-change: transform, opacity;
}
@keyframes v652-pulso{
  0%{ transform: scale(1); opacity:.55; }
  70%{ transform: scale(3); opacity:0; }
  100%{ transform: scale(3); opacity:0; }
}

/* ---------------- Gráficos de línea: punto de "ahora" y estado vacío ----------------
   El punto va en HTML (renderGraficoLineas en app.js): siempre redondo, aunque el SVG se estire. */
.stat-chart-punto{
  position:absolute; width:0; height:0; pointer-events:none; z-index:1;
}
.stat-chart-punto b, .stat-chart-punto i{
  position:absolute; left:0; top:0; border-radius:50%; background: var(--punto-color, var(--accent-vivido));
  transform: translate(-50%, -50%);
}
.stat-chart-punto b{ width:9px; height:9px; box-shadow: 0 0 0 2px var(--bg-panel); }
.stat-chart-punto i.stat-chart-ahora-halo{
  width:18px; height:18px; opacity:.18;
  animation: v652-halo 2.2s ease-in-out infinite; will-change: transform, opacity;
}
@keyframes v652-halo{
  0%, 100%{ opacity:.18; transform: translate(-50%, -50%) scale(1); }
  50%{ opacity:.05; transform: translate(-50%, -50%) scale(1.45); }
}
.stat-chart-vacio .stat-chart-punto i{ display:none; }
.stat-chart-vacio .stat-chart-punto b{ width:7px; height:7px; background: var(--text-dim); opacity:.7; }
.stat-chart-vacio-msg{
  position:absolute; left:50%; top:38%; transform: translate(-50%, -50%);
  font-size:0.78rem; color: var(--text-dim); white-space:nowrap; pointer-events:none;
  padding:6px 12px; border-radius:999px; background: color-mix(in srgb, var(--bg-panel-2) 80%, transparent);
  border:1px solid var(--line);
}

/* ---------------- Estadísticas › mes por mes (rediseño 6.5.2, meses.js) ----------------
   Se contrae tocando la cabecera; barras en HTML (nítidas); resumen arriba; lista de 4 meses con "ver los 12". */
#tab-stats .est-card.mpm{ padding:0; overflow:hidden; }
.mpm-cab{
  all:unset; box-sizing:border-box; width:100%; cursor:pointer; display:flex; align-items:center; gap:12px;
  padding:16px 18px; -webkit-tap-highlight-color:transparent;
}
.mpm-cab:focus-visible{ outline:2px solid var(--accent-vivido); outline-offset:-2px; border-radius:inherit; }
.mpm-cab-texto{ flex:1; min-width:0; display:flex; flex-direction:column; gap:2px; }
.mpm-cab .est-card-title{ margin:0; font-size:1rem; font-weight:750; }
.mpm-cab-chev{
  width:32px; height:32px; padding:7px; box-sizing:border-box; flex-shrink:0; border-radius:50%;
  background: var(--bg-panel-2); border:1px solid var(--line);
  fill:none; stroke: var(--text-dim); stroke-width:2.4; stroke-linecap:round; stroke-linejoin:round;
  transition: transform .25s cubic-bezier(.2,.8,.2,1);
}
.mpm.contraida .mpm-cab-chev{ transform: rotate(-90deg); }
.mpm-cuerpo{ display:grid; grid-template-rows: 1fr; transition: grid-template-rows .28s cubic-bezier(.2,.8,.2,1); }
.mpm.contraida .mpm-cuerpo{ grid-template-rows: 0fr; }
.mpm-cuerpo-int{ min-height:0; overflow:hidden; display:flex; flex-direction:column; gap:14px; padding:0 18px; }
.mpm.contraida .mpm-cuerpo-int{ visibility:hidden; transition: visibility 0s .28s; }

.mpm-kpis{ display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:8px; }
.mpm-kpis > div{
  background: var(--bg-panel-2); border:1px solid var(--line); border-radius:14px; padding:11px 12px;
  display:flex; flex-direction:column; gap:3px; min-width:0;
}
.mpm-kpis span{ font-size:0.72rem; font-weight:600; color: var(--text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mpm-kpis b{ font-size:1rem; font-weight:750; font-variant-numeric: tabular-nums; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.mpm-kpis b.neg{ color: var(--warn); }
.mpm-kpis small{ font-size:0.72rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.mpm-graf-cab{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; margin-bottom:-4px; }
.mpm-grafico{
  display:grid; grid-template-columns: repeat(12, minmax(0,1fr)); gap:4px; height:188px; width:auto; overflow:visible;
  padding-top:18px; position:relative;
}
.mpm-col{
  all:unset; box-sizing:border-box; cursor:pointer; position:relative; display:flex; flex-direction:column; align-items:stretch;
  min-width:0; height:100%; padding-bottom:22px; border-radius:10px; transition: background .15s ease;
}
.mpm-col:hover, .mpm-col:focus-visible{ background: color-mix(in srgb, var(--text) 5%, transparent); }
.mpm-col.actual{ background: color-mix(in srgb, var(--accent-vivido) 9%, transparent); }
.mpm-col-pos{ display:flex; align-items:flex-end; justify-content:center; gap:2px; border-bottom:1px solid var(--line); }
.mpm-col-neg{ display:flex; align-items:flex-start; justify-content:center; }
.mpm-bar{
  display:block; width:min(62%, 26px); height:var(--h); min-height:2px; border-radius:6px 6px 3px 3px;
  background: linear-gradient(180deg, var(--accent-grafico), color-mix(in srgb, var(--accent-grafico) 60%, transparent));
  transform-origin: bottom; animation: v652-crece .5s cubic-bezier(.2,.8,.2,1) both;
}
.mpm-bar.neg{ border-radius:3px 3px 6px 6px; transform-origin: top; background: linear-gradient(0deg, var(--warn-grafico), color-mix(in srgb, var(--warn-grafico) 60%, transparent)); }
.mpm-bar.cero{ height:2px; opacity:.4; background: var(--line); animation:none; }
.mpm-bar.ing, .mpm-bar.gas{ width:min(34%, 14px); }
.mpm-bar.ing{ background: linear-gradient(180deg, var(--ok-grafico), color-mix(in srgb, var(--ok-grafico) 55%, transparent)); }
.mpm-bar.gas{ background: linear-gradient(180deg, var(--warn-grafico), color-mix(in srgb, var(--warn-grafico) 55%, transparent)); }
.mpm-col:not(.actual) .mpm-bar:not(.cero){ opacity:.82; }
.mpm-col:hover .mpm-bar, .mpm-col.actual .mpm-bar{ opacity:1; }
@keyframes v652-crece{ from{ transform: scaleY(0); } to{ transform: scaleY(1); } }
.mpm-col-valor{
  position:absolute; left:50%; top:-16px; transform: translateX(-50%); font-size:0.6rem; font-weight:700;
  color: var(--text-dim); white-space:nowrap; opacity:0; transition: opacity .15s ease; pointer-events:none;
}
.mpm-col:hover .mpm-col-valor, .mpm-col.actual .mpm-col-valor, .mpm-col:focus-visible .mpm-col-valor{ opacity:1; }
.mpm-col.actual .mpm-col-valor{ color: var(--text); }
.mpm-col-mes{
  position:absolute; left:0; right:0; bottom:3px; text-align:center; font-size:0.68rem; font-weight:650;
  color: var(--text-dim); text-transform:capitalize; white-space:nowrap; overflow:hidden;
}
.mpm-col.actual .mpm-col-mes{ color: var(--accent); font-weight:800; }

.mpm .mpm-lista{ margin:0 -18px; }
.mpm:not(.todos) .mpm-fila.extra{ display:none; }
.mpm-ver-todos{
  all:unset; box-sizing:border-box; cursor:pointer; text-align:center; font-size:0.82rem; font-weight:700; color: var(--accent);
  padding:12px; margin:-14px -18px 0; border-top:1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.mpm-ver-todos:hover{ background: color-mix(in srgb, var(--text) 4%, transparent); }
.mpm-cuerpo-int > :last-child{ margin-bottom:0; }
.mpm .mpm-lista.sin-datos{ margin-bottom:4px; }
@media (max-width: 560px){
  .mpm-grafico{ height:160px; gap:2px; }
  .mpm-col-mes{ font-size:0.6rem; }
  .mpm-kpis{ gap:6px; }
  .mpm-kpis > div{ padding:9px 10px; }
  .mpm-kpis b{ font-size:0.9rem; }
}

/* ---------------- Reservas online › Rubro y ubicación (6.5.2, app.js) ---------------- */
#cfgCategoriaNegocio{ margin-bottom:6px; }
.cfg-ubic-buscar{ position:relative; display:flex; gap:8px; align-items:stretch; }
.cfg-ubic-buscar input{ flex:1; min-width:0; margin:0 !important; }
.cfg-ubic-buscar-btn{
  all:unset; box-sizing:border-box; cursor:pointer; display:inline-flex; align-items:center; gap:6px; flex-shrink:0;
  padding:0 14px; border-radius:12px; background: var(--accent-soft); color: var(--accent); font-weight:700; font-size:0.86rem;
  border:1px solid color-mix(in srgb, var(--accent-vivido) 35%, transparent);
}
.cfg-ubic-buscar-btn svg{ width:16px; height:16px; fill:none; stroke: currentColor; stroke-width:2.2; stroke-linecap:round; }
.cfg-ubic-buscar-btn.cargando{ opacity:.6; pointer-events:none; }
.cfg-ubic-buscar-btn.cargando svg{ animation: v652-gira .8s linear infinite; }
@keyframes v652-gira{ to{ transform: rotate(360deg); } }
.cfg-ubic-sugerencias{
  position:absolute; left:0; right:0; top: calc(100% + 6px); z-index:30; padding:6px; border-radius:14px;
  background: var(--bg-panel); border:1px solid var(--line); box-shadow: 0 16px 40px rgba(0,0,0,.3);
  display:flex; flex-direction:column;
}
.cfg-ubic-sugerencias.oculto{ display:none; }
.cfg-ubic-sug{
  all:unset; box-sizing:border-box; cursor:pointer; display:flex; align-items:center; gap:10px; padding:9px 10px; border-radius:10px;
}
.cfg-ubic-sug:hover, .cfg-ubic-sug:focus-visible{ background: color-mix(in srgb, var(--text) 6%, transparent); }
.cfg-ubic-sug svg{ width:18px; height:18px; flex-shrink:0; fill:none; stroke: var(--accent); stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
.cfg-ubic-sug span{ display:flex; flex-direction:column; min-width:0; }
.cfg-ubic-sug b{ font-size:0.88rem; font-weight:650; color: var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.cfg-ubic-sug small{ font-size:0.74rem; color: var(--text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.cfg-ubic{ border-style:solid; padding:0; overflow:hidden; gap:0; margin-top:12px; }
.cfg-ubic-mapa{ position:relative; height:260px; background: var(--bg-panel-2); z-index:0; }
@media (min-width: 860px){ .cfg-ubic-mapa{ height:320px; } }
.cfg-ubic-mapa-vacio{
  position:absolute; inset:0; z-index:500; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
  padding:20px; text-align:center; font-size:0.84rem; color: var(--text-dim); pointer-events:none;
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--accent-vivido) 10%, transparent), transparent 60%);
}
.cfg-ubic-mapa.listo .cfg-ubic-mapa-vacio{ background: color-mix(in srgb, var(--bg-panel) 55%, transparent); }
.cfg-ubic-mapa.con-pin .cfg-ubic-mapa-vacio{ display:none; }
.cfg-ubic-mapa-vacio svg{ width:30px; height:30px; fill:none; stroke: var(--accent); stroke-width:1.8; }
.cfg-ubic-mapa-vacio span{ max-width:240px; font-weight:600; color: var(--text); background: var(--bg-panel); padding:6px 12px; border-radius:99px; border:1px solid var(--line); }
.cfg-ubic-pin{ background:none; border:0; }
.cfg-ubic-pin span{ display:block; width:40px; height:48px; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); animation: v652-pin .35s cubic-bezier(.2,1.4,.4,1) both; cursor:grab; }
.cfg-ubic-pin svg{ width:40px; height:48px; fill: var(--accent-vivido); stroke:#1d1300; stroke-width:1.2; }
.cfg-ubic-pin svg circle{ fill:#1d1300; stroke:none; }
.leaflet-marker-dragging .cfg-ubic-pin span, .cfg-ubic-pin.leaflet-drag-target span{ transform: translateY(-6px); cursor:grabbing; }
@keyframes v652-pin{ from{ transform: translateY(-18px); opacity:0; } to{ transform:none; opacity:1; } }
.cfg-ubic-pie{ display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; padding:12px; border-top:1px solid var(--line); }
.cfg-ubic-pie .cfg-ubic-estado{ flex:1 1 220px; }
.cfg-ubic-estado svg{ stroke: var(--ok); }
.cfg-ubic-botones .btn-small{ display:inline-flex; align-items:center; gap:6px; }
.cfg-ubic-botones .btn-small svg{ width:15px; height:15px; fill:none; stroke: currentColor; stroke-width:2; stroke-linecap:round; }
.cfg-ubic > .cfg-ubic-check{ padding:12px; border-top:1px solid var(--line); }

/* ---------------- Notificaciones: estado del permiso (pintarPermisoNotif en app.js) ---------------- */
.notif-permiso{
  display:grid; grid-template-columns: 42px minmax(0,1fr); gap:6px 12px; align-items:center;
  padding:14px; margin-bottom:14px; border-radius:16px; border:1px solid color-mix(in srgb, var(--accent-vivido) 35%, var(--line));
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent-vivido) 14%, transparent), transparent 60%), var(--bg-panel-2);
}
.notif-permiso.oculto{ display:none; }
.notif-permiso.estado-denied{ border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); background: radial-gradient(120% 140% at 0% 0%, var(--warn-soft), transparent 60%), var(--bg-panel-2); }
.notif-permiso.estado-granted{ border-color: color-mix(in srgb, var(--ok) 40%, var(--line)); background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--ok) 14%, transparent), transparent 60%), var(--bg-panel-2); }
.notif-permiso-ico{ width:42px; height:42px; border-radius:50%; display:grid; place-items:center; background: var(--accent-vivido); color:#1d1300; }
.notif-permiso-ico.bloq{ background: var(--warn); color:#fff; }
.notif-permiso-ico.ok{ background: var(--ok); color:#fff; }
.notif-permiso-ico svg{ width:21px; height:21px; fill:none; stroke: currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.notif-permiso-txt{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.notif-permiso-txt b{ font-size:0.95rem; }
.notif-permiso-txt span{ font-size:0.82rem; color: var(--text-dim); line-height:1.4; }
.notif-permiso > .btn-small{ grid-column: 1 / -1; justify-self:stretch; margin-top:6px; min-height:42px; }
.notif-permiso-pasos{ grid-column: 1 / -1; margin:4px 0 0; padding:0; list-style:none; counter-reset: paso; display:flex; flex-direction:column; gap:6px; }
.notif-permiso-pasos li{ counter-increment: paso; display:flex; align-items:center; gap:10px; font-size:0.86rem; line-height:1.35; padding:8px 10px; border-radius:12px; background: color-mix(in srgb, var(--text) 4%, transparent); }
.notif-permiso-pasos li::before{ content: counter(paso); flex-shrink:0; width:22px; height:22px; border-radius:50%; display:grid; place-items:center; font-size:0.74rem; font-weight:800; background: var(--warn); color:#fff; }

/* ---------------- Turnos › Ver turnos en compu: la lista llega hasta abajo de la pantalla ----------------
   Antes tenía un tope fijo de 420px y quedaba un hueco grande debajo en pantallas altas. */
@media (min-width: 860px){
  .turnos-buscar-resultados{ max-height: max(420px, calc(100dvh - 262px)); }
}

/* ---------------- Inicio: botones Nuevo turno / Nueva venta / Nuevo gasto ----------------
   En columnas angostas (compu con la barra lateral, celulares chicos) el texto se cortaba ("Nuevo turn").
   Si no entran en fila, el ícono pasa arriba del texto. */
.ini-acciones{ container-type: inline-size; }
.ini-accion-label{ overflow:hidden; text-overflow:ellipsis; max-width:100%; }
@container (max-width: 440px){
  .ini-acciones{ grid-template-columns: repeat(3, minmax(0,1fr)); gap:8px; }
  .ini-accion{ flex-direction:column; align-items:flex-start; gap:10px; padding:12px; }
  .ini-accion-txt{ width:100%; }
  .ini-accion-label{ white-space:normal; line-height:1.2; }
}
