:root {
  --bg0: #0d1015;
  --bg1: #1b2029;
  --card: #1e242d;
  --card-2: #252c37;
  --edge: rgba(255, 255, 255, .06);
  --ink: #f2f4f7;
  --muted: #8b95a4;
  --faint: #5c6573;
  --cyan: #07EAD9;
  --cyan-ink: #001B37;
  --light: #ffffff;
  --light-ink: #151920;
  --light-muted: #7a8391;
  --light-line: #eceef2;
  --oficial: #07EAD9;
  --prensa: #6fb3ff;
  --estimacion: #ffc34d;
  --sin: #ff6b6b;
  --r-xl: 28px;
  --r-lg: 20px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --marca-navy: #001B37;
  --f-ui: Outfit, system-ui, -apple-system, sans-serif;
  --t-toque: 110ms;
  --t-estado: 180ms;
  --t-sitio: 290ms;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 15% -10%, #26303d 0%, transparent 60%),
              linear-gradient(180deg, var(--bg1), var(--bg0));
  background-attachment: fixed;
  color: var(--ink);
  font: 400 15px/1.5 Outfit, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--cyan); text-decoration: none; }
.num { font-variant-numeric: tabular-nums; letter-spacing: -.02em; }

.frame { max-width: 1240px; margin: 0 auto; padding: 18px 16px 32px; }

/* ── Barra superior ─────────────────────────────── */
.top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 500; letter-spacing: -.01em; }
.brand .logo { height: 34px; width: auto; display: block; }
.brand .logo .wordmark { fill: #fff; } /* manual: sobre fondo oscuro la marca va en blanco */
.brand .tag {
  font: 600 11px Outfit, sans-serif; letter-spacing: .14em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; background: var(--cyan); color: var(--cyan-ink);
}

.pill {
  position: relative; display: flex; gap: 2px; padding: 5px; margin: 0 auto;
  background: var(--light); border-radius: 999px; overflow-x: auto; max-width: 100%;
  scrollbar-width: none;
}
.pill::-webkit-scrollbar { display: none; }
.pill button {
  position: relative; z-index: 1; border: 0; background: transparent; cursor: pointer;
  font: 500 14px Outfit, sans-serif; color: var(--light-muted); padding: 9px 18px; border-radius: 999px;
  white-space: nowrap; transition: color .25s var(--ease);
}
.pill button:hover { color: var(--light-ink); }
.pill button.active { color: var(--cyan-ink); }
.pill button.active::before { content: "• "; }
.pill-ind {
  position: absolute; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 999px;
  background: var(--cyan); box-shadow: 0 4px 14px rgba(7, 234, 217, .35);
  transition: transform .45s var(--ease), width .45s var(--ease);
}

.tools { display: flex; gap: 8px; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--edge);
  background: var(--card); display: grid; place-items: center; cursor: pointer;
  transition: transform .2s var(--ease), background .2s;
}
.icon-btn:hover { transform: translateY(-2px); background: var(--card-2); }
.icon-btn[data-pressed] { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; fill: var(--ink); }
.icon-btn .off { display: none; }
.icon-btn[aria-pressed="false"] .on { display: none; }
.icon-btn[aria-pressed="false"] .off { display: block; fill: var(--muted); }

@media (max-width: 760px) {
  .top { gap: 12px; }
  .pill { order: 3; width: 100%; margin: 0; }
  .tools { margin-left: auto; }
}

/* ── Títulos ────────────────────────────────────── */
.tab { display: none; }
.tab.active { display: block; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
h2.title { font-size: clamp(38px, 6vw, 58px); font-weight: 400; letter-spacing: -.035em; line-height: 1; margin: 0; }
.lead { color: var(--muted); margin: 10px 0 0; max-width: 720px; }
h3 { font-size: 17px; font-weight: 500; margin: 0 0 14px; letter-spacing: -.01em; }
.eyebrow { color: var(--muted); font-size: 13.5px; }

/* ── Tarjetas ───────────────────────────────────── */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); margin-bottom: 14px; }
.two { grid-template-columns: 1.35fr 1fr; }
@media (max-width: 900px) { .two { grid-template-columns: 1fr; } }

