/* ============================================================
   PetroBox · Centro de Inteligencia — Design tokens & UI
   Tema oscuro premium por defecto · acento configurable
   ============================================================ */

:root {
  /* Espaciado (múltiplos de 4) */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px;
  /* Radios */
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 24px;
  /* Animación */
  --ease: cubic-bezier(0.33, 1, 0.68, 1);
  --t-fast: 180ms; --t-slow: 260ms;
  /* ACENTO · Easy Pay. El amarillo de la marca, el mismo `--acc` que usa el POS
     de cada billar (admin.html) y `C.primary` en la app Flutter: la marca es una
     sola y se cambia en un lugar por producto.
     `--accent-ink` es OBLIGATORIO cada vez que el amarillo va de FONDO: blanco
     sobre #FFC500 da 1.9:1 y no se lee ni de cerca. En negro da 12:1. Antes el
     acento era violeta y el blanco encima funcionaba, así que hay `color:#fff`
     desperdigado por la hoja — todos esos son ahora tinta negra. */
  --accent: #FFC500;
  --accent-2: #FFA800;          /* variante para degradados */
  --accent-soft: rgba(255,197,0,.15);
  --accent-rgb: 255,197,0;
  --accent-ink: #14110A;        /* lo que va ENCIMA del amarillo */
  --brand-text: #FFC500;        /* acento claro en dark / oscuro en light */
  /* Costos siempre en ámbar */
  --amber: #F9A826;
  --amber-soft: rgba(249,168,38,.14);
  /* Semánticos */
  --green: #2EB872; --green-soft: rgba(46,184,114,.16);
  --red: #E5533D;   --red-soft: rgba(229,83,61,.16);
  --blue: #2D8CFF;  --blue-soft: rgba(45,140,255,.16);
  --gold: #E9B949;  --silver: #B8C0CC; --bronze: #CD7F45;
}

/* ---------- Tema oscuro (default) ---------- */
[data-theme="dark"] {
  /* El oscuro NO es gris neutro: lleva una pizca del ámbar de la marca. Un
     #121212 plano al lado de un logo amarillo se ve como dos productos
     distintos pegados; con el fondo tibio, el amarillo pertenece a la pantalla
     en vez de estar apoyado encima. Es poquísimo —2 o 3 puntos de rojo sobre
     azul— y alcanza: el ojo lo lee como temperatura, no como color. */
  --bg: #131110;
  --surface: #1C1917;
  --surface-2: #272320;
  --surface-3: #14161D;       /* tiles oscuros control center */
  --text: #F3F3F3;
  --text-2: rgba(255,255,255,.70);
  --text-muted: rgba(255,255,255,.38);
  --divider: rgba(255,214,120,.11);        /* el borde también, tibio */
  --shadow: 0 4px 16px rgba(0,0,0,.45);
  --hover: rgba(255,255,255,.04);
  --scrim: rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ---------- Tema claro ---------- */
[data-theme="light"] {
  --bg: #F8F5EE;
  --surface: #FFFFFF;
  --surface-2: #F1ECE1;
  --surface-3: #232733;
  --text: #1A1A1A;
  --text-2: rgba(26,26,26,.66);
  --text-muted: rgba(26,26,26,.40);
  --divider: rgba(26,26,26,.10);
  --shadow: 0 6px 18px rgba(60,50,30,.10);
  --hover: rgba(0,0,0,.03);
  --scrim: rgba(20,16,8,.40);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }   /* el atributo hidden gana a .login/.app/.modal/.side-sheet */
html, body { height: 100%; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background var(--t-slow) var(--ease), color var(--t-slow) var(--ease);
}
h1, h2, h3, .kpi-val, .logo, .brand-num { font-family: 'Poppins', 'Inter', sans-serif; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--divider); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
input { font-family: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

/* ============================================================ Layout */
.app { display: flex; min-height: 100vh; }

/* La barra lateral, con su propio degradado. Plana y del mismo gris que el
   contenido, la pantalla es un solo rectángulo sin jerarquía: no se sabe dónde
   termina la navegación y dónde empieza lo que se está mirando. El degradado la
   separa sin necesidad de una línea más fuerte. */
.sidebar {
  width: 248px; flex-shrink: 0;
  background: linear-gradient(180deg, #201C18 0%, var(--surface) 42%, #191614 100%);
  border-right: 1px solid var(--divider);
  display: flex; flex-direction: column;
  padding: var(--s5) var(--s4);
  position: sticky; top: 0; height: 100vh;
  transition: width var(--t-slow) var(--ease), transform var(--t-slow) var(--ease);
  z-index: 40;
}
/* ============================================================
   LA BANDA DE MARCA · cabecera de la barra lateral
   ------------------------------------------------------------
   La barra y la marca tienen que leerse como UNA pieza. Por eso la banda sangra
   hasta los bordes (los márgenes negativos cancelan el padding de .sidebar), y
   el degradado de la banda muere justo en el color con el que sigue la barra:
   no hay corte, hay continuación.
   ============================================================ */
.side-brand{
  position: relative; overflow: hidden;
  margin: calc(var(--s5) * -1) calc(var(--s4) * -1) var(--s4);
  padding: var(--s5) var(--s4) var(--s4);
  background:
    radial-gradient(90% 120% at 50% -20%, rgba(255,197,0,.20), transparent 62%),
    linear-gradient(180deg, #2A241B 0%, #221E19 55%, var(--surface) 100%);
  border-bottom: 1px solid rgba(255,197,0,.22);
}
/* La rejilla: lo que le da el aire de instrumento. Son líneas de 1 px cada 14,
   tan bajas que no se ven como líneas — se sienten como textura. */
.sb-rejilla{
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(rgba(255,197,0,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,197,0,.055) 1px, transparent 1px);
  background-size: 14px 14px;
  mask-image: radial-gradient(80% 90% at 50% 30%, #000 30%, transparent 78%);
}
/* El barrido del escáner, lento y una vez cada tanto: es el gesto de la marca,
   y a este ritmo se nota sin distraer de la navegación. */
.sb-scan{
  position: absolute; left: 0; right: 0; height: 38%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(255,197,0,.16), transparent);
  animation: sbScan 7s var(--ease) 1.2s infinite;
}
@keyframes sbScan{
  0%,72%   { transform: translateY(-120%); opacity: 0 }
  78%      { opacity: 1 }
  100%     { transform: translateY(300%); opacity: 0 }
}
.sb-marca{
  position: relative; display: block; width: 74%; max-width: 158px; margin: 0 auto;
  filter: drop-shadow(0 3px 14px rgba(255,197,0,.35));
}
/* El hilo bajo la marca, con un punto que respira: la señal de "esto está vivo"
   que en un panel de monitoreo vale más que cualquier adorno. */
.sb-linea{ position: relative; height: 1px; margin: var(--s4) 6px var(--s3);
  background: linear-gradient(90deg, transparent, rgba(255,197,0,.5), transparent); }
.sb-linea > i{ position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 9px var(--accent);
  animation: sbLate 2.4s ease-in-out infinite; }
@keyframes sbLate{ 0%,100%{ opacity: 1; transform: scale(1) } 50%{ opacity: .45; transform: scale(.75) } }
.sb-sub{ position: relative; text-align: center; font-size: 9px; font-weight: 700;
  letter-spacing: 2.6px; color: rgba(255,214,120,.62); }
/* Sin movimiento para quien lo pidió: la banda queda, el barrido y el latido no. */
@media (prefers-reduced-motion: reduce){
  .sb-scan{ display: none }
  .sb-linea > i{ animation: none }
}

.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 0; flex: 1; }
/* El renglón activo. Antes era un bloque amarillo lavado de punta a punta: el
   color pesaba más que el texto y desde lejos la barra se leía como una mancha.
   Ahora la marca es una BARRITA a la izquierda —donde el ojo entra a leer— y el
   fondo apenas se insinúa. El ícono también se pinta: dos señales chicas se
   notan más que una grande. */
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: var(--s3);
  padding: 10px var(--s3) 10px 14px; border-radius: var(--r-sm);
  color: var(--text-2); font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; overflow: hidden;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(255,197,0,.16), rgba(255,197,0,.02)); color: var(--brand-text);
  box-shadow: inset 0 0 0 1px rgba(255,197,0,.10); }
/* La barrita del activo, encendida: no es un borde, es un indicador. El halo la
   despega del fondo igual que el punto de la banda. */
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--accent);
  box-shadow: 0 0 10px rgba(255,197,0,.75);
}
.nav-item .ico { flex-shrink: 0; opacity: .82; }
.nav-item.active .ico, .nav-item:hover .ico { opacity: 1; }
/* Un rótulo arriba de los renglones: sin él la lista arranca pegada a la marca
   y no se sabe si es navegación o parte del encabezado. */
