:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f3f2ee;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --accent: #2a78d6;
  --nodata: #dcdbd5;

  /* Candidato A (vermelho) e B (azul): 5 faixas 0-20, 21-40, 41-60, 61-80, 81-100 */
  --a1: #fbe0df; --a2: #f4aba9; --a3: #e66767; --a4: #c23b3a; --a5: #8a2323;
  --b1: #dbe9fb; --b2: #9ec5f4; --b3: #5598e7; --b4: #256abf; --b5: #104281;
  --a: #d63b3a; --b: #2a78d6;
  /* demais candidatos do 1º turno (aqua) */
  --c1: #d3f1e5; --c2: #8ad8b8; --c3: #1baf7a; --c4: #137f59; --c5: #0a4f37; --c: #1baf7a;
  --neutral-mid: #e9e8e3;

  --good: #0ca30c; --good-ink: #006300; --warning: #fab219; --critical: #d03b3b;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
    --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a988f; --grid: #2c2c2a; --axis: #383835;
    --border: rgba(255, 255, 255, 0.10); --nodata: #3a3a37;
    --a1: #4a1f1f; --a2: #7d2c2c; --a3: #b83f3e; --a4: #e06363; --a5: #f6a8a7;
    --b1: #172a45; --b2: #1c4a85; --b3: #2f6fc4; --b4: #5c9be8; --b5: #a9cbf6;
    --a: #e66767; --b: #3987e5; --neutral-mid: #383835; --good-ink: #0ca30c;
    --c1: #12352a; --c2: #175c45; --c3: #199e70; --c4: #4cc79a; --c5: #a3e6cb; --c: #199e70;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d; --surface: #1a1a19; --surface-2: #232321;
  --ink: #ffffff; --ink-2: #c3c2b7; --muted: #9a988f; --grid: #2c2c2a; --axis: #383835;
  --border: rgba(255, 255, 255, 0.10); --nodata: #3a3a37;
  --a1: #4a1f1f; --a2: #7d2c2c; --a3: #b83f3e; --a4: #e06363; --a5: #f6a8a7;
  --b1: #172a45; --b2: #1c4a85; --b3: #2f6fc4; --b4: #5c9be8; --b5: #a9cbf6;
  --a: #e66767; --b: #3987e5; --neutral-mid: #383835; --good-ink: #0ca30c;
  --c1: #12352a; --c2: #175c45; --c3: #199e70; --c4: #4cc79a; --c5: #a3e6cb; --c: #199e70;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.45 var(--font); }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 18px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; margin-top: 16px; }
a { color: var(--accent); }
code { font-size: 12px; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { flex: 1 1 380px; min-width: 0; }
.brand h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status .msg { overflow: hidden; text-overflow: ellipsis; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.status .dot.live { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 25%, transparent); }
.status .dot.sim { background: var(--warning); }
.badge { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }

.tabs { display: flex; gap: 4px; }
.tabs button, .seg button {
  font: inherit; font-size: 13px; color: var(--ink-2); background: transparent; border: 1px solid transparent;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--surface-2); color: var(--ink); border-color: var(--border); font-weight: 600; }
.tabs button:hover, .seg button:hover { background: var(--surface-2); }

