/* Site de resultados: tokens do tema em :root (claro), escuro por prefers-color-scheme ou [data-theme].
   Herda a paleta do painel da família (escuro) e ganha um par claro com contraste AA. */
:root {
  color-scheme: light;
  --fundo: #f6f6f3;
  --superficie: #ffffff;
  --superficie-2: #eeeee9;
  --borda: #d9d8d0;
  --texto: #171716;
  --texto-2: #46453f;
  --texto-3: #615f58;
  --destaque: #1d5fc2;
  --destaque-forte: #174d9e;
  --sobre-destaque: #ffffff;
  --foco: #1d5fc2;
  --dentro: #12731a;
  --dentro-fundo: #e1f2e2;
  --atencao: #855700;
  --atencao-fundo: #fbefd3;
  --fora: #a32d2c;
  --fora-fundo: #f8e2e1;
  --marco: #b77900;
  --s1: #2f6fd0; --s2: #cc4f1c; --s3: #137f5a; --s4: #a86f00;
  --s5: #c13f72; --s6: #6d5fd6; --s7: #0e8494; --s8: #8a6d55; --outros: #9a998f;
  --mapa-vazio: #e2e1da;
  --icone-mapa: none;
  --raio: .75rem;
  --raio-p: .45rem;
  --sombra: 0 1px 2px rgb(0 0 0 / .05), 0 2px 8px rgb(0 0 0 / .04);
  --fonte: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --e1: .25rem; --e2: .5rem; --e3: .75rem; --e4: 1rem; --e5: 1.5rem; --e6: 2rem; --e7: 3rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fundo: #111110; --superficie: #1a1a19; --superficie-2: #242422; --borda: #34342f;
    --texto: #f4f4f0; --texto-2: #c3c2b7; --texto-3: #9e9d94;
    --destaque: #5b9cf0; --destaque-forte: #86b6f5; --sobre-destaque: #0b1a2e; --foco: #86b6f5;
    --dentro: #7ee07e; --dentro-fundo: #17361a; --atencao: #fab219; --atencao-fundo: #3a2c0c;
    --fora: #ff9a9a; --fora-fundo: #3d1b1b; --marco: #fab219;
    --s1: #4d94ec; --s2: #e8703e; --s3: #2fb487; --s4: #d99a1c;
    --s5: #e06a98; --s6: #9085e9; --s7: #36b3c2; --s8: #b39377; --outros: #6a6962;
    --mapa-vazio: #2a2a27;
    --icone-mapa: invert(1) hue-rotate(180deg);
    --sombra: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fundo: #111110; --superficie: #1a1a19; --superficie-2: #242422; --borda: #34342f;
  --texto: #f4f4f0; --texto-2: #c3c2b7; --texto-3: #9e9d94;
  --destaque: #5b9cf0; --destaque-forte: #86b6f5; --sobre-destaque: #0b1a2e; --foco: #86b6f5;
  --dentro: #7ee07e; --dentro-fundo: #17361a; --atencao: #fab219; --atencao-fundo: #3a2c0c;
  --fora: #ff9a9a; --fora-fundo: #3d1b1b; --marco: #fab219;
  --s1: #4d94ec; --s2: #e8703e; --s3: #2fb487; --s4: #d99a1c;
  --s5: #e06a98; --s6: #9085e9; --s7: #36b3c2; --s8: #b39377; --outros: #6a6962;
  --mapa-vazio: #2a2a27;
  --icone-mapa: invert(1) hue-rotate(180deg);
  --sombra: none;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto); font-family: var(--fonte); font-size: 1rem;
  line-height: 1.5; font-variant-numeric: tabular-nums; min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; padding-bottom: var(--e7); }
