/* ==========================================================================
   Apuração 2026 — sistema visual
   Mobile-first; tokens claros/escuros; tipografia Inter com números tabulares.
   ========================================================================== */
:root {
  color-scheme: light;
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #f2f1ed;
  --surface-3: #e9e7e1;
  --border: #e4e2dc;
  --border-strong: #d3d0c8;
  --text: #121212;
  --text-2: #4a4945;
  --muted: #76746d;
  --accent: #121212;
  --lula: #d93b34;
  --flavio: #2a78d6;
  --t2: #8f8d86;
  --other: #c98500;
  --grid: #ebe9e4;
  --pending: #e6e4de;
  --map-stroke: #ffffff;
  --state-stroke: #4a4945;
  --l1: #f4c2bd; --l2: #e9877f; --l3: #d93b34; --l4: #9e1f19;
  --f1: #b7d3f6; --f2: #6da7ec; --f3: #2a78d6; --f4: #184f95;
  --ok: #0ca30c;
  --sobe: #0f7a30; /* variação para cima (texto) */
  --desce: #c4271f; /* variação para baixo (texto) */
  --warn: #e5a00d;
  --crit: #d03b3b;
  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(18, 18, 18, .03), 0 1px 3px rgba(18, 18, 18, .04), 0 12px 32px -18px rgba(18, 18, 18, .18);
  --header-h: 64px;
  --footer-h: 46px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e0e0d;
    --surface: #171716;
    --surface-2: #1f1f1d;
    --surface-3: #292927;
    --border: #2a2a27;
    --border-strong: #3a3a36;
    --text: #f4f3ee;
    --text-2: #c3c2b7;
    --muted: #8e8d85;
    --accent: #f4f3ee;
    --lula: #ec5a52;
    --flavio: #4b93ec;
    --t2: #8f8d86;
    --other: #d99a1a;
    --grid: #262624;
    --pending: #2b2b28;
    --map-stroke: #171716;
    --state-stroke: #c3c2b7;
    --l1: #5a2420; --l2: #8f2a24; --l3: #c63a33; --l4: #ef5b53;
    --f1: #173a63; --f2: #1c5cab; --f3: #2f7bd9; --f4: #5aa0f0;
    --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 12px 32px -20px rgba(0, 0, 0, .8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e0e0d;
  --surface: #171716;
  --surface-2: #1f1f1d;
  --surface-3: #292927;
  --border: #2a2a27;
  --border-strong: #3a3a36;
  --text: #f4f3ee;
  --text-2: #c3c2b7;
  --muted: #8e8d85;
  --accent: #f4f3ee;
  --lula: #ec5a52;
  --flavio: #4b93ec;
  --t2: #8f8d86;
  --other: #d99a1a;
  --grid: #262624;
  --pending: #2b2b28;
  --map-stroke: #171716;
  --state-stroke: #c3c2b7;
  --l1: #5a2420; --l2: #8f2a24; --l3: #c63a33; --l4: #ef5b53;
  --f1: #173a63; --f2: #1c5cab; --f3: #2f7bd9; --f4: #5aa0f0;
  --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 12px 32px -20px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 110px); }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1, "ss01" 1;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px));
}
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.015em; }
h1 { font-size: 1.05rem; font-weight: 700; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .74rem; font-weight: 650; margin-bottom: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
a { color: inherit; }
abbr { text-decoration: none; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.eyebrow { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ghost {
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: .38rem .8rem; color: var(--text-2); font-size: .85rem; line-height: 1.2; min-height: 34px;
  transition: background .15s, border-color .15s;
}
.ghost:hover { background: var(--surface-2); border-color: var(--border-strong); }
a.ghost { display: inline-flex; align-items: center; text-decoration: none; white-space: nowrap; }
.how::after { content: "→"; margin-left: .4rem; transition: transform .15s; }
.how:hover::after { transform: translateX(2px); }
:focus-visible { outline: 2px solid var(--flavio); outline-offset: 2px; border-radius: 6px; }

/* ---------- topo */
.top {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .65rem; min-width: 0; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none; position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--lula) 0 50%, var(--flavio) 50% 100%);
}
.brand-mark::after { content: ""; position: absolute; inset: 9px 7px; border-radius: 3px; background: var(--surface); opacity: .92; }
.title { min-width: 0; }
.title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { margin: .1rem 0 0; color: var(--muted); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { display: flex; align-items: center; gap: .5rem; flex: none; }
.badge {
  display: inline-flex; align-items: center; gap: .4rem; font-size: .7rem; font-weight: 650;
  padding: .3rem .6rem; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
  text-transform: uppercase; letter-spacing: .05em; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--t2); flex: none; }
.badge.live { color: var(--text); }
.badge.live::before { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: pulse 1.8s infinite; }
.badge.sim::before { background: var(--warn); }
.badge.err::before { background: var(--crit); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (prefers-reduced-motion: reduce) { .badge.live::before { animation: none; } * { transition: none !important; } }
#theme { width: 34px; padding: 0; flex: none; }
.viewers {
  display: inline-flex; align-items: center; gap: .3rem; font-size: .74rem; font-weight: 600; color: var(--text-2);
  padding: .28rem .55rem; border-radius: 999px; background: var(--surface-2); white-space: nowrap;
}
.viewers[hidden] { display: none; }
.viewers svg { width: 14px; height: 14px; fill: currentColor; opacity: .75; }
.viewers b { font-weight: 700; color: var(--text); }

.nav { display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px .55rem; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  flex: none; text-decoration: none; font-size: .86rem; font-weight: 550; color: var(--text-2);
  padding: .36rem .8rem; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent); color: var(--surface); }
.nav .sm { display: none; }
/* abas principais (Presidente, Governadores); abaixo, as sub-abas com as seções da página */
.tabs { display: flex; gap: 1.4rem; margin: 0 -16px .45rem; padding: 0 16px; border-bottom: 1px solid var(--border); }
.tabs a { position: relative; text-decoration: none; font-size: .95rem; font-weight: 600; color: var(--text-2); padding: .15rem 0 .5rem; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); }
.tabs a.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent); }
.nav.secoes a { font-size: .82rem; padding: .3rem .75rem; }
.nav.secoes a.on { background: var(--surface-2); color: var(--text); }

