/* ============================================================
   Optimal · Gobierno — Sistema de diseño "Atlas"
   Producto de datos oscuro (zinc-950), tipografía Inter,
   micro-etiquetas mono en mayúsculas, barras finas casi blancas.
   Estados clínicos teñidos (esmeralda / ámbar / rojo) sobre fondo
   oscuro — mapeados a los niveles de riesgo. Intro: login con
   fondo aurora + splash "Hola {nombre}".
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ---- Escala zinc ---- */
  --bg:        #09090b;   /* zinc-950 — lienzo */
  --card:      #0b0b0e;   /* tarjeta (apenas sobre el lienzo) */
  --elevate:   #131316;   /* elevado / hover */
  --zinc-900:  #18181b;
  --zinc-800:  #27272a;
  --zinc-700:  #3f3f46;
  --border:    #27272a;   /* zinc-800 — hairline */
  --border-soft: #1c1c1f;

  --text:      #fafafa;   /* zinc-50 */
  --text-2:    #e4e4e7;   /* zinc-200 */
  --muted:     #a1a1aa;   /* zinc-400 */
  --faint:     #71717a;   /* zinc-500 */
  --dim:       #52525b;   /* zinc-600 */
  --bar-white: #f4f4f5;

  --ink:       #fafafa;   /* alias: trazo principal sobre oscuro */
  --red:       #f87171;   /* red-400 (advertencias) */
  --red-deep:  #fca5a5;

  /* ---- Niveles de riesgo (barras / cifras sobre oscuro) ---- */
  --t-low-bar:  #10b981;  /* emerald-500 */
  --t-mod-bar:  #f59e0b;  /* amber-500 */
  --t-high-bar: #ef4444;  /* red-500 */
  --t-low-ink:  #34d399;  /* emerald-400 */
  --t-mod-ink:  #fbbf24;  /* amber-400 */
  --t-high-ink: #f87171;  /* red-400 */

  /* ---- Estados teñidos (badges, estilo Atlas STATUS_COLORS) ---- */
  --low-bg:  #064e3b; --low-fg:  #6ee7b7;
  --mod-bg:  #78350f; --mod-fg:  #fcd34d;
  --high-bg: #7f1d1d; --high-fg: #fca5a5;

  /* ---- Tipografía ---- */
  --sans: 'Inter', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'IBM Plex Mono', Menlo, Consolas, monospace;

  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 14px;
  --pill: 999px;
}

