/* ═══════════════════════════════════════════════════════════════════
   STAFF · Panel directivo — operational-luxury light (como el sistema)
   Sidebar + secciones · Inter Tight + JetBrains Mono (sin Fraunces)
   ═══════════════════════════════════════════════════════════════════ */
:root {
  --floor:   #F0EEEF;
  --card:    #FFFFFF;
  --card-2:  #F6F6F6;
  --ink:     #262626;
  --dim:     #6B6B6B;
  --faint:   rgba(38, 38, 38, 0.45);
  --line:    rgba(38, 38, 38, 0.07);
  --line-2:  rgba(38, 38, 38, 0.045);
  --ember:   #E8663A;
  --ok:      #2EAD5C;
  --warn:    #D4882A;
  --danger:  #E05252;
  --sans:    "Inter Tight", system-ui, -apple-system, sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, monospace;
  --ease:    cubic-bezier(.16, 1, .3, 1);
  --card-shadow: 0 0 0 1px rgba(38, 38, 38, 0.02), 0 2px 8px rgba(38, 38, 38, 0.035);
  color-scheme: light;
}

/* ── MODO OSCURO (más oscuro que el sistema: casi negro con tinte cálido) ── */
[data-theme="dark"] {
  --floor:   #0C0C0B;
  --card:    #141413;
  --card-2:  #1C1C1A;
  --ink:     #ECEAE5;
  --dim:     #94928C;
  --faint:   rgba(236, 234, 229, 0.40);
  --line:    rgba(255, 250, 240, 0.08);
  --line-2:  rgba(255, 250, 240, 0.05);
  --ok:      #4FBE7A;
  --warn:    #D4992E;
  --danger:  #E07370;
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 250, 240, 0.04);
  --pill-ink: #4DA3FF;
  --pill-bg:  rgba(10, 132, 255, 0.16);
  color-scheme: dark;
}
/* Overrides de colores hardcodeados (los que no salen de tokens) */
[data-theme="dark"] .st-topbar { background: rgba(12, 12, 11, 0.82); }
[data-theme="dark"] .st-export, [data-theme="dark"] .st-period { background: rgba(255, 250, 240, 0.06); }
[data-theme="dark"] .st-export { color: var(--dim); }
[data-theme="dark"] .st-export:hover, [data-theme="dark"] .st-slicer:hover { background-color: rgba(255, 250, 240, 0.11); }
[data-theme="dark"] .st-period-btn.is-active { background: rgba(255, 250, 240, 0.13); box-shadow: none; }
[data-theme="dark"] .st-slicer { background-color: rgba(255, 250, 240, 0.06); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23ECEAE5' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E"); }
[data-theme="dark"] .st-nav:hover { background: rgba(255, 250, 240, 0.06); }
[data-theme="dark"] .st-list-row:hover { background: rgba(255, 250, 240, 0.04); }
[data-theme="dark"] .st-kpi-label { color: rgba(236, 234, 229, 0.5); }
[data-theme="dark"] .st-login-input:focus, [data-theme="dark"] .st-search:focus, [data-theme="dark"] .st-ct-cost:focus, [data-theme="dark"] .st-explorar-sel:focus { background: var(--card-2); }
[data-theme="dark"] .st-login-btn, [data-theme="dark"] .st-range-apply { color: var(--floor); }
[data-theme="dark"] .st-login-btn:hover, [data-theme="dark"] .st-range-apply:hover { background: #fff; }
[data-theme="dark"] .st-main { box-shadow: 0 0 0 1px rgba(255, 250, 240, 0.05); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--floor);
  -webkit-font-smoothing: antialiased;
}

/* ── WAGON Intelligence: shimmer del sistema (engine-shimmer): banda ember que va y vuelve ── */
.wg-brand {
  color: transparent;
  background: linear-gradient(100deg, var(--ink) 0%, var(--ink) 30%, var(--ember) 50%, var(--ink) 70%, var(--ink) 100%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;          /* sitio para los descendentes (g, p, y) */
  padding-bottom: 0.1em;     /* el degradado cubre las patas — sin clip */
  animation: wgSweep 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes wgSweep { 0% { background-position: 200% center; } 50% { background-position: 0% center; } 100% { background-position: 200% center; } }
@media (prefers-reduced-motion: reduce) {
  .wg-brand { background: none; color: var(--ink); -webkit-text-fill-color: var(--ink); animation: none; }
}

/* ── LOGIN ── */
.st-login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 24px; }
.st-login-card { width: 100%; max-width: 360px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 40px 32px; text-align: center; box-shadow: 0 20px 60px rgba(38,38,38,0.06); }
.st-login-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: 0.26em; text-transform: uppercase; color: var(--dim); margin-bottom: 14px; }
.st-login-title { margin: 0 0 6px; font-family: var(--sans); font-weight: 700; font-size: 27px; line-height: 1.2; letter-spacing: -0.025em; }
.st-login-sub { margin: 0 0 26px; font-size: 12.5px; color: var(--dim); }
.st-login-form { display: flex; flex-direction: column; gap: 10px; }
.st-login-input { width: 100%; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); font-family: var(--sans); font-size: 15px; color: var(--ink); text-align: center; letter-spacing: 0.05em; }
.st-login-input:focus { outline: none; border-color: var(--ink); background: #fff; }
.st-login-btn { padding: 13px; border: none; border-radius: 10px; background: var(--ink); color: #FAF7EE; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; cursor: pointer; transition: background 0.2s var(--ease); }
.st-login-btn:hover { background: #000; }
.st-login-err { margin: 14px 0 0; font-size: 12px; color: var(--danger); }
.st-login.is-shake .st-login-card { animation: stShake 0.4s var(--ease); }
@keyframes stShake { 0%,100%{transform:translateX(0)} 20%,60%{transform:translateX(-7px)} 40%,80%{transform:translateX(7px)} }
.st-login-foot { font-family: var(--mono); font-size: 9px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--faint); }
/* Intro de login: splash grande 2s → card */
.st-login { position: relative; }
.st-login-splash {
  position: absolute; inset: 0; z-index: 5;
  display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.55s var(--ease), transform 0.6s var(--ease);
}
.wg-brand--splash { font-family: var(--sans); font-weight: 700; font-size: clamp(34px, 8.5vw, 78px); letter-spacing: -0.03em; line-height: 1.2; }
.st-login.is-intro .st-login-splash { opacity: 1; visibility: visible; }
.st-login-card, .st-login-foot { transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.st-login.is-intro .st-login-card { opacity: 0; transform: translateY(14px); pointer-events: none; }
.st-login.is-intro .st-login-foot { opacity: 0; }

/* ── APP SHELL (sidebar + content) ── */
.st-app { display: flex; min-height: 100vh; }
.st-sidebar {
  position: sticky; top: 0;
  width: 238px; flex-shrink: 0;
  height: 100vh; overflow-y: auto;
  background: var(--floor);
  display: flex; flex-direction: column;
  padding: 20px 14px 16px;
}
.st-sb-brand { display: flex; flex-direction: column; line-height: 1.15; padding: 4px 10px 18px; border-bottom: 1px solid var(--line-2); margin-bottom: 14px; }
.st-sb-eyebrow { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--dim); }
.st-sb-title { font-family: var(--sans); font-weight: 700; font-size: 18px; line-height: 1.2; letter-spacing: -0.02em; }
.st-sb-nav { display: flex; flex-direction: column; flex: 1; }
.st-sb-group { display: flex; flex-direction: column; gap: 2px; }
.st-sb-group + .st-sb-group { margin-top: 15px; }
.st-sb-grouplbl { font-family: var(--mono); font-size: 8px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--faint); padding: 0 12px; margin-bottom: 5px; }
.st-nav {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  text-align: left; border: none; background: transparent;
  padding: 9px 12px; border-radius: 9px;
  font-family: var(--sans); font-size: 13.5px; font-weight: 500;
  color: var(--dim); cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.st-nav-ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.68; transition: opacity 0.16s var(--ease); }
.st-nav-lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-nav:hover { background: rgba(38, 38, 38, 0.05); color: var(--ink); }
.st-nav:hover .st-nav-ico { opacity: 0.95; }
.st-nav.is-active { background: var(--card); color: var(--ember); font-weight: 600; box-shadow: 0 1px 3px rgba(38, 38, 38, 0.10), 0 0 0 1px rgba(38, 38, 38, 0.04); }
.st-nav.is-active .st-nav-ico { opacity: 1; }
.st-nav.is-active::before { content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%); width: 3px; height: 15px; background: var(--ember); border-radius: 2px; }
.st-sb-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line-2); margin-top: 14px; }
.st-conn { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.st-conn-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.st-conn.is-on .st-conn-dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(46,173,92,0.15); }
.st-conn.is-off .st-conn-dot { background: var(--danger); }
.st-logout { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 7px 12px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); cursor: pointer; transition: color 0.18s var(--ease), border-color 0.18s var(--ease); }
.st-logout:hover { color: var(--ink); border-color: var(--dim); }
.st-foot-actions { display: inline-flex; align-items: center; gap: 8px; }
.st-theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border: 1px solid var(--line); background: transparent; border-radius: 8px; color: var(--dim); cursor: pointer; transition: color 0.18s var(--ease), border-color 0.18s var(--ease); }
.st-theme-toggle:hover { color: var(--ink); border-color: var(--dim); }
.st-theme-toggle svg { width: 16px; height: 16px; }
.st-ico-sun { display: none; }
[data-theme="dark"] .st-ico-moon { display: none; }
[data-theme="dark"] .st-ico-sun { display: inline; }
/* Hamburguesa + backdrop (drawer mobile) — ocultos en desktop */
.st-burger { display: none; flex-direction: column; justify-content: center; gap: 4px; width: 38px; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); cursor: pointer; flex-shrink: 0; }
.st-burger span { display: block; height: 2px; border-radius: 2px; background: var(--ink); transition: transform 0.22s var(--ease), opacity 0.22s var(--ease); }
.st-app.is-nav-open .st-burger span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.st-app.is-nav-open .st-burger span:nth-child(2) { opacity: 0; }
.st-app.is-nav-open .st-burger span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.st-backdrop { display: none; }