main { max-width: 1400px; margin: 0 auto; padding: 16px 24px 48px; }
.tab[hidden] { display: none; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 16px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 16px; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.progress-row { margin: 4px 0 16px; }
.progress-label { margin-bottom: 6px; }
.progress-label strong { font-size: 18px; }
.progress { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
#progress-bar { height: 100%; width: 0; background: var(--ink-2); transition: width .6s ease; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
@media (max-width: 640px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; display: grid; gap: 4px; position: relative; overflow: hidden; }
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.card .nome { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.card .nome .num-cand { font-size: 12px; color: var(--muted); font-weight: 500; }
.card .pct { font-size: 34px; font-weight: 600; line-height: 1.1; }
.card .votos { color: var(--ink-2); }
.card .linha { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-2); border-top: 1px solid var(--grid); padding-top: 6px; margin-top: 4px; }
.card .linha b { color: var(--ink); }
.lider-tag { font-size: 11px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink); border: 1px solid var(--border); }

.proj-hero { font-size: 20px; font-weight: 600; margin: 4px 0 12px; }
.proj-hero .sub { display: block; font-size: 13px; font-weight: 400; color: var(--ink-2); margin-top: 4px; }
.proj-bar { position: relative; height: 28px; display: flex; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.proj-bar > div { height: 100%; display: flex; align-items: center; padding: 0 8px; color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; }
.proj-bar > .mid, .proj-bar > .ic { padding: 0; }
.proj-bar .mid { position: absolute; left: calc(50% - 1px); top: 0; bottom: 0; width: 2px; background: var(--surface); opacity: 1; }
.proj-bar .ic { position: absolute; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, rgba(255,255,255,.45) 0 3px, transparent 3px 7px); border-left: 1px solid rgba(255,255,255,.8); border-right: 1px solid rgba(255,255,255,.8); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; margin-top: 16px; }
.kpi { border-top: 1px solid var(--grid); padding-top: 8px; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 18px; font-weight: 600; }

.chart { width: 100%; height: 260px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .grid line { stroke: var(--grid); stroke-width: 1; }
.chart .axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .empty { fill: var(--muted); font-size: 13px; }
.legend-inline { display: flex; gap: 12px; font-size: 12px; color: var(--ink-2); flex-wrap: wrap; }
.legend-inline span { display: inline-flex; align-items: center; gap: 4px; }
.legend-inline i { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--c); }
.legend-inline i.dash { border-top-style: dashed; }

.seg { display: flex; flex-wrap: wrap; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 2px; border: 1px solid var(--border); }
.seg button { padding: 4px 10px; font-size: 12px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; border-color: var(--border); }

.map-wrap { position: relative; height: 620px; border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background: var(--surface-2); }
@media (max-width: 640px) { .map-wrap { height: 460px; } }
#map { position: absolute; inset: 0; }
.map-legend { position: absolute; left: 10px; bottom: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; max-width: calc(100% - 20px); }
.map-legend .row { display: flex; align-items: center; gap: 2px; margin-top: 4px; }
.map-legend .sw { width: 46px; height: 12px; }
.map-legend .lbls { display: flex; gap: 2px; color: var(--muted); font-size: 11px; }
.map-legend .lbls span { width: 46px; text-align: center; white-space: nowrap; }
.map-legend .ttl { font-weight: 600; color: var(--ink); }
.map-info { position: absolute; right: 10px; top: 10px; width: 340px; max-width: calc(100% - 20px); max-height: calc(100% - 20px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.map-info .close { float: right; background: none; border: 0; font-size: 18px; cursor: pointer; color: var(--muted); line-height: 1; }
.map-info table { width: 100%; }

.tooltip { position: fixed; z-index: 50; pointer-events: none; background: var(--surface); color: var(--ink); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; box-shadow: 0 4px 16px rgba(0,0,0,.15); max-width: 280px; }
.tooltip .t { font-weight: 600; margin-bottom: 4px; }
.tooltip .r { display: flex; justify-content: space-between; gap: 12px; }
.tooltip .sw-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: var(--c); }

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12px; border-bottom: 1px solid var(--axis); padding: 6px 8px; white-space: nowrap; cursor: default; position: sticky; top: 0; background: var(--surface); }
table.data th[data-sort] { cursor: pointer; }
table.data th[data-sort]:hover { color: var(--ink); }
table.data td { padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.data td.n, table.data th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
.mini-bar { display: inline-flex; width: 90px; height: 8px; border-radius: 2px; overflow: hidden; vertical-align: middle; background: var(--nodata); gap: 1px; }
.mini-bar span { display: block; height: 100%; }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--border); white-space: nowrap; }
.chip.ok { color: var(--good-ink); }
.chip.divergente { color: var(--critical); border-color: var(--critical); }
.chip.defasado { color: var(--ink-2); }
.chip.sem { color: var(--muted); }
.chip.pendente { color: var(--muted); }

.lead { color: var(--ink-2); max-width: 900px; margin: 0 0 12px; }
.ver-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.breadcrumb { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.breadcrumb button { font: inherit; background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }
.breadcrumb span.sep { color: var(--muted); }
.unit-box { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 12px; background: var(--surface-2); border-radius: 8px; margin-bottom: 12px; }
.diff-list { font-size: 12px; color: var(--critical); }
.diff-list div { white-space: normal; }

.prose { max-width: 900px; }
.prose h2 { margin-top: 20px; }
.prose h2:first-child { margin-top: 0; }
.prose p, .prose li { color: var(--ink-2); }
.formula { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); padding: 8px 12px; border-radius: 6px; color: var(--ink) !important; overflow-x: auto; }

.maplibregl-ctrl-attrib { font-size: 10px; }

@media (max-width: 640px) {
  .topbar { padding: 10px 16px; position: static; }
  .brand { flex: 1 1 100%; }
  h1 { font-size: 16px; }
  .tabs { width: 100%; }
  .tabs button { flex: 1; padding: 6px 4px; }
  main { padding: 12px 16px 40px; }
  .card .pct { font-size: 28px; }
}
.link-btn { font: inherit; font-size: 12px; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
.map-info .r { display: flex; justify-content: space-between; gap: 12px; }
.map-info .t { font-weight: 600; margin-bottom: 4px; }
.map-info .sw-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; background: var(--c); }