.progress-row { display: flex; align-items: center; gap: .9rem; padding-bottom: .55rem; }
.progress { flex: 1; height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; box-shadow: inset 0 0 0 1px var(--border); }
.progress-fill { height: 100%; width: 0; background: var(--text); border-radius: 999px; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.progress-label { font-size: .86rem; font-weight: 550; color: var(--text-2); white-space: nowrap; }
.progress-label strong { font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-right: .1rem; }
.progress-detail { font-size: .74rem; color: var(--muted); padding-bottom: .55rem; margin-top: -.3rem; }
#updated { font-size: .74rem; }

/* ---------- conteúdo e cards */
main { padding-top: 1rem; padding-bottom: 2.5rem; display: flex; flex-direction: column; gap: 1rem; }
main > * { min-width: 0; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.1rem 1rem 1.15rem; box-shadow: var(--shadow); min-width: 0;
}
.card-head { margin-bottom: .9rem; }
.card-head.row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.card-head p { margin: .25rem 0 0; }
/* marca-texto ao lado do título do medidor: deixa claro que o número é uma probabilidade, não votos */
.tag-prob { display: inline-block; margin-left: .45rem; padding: .2rem .6rem; border-radius: 999px; background: #ffd60a; color: #121212; box-shadow: 0 0 0 3px color-mix(in srgb, #ffd60a 35%, transparent); font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; vertical-align: 2px; white-space: nowrap; }
.alert {
  display: flex; gap: .6rem; align-items: flex-start;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); background: color-mix(in srgb, var(--warn) 9%, var(--surface));
  border-radius: var(--radius-sm); padding: .65rem .85rem; font-size: .86rem; color: var(--text-2);
}
.alert[hidden] { display: none; }
.alert::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-top: .45rem; flex: none; }