a { color: var(--destaque); text-underline-offset: .15em; }
a:hover { color: var(--destaque-forte); }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; border-radius: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(1.5rem, 1.15rem + 1.6vw, 2.25rem); font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 1.3rem; font-weight: 750; }
h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texto-2); font-weight: 700; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.largura { width: 100%; max-width: 74rem; margin: 0 auto; padding: 0 16px; }
.sub { color: var(--texto-2); font-size: .875rem; }
.fraco { color: var(--texto-3); }
.pular { position: absolute; left: -999px; top: 0; background: var(--destaque); color: var(--sobre-destaque); padding: var(--e2) var(--e3); z-index: 10; }
.pular:focus { left: 16px; }

/* topo e navegação */
.topo { background: var(--superficie); border-bottom: 1px solid var(--borda); }
.topo .largura { display: flex; align-items: center; gap: var(--e2) var(--e4); flex-wrap: wrap; min-height: 3.5rem; }
.marca { font-weight: 800; font-size: 1.1rem; color: var(--texto); text-decoration: none; padding: var(--e2) 0; margin-right: auto; }
.marca b { color: var(--destaque); }
.nav { display: flex; flex-wrap: wrap; gap: 0 var(--e1); }
.nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--e3); border-radius: var(--raio-p);
  color: var(--texto-2); text-decoration: none; font-weight: 600; font-size: .95rem; }
.nav a:hover { background: var(--superficie-2); color: var(--texto); }
.nav a[aria-current="page"] { color: var(--texto); box-shadow: inset 0 -3px 0 var(--destaque); border-radius: 0; }
.botao-tema { min-width: 44px; min-height: 44px; border: 1px solid var(--borda); background: var(--superficie);
  border-radius: 999px; cursor: pointer; font-size: 1.1rem; line-height: 1; }
.botao-tema:hover { background: var(--superficie-2); }
.migalhas ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--e1) var(--e2); padding: var(--e3) 0 0; margin: 0; font-size: .85rem; color: var(--texto-3); }
.migalhas li + li::before { content: "›"; margin-right: var(--e2); color: var(--texto-3); }
.migalhas a { color: var(--texto-2); }
.migalhas [aria-current] { color: var(--texto-3); }

/* blocos */
.cabeca { padding: var(--e5) 0 var(--e4); display: flex; flex-direction: column; gap: var(--e2); }
.cabeca .linha-acoes { display: flex; flex-wrap: wrap; gap: var(--e2) var(--e3); align-items: center; }
.secao-pagina { margin-top: var(--e6); display: flex; flex-direction: column; gap: var(--e3); }
.secao-pagina > header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--e2) var(--e4); }
.painel { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: var(--e4) var(--e4);
  box-shadow: var(--sombra); display: flex; flex-direction: column; gap: var(--e3); min-width: 0; }
.grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: var(--e3); }
.grade-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: var(--e4); }
.aviso { border: 1px solid var(--atencao); background: var(--atencao-fundo); color: var(--texto); border-radius: var(--raio);
  padding: var(--e3) var(--e4); font-size: .95rem; }