/* ---- Monitor de conexão com o TSE ---- */
.conn { position: relative; display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink);
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); cursor: default; white-space: nowrap; }
.conn > i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.conn-ok > i { background: var(--good); }
.conn-warn > i { background: var(--warning); animation: pisca 0.7s steps(2, jump-none) infinite; }
.conn-down > i { background: var(--critical); }
.conn-down { border-color: var(--critical); }
@keyframes pisca { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
.conn-ok > i { box-shadow: 0 0 0 0 rgba(12, 163, 12, .5); animation: pisca-verde 1.4s ease-in-out infinite; }
@keyframes pisca-verde {
  0% { opacity: 1; box-shadow: 0 0 0 0 rgba(12, 163, 12, .55); }
  50% { opacity: .35; }
  70% { box-shadow: 0 0 0 7px rgba(12, 163, 12, 0); }
  100% { opacity: 1; box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); }
}
@media (prefers-reduced-motion: reduce) { .conn > i { animation: none !important; } }
.conn-pop { display: none; position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: 290px; white-space: normal;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-weight: 400;
  color: var(--ink-2); box-shadow: 0 4px 16px rgba(0,0,0,.15); }
.conn:hover .conn-pop, .conn:focus .conn-pop, .conn:focus-within .conn-pop { display: block; }
.conn-pop .r { display: flex; justify-content: space-between; gap: 12px; }
.conn-pop b { color: var(--ink); }