.card {
  position: relative; min-width: 0;
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--edge); border-radius: var(--r-xl); padding: 22px;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s;
}
.card.hover:hover { transform: translateY(-3px); box-shadow: 0 18px 40px rgba(0, 0, 0, .35); border-color: rgba(255, 255, 255, .1); }
.card:has(> .arrow) .eyebrow { padding-right: 44px; }
.card.accent { background: var(--cyan); color: var(--cyan-ink); border-color: transparent; }
.card.accent .eyebrow, .card.accent .hint { color: rgba(0, 27, 55, .65); }

.light {
  background: var(--light); color: var(--light-ink); border-radius: var(--r-xl); padding: 22px;
  min-width: 0;
}
.light .eyebrow, .light .hint { color: var(--light-muted); }

.kpi .value { font-size: clamp(30px, 4vw, 40px); font-weight: 500; margin: 6px 0 4px; line-height: 1.1; }
.kpi .value small { font-size: .5em; color: var(--muted); font-weight: 400; margin-left: 4px; }
.card.accent .kpi .value small, .card.accent.kpi .value small { color: rgba(0, 27, 55, .6); }
.hint { font-size: 13px; color: var(--muted); }
.arrow {
  position: absolute; top: 18px; right: 18px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; border: 1px solid var(--edge); color: var(--muted); font-size: 15px;
}

/* entrada en cascada */
.reveal { opacity: 0; transform: translateY(14px) scale(.985); }
.reveal.in { opacity: 1; transform: none; transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: var(--d, 0ms); }

/* ── Segmentos / filtros ────────────────────────── */
.chips { display: inline-flex; gap: 6px; padding: 5px; border-radius: 999px; background: var(--bg0); border: 1px solid var(--edge); flex-wrap: wrap; }
.chips button {
  border: 0; cursor: pointer; font: 500 13.5px Outfit, sans-serif; color: var(--ink);
  background: var(--card-2); padding: 8px 14px; border-radius: 999px;
  transition: background .25s var(--ease), color .25s, transform .15s;
}
.chips button:hover { background: #2f3744; }
.chips button[data-pressed] { transform: scale(.96); }
.chips button.active { background: var(--cyan); color: var(--cyan-ink); }
.chips .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: 11.5px; }
.chips button.active .count { background: var(--cyan-ink); color: var(--cyan); }

.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.field {
  display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--edge);
  border-radius: 999px; padding: 4px 6px 4px 16px; font-size: 13px; color: var(--muted);
}
.field select, .field input {
  font: 500 14px Outfit, sans-serif; color: var(--ink); background: transparent; border: 0; outline: none;
  padding: 8px 10px 8px 0;
}
.field select option { background: var(--card); }
.field input[type=search] { min-width: 220px; }
.field input[type=number] { width: 90px; }