/* El rótulo, con su hilo a la derecha: separa sin gastar una línea entera. */
.nav-tit { display: flex; align-items: center; gap: 9px;
  font-size: 9px; font-weight: 700; letter-spacing: 2px; color: rgba(255,214,120,.45);
  padding: 0 var(--s3) 9px; text-transform: uppercase; }
.nav-tit::after { content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, rgba(255,197,0,.22), transparent); }

.side-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s2);
  padding-top: var(--s3); margin-top: var(--s4); border-top: 1px solid var(--divider); }
.side-collapse { width: 34px; height: 34px; border-radius: 9px; color: var(--text-muted); display: grid; place-items: center; }
.side-collapse:hover { background: var(--hover); color: var(--text); }
.online { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.dot-online { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }

/* Sidebar colapsado (solo iconos) */
.app.collapsed .sidebar { width: 70px; padding-left: var(--s3); padding-right: var(--s3); }
.app.collapsed .side-brand-txt,
.app.collapsed .nav-item span:not(.ico),
.app.collapsed .online-txt { display: none; }
.app.collapsed .side-brand { justify-content: center; padding-left: 0; padding-right: 0; }
.app.collapsed .nav-item { justify-content: center; }
.app.collapsed .side-foot { flex-direction: column; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ============================================================ Topbar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s4) var(--s6);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--divider);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 22px; font-weight: 700; letter-spacing: -.4px; }
.topbar-sub { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: var(--s2); }

.chip-select {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--divider);
  color: var(--text-2); font-weight: 600; font-size: 13px;
  transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.chip-select:hover { border-color: var(--accent); color: var(--text); }
.chip-select .caret { width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; border-top: 5px solid currentColor; opacity: .6; margin-left: 2px; }

.search { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-md); color: var(--text-muted); }
.search input { border: none; background: none; outline: none; color: var(--text); font-size: 13px; width: 150px; }
.search input::placeholder { color: var(--text-muted); }

.icon-btn { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--divider); color: var(--text-2); display: grid; place-items: center; position: relative; transition: border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease); }
.icon-btn:hover { border-color: var(--accent); color: var(--text); }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--surface); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }

/* ============================================================ Content */
.content { padding: var(--s6); max-width: 1480px; width: 100%; margin: 0 auto; }
.block { margin-bottom: var(--s8); }
.block-head { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.block-title { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; color: var(--text-muted); text-transform: uppercase; white-space: nowrap; }
.block-line { flex: 1; height: 1px; background: var(--divider); }

.grid { display: grid; gap: var(--s4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-kpi { grid-template-columns: repeat(5, 1fr); }
.span-2 { grid-column: span 2; }

/* ============================================================ DashCard */
.card {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: var(--s5);
}
.card-head { display: flex; align-items: flex-start; gap: var(--s3); margin-bottom: var(--s4); }
.card-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.card-htxt h2 { font-size: 15px; font-weight: 700; letter-spacing: -.2px; }
.card-htxt p { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 1px; }

/* KPI */
.kpi { display: flex; flex-direction: column; gap: var(--s3); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.kpi-delta { font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.kpi-delta.up { color: var(--green); background: var(--green-soft); }
.kpi-delta.down { color: var(--red); background: var(--red-soft); }
.kpi-val { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.kpi-title { font-size: 13px; font-weight: 600; color: var(--text-2); }

/* ============================================================ Chart línea */
.linechart { width: 100%; height: 240px; display: block; }
.lc-tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: #0c0c0c; color: #fff; border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; padding: 8px 11px; font-size: 12px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); transform: translate(-50%, -120%); white-space: nowrap;
}
.lc-tooltip .lc-t-lbl { color: rgba(255,255,255,.6); font-size: 11px; font-weight: 500; }
.lc-axis { fill: var(--text-muted); font-size: 11px; font-weight: 600; font-family: 'Inter'; }
.lc-line { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: lcDraw 1.2s var(--ease) forwards; }
@keyframes lcDraw { to { stroke-dashoffset: 0; } }
.lc-area { opacity: 0; animation: lcAreaIn .85s var(--ease) .35s forwards; }
@keyframes lcAreaIn { to { opacity: 1; } }
.lc-dot { opacity: 0; animation: lcDotIn .35s var(--ease) forwards; transition: r .15s var(--ease); }
@keyframes lcDotIn { to { opacity: 1; } }
.lc-hit { cursor: pointer; }

/* ============================================================ Leaderboard */
.lb-row { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; }
.lb-row + .lb-row { border-top: 1px solid var(--divider); }
.lb-medal { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 12px; color: #1a1a1a; flex-shrink: 0; }
.lb-av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; }
.lb-mid { flex: 1; min-width: 0; }
.lb-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-meta { font-size: 11.5px; color: var(--text-muted); }
.lb-bar { height: 4px; border-radius: 3px; background: var(--surface-2); margin-top: 6px; overflow: hidden; }
.lb-bar > i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transform-origin: left; animation: barGrow .9s var(--ease); }
@keyframes barGrow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.lb-right { text-align: right; flex-shrink: 0; }
.lb-val { font-weight: 700; font-size: 13.5px; }
.lb-grow { font-size: 11.5px; font-weight: 700; }
.lb-grow.up { color: var(--green); } .lb-grow.down { color: var(--red); }

/* ============================================================ Donut */
.donut-wrap { display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap; }
.donut { position: relative; width: 160px; height: 160px; flex-shrink: 0; }
.donut svg { animation: donutPop .6s var(--ease); transform-origin: center; }
@keyframes donutPop { from { transform: scale(.94); opacity: .3; } to { transform: scale(1); opacity: 1; } }
.donut-seg { opacity: 0; animation: segIn .55s var(--ease) forwards; transition: stroke-width .15s var(--ease); }
@keyframes segIn { to { opacity: 1; } }
.donut-seg:hover { stroke-width: 21; cursor: pointer; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; line-height: 1.05; gap: 2px; }
.donut-center b { font-size: 24px; font-family: 'Poppins'; font-weight: 800; display: block; }
.donut-center span { font-size: 10.5px; color: var(--text-2); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
.legend { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 9px; }
.legend-row { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-name { flex: 1; color: var(--text-2); }
.legend-pct { font-weight: 700; }
.legend-amt { color: var(--text-muted); font-size: 12px; min-width: 78px; text-align: right; }

/* ============================================================ Lista clave-valor / planes */
.kv-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; font-size: 13.5px; }
.kv-row + .kv-row { border-top: 1px solid var(--divider); }
.kv-key { color: var(--text-2); display: flex; align-items: center; gap: 9px; }
.kv-val { font-weight: 700; }
.dotc { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }

.plan-row { display: flex; align-items: center; gap: var(--s3); padding: 10px 0; }
.plan-row + .plan-row { border-top: 1px solid var(--divider); }
.plan-mid { flex: 1; }
.plan-name { font-weight: 600; font-size: 13.5px; }
.plan-meta { font-size: 11.5px; color: var(--text-muted); }
.plan-mrr { font-weight: 700; color: var(--brand-text); }

/* ============================================================ Heatmap */
.heat { display: grid; grid-template-columns: 54px repeat(4, 1fr); gap: 6px; align-items: center; }
.heat-h { font-size: 10.5px; font-weight: 700; color: var(--text-muted); text-align: center; text-transform: uppercase; letter-spacing: .4px; }
.heat-day { font-size: 12px; font-weight: 600; color: var(--text-2); }
.heat-cell { height: 30px; border-radius: 7px; background: var(--accent); transition: transform var(--t-fast) var(--ease); }
.heat-cell:hover { transform: scale(1.06); }
.heat-legend { display: flex; align-items: center; gap: 7px; justify-content: flex-end; margin-top: var(--s4); font-size: 11px; color: var(--text-muted); }
.heat-legend i { width: 16px; height: 12px; border-radius: 3px; }

/* ============================================================ Alertas */
.alert-card { display: flex; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); border: 1px solid var(--divider); background: var(--surface-2); }
.alert-card + .alert-card { margin-top: var(--s3); }
.alert-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.alert-lvl-alto { border-left: 3px solid var(--red); }
.alert-lvl-medio { border-left: 3px solid var(--amber); }
.alert-lvl-bajo { border-left: 3px solid var(--blue); }
.alert-title { font-weight: 700; font-size: 13.5px; }
.alert-detail { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }

/* ============================================================ Centro de decisiones */
.dec-grid { grid-template-columns: repeat(4, 1fr); }
.dec-card { border-radius: var(--r-lg); padding: var(--s5); color: #fff; position: relative; overflow: hidden; min-height: 116px; display: flex; flex-direction: column; justify-content: space-between; }
.dec-card .dec-ico { position: absolute; top: var(--s4); right: var(--s4); opacity: .35; }
.dec-label { font-size: 10.5px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: .85; }
.dec-val { font-size: 21px; font-weight: 800; font-family: 'Poppins'; letter-spacing: -.3px; margin: 6px 0 2px; }
.dec-detail { font-size: 12px; opacity: .85; }

/* ============================================================ Feed tiempo real */
.feed-row { display: flex; align-items: flex-start; gap: var(--s3); padding: 11px 0; }
.feed-row + .feed-row { border-top: 1px solid var(--divider); }
.feed-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.feed-mid { flex: 1; }
.feed-txt { font-size: 13.5px; }
.feed-txt b { font-weight: 700; }
.feed-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

/* ============================================================ Ventas/Costos — selector negocio */
.biz-search { margin-bottom: var(--s4); }
.biz-grid { grid-template-columns: repeat(3, 1fr); }
.biz-card { display: flex; align-items: center; gap: var(--s3); padding: var(--s4); border-radius: var(--r-md); border: 1px solid var(--divider); background: var(--surface); cursor: pointer; transition: border-color var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); position: relative; }
.biz-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.biz-card.sel { border-color: var(--accent); background: var(--accent-soft); }
.biz-av { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; flex-shrink: 0; }
/* El logo llena su cuadradito: sin padding —un marco de aire adentro de otro
   marco de aire es lo que hacía que el dibujo quedara diminuto— y con el recorte
   o el ajuste que decida encuadrarLogo() mirando la imagen. El fondo también lo
   pone esa función, copiado del propio logo, así que acá no se fija ninguno. */
.biz-av-logo { overflow: hidden; padding: 0; }
.biz-av-logo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
/* Logo sin fondo: gris del panel, entero y con aire. Lo pone encuadrarLogo()
   cuando ve las esquinas transparentes. */
.biz-av-trans { background: rgba(255,255,255,.07) !important; padding: 4px; }
.biz-av-trans img { object-fit: contain !important; }
/* El logo de fondo negro sobre una tarjeta casi negra no tiene borde: deja de
   leerse como un cuadrito y se lee como un agujero. El aro se lo devuelve. Va
   por dentro (`inset`) para no agrandar la caja ni empujar lo que tiene al lado,
   y lo pone el JS solo cuando el fondo del logo es oscuro de verdad. */
.biz-av-borde { box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.biz-name { font-weight: 600; font-size: 13.5px; }
.biz-meta { font-size: 11.5px; color: var(--text-muted); }
.biz-check { position: absolute; top: 10px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: none; place-items: center; }
.biz-card.sel .biz-check { display: grid; }

.period-chips { display: flex; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s4); }
.pchip { padding: 7px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--divider); font-size: 13px; font-weight: 600; color: var(--text-2); }
.pchip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.total-card { display: flex; align-items: center; justify-content: space-between; padding: var(--s5); border-radius: var(--r-lg); margin-bottom: var(--s4); color: #fff; }
.total-label { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; opacity: .85; }
.total-val { font-size: 30px; font-weight: 800; font-family: 'Poppins'; letter-spacing: -.5px; margin-top: 2px; }
.total-sub { font-size: 12px; opacity: .85; }

.mov-row { display: flex; align-items: center; gap: var(--s3); padding: 12px 0; cursor: pointer; }
.mov-row + .mov-row { border-top: 1px solid var(--divider); }
.mov-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.mov-mid { flex: 1; min-width: 0; }
.mov-title { font-weight: 600; font-size: 13.5px; }
.mov-meta { font-size: 11.5px; color: var(--text-muted); }
.mov-right { display: flex; align-items: center; gap: var(--s3); }
.mov-amt { font-weight: 700; font-size: 14px; white-space: nowrap; }
.mov-chev { color: var(--text-muted); }

.pill { font-size: 11px; font-weight: 700; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.pill-green { color: var(--green); background: var(--green-soft); }
.pill-amber { color: var(--amber); background: var(--amber-soft); }
.pill-blue { color: var(--blue); background: var(--blue-soft); }

/* ============================================================ Control center */
.eco-grid { grid-template-columns: repeat(4, 1fr); }
.eco-tile { background: var(--surface-3); border: 1px solid var(--divider); border-radius: var(--r-lg); padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.eco-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; }
.eco-num { font-size: 30px; font-weight: 800; font-family: 'Poppins'; color: #fff; line-height: 1; }
.eco-lbl { font-size: 12.5px; color: rgba(255,255,255,.6); font-weight: 600; }

.health-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.health-row + .health-row { border-top: 1px solid var(--divider); }
.health-name { display: flex; align-items: center; gap: 9px; font-size: 13.5px; color: var(--text-2); }
.health-state { font-size: 12px; font-weight: 700; }

.audit-row { display: flex; align-items: flex-start; gap: var(--s3); padding: 10px 0; }
.audit-row + .audit-row { border-top: 1px solid var(--divider); }
.audit-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.audit-txt { flex: 1; font-size: 13px; }
.audit-time { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }

/* ============================================================ Configuración */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding: 13px 0; }
.set-row + .set-row { border-top: 1px solid var(--divider); }
.set-name { font-weight: 600; font-size: 14px; }
.set-desc { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.switch { width: 44px; height: 26px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--divider); position: relative; flex-shrink: 0; transition: background var(--t-fast) var(--ease); }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform var(--t-fast) var(--ease); box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { transform: translateX(18px); }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--divider); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button { padding: 6px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.seg button.active { background: var(--accent); color: var(--accent-ink); }

.accent-dots { display: flex; gap: var(--s3); }
.accent-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; border: 2px solid transparent; }
.accent-dot.active { border-color: var(--text); }
.accent-dot .ck { color: #fff; opacity: 0; }
.accent-dot.active .ck { opacity: 1; }

/* ============================================================ Popover / sheets */
.popover { position: fixed; z-index: 80; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-md); box-shadow: 0 12px 36px rgba(0,0,0,.4); padding: 6px; min-width: 170px; }
.pop-item { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 9px; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; }
.pop-item:hover { background: var(--hover); color: var(--text); }
.pop-item.active { color: var(--brand-text); background: var(--accent-soft); }

.sheet-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 90; backdrop-filter: blur(2px); }
.side-sheet { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw; background: var(--surface); border-left: 1px solid var(--divider); z-index: 95; padding: var(--s5); overflow-y: auto; animation: slideIn var(--t-slow) var(--ease); }
.bottom-sheet { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 480px; max-width: 96vw; background: var(--surface); border: 1px solid var(--divider); border-bottom: none; border-radius: var(--r-xl) var(--r-xl) 0 0; z-index: 95; padding: var(--s6); animation: slideUp var(--t-slow) var(--ease); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideUp { from { transform: translate(-50%, 24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s5); }
.sheet-head h3 { font-size: 18px; font-weight: 700; }
.sheet-x { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--text-muted); }
.sheet-x:hover { background: var(--hover); color: var(--text); }
.detail-amt { font-size: 32px; font-weight: 800; font-family: 'Poppins'; letter-spacing: -.5px; margin: var(--s2) 0 var(--s4); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4) var(--s5); }
.detail-k { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); }
.detail-v { font-size: 14px; font-weight: 600; margin-top: 3px; }

/* ============================================================ Iconos */
.ico { display: inline-flex; width: 18px; height: 18px; }
.ico svg { width: 100%; height: 100%; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* ============================================================ Login
   EL FONDO ES EL MISMO QUE EL DEL SPLASH, y no por gusto: el splash promete en
   su propio comentario que abajo está la misma foto para que al desvanecerse
   "se prenda la luz" en vez de verse un corte. No era cierto —el login tenía un
   degradado plano— y la pantalla quedaba vacía, con la tarjeta flotando en
   negro. Foto y velo son idénticos a los de #splash: lo único que cambia al
   terminar la entrada es el logo animado por la tarjeta.
   ------------------------------------------------------------ */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--s6);
  background: url('img/login-fondo.webp') center/cover no-repeat #0a0908; }
/* El mismo velo que #splash::before, al mismo valor. Si se cambia uno hay que
   cambiar el otro: son las dos mitades de una transición. */
.login::before { content: ''; position: absolute; inset: 0;
  background: radial-gradient(62% 62% at 50% 48%, rgba(255,197,0,.12), transparent 68%), rgba(6,6,7,.84); }
/* La tarjeta deja ver la foto: opaca sobre una foto es un rectángulo pegado
   encima, y lo que se quiere es que esté APOYADA en el salón. El blur es lo que
   mantiene el texto legible sin tapar la imagen. */
.login-card { position: relative; width: 100%; max-width: 380px;
  background: rgba(22,22,24,.72); -webkit-backdrop-filter: blur(14px) saturate(1.1); backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid rgba(255,255,255,.10); border-radius: var(--r-xl);
  box-shadow: 0 28px 70px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.06);
  padding: 40px 32px; text-align: center; animation: fade var(--t-slow) var(--ease); }
/* Sin backdrop-filter (Firefox viejo, webviews) la tarjeta se opaca: legible
   igual, sin la foto atrás. Mejor eso que texto sobre una foto a media luz. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .login-card { background: rgba(18,18,20,.94); }
}
/* Los corchetes del encuadre, el motivo de la marca: los mismos que dibuja el
   splash y los que trae el logo. Enmarcan la tarjeta en vez de decorarla. */
.login-card::before, .login-card::after { content: ''; position: absolute; width: 26px; height: 26px;
  border: 2px solid var(--accent); opacity: .55; pointer-events: none; }
.login-card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; border-radius: var(--r-xl) 0 0 0; }
.login-card::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; border-radius: 0 0 var(--r-xl) 0; }
/* La marca entera, sin recortar. `contain` y no `cover`: con cover los cuatro
   corchetes del logo quedan afuera del cuadro y lo que se ve es un fragmento. */