/* ── CONTENT ── */
.st-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.st-topbar {
  position: -webkit-sticky; position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap;
  padding: 16px clamp(18px, 3vw, 36px);
  background: rgba(240,238,239,0.88);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
}
.st-topbar-title { margin: 0 auto 0 0; font-family: var(--sans); font-weight: 700; font-size: 23px; letter-spacing: -0.025em; }
.st-export { border: none; background: #E7E5E6; border-radius: 9px; padding: 9px 14px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(38,38,38,0.72); cursor: pointer; white-space: nowrap; transition: background 0.18s var(--ease), color 0.18s var(--ease); }
.st-export:hover { color: var(--ink); background: #dfdcdd; }
/* Slicer global por local */
.st-slicer-wrap { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; }
.st-slicer-eyebrow { font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.st-slicer { appearance: none; -webkit-appearance: none; border: none; border-radius: 9px; padding: 8px 30px 8px 12px; font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); cursor: pointer; max-width: 220px; transition: background-color 0.18s var(--ease), color 0.18s var(--ease); background: #E7E5E6 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23262626' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 11px center; }
.st-slicer:hover { background-color: #dfdcdd; }
.st-slicer:focus { outline: none; box-shadow: 0 0 0 2px rgba(232, 102, 58, 0.35); }
.st-slicer.is-filtered { background-color: var(--ember); color: #fff; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E"); }
/* Controles de la sección Explorar (cubo ad-hoc) */
.st-explorar-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.st-explorar-field { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 9px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); }
.st-explorar-sel { appearance: none; -webkit-appearance: none; border: 1px solid var(--line); border-radius: 9px; padding: 9px 30px 9px 12px; font-family: var(--sans); font-size: 13.5px; font-weight: 500; color: var(--ink); cursor: pointer; min-width: 168px; background: var(--card-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none' stroke='%23262626' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 11px center; transition: border-color 0.18s var(--ease); }
.st-explorar-sel:focus { outline: none; border-color: var(--ember); background-color: #fff; }
.st-explorar-controls .st-export { margin-left: auto; align-self: flex-end; }
.st-period { display: inline-flex; background: #E7E5E6; border-radius: 9px; padding: 3px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.st-period::-webkit-scrollbar { display: none; }
.st-period-btn { border: none; background: transparent; padding: 7px 12px; border-radius: 7px; font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); cursor: pointer; white-space: nowrap; flex: 0 0 auto; transition: background 0.18s var(--ease), color 0.18s var(--ease); }
.st-period-btn.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(38,38,38,0.10); }
.st-range-pop { position: absolute; top: 60px; right: clamp(18px, 3vw, 36px); z-index: 40; width: 300px; padding: 16px; background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 10px 34px rgba(38,38,38,0.16), 0 0 0 1px rgba(38,38,38,0.02); animation: stCardIn 0.2s var(--ease); }
.st-range-pop[hidden] { display: none; }
.st-range-pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.st-range-field { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.st-range-field input { font-family: var(--sans); font-size: 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: var(--card-2); }
.st-range-field input:focus { outline: none; border-color: var(--ember); }
.st-range-pop-foot { display: flex; justify-content: flex-end; gap: 8px; }
.st-range-ghost, .st-range-apply { border: none; border-radius: 8px; padding: 8px 14px; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; transition: background 0.18s var(--ease), color 0.18s var(--ease); }
.st-range-ghost { background: transparent; color: var(--dim); }
.st-range-ghost:hover { color: var(--ink); }
.st-range-apply { background: var(--ink); color: #fff; }
.st-range-apply:hover { background: #000; }

.st-main {
  flex: 1;
  background: var(--card-2);
  border-radius: 18px;
  margin: 4px 12px 12px;
  padding: clamp(18px, 3vw, 30px);
  box-shadow: 0 0 0 1px rgba(38, 38, 38, 0.045), 0 2px 8px rgba(38, 38, 38, 0.04), 0 8px 32px rgba(38, 38, 38, 0.05);
}
.st-section { display: none; }
.st-section.is-active { display: flex; flex-direction: column; gap: 22px; }
.st-section.is-active > * { animation: stCardIn 0.42s var(--ease) both; }
.st-section.is-active > *:nth-child(1) { animation-delay: 0.02s; }
.st-section.is-active > *:nth-child(2) { animation-delay: 0.07s; }
.st-section.is-active > *:nth-child(3) { animation-delay: 0.12s; }
.st-section.is-active > *:nth-child(4) { animation-delay: 0.17s; }
.st-section.is-active > *:nth-child(5) { animation-delay: 0.22s; }
.st-section.is-active > *:nth-child(n+6) { animation-delay: 0.27s; }
@keyframes stCardIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ── KPI cards ── */
.st-kpis { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line-2); border-radius: 14px; overflow: hidden; box-shadow: var(--card-shadow); }
.st-kpis--4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.st-kpis--3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.st-kpi { background: var(--card); padding: 20px 20px; min-height: 110px; display: flex; flex-direction: column; gap: 8px; }
.st-kpi-label { font-family: var(--mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(38, 38, 38, 0.45); }
.st-kpi-val { font-family: var(--sans); font-weight: 700; font-size: 27px; letter-spacing: -0.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.st-kpi-val.is-sm { font-size: 21px; }
.st-kpi-delta { font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--dim); display: inline-flex; align-items: center; gap: 5px; }
.st-kpi-delta.is-up { color: var(--ok); }
.st-kpi-delta.is-down { color: var(--danger); }
.st-kpi-sub { font-size: 11px; color: var(--dim); }
.st-kpi-val.t-ok { color: var(--ok); }
.st-kpi-val.t-warn { color: var(--warn); }
.st-kpi-val.t-danger { color: var(--danger); }

/* ── Cards / charts ── */
.st-card { background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; padding: 20px clamp(16px, 2.4vw, 24px); box-shadow: var(--card-shadow); }
.st-card--chart { padding-bottom: 12px; }
.st-card-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.st-card-head h3 { margin: 0; font-family: var(--sans); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.st-card-meta { margin-left: auto; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.st-card-desc { margin: -8px 0 16px; font-size: 12px; line-height: 1.45; color: var(--dim); max-width: 66ch; }
/* Callout de insight automático (NLG) — reutilizable en cualquier card */
.st-card-insight { position: relative; margin-top: 16px; padding: 11px 14px 11px 32px; background: rgba(232, 102, 58, 0.06); border-radius: 10px; font-size: 12.5px; line-height: 1.5; color: var(--ink); }
.st-card-insight::before { content: "◆"; position: absolute; left: 14px; top: 12px; color: var(--ember); font-size: 9px; }
.st-card-insight--good { background: rgba(46, 173, 92, 0.08); }
.st-card-insight--good::before { color: var(--ok); }
.st-card-insight--warn { background: rgba(212, 136, 42, 0.09); }
.st-card-insight--warn::before { color: var(--warn); }
.st-card-insight--bad { background: rgba(224, 82, 82, 0.08); }
.st-card-insight--bad::before { color: var(--danger); }
.st-card-insight b { font-weight: 600; }
.st-card-insight:empty { display: none; }
/* Drill-down: barra de filtro de categoría activa */
.st-drill-bar { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: rgba(232, 102, 58, 0.07); border: 1px solid rgba(232, 102, 58, 0.18); border-radius: 12px; }
.st-drill-bar[hidden] { display: none; }
.st-drill-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.st-drill-chip { display: inline-flex; align-items: center; gap: 8px; border: none; background: var(--ember); color: #fff; border-radius: 8px; padding: 6px 11px; font-family: var(--sans); font-size: 12.5px; font-weight: 600; cursor: pointer; transition: background 0.18s var(--ease); }
.st-drill-chip:hover { background: #d4532b; }
.st-drill-x { font-size: 11px; opacity: 0.85; }
/* Nota informativa cuando el slicer de local no aplica a una sección */
.st-slicer-note { padding: 11px 15px; background: rgba(10, 132, 255, 0.06); border: 1px solid rgba(10, 132, 255, 0.16); border-radius: 11px; font-size: 12.5px; line-height: 1.45; color: var(--dim); }
.st-chart-wrap { position: relative; height: 240px; }
.st-chart-wrap--lg { height: 320px; }
.st-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }

/* ── Comparativa locales ── */
.st-locales { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 20px; }
.st-local-card { background: var(--card); border: 1px solid var(--line-2); border-radius: 14px; padding: 22px; border-top: 3px solid var(--ember); box-shadow: var(--card-shadow); }
.st-local-name { font-family: var(--sans); font-weight: 600; font-size: 19px; margin: 0 0 4px; }
.st-local-sub { font-family: var(--mono); font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); margin-bottom: 18px; }
.st-local-rows { display: flex; flex-direction: column; gap: 0; }
.st-local-row { display: flex; align-items: baseline; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.st-local-row:last-child { border-bottom: none; }
.st-local-row .k { font-size: 12.5px; color: var(--dim); }
.st-local-row .v { font-family: var(--sans); font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; }
.st-local-row .v.t-danger { color: var(--danger); }

/* ── Bars (medio de pago) ── */
.st-bars { display: flex; flex-direction: column; gap: 12px; }
.st-bar-row { display: flex; flex-direction: column; gap: 5px; }
.st-bar-head { display: flex; justify-content: space-between; font-size: 12px; }
.st-bar-head .lbl { color: var(--ink); }
.st-bar-head .amt { font-family: var(--mono); font-size: 11px; color: var(--dim); }
.st-bar-track { height: 8px; background: var(--card-2); border-radius: 5px; overflow: hidden; }
.st-bar-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #0A84FF, #FF6B35); transition: width 0.5s var(--ease); }

/* ── Listas (top productos / críticos) ── */
.st-list { display: flex; flex-direction: column; }
.st-list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.st-list-row:last-child { border-bottom: none; }
.st-list-rank { font-family: var(--mono); font-size: 11px; color: var(--faint); width: 22px; flex-shrink: 0; }
.st-list-name { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-list-sub { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.st-list-val { font-family: var(--sans); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; }
.st-list-val.t-danger { color: var(--danger); }
.st-list-val.t-ok { color: var(--ok); }
/* "¿Qué cambió?": variación % (mono) + sufijo "del cambio" */
.st-qc-var { font-family: var(--mono); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.st-qc-var.t-ok { color: var(--ok); }
.st-qc-var.t-danger { color: var(--danger); }
.st-qc-suffix { font-family: var(--mono); font-size: 9px; font-weight: 500; color: var(--dim); text-transform: uppercase; letter-spacing: 0.06em; margin-left: 5px; }
.st-list-val.t-warn { color: var(--warn); }
.st-pill { font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pill-ink, #0A84FF); background: var(--pill-bg, rgba(10, 132, 255, 0.10)); padding: 3px 7px; border-radius: 5px; }
.st-empty { padding: 28px 0; text-align: center; color: var(--faint); font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; }

/* ── Rentabilidad: nota, buscador, cost table ── */
.st-card-note { margin: 0 0 14px; font-size: 12px; color: var(--dim); line-height: 1.55; }
.st-search { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card-2); font-family: var(--sans); font-size: 13px; color: var(--ink); margin-bottom: 12px; }
.st-search:focus { outline: none; border-color: var(--ink); background: #fff; }
.st-ct { max-height: 460px; overflow-y: auto; border: 1px solid var(--line-2); border-radius: 10px; }
.st-ct-row { display: grid; grid-template-columns: minmax(0, 2.2fr) 1fr 0.9fr 1fr 0.7fr; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line-2); }
.st-ct-row:last-child { border-bottom: none; }
.st-ct-head { position: sticky; top: 0; z-index: 1; background: var(--card-2); }
.st-ct-head span { font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); }
.st-ct-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-ct-cat { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-ct-precio { font-family: var(--mono); font-size: 12px; color: var(--dim); text-align: right; }
.st-ct-cost { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--card-2); font-family: var(--mono); font-size: 12px; color: var(--ink); text-align: right; }
.st-ct-cost:focus { outline: none; border-color: var(--ember); background: #fff; }
.st-ct-margen { font-family: var(--sans); font-weight: 600; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; color: var(--dim); }
.st-ct-margen.t-ok { color: var(--ok); }
.st-ct-margen.t-warn { color: var(--warn); }
.st-ct-margen.t-danger { color: var(--danger); }
@media (max-width: 640px) {
  .st-ct-row { grid-template-columns: minmax(0, 1.6fr) 0.9fr 1fr 0.7fr; }
  .st-ct-cat { display: none; }
}

/* ── Insights (Resumen) ── */
.st-insights { display: flex; flex-direction: column; gap: 8px; }
.st-insights:empty { display: none; }
.st-insight { display: flex; align-items: center; gap: 11px; background: linear-gradient(180deg, #FFFFFF, #FCFAF8); border: 1px solid var(--line); border-left: 3px solid var(--ember); border-radius: 11px; padding: 13px 17px; font-size: 13px; line-height: 1.4; color: var(--ink); }
.st-insight-icon { color: var(--ember); font-size: 11px; flex-shrink: 0; }
.st-insight b { font-weight: 600; font-variant-numeric: tabular-nums; }
/* ── Saludo "IA escribiendo" (Resumen) ── */
.st-welcome { margin: 2px 0 4px; max-width: 72ch; font-family: var(--sans); font-weight: 400; font-size: clamp(17px, 2.1vw, 21px); line-height: 1.62; color: var(--ink); letter-spacing: -0.005em; min-height: 1.62em; }
.st-welcome .st-hl { color: var(--ember); font-weight: 600; background: rgba(232, 102, 58, 0.10); border-radius: 5px; padding: 0.04em 0.32em; font-variant-numeric: tabular-nums; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.st-welcome.st-typing::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px; background: var(--ember); vertical-align: -0.18em; animation: wgCaret 1s steps(1) infinite; }
@keyframes wgCaret { 50% { opacity: 0; } }

/* ── Medios de pago por empleado ── */
.st-emp-medio { padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.st-emp-medio:last-child { border-bottom: none; }
.st-emp-medio-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12.5px; margin-bottom: 7px; }
.st-emp-medio-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; background: var(--card-2); }
.st-seg { height: 100%; }

/* ── Sparkline en KPI card ── */
.st-kpi-spark { margin-top: auto; padding-top: 6px; }
.st-spark { display: block; width: 100%; max-width: 110px; height: 24px; opacity: 0.85; }

/* ── Heatmap día×hora (grilla CSS) ── */
.st-hm-scroll { overflow-x: auto; }
.st-hm { display: grid; gap: 3px; align-items: center; }
.st-hm-collbl, .st-hm-rowlbl { font-family: var(--mono); font-size: 9px; letter-spacing: 0.02em; color: var(--dim); text-align: center; }
.st-hm-rowlbl { text-align: right; padding-right: 8px; }
.st-hm-cell { height: 26px; border-radius: 4px; border: 1px solid var(--line-2); transition: transform 0.12s var(--ease); }
.st-hm-cell:hover { transform: scale(1.12); border-color: var(--ink); cursor: default; }
.st-hm-legend { display: flex; align-items: center; gap: 8px; justify-content: flex-end; margin-top: 14px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--dim); }
.st-hm-legend-bar { width: 96px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, rgba(10, 132, 255, 0.4), #0A84FF, #FF6B35); }

/* ── Alertas ── */
.st-alerts { display: flex; flex-direction: column; gap: 10px; }
.st-alert {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--dim);
  border-radius: 12px; padding: 16px 18px; cursor: pointer; font-family: var(--sans);
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.st-alert:hover { transform: translateX(2px); box-shadow: 0 4px 16px rgba(38,38,38,0.06); }
.st-alert--danger { border-left-color: var(--danger); }
.st-alert--warn { border-left-color: var(--warn); }
.st-alert--info { border-left-color: var(--c-info, #0A84FF); }
.st-alert-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; background: var(--dim); }
.st-alert--danger .st-alert-dot { background: var(--danger); box-shadow: 0 0 0 4px rgba(224,82,82,0.14); }
.st-alert--warn .st-alert-dot { background: var(--warn); box-shadow: 0 0 0 4px rgba(212,136,42,0.14); }
.st-alert--info .st-alert-dot { background: #0A84FF; box-shadow: 0 0 0 4px rgba(10,132,255,0.14); }
.st-alert-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.st-alert-title { font-size: 14px; font-weight: 600; color: var(--ink); }
.st-alert-detail { font-size: 12px; color: var(--dim); }
.st-alert-val { font-family: var(--sans); font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; flex-shrink: 0; }
.st-alert-go { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); flex-shrink: 0; }
.st-empty-big {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 56px 28px; text-align: center; font-family: var(--sans); font-size: 20px; font-weight: 600; color: var(--ok);
}

/* ── Skeleton / próximamente ── */
.st-skel { position: relative; overflow: hidden; background: var(--card-2); min-height: 110px; }
.st-skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(38,38,38,0.05), transparent); transform: translateX(-100%); animation: stShimmer 1.2s infinite; }
@keyframes stShimmer { to { transform: translateX(100%); } }
.st-soon-block { background: var(--card); border: 1px dashed var(--line); border-radius: 16px; padding: 40px 28px; text-align: center; }
.st-soon-block h3 { margin: 0 0 10px; font-family: var(--sans); font-weight: 600; font-size: 22px; }
.st-soon-block p { margin: 0 auto; max-width: 460px; font-size: 13.5px; line-height: 1.7; color: var(--dim); }

/* ── Micro-interacciones (hover) + indicador de vida ── */
.st-list-row { transition: background 0.16s var(--ease); }
.st-list-row:hover { background: rgba(38, 38, 38, 0.025); }
.st-kpi { transition: background 0.18s var(--ease); }
.st-kpi:hover { background: var(--card-2); }
.st-card, .st-local-card { transition: box-shadow 0.22s var(--ease); }
.st-card:hover, .st-local-card:hover { box-shadow: 0 0 0 1px rgba(38, 38, 38, 0.04), 0 6px 22px rgba(38, 38, 38, 0.07); }
.st-conn.is-on .st-conn-dot { animation: wgDotPulse 2.4s ease-in-out infinite; }
@keyframes wgDotPulse { 0% { box-shadow: 0 0 0 0 rgba(46, 173, 92, 0.45); } 70%, 100% { box-shadow: 0 0 0 6px rgba(46, 173, 92, 0); } }

/* ── Responsive ── */
@media (max-width: 860px) {
  /* Sidebar → drawer off-canvas */
  .st-app { display: block; }
  .st-sidebar {
    position: fixed; top: 0; left: 0; z-index: 70;
    width: 270px; max-width: 84vw; height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 44px rgba(38, 38, 38, 0.2); border-right: 1px solid var(--line-2);
  }
  .st-app.is-nav-open .st-sidebar { transform: translateX(0); }
  .st-backdrop { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(38, 38, 38, 0.42); opacity: 0; pointer-events: none; transition: opacity 0.3s var(--ease); }
  .st-app.is-nav-open .st-backdrop { opacity: 1; pointer-events: auto; }
  .st-content { width: 100%; display: block; }  /* block (no flex) → sticky de la topbar funciona en iOS Safari */
  .st-burger { display: flex; }
  /* Topbar compacto: [☰ título export] arriba, período full-width abajo */
  .st-topbar { gap: 11px 12px; padding: 12px clamp(14px, 4vw, 20px); }
  .st-topbar-title { font-size: 19px; }
  .st-slicer-wrap { order: 1; }
  .st-export { order: 2; }
  .st-period { order: 3; width: 100%; }
  .st-main { margin: 0 8px 8px; padding: clamp(15px, 4vw, 22px); border-radius: 16px; }
  .st-range-pop { position: fixed; top: auto; bottom: 10px; left: 10px; right: 10px; width: auto; }
  .st-hm { min-width: 460px; }
}
@media (max-width: 560px) {
  .st-kpis--4, .st-kpis--3 { grid-template-columns: repeat(2, 1fr); }
  .st-kpi { padding: 15px 14px; min-height: 90px; gap: 6px; }
  .st-kpi-val { font-size: 22px; }
  .st-kpi-val.is-sm { font-size: 18px; }
  .st-card { padding: 17px 15px; }
  .st-card-head h3 { font-size: 15.5px; }
  .st-section.is-active { gap: 16px; }
  .st-grid-2 { gap: 16px; }
  .st-qc-prevcur, .st-qc-suffix { display: none; }
}
@media (max-width: 380px) {
  .st-kpis--4, .st-kpis--3 { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Print (export PDF vía Ctrl+P) ── */
@media print {
  .st-sidebar, .st-export, .st-period, .st-slicer-wrap, .st-conn, .st-logout { display: none !important; }
  .st-app { display: block; }
  .st-topbar { position: static; border: none; backdrop-filter: none; }
  .st-section:not(.is-active) { display: none !important; }
  .st-section.is-active { display: block !important; }
  .st-card, .st-kpi, .st-local-card, .st-alert { break-inside: avoid; box-shadow: none !important; }
  .st-grid-2, .st-locales, .st-kpis { display: block; }
  .st-grid-2 > *, .st-kpis > * { margin-bottom: 10px; }
  body { background: #fff; }
}