.aviso b { color: var(--atencao); }
.vazio { color: var(--texto-3); padding: var(--e5); text-align: center; border: 1px dashed var(--borda); border-radius: var(--raio); }
.mais { font-weight: 650; text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.mais::after { content: " →"; white-space: pre; }

/* números de destaque */
.kpis { display: flex; flex-wrap: wrap; gap: var(--e3) var(--e5); }
.kpi { display: flex; flex-direction: column; min-width: 7rem; }
.kpi span { font-size: .78rem; color: var(--texto-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.kpi b { font-size: 1.35rem; font-weight: 750; }
.kpi small { color: var(--texto-3); font-size: .8rem; }
.placar { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--e1) var(--e4); }
.placar .grande { font-size: clamp(2.2rem, 1.6rem + 2.5vw, 3.4rem); font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.placar .meio { font-size: 1.25rem; font-weight: 700; color: var(--texto-2); }

/* situação */
.pilula { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .78rem; padding: .15rem .6rem;
  border-radius: 999px; white-space: nowrap; background: var(--superficie-2); color: var(--texto-2); vertical-align: middle; }
.pilula.dentro { background: var(--dentro-fundo); color: var(--dentro); }
.pilula.atencao { background: var(--atencao-fundo); color: var(--atencao); }
.pilula.fora { background: var(--superficie-2); color: var(--texto-2); }
.pilula.anulado { background: var(--fora-fundo); color: var(--fora); }

/* barras de resultado */
.barras { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--e3); }
.barra { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) 7.5rem; align-items: center; gap: var(--e2) var(--e3); }
.barra-nome { min-width: 0; line-height: 1.25; }
.barra-nome a { font-weight: 700; color: var(--texto); text-decoration: none; }
.barra-nome a:hover { text-decoration: underline; }
.barra-nome .sub { display: block; font-size: .8rem; }
.trilho { position: relative; height: 1.15rem; background: var(--superficie-2); border-radius: 4px; }
.trilho i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--c, var(--outros)); min-width: 2px; }
.trilho .marco { position: absolute; top: -.3rem; bottom: -.3rem; width: 2px; background: var(--marco); }
.barra-num { text-align: right; line-height: 1.2; }
.barra-num b { font-size: 1.05rem; }
.barra-num small { display: block; color: var(--texto-2); font-size: .78rem; }
.legenda-marco { font-size: .8rem; color: var(--texto-3); }
.legenda-marco::before { content: ""; display: inline-block; width: 2px; height: .9em; background: var(--marco); margin-right: .4rem; vertical-align: -1px; }
@media (max-width: 40rem) {
  .barra { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "nome num" "trilho trilho"; row-gap: var(--e1); }
  .barra-nome { grid-area: nome; }
  .barra-num { grid-area: num; }
  .trilho { grid-area: trilho; height: .8rem; }
}

/* tabelas */
.rolagem { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--superficie); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
caption { text-align: left; padding: var(--e3) var(--e3) 0; color: var(--texto-2); font-size: .85rem; }
th { text-align: left; color: var(--texto-2); font-weight: 650; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em;
  padding: var(--e2) var(--e3); border-bottom: 1px solid var(--borda); white-space: nowrap; background: var(--superficie); }