/* ── Tablas (en panel claro) ────────────────────── */
.table-wrap { overflow-x: auto; margin: 0 -8px; }
table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 14px; }
th {
  text-align: left; font-weight: 400; font-size: 12.5px; color: var(--light-muted);
  padding: 6px 14px; white-space: nowrap; cursor: default;
}
th.sortable { cursor: pointer; }
th.sortable:hover { color: var(--light-ink); }
td { padding: 11px 14px; vertical-align: middle; }
td.r, th.r { text-align: right; }
tbody tr { transition: background .2s, color .2s, transform .25s var(--ease); }
tbody tr td:first-child { border-radius: 999px 0 0 999px; }
tbody tr td:last-child { border-radius: 0 999px 999px 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #f3f5f7; }
tbody tr.sel { background: var(--light-ink); color: #fff; }
tbody tr.sel .muted-l { color: #aab2bf; }
.muted-l { color: var(--light-muted); }
.rank { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #f1f3f6; font-size: 12px; color: var(--light-muted); }
tbody tr.sel .rank { background: var(--cyan); color: var(--cyan-ink); }

.bar { height: 8px; border-radius: 999px; background: #edf0f3; overflow: hidden; min-width: 90px; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 999px; background: var(--light-ink); transition: width .9s var(--ease); }
tbody tr.sel .bar { background: #384150; }
tbody tr.sel .bar > i, .bar.lime > i { background: var(--cyan); }
.card .bar { background: rgba(255,255,255,.08); }
.card .bar > i { background: var(--cyan); }

.hbar { display: grid; grid-template-columns: 150px 1fr 64px; gap: 12px; align-items: center; font-size: 13.5px; margin: 9px 0; }
.hbar .n { text-align: right; }
@media (max-width: 600px) { .hbar { grid-template-columns: 108px 1fr 52px; } }

/* ── Fuentes ────────────────────────────────────── */
.src { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 1.3;
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--edge); color: var(--muted);
  background: rgba(255,255,255,.03); max-width: 100%; transition: color .2s, border-color .2s, transform .2s var(--ease);
}
a.chip:hover { color: var(--ink); border-color: rgba(255,255,255,.2); transform: translateY(-1px); }
.light .chip { border-color: var(--light-line); color: var(--light-muted); background: #f7f8fa; }
.light a.chip:hover { color: var(--light-ink); border-color: #cfd4db; }
.card.accent .chip { border-color: rgba(0,27,55,.15); color: rgba(0,27,55,.75); background: rgba(255,255,255,.25); }
.chip .t { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.chip.oficial .t { background: var(--oficial); box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.chip.prensa .t { background: var(--prensa); }
.chip.estimacion .t { background: var(--estimacion); }
.chip.sin { color: var(--sin); border-color: rgba(255,107,107,.35); }
.chip.sin .t { background: var(--sin); }
.chip .txt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tipo { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 7px; }
.tipo::before { content: ""; width: 8px; height: 8px; border-radius: 50%; }
.tipo.oficial::before { background: var(--oficial); }
.tipo.prensa::before { background: var(--prensa); }
.tipo.estimacion::before { background: var(--estimacion); }
.tipo.sin::before { background: var(--sin); }

.note { font-size: 13.5px; color: var(--muted); border-radius: 16px; padding: 12px 16px; margin: 14px 0 0; background: rgba(255,195,77,.07); border: 1px solid rgba(255,195,77,.18); }
.note b { color: var(--estimacion); font-weight: 500; }
.note.warn { background: rgba(255,107,107,.07); border-color: rgba(255,107,107,.2); }
.note.warn b { color: var(--sin); }
.light .note { color: var(--light-muted); background: #fff8e8; border-color: #ffe7b0; }
.light .note b { color: #9a6a00; }

/* ── Eventos ────────────────────────────────────── */
.events { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
@media (max-width: 420px) { .events { grid-template-columns: 1fr; } }
.ev-head { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.ev h3 { margin: 4px 0 2px; font-size: 18px; }
.ev dl { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 14px 0 0; font-size: 13.5px; }
.ev dt { color: var(--muted); }
.ev dd { margin: 0; }
.badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: rgba(255,255,255,.07); color: var(--ink); white-space: nowrap; }
.badge.lime { background: var(--cyan); color: var(--cyan-ink); }
.badge.red { background: rgba(255,107,107,.15); color: var(--sin); }
.empty { color: var(--muted); padding: 30px; text-align: center; }

ul.clean { margin: 0; padding: 0; list-style: none; }
ul.clean li { padding: 10px 0; border-bottom: 1px solid var(--edge); display: flex; gap: 10px; justify-content: space-between; align-items: baseline; }
ul.clean li:last-child { border-bottom: 0; }
.light ul.clean li { border-color: var(--light-line); }

.steps { counter-reset: s; }
.steps li { justify-content: flex-start !important; }
.steps li::before { counter-increment: s; content: counter(s); display: inline-grid; place-items: center; width: 24px; height: 24px; flex: none; border-radius: 50%; background: var(--card-2); font-size: 12px; color: var(--muted); }
.steps li.done::before { content: "✓"; background: var(--cyan); color: var(--cyan-ink); }

footer { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; margin-top: 34px; padding-top: 16px; border-top: 1px solid var(--edge); color: var(--faint); font-size: 12.5px; }
footer .grow { flex: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ── Botones (Usuarios) ─────────────────────────── */
.btn-dark, .btn-cyan, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  border-radius: 999px; border: 0; cursor: pointer; font: 600 14px Outfit, sans-serif; text-decoration: none;
  transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.btn-dark { background: var(--cyan-ink); color: #fff; }
.btn-cyan { background: var(--cyan); color: var(--cyan-ink); }
.btn-cyan:hover { box-shadow: 0 8px 22px rgba(7, 234, 217, .3); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--edge); min-height: 36px; font-weight: 500; font-size: 13px; }
.btn-ghost:hover { border-color: rgba(255,255,255,.25); }
.btn-ghost.dark { color: var(--light-ink); border-color: var(--light-line); }
.btn-ghost.dark:hover { border-color: #cfd4db; }
.btn-dark[data-pressed], .btn-cyan[data-pressed], .btn-ghost[data-pressed] { transform: scale(.96); }

.light .badge { background: #f1f3f6; color: var(--light-ink); }
.light .badge.lime { background: var(--cyan); color: var(--cyan-ink); }

/* ── Mapa ───────────────────────────────────────── */
#mapa { position: relative; }
svg.mx { width: 100%; height: auto; display: block; overflow: visible; }
svg.mx path {
  fill: var(--f); stroke: #12161c; stroke-width: 1.2; stroke-linejoin: round; cursor: pointer;
  opacity: 0; animation: mx-in .6s var(--ease) forwards; animation-delay: var(--d);
  transition: fill .5s var(--ease), filter .2s, stroke .2s;
}
svg.mx path:hover { filter: brightness(1.25); stroke: #fff; stroke-width: 1.6; }
svg.mx path.sel { stroke: #fff; stroke-width: 2.4; filter: drop-shadow(0 0 10px rgba(7, 234, 217, .55)); }
@keyframes mx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.mx-leyenda { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; flex-wrap: wrap; }
.mx-leyenda i { width: 160px; height: 8px; border-radius: 999px; background: linear-gradient(90deg, color-mix(in srgb, var(--cyan) 8%, #1d242d), var(--cyan)); }
.mx-tip {
  position: absolute; pointer-events: none; z-index: 3; background: #0b0f14; border: 1px solid var(--edge);
  padding: 7px 11px; border-radius: 10px; font-size: 13px; white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.4);
}

svg.mx.pros path { cursor: default; animation: none; opacity: 1; stroke: rgba(255,255,255,.25); }
svg.mx.pros path:hover { filter: none; stroke: rgba(255,255,255,.25); stroke-width: 1.2; }
svg.mx.pros circle { cursor: pointer; opacity: .85; transition: r .2s; }
svg.mx.pros circle:hover { opacity: 1; stroke: #fff; stroke-width: .6; }
svg.mx.pros circle.sel { stroke: #fff; stroke-width: .8; opacity: 1; }
button[disabled] { opacity: .4; cursor: default; }

/* Los textos y ligas largas nunca empujan la columna fuera de la tarjeta. */
.ev dd, .ev dt, .card li, .light td { min-width: 0; overflow-wrap: anywhere; }
.src { min-width: 0; max-width: 100%; }
.chip { min-width: 0; }

/* Bitácora por usuario */
details.bitacora { border-top: 1px solid var(--light-line); padding: 4px 0; }
details.bitacora:first-of-type { border-top: 0; }
details.bitacora summary {
  cursor: pointer; list-style: none; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  padding: 12px 8px; border-radius: 12px; transition: background .2s;
}
details.bitacora summary::-webkit-details-marker { display: none; }
details.bitacora summary::before { content: "›"; display: inline-block; width: 14px; color: var(--light-muted); transition: transform .2s var(--ease); }
details.bitacora[open] summary::before { transform: rotate(90deg); }
details.bitacora summary:hover { background: #f3f5f7; }
details.bitacora summary b { font-size: 15px; }
details.bitacora summary .muted-l { font-size: 12.5px; }