/* ---- 1º turno ---- */
.t1-grid { align-items: start; }
.t1-bars { display: grid; gap: 8px; }
.t1-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; font-size: 13px; }
.t1-bar .nm { font-weight: 600; }
.t1-bar .nm .muted { font-weight: 400; }
.t1-bar .vl { text-align: right; font-variant-numeric: tabular-nums; }
.t1-bar .track { grid-column: 1 / -1; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.t1-bar .track span { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.tag2t { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); margin-left: 6px; }
.t1-kpis { margin-top: 0; }
.map-ctrls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sel select { font: inherit; font-size: 12px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); max-width: 220px; }
.sel select:disabled { opacity: .5; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#map1 { position: absolute; inset: 0; }

/* ---- Rodapé ---- */
.rodape { max-width: 1400px; margin: 0 auto; padding: 20px 24px 32px; border-top: 1px solid var(--border); text-align: center; color: var(--ink-2); font-size: 14px; }
.rodape p { margin: 4px 0; }
.rodape b { color: var(--ink); font-weight: 600; }
/* logos com altura proporcional ao texto, apoiados na linha de base */
.rodape img { display: inline-block; width: auto; mix-blend-mode: multiply; }
.logo-claude { height: 0.9em; vertical-align: -0.07em; margin: 0 0.15em; }
.logo-anthropic { height: 0.72em; vertical-align: 0; margin: 0 0.15em; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rodape img { filter: invert(1) hue-rotate(180deg); mix-blend-mode: screen; }
}
:root[data-theme="dark"] .rodape img { filter: invert(1) hue-rotate(180deg); mix-blend-mode: screen; }
@media (max-width: 640px) { .rodape { padding: 16px; font-size: 13px; } }

/* ---- Fotos oficiais (TSE) ---- */
.card-top { display: flex; gap: 14px; align-items: center; }
.card-id { display: grid; gap: 4px; min-width: 0; }
.foto { width: 72px; height: auto; aspect-ratio: 161 / 225; object-fit: cover; border-radius: 8px; flex: none;
  border: 2px solid var(--c); background: var(--surface-2); }
.t1-bar.com-foto { grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; }
.t1-bar.com-foto .track { grid-column: 2 / -1; }
.foto-mini { grid-row: span 2; width: 30px; height: auto; aspect-ratio: 161 / 225; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
@media (max-width: 640px) { .foto { width: 60px; } }

/* ---- Matematicamente eleito ---- */
.eleito-tag { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: var(--good-ink); color: #fff; }
.eleito-hero { color: var(--good-ink); }
.proj-matematico { margin-top: 14px; display: grid; gap: 4px; font-size: 13px; }
.proj-matematico:empty { display: none; }
.mat-row { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); }
.mat-row b { color: var(--ink); }
.mat-bar { height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; margin: 4px 0 2px; }
.mat-bar span { display: block; height: 100%; background: var(--ink-2); }

/* ---- Relógio: horário de Brasília ---- */
.relogio { display: grid; justify-items: end; line-height: 1.15; white-space: nowrap; }
.rel-hora { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.rel-sub { font-size: 11px; color: var(--muted); }
@media (max-width: 640px) { .relogio { justify-items: start; } .rel-hora { font-size: 16px; } }

/* ---- Quadros do painel ---- */
.quadros .panel { margin-bottom: 0; }
.quadros { margin-bottom: 16px; }
.reg-row { display: grid; grid-template-columns: 110px minmax(0, 1fr) 150px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.reg-row:last-child { border-bottom: 0; }
.reg-row .nm { font-weight: 600; }
.reg-row .vl { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.reg-bar { height: 10px; background: var(--surface-2); border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.reg-bar span { display: block; height: 100%; background: var(--ink-2); border-radius: 0 5px 5px 0; }
.lean { display: inline-flex; width: 80px; height: 8px; border-radius: 2px; overflow: hidden; gap: 1px; vertical-align: middle; background: var(--nodata); }
.lean span { display: block; height: 100%; }
.vazio { color: var(--muted); font-size: 13px; padding: 12px 0; }
.chart-uf svg { width: 100%; display: block; }
.chart-uf text { font-size: 11px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.chart-uf .zero { stroke: var(--axis); stroke-width: 1.5; }
.chart-uf .hit { fill: transparent; cursor: default; }
.chart-uf .hit:hover { fill: var(--surface-2); }
.destaques { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 640px) { .destaques { grid-template-columns: minmax(0, 1fr); } .reg-row { grid-template-columns: 90px minmax(0, 1fr) 110px; } }
.dest-col h3 { margin: 0 0 6px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.dest-item { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; padding: 4px 0; border-bottom: 1px solid var(--grid); }
.dest-item .mu { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dest-item b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.ult-item { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; gap: 10px; align-items: center; font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--grid); }
.ult-item .hr { color: var(--muted); font-variant-numeric: tabular-nums; }
.ult-item .lc { min-width: 0; }
.ult-item .lc div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ult-item .vt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dot-c { display: inline-block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); margin-right: 3px; }
.uf-chips { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.uf-chips > span { white-space: nowrap; }

/* ---- Bandeiras (UFs: IBGE; Exterior e Brasil: TSE) ---- */
.flag { display: inline-block; width: 21px; height: 14px; object-fit: cover; border-radius: 2px; vertical-align: -2px; margin-right: 6px;
  box-shadow: 0 0 0 1px var(--border); background: var(--surface-2); }
.tooltip .flag, .map-info .flag { width: 18px; height: 12px; margin-right: 5px; }

/* ---- Logos de partido ---- */
.logo-partido { display: inline-block; height: 1.6em; width: auto; vertical-align: middle; margin-left: 2px; border-radius: 2px; }
.card .num-cand { display: inline-flex; align-items: center; gap: 4px; }
.card .logo-partido { height: 28px; }
.t1-bar .logo-partido { height: 1.35em; }

/* ---- Comemoração: matematicamente eleito ---- */
.celebracao { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--page) 55%, transparent); backdrop-filter: blur(6px); animation: cel-fade .4s ease-out; }
.celebracao[hidden] { display: none; }
#confete { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.cel-card { position: relative; width: min(440px, 100%); text-align: center; background: var(--surface); border-radius: 18px;
  border: 3px solid var(--cel-cor, var(--good)); box-shadow: 0 24px 80px rgba(0,0,0,.35); padding: 0 24px 24px; overflow: hidden;
  animation: cel-pop .7s cubic-bezier(.2, 1.4, .4, 1) both; }
.cel-faixa { margin: 0 -24px 18px; padding: 8px; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #fff;
  background: linear-gradient(90deg, #009c3b, #ffdf00 50%, #009c3b); text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.cel-foto { display: block; margin: 0 auto; width: 128px; height: auto; aspect-ratio: 161 / 225; object-fit: cover; border-radius: 12px; border: 4px solid var(--cel-cor, var(--good));
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--cel-cor, var(--good)) 25%, transparent); animation: cel-brilho 1.6s ease-in-out infinite; }
.cel-selo { display: inline-block; margin-top: 16px; padding: 4px 12px; border-radius: 999px; background: var(--good-ink); color: #fff; font-size: 13px; font-weight: 700; }
.cel-nome { margin: 10px 0 4px; font-size: 30px; line-height: 1.1; }
.cel-sub { color: var(--ink-2); font-size: 15px; }
.cel-num { margin-top: 12px; font-size: 13px; color: var(--muted); }
.cel-fechar { margin-top: 18px; font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 8px; border: 0; cursor: pointer; color: #fff;
  background: var(--cel-cor, var(--good)); }
.cel-fechar:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@keyframes cel-fade { from { opacity: 0; } }
@keyframes cel-pop { from { opacity: 0; transform: scale(.6) translateY(40px); } }
@keyframes cel-brilho { 50% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--cel-cor, var(--good)) 10%, transparent); } }
@media (prefers-reduced-motion: reduce) { .celebracao, .cel-card, .cel-foto { animation: none !important; } }
#tabela-uf th, #tabela-uf-t1 th { white-space: normal; vertical-align: bottom; }
#tabela-uf .mini-bar { width: 70px; }