/* ============ BASE ============ */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  /* atmósfera aurora dentro del producto (no solo en el login) */
  background:
    radial-gradient(72% 52% at 100% 0%, rgba(16,185,129,0.08), transparent 60%),
    radial-gradient(54% 42% at 0% 100%, rgba(99,102,241,0.06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text-2);
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: #3f3f46; color: #fafafa; }

/* scrollbar (Atlas) */
* { scrollbar-width: thin; scrollbar-color: #27272a #09090b; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #09090b; }
*::-webkit-scrollbar-thumb { background: #27272a; border-radius: 6px; border: 2px solid #09090b; }
*::-webkit-scrollbar-thumb:hover { background: #3f3f46; }

[hidden] { display: none !important; }

/* ============================================================
   KEYFRAMES (Atlas)
   ============================================================ */
@keyframes optimalSplashFade {
  0%   { opacity: 0; transform: translateY(6px); filter: blur(8px); }
  25%  { opacity: 1; transform: translateY(0);   filter: blur(0); }
  75%  { opacity: 1; transform: translateY(0);   filter: blur(0); }
  100% { opacity: 0; transform: translateY(-4px); filter: blur(4px); }
}
@keyframes optimal-fade-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes optimal-breathe { 0%,100% { opacity: 0.35; transform: scale(1); } 50% { opacity: 1; transform: scale(1.4); } }
@keyframes optimal-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
.optimal-fade-in { animation: optimal-fade-in 0.6s ease-out both; }
.breathe-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: optimal-breathe 1.6s ease-in-out infinite; }
.shimmer {
  background: linear-gradient(90deg, rgba(161,161,170,0.45) 0%, #fafafa 50%, rgba(161,161,170,0.45) 100%);
  background-size: 200% 100%; background-clip: text; -webkit-background-clip: text;
  color: transparent; -webkit-text-fill-color: transparent;
  animation: optimal-shimmer 3.2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) { .shimmer { animation: none; } }

/* ============================================================
   LOGIN (intro)
   ============================================================ */
.login { position: fixed; inset: 0; z-index: 100; display: flex; background: var(--bg); color: var(--text-2); }
.login.is-leaving { opacity: 0; transition: opacity 0.5s ease; pointer-events: none; }
.login-left { width: 50%; display: flex; flex-direction: column; justify-content: center; padding: 0 80px; }
.login-form { width: 100%; max-width: 380px; margin: 0 auto; }
.login-h { font-size: 30px; font-weight: 700; letter-spacing: -0.6px; color: var(--text); margin-bottom: 8px; }
.login-p { font-size: 14px; color: var(--muted); margin-bottom: 40px; }
.login-field { margin-bottom: 20px; }
.login-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--faint); font-weight: 600; margin-bottom: 8px; }
.login-row { display: flex; align-items: baseline; justify-content: space-between; }
.login-link { background: none; border: none; font-family: inherit; font-size: 11px; color: var(--faint); cursor: pointer; transition: color 0.15s; }
.login-link:hover { color: var(--text-2); }
.login-input {
  width: 100%; height: 44px; border-radius: var(--r-md);
  border: 1px solid var(--zinc-800); background: rgba(24,24,27,0.5);
  padding: 0 12px; font-family: inherit; font-size: 14px; color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.login-input::placeholder { color: var(--dim); }
.login-input:focus { outline: none; border-color: var(--zinc-700); box-shadow: 0 0 0 1px var(--zinc-700); }
.login-btn {
  width: 100%; height: 44px; border-radius: var(--r-md); border: none;
  background: var(--text); color: #18181b; font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: background 0.15s, opacity 0.15s;
}
.login-btn:hover { background: #fff; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.login-foot { font-size: 12px; color: var(--dim); margin-top: 48px; }
.login-foot button { background: none; border: none; font-family: inherit; font-size: 12px; color: var(--text-2); cursor: pointer; font-weight: 500; }
.login-foot button:hover { color: var(--text); }

.login-aurora { width: 50%; position: relative; overflow: hidden; }
.login-aurora .aurora-img {
  position: absolute; inset: 0;
  background-image: url("../assets/aurora.jpg");
  background-size: cover; background-position: center; background-color: #050507;
}
.login-aurora .aurora-logo { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.login-aurora .aurora-logo svg { height: 30px; width: auto; opacity: 0.92; }

/* ============================================================
   SPLASH (intro)
   ============================================================ */
.splash { position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center; background: #000; }
.splash-name { font-size: 44px; font-weight: 300; letter-spacing: -0.8px; color: var(--text); animation: optimalSplashFade 2400ms ease-in-out forwards; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app { display: flex; height: 100vh; }
.app[hidden] { display: none; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: 230px; flex-shrink: 0; height: 100vh;
  background: var(--bg); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 22px 0 16px;
}
.logo { padding: 0 20px 18px; margin: 0 4px 8px; border-bottom: 1px solid var(--border); }
.logo svg { height: 22px; width: auto; display: block; }
.logo svg path { fill: var(--text); }
.logo-co { font-size: 11px; color: var(--dim); margin-top: 9px; letter-spacing: 0.02em; }

.nav-section { font-size: 11px; font-weight: 600; color: var(--dim); padding: 18px 22px 8px; text-transform: uppercase; letter-spacing: 0.12em; }
.nav-item {
  display: flex; align-items: center; gap: 12px; margin: 2px 12px; padding: 9px 12px;
  cursor: pointer; font-size: 14px; font-weight: 500; color: var(--muted);
  border-radius: var(--r-md); position: relative; transition: background 0.15s, color 0.15s;
}
.nav-item i { font-size: 19px; color: var(--dim); transition: color 0.15s; }
.nav-item:hover { background: var(--zinc-900); color: var(--text-2); }
.nav-item:hover i { color: var(--muted); }
.nav-item.active { background: var(--zinc-900); color: var(--text); font-weight: 600; }
.nav-item.active i { color: var(--text); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 2px; border-radius: 0 2px 2px 0; background: var(--text); }
.nav-num { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--dim); }
.nav-item.active .nav-num { color: var(--muted); }

.side-block { margin: 22px 18px 0; }
.side-h { font-size: 11px; font-weight: 600; color: var(--dim); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.1em; }
/* selector de ciclo: filas sutiles, sin trazos (es simulación) */
.cycle {
  cursor: pointer; padding: 7px 10px; border-radius: var(--r-md);
  margin-bottom: 1px; background: transparent; border: none;
  display: flex; justify-content: space-between; align-items: center;
  transition: background 0.15s;
}
.cycle:hover { background: var(--zinc-900); }
.cycle.on { background: var(--zinc-900); }
.cycle-n { font-size: 13px; font-weight: 500; color: var(--faint); }
.cycle.on .cycle-n { color: var(--text); font-weight: 600; }
.cycle-d { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.cycle.on .cycle-d { color: var(--t-low-ink); }

.sidebar-foot { margin-top: auto; padding: 16px 20px 0; margin-left: 4px; margin-right: 4px; font-size: 11.5px; color: var(--faint); line-height: 1.55; border-top: 1px solid var(--border); }
.sidebar-foot strong { color: var(--text-2); font-weight: 600; }
.demo-tag {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 12px;
  font-family: var(--mono); font-size: 10px; color: var(--mod-fg);
  background: rgba(120,53,15,0.35); padding: 4px 9px; border-radius: 5px; letter-spacing: 0.04em;
}
.demo-tag .blip { width: 6px; height: 6px; border-radius: 50%; background: var(--mod-fg); animation: optimal-breathe 1.8s ease-in-out infinite; }

/* ---- MAIN ---- */
.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  background: rgba(9,9,11,0.65); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border); flex-shrink: 0; position: sticky; top: 0; z-index: 20;
}
.topbar-inner {
  width: 100%;
  padding: 13px 40px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.crest { display: flex; align-items: center; gap: 13px; }
.crest-mark { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--zinc-900); border: 1px solid var(--border); color: var(--text); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.crest-mark i { font-size: 20px; }
.org-name { font-size: 14.5px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
.org-meta { display: flex; align-items: center; gap: 9px; margin-top: 3px; }
.org-sub { font-size: 12px; color: var(--faint); }
.org-sep { font-size: 12px; color: var(--zinc-700); }
.org-cov { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--t-low-ink); }

.tb-right { display: flex; align-items: center; gap: 11px; }
.pill { font-family: var(--mono); font-size: 11px; padding: 6px 12px; border-radius: var(--pill); font-weight: 500; background: var(--zinc-900); color: var(--muted); border: 1px solid var(--border); display: inline-flex; align-items: center; gap: 7px; }
.pill .blip { width: 6px; height: 6px; border-radius: 50%; background: var(--t-low-bar); }
.export-btn {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;
  padding: 8px 15px; border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--zinc-900); color: var(--text-2); cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.export-btn:hover { background: var(--zinc-800); border-color: var(--zinc-700); }
.export-btn i { font-size: 16px; color: var(--muted); }

.tb-sep { width: 1px; height: 26px; background: var(--border); flex-shrink: 0; }
.tb-user { display: flex; align-items: center; gap: 11px; }
.tb-user-meta { text-align: right; line-height: 1.25; }
.tb-user-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.tb-user-role { font-size: 10.5px; color: var(--faint); }
.logout-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--zinc-900); border: 1px solid var(--border); color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background 0.15s, color 0.15s, border-color 0.15s; }
.logout-btn:hover { background: var(--zinc-800); color: var(--t-high-ink); border-color: var(--zinc-700); }
.logout-btn i { font-size: 17px; }

.content { padding: 28px 40px 60px; flex: 1; width: 100%; }

/* ============ VIEWS ============ */
.view { display: none; }
.view.active { display: block; animation: optimal-fade-in 0.4s ease-out; }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; margin-bottom: 28px; padding-bottom: 26px; border-bottom: 1px solid var(--border); position: relative; }
.view-head-text { max-width: 640px; }
.eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--faint); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 12px; }
.view-title { font-size: 34px; font-weight: 700; letter-spacing: -1px; line-height: 1.1; color: var(--text); }
.view-title em { font-style: normal; font-weight: 700; color: var(--text); }
.view-sub { font-size: 15px; font-weight: 400; color: var(--muted); margin-top: 13px; line-height: 1.55; }

/* momento "héroe": cifra focal grande con atmósfera aurora */
.head-stat { flex-shrink: 0; text-align: right; position: relative; padding: 6px 4px 2px; }
.head-stat::before { content: ''; position: absolute; right: -20px; top: -34px; width: 280px; height: 180px; background: radial-gradient(circle at 72% 42%, rgba(16,185,129,0.16), transparent 68%); pointer-events: none; z-index: 0; }
.head-stat.crit::before { background: radial-gradient(circle at 72% 42%, rgba(239,68,68,0.20), transparent 68%); }
.head-stat > * { position: relative; z-index: 1; }
.head-stat-num { font-size: 56px; font-weight: 800; letter-spacing: -3px; line-height: 0.92; font-variant-numeric: tabular-nums; }
.head-stat-num.crit { color: var(--t-high-ink); }
.head-stat-lbl { font-size: 12px; color: var(--faint); margin-top: 10px; font-weight: 500; }
.head-spark { display: flex; align-items: flex-end; justify-content: flex-end; gap: 4px; height: 26px; margin-top: 14px; }
.head-spark i { width: 7px; background: var(--zinc-700); border-radius: 2px; display: block; transition: height 0.7s cubic-bezier(0.22,0.61,0.36,1); }
.head-spark i:last-child { background: var(--bar-white); }
.head-spark-cap { font-family: var(--mono); font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 7px; }

/* ============ REVEAL ============ */
[data-reveal] { opacity: 0; transform: translateY(12px); }
.reveal-on [data-reveal] { opacity: 1; transform: none; transition: opacity 0.5s cubic-bezier(0.22,0.61,0.36,1), transform 0.5s cubic-bezier(0.22,0.61,0.36,1); transition-delay: var(--d, 0s); }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }
  .view.active { animation: none; }
  .splash-name { animation: none; }
  .seg, .prev-fill, .wf-bar, .col-bar i { transition: none !important; }
}

