[hidden] { display: none !important; }
:root {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #141e32;
  --surface-2: #1b2740;
  --surface-inner: #0f172a;   /* bloco dentro de um cartão */
  --line: #ffffff17;
  --line-strong: #ffffff29;
  --track: #233047;
  --text: #e2e8f0;            /* 13,5:1 sobre --surface */
  --muted: #94a3b8;           /* 5,8 a 7,3:1 em todas as superfícies */
  --ink-progress: #cbd5e1;    /* apuração = processo: neutra, nunca cor de partido nem de status */
  --accent: #22d3ee;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;             /* só em ponto de status de erro; nunca perto de candidato */
  --sim: #c084fc;
  --gov: #fbbf24;             /* marcador "G" de disputa para governador */
  /* Escala de texto em rem; piso de 12 px. */
  --fs-xs: .75rem;
  --fs-sm: .8125rem;
  --fs-base: .9375rem;
  --fs-md: 1rem;
  --fs-lg: 1.1875rem;
  --fs-hero: clamp(2.25rem, 1.2rem + 3.2vw, 3.5rem);
  /* Espaço (base 4 px) e raios */
  --s-1: .25rem;
  --s-2: .5rem;
  --s-3: .75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --radius: 16px;
  --radius-inner: 12px;
  --r-chip: 6px;
  --radius-control: 999px;
  /* Movimento: a mesma curva do contador de números do app.js (ease-out cúbico, 3 s). */
  --dur-count: 3s;
  --ease-count: cubic-bezier(.33, 1, .68, 1);
  --header-height: 74px;
  --history-height: 0px;
  --top-stuck: var(--header-height);
  --sticky-top: calc(var(--header-height) + var(--history-height) + 16px);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
html { background: var(--bg); scroll-padding-top: var(--sticky-top); }
body { margin: 0; color: var(--text); background: var(--bg); line-height: 1.45; }
a { color: #7dd3fc; }
h1, h2, h3 { margin: 0 0 10px; line-height: 1.2; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-base); }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-xs); font-weight: 400; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: #000; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cabeçalho */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, #0e162a, var(--bg)); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; flex-direction: column; }
.brand-mark { font-size: 18px; font-weight: 800; letter-spacing: .02em; }
.brand-sub { font-size: var(--fs-xs); color: var(--muted); }
.nav { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.nav a { color: var(--text); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-color: var(--accent); }
.health { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: var(--fs-sm); color: var(--muted); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: var(--fs-xs); border: 1px solid var(--line); background: var(--surface); color: var(--text); white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
/* Um único pulso: três vezes ao entrar no estado "ao vivo", depois o ponto descansa. */
.pill-live::before { background: var(--ok); box-shadow: 0 0 0 0 rgba(52,211,153,.6); animation: pulse 2s 3; }
.pill-quiet::before { background: var(--ok); }
.pill-stale::before { background: var(--warn); }
.pill-error::before { background: var(--bad); }
.pill-sim::before { background: var(--sim); }
.pill-final::before { background: var(--accent); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(52,211,153,.6); } 70% { box-shadow: 0 0 0 8px rgba(52,211,153,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); } }
.audience { padding-left: 12px; border-left: 1px solid var(--line); white-space: nowrap; }
.audience #audience-count { font-variant-numeric: tabular-nums; }

.banner { padding: 10px 20px; font-size: 14px; }
.banner-sim { background: #3b0764; color: #f5d0fe; }
.banner-preview { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; background: #12313e; color: #a5f3fc; }
.banner-history { position: sticky; top: var(--top-stuck); z-index: 25; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; background: #1e3a8a; color: #dbeafe; }
.pill-history::before { background: #93c5fd; }

main { max-width: 1840px; margin: 0 auto; padding: 18px 24px 40px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.dashboard-content { display: grid; gap: 18px; min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: inset 0 1px 0 #ffffff04, 0 10px 32px -24px #00000070; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.toggle { font-size: 14px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.btn-small, .layer-btn { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 6px 12px; font-size: var(--fs-sm); cursor: pointer; transition: background-color .18s, border-color .18s; }
.btn-small:hover { background: #253650; border-color: #ffffff30; }
.live-indicator { display: inline-flex; align-items: center; gap: 8px; color: #6ee7b7; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }
.live-indicator i { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.layer-btn.active { border-color: var(--accent); color: var(--accent); }
.layers { display: flex; flex-wrap: wrap; gap: 6px; }

/* Resumo presidencial: candidatos em ordem fixa (a = esquerda, b = direita) e o duelo contra 50% */
.hero { position: relative; overflow: hidden; background: linear-gradient(120deg, #16213a, #111b30); }
.hero-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.1fr) minmax(0,1fr); gap: 16px; align-items: stretch; }
.cand { padding: 16px; border-radius: var(--radius-inner); background: var(--surface-inner); border: 1px solid var(--line); border-top: 3px solid var(--c, var(--muted)); min-width: 0; }
.cand.leader { background: color-mix(in srgb, var(--c) 7%, var(--surface-inner)); border-color: color-mix(in srgb, var(--c), transparent 55%); border-top-color: var(--c); }
.cand-b { text-align: right; }
.cand-b .cand-head { flex-direction: row-reverse; }
.cand-b .cand-name { justify-content: flex-end; }
.cand-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.cand-head .cand-name { min-width: 0; font-size: var(--fs-base); }
.candidate-avatar { position: relative; display: inline-grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; overflow: hidden; background: #243449; color: var(--text); border: 1px solid #ffffff26; font-size: var(--fs-xs); font-weight: 700; }
.candidate-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.hero-avatar { width: 60px; height: 60px; font-size: 18px; }
.candidate-identity { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.candidate-identity > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.cand-name { font-size: var(--fs-base); font-weight: 700; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; }
.cand-party { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
.cand-pct { display: block; font-size: var(--fs-hero); font-weight: 800; letter-spacing: -.03em; line-height: 1; color: var(--c); margin: 4px 0 6px; }
.cand-votes { display: block; font-size: var(--fs-sm); color: var(--muted); }
.cand-status { min-height: 0; margin-top: 6px; }
.hero-mid { display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 8px 4px; text-align: center; min-width: 0; }
.diff { font-size: var(--fs-base); }
.diff strong { font-size: 24px; display: block; }
.hero-wait { margin: 0; color: var(--muted); font-size: var(--fs-sm); line-height: 1.5; text-wrap: balance; }
.hero-wait strong { color: var(--text); }
.progress { height: 8px; background: var(--track); border-radius: 8px; overflow: hidden; contain: layout paint; }
.progress > span { display: block; height: 100%; background: var(--ink-progress); border-radius: 8px; }
/* Duelo: Lula da esquerda, Flávio da direita; o entalhe marca a maioria (50%). Anima só transform. */
.duel-wrap { grid-column: 1 / -1; }
.duel { position: relative; height: 14px; border-radius: 999px; background: var(--track); overflow: hidden; contain: layout paint; }
.duel > span { position: absolute; inset-block: 0; width: 100%; background: var(--c); transform: scaleX(var(--v, 0)); transition: transform var(--dur-count) var(--ease-count); }
.duel > .duel-a { left: 0; transform-origin: left center; }
.duel > .duel-b { right: 0; transform-origin: right center; }
.duel-mid { position: absolute; left: 50%; inset-block: 0; width: 2px; margin-left: -1px; background: var(--text); box-shadow: 0 0 0 2px var(--surface-inner); }
/* Projeção do onh sob o duelo (≥ 70% apurado): colchete = faixa provável; triângulo = ponto projetado. */
.duel-proj-row { position: relative; height: 12px; margin-top: 2px; }
.duel-proj { position: absolute; top: 0; height: 7px; border: 1.5px solid #e2e8f0; border-top: 0; border-radius: 0 0 4px 4px; opacity: .85; }
.duel-proj > b { position: absolute; top: 2px; translate: -50% 0; border: 5px solid transparent; border-top: 0; border-bottom-color: #fff; }
.duel-proj-note { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px; margin: 6px 0 0; font-size: var(--fs-sm); color: var(--text); text-align: center; }
.proj-tag, .fc-stage { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.fc-stage { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 10px; }
.badge-projection { color: #a5f3fc; background: #083344; border-color: #22d3ee; border-style: dashed; text-transform: none; letter-spacing: 0; }
.ev-now-proj { flex-basis: 100%; color: var(--muted); }
.ev-now-proj b { color: var(--c, var(--text)); font-weight: 700; font-variant-numeric: tabular-nums; }
.duel-note { display: flex; justify-content: center; margin-top: 6px; font-size: var(--fs-xs); color: var(--muted); }
.duel.is-small { height: 6px; margin-top: 8px; }
.duel.is-small .duel-mid { width: 1px; margin-left: 0; background: #e2e8f0b3; box-shadow: none; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; font-size: var(--fs-sm); color: var(--muted); }
/* Fatos secundários em linha, separados por fios (sem caixa dentro de caixa) */
.hero-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 18px 0 12px; border-block: 1px solid var(--line); }
.hero-stats > div { padding: 10px 14px; border-left: 1px solid var(--line); }
.hero-stats > div:first-child { border-left: 0; padding-left: 0; }
.hero-stats span { display: block; color: var(--muted); font-size: var(--fs-xs); }
.hero-stats b { display: block; margin-top: 2px; font-size: var(--fs-md); }
/* Aguardando: zeros esmaecidos (o dado é zero, não destaque) */
.hero-grid.is-awaiting .cand-pct { color: color-mix(in srgb, var(--c) 40%, var(--muted)); }
.badge { display: inline-block; padding: 3px 8px; border-radius: var(--r-chip); font-size: var(--fs-xs); font-weight: 700; line-height: 1.4; border: 1px solid; }
.badge-official { color: #6ee7b7; background: #064e3b; border-color: #047857; }
.badge-guaranteed { color: #a7f3d0; background: #065f46; border-color: #10b981; }
.badge-conditional, .badge-runoff, .badge-likely { color: #fde68a; background: #422006; border-color: #a16207; }
.badge-out { color: #cbd5e1; background: #1e293b; border-color: #475569; }
.badge-stale { color: #fde68a; background: #422006; border-color: #a16207; }
.badge-final { color: #a5f3fc; background: #164e63; border-color: #0891b2; }
.others { margin-top: 12px; font-size: var(--fs-sm); color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; }

/* Simulação: marca que sobrevive a recorte de tela (o número sempre leva "simulação" junto) */
html[data-sim] #resumo::after { content: "SIMULAÇÃO"; position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(3rem, 11vw, 8.5rem); font-weight: 900; letter-spacing: .08em; color: #c084fc1c; rotate: -10deg; pointer-events: none; }
html[data-sim] .cand-pct::after, html[data-sim] .fc-pct::after { content: "simulação"; display: block; margin-top: 4px; font-size: var(--fs-xs); font-weight: 700; letter-spacing: .02em; color: var(--sim); }

/* Barras de candidatos (detalhe de UF) */
.rows { display: grid; gap: 10px; }
.row { display: grid; gap: 4px; }
.row-label { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-sm); }
.row-label b { font-weight: 700; }
.row-metrics { text-align: right; white-space: nowrap; }
.row-metrics .pct { font-weight: 800; font-size: var(--fs-md); color: var(--c, var(--text)); }
.row-metrics .votes { display: block; font-size: var(--fs-xs); color: var(--muted); }
.track { height: 9px; background: var(--track); border-radius: 6px; overflow: hidden; contain: layout paint; }
.track > span { display: block; height: 100%; border-radius: 6px; background: var(--c, var(--accent)); }

/* Mapa */
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 20px; align-items: start; }
#mapa > .section-head { align-items: flex-start; gap: 14px; margin-bottom: 18px; }
#mapa > .section-head h2 { width: 100%; }
.map { width: 100%; }
.map-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: var(--fs-xs); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid #0b1120; }
.legend i.gov-marker, .gov-indicator { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; border-radius: 50%; background: var(--gov); border: 2px solid #0b1120; color: #0b1120; font: 900 12px/1 system-ui, sans-serif; }
.gov-indicator { margin-left: 6px; vertical-align: middle; }
.zz-box { width: 100%; display: grid; gap: 12px; text-align: left; background: linear-gradient(125deg, #18354b, #12243c); border: 1px solid #3b7086; color: var(--text); border-radius: var(--radius-inner); padding: 16px; font: inherit; cursor: pointer; box-shadow: 0 8px 24px #02061740; }
.zz-box:hover, .zz-box.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 8px 24px #02061740; }
.zz-heading { display: flex; align-items: center; gap: 10px; color: #e0f7ff; font-size: 17px; }
.zz-heading svg { color: var(--accent); flex-shrink: 0; }
.zz-heading .zz-arrow { margin-left: auto; color: var(--accent); }
.zz-progress { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: #b8d8e7; font-size: var(--fs-xs); }
.zz-progress b { color: #f0f9ff; font-size: 24px; }
.zz-track { display: block; height: 5px; background: #081a2c; border-radius: 4px; overflow: hidden; contain: layout paint; }
.zz-track > span { display: block; height: 100%; background: var(--ink-progress); }
.zz-candidate { display: flex; justify-content: space-between; gap: 8px; font-size: var(--fs-xs); }
.zz-candidate b { color: var(--c); white-space: nowrap; }
.zz-countries { margin-top: -6px; padding: 0 4px; font-size: var(--fs-xs); }
.map-side { display: grid; gap: 14px; min-width: 0; }
.card, .map-column, .uf-detail, .regions { min-width: 0; }
.regions { overflow-x: auto; }
/* Por região: linhas separadas por fios, com o duelo pequeno */
.region-legend { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 8px; font-size: var(--fs-xs); margin-bottom: 4px; }
.region-list { display: grid; }
.region-item { padding: 10px 0; border-top: 1px solid var(--line); }
.region-item:first-child { border-top: 0; }
.region-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; font-size: var(--fs-sm); }
.region-head > span { color: var(--muted); font-size: var(--fs-xs); white-space: nowrap; }
.region-scores { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin: 4px 0 0; }
.region-scores strong { font-size: var(--fs-base); }
.region-scores small { color: var(--muted); font-size: var(--fs-xs); text-align: center; line-height: 1.25; white-space: pre-line; }
.regions-waiting { margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.uf-detail { background: var(--surface-inner); border: 1px solid var(--line); border-radius: var(--radius-inner); padding: 16px; }
.uf-detail-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 10px; margin-bottom: 8px; }
.uf-detail-head h3 { font-size: 17px; margin: 0; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 4px 10px; font-size: var(--fs-xs); color: var(--muted); margin-top: 10px; }
.kv b { color: var(--text); font-weight: 600; }
.regions table, .table-scroll table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.regions th, .regions td, .table-scroll th, .table-scroll td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.regions th:first-child, .regions td:first-child, .table-scroll th:first-child, .table-scroll td:first-child { text-align: left; }
.regions th, .table-scroll th { color: var(--muted); font-weight: 500; }
.table-scroll { overflow-x: auto; }
.table-scroll tr[data-uf] { cursor: pointer; }
.table-scroll tr[data-uf]:hover { background: var(--surface-2); }
.table-wrap { margin-top: 12px; }
.table-wrap summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.lead-a { color: var(--a); font-weight: 700; }
.lead-b { color: var(--b); font-weight: 700; }
.tooltip { position: fixed; z-index: 30; background: var(--surface-inner); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: var(--fs-xs); pointer-events: none; max-width: 280px; box-shadow: 0 10px 30px rgba(0,0,0,.4); }
.tooltip h4 { margin: 0 0 6px; font-size: var(--fs-sm); }
.tooltip .tt-row { display: flex; justify-content: space-between; gap: 12px; }
.tooltip .tt-row > span:last-child { text-align: right; white-space: nowrap; }
.tt-race + .tt-race { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.tt-race > b { display: block; margin-bottom: 4px; }
#map-tooltip { max-width: min(360px, calc(100vw - 16px)); }

/* Curva */
.chart svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: var(--fs-sm); margin: 6px 0 4px; }
.chart-legend i { display: inline-block; width: 18px; border-top: 3px solid currentColor; vertical-align: middle; margin-right: 6px; }
.chart-legend i.dash { border-top-style: dashed; }
.chart-table-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 12px 0; }
.chart-table-controls label { display: flex; align-items: center; gap: 8px; }
#chart-table caption { text-align: left; color: var(--muted); font-size: var(--fs-xs); padding: 8px 0; }
#chart-tooltip { max-width: min(420px, calc(100vw - 16px)); }
#chart-tooltip .tt-row { margin: 4px 0; }
#chart-tooltip .tt-row > span:last-child { text-align: right; }
.tt-history-meta { margin: 10px 0 4px; color: var(--muted); font-size: var(--fs-xs); }
.zz-schedule { font-size: var(--fs-xs); line-height: 1.5; color: #b8d8e7; border-top: 1px solid #3b708666; padding-top: 10px; }
.exterior-schedule { border: 1px solid #3b7086; border-radius: var(--radius-inner); padding: 12px 14px; background: #18354b55; font-size: var(--fs-sm); line-height: 1.6; }
.exterior-schedule strong { display: block; color: #e0f7ff; }
.country-metric, .country-partial { display: block; font-size: var(--fs-xs); font-weight: 400; margin-top: 2px; }
.country-toggle { display: block; min-height: 40px; margin: 12px auto 0; }
.sort-country { display: inline-flex; align-items: center; gap: 8px; padding: 6px 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: inherit; cursor: pointer; }
.sort-country span { color: var(--muted); }
th[aria-sort="ascending"] .sort-country, th[aria-sort="descending"] .sort-country { color: var(--accent); }
/* Barras e números chegam juntos: mesma duração e mesma curva do contador (app.js). */
.progress > span, .track > span, .zz-track > span { transition: width var(--dur-count) var(--ease-count); }

/* Estimativa: aparência de projeção (tracejado, "≈", uma casa), nunca de resultado */
.forecast-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.fc { border: 1px dashed color-mix(in srgb, var(--c) 55%, transparent); border-radius: var(--radius-inner); padding: 12px 16px; }
.fc .cand-name { font-size: var(--fs-sm); }
.fc-pct { font-size: 1.75rem; font-weight: 800; color: var(--c); line-height: 1.15; }
.fc-pct small { font-size: var(--fs-xs); font-weight: 600; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.fc-range { font-size: var(--fs-xs); color: var(--muted); }
.method-note { font-size: var(--fs-xs); color: var(--muted); margin-top: 10px; }

/* Governadores */
.gov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.gov { background: var(--surface-inner); border: 1px solid var(--line); border-radius: var(--radius-inner); padding: 16px; min-width: 0; }
.gov-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.gov-head h3 { margin: 0; font-size: var(--fs-md); }
.gov .duel { margin-top: 10px; }
.gov-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: var(--fs-xs); color: var(--muted); margin-top: 8px; }

/* Últimas leituras: cabeçalho com pulso da verificação, itens compactos (hora | lugar | título | %) */
.events-panel { position: sticky; top: var(--sticky-top); display: flex; flex-direction: column; max-height: calc(100dvh - var(--sticky-top) - 16px); padding: 0; overflow: hidden; background: var(--surface); }
.ev-head { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px var(--s-3); padding: var(--s-4) var(--s-4) var(--s-3); border-bottom: 1px solid var(--line); }
.ev-head h2 { margin: 0; font-size: var(--fs-md); white-space: nowrap; }
#events-note { flex: 1 0 100%; margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.ev-tick { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; }
.ev-tick > i { display: block; height: 100%; background: var(--accent); opacity: .8; transform-origin: left center; transform: scaleX(0); }
.events-panel:is([data-state="stale"], [data-state="offline"]) .ev-tick > i { background: var(--warn); }
.events-panel:is([data-state="history"], [data-state="loading"]) .ev-tick { visibility: hidden; }
.events-status { display: inline-flex; gap: 6px; align-items: center; font-size: var(--fs-xs); font-weight: 700; color: var(--muted); white-space: nowrap; }
.events-status::before { content: ''; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.events-status[data-state="live"] { color: var(--ok); }
.events-status[data-state="simulation"] { color: var(--sim); }
.events-status:is([data-state="stale"], [data-state="offline"]) { color: var(--warn); }
.events-status[data-state="history"] { color: #93c5fd; }
/* Linha "Agora": acompanha o resumo a cada ciclo; as leituras abaixo são o histórico das mudanças. */
.ev-now { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s-2); padding: var(--s-2) var(--s-4); border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--accent) 6%, transparent); font-size: var(--fs-sm); }
.ev-now[hidden] { display: none; }
.ev-now-tag { font-size: var(--fs-xs); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.ev-now-main b { font-variant-numeric: tabular-nums; }
.ev-now-score { color: var(--muted); }
.ev-now-score b { color: var(--c, var(--text)); font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-body { position: relative; display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.events { flex: 1 1 auto; min-height: 0; list-style: none; margin: 0; padding: 0 0 var(--s-1); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #3b526b transparent; overflow-anchor: none; }
.events > li { position: relative; display: grid; grid-template-columns: 3rem minmax(0, 1fr) auto; column-gap: var(--s-2); row-gap: 2px; align-items: baseline; padding: 10px var(--s-4) 10px 13px; border-left: 3px solid transparent; border-top: 1px solid var(--line); font-size: var(--fs-sm); line-height: 1.4; }
.events > li:first-child { border-top: 0; }
.events > li.ev-cont { border-top-color: transparent; padding-top: 0; }
.events time { grid-column: 1; grid-row: 1 / span 2; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.events time small { display: block; font-size: var(--fs-xs); font-weight: 400; color: var(--muted); }
/* mesmo minuto do item anterior: a hora some da vista, mas o leitor de tela continua lendo */
.events > li.ev-cont > time { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ev-main { grid-column: 2; min-width: 0; }  /* bloco: o título quebra sob o selo, na largura toda da coluna */
.ev-place { margin-right: 6px; vertical-align: 1px; display: inline-flex; align-items: center; gap: 4px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: var(--r-chip); font-size: var(--fs-xs); font-weight: 700; color: var(--text); }
.ev-place[data-office="3"]::before { content: "G"; display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%; background: var(--gov); color: var(--bg); font-size: 10px; font-weight: 900; }
.ev-title, .ev-text { min-width: 0; overflow-wrap: anywhere; }
.ev-title { font-weight: 600; }
.ev-pct { grid-column: 3; grid-row: 1; font-size: var(--fs-xs); color: var(--muted); white-space: nowrap; }
.ev-detail { grid-column: 2 / -1; color: var(--muted); overflow-wrap: anywhere; }
.ev-detail b { color: var(--c, var(--text)); font-weight: 700; }
.events > li.ev-full .ev-detail { color: var(--text); }
.events > li[data-tone="marco"] { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.events > li[data-tone="marco"] .ev-title { color: #fff; }
.events > li[data-tone="revisao"] { border-left-color: var(--warn); }
.events > li.ev-empty { display: block; padding: var(--s-4); border: 0; color: var(--muted); }
.events > li.fresh { animation: event-arrive var(--dur-count) var(--ease-count); }
@keyframes event-arrive { from { background-color: color-mix(in srgb, var(--accent) 22%, transparent); } }
/* pílula sobreposta: aparecer não empurra a lista que está sendo lida */
.events-new { position: absolute; top: var(--s-2); left: 50%; translate: -50% 0; z-index: 1; border: 0; font-weight: 700; color: var(--bg); background: var(--accent); box-shadow: 0 6px 20px #0009; }
.events-new:hover { background: #67e8f9; }
.ev-more { display: none; }
.events-foot { margin: 0; padding: var(--s-2) var(--s-4) var(--s-3); border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--muted); flex-shrink: 0; }

.method > summary { cursor: pointer; font-size: var(--fs-lg); font-weight: 700; }
.method ul { padding-left: 18px; font-size: 14px; color: var(--muted); }
.method li { margin: 6px 0; }
.method strong { color: var(--text); }
.foot { max-width: 1840px; margin: 0 auto; padding: 0 24px 30px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; font-size: var(--fs-xs); color: var(--muted); }

@media (max-width: 1199px) {
  main { grid-template-columns: minmax(0, 1fr); }
  .dashboard-content { display: contents; }
  .dashboard-content > .card { order: 4; }
  #resumo { order: 0; }
  #timeline { order: 1; }
  #mapa { order: 2; }
  /* Sem rolagem dentro da rolagem: cinco leituras e "Ver todas". */
  .events-panel { order: 3; position: static; max-height: none; overflow: visible; }
  .events { overflow: visible; }
  .events-panel:not([data-expanded]) .events > li:nth-child(n+6) { display: none; }
  .ev-more:not([hidden]) { display: block; width: calc(100% - 2 * var(--s-4)); min-height: 44px; margin: var(--s-2) var(--s-4) 0; }
}

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .duel-wrap { order: 2; }
  .hero-mid { grid-column: 1 / -1; order: 3; }
  .map-layout { grid-template-columns: minmax(0, 1fr) 270px; gap: 14px; }
}
@media (max-width: 760px) {
  .map-layout { grid-template-columns: minmax(0, 1fr); }
  .map-side { grid-template-columns: minmax(0, 1fr); }
  /* Cabeçalho parcialmente fixo: marca e menu rolam; só a linha de status (~45 px) fica presa. */
  :root { --top-stuck: 45px; --sticky-top: calc(var(--top-stuck) + 12px); }
  .top { top: calc(var(--top-stuck) - var(--header-height)); gap: 8px 12px; padding: 10px 14px 8px; }
  .nav { width: calc(100% + 28px); margin: 0 -14px; padding: 0 14px; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: none; font-size: var(--fs-sm); mask-image: linear-gradient(90deg, #000 88%, transparent); }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 8px; }
  .health { width: 100%; min-height: 36px; margin-left: 0; flex-wrap: nowrap; overflow: hidden; }
  .health-detail { display: none; }
}
@media (max-width: 560px) {
  main { padding: 12px 12px 30px; gap: 12px; }
  .card { padding: 14px; }
  /* Candidatos lado a lado: a comparação inteira cabe na primeira tela. */
  .hero-grid { gap: 8px; }
  .cand { padding: 12px; }
  /* altura de três linhas de nome: os percentuais dos dois lados ficam na mesma altura */
  .cand-head { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 8px; min-height: calc(44px + 8px + 3.9em); }
  .cand-b .cand-head { flex-direction: column; align-items: flex-end; }
  .hero-avatar { width: 44px; height: 44px; font-size: 15px; }
  .cand-name { font-size: var(--fs-sm); }
  .cand-pct { font-size: clamp(1.875rem, 9vw, 2.5rem); }
  .cand-votes { font-size: var(--fs-xs); }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats > div:nth-child(odd) { border-left: 0; padding-left: 0; }
  .hero-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .diff strong { font-size: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .progress > span, .track > span, .zz-track > span, .duel > span { transition: none; }
  .pill-live::before, .events > li.fresh { animation: none !important; }
  .ev-tick { display: none; }
}

/* Mapa em Canvas (assets/map.js) */
.emap { position: relative; width: 100%; user-select: none; -webkit-user-select: none; border-radius: var(--radius-inner); overflow: hidden; background: radial-gradient(ellipse at 48% 40%, #1b3550 0, #102038 55%, #0b1729 100%); border: 1px solid #ffffff16; }
.emap canvas { position: absolute; inset: 0; display: block; }
.emap-base { pointer-events: none; }
.emap-overlay { touch-action: pan-y; }
/* canto inferior esquerdo: fica sobre o vazio a oeste do RS/MS, sem cobrir o Nordeste */
.emap-controls { position: absolute; left: 8px; bottom: 8px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.emap-controls button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: rgba(20,30,50,.9); color: var(--text); font-size: 18px; line-height: 1; cursor: pointer; }
.emap-controls button:hover { border-color: var(--accent); }
.emap-hint { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); background: rgba(15,23,42,.92); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: var(--fs-xs); color: var(--text); pointer-events: none; z-index: 2; white-space: nowrap; }
.map-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: #0c162899; border: 1px solid var(--line); border-radius: var(--radius-control); }
.seg button { background: transparent; color: var(--muted); border: 0; border-radius: var(--radius-control); padding: 6px 10px; font-size: var(--fs-sm); cursor: pointer; transition: background-color .18s, color .18s; }
.seg button:hover { color: var(--text); background: #ffffff08; }
.seg button:last-child { border-right: 0; }
.seg button.active { background: #164454; color: #a5f3fc; box-shadow: inset 0 0 0 1px #22d3ee24; }
.seg.layers { gap: 2px; }
.seg .layer-btn { border: 0; }
.select-wrap select, .search input { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 8px 12px; font-size: var(--fs-sm); }
.search input { min-width: 180px; }
.legend-race { display: inline-flex; align-items: center; gap: 3px; }
.legend-race b { color: var(--text); font-size: var(--fs-xs); margin-right: 2px; }
.zz-box:disabled { cursor: default; }
.zz-box:disabled:hover { border-color: #3b7086; box-shadow: 0 8px 24px #02061740; }
.uf-detail .spacer { height: 14px; }
.link-btn { background: none; border: 0; color: #7dd3fc; font-size: var(--fs-xs); cursor: pointer; padding: 0; text-decoration: underline; }
.btn-live { color: var(--ok); }
.btn-live:disabled { display: none; } /* já ao vivo: o próprio rótulo "ao vivo" ao lado diz o estado */
.btn-small:disabled { opacity: .45; cursor: default; }

/* Linha do tempo */
.timeline { padding: 12px 16px; }
.tl-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.tl-row input[type=range] { flex: 1 1 220px; accent-color: var(--accent); }
.tl-row output { min-width: 110px; font-weight: 700; font-variant-numeric: tabular-nums; }
.timeline p { margin: 6px 0 0; }

@media (max-width: 560px) {
  .map-controls { gap: 6px; }
  .seg button { padding: 6px 8px; font-size: var(--fs-xs); }
  .search input { min-width: 0; width: 100%; }
}
/* Alvos de toque de 44 px em telas de toque (fica no fim para vencer os tamanhos acima). */
@media (pointer: coarse) {
  .seg button, .btn-small, .layer-btn, .select-wrap select, .search input, .link-btn { min-height: 44px; }
  .emap-controls button { width: 44px; height: 44px; }
}
/* Aviso de versão nova (app.js showUpdateButton): discreto, mas distinto dos selos de status. */
.update-app { border-color: transparent; background: var(--accent); color: var(--bg); font-weight: 700; }
/* Imagens para compartilhar (share.js): botão discreto sob o trecho e diálogo de prévia. */
.share-btn { display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 38px; margin: var(--s-3) auto 0; padding: 6px 16px; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: var(--r-pill); background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--text); font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; }
.share-btn:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.share-btn svg { width: 16px; height: 16px; flex: none; }
.share-btn[aria-disabled="true"] { opacity: .6; cursor: progress; }
.share-dialog { width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.share-dialog::backdrop { background: rgba(2, 6, 23, .78); }
.share-dialog h2 { margin: 0 32px var(--s-3) 0; font-size: var(--fs-md); }
.share-dialog img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-inner); }
.share-close { position: absolute; top: 6px; right: 10px; border: 0; background: none; color: var(--muted); font-size: 28px; line-height: 1; cursor: pointer; }
.share-actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-3); }
.share-actions > * { flex: 1 1 160px; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; border-radius: var(--r-pill); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.share-actions > [hidden] { display: none; }
.share-primary { border: 0; background: var(--accent); color: var(--bg); }
#share-save { border: 1px solid var(--line-strong); color: var(--text); }
.share-hint { margin: var(--s-2) 0 0; font-size: var(--fs-xs); color: var(--muted); }
/* Box do livro (promo.js): espaço fixo no pé da coluna de leituras, cores neutras (nunca as dos candidatos), sem flutuar. */
.promo { position: relative; flex-shrink: 0; min-height: 132px; padding: var(--s-3) var(--s-4) var(--s-4); border-top: 1px solid var(--line-strong); background: var(--surface-2); }
.promo-label { margin: 0 36px 4px 0; font-size: var(--fs-xs); color: var(--muted); }
.promo-title { margin: 0 36px 4px 0; font-size: var(--fs-sm); font-weight: 800; line-height: 1.3; color: var(--text); }
.promo-sub { margin: 0 0 var(--s-2); font-size: var(--fs-xs); line-height: 1.4; color: var(--muted); }
.promo-form { display: flex; flex-wrap: wrap; gap: 6px; }
.promo-form input[type="email"] { flex: 1 1 150px; min-width: 0; min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-inner); color: var(--text); font: inherit; font-size: var(--fs-sm); }
.promo-cta { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--accent); color: var(--bg); font: inherit; font-size: var(--fs-sm); font-weight: 800; text-decoration: none; cursor: pointer; }
.promo-cta--ghost { border: 1px solid var(--line-strong); background: transparent; color: var(--text); }
.promo-legal { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--muted); }
.promo-legal a { color: var(--muted); }
.promo-close { position: absolute; top: 2px; right: 2px; width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 22px; line-height: 1; cursor: pointer; }
@media (max-width: 1199px) { .promo { margin: var(--s-3) var(--s-4) var(--s-4); border: 1px solid var(--line-strong); border-radius: var(--radius-inner); } }