td { padding: var(--e2) var(--e3); border-bottom: 1px solid var(--superficie-2); vertical-align: top; }
tbody:last-of-type tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: color-mix(in srgb, var(--destaque) 6%, transparent); }
td.n, th.n { text-align: right; white-space: nowrap; }
td a { font-weight: 600; }
td .sub { display: block; font-size: .78rem; }
tr.eleito td:first-child { box-shadow: inset 3px 0 0 var(--dentro); }
/* ordenação pelo cabeçalho: o botão vem do site.js (sem JS, o cabeçalho fica em texto) e ocupa o th inteiro */
th abbr[title] { text-decoration: underline dotted; text-underline-offset: .2em; cursor: help; }
.ordenar { position: relative; display: inline-flex; align-items: center; gap: .3em; margin: 0; padding: 0; border: 0;
  background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.ordenar::after { content: ""; position: absolute; inset: calc(-1 * var(--e2)) calc(-1 * var(--e3)); }
.ordenar:hover { color: var(--texto); }
.ordenar abbr[title] { cursor: inherit; }
.ordenar .seta { display: inline-block; width: 1ch; text-align: center; color: var(--texto-3); }
th[aria-sort] { color: var(--texto); }
th[aria-sort] .seta { color: var(--destaque); }
/* a mesma seta nas tabelas ordenadas no servidor (web/listas.py), em que o cabeçalho é um link */
a.ordenar { text-decoration: none; }
/* acompanhar e comparar em cada linha de candidato (os botões vêm do site.js) */
.acoes { white-space: nowrap; text-align: right; width: 1%; }
.marcador { display: inline-flex; align-items: center; justify-content: center; min-width: 36px; min-height: 36px;
  padding: 0 var(--e2); border: 1px solid var(--borda); border-radius: 999px; background: var(--superficie);
  color: var(--texto-2); font-size: 1rem; line-height: 1; cursor: pointer; }
.marcador + .marcador { margin-left: var(--e1); }
.marcador:hover { border-color: var(--destaque); color: var(--texto); }
.marcador[aria-pressed="true"] { background: var(--destaque); border-color: var(--destaque); color: var(--sobre-destaque); }
.acoes .botao + .botao { margin-left: var(--e2); }
.oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nav .contagem { margin-left: .35rem; min-width: 1.4rem; padding: 0 .35rem; border-radius: 999px; background: var(--destaque);
  color: var(--sobre-destaque); font-size: .75rem; line-height: 1.4rem; text-align: center; }
.avisos-acompanhar { position: fixed; left: 50%; bottom: var(--e4); transform: translateX(-50%); z-index: 20;
  max-width: min(32rem, calc(100vw - 32px)); box-shadow: var(--sombra); }
/* vazia, a região viva continua na página (para o leitor de tela anunciar o próximo aviso), mas não aparece */
.avisos-acompanhar:empty { padding: 0; border: 0; }
.grupo-acompanhar { display: flex; flex-direction: column; gap: var(--e2); margin-top: var(--e4); }
/* lado a lado: até 4 numa linha; com menos, cada um ocupa o espaço que sobra */
.grade.comparacao { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.ponto { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .4rem; vertical-align: -1px; background: var(--c, var(--outros)); }

/* filtros de tabela (aparecem só com JS) */
.filtros { display: flex; flex-wrap: wrap; gap: var(--e3); align-items: flex-end; }
.filtros label { display: flex; flex-direction: column; gap: var(--e1); font-size: .78rem; color: var(--texto-2); font-weight: 650;
  text-transform: uppercase; letter-spacing: .04em; }
.filtros input, .filtros select, .campo { min-height: 44px; padding: 0 var(--e3); border-radius: var(--raio-p); border: 1px solid var(--borda);
  background: var(--superficie); color: var(--texto); font-size: 1rem; text-transform: none; letter-spacing: 0; font-weight: 400; }
.filtros input[type="number"] { width: 7rem; }
.filtros .contador { font-size: .85rem; color: var(--texto-3); align-self: center; text-transform: none; letter-spacing: 0; font-weight: 400; }

/* páginas de uma lista longa */
.paginacao { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: var(--e2) var(--e4); font-size: .9rem; color: var(--texto-2); }
.paginacao a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--e4); border: 1px solid var(--borda);
  border-radius: 999px; background: var(--superficie); font-weight: 650; text-decoration: none; }
.paginacao a[rel="prev"]::before { content: "← "; white-space: pre; }
.paginacao a[rel="next"]::after { content: " →"; white-space: pre; }

/* botões */
.botao { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: 0 var(--e4);
  border-radius: 999px; border: 1px solid var(--destaque); background: var(--destaque); color: var(--sobre-destaque);
  font-weight: 700; cursor: pointer; text-decoration: none; transition: background-color .15s ease, color .15s ease; }
.botao:hover { background: var(--destaque-forte); border-color: var(--destaque-forte); color: var(--sobre-destaque); }
.botao[aria-pressed="true"], .botao.secundario { background: transparent; color: var(--destaque); }
.botao.pequeno { min-height: 36px; padding: 0 var(--e3); font-size: .85rem; }

/* ficha do candidato */
.ficha { display: grid; grid-template-columns: max-content 1fr; gap: var(--e2) var(--e4); margin: 0; font-size: .95rem; }
.ficha dt { color: var(--texto-2); font-weight: 600; }
.ficha dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 34rem) { .ficha { grid-template-columns: 1fr; gap: 0; } .ficha dd { margin-bottom: var(--e3); } }
.explica { font-size: .85rem; color: var(--texto-2); margin-top: var(--e1); }
.redes { display: flex; flex-wrap: wrap; gap: var(--e2); list-style: none; margin: 0; padding: 0; }
.redes a, .redes span { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--e3); border-radius: 999px;
  background: var(--superficie-2); color: var(--texto); text-decoration: none; font-size: .9rem; font-weight: 600; }

