:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e2e0da;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7973;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --neutral-fill: #e4e2dc;
  --warn: #fab219;
  --crit: #d03b3b;
  --good: #0ca30c;
  --mid: #f0efec;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2f2f2c;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #8f8e86;
    --accent: #3987e5; --accent-ink: #86b6ef; --neutral-fill: #2f2f2c; --mid: #383835;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2f2f2c;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #8f8e86;
  --accent: #3987e5; --accent-ink: #86b6ef; --neutral-fill: #2f2f2c; --mid: #383835;
  --shadow: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 "IBM Plex Sans", system-ui, sans-serif;
}
.num, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
a { color: var(--accent-ink); }

.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.brand { display: flex; gap: 12px; align-items: center; }
.logo { width: 34px; height: 34px; border-radius: 8px; background: var(--accent);
  background-image: linear-gradient(90deg, transparent 20%, rgba(255,255,255,.9) 20% 28%, transparent 28% 44%, rgba(255,255,255,.9) 44% 52%, transparent 52% 68%, rgba(255,255,255,.9) 68% 76%, transparent 76%);
  -webkit-mask: linear-gradient(#000 0 0); flex: none; }
h1 { font-size: 18px; font-weight: 700; }
.sub { margin: 0; color: var(--text-2); font-size: 13px; }
.theme { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 8px; width: 36px; height: 36px; font-size: 16px; cursor: pointer; display: grid; place-items: center; }

.banner { margin-top: 16px; padding: 10px 14px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); font-size: 14px; }
.aviso { margin-top: 16px; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 10px 10px 0; color: var(--text-2); font-size: 14px; }
.aviso strong { color: var(--text); display: block; margin-bottom: 2px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-top: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .l { color: var(--text-2); font-size: 12.5px; }
.kpi .v { font-size: 26px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.kpi .d { color: var(--muted); font-size: 12.5px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin: 16px 0 10px; }
.seg { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--text-2); padding: 6px 10px; border-radius: 7px; font: inherit; font-size: 13.5px; cursor: pointer; display: grid; place-items: center; }
.seg button[aria-checked="true"] { background: var(--text); color: var(--surface); }
.search { position: relative; flex: 1 1 240px; max-width: 360px; }
.search input { width: 100%; padding: 8px 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; font: inherit; }
.search ul { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 300px; overflow: auto; }
.search li { padding: 7px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.search li[aria-selected="true"], .search li:hover { background: var(--surface-2); }
.search li span { color: var(--muted); font-size: 12px; }

.grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 12px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); margin-bottom: 12px; min-width: 0; }
.card-h { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.mapcard { position: relative; }
.mapbox { width: 100%; aspect-ratio: 1 / .95; }
#map { width: 100%; height: 100%; display: block; }
#map path { stroke: var(--surface); stroke-width: .6; vector-effect: non-scaling-stroke; cursor: pointer; display: grid; place-items: center; }
#map path:hover { stroke: var(--text); stroke-width: 1.5; }
#map path.sel { stroke: var(--text); stroke-width: 2.2; }
.crumbs { font-size: 14px; display: flex; gap: 6px; align-items: center; }
.crumbs button { border: 0; background: none; color: var(--accent-ink); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.crumbs .sep { color: var(--muted); }
.legend { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.legend .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }
.legend .ramp { display: flex; align-items: center; gap: 6px; }
.legend .bar { width: 140px; height: 10px; border-radius: 3px; }
.tip { position: fixed; pointer-events: none; z-index: 10; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; box-shadow: 0 6px 18px rgba(0,0,0,.14); max-width: 240px; }
.tip b { display: block; }
.tip .r { color: var(--text-2); }

.detail h2 { font-size: 20px; }
.detail .uf-tag { color: var(--muted); font-weight: 500; }
.detail .muted { color: var(--text-2); font-size: 13px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.stat .l { font-size: 12px; color: var(--text-2); }
.stat .v { font-size: 17px; font-weight: 600; }
.stat .c { font-size: 12px; color: var(--muted); }
.cands { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 6px 0 4px; }
.cands th { text-align: left; font-weight: 500; color: var(--text-2); font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.cands th.r, .cands td.r { text-align: right; }
.cands td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.cands .barc { width: 34%; padding-left: 8px; }
.cands .track { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; }
.cands .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 0 4px 4px 0; }
.cands .ref { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text); opacity: .55; }

.flags { display: grid; gap: 8px; margin-top: 12px; }
.flag { border: 1px solid var(--line); border-left: 4px solid var(--warn); border-radius: 8px; padding: 10px 12px; }
.flag.forte { border-left-color: var(--crit); }
.flag .t { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; }
.flag p { margin: 4px 0 0; font-size: 13.5px; color: var(--text-2); }
.flag .ben { font-size: 12.5px; color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--text); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--warn); }
.pill.forte::before { background: var(--crit); }
.pill.ok::before { background: var(--good); border-radius: 50%; }
.okbox { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 13.5px; color: var(--text-2); }
.links { margin-top: 12px; font-size: 13px; display: flex; gap: 12px; flex-wrap: wrap; }

.rank-f { display: flex; gap: 8px; flex-wrap: wrap; }
select { font: inherit; font-size: 13.5px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.tablewrap { overflow-x: auto; }
.rank { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rank th { text-align: left; color: var(--text-2); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.rank td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.rank tr.row { cursor: pointer; display: grid; place-items: center; }
.rank tr.row:hover td { background: var(--surface-2); }
.rank .tags { display: flex; gap: 4px; flex-wrap: wrap; }
.rank .more td { text-align: center; }
.rank .more button { border: 1px solid var(--line); background: var(--surface-2); color: var(--text); border-radius: 8px; padding: 6px 12px; font: inherit; cursor: pointer; display: grid; place-items: center; }

.metodo p, .metodo li { color: var(--text-2); font-size: 14px; }
.metodo details { border-top: 1px solid var(--line); padding: 10px 0; }
.metodo summary { cursor: pointer; font-weight: 600; }
.ind { padding: 10px 0; border-top: 1px solid var(--line); }
.ind:first-child { border-top: 0; }
.ind p { margin: 4px 0; }
#metodo-ind { margin: 8px 0 4px; }

.foot { color: var(--muted); font-size: 12.5px; padding: 8px 0 32px; }

.secgrid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; margin-top: 8px; }
@media (max-width: 900px) { .secgrid { grid-template-columns: 1fr; } }
#sc { width: 100%; height: 320px; display: block; }
#sc .axis text { fill: var(--text-2); font: 11px "IBM Plex Mono", monospace; }
#sc .axis line { stroke: var(--line); }
#sc .axis .domain { stroke: var(--line); }
#sc .axl { fill: var(--muted); font-size: 11.5px; }
#sc circle { cursor: pointer; }
.seclist { display: grid; gap: 8px; max-height: 420px; overflow: auto; align-content: start; }
.seclist .flag p { margin-top: 6px; }
.flag.hl { outline: 2px solid var(--accent); }
.btn { font: inherit; font-size: 13.5px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; }