.login-logo { width: 150px; height: auto; margin: 0 auto var(--s4); display: block; object-fit: contain;
  filter: drop-shadow(0 6px 22px rgba(255,197,0,.28)); }
.login-title { font-size: 20px; font-weight: 700; letter-spacing: -.3px; }
.login-sub { font-size: 10.5px; font-weight: 700; letter-spacing: 1.2px; color: var(--text-muted); margin-top: 5px; }
/* BLANCO, como pide la guía de marca de Google para su botón — y de paso es lo
   único claro de la pantalla, así que se lee como LA acción y no como un
   renglón más. Antes era una tarjeta oscura sobre una tarjeta oscura. */
.btn-google { display: flex; align-items: center; justify-content: center; gap: 11px; width: 100%;
  margin-top: var(--s6); padding: 13px; border-radius: var(--r-md);
  background: #fff; border: 1px solid rgba(0,0,0,.10); font-weight: 600; font-size: 14px; color: #1f1f1f;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  transition: box-shadow var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn-google:hover:not([disabled]) { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(255,197,0,.28), 0 0 0 1px var(--accent); }
.btn-google:active:not([disabled]) { transform: translateY(0); }
.btn-google[disabled] { opacity: .5; cursor: not-allowed; }
.btn-google .g { width: 18px; height: 18px; flex-shrink: 0; display: block; }
/* Sobre el velo de la foto el gris de --text-muted se apaga demasiado. */
.login-hint { font-size: 12px; color: rgba(255,255,255,.62); margin-top: var(--s4); }
.login-hint b { color: rgba(255,255,255,.86); }
.login-error { font-size: 12.5px; color: var(--red); margin-top: var(--s3); background: var(--red-soft); padding: 9px 12px; border-radius: 10px; }

/* Menú de usuario (popover) */
.pop-user { padding: 10px 12px; border-bottom: 1px solid var(--divider); margin-bottom: 6px; }
.pop-user-name { font-weight: 700; font-size: 13px; }
.pop-user-mail { font-size: 12px; color: var(--text-muted); word-break: break-all; }
.pop-user-rol { font-size: 11px; color: var(--brand-text); font-weight: 600; margin-top: 3px; }
.avatar { cursor: pointer; transition: transform var(--t-fast) var(--ease); }
.avatar:hover { transform: scale(1.05); }

.only-mobile { display: none; }
.fade-in { animation: fade var(--t-slow) var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.empty { text-align: center; padding: var(--s8); color: var(--text-muted); font-size: 13.5px; }

/* ============================================================ Operativo: pills, botones, utilidades */
.pill-red { color: var(--red); background: var(--red-soft); }
.muted { color: var(--text-muted); }
.small { font-size: 11.5px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 11px; }
.kpi-hint { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--divider); color: var(--text); font-weight: 600; font-size: 13px; transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease), transform var(--t-fast) var(--ease); }
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn .ico { width: 16px; height: 16px; }
.btn.sm { padding: 7px 11px; font-size: 12.5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger-outline { background: transparent; border-color: var(--red); color: var(--red); }
.btn.block { display: flex; width: 100%; justify-content: center; padding: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

/* ---- Tablas ---- */
.table-card { padding: 0; overflow: hidden; }
.table-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s4) var(--s5); border-bottom: 1px solid var(--divider); flex-wrap: wrap; }
.table-head-actions { display: flex; gap: var(--s2); }
.filtros { display: flex; gap: var(--s2); flex-wrap: wrap; }
.chip { padding: 7px 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--divider); font-size: 12.5px; font-weight: 600; color: var(--text-2); transition: all var(--t-fast) var(--ease); }
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.table-scroll { overflow-x: auto; }
.dtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dtable thead th { text-align: left; padding: 12px var(--s5); font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); cursor: pointer; white-space: nowrap; user-select: none; }
.dtable thead th:hover { color: var(--text-2); }
.dtable thead th.num, .dtable td.num { text-align: right; }
.dtable .arrow { color: var(--brand-text); }
.dtable tbody td { padding: 12px var(--s5); border-top: 1px solid var(--divider); }
.dtable tbody tr.clickable { cursor: pointer; transition: background var(--t-fast) var(--ease); }
.dtable tbody tr.clickable:hover { background: var(--hover); }
.dt-biz { display: flex; align-items: center; gap: var(--s3); }
.dt-bn { font-weight: 600; }
.dt-bo { font-size: 11.5px; color: var(--text-muted); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s5); border-top: 1px solid var(--divider); font-size: 12.5px; }
.pager-ctrls { display: flex; align-items: center; gap: var(--s3); }