/* ---------- medidor */
.meter-numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; margin: .2rem 0 .8rem; }
.mnum { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.mnum.t2 { align-items: center; text-align: center; }
.mnum.flavio { align-items: flex-end; text-align: right; }
.mnum .mlabel { display: inline-flex; align-items: center; gap: .35rem; font-size: .74rem; color: var(--text-2); line-height: 1.25; }
.mnum .swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.mnum strong { font-size: clamp(1.75rem, 8.5vw, 3.4rem); font-weight: 750; letter-spacing: -.035em; line-height: 1; }
.mnum.lula strong { color: var(--lula); }
.mnum.flavio strong { color: var(--flavio); }
.mnum.lula .swatch, .seg.lula { background: var(--lula); }
.mnum.flavio .swatch, .seg.flavio { background: var(--flavio); }
.mnum.t2 .swatch, .seg.t2 { background: var(--t2); }
.meter-bar { display: flex; gap: 3px; height: 14px; border-radius: 999px; overflow: hidden; background: var(--surface-2); }
.seg { height: 100%; transition: flex-basis 1s cubic-bezier(.2, .8, .2, 1); flex: 0 0 0; min-width: 0; }
.meter-sub { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; margin-top: 1.3rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.history { position: relative; }
.history svg, #projection svg { display: block; width: 100%; height: auto; overflow: visible; }
.axis text { fill: var(--muted); font-size: 11px; font-family: inherit; }
.axis path, .axis line { stroke: var(--grid); }
.gridline { stroke: var(--grid); }
.refline { stroke: var(--text-2); stroke-dasharray: 3 3; }
.reflabel { fill: var(--text-2); font-size: 11px; }
.dlabel { font-size: 12px; font-weight: 650; fill: var(--text); }
.dlabel-sub { font-size: 11px; fill: var(--muted); }

/* ---------- grade principal */
.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.map-wrap { position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 80vh; border-radius: var(--radius-sm); overflow: hidden; touch-action: none; background: var(--surface); }
#map { width: 100%; height: 100%; display: block; cursor: grab; }
#map:active { cursor: grabbing; }
#map .unit { stroke: var(--map-stroke); stroke-width: .35; vector-effect: non-scaling-stroke; transition: fill .4s; }
#map .unit:hover { stroke: var(--text); stroke-width: 1.5; }
#map .states-mesh { fill: none; stroke: var(--state-stroke); stroke-width: .8; vector-effect: non-scaling-stroke; pointer-events: none; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.controls { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.seg-ctl { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; }
.seg-ctl button { border: 0; background: transparent; padding: .32rem .8rem; color: var(--text-2); border-radius: 999px; font-size: .84rem; min-height: 30px; }
.seg-ctl button.on { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.legend { display: flex; flex-wrap: wrap; gap: .45rem 1.1rem; margin-top: .8rem; font-size: .76rem; color: var(--text-2); align-items: center; }
.legend > span { display: inline-flex; align-items: center; }
.legend .ramp { display: inline-flex; gap: 2px; margin-right: .4rem; }
.legend .ramp i, .legend .sw { display: inline-block; width: 14px; height: 9px; border-radius: 2px; }
.legend .sw { margin-right: .35rem; }
.note { margin: .7rem 0 0; font-size: .78rem; line-height: 1.45; }

/* ---------- candidatos */
.cand { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .15rem .6rem; padding: .55rem 0; border-top: 1px solid var(--border); }
.cand:first-child { border-top: 0; padding-top: 0; }
.cand .name { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand .name small { font-weight: 450; color: var(--muted); margin-left: .35rem; font-size: .76rem; }
.cand .pct { font-weight: 700; text-align: right; }
.cand .bar { grid-column: 1 / -1; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.cand .bar i { display: block; height: 100%; border-radius: 3px; background: var(--t2); transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.cand.lula .bar i { background: var(--lula); }
.cand.flavio .bar i { background: var(--flavio); }
.cand .votes { grid-column: 1 / -1; font-size: .74rem; color: var(--muted); }
.cand.minor { padding: .3rem 0; }
.cand.minor .bar { height: 3px; }
.cand.minor .votes { display: none; }
.cand.minor .name, .cand.minor .pct { font-size: .82rem; font-weight: 500; }
.cand-sep { margin-top: .7rem; padding-top: .7rem; border-top: 1px solid var(--border-strong); font-size: .7rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); }
.cand.nv { border-top: 0; }
.cand.nv .votes { display: block; }
.cand.nv .bar i { background: var(--border-strong); }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem 1rem; margin: 0; }
.stats div { min-width: 0; }
.stats dt { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 650; }
.stats dd { margin: .1rem 0 0; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; }
.stats dd small { font-weight: 450; color: var(--muted); font-size: .76rem; display: block; letter-spacing: 0; }

/* ---------- tabelas */
.table-wrap { overflow-x: auto; margin: 0 -1rem; padding: 0 1rem; -webkit-overflow-scrolling: touch; }
table.states { width: 100%; border-collapse: collapse; font-size: .86rem; }
.states th { text-align: left; font-weight: 650; color: var(--muted); padding: .5rem .5rem; border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap; user-select: none; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; }
.states th.sorted::after { content: " ↓"; }
.states th.sorted.asc::after { content: " ↑"; }
.states td { padding: .5rem .5rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.states tr:last-child td { border-bottom: 0; }
.states .num { text-align: right; }
.states tbody tr { cursor: pointer; transition: background .12s; }
.states tbody tr:hover { background: var(--surface-2); }
.states .mini { display: inline-block; width: 46px; height: 5px; background: var(--surface-3); border-radius: 3px; margin-left: .4rem; vertical-align: middle; overflow: hidden; }
.states .mini i { display: block; height: 100%; background: var(--text-2); }
.lead-l { color: var(--lula); font-weight: 650; }
/* dois candidatos numa célula: um por linha, com a bolinha da cor de cada um; o maior em negrito */
.par { display: block; white-space: nowrap; font-variant-numeric: tabular-nums; }
.par::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; background: var(--muted); }
.par.l::before { background: var(--lula); }
.par.f::before { background: var(--flavio); }
.par.ga::before { background: var(--ga); }
.par.gb::before { background: var(--gb); }
.par.lider { font-weight: 650; color: var(--text); }
.par.inline { display: inline; }
.dd-par .par { font-size: 1rem; }
.muted .par.lider { color: inherit; }
.lead-f { color: var(--flavio); font-weight: 650; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .4rem; vertical-align: 1px; }

.method p, .method li { color: var(--text-2); max-width: 72ch; font-size: .92rem; }
.method ol { padding-left: 1.2rem; }
.method li { margin-bottom: .45rem; }

/* ---------- exterior */
.ext-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.world-wrap { width: 100%; aspect-ratio: 1.9 / 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); touch-action: none; }
#world { width: 100%; height: 100%; display: block; cursor: grab; }
#world .country { fill: var(--surface); stroke: var(--border-strong); stroke-width: .5; vector-effect: non-scaling-stroke; transition: fill .4s; }
#world .country.br { fill: var(--surface-3); }
#world .country.has-data { fill-opacity: .55; stroke: var(--surface); }
#world .country.has-data:hover { fill-opacity: .8; }
#world .city { stroke: var(--surface); stroke-width: 1; vector-effect: non-scaling-stroke; }
#world .city.pending { fill: none; stroke: var(--muted); stroke-width: 1; }
#world .city:hover { stroke: var(--text); stroke-width: 2; }
.ext-side { display: flex; flex-direction: column; gap: .9rem; min-width: 0; }
.ext-tabs { align-self: flex-start; }
.ext-list { max-height: 340px; overflow: auto; border-top: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.ext-table th { position: sticky; top: 0; background: var(--surface); cursor: default; z-index: 1; }
.ext-table td:first-child { max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
/* exterior × 1º turno: tabelinha Lula/Flávio nos dois turnos e quem ganhou fatia */
.sobe { color: var(--sobe); }
.desce { color: var(--desce); }
.ext-1t .ext-dois { display: block; margin-bottom: .15rem; }
.ext-table .ext-el { display: block; color: var(--muted); font-size: .74rem; margin: .05rem 0 0 calc(8px + .4rem); white-space: normal; }
/* celular: 4 colunas sem rolagem de lado — letra um pouco menor, nome e "Diferença" quebram linha */
@media (max-width: 639px) {
  .ext-table { font-size: .84rem; }
  .ext-table th, .ext-table td { padding-left: .25rem; padding-right: .25rem; }
  .ext-table td:first-child { max-width: 132px; white-space: normal; }
  .ext-table th { font-size: .62rem; letter-spacing: .03em; }
  .ext-cmp { font-size: .84rem; }
  .ext-cmp th { font-size: .62rem; letter-spacing: .03em; }
  .ext-cmp th, .ext-cmp td { padding-left: .25rem; padding-right: .25rem; }
}
/* celular: colunas de largura fixa (a tabela nunca passa da tela); nomes longos quebram com hífen */
@media (max-width: 639px) {
  .ext-table { table-layout: fixed; width: 100%; }
  .ext-table th:nth-child(1) { width: 28%; }
  .ext-table th:nth-child(2) { width: 24%; }
  .ext-table th:nth-child(3) { width: 24%; }
  .ext-table th:nth-child(4) { width: 24%; }
  .ext-table td:first-child { max-width: none; overflow-wrap: anywhere; -webkit-hyphens: auto; hyphens: auto; }
}
.ext-table th, .ext-table td { padding-left: .4rem; padding-right: .4rem; }
.ext-1t h3 { margin-bottom: .3rem; }
.ext-1t > p { margin: 0; }
.ext-cmp { width: 100%; margin: .45rem 0 0; font-variant-numeric: tabular-nums; }
.ext-cmp th, .ext-cmp td { padding: .4rem .35rem; cursor: default; }
.ext-cmp tbody tr { cursor: default; }
.ext-cmp tbody tr:hover { background: none; }
.ext-1t .ext-cmp-nota { margin-top: .55rem; color: var(--text-2); }

/* ---------- página dos estados */
.uf-picker { display: flex; gap: .3rem; overflow-x: auto; scrollbar-width: none; margin: 0 -1rem; padding: 0 1rem .2rem; -webkit-overflow-scrolling: touch; }
.uf-picker::-webkit-scrollbar { display: none; }
.uf-picker button {
  flex: none; border: 1px solid var(--border); background: var(--surface); border-radius: 10px;
  min-width: 46px; padding: .4rem .5rem; font-weight: 650; font-size: .82rem; letter-spacing: .02em; text-transform: uppercase;
}
.uf-picker button.on { background: var(--accent); color: var(--surface); border-color: var(--accent); }
.race-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.race-head { display: flex; justify-content: space-between; align-items: baseline; gap: .6rem; flex-wrap: wrap; margin-bottom: .8rem; }
.race-head .kpi { font-size: .82rem; color: var(--text-2); }
.race-head .kpi b { font-size: 1.05rem; color: var(--text); }
.rc { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .25rem .7rem; padding: .65rem 0; border-top: 1px solid var(--border); align-items: center; }
.rc:first-of-type { border-top: 0; }
.rc .nm { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc .nm small { color: var(--muted); font-weight: 450; margin-left: .3rem; font-size: .75rem; }
.rc .pv { text-align: right; font-weight: 700; font-size: .95rem; }
.rc .track { grid-column: 1 / -1; position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; }
.rc .track .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--text-2); opacity: .85; }
.rc .track .range { position: absolute; top: -3px; bottom: -3px; border-radius: 3px; border: 1.5px solid var(--text); opacity: .5; }
.rc .track .half { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 1.5px dashed var(--muted); }
.rc .meta { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .25rem .9rem; font-size: .74rem; color: var(--muted); }
.rc .meta b { color: var(--text); font-weight: 650; }
.prob-pill { display: inline-flex; align-items: center; gap: .3rem; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 650; background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.prob-pill.hi { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: color-mix(in srgb, var(--ok) 70%, var(--text)); }
.seats { display: flex; flex-direction: column; gap: .45rem; }
.seat-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) 58px; gap: .55rem; align-items: center; font-size: .82rem; }
.seat-row .sg { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-row .sbar { position: relative; height: 16px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.seat-row .sbar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--text-2); border-radius: 4px; }
.seat-row .sbar s { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--text-2) 22%, transparent); text-decoration: none; }
.seat-row .sn { text-align: right; font-weight: 700; }
.seat-row .sn small { display: block; font-weight: 450; color: var(--muted); font-size: .7rem; }
.search { width: 100%; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; padding: .55rem .75rem; font: inherit; font-size: .9rem; color: var(--text); margin: .3rem 0 .6rem; }
.empty { color: var(--muted); font-size: .88rem; padding: .6rem 0; }

/* ---------- tooltip */
.tooltip {
  position: fixed; z-index: 30; pointer-events: none; max-width: 280px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 12px; padding: .6rem .75rem; font-size: .8rem; box-shadow: 0 10px 30px -8px rgba(0, 0, 0, .28);
}
.tooltip .tt-title { font-weight: 650; margin-bottom: .15rem; }
.tooltip .tt-sub { color: var(--muted); margin-bottom: .4rem; }
.tooltip .tt-row { display: grid; grid-template-columns: 10px 1fr auto; gap: .45rem; align-items: center; }
.tooltip .tt-row i { width: 10px; height: 10px; border-radius: 3px; }
.tooltip .tt-row b { text-align: right; }

/* ---------- rodapé fixo */
.footer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; align-items: center; justify-content: center; gap: .9rem;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--border); font-size: .78rem; color: var(--muted);
}
.footer a { text-decoration: none; color: var(--text-2); }
.footer a:hover { color: var(--text); }
.powered { display: inline-flex; align-items: center; gap: .45rem; font-weight: 550; }
.powered b { color: var(--text); font-weight: 700; letter-spacing: -.01em; }
.powered .tf { width: 16px; height: 16px; border-radius: 5px; background: conic-gradient(from 210deg, #c9ccd3, #f4f5f7, #9aa0aa, #e6e8ec, #c9ccd3); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .12); }
.footer .sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
/* "Apoiar": o único pedido de apoio (sem cartão automático), em destaque, com o coração batendo */
.footer .apoiar { --apoio: #e5487f; position: relative; display: inline-flex; align-items: center; gap: .35rem; min-height: 32px; padding: 0 .8rem; border: 1px solid color-mix(in srgb, var(--apoio) 45%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--apoio) 13%, transparent); color: var(--text); font-size: .82rem; font-weight: 700; }
.footer .apoiar::after { content: ''; position: absolute; inset: -6px -2px; } /* área de toque de 44 px */
.footer .apoiar:hover { background: color-mix(in srgb, var(--apoio) 22%, transparent); border-color: var(--apoio); }
.footer .apoiar span { display: inline-block; color: var(--apoio); font-size: 1.05em; animation: coracao 1.5s ease-in-out infinite; }
@keyframes coracao { 0%, 50%, 100% { transform: scale(1); } 12% { transform: scale(1.3); } 25% { transform: scale(1); } 37% { transform: scale(1.18); } }
@media (prefers-reduced-motion: reduce) { .footer .apoiar span { animation: none; } }
[data-simulacao] .footer .apoiar, [data-simulacao] .footer .sep:has(+ .apoiar) { display: none; }

/* ---------- pedido de apoio: cartão acima do rodapé, sem fundo escuro nem bloqueio da página */
.apoio {
  position: fixed; z-index: 25; left: 12px; right: 12px; bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px) + 10px);
  max-width: 420px; margin: 0 auto; padding: 1rem;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .08), 0 18px 48px -12px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(14px); transition: opacity .22s ease, transform .22s ease;
}
.apoio.aberto { opacity: 1; transform: none; }
.apoio-x { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; border: 0; border-radius: 12px; background: none; color: var(--muted); font-size: 1.45rem; line-height: 1; }
.apoio-x:hover { color: var(--text); }
.apoio-q { margin: .1rem 2.4rem .85rem 0; font-size: 1rem; font-weight: 650; line-height: 1.35; letter-spacing: -.01em; }
.apoio-txt { margin: -.45rem 0 .85rem; color: var(--text-2); font-size: .88rem; line-height: 1.45; }
.apoio-chave { margin: 0 0 .85rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font: 500 .86rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; -webkit-user-select: all; user-select: all; }
.apoio-acoes { display: flex; flex-wrap: wrap; gap: .5rem; }
.apoio-btn { flex: 1 1 8.5rem; min-height: 46px; padding: .6rem .9rem; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface-2); color: var(--text); font-size: .95rem; font-weight: 600; white-space: nowrap; }
.apoio-btn:hover { border-color: var(--text-2); }
.apoio-btn.principal { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.apoio-btn:focus-visible, .apoio-x:focus-visible, .footer .apoiar:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
@media (min-width: 640px) {
  .apoio { left: auto; right: 20px; width: 380px; margin: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .apoio { transition: none; transform: none; }
}

/* ---------- breakpoints */
@media (min-width: 640px) {
  .card { padding: 1.3rem 1.4rem 1.4rem; }
  .table-wrap { margin: 0 -1.4rem; padding: 0 1.4rem; }
  .uf-picker { margin: 0 -1.4rem; padding: 0 1.4rem .2rem; }
  .meter-bar { height: 18px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  h1 { font-size: 1.15rem; }
}
@media (min-width: 900px) {
  .meter-sub { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
  .ext-grid { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .race-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-width: 1040px) {
  .grid { grid-template-columns: minmax(0, 1fr) 360px; }
  .side .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 360px) {
  .title h1 { font-size: .92rem; }
  .brand-mark { display: none; }
}
@media (max-width: 639px) {
  :root { --header-h: 56px; }
  .sub { display: none; }
  #updated { display: none; }
  .top-inner { gap: .5rem; }
  .brand { gap: .5rem; flex: 1 1 auto; }
  .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
  .brand-mark::after { inset: 8px 6px; }
  .title h1 { font-size: 1rem; overflow: visible; text-overflow: clip; }
  .status { gap: .35rem; }
  .badge { font-size: .62rem; padding: .26rem .5rem; letter-spacing: .04em; }
  .viewers { font-size: .7rem; padding: .26rem .5rem; }
  .viewers-label { display: none; }
  .nav .lg { display: none; }
  .nav .sm { display: inline; }
  .nav a { padding: .34rem .7rem; }
  .nav.secoes a { padding: .28rem .65rem; }
  #theme { width: 32px; min-height: 32px; }
  .map-wrap { aspect-ratio: 1 / 1.02; }
  .world-wrap { aspect-ratio: 1.55 / 1; }
  .seat-row { grid-template-columns: 74px minmax(0, 1fr) 48px; }
  .card-head.row { align-items: flex-start; }
  .footer .hide-sm { display: none; }
  .ov-table .uf-name { display: none; }
}
/* ---------- simulação por visitante (simulacao.js): painel fixo acima do rodapé */
body.com-sim { padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px) + 132px); }
.sim-painel {
  position: fixed; z-index: 19; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px) + 10px);
  width: min(640px, calc(100% - 32px)); box-sizing: border-box;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .55rem .9rem;
  padding: .7rem .8rem .7rem 1rem; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--border)); box-shadow: var(--shadow);
}
.sim-txt { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1 1 220px; font-size: .84rem; color: var(--text-2); }
.sim-txt strong { display: inline-flex; align-items: center; gap: .45rem; color: var(--text); font-size: .9rem; }
.sim-txt strong::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.sim-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.sim-ctl .ghost { min-height: 34px; padding: .3rem .8rem; font-size: .84rem; }
.sim-ir {
  min-height: 34px; padding: .3rem .95rem; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--surface); font-size: .84rem; font-weight: 600;
}
.sim-ir:hover { opacity: .88; }
.sim-ir:focus-visible, .sim-ctl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 520px) {
  body.com-sim { padding-bottom: calc(var(--footer-h) + env(safe-area-inset-bottom, 0px) + 168px); }
  .sim-painel { padding: .65rem .7rem; }
  .sim-ctl { width: 100%; justify-content: space-between; }
}
@media (forced-colors: active) {
  .seg, .cand .bar i { forced-color-adjust: none; }
}

