/* ─────────────────────────────────────────────────────────────────────────────
   DecideEspaña · base gráfica de la familia Decide (~/decide-base)
   Tokens de familia (navy, rail, grises, sombras, radios) + marca del país.
   Corte móvil/desktop: 1280px. Desktop se dibuja con zoom 0.9.
   ───────────────────────────────────────────────────────────────────────────── */
:root {
  color-scheme: light;
  /* Familia: no cambian por país */
  --navy: #032753;
  --navy-rail: #1a375a;
  --navy-line: #4f6887;
  --navy-tab: #909eb1;
  --navy-tab-active: #e0e0e0;
  --ink: #3c3c3c;
  --ink-strong: #171717;
  --ink-2: #4f4f4f;
  --ink-3: #6b6b6b;
  --ink-muted: #8a8a8a;
  --ink-faint: #a8a8a8;
  --ink-placeholder: #bdbdbd;
  --line: #e0e0e0;
  --line-soft: #eeeef0;
  --canvas: #f0f0f0;
  --paper: #fafafa;
  --ok: #1a7f37;
  --bad: #b42318;
  /* Marca: DecideEspaña (color del logo oficial #2150E8) */
  --brand: 33 80 232;
  --brand-dark: 22 56 176;
  --brand-light: 78 119 242;
  /* Sombras y radios */
  --shadow-card: 0 3.54px 13.88px 2.78px rgba(0, 0, 0, .25);
  --shadow-card-soft: 0 3.54px 13.88px 2.78px rgba(0, 0, 0, .15);
  --shadow-tip: 0 4px 16px rgba(0, 0, 0, .14);
  --shadow-list: 0 0 8px rgba(0, 0, 0, .15);
  --shadow-ctrl: 0 2px 8px rgba(0, 0, 0, .12);
  --shadow-sheet: 0 -4px 24px rgba(0, 0, 0, .25);
  --shadow-header: 0 5px 16px -4px rgba(0, 0, 0, .18);
  --shadow-rail: 6px 0 24px rgba(0, 0, 0, .35);
  --r-card: 28px;
  --r-sheet: 20px;
  --r-tip: 12px;
  --r-field: 10px;
  --r-bar: 2px;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --zoom-desktop: 1;
  --sheet-px: 360px;
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  font-synthesis: none;
}
@media (min-width: 1280px) {
  :root { --zoom-desktop: .9; zoom: var(--zoom-desktop); }
}
*, *::before, *::after { box-sizing: border-box; }
* { -ms-overflow-style: none; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  margin: 0;
  overflow: hidden;
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
button, input, select { font: inherit; color: inherit; }
button, a, select { touch-action: manipulation; }
button { cursor: pointer; }
a { color: rgb(var(--brand)); }
:focus-visible { outline: 2px solid rgb(var(--brand)); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip { position: fixed; top: -80px; left: 20px; z-index: 100; background: #fff; padding: 12px 16px; border-radius: var(--r-field); }
.skip:focus { top: 10px; }
.hbtn svg, .round-btn svg, .cmd svg, .pin svg, .ico svg, .search-box svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cifra, .num, .percentage { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.mono { font-family: var(--mono); }
.halo { text-shadow: 0 1px 0 #fafafa, 0 -1px 0 #fafafa, 1px 0 0 #fafafa, -1px 0 0 #fafafa; }
.rotulo { margin: 20px 0 8px; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-2); }
.section-label, .eyebrow { display: block; font: 500 12px var(--mono); letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink-2); }

/* ── Shell ─────────────────────────────────────────────────────────────────── */
#app { height: 100%; display: flex; flex-direction: column; }
#topbar {
  position: relative; z-index: 40; flex: none;
  background: var(--navy); color: #fff;
  padding-top: var(--safe-top);
  border-bottom: 1px solid var(--navy-line);
  box-shadow: var(--shadow-header);
}
.top-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 4px; padding: 12px 12px 8px; }
.top-left { display: flex; align-items: center; gap: 2px; min-width: 0; }
.hbtn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 6px; background: none; color: #fff; flex: none; }
.hbtn:hover { background: rgba(255, 255, 255, .1); }
.hbtn svg { width: 22px; height: 22px; }
#page-title { display: none; }
.logo { display: inline-flex; color: #f0f0f0; justify-self: center; }
.logo svg { height: 37px; width: auto; display: block; }
.top-row .logo svg { height: 30px; }
/* Vista Fuentes oculta por ahora */
button[data-tab="sources"] { display: none !important; }
/* La sección 29N Candidaturas no se muestra: sus datos se consultan desde el buscador y la vista de elección. */
button[data-tab="candidates"] { display: none !important; }
.search-box { position: relative; display: none; align-items: center; gap: 10px; margin: 0 12px 10px; padding: 0 14px; height: 44px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 12px; background: rgba(255, 255, 255, .1); color: rgba(255, 255, 255, .6); }
.search-box.open { display: flex; }
.search-box:focus-within { border-color: rgba(255, 255, 255, .4); }
.search-box svg { width: 20px; height: 20px; flex: none; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 16px; color: #fff; height: 100%; -webkit-appearance: none; appearance: none; }
.search-box input::placeholder { color: rgba(255, 255, 255, .55); }
.search-box input::-webkit-search-cancel-button { display: none; }
#search-btn .i-close, #search-btn[aria-expanded="true"] .i-search { display: none; }
#search-btn[aria-expanded="true"] .i-close { display: block; }
/* Resultados: tarjeta blanca bajo el campo, agrupada y con la coincidencia resaltada. */
.search-results { position: absolute; z-index: 90; top: calc(100% + 8px); left: 0; right: 0; max-height: min(420px, 60vh); overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: #fff; border-radius: 12px; box-shadow: var(--shadow-card-soft); color: var(--ink); text-align: left; }
.search-results li[role=option] { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 10px 14px; border-radius: 8px; cursor: pointer; }
.search-results li[role=option]:hover { background: var(--line-soft); }
.search-results li[aria-selected="true"] { background: #e6ebf2; }
.sr-name { font-size: 15px; font-weight: 500; color: var(--ink); }
.sr-name mark { background: none; font-weight: 800; color: var(--ink-strong); }
.sr-sub { flex: none; font-size: 12px; color: var(--ink-muted); }
.sr-group { padding: 10px 14px 4px; font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); }
.sr-empty { padding: 12px 14px; font-size: 14px; color: var(--ink-muted); }

/* Navegación: tabs en el header (móvil) / rail lateral (desktop) */
.nav-tabs { display: flex; justify-content: safe center; gap: 4px; height: 32px; padding: 0 8px; overflow-x: auto; }
.nav-tabs button { display: flex; align-items: center; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--navy-tab); font-size: 14px; padding: 0 10px; white-space: nowrap; }
.nav-tabs button.active { color: var(--navy-tab-active); font-size: 16px; font-weight: 600; border-bottom-color: var(--navy-line); }
.nav-tabs .ico { display: none; }
.nav-types { display: flex; gap: 4px; padding: 2px 0 0 14px; background: var(--paper); border-bottom: 1px solid var(--line-soft); overflow-x: auto; }
.nav-types button { height: 27px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--ink-muted); font-size: 14px; white-space: nowrap; }
.nav-types button.active { color: var(--ink-2); font-weight: 600; border-bottom-color: rgba(79, 79, 79, .6); }
.nav-types .sig { display: none; }
#app[data-tab="social"] .nav-types, #app[data-tab="sources"] .nav-types { display: none; }
#franja { display: none; }

#main { position: relative; flex: 1; min-height: 0; overflow: hidden; }
#explorer { position: absolute; inset: 0; }

/* ── Mapa ──────────────────────────────────────────────────────────────────── */
#map-wrap { position: absolute; inset: 0; background: var(--canvas); overflow: hidden; }
#map { width: 100%; height: 100%; display: block; touch-action: none; }
#map-layer path { stroke: #fff; stroke-width: .8; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill .15s, opacity .15s; outline: none; }
#map[data-level="sections"] #map-layer path { stroke-width: .3; }
#map[data-level="municipalities"] #map-layer path { stroke-width: .45; }
#map[data-scope="municipality"] #map-layer path, #map[data-scope="province"][data-level="municipalities"] #map-layer path { stroke-width: .8; }
#map-layer path:hover, #map-layer path:focus-visible { filter: brightness(1.1); }
#map-layer path:focus-visible { stroke: var(--ink-strong); stroke-width: 2; }
#map-layer path.dim { opacity: .5; }
#map-layer path.out { opacity: .25; }
#map-layer path.selected { stroke: var(--ink-strong); stroke-width: 2.5; opacity: 1; }
#map-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ink-muted); font-size: 13px; }
.map-controls { position: absolute; z-index: 15; right: 12px; bottom: calc(var(--sheet-px) + 12px); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.cmd { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: 0; border-radius: 999px; background: #fff; color: var(--ink); box-shadow: var(--shadow-ctrl); transition: transform .1s, background .15s; }
.cmd:hover { background: var(--canvas); }
.cmd:active { transform: translateY(2px); }
.cmd.dark { background: var(--ink-3); color: #fff; }
.cmd.dark:hover { background: var(--ink-2); }
.cmd svg { width: 16px; height: 16px; stroke-width: 2.5; }
.map-controls .dark { display: none; }

/* Leyenda de bandas */
.legend { position: absolute; z-index: 15; left: 12px; bottom: calc(var(--sheet-px) + 12px); pointer-events: none; max-width: calc(100% - 80px); }
.legend .lg-title { font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-faint); }
.legend .lg-body { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; }
.legend .lg-cuts { display: flex; flex-direction: column; justify-content: space-around; height: 36px; font-size: 9px; line-height: 1; color: var(--ink-faint); text-align: right; font-variant-numeric: tabular-nums; }
.legend .lg-col { display: flex; flex-direction: column; align-items: center; }
.legend .lg-bands { display: flex; flex-direction: column; width: 24px; height: 36px; border-radius: var(--r-bar); overflow: hidden; }
.legend .lg-bands i { flex: 1; }
.legend .lg-col span { margin-top: 2px; font-size: 9px; font-weight: 600; line-height: 1; color: var(--ink-2); max-width: 44px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .lg-ramp { display: flex; align-items: center; gap: 6px; font-size: 10px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.legend .lg-ramp .ramp { display: flex; height: 10px; width: 132px; border-radius: var(--r-bar); overflow: hidden; }
.legend .lg-ramp .ramp i { flex: 1; }
.legend .lg-note { margin-top: 4px; font-size: 10px; color: var(--ink-faint); }
.legend .lg-nodata { display: inline-flex; align-items: center; gap: 4px; }
.legend .lg-nodata i { width: 10px; height: 10px; border-radius: var(--r-bar); background: var(--line); display: inline-block; }

/* Tooltip-card */
#tooltip { position: fixed; z-index: 50; pointer-events: none; width: max-content; min-width: 240px; max-width: min(340px, 80vw); padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-tip); background: #fff; color: var(--ink); box-shadow: var(--shadow-tip); font-size: 13px; }
#tooltip .tt-title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tooltip .tt-sub { margin: 2px 0 0; font-size: 12px; color: var(--ink-muted); }
#tooltip table { width: 100%; margin-top: 10px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
#tooltip th { padding-bottom: 4px; border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 400; color: var(--ink-muted); text-align: right; }
#tooltip th:first-child { text-align: left; }
#tooltip td { padding-top: 6px; text-align: right; color: var(--ink-3); }
#tooltip td:first-child { text-align: left; color: var(--ink); }
#tooltip td:last-child { font-weight: 700; color: var(--ink); padding-left: 12px; }
#tooltip .tt-party { display: flex; align-items: center; gap: 8px; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tooltip .tt-party i { width: 3px; height: 14px; border-radius: 99px; flex: none; }
#tooltip .tt-foot { margin: 8px 0 0; padding-top: 6px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-muted); }
#tooltip .tt-note { margin: 6px 0 0; color: var(--ink-3); }

/* ── Card de resultados (bottom sheet en móvil) ────────────────────────────── */
.results-card {
  position: absolute; z-index: 20; left: 0; right: 0; bottom: 0;
  height: var(--sheet-px);
  display: flex; flex-direction: column;
  background: #fff; border-radius: var(--r-sheet) var(--r-sheet) 0 0; box-shadow: var(--shadow-sheet);
  overflow: hidden;
}
.sheet-handle { flex: none; display: flex; justify-content: center; padding: 10px 0 6px; cursor: grab; touch-action: none; }
.sheet-handle span { width: 40px; height: 4px; border-radius: 99px; background: var(--line); }
.card-head { flex: none; padding: 0 16px; }
.head-row { display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; gap: 6px; }
.head-row h2 { margin: 0; text-align: center; font-size: 20px; font-weight: 700; letter-spacing: -.015em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-btn { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 999px; background: none; color: var(--ink-faint); }
.round-btn:hover { background: var(--line-soft); color: var(--ink); }
.round-btn svg { width: 17px; height: 17px; stroke-width: 2.3; }
.head-actions { display: flex; justify-content: flex-end; gap: 2px; }
/* Descargas ocultas por ahora */
#download { display: none !important; }
.crumbs { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 4px; font-size: 13px; color: var(--ink-3); min-height: 4px; }
.crumbs button { border: 0; background: none; padding: 0; color: var(--ink-3); }
.crumbs button:hover { color: var(--ink); text-decoration: underline; }
.crumbs .crumb-sep { color: var(--ink-faint); }
.kicker { display: none; margin: 6px 0 0; text-align: center; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-faint); }
.kicker #context-date { color: var(--ink-2); }
.card-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px 24px; }

/* Franja de cifras (KPIs) */
.strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; padding: 10px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.kpi { min-width: 0; }
.part-strip { margin-top: 12px; }
.part-pill { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-radius: var(--r-field); background: #fff; box-shadow: var(--shadow-ctrl); font-size: 14px; color: var(--ink-2); text-align: center; font-variant-numeric: tabular-nums; }
.part-pill strong { color: var(--ink-strong); font-weight: 700; }
.part-pill .chev { flex: none; font-size: 18px; line-height: 1; color: var(--ink-muted); }
.part-pill:hover { border-color: var(--ink-faint); }
.rotulo-n { font-weight: 400; letter-spacing: .06em; text-transform: none; color: var(--ink-muted); }
#part-backdrop, .side-panel { display: none; }
/* Móvil: el panel lateral es una hoja desde abajo (DecideBrasil → PanelLateral). */
#part-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 70; background: rgba(0, 0, 0, .3); }
.side-panel:not([hidden]) { display: flex; flex-direction: column; position: fixed; z-index: 71; left: 0; right: 0; bottom: 0; max-height: 80vh; padding-bottom: var(--safe-bottom); background: #fff; border-radius: var(--r-card) var(--r-card) 0 0; box-shadow: var(--shadow-card); }
.side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.side-head h2 { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.2; color: var(--ink); }
.side-head p { margin: 0; font-size: 12px; color: var(--ink-3); }
.side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px; }
.party-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.party-stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.party-rot { margin: 20px 0 8px; }
.party-stats div { padding: 12px; border: 1px solid var(--line); border-radius: var(--r-field); }
.party-stats span { display: block; font-size: 10px; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-faint); }
.party-stats strong { display: block; margin-top: 4px; font-size: 20px; font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.party-prov { margin-top: 6px; }
.party-prov tbody th { font-weight: 600; }
.part-pill.open .chev { transform: rotate(90deg); }
#part-inline { margin-top: 12px; }
.part-inline-title { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--ink-3); }
.modal-x { flex: none; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--ink-faint); }
.modal-x:hover { background: var(--line-soft); color: var(--ink); }
.modal-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; }
.part-scroll { overflow-x: auto; }
.part-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.part-table th, .part-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.part-table thead th { font-weight: 700; color: var(--ink-strong); border-bottom-color: var(--ink-faint); }
.part-table th { text-transform: none; letter-spacing: 0; font-size: inherit; }
.part-table thead th:first-child { text-align: left; }
.part-table tbody th { position: sticky; left: 0; background: #fff; text-align: left; font-weight: 700; color: var(--ink-strong); }
.part-table tr.sub th { font-weight: 400; color: var(--ink-2); }
.part-table tr.strong td { font-weight: 600; }
.part-table td small { display: block; font-size: 10px; color: var(--ink-muted); font-weight: 400; }
.part-table .cur { background: var(--canvas); }
.kpi .label { font-size: 10px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value { margin-top: 2px; font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi small { display: block; margin-top: 1px; font-size: 10px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Lista de candidaturas */
.result-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.sym { display: flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; border-radius: 999px; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: -.02em; overflow: hidden; }
.result-info { flex: 1; min-width: 0; }
.result-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.party { font-size: 14px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.percentage { flex: none; font-size: 14px; font-weight: 700; color: var(--ink); }
.bar { height: 4px; margin: 5px 0 4px; border-radius: var(--r-bar); background: var(--line-soft); overflow: hidden; }
.bar span { display: block; height: 100%; border-radius: var(--r-bar); transition: width 900ms cubic-bezier(.33, 1, .68, 1); }
.result-numbers { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.result-numbers strong { font-weight: 600; }
.expand { display: flex; align-items: center; gap: 2px; margin: 8px 0 0; padding: 0; border: 0; background: none; color: rgb(var(--brand)); font-size: 12px; font-weight: 500; }
.expand:hover { text-decoration: underline; }
.panel-note { margin: 16px 0 0; font-size: 11px; line-height: 1.6; color: var(--ink-muted); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: var(--r-bar); flex: none; vertical-align: -1px; }

/* Perfil social */
.social-stat { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.social-stat label { font-size: 13px; font-weight: 600; color: var(--ink); }
.social-stat strong { grid-row: span 2; align-self: center; font-size: 19px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.social-stat small { font-size: 11px; color: var(--ink-muted); }

/* Hemiciclo y composición */
#congress-panel .hemi-wrap { position: relative; }
#hemicycle { display: block; width: 100%; height: auto; }
#hemicycle .hemi-seat { transition: opacity .15s; }
#hemicycle.focus .hemi-seat:not(.on) { opacity: .3; }
.hemi-majority { margin-top: 6px; text-align: center; font-size: 12px; color: var(--ink-3); }
.hemi-majority strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.party-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; }
.party-list button { display: flex; align-items: center; gap: 10px; width: 100%; height: 100%; min-height: 60px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-field); background: #fff; text-align: left; transition: opacity .15s, border-color .15s, box-shadow .15s; }
.party-list button:hover { border-color: var(--ink-faint); }
.party-list button.on { border-color: var(--ink-3); box-shadow: var(--shadow-ctrl); }
.party-list.focus button:not(.on) { opacity: .4; }
.party-list .sym { flex: none; width: 36px; height: 36px; font-size: 10px; }
.party-list .pl-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; line-height: 1.2; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.party-list .pl-n { flex: none; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Mesas */
.supplementary { margin-top: 8px; }
.supplementary h2 { margin: 0 0 8px; font-size: 16px; font-weight: 700; color: var(--ink); }
.supplementary details { border-top: 1px solid var(--line-soft); }
.supplementary details:last-of-type { border-bottom: 1px solid var(--line-soft); }
.supplementary summary { padding: 10px 0; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid var(--line-soft); }
th { font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-faint); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ── Filtros ───────────────────────────────────────────────────────────────── */
.filters-card { position: absolute; z-index: 25; top: 10px; left: 0; right: 0; display: flex; align-items: center; gap: 6px; padding: 0 12px; overflow-x: auto; pointer-events: none; }
.filters-card > * { pointer-events: auto; }
.filters-card .rotulo { display: none; }
.filters-card label { flex: none; font-size: 0; }
select, .dd-btn {
  -webkit-appearance: none; appearance: none;
  height: 36px; padding: 0 30px 0 12px; border: 0; border-radius: var(--r-field);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center / 14px;
  box-shadow: var(--shadow-ctrl);
  font-size: 15px; font-weight: 700; color: var(--ink);
  max-width: 220px; text-overflow: ellipsis;
}
select:disabled, .dd-btn:disabled { opacity: .5; }
.dd-native { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0; pointer-events: none; }
.dd-btn { display: inline-flex; align-items: center; text-align: left; white-space: nowrap; cursor: pointer; }
.dd-btn[hidden] { display: none !important; }
.dd-btn span { overflow: hidden; text-overflow: ellipsis; }
.dd-btn[aria-expanded="true"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B6B6B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 15 6-6 6 6'/%3E%3C/svg%3E"); }
/* Lista desplegable: tarjeta blanca, opción elegida con fondo suave (DecideBrasil). */
.dd-pop { position: fixed; z-index: 90; max-height: min(340px, 60vh); overflow-y: auto; margin: 0; padding: 6px; list-style: none; background: #fff; border-radius: 12px; box-shadow: var(--shadow-card-soft); }
.dd-pop li { padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink); white-space: nowrap; cursor: pointer; outline: none; }
.dd-pop li:hover, .dd-pop li:focus-visible { background: var(--line-soft); }
.dd-pop li.on { background: #e6ebf2; color: var(--ink-strong); }
.f-head { display: flex; align-items: center; justify-content: space-between; }
.f-collapse, .filters-tab { display: none; }
#app[data-tab="social"] .f-election, #app[data-tab="elections"] .f-year, #app[data-tab="history"] .f-election, #app[data-tab="history"] .f-level, #app[data-tab="history"] .f-metric, #app[data-tab="history"] .f-year, #app[data-tab="history"] .reset { display: none; }
#app[data-tab="sources"] .filters-card { display: none; }
/* Comparar años no tiene filtros: sin card ni pestaña de filtros. */
#app[data-tab="history"] .filters-card, #app[data-tab="history"] #filters-tab { display: none !important; }
/* Provincia: se llega navegando el mapa o con el buscador; el select queda oculto (sigue sincronizado con el estado). */
.filters-card .f-province { display: none !important; }

#status { position: absolute; z-index: 15; top: 48px; left: 12px; right: 12px; font-size: 11px; color: var(--ink-muted); pointer-events: none; }
#status.error { color: var(--bad); }
#status.idle { visibility: hidden; }
#app[data-tab="history"] #status, #app[data-tab="sources"] #status { display: none; }

/* ── Páginas (Comparar años, Fuentes) ──────────────────────────────────────── */
.page { position: absolute; inset: 0; overflow-y: auto; background: var(--canvas); }
#history { padding: 56px 12px 32px; }
.page-inner { max-width: 1120px; margin: 0 auto; padding: 20px 12px 40px; }
.card { background: #fff; border-radius: var(--r-sheet); box-shadow: var(--shadow-card-soft); }
#history .hist-card { padding: 20px; }
.page h2 { margin: 6px 0 0; font-size: 25px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.page h3 { margin: 8px 0 10px; font-size: 18px; font-weight: 700; color: var(--ink); }
.page p { font-size: 14px; line-height: 1.55; color: var(--ink-3); }
.history-chart { margin: 12px 0; overflow-x: auto; }
.history-chart svg { width: 100%; min-width: 600px; height: auto; display: block; }
.history-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.history-legend span { display: inline-flex; align-items: center; gap: 6px; }
.source-intro { max-width: 760px; margin-bottom: 20px; }
.source-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.source-grid .card { padding: 22px; }
.source-grid .eyebrow { font-size: 11px; color: var(--ink-faint); }
.source-grid a { font-size: 13px; font-weight: 600; line-height: 1.8; }

/* ── Menú lateral ──────────────────────────────────────────────────────────── */
#scrim { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, .4); }
#drawer { position: fixed; z-index: 61; top: 0; bottom: 0; left: 0; width: min(360px, 88vw); display: flex; flex-direction: column; background: var(--paper); color: var(--ink); box-shadow: var(--shadow-rail); }
.drawer-band { flex: none; display: flex; align-items: center; justify-content: space-between; height: 96px; padding: var(--safe-top) 20px 0; background: var(--navy); color: #fff; }
.drawer-band .logo svg { height: 44px; }
.drawer-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; padding: 16px 20px 24px; }
.drawer-body .rotulo { margin-top: 24px; }
.menu-list { display: flex; flex-direction: column; }
.menu-list > * { display: flex; align-items: center; justify-content: space-between; height: 48px; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 0 4px; font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; text-align: left; }
.menu-list > button { text-transform: uppercase; letter-spacing: .02em; font-size: 14px; }
.menu-list > *:hover { color: var(--ink-strong); background: rgba(0, 0, 0, .03); }
.menu-list .muted { font-weight: 400; margin-right: 1px; }
.drawer-foot { margin-top: auto; padding-top: 28px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.drawer-foot .micro { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); text-decoration: none; }
.drawer-foot .unh { font: 800 15px "Hanken Grotesk", sans-serif; letter-spacing: .2em; color: var(--ink-faint); text-decoration: none; margin-bottom: 8px; }

/* ── Desktop ≥1280 ─────────────────────────────────────────────────────────── */
@media (min-width: 1280px) {
  #topbar { height: 96px; padding: 20px 32px; border-bottom: 0; box-shadow: none; }
  .top-row { display: flex; justify-content: space-between; gap: 24px; padding: 0; height: 56px; }
  .top-left { gap: 16px; flex: 1; }
  .hbtn { width: 40px; height: 40px; }
  .hbtn svg { width: 24px; height: 24px; }
  /* Título: se achica con la ventana y, si aun así no cabe, recorta el subtítulo con "…" en vez de cortar en seco. */
  #page-title { display: flex; align-items: baseline; gap: .25em; min-width: 0; margin: 0; padding: 4px 0; font-size: clamp(28px, 2.6vw, 38px); line-height: 1.15; letter-spacing: -.02em; font-weight: 700; white-space: nowrap; }
  #page-name { flex: none; }
  #page-sub { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  #page-sub { font-weight: 400; color: rgba(255, 255, 255, .6); }
  .logo svg { height: 56px; }
  .top-row .logo svg { height: 46px; }
  .search-box { position: absolute; top: 24px; left: 144px; width: min(760px, calc(100% - 144px - 300px)); height: 48px; margin: 0; }
  .search-box input { font-size: 17px; }
  #app:has(.search-box.open) #page-title { visibility: hidden; }

  /* Rail: 92px, se expande a 196px por encima del contenido */
  #nav { position: fixed; z-index: 30; top: 96px; left: 0; bottom: 0; width: 92px; display: flex; flex-direction: column; padding: 16px 2px 16px 14px; background: var(--navy-rail); color: #fff; overflow: hidden auto; transition: width .15s ease-out; }
  #nav:hover, #nav:has(:focus-visible) { width: 228px; box-shadow: var(--shadow-rail); }
  .nav-tabs { flex-direction: column; justify-content: flex-start; gap: 14px; height: auto; padding: 0; overflow: visible; }
  .nav-tabs button { height: 40px; padding: 0 8px 0 0; border: 0; border-radius: 12px; color: rgba(255, 255, 255, .7); font-size: 14px; font-weight: 600; }
  .nav-tabs button.active { color: #fff; font-size: 14px; }
  .nav-tabs .ico { display: flex; align-items: center; justify-content: center; width: 76px; flex: none; }
  .nav-tabs .ico svg { width: 40px; height: 40px; padding: 9px; border-radius: 12px; transition: background .15s; }
  .nav-tabs button.active .ico svg { background: rgba(255, 255, 255, .15); }
  .nav-tabs button:hover .ico svg { background: rgba(255, 255, 255, .1); }
  .nav-tabs button:hover { color: #fff; }
  .nav-tabs .lbl, .nav-types .lbl { display: none; }
  .rail-div { display: block; flex: none; height: 1px; width: 28px; margin: 14px auto 14px 24px; background: rgba(255, 255, 255, .2); }
  .nav-types { flex-direction: column; gap: 4px; padding: 0; background: none; border: 0; overflow: visible; }
  .nav-types button { display: flex; align-items: center; height: 40px; padding: 0; border: 0; border-radius: 12px; color: rgba(255, 255, 255, .7); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
  .nav-types button:hover { background: rgba(255, 255, 255, .1); color: #fff; }
  .nav-types button.active { background: rgba(255, 255, 255, .15); color: #fff; border: 0; font-weight: 700; }
  .nav-types .sig { display: flex; justify-content: center; width: 76px; flex: none; }
  #nav:hover .lbl, #nav:has(:focus-visible) .lbl { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #nav:hover .nav-types .sig, #nav:has(:focus-visible) .nav-types .sig { display: none; }
  #nav:hover .nav-types .lbl, #nav:has(:focus-visible) .nav-types .lbl { padding: 0 12px 0 20px; text-transform: uppercase; }
  #nav:hover .nav-tabs button.active, #nav:has(:focus-visible) .nav-tabs button.active { background: rgba(255, 255, 255, .15); }
  #nav:hover .nav-tabs button.active .ico svg, #nav:has(:focus-visible) .nav-tabs button.active .ico svg { background: none; }
  #nav:hover .rail-div, #nav:has(:focus-visible) .rail-div { width: auto; margin: 14px 0; }
  #app[data-tab="social"] .nav-types, #app[data-tab="sources"] .nav-types { display: flex; opacity: .35; pointer-events: none; }

  /* Franja de territorio + cifras */
  #franja { display: flex; flex: none; align-items: center; gap: 8px; height: 36px; margin-left: 92px; padding: 0 24px; background: #fff; border-bottom: 1px solid rgba(0, 0, 0, .1); position: relative; z-index: 20; }
  #franja .pin svg { width: 16px; height: 16px; display: block; color: var(--ink-2); }
  #franja-name { font-size: 14px; font-weight: 700; color: var(--ink); }
  #cifras { display: flex; gap: 24px; margin-left: auto; }
  #cifras div { display: flex; align-items: baseline; gap: 6px; }
  #cifras span { font-size: 10px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-faint); }
  #cifras strong { font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
  #app[data-tab="sources"] #franja, #app[data-tab="history"] #cifras { visibility: hidden; }

  #main { margin-left: 92px; }

  /* Card de resultados flotante a la izquierda */
  .results-card { top: 16px; left: 24px; bottom: 16px; right: auto; width: 528px; height: auto; border-radius: var(--r-card); box-shadow: var(--shadow-card); }
  .sheet-handle { display: none; }
  .card-head { padding: 16px 20px 0; }
  .head-row h2 { font-size: 28px; }
  .crumbs { font-size: 15px; }
  .card-body { padding: 0 20px 20px; }
  .strip { gap: 12px; }
  /* Panel lateral (DecideBrasil → PanelLateral, ancho "medio"): mismo alto que la card, metido
     18px por DEBAJO de ella para que su sombra le dé profundidad. La card va de 24 a 552. */
  #part-backdrop:not([hidden]) { position: absolute; z-index: 18; background: transparent; }
  .side-panel:not([hidden]) { position: absolute; z-index: 19; top: 16px; bottom: 16px; left: 534px; right: auto; max-height: none; padding-bottom: 0; width: 760px; max-width: calc(100% - 534px - 16px); background: #fff; border-radius: 0 var(--r-card) var(--r-card) 0; box-shadow: var(--shadow-card); }
  .side-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 24px 16px 58px; border-bottom: 1px solid var(--line-soft); }
  .side-head h2 { margin: 0; font-size: 25px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; color: var(--ink); }
  .side-head p { margin: 0; font-size: 12px; color: var(--ink-3); }
  .side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 24px 16px 58px; }
  .part-table { font-size: 14px; }
  .kpi .value { font-size: 16px; }
  .sym { width: 44px; height: 44px; font-size: 12px; }
  .result-row { gap: 12px; padding: 7px 0; }
  .party { font-size: 18px; font-weight: 700; }
  .percentage { font-size: 19px; }
  .result-numbers { font-size: 13px; }
  .party-list .pl-name { font-size: 15px; }
  .party-list .pl-n { font-size: 22px; }

  /* Filtros: tarjeta flotante a la derecha */
  .filters-card { top: 16px; left: auto; right: 16px; width: 200px; display: block; padding: 16px; overflow: visible; background: #fff; border-radius: 18px; box-shadow: var(--shadow-card-soft); pointer-events: auto; }
  .filters-card .rotulo { display: block; margin: 0; }
  .filters-card label { display: block; margin-top: 12px; font-size: 11px; font-weight: 500; letter-spacing: .03em; text-transform: uppercase; color: var(--ink-faint); }
  .filters-card .dd-btn { display: flex; width: 100%; max-width: none; height: 40px; margin-top: 4px; border: 1px solid var(--line); border-radius: var(--r-field); box-shadow: none; font-size: 14px; text-transform: none; letter-spacing: 0; }
  .filters-card .dd-btn:hover, .filters-card .dd-btn[aria-expanded="true"] { border-color: var(--ink-faint); }
  .f-collapse { display: grid; place-items: center; width: 24px; height: 24px; margin: -4px -6px -4px 0; border: 0; border-radius: 6px; background: none; color: var(--ink-faint); }
  .f-collapse:hover { background: var(--line-soft); color: var(--ink); }
  .f-collapse svg, .filters-tab svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
  .filters-card.collapsed { display: none; }
  /* Pestaña vertical a la derecha cuando el panel está colapsado. */
  .filters-tab:not([hidden]) { position: absolute; z-index: 25; top: 16px; right: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 14px 10px; border: 0; border-radius: 14px 0 0 14px; background: #fff; box-shadow: var(--shadow-card-soft); color: var(--ink-3); }
  .filters-tab span { writing-mode: vertical-rl; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
  .filters-tab:hover { color: var(--ink); }

  .legend { left: 584px; bottom: 24px; max-width: calc(100% - 584px - 260px); }
  .legend .lg-title { font-size: 13px; }
  .legend .lg-body { gap: 8px; margin-top: 6px; }
  .legend .lg-cuts { height: 52px; font-size: 11px; }
  .legend .lg-bands { width: 36px; height: 52px; }
  .legend .lg-col span { margin-top: 4px; font-size: 11px; max-width: 60px; }
  .legend .lg-ramp { font-size: 12px; }
  .legend .lg-ramp .ramp { width: 180px; height: 12px; }
  .legend .lg-note { font-size: 11px; }
  .map-controls { flex-direction: row; right: 20px; bottom: 20px; }
  .map-controls .dark { display: flex; }
  #status { top: auto; left: auto; bottom: 68px; right: 20px; max-width: 380px; text-align: right; }

  #history { padding: 24px 32px 40px 24px; }
  #history .hist-card { padding: 28px; max-width: 1120px; margin: 0 auto; }
  .page-inner { padding: 32px 32px 48px; }
  .source-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .bar span, #nav, #map-layer path { transition: none; }
}

/* Listas proclamadas 2026; separadas de los resultados históricos. */
#app[data-tab="candidates"] .filters-card,
#app[data-tab="candidates"] #filters-tab,
#app[data-tab="candidates"] .nav-types,
#app[data-tab="candidates"] #search-box,
#app[data-tab="candidates"] #cifras { display:none !important; }
#candidates .card { padding:24px; }
.candidate-filters { display:flex; flex-wrap:wrap; gap:12px; margin:20px 0; }
.candidate-filters label { display:grid; gap:6px; flex:1 1 180px; font-size:13px; }
.candidate-filters input,.candidate-filters select { padding:10px; border:1px solid var(--line,#ddd); border-radius:6px; background:white; min-width:0; font:inherit; }
.candidate-party { display:block; color:var(--ink-3); margin-top:4px; }
.candidate-pages { display:flex; gap:16px; align-items:center; flex-wrap:wrap; margin:18px 0; }
.candidate-pages button { padding:8px 14px; border:1px solid #ddd; border-radius:6px; }
#candidates table { min-width:720px; }
#candidates th,#candidates td { padding:10px 12px; text-align:left; }

/* Toggle segmentado, lupa y búsqueda (panel del partido) y filas de candidatos */
.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--line-soft); }
.seg button { padding: 4px 10px; border: 0; border-radius: 6px; background: none; font-size: 12px; font-weight: 500; color: var(--ink-muted); cursor: pointer; }
.seg button[aria-pressed="true"] { background: #032753; color: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.seg button:disabled { opacity: .45; cursor: not-allowed; }
.hemi-lupa { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.hemi-lupa:hover, .hemi-lupa[aria-expanded="true"] { background: var(--line-soft); }
.hemi-lupa svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.hemi-search { margin: 0 0 8px; }
.hemi-search[hidden] { display: none; }
.hemi-search input { width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-field); font-size: 14px; color: var(--ink); background: #fff; }
.hemi-search input:focus { outline: none; border-color: var(--ink-3); }
.cand-rows { margin: 8px 0 0; padding: 0; list-style: none; }
.cand-rows li { border-bottom: 1px solid var(--line-soft); min-width: 0; }
.cand-rows button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 2px; border: 0; background: none; text-align: left; cursor: pointer; }
.cand-rows button:hover { background: var(--line-soft); }
.cand-av { position: relative; flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 2px solid; border-radius: 50%; background: #EEF1F5; font-size: 13px; font-weight: 700; color: var(--ink-3); }
.cand-av .sym { position: absolute; right: -4px; bottom: -4px; width: 20px; height: 20px; font-size: 6px; font-style: normal; border: 2px solid #fff; }
.cand-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cand-l1, .cand-l2 { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cand-name { min-width: 0; font-size: 15px; font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cand-ok { flex: none; color: #1E9E5A; font-size: 13px; }
.cand-pct { flex: none; margin-left: auto; font-size: 15px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.cand-dist { min-width: 0; font-size: 12px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cand-tag { flex: none; padding: 1px 6px; border-radius: 4px; background: var(--line-soft); font-size: 9px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; color: var(--ink-muted); }
.cand-votes { flex: none; margin-left: auto; font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
/* Paginación */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 12px 0 4px; font-size: 13px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.pager button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: var(--line-soft); font-size: 18px; line-height: 1; color: var(--ink); cursor: pointer; }
.pager button:disabled { opacity: .35; cursor: default; }
.pager button:not(:disabled):hover { background: var(--line); }
/* Escritorio: dos columnas de candidatos en el panel lateral */
@media (min-width: 1280px) { .side-panel .cand-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; grid-template-rows: repeat(var(--rows, 10), auto); grid-auto-flow: column; } }

/* Panel del partido: toggle Por provincia | Candidatos bajo los totales */
.party-tools { display: flex; align-items: center; gap: 8px; margin: 20px 0 8px; }
.party-seg { display: flex; flex: 1; }
.party-seg button { flex: 1; padding: 6px 10px; font-size: 13px; }
.party-seg small { margin-left: 4px; font-size: 11px; opacity: .75; }

/* ── Inicio (réplica de DecideBrasil) ───────────────────────────────────── */
#app[data-tab="home"] .nav-types, #app[data-tab="home"] .rail-div, #app[data-tab="home"] .filters-card, #app[data-tab="home"] #filters-tab, #app[data-tab="home"] #status { display: none !important; }
#home { padding: 16px 12px 28px; background: #f0f0f0; }
.home-grid { display: flex; flex-direction: column; gap: 14px; }
.home-left, .home-right { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.hcard { display: flex; flex-direction: column; min-width: 0; padding: 14px 16px 12px; background: #fff; border-radius: 12px; box-shadow: 0 3.54px 13.88px 2.78px rgba(0,0,0,.25); color: #3C3C3C; overflow: hidden; }
.hcard > * { flex-shrink: 0; }
.hc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.hc-tl { min-width: 0; }
.hc-tl h2 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.3px; line-height: 1.05; color: #3C3C3C; }
.hc-stats { margin: 4px 0 0; font-size: 11px; color: #8A8A8A; }
.hc-stats b { color: #3C3C3C; font-weight: 600; }
.hc-dot { color: #D0D0D0; }
.hc-dash { color: #AAAAAA; }
.hc-act { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.hc-more { display: inline-flex; align-items: center; gap: 2px; padding: 0; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 500; color: #2150E8; cursor: pointer; }
.hc-more svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.5; }
.hc-more:hover { text-decoration: underline; }
/* Firma @DecideEspaña: misma tipografía, tamaño y azul en todas las cards (gana a `.page p`). */
.hcard .hc-sig { margin: 8px 0 0; text-align: center; font-family: var(--mono); font-size: 11px; font-weight: 400; line-height: 1.4; letter-spacing: 0; color: #2150E8; }
/* Cards de cámara: hemiciclo + grilla de partidos */
.hc-fig { display: flex; align-items: center; gap: 16px; margin-top: 17px; }
.hc-hemi { flex: 1.2; min-width: 0; width: 100%; height: auto; }
.gp-grid { flex: 1; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; }
.gp { display: flex; flex-direction: column; align-items: center; min-width: 0; text-align: center; }
.gp b { font-size: 20px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.gp span { max-width: 100%; font-size: 11px; font-weight: 600; color: #8A8A8A; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Comparador territorial */
.hc-cmp-card .cmp-sel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.cmp-maps { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; padding-top: 26px; border-top: 1px solid #EEEEF0; }
.cmp-maps figure { margin: 0; min-width: 0; }
.cmp-maps figcaption { text-align: center; font-size: 15px; font-weight: 700; color: #3C3C3C; }
.cmp-maps figcaption small { font-weight: 400; color: #8A8A8A; }
.cmp-map { display: block; width: 100%; height: auto; margin-top: 6px; }
.cmp-map path { stroke: #fff; stroke-width: .6; vector-effect: non-scaling-stroke; }
.hcard .cmp-sig { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); margin: 0; white-space: nowrap; }
.cmp-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 12px; margin-top: 8px; font-size: 11px; color: #8A8A8A; }
.cmp-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; }
.cmp-text { display: flex; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid #EEEEF0; border-radius: 10px; }
.cmp-text svg { flex: none; width: 18px; height: 18px; fill: none; stroke: #2150E8; stroke-width: 1.6; stroke-linejoin: round; }
.cmp-text p { margin: 0; font-size: 12px; line-height: 1.5; color: #3C3C3C; }
@media (min-width: 1280px) {
  #home { padding: 32px 32px 24px; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; height: var(--hblock, 760px); }
  .home-left { display: grid; grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; min-height: 0; }
  .home-left > .hcard, .home-right > .hcard { min-height: 0; overflow-y: auto; scrollbar-width: none; }
  .home-left > .hcard::-webkit-scrollbar, .home-right > .hcard::-webkit-scrollbar { display: none; }
  .home-right { min-height: 0; }
  .home-right > .hc-cmp-card { height: 100%; }
  .hc-tl h2 { font-size: 30px; }
  .hc-stats { font-size: 15px; }
  .hc-body .hc-fig { flex: 1; min-height: 0; }
  .hc-hemi { max-height: 100%; }
  .hc-cmp-card .cmp-maps { flex: 1; min-height: 0; align-items: center; }
  .cmp-map { max-height: calc(var(--hblock, 760px) - 330px); }
}

/* Selectores del comparador (Select de DecideBrasil) */
.cmp-dd { position: relative; min-width: 0; }
.cmp-dd-btn { display: flex; align-items: center; justify-content: space-between; gap: 4px; width: 100%; height: 28px; padding: 0 10px; border: 1px solid #EEEEF0; border-radius: 8px; background: #FAFAFA; font: inherit; font-size: 12px; font-weight: 700; color: #4F4F4F; text-align: left; cursor: pointer; }
.cmp-dd-btn span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-dd-btn svg { flex: none; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.cmp-dd-btn:hover { border-color: #E0E0E0; }
.cmp-dd-btn[aria-expanded="true"] { border-color: #032753; box-shadow: 0 0 0 1px #032753; }
.cmp-dd-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.cmp-dd-pop { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 240px; overflow-y: auto; padding: 4px 0; border-radius: 8px; background: #fff; box-shadow: 0 0 8px 0 rgba(0,0,0,.15); }
.cmp-dd-pop[hidden] { display: none; }
.cmp-dd-group { padding: 8px 10px 2px; font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #A8A8A8; }
.cmp-dd-pop [role="option"] { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 10px; border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; color: #4F4F4F; text-align: left; white-space: nowrap; cursor: pointer; }
.cmp-dd-pop [role="option"]:hover, .cmp-dd-pop [role="option"]:focus-visible { background: #F5F5F7; outline: none; }
.cmp-dd-pop [aria-selected="true"], .cmp-dd-pop [aria-selected="true"]:hover { color: #032753; background: rgba(3,39,83,.10); }
.cmp-dd-tag { padding: 0 6px; border-radius: 999px; background: #EEEEF0; font-size: 9px; font-weight: 700; letter-spacing: .05em; color: #A8A8A8; }
@media (min-width: 1280px) {
  .cmp-dd-btn { height: 34px; font-size: 14px; }
  .cmp-dd-group { font-size: 11px; }
  .cmp-dd-pop [role="option"] { font-size: 14px; }
}

/* Comparador: botón de opciones avanzadas, fila de elecciones y leyenda de rampa */
.cmp-adv-btn { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 8px; background: none; color: #8A8A8A; cursor: pointer; }
.cmp-adv-btn:hover, .cmp-adv-btn[aria-expanded="true"] { background: #F5F5F7; color: #3C3C3C; }
.cmp-adv-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.hc-cmp-card .cmp-adv { margin-top: 8px; }
.hc-cmp-card .cmp-adv[hidden] { display: none; }
.cmp-ramp { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-size: 11px; color: #8A8A8A; font-variant-numeric: tabular-nums; }
.cmp-ramp .ramp { display: inline-flex; }
.cmp-ramp .ramp i { display: block; width: 22px; height: 9px; }
.cmp-ramp .ramp i:first-child { border-radius: 2px 0 0 2px; } .cmp-ramp .ramp i:last-child { border-radius: 0 2px 2px 0; }
.cmp-nd { margin-left: 8px; } .cmp-nd i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 2px; vertical-align: -1px; }

/* Votos del territorio en cards (mismo componente que la composición) */
.vote-cards { margin-top: 8px; }
.vote-cards .vc-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.vote-cards .vc-txt small { font-size: 11px; color: var(--ink-muted); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vote-cards .pl-n { display: flex; flex-direction: column; align-items: flex-end; line-height: 1; font-variant-numeric: tabular-nums; }
.vote-cards .pl-n small { margin-top: 3px; font-size: 9px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; opacity: .8; }

/* ── Header: bandera de la familia Decide (solo móvil) ── */
.flag-wrap { position: relative; flex: none; }
.flag-btn { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; background: none; cursor: pointer; }
.flag { display: block; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; flex: none; }
.flag svg { display: block; width: 100%; height: 100%; }
.flag-btn .flag { border: 2px solid rgba(255,255,255,.2); box-sizing: border-box; }
.flag-wrap.open::before { content: ""; position: fixed; inset: 0; z-index: 49; background: rgba(20,20,20,.2); }
.flag-menu { position: absolute; z-index: 50; left: 0; top: calc(100% + 4px); min-width: 180px; padding: 4px 0; border: 1px solid #375377; border-radius: 8px; background: #1c3c64; box-shadow: 0 20px 25px -5px rgba(0,0,0,.25); overflow: hidden; }
.flag-menu[hidden] { display: none; }
.flag-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 15px; font-weight: 500; color: rgba(255,255,255,.9); text-decoration: none; }
.flag-item .flag { width: 24px; height: 24px; }
.flag-item.on { font-weight: 600; color: #fff; background: rgba(255,255,255,.08); cursor: default; }
a.flag-item:hover { background: rgba(255,255,255,.1); }
.flag-item .muted { opacity: .7; }
/* ── Botón de alertas ── */
.top-right { display: flex; justify-content: flex-end; align-items: center; }
.alert-btn { display: inline-flex; align-items: center; justify-content: center; gap: 3px; height: 26px; min-width: 42px; padding: 4px 6px; border: 1px solid #d9938f; border-radius: 6px; background: #b3261e; color: #eeeef0; box-shadow: 0 5.54px 21.73px 0 rgba(0,0,0,.25); cursor: pointer; transition: opacity .15s; }
.alert-btn:hover { opacity: .9; } .alert-btn:active { opacity: .75; }
.alert-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#alert-count { font-size: 12px; font-weight: 600; letter-spacing: .1em; }
/* ── Panel de alertas: móvil cuelga del header (navy); escritorio lateral derecho ── */
.alert-scrim { position: fixed; inset: var(--alert-top, 0) 0 0 0; z-index: 1000; background: rgba(0,0,0,.4); }
.alert-scrim[hidden], .alert-panel[hidden] { display: none; }
.alert-panel { position: fixed; z-index: 1001; left: 0; right: 0; top: var(--alert-top, 54px); bottom: 12px; display: flex; flex-direction: column; background: #032753; border-radius: 0 0 20px 20px; box-shadow: 0 25px 50px -12px rgba(0,0,0,.25); overflow: hidden; color: #fff; }
.alert-scrim { top: var(--alert-top, 54px); }
.ap-head { flex: none; padding: 16px 16px 4px; }
.ap-logo { display: none; }
.ap-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ap-row h2 { margin: 0; font-size: 19px; font-weight: 700; letter-spacing: -.01em; color: #fff; }
.ap-close { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: none; color: rgba(255,255,255,.5); cursor: pointer; }
.ap-close:hover { background: rgba(255,255,255,.1); color: #fff; }
.ap-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.ap-sub { display: none; }
.ap-body { position: relative; flex: 1; min-height: 0; }
.ap-list { height: 100%; overflow-y: auto; padding: 12px 12px 20px; }
.ap-chev { display: none; }
.ap-day { margin: 12px 0 8px 2px; font-size: 13px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.ap-day:first-child { margin-top: 0; }
.ap-card { margin-bottom: 8px; padding: 12px 14px; border-radius: 12px; background: #fff; color: #3c3c3c; }
.ap-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.ap-card-head strong { font-size: 14px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; }
.ap-card time { flex: none; font-size: 10px; color: #a8a8a8; }
.ap-card p { margin: 0; font-size: 14px; font-weight: 300; line-height: 1.4; }
.ap-empty { margin-top: 8px; padding: 40px 16px; border: 1px solid rgba(255,255,255,.08); border-radius: 12px; background: rgba(255,255,255,.04); text-align: center; font-size: 15px; font-weight: 500; color: rgba(255,255,255,.6); }
@media (min-width: 1280px) {
  .flag-wrap { display: none; }
  .top-right { flex: none; order: -1; }
  .top-row > .top-left { order: -2; }
  .alert-btn { height: 36px; padding: 0 8px; }
  .alert-scrim { inset: 0; top: 0; z-index: 200; background: rgba(0,0,0,.3); }
  .alert-panel { top: 0; bottom: 0; left: auto; right: 0; z-index: 201; width: 460px; border-radius: 0; background: #FAFAFA; color: #3c3c3c; }
  .ap-head { height: 178px; display: flex; flex-direction: column; justify-content: center; padding: 0 24px; background: #032753; color: #fff; }
  .ap-logo { display: block; margin-bottom: 16px; }
  .ap-logo svg { display: block; height: 36px; width: auto; }
  .ap-row h2 { font-size: 28px; letter-spacing: -.02em; }
  .ap-close { width: 24px; height: 24px; color: rgba(255,255,255,.7); }
  .ap-close svg { width: 24px; height: 24px; }
  .ap-sub { display: block; margin: 4px 0 0; font-family: var(--mono); font-size: 14px; letter-spacing: .03em; color: rgba(255,255,255,.5); }
  .ap-list { padding: 12px 50px 12px 24px; }
  .ap-chev { position: absolute; right: 24px; top: 50%; transform: translateY(-50%); display: flex; flex-direction: column; gap: 8px; }
  .ap-chev button { display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: rgba(0,0,0,.06); color: #555; cursor: pointer; }
  .ap-chev button:hover { background: rgba(0,0,0,.1); }
  .ap-chev svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .ap-day { color: #a8a8a8; }
  .ap-card { border: 1px solid #EBEBEB; }
  .ap-card-head strong, .ap-card p { font-size: 18px; }
  .ap-card time { font-size: 14px; }
  .ap-empty { border-color: #EBEBEB; background: #fff; color: #ADADAD; }
}

/* ── Menú (estilo DecideBrasil): pantalla clara, filas con ícono y chevron, familia Decide con banderas ── */
#drawer { background: #FAFAFA; color: #3C3C3C; }
#drawer .drawer-band { height: auto; padding: calc(var(--safe-top) + 28px) 24px 8px; background: none; color: #3C3C3C; }
#drawer .drawer-band .logo { display: none; }
.lang-pill { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border-radius: 8px; background: #EEEEF0; font-size: 15px; font-weight: 600; color: #3C3C3C; }
#drawer #drawer-close { width: 40px; height: 40px; color: #3C3C3C; }
#drawer #drawer-close svg { width: 30px; height: 30px; stroke-width: 1.8; }
#drawer .drawer-body { padding: 24px 24px 28px; }
#drawer .menu-list > * { display: flex; align-items: center; gap: 18px; height: 72px; padding: 0 2px; border: 0; border-bottom: 1px solid #E0E0E0; background: none; font: inherit; text-align: left; color: #3C3C3C; text-decoration: none; cursor: pointer; }
#drawer .menu-list > *:hover { background: rgba(0,0,0,.03); }
#drawer .menu-list > button { text-transform: uppercase; letter-spacing: .01em; }
#drawer .mi-lbl { flex: 1; min-width: 0; font-size: 18px; font-weight: 700; }
#drawer .fam .mi-lbl { font-size: 18px; font-weight: 700; text-transform: none; }
#drawer .fam .muted { font-weight: 400; color: #8A8A8A; margin-right: 0; }
#drawer .mi-ico { flex: none; width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#drawer .fam .flag { width: 28px; height: 28px; }
#drawer .mi-go { flex: none; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#drawer .drawer-foot { margin-top: auto; padding-top: 24px; gap: 10px; }
#drawer .drawer-foot .micro { font-size: 12px; letter-spacing: .08em; color: #A8A8A8; }
#drawer .unh { margin: 0 0 4px; }
.unh-logo { display: block; height: 22px; width: auto; opacity: .4; }
.foot-link { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: #A8A8A8; text-decoration: underline; text-underline-offset: 3px; }
.foot-link.plain { text-decoration: none; max-width: 280px; line-height: 1.5; }
@media (max-width: 1279px) { #drawer { width: 100vw; } }