/* cartões de estado, município e seção */
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); padding: var(--e3) var(--e4);
  display: flex; flex-direction: column; gap: var(--e2); min-width: 0; }
.cartao h3 { color: var(--texto); text-transform: none; letter-spacing: 0; font-size: 1.05rem; }
.cartao h3 a { color: inherit; text-decoration: none; }
.cartao h3 a:hover { text-decoration: underline; }
.cartao ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--e1); font-size: .9rem; }
.cartao li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--e2); align-items: baseline; }
.cartao li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-links { columns: 15rem auto; column-gap: var(--e5); list-style: none; margin: 0; padding: 0; }
.lista-links li { break-inside: avoid; }
.lista-links a { display: inline-flex; min-height: 36px; align-items: center; }
.secoes-local { display: flex; flex-wrap: wrap; gap: var(--e2); list-style: none; margin: 0; padding: 0; }
.secoes-local a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 var(--e3); border-radius: var(--raio-p);
  background: var(--superficie-2); text-decoration: none; font-weight: 650; }
.secoes-local a:hover { background: color-mix(in srgb, var(--destaque) 16%, var(--superficie-2)); }
.secoes-local small { color: var(--texto-3); font-weight: 400; margin-left: .35rem; }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-weight: 650; color: var(--destaque); }
details[open] > summary { margin-bottom: var(--e2); }

/* hemiciclo e chips de partido */
.chips { display: flex; flex-wrap: wrap; gap: var(--e2); list-style: none; margin: 0; padding: 0; }
.chips li { background: var(--superficie-2); border-radius: 999px; padding: .2rem .7rem; font-size: .88rem; }
.chips b { margin-left: .3rem; }
.hemiciclo { width: 100%; max-width: 24rem; height: auto; display: block; margin: 0 auto; }

/* lista dos locais de votação (o mapa interativo tem o próprio CSS, mapa.css) */
#tabela-locais td .botao { margin-top: var(--e1); }
#tabela-locais tr:target td, .cartao:target { background: color-mix(in srgb, var(--destaque) 12%, var(--superficie)); }

/* busca */
.busca-campo { width: 100%; max-width: 36rem; min-height: 52px; font-size: 1.15rem; padding: 0 var(--e4); border-radius: var(--raio);
  border: 1px solid var(--borda); background: var(--superficie); color: var(--texto); }

/* rodapé */
.rodape { border-top: 1px solid var(--borda); background: var(--superficie); color: var(--texto-2); font-size: .85rem; padding: var(--e5) 0; }
.rodape .largura { display: flex; flex-direction: column; gap: var(--e2); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .topo nav, .botao-tema, .filtros, .botao { display: none !important; }
  body { background: #fff; color: #000; }
}

/* composição de casa (_composicao.html), histórico e mandatários: listas de nomes */
.composicao { display: flex; flex-direction: column; gap: var(--e3); }
.composicao + .composicao { margin-top: var(--e4); }
.composicao th.grupo { text-align: center; border-bottom: 1px solid var(--borda); }
.composicao-listas details { border-top: 1px solid var(--superficie-2); padding: var(--e1) 0; }
.composicao-listas summary { cursor: pointer; font-weight: 650; min-height: 36px; display: flex; align-items: center; }
.composicao-listas h4 { font-size: .85rem; margin: var(--e3) 0 var(--e1); color: var(--texto-2); }
.composicao-listas h4:target { color: var(--destaque); }
.nomes { columns: 16rem auto; column-gap: var(--e5); list-style: none; margin: 0; padding: 0; font-size: .9rem; }
.nomes li { break-inside: avoid; padding: 2px 0; }
a.pilula { text-decoration: none; }