/* ------------------------------------------------------------------ 2º turno */
.meter-numbers.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.transfer { display: grid; gap: .55rem; }
.tr-row { display: grid; grid-template-columns: minmax(7.5rem, 11rem) minmax(0, 1fr); gap: .8rem; align-items: center; cursor: default; }
.tr-name { display: flex; flex-direction: column; font-size: .86rem; font-weight: 550; line-height: 1.2; min-width: 0; }
.tr-name small { color: var(--muted); font-weight: 450; font-size: .74rem; }
.tr-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.tr-bar i { display: flex; align-items: center; justify-content: center; font-style: normal; font-size: .72rem; font-weight: 600; color: #fff; min-width: 0; white-space: nowrap; transition: width .8s cubic-bezier(.2, .8, .2, 1); }
.tr-bar i.l { background: var(--lula); }
.tr-bar i.f { background: var(--flavio); }
.tr-bar i.n { background: var(--surface-3); color: var(--text-2); }
.urnas-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
.urnas-grid h3 { display: flex; align-items: center; gap: .4rem; }
.urnas-hist svg { display: block; width: 100%; height: auto; overflow: visible; }
.urnas-listas { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.urnas-grid > *, .urnas-listas > *, .transfer > * { min-width: 0; }
.urnas-lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .35rem; font-size: .82rem; }
.urnas-lista li { display: flex; justify-content: space-between; gap: .6rem; padding: .35rem 0; border-bottom: 1px solid var(--border); min-width: 0; }
.urnas-lista .u-local { color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.urnas-lista .u-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) {
  .urnas-listas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; }
}
@media (max-width: 520px) {
  .tr-row { grid-template-columns: minmax(0, 1fr); gap: .25rem; }
  .urnas-lista li { flex-direction: column; gap: .1rem; }
}
/* governadores no 2º turno (governadores.html): cores neutras, que não associam partido a cor —
   roxo para o 1º colocado no 1º turno, verde-azulado para o 2º */