/* ---- Toasts ---- */
.toasts { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1a1a1a; color: #fff; border: 1px solid rgba(255,255,255,.14); padding: 11px 18px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.45); animation: slideUp var(--t-slow) var(--ease); transition: opacity var(--t-fast), transform var(--t-fast); }
.toast.ok { border-color: var(--green); }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 110; display: grid; place-items: center; background: var(--scrim); backdrop-filter: blur(3px); padding: var(--s5); }
.modal-card { width: 100%; max-width: 460px; max-height: 88vh; overflow-y: auto; overflow-x: hidden; background: var(--surface); border: 1px solid var(--divider); border-radius: var(--r-xl); box-shadow: 0 24px 60px rgba(0,0,0,.5); padding: var(--s6); animation: fade var(--t-slow) var(--ease); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s5); }
.modal-head h3 { font-size: 18px; font-weight: 700; }

/* ---- Form ---- */
.form { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
/* min-width:0 en todos lados: el ancho propio del <input> (unos 180px) no debe
   empujar la columna del grid ni desbordar la tarjeta a lo ancho. */
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--text-2); min-width: 0; }
.form .frow { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); min-width: 0; }
.form .frow > * { min-width: 0; }
.form input, .form select, .form textarea { width: 100%; min-width: 0; max-width: 100%; }
.form input, .form select, .form textarea, .cfg-edit input, .d-qr-row input, .d-qr-row select, .date-input {
  padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--divider); background: var(--surface-2); color: var(--text); font-size: 14px; outline: none; transition: border-color var(--t-fast) var(--ease); }
.form input[type=file] { padding: 8px 12px; }
.form input:focus, .form select:focus, .form textarea:focus, .date-input:focus, .cfg-edit input:focus { border-color: var(--accent); }

