:root { --cor-radio: var(--accent); }
body { min-height: 100dvh; }

.faixa { height: 5px; background: var(--cor-radio); }
.cabecalho {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 16px clamp(16px, 3vw, 36px) 10px;
}
.titulo { flex: 1; min-width: 220px; }
.titulo h1 { font-size: clamp(22px, 3vw, 34px); letter-spacing: -.01em; }
.subtitulo { color: var(--text-2); font-size: 15px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.ao-vivo { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--ok); font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.ao-vivo i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: pulso 1.6s infinite; }
.ao-vivo.off { color: var(--err); }
.ao-vivo.off i { animation: none; }
@keyframes pulso { 50% { opacity: .25; } }
.controles { display: flex; gap: 8px; flex-wrap: wrap; }
.controles select { width: auto; min-width: 150px; }
.controles button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }

.painel { padding: 0 clamp(16px, 3vw, 36px) 36px; display: grid; gap: 16px; }

/* resumo do topo */
.resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; display: grid; gap: 4px; align-content: start; }
.kpi .rotulo { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.kpi .valor { font-size: clamp(26px, 3vw, 38px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi .extra { font-size: 14px; color: var(--text-2); }
.barra-progresso { height: 8px; border-radius: 99px; background: var(--bg-3); overflow: hidden; margin-top: 6px; }
.barra-progresso span { display: block; height: 100%; background: var(--cor-radio); border-radius: 99px; transition: width .6s ease; }

/* abas de cargos */
.cargos { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.cargos button { flex: none; min-height: 44px; font-size: 16px; padding: 8px 18px; border-radius: 999px; }
.cargos button[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

/* candidatos */
.cargo-grid { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1100px) { .cargo-grid.duas { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.bloco { padding: 16px; display: grid; gap: 12px; align-content: start; }
.bloco h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); display: flex; align-items: center; gap: 10px; }
.bloco h2 .grow { flex: 1; }
.bloco h2 input { max-width: 220px; min-height: 34px; padding: 5px 10px; font-size: 14px; text-transform: none; letter-spacing: 0; }

.lista { display: grid; gap: 4px; }
.cand {
  display: grid; grid-template-columns: 34px 64px minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  padding: 10px 6px; border-radius: 8px;
}
.cand + .cand { border-top: 1px solid var(--line); }
.cand .pos { font-weight: 800; color: var(--text-3); font-size: 18px; text-align: center; }
.cand .num {
  font-weight: 800; font-size: 18px; text-align: center; background: var(--bg-3); border-radius: 8px; padding: 6px 4px;
}
.cand .nome { font-size: clamp(18px, 2vw, 24px); font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand .partido { font-size: 14px; color: var(--text-2); font-weight: 600; }
.cand .numeros { text-align: right; }
.cand .pct { font-size: clamp(22px, 2.4vw, 30px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.cand .votos { font-size: 14px; color: var(--text-2); }
.cand .barra { grid-column: 3 / 5; height: 10px; border-radius: 99px; background: var(--bg-3); overflow: hidden; }
.cand .barra span { display: block; height: 100%; border-radius: 99px; background: var(--text-3); transition: width .6s ease; }
.cand.lider .barra span { background: var(--cor-radio); }
.cand.lider .pos { color: var(--cor-radio); }
.cand.destaque { background: color-mix(in srgb, var(--cor-radio) 10%, transparent); }
.lista.compacta .cand { padding: 7px 6px; grid-template-columns: 30px 70px minmax(0, 1fr) auto; }
.lista.compacta .cand .nome { font-size: 17px; }
.lista.compacta .cand .pct { font-size: 20px; }
.lista.compacta .cand .barra { height: 6px; }

.totais-cargo { display: flex; gap: 10px 24px; flex-wrap: wrap; font-size: 15px; color: var(--text-2); padding-top: 4px; border-top: 1px solid var(--line); }
.totais-cargo strong { color: var(--text); }

.vazio-painel { padding: 48px 16px; text-align: center; color: var(--text-2); font-size: 17px; }

/* rodapé */
.rodape-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th { text-align: left; font-size: 12px; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; }
td { padding: 8px; border-top: 1px solid var(--line); }
td.n, th.n { text-align: right; }
.ultimos { list-style: none; margin: 0; padding: 0; display: grid; }
.ultimos li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; }
.ultimos li:first-child { border-top: 0; }

/* modo apresentação: sem controles, letras maiores */
body.apresentando .controles > :not(#apresentar) { display: none; }
body.apresentando .rodape-grid { display: none; }
body.apresentando .cand .nome { font-size: clamp(22px, 2.6vw, 34px); }
body.apresentando .cand .pct { font-size: clamp(28px, 3vw, 42px); }
body.apresentando .lista.compacta .cand .nome { font-size: clamp(18px, 2vw, 24px); }
.contagem-slide { height: 3px; background: var(--bg-3); border-radius: 99px; overflow: hidden; }
.contagem-slide span { display: block; height: 100%; width: 0; background: var(--cor-radio); }

@media (max-width: 640px) {
  .cand { grid-template-columns: 26px 52px minmax(0, 1fr) auto; gap: 2px 10px; }
  .cand .num { font-size: 15px; }
  .controles select { min-width: 0; flex: 1; }
}
.cand .pos, .cand .num { grid-row: span 2; }
