/* Página pública de apuração. */

.campo-evento { width: auto; max-width: 280px; padding: 6px 28px 6px 10px; font-size: 0.8rem; }
.topnav-cargos { overflow-x: auto; scrollbar-width: none; }
.topnav-cargos::-webkit-scrollbar { display: none; }

/* ---- Palco: mapa | resultado ---- */

.palco {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    grid-template-areas: "mapa dock";
    height: calc(100vh - var(--topbar));
    height: calc(100dvh - var(--topbar));
    min-height: 560px;
    border-bottom: 1px solid var(--line);
}

.dock { display: flex; flex-direction: column; min-height: 0; background: var(--paper); }
.dock-principal { grid-area: dock; border-left: 1px solid var(--line); }
.dock-head { flex: none; padding: 18px 22px 14px; border-bottom: 1px solid var(--line); }
.dock-body { flex: 1 1 0; min-height: 0; overflow-y: auto; padding: 16px 22px 22px; }

.dock-rot {
    margin-bottom: 10px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.kicker { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; margin-bottom: 10px; }
.voltar { border: 0; background: none; padding: 2px 0; font-size: 0.78rem; color: var(--muted); }
.voltar:hover { color: var(--ink); }

.titulo { font-family: var(--display); font-size: clamp(1.5rem, 2.3vw, 1.95rem); font-weight: 500; line-height: 1.06; letter-spacing: -0.025em; }
.subtitulo { margin-top: 4px; font-size: 0.82rem; color: var(--muted); }

.progresso { margin-top: 14px; }
.progresso-topo { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.progresso-pct { font-family: var(--display); font-size: 1.4rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.progresso-pct small { font-family: var(--sans); font-size: 0.78rem; font-weight: 400; color: var(--muted); margin-left: 6px; }
.progresso-lab { font-size: 0.76rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.carimbo { margin-top: 7px; font-size: 0.72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Placar ---- */

.placar { display: grid; }
.cand {
    display: grid;
    grid-template-columns: 4px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: stretch;
    padding: 8px 0 7px;
    border-bottom: 1px solid var(--line);
    cursor: pointer;
    transition: background .15s;
}
.cand > div { align-self: center; }
.cand:hover { background: var(--paper-2); }
.cand.is-calor { background: var(--paper-2); }
.cand:not(.is-lider) .cand-nome { opacity: .9; }
.filete { display: block; width: 4px; }
.cand-nome { opacity: .9; }
.cand-nome { font-size: 0.95rem; font-weight: 400; line-height: 1.2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.cand-partido { margin-top: 2px; font-size: 0.68rem; color: var(--muted); letter-spacing: 0.03em; }
.cand-barra { margin-top: 5px; height: 6px; background: var(--paper-3); }
.cand-barra > span { display: block; height: 100%; width: 0; transition: width .8s cubic-bezier(.16, 1, .3, 1); }
.cand-nums { text-align: right; white-space: nowrap; }
.cand-pct { font-family: var(--display); font-size: 1.14rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.cand-votos { margin-top: 3px; font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.cand.is-zero .cand-pct { color: var(--muted); font-weight: 500; }

.mais {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: none;
    font-size: 0.78rem;
    letter-spacing: 0.03em;
    color: var(--muted);
    transition: color .15s, border-color .15s;
}
.mais:hover { color: var(--ink); border-color: var(--line-strong); }

.bloco { margin-top: 22px; }
.vazio-pequeno { font-size: 0.82rem; color: var(--muted); }
.credito { margin-top: 24px; font-size: 0.7rem; color: var(--muted); line-height: 1.5; }

.aguardando-cartao { padding: 14px 0 6px; }
.aguardando-cartao h3 { font-family: var(--display); font-size: 1.1rem; font-weight: 500; margin-bottom: 6px; }
.aguardando-cartao p { font-size: 0.82rem; color: var(--muted); }

/* ---- Participação ---- */

.participacao { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 3px; overflow: hidden; }
.part-item { background: var(--paper); padding: 9px 11px; }
.part-rot { font-size: 0.64rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.part-val { margin-top: 2px; font-family: var(--display); font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.part-sub { font-size: 0.7rem; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- Cadeiras ---- */

.cadeiras-barra { display: flex; height: 22px; gap: 2px; margin-bottom: 10px; }
.cadeiras-barra span { display: block; height: 100%; border-radius: 1px; }
.cadeiras-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px 10px; font-size: 0.8rem; }
.cadeiras-lista div { display: flex; align-items: center; gap: 6px; }
.cadeiras-lista strong { font-variant-numeric: tabular-nums; margin-left: auto; }
.cadeiras-nota { margin-top: 8px; font-size: 0.7rem; color: var(--muted); }
.hemiciclo { display: block; width: 100%; max-width: 320px; margin: 0 auto 10px; }

/* ---- Curva ---- */

.curva-svg { display: block; width: 100%; height: auto; overflow: visible; }
.curva-grade { stroke: var(--line); stroke-width: 1; }
.curva-maioria { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.curva-eixo { fill: var(--muted); font-size: 9px; font-family: var(--sans); }
.curva-linha { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.curva-rotulo { font-size: 10px; font-weight: 700; font-family: var(--sans); }
.curva-legenda { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 8px; font-size: 0.74rem; color: var(--ink-2); }
.curva-legenda span { display: inline-flex; align-items: center; gap: 6px; }
.curva-nota { margin-top: 6px; font-size: 0.68rem; color: var(--muted); }

/* ---- Mapa ---- */

.palco-mapa { grid-area: mapa; position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--paper); }
.mapa-area { position: absolute; inset: calc(var(--barra-h, 34px) + 24px) 20px 20px; }
.mapa-area[hidden] { display: none; }
.botoes-bairros {
    position: absolute;
    z-index: 4;
    left: 20px;
    top: calc(var(--barra-h, 34px) + 24px);
    display: flex;
    gap: 6px;
}
.botoes-bairros[hidden] { display: none; }
.botao-bairros {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink);
    font-size: 0.8rem;
    cursor: pointer;
}
.botao-bairros:hover { background: var(--paper-2); }
a.botao-bairros { text-decoration: none; }

.barra-mapa {
    position: absolute;
    z-index: 4;
    top: 14px;
    left: 14px;
    right: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}
.busca-mapa { flex: 0 1 190px; }
.busca-mapa .campo { padding-top: 5px; padding-bottom: 5px; font-size: 0.76rem; }
#modos { margin-left: auto; }

.legenda {
    position: absolute;
    z-index: 3;
    right: 14px;
    top: calc(var(--barra-h, 34px) + 24px);
    padding: 9px 11px 8px;
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    border: 1px solid var(--line);
    border-radius: 3px;
    font-size: 0.66rem;
    color: var(--ink-2);
    pointer-events: none;
    max-width: calc(100% - 90px);
}
.legenda:empty { display: none; }
.leg-tit { margin-bottom: 6px; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.leg-linha { display: grid; grid-template-columns: 7.5em auto; align-items: center; gap: 8px; }
.leg-linha + .leg-linha { margin-top: 3px; }
.leg-nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.leg-regua { display: grid; grid-auto-flow: column; grid-auto-columns: 18px; gap: 1px; }
.leg-regua > span { height: 10px; }
.leg-regua.rotulos > span { height: auto; font-size: 0.56rem; color: var(--muted); font-variant-numeric: tabular-nums; text-align: center; }
.leg-vazio { display: flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--muted); }
.leg-vazio i { width: 18px; height: 10px; background: var(--map-vazio); display: inline-block; }

.zoom-ctrl {
    position: absolute;
    z-index: 3;
    right: 14px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: 3px;
    overflow: hidden;
    background: var(--paper);
}
.zoom-ctrl button { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 0; background: none; font-size: 1.05rem; color: var(--ink-2); }
.zoom-ctrl button + button { border-top: 1px solid var(--line); }
.zoom-ctrl button:hover { background: var(--paper-2); color: var(--ink); }
.zoom-ctrl svg { width: 14px; height: 14px; }


.aviso-mapa {
    position: absolute;
    z-index: 4;
    left: 50%;
    top: calc(var(--barra-h, 34px) + 24px);
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 8px 7px 14px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 3px;
    font-size: 0.8rem;
    white-space: nowrap;
}
.aviso-mapa { padding: 8px 14px; background: var(--paper-2); color: var(--ink-2); border: 1px solid var(--line); }

/* ---- Tabelas ---- */

.secao { padding: clamp(32px, 5vw, 56px) 0 clamp(20px, 3vw, 32px); }
.secao + .secao { padding-top: 12px; }
.secao-in { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }
.secao-cab { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.h2 { font-family: var(--display); font-size: clamp(1.4rem, 2.6vw, 1.9rem); font-weight: 500; letter-spacing: -0.02em; }
.secao-nota { font-size: 0.78rem; color: var(--muted); }
.busca-tabela { width: min(280px, 100%); }
.mais-tabela { max-width: 320px; margin: 16px auto 0; }

.tabela .lider { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.tabela .lider small { color: var(--muted); font-size: 0.72rem; }
.tabela .mini-cadeiras { display: inline-flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 10px; }
.tabela .mini-cadeiras span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.tabela .nome-unidade { font-weight: 600; }
.tabela td.pct-forte { font-weight: 700; }
.tabela td.margem { color: var(--cor, var(--ink)); }
:root[data-theme="dark"] .tabela td.margem { color: color-mix(in srgb, var(--cor, #fff) 72%, #fff); }
.mini-apurado { display: inline-flex; align-items: center; gap: 8px; }
.mini-apurado .barra { width: 54px; height: 4px; }
.tabela td.vazio { color: var(--muted); }

.rodape { border-top: 1px solid var(--line); padding: 22px 0 34px; margin-top: 30px; font-size: 0.76rem; color: var(--muted); }
.rodape-in { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.rodape a:hover { color: var(--ink); }
.rodape-links { display: inline-flex; gap: 18px; flex-wrap: wrap; }

.estado-vazio { display: grid; place-items: center; text-align: center; padding: 60px 24px; grid-column: 1 / -1; }
.estado-vazio h2 { font-family: var(--display); font-size: 1.6rem; font-weight: 500; margin-bottom: 8px; }
.estado-vazio p { color: var(--muted); max-width: 440px; }

/* ---- Balão do mapa (página pública) ----
   Copiado do ElectoMaps (apuracao.css, .apu-tip e .district-nyt-*), com os mesmos valores literais. */

.apu-tip {
    position: fixed;
    z-index: 60;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.14s ease;
    background: #f6f6f4;
    color: #111111;
    border: 1px solid #cccccc;
    border-radius: 2px;
    padding: 8px 10px;
    font-family: var(--sans);
    min-width: 260px;
    max-width: 360px;
    white-space: normal;
    box-sizing: border-box;
    overflow-wrap: anywhere;
    word-break: break-word;
    overflow: hidden;
}
.apu-tip.is-on { opacity: 1; }
.nyt-tooltip-container { font-family: var(--sans); color: inherit; min-width: 280px; box-sizing: border-box; overflow-wrap: anywhere; word-break: break-word; }
.district-nyt-title { font-weight: 700; font-size: 15px; color: #1a1a1a; margin-bottom: 8px; line-height: 1.25; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.district-nyt-sub { font-size: 12px; color: #777777; margin-bottom: 6px; }
.district-nyt-nota { font-size: 11px; color: #777777; margin-top: 8px; }
.district-nyt-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.district-nyt-table th { font-size: 12px; font-weight: normal; color: #777777; border-bottom: 1px solid #eeeeee; padding: 4px 6px; padding-top: 0; text-align: right; }
.district-nyt-table th:first-child { text-align: left; padding-left: 0; width: auto; }
.district-nyt-table th:nth-child(2) { width: 96px; text-align: right; padding-right: 12px; }
.district-nyt-table th:nth-child(3) { width: 62px; text-align: right; padding-right: 0; }
.district-nyt-table td { font-size: 13px; padding: 4px 6px; border-bottom: 1px solid #eeeeee; text-align: right; vertical-align: middle; }
.district-nyt-table td:first-child { text-align: left; padding-left: 0; width: auto; white-space: normal; }
.district-nyt-table td.votes-cell { width: 96px; text-align: right; white-space: nowrap; padding-left: 4px; padding-right: 12px; font-variant-numeric: tabular-nums; color: #555555; }
.district-nyt-table td.votes-cell.winner { color: #333333; }
.district-nyt-table td:last-child { padding-right: 0; }
.district-nyt-table td.pct-cell { width: 62px; text-align: right; white-space: nowrap; padding-left: 2px; padding-right: 0; font-weight: bold; color: #333333; }
.district-nyt-table td.pct-cell.winner { color: #111111; }
.district-nyt-loser-cell { padding: 4px 6px; display: flex; align-items: flex-start; border-left: 3px solid; min-width: 0; width: 100%; box-sizing: border-box; overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.district-nyt-loser-cell > span { margin-left: 6px; min-width: 0; }
:root[data-theme="dark"] .apu-tip { background: #151515; color: #f5f5f5; border-color: #2a2a2a; }
:root[data-theme="dark"] .district-nyt-title { color: #ffffff; }
:root[data-theme="dark"] .district-nyt-table th { color: #aaaaaa; border-bottom-color: #2a2a2a; }
:root[data-theme="dark"] .district-nyt-table td { border-bottom-color: #2a2a2a; }
:root[data-theme="dark"] .district-nyt-table td.votes-cell { color: #aaaaaa; }
:root[data-theme="dark"] .district-nyt-table td.votes-cell.winner { color: #dddddd; }
:root[data-theme="dark"] .district-nyt-table td.pct-cell { color: #cccccc; }
:root[data-theme="dark"] .district-nyt-table td.pct-cell.winner { color: #ffffff; }

/* ---- Responsivo ---- */

@media (max-width: 1180px) {
    .palco { grid-template-columns: minmax(0, 1fr) 360px; }
}

@media (max-width: 860px) {
    .topbar { height: auto; position: static; }
    .topbar-in { flex-wrap: wrap; padding: 10px 14px; gap: 10px 18px; height: auto; }
    .topbar-acoes { margin-left: auto; }
    .topnav-sep { display: none; }
    .topnav-cargos { order: 5; width: 100%; }
    .palco {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "dock" "mapa";
        grid-template-rows: auto 72vh;
        height: auto;
        min-height: 0;
    }
    .dock-principal { border-left: 0; border-bottom: 1px solid var(--line); }
    .dock-body { flex: none; overflow: visible; }
    .legenda { padding: 6px 8px; font-size: 0.6rem; }
    .leg-linha { grid-template-columns: 5.5em auto; }
    .leg-regua { grid-auto-columns: 13px; }
    .legenda .leg-vazio { display: none; }
    .mapa-area { left: 6px; right: 6px; }
    #modos { margin-left: 0; }
    .campo-evento { max-width: 190px; }
}
.subtitulo .link-cidade { color: var(--brand); font-weight: 600; text-decoration: none; }

/* ---- Hemiciclo compartilhado (resumo, deputados e cidades) ---- */

.apu-swatch {
    display: inline-block;
    vertical-align: -1px;
    width: 11px;
    height: 11px;
    border-radius: 2px;
    flex: none;
}
.apu-hemi { display: block; width: 100%; height: auto; overflow: visible; }
.apu-hemi-assento {
    fill: var(--paper-3);
    stroke: var(--paper-3);
    stroke-linejoin: round;
    cursor: pointer;
    transition: fill 0.6s ease, stroke 0.6s ease, opacity 0.2s ease;
}
.apu-hemi-assento.is-vazio { cursor: default; }
.apu-hemi-assento.is-ponto { stroke: none; }
.apu-hemi-assento.is-provisorio { opacity: 0.5; }
.apu-hemi.is-foco .apu-hemi-assento:not(.is-foco) { opacity: 0.22; }
.apu-hemi-maioria {
    stroke: var(--ink);
    stroke-width: 1.2;
    stroke-dasharray: 3 3;
    opacity: 0.6;
    pointer-events: none;
}
.apu-hemi-maioria-rot {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    fill: var(--muted);
}
.apu-hemi-total {
    font-family: var(--display);
    font-size: 40px;
    font-weight: 600;
    fill: var(--ink);
}
.apu-hemi-rot {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    fill: var(--muted);
}
.apu-hemi-maioria-abs {
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 500;
    fill: var(--muted);
}
@media (prefers-reduced-motion: reduce) {
    .apu-hemi-assento { transition: none; }
}