/* ---- QR ---- */
.qr-wrap { text-align: center; }
.qr-wrap p { color: var(--text-2); font-size: 13.5px; margin-bottom: var(--s4); }
.qr { width: 220px; height: 220px; border-radius: var(--r-md); background: #fff; padding: 10px; }
.token { font-family: ui-monospace, monospace; font-size: 11px; color: var(--text-muted); word-break: break-all; margin: var(--s3) 0; }

/* ---- Asistente (wizard) ---- */
.wz-steps { list-style: none; display: flex; flex-direction: column; gap: var(--s3); margin-bottom: var(--s4); }
.wz-step { display: flex; align-items: center; gap: var(--s3); padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--divider); background: var(--surface-2); }
.wz-ic { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--text-muted); background: var(--surface); flex-shrink: 0; }
.wz-step.ok .wz-ic { color: #fff; background: var(--green); }
.wz-step.error .wz-ic { color: #fff; background: var(--red); }
.wz-step.run .wz-ic { color: var(--brand-text); }
.wz-lbl { font-weight: 600; font-size: 13.5px; flex: 1; }
.wz-msg { font-size: 11.5px; color: var(--text-muted); width: 100%; flex-basis: 100%; padding-left: 38px; }
.wz-step { flex-wrap: wrap; }
.spin { width: 14px; height: 14px; border: 2px solid var(--divider); border-top-color: var(--brand-text); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wz-error { color: var(--red); background: var(--red-soft); padding: 12px 14px; border-radius: var(--r-md); font-size: 13px; margin-bottom: var(--s3); }

/* ---- Barras verticales ---- */
.bars { display: flex; align-items: flex-end; gap: var(--s3); height: 200px; padding-top: var(--s4); }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-val { font-size: 11px; font-weight: 700; color: var(--text-2); }
.bar-track { width: 100%; max-width: 46px; flex: 1; display: flex; align-items: flex-end; }
.bar-track > i { width: 100%; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--accent), var(--accent-soft)); display: block; animation: barUp .8s var(--ease); transform-origin: bottom; }
@keyframes barUp { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-lbl { font-size: 11px; color: var(--text-muted); font-weight: 600; }
/* MRR a todo el ancho: barras más altas y anchas */
.bars-mrr { height: 270px; gap: var(--s5); padding-top: var(--s5); }
.bars-mrr .bar-track { max-width: 96px; }
.bars-mrr .bar-track > i { border-radius: 12px 12px 5px 5px; }
.bars-mrr .bar-val { font-size: 13px; }
.bars-mrr .bar-lbl { font-size: 12.5px; }

/* ---- Barras horizontales ---- */
.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 38px; align-items: center; gap: var(--s3); font-size: 13px; }
.hbar-k { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 9px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.hbar-track > i { display: block; height: 100%; border-radius: 5px; animation: barGrow .8s var(--ease); transform-origin: left; }
.hbar-n { text-align: right; font-weight: 700; }

/* ---- Detalle de negocio (panel lateral) ---- */
.side-sheet.wide { width: 460px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border-radius: var(--r-md); padding: 4px; margin-bottom: var(--s4); }
.tab { flex: 1; padding: 8px; border-radius: 10px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.tab.active { background: var(--surface); color: var(--brand-text); box-shadow: var(--shadow); }
.d-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.d-box { background: var(--surface-2); border: 1px solid var(--divider); border-radius: var(--r-md); padding: 12px 14px; }
.d-box.d-block { grid-column: span 2; margin-top: var(--s3); }
.d-l { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--text-muted); }
.d-v { font-size: 17px; font-weight: 700; margin-top: 3px; word-break: break-word; }
.d-qr-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.d-qr-row input { width: 76px; }
.dev-card { border: 1px solid var(--divider); border-radius: var(--r-md); padding: 14px; margin-bottom: 10px; background: var(--surface-2); }
.dev-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 8px; }
.dev-name { font-weight: 700; font-size: 13px; display: flex; align-items: center; gap: 7px; }
.dev-name .ico { width: 15px; height: 15px; }
.dev-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 18px; font-size: 12.5px; }
.dv-row { display: flex; justify-content: space-between; gap: 10px; }
.dv-row span:last-child { font-weight: 600; text-align: right; }
.dev-actions { margin-top: 12px; display: flex; gap: 8px; justify-content: flex-end; }
.sheet-actions { display: flex; gap: var(--s2); margin-top: var(--s5); padding-top: var(--s4); border-top: 1px solid var(--divider); }

/* ---- Config ---- */
.cfg-edit { display: flex; gap: 8px; align-items: center; }
.cfg-edit input { width: 100px; }

/* ---- Reportes ---- */
.rep-head { gap: var(--s3); }
.rep-filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============================================================ Responsive */
@media (max-width: 1240px) {
  .grid-kpi { grid-template-columns: repeat(3, 1fr); }
  .dec-grid { grid-template-columns: repeat(2, 1fr); }
  .biz-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1040px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .app.drawer-open .sidebar { transform: translateX(0); }
  .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 39; opacity: 0; pointer-events: none; transition: opacity var(--t-slow) var(--ease); }
  .app.drawer-open .scrim { opacity: 1; pointer-events: auto; }
  .only-mobile { display: grid; }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: span 1; }
}
@media (max-width: 920px) { .only-wide { display: none; } }
@media (max-width: 760px) {
  .content { padding: var(--s4); }
  .topbar { padding: var(--s3) var(--s4); }
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .eco-grid { grid-template-columns: repeat(2, 1fr); }
  .biz-grid { grid-template-columns: 1fr; }
  .dec-grid { grid-template-columns: 1fr; }
  .topbar-title h1 { font-size: 18px; }
}
@media (max-width: 460px) {
  .grid-kpi { grid-template-columns: 1fr; }
  .form .frow { grid-template-columns: 1fr; }   /* dos campos por fila no entran */
}
.scrim { display: none; }

/* --- Sucursales, personal y equipos (ficha del billar) --------------------- */
/* La casilla de "puede entrar": la etiqueta va al lado del cuadrito, no arriba,
   porque acá el texto ES la opción y no el nombre de un campo. */
.form label.chk { flex-direction: row; align-items: center; gap: 9px; font-size: 13px; color: var(--text); }
.form label.chk input { width: auto; }
/* La matriz de roles. Se lee de una sola pasada: una fila por rol y una columna
   por lo que puede tocar. Sin bordes verticales — la separación la hace el
   espacio, que a esta densidad rinde más que una grilla. */
.roles-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.roles-tbl th { text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .4px; color: var(--text-muted); padding: 6px 10px 6px 0; white-space: nowrap; }
.roles-tbl td { padding: 9px 10px 9px 0; border-top: 1px solid var(--divider); vertical-align: top; }
.roles-tbl th:not(:first-child), .roles-tbl td:not(:first-child) { text-align: center; padding: 9px 0 9px 14px; }
.roles-tbl .roles-sep td { border-top: none; padding-top: 16px; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; color: var(--text-muted); }


/* ============================================================
   ENTRADA · la misma animación que el POS
   ------------------------------------------------------------
   Copiada de categorias/billares/admin.html con las rutas de imagen
   adaptadas (allá son absolutas, acá cuelgan de public/img). Es una copia y
   no un import porque son dos deployments distintos —el POS vive en
   billares-base y el panel en billares-panel— y no comparten árbol de
   archivos; el que las mantenga juntas es este comentario.
   ============================================================ */
#splash{position:fixed;inset:0;z-index:9998;display:grid;place-items:center;
  background:url('img/login-fondo.webp') center/cover no-repeat #0a0908;
  transition:opacity .5s ease,transform .5s ease}