/* ============ KPI ============ */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px; }
.kpis.cols-3 { grid-template-columns: repeat(3, 1fr); }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 20px; position: relative; overflow: hidden; transition: border-color 0.16s, box-shadow 0.2s, transform 0.16s; }
.kpi::after { content: ''; position: absolute; left: 20px; right: 20px; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255,255,255,0.07), transparent); }
.kpi:hover { border-color: var(--zinc-700); transform: translateY(-2px); box-shadow: 0 12px 32px -18px rgba(0,0,0,0.8); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-lbl { font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; line-height: 1.3; }
.kpi-ico { color: var(--dim); font-size: 17px; flex-shrink: 0; }
.kpi.k-red .kpi-ico { color: var(--t-high-ink); opacity: 0.85; }
.kpi-val { font-size: 34px; font-weight: 700; letter-spacing: -1.4px; color: var(--text); margin-top: 14px; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi-val .unit { font-size: 19px; font-weight: 600; color: var(--dim); margin-left: 2px; letter-spacing: 0; }
.kpi-sub { font-size: 12px; color: var(--faint); margin-top: 11px; line-height: 1.45; }
.kpi-sub b { color: var(--text-2); font-weight: 600; }
.kpi-sub b.warn { color: var(--t-high-ink); font-weight: 600; }
.kpi.k-red .kpi-val { color: var(--t-high-ink); }
.kpi.k-ink { background: linear-gradient(160deg, #101012, var(--card)); border-color: var(--zinc-700); }

/* ============ CARDS ============ */
.g-2  { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.g-37 { display: grid; grid-template-columns: 1.05fr 1.55fr; gap: 16px; margin-bottom: 16px; }
.g-terr { grid-template-columns: 1.4fr 1.2fr; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-t { font-size: 16px; font-weight: 600; color: var(--text); letter-spacing: -0.2px; }
.card-n { font-family: var(--mono); font-size: 10.5px; color: var(--dim); text-align: right; text-transform: uppercase; letter-spacing: 0.04em; }

/* ============ SEGMENTED RISK BAR ============ */
.seg { display: flex; height: 38px; border-radius: var(--r-md); overflow: hidden; margin-bottom: 18px; clip-path: inset(0 100% 0 0); transition: clip-path 1s cubic-bezier(0.22,0.61,0.36,1) 0.2s; }
.reveal-on .seg { clip-path: inset(0 0 0 0); }
.seg-part { display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.seg-bajo { background: #059669; }
.seg-mod  { background: #d97706; }
.seg-alto { background: #dc2626; }
.seg-leg { display: flex; flex-direction: column; gap: 12px; }
.lg-row { display: flex; align-items: center; gap: 11px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.lg-name { font-size: 13.5px; color: var(--text-2); flex: 1; font-weight: 500; }
.lg-detail { font-size: 12.5px; color: var(--dim); font-weight: 400; }
.lg-val { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }

/* ============ PREVALENCE ============ */
.prev-row { display: grid; grid-template-columns: 220px 1fr 52px; gap: 18px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.prev-row:last-child { border-bottom: none; padding-bottom: 2px; }
.prev-name { font-size: 13.5px; color: var(--text-2); font-weight: 500; }
.prev-name small { display: block; font-size: 11.5px; color: var(--dim); font-weight: 400; margin-top: 2px; }
.prev-track { position: relative; height: 22px; background: var(--zinc-900); border-radius: var(--pill); overflow: visible; }
.prev-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: var(--pill); width: 0; transition: width 0.9s cubic-bezier(0.22,0.61,0.36,1) 0.25s; }
.reveal-on .prev-fill { width: var(--w); }
.prev-state { background: var(--bar-white); }
.prev-state.ok { background: var(--zinc-700); }
.prev-val { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); text-align: right; }
.prev-nat { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fafafa; box-shadow: 0 0 0 1.5px var(--bg); border-radius: 2px; }
.prev-nat::after { content: 'nac.'; position: absolute; top: -15px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 8px; color: var(--muted); white-space: nowrap; }
.prev-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--faint); display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.prev-key { display: flex; align-items: center; gap: 8px; }
.prev-key .kbar { width: 18px; height: 9px; border-radius: var(--pill); }
.prev-key .kline { width: 2px; height: 14px; background: #fafafa; border-radius: 2px; }

/* ============ CHART ============ */
.chart-wrap { position: relative; height: 190px; }

/* ============ CARTOGRAM ============ */
.terr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 13px; }
.muni { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 16px 15px; cursor: pointer; position: relative; background: var(--card); transition: transform 0.13s, border-color 0.16s, background 0.16s; }
.muni:hover { transform: translateY(-2px); border-color: var(--zinc-700); }
.muni.sel { border-color: var(--text); border-width: 1.5px; }
.muni.t-bajo { background: rgba(16,185,129,0.05); }
.muni.t-mod  { background: rgba(245,158,11,0.05); }
.muni.t-alto { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.28); }
.muni-code { font-family: var(--mono); font-size: 9.5px; color: var(--dim); letter-spacing: 0.04em; }
.muni-name { font-size: 13px; font-weight: 600; color: var(--text-2); margin-top: 7px; line-height: 1.32; min-height: 35px; }
.muni-irc { font-size: 30px; font-weight: 700; letter-spacing: -1.2px; margin-top: 8px; line-height: 1; font-variant-numeric: tabular-nums; }
.t-bajo .muni-irc { color: var(--t-low-ink); }
.t-mod  .muni-irc { color: var(--t-mod-ink); }
.t-alto .muni-irc { color: var(--t-high-ink); }
.muni-cov { font-size: 10.5px; color: var(--faint); margin-top: 11px; }
.muni-cov b { font-family: var(--mono); font-weight: 600; color: var(--text-2); }

.terr-legend { display: flex; align-items: center; gap: 20px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--faint); flex-wrap: wrap; }
.tl-item { display: flex; align-items: center; gap: 8px; }
.tl-sw { width: 12px; height: 12px; border-radius: 4px; }
.tl-irc { margin-left: auto; font-size: 11px; color: var(--dim); }

/* ---- detail ---- */
.detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.detail-code { font-family: var(--mono); font-size: 10.5px; color: var(--dim); }
.detail-name { font-size: 24px; font-weight: 700; color: var(--text); letter-spacing: -0.6px; margin-top: 3px; line-height: 1.05; }
.detail-irc-box { text-align: right; flex-shrink: 0; }
.detail-irc { font-size: 42px; font-weight: 700; line-height: 0.9; letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.detail-irc-lbl { font-family: var(--mono); font-size: 9.5px; color: var(--dim); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 5px; }
.tier-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: var(--pill); margin-top: 11px; }
.tier-chip i { font-size: 12px; }
.chip-bajo { background: var(--low-bg); color: var(--low-fg); }
.chip-mod  { background: var(--mod-bg); color: var(--mod-fg); }
.chip-alto { background: var(--high-bg); color: var(--high-fg); }

.detail-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 16px 0; }
.dstat { background: var(--zinc-900); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: 11px 13px; }
.dstat-v { font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -0.4px; font-variant-numeric: tabular-nums; }
.dstat-l { font-size: 11px; color: var(--faint); margin-top: 3px; }

.col-h { font-family: var(--mono); font-size: 10.5px; font-weight: 500; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; margin: 8px 0 11px; }
.col-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border-soft); }
.col-row:last-child { border-bottom: none; padding-bottom: 0; }
.col-rank { font-family: var(--mono); font-size: 11px; color: var(--dim); width: 16px; }
.col-name { font-size: 13.5px; color: var(--text-2); flex: 1; font-weight: 500; }
.col-bar { width: 84px; height: 5px; background: var(--zinc-900); border-radius: var(--pill); overflow: hidden; flex-shrink: 0; }
.col-bar i { display: block; height: 100%; border-radius: var(--pill); width: 0; transition: width 0.7s cubic-bezier(0.22,0.61,0.36,1); }
.col-irc { font-family: var(--mono); font-size: 13px; font-weight: 600; width: 28px; text-align: right; }

/* ============ TABLES ============ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { font-family: var(--mono); font-size: 10px; font-weight: 500; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; text-align: left; padding: 10px 12px; background: var(--zinc-900); border-bottom: 1px solid var(--border); }
.tbl th:first-child { border-radius: var(--r-md) 0 0 0; }
.tbl th:last-child { border-radius: 0 var(--r-md) 0 0; }
.tbl th.num, .tbl td.num { text-align: right; font-family: var(--mono); }
.tbl td { font-size: 13.5px; color: var(--text-2); padding: 11px 12px; border-bottom: 1px solid var(--border-soft); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background 0.12s; }
.tbl tr.clk { cursor: pointer; }
.tbl tr.clk:hover td { background: var(--zinc-900); }
.tbl .code { font-family: var(--mono); font-size: 10px; color: var(--dim); }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-md); }
.b-bajo { background: var(--low-bg); color: var(--low-fg); }
.b-mod  { background: var(--mod-bg); color: var(--mod-fg); }
.b-alto { background: var(--high-bg); color: var(--high-fg); }
.irc-cell { font-weight: 700; }
.accion { font-size: 12.5px; color: var(--muted); }

/* ============ IMPACT ============ */
.waterfall { display: flex; align-items: flex-end; gap: 24px; height: 220px; padding: 26px 10px 0; }
.wf-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.wf-bar { width: 100%; border-radius: var(--r-md) var(--r-md) 0 0; position: relative; display: flex; min-height: 4px; height: 0; transition: height 0.9s cubic-bezier(0.22,0.61,0.36,1); }
.reveal-on .wf-bar { height: var(--h); }
.wf-bar.b-inv { background: var(--zinc-700); }
.wf-bar.b-evi { background: linear-gradient(180deg, #34d399, #059669); }
.wf-bar.b-net { background: var(--zinc-300, #d4d4d8); }
.wf-val { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--text); white-space: nowrap; }
.wf-lbl { font-size: 12.5px; color: var(--text-2); margin-top: 12px; text-align: center; font-weight: 600; }
.wf-lbl small { display: block; color: var(--dim); font-weight: 400; font-size: 11px; margin-top: 2px; }

.method { background: var(--zinc-900); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; }
.method-h { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 15px; display: flex; align-items: center; gap: 10px; letter-spacing: -0.2px; }
.method-h i { color: var(--t-low-ink); font-size: 19px; }
.method ol { margin: 0; padding-left: 22px; counter-reset: m; list-style: none; }
.method li { font-size: 13.5px; color: var(--muted); line-height: 1.55; margin-bottom: 12px; position: relative; padding-left: 8px; }
.method li::before { counter-increment: m; content: counter(m); position: absolute; left: -22px; top: 1px; width: 18px; height: 18px; border-radius: 50%; background: var(--zinc-800); color: var(--text); font-family: var(--mono); font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; }
.method li b { color: var(--text-2); font-weight: 600; }
.method-note { margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--dim); line-height: 1.55; }

.foot-note { font-size: 11.5px; color: var(--dim); margin-top: 14px; line-height: 1.55; max-width: 920px; }
.foot-note b { color: var(--faint); font-weight: 600; }

/* ============ PRINT ============ */
@media print {
  body { height: auto; overflow: visible; background: #fff; color: #000; }
  .login, .splash, .sidebar, .export-btn { display: none !important; }
  .app { display: block; }
  .view { display: block !important; page-break-after: always; }
  .view.active { animation: none; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .seg { clip-path: none !important; }
  .prev-fill { width: var(--w) !important; }
  .wf-bar { height: var(--h) !important; }
  .main { overflow: visible; }
  .card, .kpi, .method { background: #fff; border-color: #ccc; color: #000; }
  .view-title, .card-t, .kpi-val, .detail-name, .detail-irc, .org-name { color: #000 !important; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1080px) {
  .kpis, .kpis.cols-3 { grid-template-columns: 1fr 1fr; }
  .g-2, .g-37 { grid-template-columns: 1fr; }
  .view-title { font-size: 30px; }
  .view-head { flex-direction: column; align-items: flex-start; gap: 22px; }
  .head-stat { text-align: left; }
  .head-stat::before { display: none; }
  .head-spark { justify-content: flex-start; }
  .head-stat-num { font-size: 46px; }
  .tb-user-meta { display: none; }
}
@media (max-width: 860px) {
  .login-left { width: 100%; padding: 0 32px; }
  .login-aurora { display: none; }
}
@media (max-width: 720px) {
  body { overflow: auto; }
  .app { flex-direction: column; height: auto; }
  .sidebar { width: 100%; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 12px; gap: 8px; border-right: none; border-bottom: 1px solid var(--border); }
  .side-block, .sidebar-foot, .nav-section { display: none; }
  .logo { border: none; padding: 0 8px; margin: 0; }
  .nav-item { margin: 0; }
  .kpis { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 44px; }
  .view-title { font-size: 26px; }
}