:root {
  --ga: #7c4ddb; --gb: #0f8f86;
  --ga1: #ddd0f7; --ga2: #b49be9; --ga3: #7c4ddb; --ga4: #4f2a9e;
  --gb1: #bfe6e2; --gb2: #74c6bd; --gb3: #0f8f86; --gb4: #07605a;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ga: #a07cf0; --gb: #2bb5aa;
    --sobe: #4cc76a; --desce: #f0605a;
    --ga1: #35255e; --ga2: #55389a; --ga3: #8460d8; --ga4: #b39af5;
    --gb1: #123d39; --gb2: #17675f; --gb3: #22a093; --gb4: #5fd3c7;
  }
}
:root[data-theme="dark"] {
  --ga: #a07cf0; --gb: #2bb5aa;
  --sobe: #4cc76a; --desce: #f0605a;
  --ga1: #35255e; --ga2: #55389a; --ga3: #8460d8; --ga4: #b39af5;
  --gb1: #123d39; --gb2: #17675f; --gb3: #22a093; --gb4: #5fd3c7;
}
.mnum.ga strong { color: var(--ga); }
.lead-ga { color: var(--ga); font-weight: 650; }
.lead-gb { color: var(--gb); font-weight: 650; }
.mnum.gb strong { color: var(--gb); }
.mnum.gb { align-items: flex-end; text-align: right; }
.mnum.ga .swatch, .seg.ga { background: var(--ga); }
.mnum.gb .swatch, .seg.gb { background: var(--gb); }
.cand.g0 .bar i { background: var(--ga); }
.cand.g1 .bar i { background: var(--gb); }
.gov-page .tr-bar i.l { background: var(--ga); }
.gov-page .tr-bar i.f { background: var(--gb); }
.gov-map { aspect-ratio: 1000 / 760; }
.gov-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
@media (min-width: 700px) { .gov-picker { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); } }
.gov-pick { display: grid; gap: .3rem; width: 100%; overflow: hidden; text-align: left; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; min-width: 0; }
.gov-pick:hover { border-color: var(--border-strong); }
.gov-pick.on { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.gov-pick .gp-head { display: flex; justify-content: space-between; gap: .3rem; align-items: baseline; font-size: .86rem; }
.gov-pick .gp-head strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gov-pick .gp-head > span { flex-shrink: 0; }
.gp-c { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .35rem; align-items: baseline; font-size: .76rem; }
.gp-c .gp-n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); padding-left: .55rem; position: relative; }
.gp-c .gp-n::before { content: ""; position: absolute; left: 0; top: .42em; width: 6px; height: 6px; border-radius: 50%; }
.gp-c.g0 .gp-n::before { background: var(--ga); }
.gp-c.g1 .gp-n::before { background: var(--gb); }
.gp-c .gp-v { font-variant-numeric: tabular-nums; color: var(--text-2); }
.gp-c b { font-variant-numeric: tabular-nums; }
.gp-c.g0 b { color: var(--ga); }
.gp-c.g1 b { color: var(--gb); }