/* Misma foto que el login, pero apagada: cuando el splash se desvanece, abajo
   está el mismo fondo y no se ve un corte, se ve que se prende la luz. */
#splash::before{content:'';position:absolute;inset:0;
  background:radial-gradient(62% 62% at 50% 48%,rgba(255,197,0,.12),transparent 68%),rgba(6,6,7,.84)}
#splash.sp-out{opacity:0;transform:scale(1.05);pointer-events:none}
.sp-logo{position:relative;--lw:min(52vmin,360px);width:var(--lw);aspect-ratio:1}
.sp-p{position:absolute;inset:0;opacity:0;background:center/contain no-repeat}
.sp-easy{background-image:url('img/splash-easy.png')}
.sp-pay {background-image:url('img/splash-pay.png')}
.sp-taco{background-image:url('img/splash-taco.png')}
.sp-bola{background-image:url('img/splash-bola.png')}
.sp-bill{background-image:url('img/splash-billares.png')}
.sp-tl>i,.sp-tr>i,.sp-bl>i,.sp-br>i{position:absolute;inset:0;display:block;
  background:url('img/splash-marco.png') center/contain no-repeat}
/* --- los cuatro corchetes: entran cada uno desde su diagonal --------------- */
.sp-tl>i{clip-path:inset(0 50% 50% 0)}
.sp-tr>i{clip-path:inset(0 0 50% 50%)}
.sp-bl>i{clip-path:inset(50% 50% 0 0)}
.sp-br>i{clip-path:inset(50% 0 0 50%)}
.sp-tl{--dx:-16%;--dy:-16%;animation:spMarco .42s cubic-bezier(.18,.86,.3,1.18) .02s both}
.sp-tr{--dx: 16%;--dy:-16%;animation:spMarco .42s cubic-bezier(.18,.86,.3,1.18) .06s both}
.sp-br{--dx: 16%;--dy: 16%;animation:spMarco .42s cubic-bezier(.18,.86,.3,1.18) .10s both}
.sp-bl{--dx:-16%;--dy: 16%;animation:spMarco .42s cubic-bezier(.18,.86,.3,1.18) .14s both}
@keyframes spMarco{from{opacity:0;transform:translate(var(--dx),var(--dy)) scale(.9)}
                   to{opacity:1;transform:none}}
/* --- el barrido del visor ------------------------------------------------- */
.sp-scan{position:absolute;left:11%;right:11%;top:9%;height:13%;opacity:0;border-radius:50%;
  background:linear-gradient(180deg,transparent,rgba(255,213,64,.55),transparent);
  filter:blur(3px);animation:spScan .55s ease-in-out .30s both}
@keyframes spScan{0%{opacity:0;transform:translateY(0)}
                  18%{opacity:1}80%{opacity:1}
                  100%{opacity:0;transform:translateY(500%)}}
/* --- la marca ------------------------------------------------------------- */
/* "easy" es cursiva: entra inclinada y se endereza, como si la escribieran. */
.sp-easy{animation:spEasy .40s cubic-bezier(.2,.8,.3,1) .42s both}
@keyframes spEasy{from{opacity:0;transform:translateX(-7%) skewX(9deg)}
                  to{opacity:1;transform:none}}
/* "pay" es el peso del logo: aterriza, no aparece. */
.sp-pay{animation:spPay .40s cubic-bezier(.2,1.3,.4,1) .54s both}
@keyframes spPay{from{opacity:0;transform:translateY(6%) scale(.88)}
                 to{opacity:1;transform:none}}

/* --- EL TAQUEO ------------------------------------------------------------ */
/* La bola se pone en la mesa y NO SE MUEVE MÁS. Es el objeto quieto contra el
   que pega el taco: toda la energía del golpe se va al temblor del logo, no a
   la bola. El único transform que tiene es el de entrar, y gira alrededor de
   su propio centro (73.2% 72.6% del lienzo) para que el `scale` la asiente en
   el lugar en vez de mandarla a pasear. */
.sp-bola{transform-origin:73.2% 72.6%;
  animation:spBola .36s cubic-bezier(.3,.7,.4,1) .66s both,
            spBolaAcusa .40s ease-out 1.52s both}
@keyframes spBola{0%  {opacity:0;transform:translateY(-4%) scale(.4)}
                  52% {opacity:1;transform:translateY(0) scale(1)}
                  70% {transform:translateY(-1.2%)}
                  86% {transform:translateY(0)}
                  94% {transform:translateY(-.4%)}
                  100%{transform:none}}
/* Acusa el golpe SIN moverse: se enciende. Es una animación aparte de la de
   entrada y conviven porque ésta toca `filter` y aquélla `transform`. */
@keyframes spBolaAcusa{0%{filter:none}
                       12%{filter:brightness(1.85) drop-shadow(0 0 calc(var(--lw)*.028) rgba(255,238,160,.9))}
                       100%{filter:none}}
/* El taco. Entra, apunta, hace dos amagues y toma el retroceso largo — y
   entonces PARA UN INSTANTE arriba del swing (72%→76%). Esa pausa de 34 ms es
   lo que hace que se lea como un taqueo y no como un resorte: nadie pega de
   corrido, todos frenan un pelo antes de soltar el brazo.

   El golpe es el tramo 76%→84%: 69 ms para recorrer los 15.4% del retroceso.
   Termina en +1.4% y no más, porque +1.4% son 13 px y ésa es exactamente la
   luz que hay entre la virola (x 596) y la bola (x 610). Con la bola quieta,
   pasarse de ahí sería meter el taco ADENTRO de la bola. Después rebota a
   -0.9% y se acomoda en 0, que es donde el logo lo tiene dibujado. */
.sp-taco{animation:spTaco .86s linear .80s both}
@keyframes spTaco{
  0%  {opacity:0;transform:translateX(-52%)}
  14% {opacity:1}
  28% {transform:translateX(-3%);    animation-timing-function:ease-in-out}  /* apunta */
  37% {transform:translateX(-9%);    animation-timing-function:ease-in-out}  /* amague 1 */
  45% {transform:translateX(-3.5%);  animation-timing-function:ease-in-out}
  54% {transform:translateX(-10.5%); animation-timing-function:ease-in-out}  /* amague 2 */
  61% {transform:translateX(-3.5%);  animation-timing-function:ease-out}
  72% {transform:translateX(-14%);   animation-timing-function:linear}       /* retroceso */
  76% {transform:translateX(-14%);   animation-timing-function:cubic-bezier(.5,0,.85,.5)} /* la pausa */
  84% {transform:translateX(1.4%);   animation-timing-function:ease-out}     /* ¡GOLPE! */
  89% {transform:translateX(-.9%);   animation-timing-function:ease-in-out}  /* rebota */
  100%{opacity:1;transform:none}}
