:root {
  /* Tema "Calçada": claro, cinza-pedra, com terracota (ao vivo) e verde-escuro (apurado).
     Todas as cores da interface estão aqui; as dos partidos e do mapa estão em configuracao.js. */
  --bg: #ecebe7;          /* fundo da página */
  --painel: #f9f8f5;      /* painéis laterais */
  --painel-2: #ffffff;    /* menus, caixas de informação, campos */
  --vidro: rgba(249,248,245,.94); /* timeline e botões por cima do mapa */
  --borda: #d6d2ca;
  --borda-forte: #b9b4aa;
  --hover: #efede8;       /* fundo ao passar o rato */
  --trilho: #e2dfd8;      /* fundo das barras vazias */
  --texto: #1b1c1e;
  --suave: #5f6368;
  --fraco: #8b8e92;
  --ativo: #1b1c1e;       /* separador escolhido (pílula escura) */
  --ativo-texto: #f9f8f5;
  --destaque: #b5442c;    /* terracota: "ao vivo" */
  --apurado: #2d6a4f;     /* verde-escuro: eleito, vence, sobe */
  --laranja: #b26a00;     /* 2.ª volta, timeline no passado */
  --vermelho: #c0392b;
  --sombra: rgba(60,50,35,.16);
  --serif: "Faustina", Georgia, serif;
  --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--texto); font-family: var(--sans); font-size: 14px; }
button, select { font: inherit; color: inherit; }
a { color: inherit; }

/* Topo */
.topo { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 20px; background: var(--ativo); color: var(--ativo-texto); flex-wrap: wrap; }
.marca { font-family: var(--serif); font-size: 22px; }
.marca b { font-weight: 500; }
.abas { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.seg button { background: none; border: 0; padding: 5px 11px; border-radius: 5px; cursor: pointer; color: var(--suave); }
.abas button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 12px 0 10px; border-radius: 0; cursor: pointer; color: var(--suave); font-weight: 500; white-space: nowrap; }
.seg button.ativa { background: var(--ativo); color: var(--ativo-texto); }
.abas button.ativa { color: var(--texto); border-bottom-color: var(--destaque); }
.abas button:hover { color: var(--texto); }
.status { display: flex; align-items: center; gap: 8px; color: rgba(249,248,245,.72); font-variant-numeric: tabular-nums; }
.ponto { width: 8px; height: 8px; border-radius: 50%; background: var(--fraco); }
.ponto.vivo { background: var(--destaque); box-shadow: 0 0 0 0 rgba(181,68,44,.5); animation: pulso 2s infinite; }
.ponto.erro { background: var(--vermelho); }
@keyframes pulso { 70% { box-shadow: 0 0 0 8px rgba(181,68,44,0); } 100% { box-shadow: 0 0 0 0 rgba(181,68,44,0); } }

/* Grade */
.grade { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; padding: 16px 20px; align-items: start; }
.painel { background: var(--painel); border: 1px solid var(--borda); border-radius: 10px; padding: 18px; }
.centro { min-width: 0; }