/* 2º turno: quanto falta, margem, contado × projeção */
.meter-sub .span-all { grid-column: 1 / -1; }
.sub-head { display: flex; justify-content: space-between; align-items: center; gap: .4rem .8rem; flex-wrap: wrap; margin-bottom: .7rem; }
.sub-head h3 { margin: 0; }
.falta { margin: .8rem 0 0; padding: .6rem .8rem; border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9rem; line-height: 1.45; }
.falta b.lula { color: var(--lula); }
.falta b.flavio { color: var(--flavio); }
.falta b.ga { color: var(--ga); }
.falta b.gb { color: var(--gb); }
.margem { margin: .4rem 0 0; }

/* sua cidade, sua urna */
.busca { position: relative; max-width: 420px; }
.sugestoes { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); padding: .25rem; display: grid; }
.sugestoes button { text-align: left; border: 0; background: transparent; color: var(--text); padding: .45rem .6rem; border-radius: 6px; font: inherit; cursor: pointer; }
.sugestoes button:hover, .sugestoes button:focus { background: var(--surface-2); }
.sugestoes[hidden] { display: none; }
#cid-res { margin-top: 1rem; display: grid; gap: .8rem; }
.cid-head h3 { margin: 0 0 .5rem; font-size: 1.1rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.cid-table tr.cid-local { cursor: pointer; }
.cid-table tr.cid-local:hover td { background: var(--surface-2); }
.cid-table tr.cid-secao td { background: var(--surface-2); font-size: .82rem; }
.cid-table tr.cid-secao td:first-child { padding-left: 1.2rem; }

/* onde cada um cresceu */
.cres-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
.cres-var { display: grid; gap: .5rem; min-width: 0; }
.cres-var h3 { margin: 0 0 .1rem; }
.cres-row { display: grid; grid-template-columns: minmax(6.5rem, 8rem) minmax(0, 1fr) 4.9rem; grid-template-areas: "lab bar val" "lab det det"; column-gap: .7rem; row-gap: .15rem; align-items: center; min-width: 0; }
.cres-lab { grid-area: lab; font-size: .84rem; font-weight: 550; font-variant-numeric: tabular-nums; }
.cres-bar { grid-area: bar; position: relative; height: 16px; border-radius: 5px; background: var(--surface-2); overflow: hidden; }
.cres-bar i { position: absolute; top: 0; bottom: 0; transition: left .8s cubic-bezier(.2, .8, .2, 1), width .8s cubic-bezier(.2, .8, .2, 1); }
.cres-bar i.l { background: var(--lula); }
.cres-bar i.f { background: var(--flavio); }
.cres-bar.t1 i { opacity: .55; }
.cres-zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--text-2); }
.cres-media { position: absolute; top: -2px; bottom: -2px; width: 0; border-left: 2px dashed var(--text); opacity: .55; }
.cres-val { grid-area: val; text-align: right; font-size: .86rem; font-variant-numeric: tabular-nums; }
.cres-det { grid-area: det; color: var(--muted); font-size: .74rem; min-width: 0; }
@media (min-width: 1040px) {
  .cres-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.6rem; }
}
.cid-perfil-tit { margin: .9rem 0 .4rem; padding-top: .7rem; border-top: 1px solid var(--border); font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