/* El destello del contacto, en la luz entre la virola y la bola (x 603). */
.sp-golpe{position:absolute;left:67%;top:72.8%;width:15%;aspect-ratio:1;opacity:0;
  background:radial-gradient(circle,rgba(255,243,195,.8),rgba(255,197,0,.34) 36%,transparent 66%);
  animation:spGolpe .3s ease-out 1.52s both}
@keyframes spGolpe{0%{opacity:0;transform:translate(-50%,-50%) scale(.15)}
                   22%{opacity:1}
                   100%{opacity:0;transform:translate(-50%,-50%) scale(1.9)}}
/* EL TEMBLOR. Acá se va toda la energía del golpe, ya que la bola no se mueve.
   Siete oscilaciones con la amplitud cayendo, que es como vibra algo de
   verdad: un solo sacudón se lee como un salto, no como un temblor. Empieza en
   0.9% (8 px) y muere en 0.1%. Va sobre .sp-logo, así que tiembla el conjunto
   —marco, marca, taco y bola— como la mesa entera cuando pega el taco. */
.sp-logo{animation:spVibra .55s linear 1.52s both,
                   spFogonazo .34s ease-out 1.52s both}
@keyframes spVibra{0%  {transform:none}
                   8%  {transform:translate(-.9%,.35%) rotate(-.32deg)}
                   18% {transform:translate(.7%,-.28%) rotate(.26deg)}
                   29% {transform:translate(-.55%,.22%) rotate(-.2deg)}
                   41% {transform:translate(.42%,-.16%) rotate(.15deg)}
                   54% {transform:translate(-.3%,.11%) rotate(-.1deg)}
                   68% {transform:translate(.2%,-.07%) rotate(.06deg)}
                   82% {transform:translate(-.1%,.03%) rotate(-.03deg)}
                   100%{transform:none}}
@keyframes spFogonazo{0%{filter:none}
                      16%{filter:drop-shadow(0 0 calc(var(--lw)*.06) rgba(255,220,110,.55))}
                      100%{filter:none}}
/* BILLARES no aparece: lo sacude el golpe. Entra desde arriba, apretado, y se
   abre al tracking ancho que tiene la palabra en el logo. */
.sp-bill{animation:spBill .42s cubic-bezier(.2,1.25,.4,1) 1.57s both}
@keyframes spBill{from{opacity:0;transform:translateY(-1.4%) scaleX(.84)}
                  to{opacity:1;transform:none}}
@media(max-width:760px){.sp-logo{--lw:min(64vmin,300px)}}
/* Para quien pidió menos movimiento: el logo entero, quieto, y afuera. El JS
   también acorta la espera — si no, se queda mirando un logo fijo dos segundos. */
@media(prefers-reduced-motion:reduce){
  .sp-p{animation:none!important;opacity:1;transform:none;filter:none}
  .sp-scan,.sp-golpe{display:none}
  .sp-logo{animation:spQuieto .45s ease both}
  @keyframes spQuieto{from{opacity:0}to{opacity:1}}
}

/* ---- Negocios en TARJETAS ------------------------------------------------
   La tabla compara; la tarjeta reconoce. Cada cliente ocupa una tarjeta con su
   logo grande y la plata del día, y una CADENA se lleva sus sucursales adentro
   —no sueltas al lado— porque el cliente es la cadena, no cada salón. */
.tbseg2 { display: inline-flex; gap: 3px; background: var(--surface-2); border: 1px solid var(--divider); border-radius: 12px; padding: 3px; }
.tbseg2 button { border: none; background: none; color: var(--text-2); font-weight: 700; font-size: 12.5px; padding: 6px 13px; border-radius: 9px; cursor: pointer; font-family: inherit; }
.tbseg2 button.on { background: var(--accent); color: var(--accent-ink); }

/* Tarjetas más grandes: la vista de tarjeta existe para RECONOCER un cliente por
   su marca, y con 310px el logo entraba en 52 y no se distinguía de otro. */
.bizgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: var(--s4); padding: var(--s5); }
.bizcard { background: var(--surface-2); border: 1px solid var(--divider); border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 14px; transition: border-color var(--t-fast) var(--ease); }
.bizcard:hover { border-color: var(--accent); }
/* La cadena se distingue del billar suelto por una franja, no por un cartel:
   con veinte tarjetas hay que poder barrer con la vista cuáles son cadenas. */
.bizcard.es-cadena { border-top: 3px solid var(--brand-text); }
.bizc-top { display: flex; align-items: center; gap: 14px; cursor: pointer; }
/* EL LOGO, GRANDE Y NÍTIDO. Era de 52px: el archivo que sube el cliente tiene
   1080px de ancho, así que lo que se veía borroso no era el archivo sino el
   tamaño en que se dibujaba —y el navegador suavizando un dibujo de línea al
   reducirlo 20 veces—. A 76px se le ve la marca.
   `image-rendering:high-quality` le pide al navegador el remuestreo bueno en
   vez del rápido, que es donde se comen los trazos finos de un logotipo.
   De 76 a 92: el logo típico es un emblema circular con letra fina en el aro, y
   a 76 esa letra no llegaba a formarse. La tarjeta tiene 380px de ancho mínimo,
   así que los 16px salen del aire que sobra al lado del nombre. Va junto con el
   recorte del margen de encuadrarLogo(): el tamaño solo agranda el marco si el
   dibujo sigue nadando adentro. */
.bizc-av .biz-av { width: 92px; height: 92px; border-radius: 20px; font-size: 32px; }
.biz-av-logo img { image-rendering: high-quality; }
.bizc-id { flex: 1; min-width: 0; }
.bizc-nom { font-weight: 800; font-size: 17px; line-height: 1.25; }
.bizc-chapas { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.bizc-cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; cursor: pointer; }
.bizc-num { font-size: 19px; font-weight: 800; letter-spacing: -.3px; }
.bizc-num.sm { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.bizc-lbl { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .4px; margin-top: 2px; }
.bizc-vivo { font-size: 12px; color: var(--text-2); }
.bizc-sucs { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--divider); padding-top: 10px; }
.bizc-suc { display: flex; align-items: center; gap: 9px; padding: 6px; border-radius: 10px; cursor: pointer; }
.bizc-suc:hover { background: var(--surface); }
/* Las sucursales de adentro también suben, para que el logo de una sucursal
   con marca propia se distinga del cuadradito de color. */
.bizc-suc .biz-av { width: 36px; height: 36px; border-radius: 10px; font-size: 14px; }
.bizc-sucmid { flex: 1; min-width: 0; }
.bizc-sucn { font-size: 13.5px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bizc-sucm { font-size: 11px; color: var(--text-muted); }
.bizc-sucv { font-size: 13px; font-weight: 700; white-space: nowrap; }
.bizc-plegado { font-size: 12px; color: var(--brand-text); border-top: 1px solid var(--divider); padding-top: 10px; }
.bizc-pie { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid var(--divider); padding-top: 9px; }
@media (max-width: 720px) { .bizgrid { grid-template-columns: 1fr; padding: var(--s4); } }