/* Resumo */
.rotulo { color: var(--suave); font-size: 12px; margin-bottom: 8px; }
.manchete { font-family: var(--serif); font-size: 26px; line-height: 1.15; margin: 0 0 14px; font-weight: 400; }
.manchete .nome { font-weight: 500; }
.duelo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.duelo .lado:last-child { text-align: right; }
.cab { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.duelo .lado:last-child .cab { flex-direction: row-reverse; }
/* Fotos do TSE são retratos 161×225 com a cara no terço de cima: recorta o quadrado nessa zona */
.foto { width: 46px; height: 46px; border-radius: 10px; object-fit: cover; object-position: 50% 22%; background: var(--trilho); flex: none; display: block; }
.foto.p { width: 32px; height: 32px; border-radius: 8px; }
.foto.xs { width: 22px; height: 22px; border-radius: 50%; }
/* Foto recortada: cor do partido por trás (gradiente), como um "cartão" do candidato */
.foto.recortada { background: radial-gradient(120% 90% at 50% 15%, color-mix(in srgb, var(--cp) 85%, #fff 15%), color-mix(in srgb, var(--cp) 70%, #000 30%)); }
.foto.sem { content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Crect width='40' height='40' fill='%23e2dfd8'/%3E%3Ccircle cx='20' cy='15' r='7' fill='%23b9b4aa'/%3E%3Cpath d='M6 40c0-9 6-14 14-14s14 5 14 14z' fill='%23b9b4aa'/%3E%3C/svg%3E"); }
.pilha { display: inline-flex; flex: none; }
.pilha .foto + .foto { margin-left: -8px; }
.pilha .foto { box-shadow: 0 0 0 2px var(--painel); }
.nm { font-weight: 600; line-height: 1.2; }
.pt { font-size: 12px; }
.pct { font-size: 34px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pct small { font-size: 14px; color: var(--suave); }
.votos { color: var(--suave); font-size: 12px; font-variant-numeric: tabular-nums; }
.barra { position: relative; height: 8px; background: var(--trilho); border-radius: 4px; margin: 18px 0 6px; overflow: hidden; }
.barra i { position: absolute; top: 0; bottom: 0; }
.barra .meio { left: 50%; width: 2px; background: var(--texto); margin-left: -1px; z-index: 2; }
.faltam { display: flex; justify-content: space-between; color: var(--suave); font-size: 12px; }
.linhas { margin-top: 16px; border-top: 1px solid var(--borda); padding-top: 12px; }
.linha { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; gap: 10px; }
.linha .esq { display: flex; align-items: center; gap: 10px; min-width: 0; }
.linha .esq span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--suave); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; border-top: 1px solid var(--borda); padding-top: 12px; }
.stats div { font-size: 11px; color: var(--suave); }
.stats b { display: block; font-size: 16px; color: var(--texto); font-weight: 500; font-variant-numeric: tabular-nums; margin-top: 2px; }
.selo { display: inline-block; white-space: nowrap; font-size: 11px; padding: 2px 8px; border-radius: 999px; background: rgba(45,106,79,.12); color: var(--apurado); margin-left: 6px; vertical-align: middle; font-family: var(--sans); }
.selo.t2 { background: rgba(178,106,0,.12); color: var(--laranja); }
.lista-uf .linha { cursor: pointer; border-radius: 8px; padding: 6px 6px; margin: 0 -6px; }
.lista-uf .linha:hover { background: var(--hover); }
.uf-tag { width: 30px; font-weight: 600; color: var(--suave); flex: none; }

/* Mapa */
.controles { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.seg { display: flex; background: var(--painel); border: 1px solid var(--borda); border-radius: 8px; padding: 3px; }
/* Dropdown de candidatos */
.dropdown { position: relative; }
.dd-botao { display: flex; align-items: center; gap: 8px; background: var(--painel); border: 1px solid var(--borda); border-radius: 8px; padding: 4px 12px 4px 5px; cursor: pointer; }
.dd-botao .seta { color: var(--suave); font-size: 11px; }
.dd-lista { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; max-height: min(420px, calc(100vh - 220px)); overflow-y: auto; background: var(--painel-2); border: 1px solid var(--borda); border-radius: 12px; padding: 6px; min-width: 270px; box-shadow: 0 12px 40px var(--sombra); }
.dd-lista button { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-radius: 8px; padding: 7px 8px; cursor: pointer; text-align: left; }
.dd-lista button:hover, .dd-lista button.ativa { background: var(--hover); }
.dd-lista small { font-size: 11px; }
.link { background: none; border: 0; color: var(--suave); cursor: pointer; }
.link:hover { color: var(--texto); }
.mapa-wrap { position: relative; border-radius: 10px; overflow: hidden;
  background:
    radial-gradient(ellipse 60% 55% at 46% 48%, rgba(255,255,255,.6), transparent 70%),
    radial-gradient(circle, rgba(0,0,0,.07) 1px, transparent 1.3px) 0 0 / 18px 18px; }
#mapa { width: 100%; height: auto; display: block; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
#mapa.arrastando { cursor: grabbing; }
/* Sombra do país: camada própria (will-change) desenhada uma vez; escondida com zoom */
.mapa-sombra { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; will-change: transform; transition: opacity .3s; }
.mapa-sombra path { fill: #d9d6cf; }
.mapa-wrap.ampliado .mapa-sombra { opacity: 0; }
#mapa { position: relative; }
#mun .m { stroke: rgba(255,255,255,.6); stroke-width: .35; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: pointer; transition: fill .6s ease, opacity .35s ease; }
#mapa.nivel-uf #mun .m { stroke: rgba(255,255,255,.25); }
#ufs .uf { fill: none; stroke: rgba(27,28,30,.55); stroke-width: .9; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; transition: stroke .2s; }
#ufs .uf.sel { stroke: var(--texto); stroke-width: 2.2; }
#hoverMun { fill: rgba(0,0,0,.06); stroke: var(--texto); stroke-width: 1.6; vector-effect: non-scaling-stroke; pointer-events: none; }
#hoverUf { fill: none; stroke: rgba(27,28,30,.8); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
#mapa.nivel-uf #hoverUf { fill: rgba(0,0,0,.05); stroke-width: 2.2; }
#mapa .rot { font-family: var(--sans); font-size: calc(20px / var(--k, 1)); font-weight: 600; fill: #fff; text-anchor: middle; pointer-events: none;
  paint-order: stroke; stroke: rgba(0,0,0,.55); stroke-width: calc(3.5px / var(--k, 1)); stroke-linejoin: round; letter-spacing: .02em; transition: opacity .3s; }
#mapa .rot tspan.p { font-weight: 500; font-size: calc(16px / var(--k, 1)); fill: rgba(255,255,255,.88); }
#mapa.com-sel .rot:not(.sel) { opacity: .3; }
#mapa .chip { cursor: pointer; }
#mapa .chip rect { stroke: rgba(0,0,0,.12); stroke-width: 1; transition: fill .5s; }
#mapa .chip:hover rect, #mapa .chip.sel rect { stroke: var(--texto); stroke-width: 2; }
#mapa .chip text { font-size: 17px; font-weight: 700; fill: #fff; pointer-events: none; letter-spacing: .03em; }
#mapa .chip text.v { font-weight: 500; }
#mapa .chip-linha { fill: none; stroke: rgba(0,0,0,.25); stroke-width: .9; }
.zoom-ctl { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; border: 1px solid var(--borda); border-radius: 10px; overflow: hidden; background: var(--vidro); backdrop-filter: blur(6px); }
.zoom-ctl button { width: 32px; height: 30px; background: none; border: 0; color: var(--texto); cursor: pointer; font-size: 16px; line-height: 1; }
.zoom-ctl button + button { border-top: 1px solid var(--borda); }
.zoom-ctl button:hover { background: var(--hover); }
#nivel button:disabled { opacity: .4; cursor: not-allowed; }
.tooltip { position: absolute; left: 0; top: 0; will-change: transform; pointer-events: none; background: var(--painel-2); border: 1px solid var(--borda); border-radius: 10px; padding: 10px 12px; min-width: 190px; font-size: 12px; z-index: 5; box-shadow: 0 8px 30px var(--sombra); }
.tooltip h4 { margin: 0 0 6px; font-size: 13px; }
.tooltip .linha { padding: 2px 0; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; color: var(--suave); font-size: 12px; margin-top: 6px; }
.legenda span { display: inline-flex; align-items: center; gap: 6px; }
.legenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.leg-p, .leg-escala { gap: 7px; }
.leg-p b { font-weight: 700; font-size: 11px; letter-spacing: .03em; }
.legenda .degraus { display: inline-flex; gap: 0; }
.legenda .degraus i { width: 14px; height: 8px; border-radius: 0; }
.legenda .degraus i:first-child { border-radius: 3px 0 0 3px; }
.legenda .degraus i:last-child { border-radius: 0 3px 3px 0; }
.legenda small { color: var(--suave); font-size: 11px; }
.leg-nota { color: var(--fraco); font-size: 11px; }
.tip-sub { color: var(--suave); font-size: 11px; margin: -2px 0 6px; }

/* Feed */
.feed h3 { margin: 0 0 12px; font-size: 14px; font-weight: 600; }
.feed ol { list-style: none; padding: 0; margin: 0; max-height: calc(100vh - 170px); overflow-y: auto; }
.feed li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; padding: 9px 0; border-top: 1px solid var(--borda); font-size: 13px; }
.feed li:first-child { border-top: 0; }
.feed time { color: var(--suave); font-size: 12px; font-variant-numeric: tabular-nums; }
.feed .vazio { color: var(--suave); display: block; }
.feed li.item { cursor: pointer; border-radius: 6px; transition: opacity .2s; }
.feed li.item:hover time { color: var(--texto); }
.feed li.futuro { opacity: .3; }
.fc { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.fc .var { margin-left: auto; font-size: 10.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fc .var + .num { margin-left: 6px; min-width: 42px; text-align: right; }
.fc .num:not(.var + .num) { margin-left: auto; }
.var.sobe { color: var(--apurado); }
.var.desce { color: var(--suave); }
.var.igual { color: var(--fraco); }
.fc.txt { align-items: flex-start; margin-top: 0; }

/* Timeline */
body { padding-bottom: 84px; }
.timeline { position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); width: min(760px, calc(100% - 32px)); z-index: 20;
  display: flex; align-items: center; gap: 12px; background: var(--vidro); backdrop-filter: blur(10px); border: 1px solid var(--borda); border-radius: 10px; padding: 8px 12px; box-shadow: 0 10px 40px var(--sombra); }
.tl-play { width: 32px; height: 32px; border-radius: 6px; border: 0; background: var(--ativo); color: var(--ativo-texto); cursor: pointer; font-size: 11px; flex: none; }
.tl-hora { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 48px; }
.tl-corpo { flex: 1; min-width: 0; }
.tl-trilho { position: relative; height: 30px; }
#tlSpark { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; pointer-events: none; }
#tlRange { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
#tlRange::-webkit-slider-runnable-track { height: 2px; background: var(--borda-forte); border-radius: 2px; }
#tlRange::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -6px; border-radius: 50%; background: var(--destaque); box-shadow: 0 0 0 4px rgba(27,28,30,.12); }
#tlRange::-moz-range-track { height: 2px; background: var(--borda-forte); }
#tlRange::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--destaque); }
.tl-marcas { position: relative; height: 14px; font-size: 10px; color: var(--fraco); }
.tl-marcas span { position: absolute; transform: translateX(-50%); }
.tl-vivo { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--borda); border-radius: 6px; padding: 5px 10px; cursor: pointer; color: var(--suave); flex: none; }
.tl-vivo .ponto { background: var(--fraco); animation: none; box-shadow: none; }
.tl-vivo.ativo { color: var(--texto); }
.tl-vivo.ativo .ponto { background: var(--destaque); }
.timeline.vazia .tl-corpo { pointer-events: none; }
/* Sem gravação da noite: só o aviso, centrado (sem botão, hora, barra nem "Ao vivo") */
.timeline.vazia .tl-play, .timeline.vazia .tl-hora, .timeline.vazia .tl-trilho, .timeline.vazia .tl-vivo { display: none; }
.timeline.vazia .tl-marcas { height: auto; padding: 6px 0; text-align: center; font-size: 12px; }
.timeline.vazia .tl-marcas span { position: static; transform: none; }
body.passado .status { color: #f0b04a; }
body.passado .status .ponto { background: #f0b04a; animation: none; }

.rodape { color: var(--fraco); font-size: 12px; text-align: center; padding: 8px 20px 24px; }

/* Responsivo */
@media (max-width: 999px) {
  .grade { grid-template-columns: minmax(0, 1fr); }
  .feed ol { max-height: 480px; }
}
@media (max-width: 760px) {
  .topo { padding: 10px 16px; }
  .status { margin-left: auto; font-size: 12px; }
  .grade { grid-template-columns: 1fr; padding: 12px 16px; }
  .pct { font-size: 28px; }
  .timeline { bottom: 8px; gap: 8px; padding: 6px 8px; }
  .tl-vivo { padding: 5px 8px; font-size: 12px; }
}

/* Previsão */
.prev { margin-top: 16px; border: 1px solid var(--borda); border-radius: 12px; padding: 12px; background: var(--painel-2); }
.prev-cab { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.prev-cab .muted { font-size: 11px; text-align: right; }
.prev-barra { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--trilho); }
.prev-barra i { display: block; height: 100%; transition: width .4s; }
.prev-barra i.t2 { background: repeating-linear-gradient(135deg, #e0a030 0 4px, #b26a00 4px 8px); }
.prev-cenarios { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; margin: 8px 0 4px; font-size: 11px; color: var(--suave); line-height: 1.3; }
.prev-cenarios > div { display: flex; gap: 6px; align-items: flex-start; }
.prev-cenarios b { font-size: 15px; color: var(--texto); font-weight: 600; }
.prev-cenarios .meio { text-align: center; justify-content: center; }
.prev-cenarios .meio b { color: var(--laranja); }
.prev-cenarios .dir { justify-content: flex-end; text-align: right; }
.prev-tab { margin-top: 8px; }
.prev-tab .linha { display: grid; grid-template-columns: minmax(0,1fr) 78px 58px; gap: 6px; padding: 4px 0; }
.prev-tab .cab-tab { font-size: 10px; color: var(--fraco); text-transform: uppercase; letter-spacing: .04em; }
.prev-tab .cab-tab span:not(:first-child), .prev-tab .proj, .prev-tab .chance { text-align: right; }
.prev-tab .proj small { display: block; font-size: 10px; color: var(--suave); }
.prev-tab .chance { font-weight: 600; }
.prev details { margin-top: 8px; font-size: 12px; color: var(--suave); }
.prev summary { cursor: pointer; color: var(--suave); }
.prev details p { margin: 6px 0 0; line-height: 1.45; }
.selo.prev { background: rgba(0,0,0,.06); color: var(--suave); }
.selo.prev.t2 { background: rgba(178,106,0,.1); color: var(--laranja); }
.linha .esq .selo { flex: none; overflow: visible; margin-left: 0; }

/* Barras de rolagem discretas (painéis com rolagem interna) */
.painel, .feed ol, .dd-lista { scrollbar-width: thin; scrollbar-color: var(--borda-forte) transparent; }

/* Computador: a página ocupa exatamente a janela (100vh) — nada fica fora da vista.
   O mapa encolhe/cresce com o espaço livre; os painéis laterais rolam por dentro se precisarem. */
@media (min-width: 1000px) {
  html, body { height: 100%; }
  body { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
  .topo { flex: none; padding-top: 10px; padding-bottom: 10px; }
  .grade { flex: 1; min-height: 0; grid-template-rows: minmax(0, 1fr) auto; align-items: stretch; padding: 12px 20px 8px; }
  .painel { min-height: 0; overflow-y: auto; }
  .centro { display: flex; flex-direction: column; min-height: 0; }
  .mapa-area { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  .mapa-wrap { flex: 1; min-height: 0; }
  .lado { min-height: 0; }
  #mapa { height: 100%; max-height: none; }
  .feed { display: flex; flex-direction: column; overflow: hidden; }
  .feed ol { flex: 1; min-height: 0; max-height: none; }
  .timeline { grid-column: 1 / -1; position: static; transform: none; width: 100%; margin-top: 0; box-shadow: none; background: var(--painel); flex: none; }
  .rodape { flex: none; padding: 0 20px 8px; font-size: 11px; }
}
@media (min-width: 1000px) and (max-width: 1250px) {
  .grade { grid-template-columns: minmax(0, 1fr) 340px; gap: 12px; }
}

/* Toast de novos dados */
.toast { position: fixed; top: 62px; left: 50%; z-index: 50; display: flex; align-items: center; gap: 10px; max-width: min(520px, calc(100% - 32px));
  background: var(--vidro); backdrop-filter: blur(10px); border: 1px solid var(--borda); border-radius: 999px; padding: 8px 10px 8px 14px;
  font-size: 13px; box-shadow: 0 10px 30px var(--sombra); transform: translate(-50%, -16px); opacity: 0; pointer-events: none; transition: transform .3s ease, opacity .3s ease; }
.toast.visivel { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.toast .ponto { flex: none; }
.toast > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-btn { flex: none; background: var(--texto); color: var(--bg); border: 0; border-radius: 6px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
@media (max-width: 760px) { .toast { top: 110px; } }
@media (prefers-reduced-motion: reduce) { .toast { transition: opacity .2s; transform: translate(-50%, 0); } }
.fc:not(.txt) > span:nth-child(2) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed li > div { min-width: 0; }
.feed ol { overflow-x: hidden; }

/* ---------- Específico de Portugal ---------- */
/* Logótipos/fotos e "emblemas" de sigla quando não há imagem */
.foto.logo { object-fit: contain; object-position: center; background: #fff; box-shadow: inset 0 0 0 1px var(--borda); padding: 3px; }
.foto.logo.xs { padding: 2px; }
.familias .esq { display: flex; align-items: center; gap: 8px; }
.emb { display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 10px; background: var(--cp, #8b8e92);
  color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .02em; text-shadow: 0 1px 2px rgba(0,0,0,.35); overflow: hidden; }
.emb.p { width: 32px; height: 32px; border-radius: 8px; font-size: 10.5px; }
.emb.xs { width: 22px; height: 22px; border-radius: 50%; font-size: 8px; letter-spacing: 0; }
.pilha .emb + .emb, .pilha .foto + .emb, .pilha .emb + .foto { margin-left: -8px; }
.pilha .emb { box-shadow: 0 0 0 2px var(--painel); }

/* Migalhas (território selecionado) */
.migalhas { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; min-height: 22px; margin: -2px 0 6px; font-size: 13px; color: var(--suave); }
.migalhas button { background: none; border: 0; padding: 2px 6px; border-radius: 6px; cursor: pointer; color: var(--suave); }
.migalhas button:hover { background: var(--hover); color: var(--texto); }
.migalhas button.atual { color: var(--texto); font-weight: 600; cursor: default; background: none; }
.migalhas .sep { color: var(--fraco); }

/* Mapa: freguesias por baixo, fronteiras de concelho e distrito por cima */
#fregs .m { stroke: rgba(255,255,255,.55); stroke-width: .3; vector-effect: non-scaling-stroke; stroke-linejoin: round; cursor: pointer; transition: fill .35s ease; }
#mapa.nivel-conc #fregs .m, #mapa.nivel-dist #fregs .m { stroke: rgba(255,255,255,.22); }
#concs path { fill: none; stroke: rgba(255,255,255,.85); stroke-width: .6; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }
#mapa.nivel-dist #concs path { stroke: rgba(255,255,255,.4); }
#mapa.nivel-freg #concs path { stroke: rgba(27,28,30,.35); stroke-width: .7; }
#dists path { fill: none; stroke: rgba(27,28,30,.55); stroke-width: .9; vector-effect: non-scaling-stroke; stroke-linejoin: round; pointer-events: none; }
#dists path.sel { stroke: var(--texto); stroke-width: 2.2; }
#concs path.sel { stroke: var(--texto); stroke-width: 2; }
#hoverF { fill: rgba(0,0,0,.06); stroke: var(--texto); stroke-width: 1.6; vector-effect: non-scaling-stroke; pointer-events: none; }
#hoverC { fill: none; stroke: rgba(27,28,30,.8); stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
#mapa .caixa rect { fill: rgba(0,0,0,.015); stroke: rgba(0,0,0,.2); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-dasharray: 3 3; }
#mapa .caixa text { font-size: calc(15px / var(--k, 1)); fill: var(--suave); font-weight: 600; letter-spacing: .04em; pointer-events: none; }
#mapa .rot.conc { font-size: calc(30px / var(--k, 1)); font-weight: 600; stroke-width: calc(5px / var(--k, 1)); }
#mapa .rot.conc tspan.p { font-size: calc(26px / var(--k, 1)); }
#mapa .rot { font-size: calc(26px / var(--k, 1)); }
#mapa .rot tspan.p { font-size: calc(22px / var(--k, 1)); }

/* Hemiciclo (Assembleia da República) */
.hemiciclo { margin: 6px 0 2px; }
.hemiciclo svg { width: 100%; height: auto; display: block; }
.hemiciclo circle { transition: fill .4s; }
.hemi-leg { display: flex; justify-content: space-between; font-size: 11px; color: var(--suave); margin-top: -4px; }
.lugares { position: relative; display: flex; height: 12px; border-radius: 4px; overflow: hidden; background: var(--trilho); margin: 12px 0 4px; }
.lugares i { display: block; height: 100%; }
.lugares .meio { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--texto); }

/* Tabela de resultados */
.tab { margin-top: 14px; border-top: 1px solid var(--borda); padding-top: 8px; }
.tab .linha { display: grid; grid-template-columns: minmax(0,1fr) 54px 56px; gap: 8px; padding: 5px 0; }
.tab.com-mand .linha { grid-template-columns: minmax(0,1fr) 54px 56px 40px; }
.tab .cab-tab { font-size: 10px; color: var(--fraco); text-transform: uppercase; letter-spacing: .04em; padding-bottom: 2px; }
.tab .linha > span:not(:first-child) { text-align: right; }
.tab .esq small { display: block; color: var(--suave); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tab .esq > span { min-width: 0; }
.tab .mand { font-weight: 600; }
.tab .linha.outros { color: var(--suave); }

/* Visão geral das autárquicas */
.familias .linha { display: grid; grid-template-columns: minmax(0,1fr) 44px 44px; gap: 8px; }
.familias .linha > span:not(:first-child) { text-align: right; }
.familias .barrinha { height: 4px; border-radius: 2px; margin-top: 3px; }
.var.sobe, .familias .sobe { color: var(--apurado); }
.familias .desce { color: var(--vermelho); }
.procura { width: 100%; margin: 14px 0 6px; background: var(--painel-2); border: 1px solid var(--borda); border-radius: 10px; padding: 8px 12px; color: var(--texto); font: inherit; }
.procura:focus { outline: none; border-color: var(--borda-forte); }
.lista-uf .uf-tag.dist { width: auto; min-width: 30px; font-size: 11px; font-weight: 500; }
.selo.mud { background: rgba(192,57,43,.1); color: var(--vermelho); }
.nota { font-size: 11px; color: var(--fraco); margin-top: 6px; line-height: 1.4; }
.cabeca { color: var(--suave); font-size: 12px; }

/* Deputados eleitos (legislativas) */
.eleitos { margin-top: 14px; border-top: 1px solid var(--borda); padding-top: 10px; }
.eleitos-partido { margin-bottom: 8px; }
.eleitos-partido .esq { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.eleitos-partido .esq .muted { margin-left: auto; font-variant-numeric: tabular-nums; }
.eleitos-partido ol { margin: 4px 0 0; padding-left: 50px; color: var(--texto); font-size: 12.5px; line-height: 1.55; }
.eleitos-partido li::marker { color: var(--fraco); font-variant-numeric: tabular-nums; }

/* Modo Deputados: caras dos eleitos por cima dos distritos */
#deps .dep, #chips .dep { cursor: pointer; }
#deps .dep image, #chips .dep image { clip-path: circle(50%); }
#deps .dep .aro, #chips .dep .aro { fill: none; }
#deps .dep text, #chips .dep text { fill: #fff; font-weight: 700; text-anchor: middle; pointer-events: none; font-family: var(--sans); }
#deps .dep:hover .aro, #chips .dep:hover .aro { stroke: var(--texto); }
.tip-dep { display: flex; gap: 10px; align-items: center; max-width: 280px; }
.tip-dep img, .tip-dep .emb { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: none; }
.tip-dep h4 { margin: 0 0 3px; line-height: 1.25; }
.eleitos-partido li { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.eleitos-partido ol { list-style: none; padding-left: 28px; }

/* Navegação sem lag: durante o gesto o mapa é movido como imagem (GPU) e redesenhado no fim */
#mapa { transform-origin: 0 0; }
#mapa.gesto { will-change: transform; }
#mapa.gesto #fregs .m { transition: none; }
#foraSel { fill: var(--bg); opacity: .6; pointer-events: none; }

/* Linha "matemática" no painel (como no projeto do Brasil) */
.matematica { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,.025); border: 1px dashed var(--borda-forte); font-size: 12px; color: var(--suave); line-height: 1.4; }
.matematica b { color: var(--texto); }
.mat-icone { flex: none; width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--trilho); color: var(--texto); font-weight: 700; }

/* Fotos e logótipos por cima dos territórios — tamanho constante no ecrã, qualquer que seja o zoom */
#mapa .av { cursor: pointer; transition: opacity .3s; }
#mapa .av-escala { transform: scale(calc(var(--u, 1.6) / var(--k, 1))); }
#mapa .av-anel { fill: none; stroke: rgba(0,0,0,.5); stroke-width: 1.5; }
#mapa .av.eleito .av-anel { stroke: #fff; stroke-width: 2; }
#mapa .av.apurando .av-c { opacity: .82; }
#mapa .av:hover .av-anel { stroke: #fff; stroke-width: 2.4; }
#mapa .av-ini { fill: #fff; font-family: var(--sans); font-weight: 700; text-anchor: middle; pointer-events: none; }
#mapa .av-ok circle { fill: var(--apurado); stroke: #fff; stroke-width: 1.5; }
#mapa .av-ok path { fill: none; stroke: #fff; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
#mapa .av-uf { font-family: var(--sans); font-size: 11px; font-weight: 700; fill: #fff; text-anchor: middle; paint-order: stroke; stroke: rgba(0,0,0,.65); stroke-width: 2.6px; stroke-linejoin: round; letter-spacing: .01em; pointer-events: none; }
#mapa .av-uf .p { font-weight: 500; font-size: 10.5px; }
#mapa.com-sel .av:not(.sel) { opacity: .55; }
.tip-dep .foto { width: 56px; height: 56px; border-radius: 50%; }

/* ---------- Backoffice: avisos, manutenção e mensagem fixada (ligacao.js) ---------- */
.manutencao { background: #fbecd0; color: #7a4a00; border-bottom: 1px solid #ecd3a3; padding: 8px 20px; font-size: 13px; text-align: center; }
.avisos-topo .aviso-banner { display: flex; align-items: center; gap: 14px; padding: 10px 20px; background: var(--painel-2); border-bottom: 1px solid var(--borda); }
.avisos-canto { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 10px; max-width: min(360px, calc(100vw - 32px)); }
.aviso-toast { position: relative; display: flex; gap: 12px; padding: 12px 36px 12px 12px; border-radius: 12px; background: var(--painel-2); border: 1px solid var(--borda); box-shadow: 0 12px 40px var(--sombra); animation: avisoEntra .3s ease; }
.aviso-janela { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(27,28,30,.45); animation: avisoEntra .2s ease; }
.aviso-caixa { position: relative; display: flex; flex-direction: column; gap: 12px; width: min(440px, 100%); padding: 18px; border-radius: 14px; background: var(--painel); border: 1px solid var(--borda); box-shadow: 0 20px 60px rgba(27,28,30,.25); }
.aviso-imagem { display: block; max-width: 100%; border-radius: 8px; object-fit: cover; }
.aviso-toast .aviso-imagem { width: 64px; height: 64px; flex: none; }
.aviso-banner .aviso-imagem { height: 36px; width: auto; }
.aviso-corpo { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; }
.aviso-banner .aviso-corpo { flex-direction: row; align-items: center; gap: 12px; flex: 1; flex-wrap: wrap; }
.aviso-titulo { font-size: 14px; }
.aviso-texto { color: var(--suave); line-height: 1.4; }
.aviso-link { align-self: flex-start; margin-top: 4px; padding: 5px 12px; border-radius: 6px; background: var(--texto); color: var(--bg); font-weight: 600; font-size: 12px; text-decoration: none; }
.aviso-banner .aviso-link { margin-top: 0; }
.aviso-fechar { position: absolute; top: 6px; right: 8px; background: none; border: 0; color: var(--suave); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.aviso-banner .aviso-fechar { position: static; margin-left: auto; }
.aviso-fechar:hover { color: var(--texto); }
@keyframes avisoEntra { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { .aviso-toast, .aviso-janela { animation: none; } }
.feed li.fixada { background: rgba(178,106,0,.08); border-radius: 8px; padding: 9px 8px; margin: 0 -8px 4px; border-top: 0; }
.feed li.fixada a { color: var(--texto); }
/* Previsões visíveis só para o administrador (desligadas para o público no backoffice) */
.selo.prev-admin { background: rgba(178,106,0,.12); color: var(--laranja); font-weight: 500; }

/* Esqueletos: blocos cinzentos com um brilho a passar, enquanto não há resultados */
.esq-bloco { display: block; border-radius: 6px; background: linear-gradient(90deg, var(--trilho) 25%, var(--painel-2) 50%, var(--trilho) 75%);
  background-size: 200% 100%; animation: brilho 1.5s ease-in-out infinite; }
.esq-linha { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-top: 1px solid var(--borda); }
.esq-linha:first-child { border-top: 0; }
.esq-aviso { margin: 16px 0 0; color: var(--suave); font-size: 12px; text-align: center; }
.feed li.esq-item { align-items: start; }
@keyframes brilho { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.mapa-wrap.a-carregar #mapa { animation: respirar 1.8s ease-in-out infinite; }
@keyframes respirar { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .esq-bloco, .mapa-wrap.a-carregar #mapa { animation: none; } }

/* Feed sem horas (eleições sem gravação da noite): o texto ocupa a largura toda */
.feed ol.sem-horas li:not(.fixada) { grid-template-columns: minmax(0, 1fr); }
.feed ol.sem-horas li:not(.fixada) > time { display: none; }
.feed li.so-texto { display: block; }

/* ---------- Disposição "Redação" ---------- */
[hidden] { display: none !important; } /* sem isto, "display: flex" (ex.: .seg) ignorava o atributo hidden */

/* Faixa das eleições: separadores sublinhados e, à direita, a volta ou o órgão */
.faixa-eleicoes { display: flex; align-items: center; gap: 16px; padding: 0 20px; background: var(--painel); border-bottom: 1px solid var(--borda); }
.faixa-eleicoes #variantes { margin-left: auto; flex: none; }

/* Mapa: os controlos ficam por cima, no canto superior esquerdo; o zoom no direito */
.mapa-area { position: relative; }
.mapa-ferramentas { position: absolute; z-index: 6; top: 10px; left: 10px; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 64px); pointer-events: none; }
.mapa-ferramentas > * { pointer-events: auto; }
.mapa-ferramentas .seg, .mapa-ferramentas .dd-botao { background: var(--vidro); backdrop-filter: blur(6px); box-shadow: 0 2px 10px var(--sombra); }
.centro .migalhas { margin: 0 0 8px; }

/* Coluna da direita: Resultados | Atualizações */
.lado { display: flex; flex-direction: column; background: var(--painel); border: 1px solid var(--borda); border-radius: 10px; overflow: hidden; }
.lado .painel { border: 0; border-radius: 0; background: none; }
.lado[data-ver="resultados"] .feed, .lado[data-ver="feed"] #resumo { display: none; }
.lado-abas { display: flex; flex: none; border-bottom: 1px solid var(--borda); }
.lado-abas button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 12px 8px 10px; background: none; border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--suave); font-weight: 500; cursor: pointer; }
.lado-abas button:hover { color: var(--texto); }
.lado-abas button.ativa { color: var(--texto); border-bottom-color: var(--destaque); }
.contador { min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--destaque); color: #fff; font-size: 11px; font-variant-numeric: tabular-nums; }
.feed h3 { font-size: 12px; color: var(--suave); font-weight: 500; text-transform: uppercase; letter-spacing: .05em; }

@media (max-width: 760px) {
  .faixa-eleicoes { padding: 0 16px; flex-wrap: wrap; gap: 0 16px; }
  .faixa-eleicoes #variantes { margin: 0 0 8px; }
  .mapa-ferramentas { position: static; max-width: none; margin-bottom: 8px; }
  .mapa-ferramentas .seg, .mapa-ferramentas .dd-botao { box-shadow: none; }
}

/* Janela "Deputados eleitos" (ultimos-eleitos.js): por cima do mapa, no canto inferior esquerdo */
.mapa-cartoes { position: absolute; z-index: 6; left: 10px; bottom: 10px; width: 290px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.mapa-cartoes > * { pointer-events: auto; }
.previsao-no-mapa .prev { margin: 0; background: var(--vidro); backdrop-filter: blur(8px); box-shadow: 0 6px 24px var(--sombra); }
.eleitos-recentes { background: var(--vidro); backdrop-filter: blur(8px);
  border: 1px solid var(--borda); border-radius: 10px; box-shadow: 0 6px 24px var(--sombra); overflow: hidden; }
.er-cab { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 8px 12px; font-size: 12px; border-bottom: 1px solid var(--borda); }
.eleitos-recentes.recolhida .er-cab { border-bottom: 0; }
.er-recolher { width: 26px; height: 22px; border: 1px solid var(--borda); border-radius: 6px; background: var(--painel-2); color: var(--suave); cursor: pointer; font-size: 11px; line-height: 1; }
.er-recolher:hover { color: var(--texto); }
.er-lista { display: flex; flex-direction: column; padding: 4px; max-height: 236px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--borda-forte) transparent; }
.er-hora { margin-left: auto; flex: none; align-self: flex-start; padding-top: 2px; font-size: 11px; color: var(--suave); font-variant-numeric: tabular-nums; }
.er-texto { flex: 1; }
.er-linha { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; background: none; border: 0; border-radius: 6px; text-align: left; cursor: pointer; }
.er-linha:hover { background: var(--hover); }
.er-texto { display: flex; flex-direction: column; min-width: 0; }
.er-nome { font-size: 12.5px; font-weight: 500; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.er-sub { font-size: 11px; color: var(--suave); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.er-primeiro { padding: 8px; }
.er-primeiro .er-nome { font-family: var(--serif); font-size: 16px; white-space: normal; }
.er-primeiro .er-sub { font-size: 12px; }
.er-linha.novo { animation: eleitoNovo 1.6s ease; }
@keyframes eleitoNovo { 0% { background: rgba(181,68,44,.22); } 100% { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .er-linha.novo { animation: none; } }
@media (max-width: 760px) { .eleitos-recentes { position: static; width: auto; margin-top: 8px; box-shadow: none; } }
