/* Painel ao vivo · Fala Reto identity (tokens from /marca/fala-reto.css; header/footer from /marca/cabecalho.js).
   Light theme only. Candidate colors come from MapKit; "still to count" uses yellow stripes, counted uses navy. */
:root {
  color-scheme: light;
  --ink: #0D1117;
  --brand: #0A1A33;
  --lime: #12284A;          /* secondary accent (navy 2) */
  --gold: #FFC20E;
  --muted: #5B6474;
  --line: #E1E5EA;
  --surface: #FFFFFF;
  --bg: #F2F4F7;
  --soft: #F2F4F7;
  --todo: #E1E5EA;
  --warn: #0A1A33;
  --warn-bg: #FFC20E33;
  --err: #0A1A33;
  --header-h: 112px;
  font-family: Montserrat, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 56px); }
body {
  margin: 0;
  background: var(--bg);
  font-size: 14px;
  line-height: 1.4;
  overflow-x: hidden;
}
a { color: inherit; text-underline-offset: 3px; }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .4; cursor: not-allowed; }
main :focus-visible, .card :focus-visible, .statusbar :focus-visible, .ticker :focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #fff; padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- page title (site header is the shared Fala Reto component) ---------- */
.page-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; max-width: 1480px; margin: 0 auto; padding: 18px 16px 6px; }
.page-title h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: -.03em; color: var(--brand); }
.live-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 900; letter-spacing: .14em; color: var(--gold); background: var(--brand); padding: 5px 10px; border-radius: 999px; }
.live-tag i { width: 7px; height: 7px; border-radius: 50%; background: var(--gold); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.statusbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; max-width: 1480px; margin: 0 auto; padding: 4px 16px 10px; font-size: 12px; color: var(--muted); }
.statusbar .warn { color: var(--warn); background: var(--warn-bg); border: 1px solid var(--gold); border-radius: 6px; padding: 2px 8px; }
.statusbar #refresh { margin-left: auto; }

/* ---------- sticky ticker (phones) ---------- */
.ticker { position: sticky; top: var(--header-h); z-index: 20; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 8px 16px; background: #F2F4F7F2; backdrop-filter: blur(6px); border-block: 1px solid var(--line); font-size: 12px; }
.ticker::-webkit-scrollbar { display: none; }
.tk { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tk span { display: inline-flex; align-items: center; gap: 4px; }
.tk b { color: var(--brand); }

/* ---------- board layout ---------- */
.board { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; max-width: 1480px; margin: 0 auto; padding: 14px 16px 24px; }
.col { display: grid; gap: 14px; align-content: start; min-width: 0; }
/* Phone order: president, followed governors, where counting is missing, overview. */
.col-a { display: contents; }
#president { order: 1; } .col-b { order: 2; } #missing { order: 3; } .col-c { order: 4; }

@media (min-width: 820px) {
  .ticker { display: none; }
  .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .col-a { display: grid; order: 1; }
  .col-b { order: 2; }
  .col-c { order: 3; grid-column: 1 / -1; }
  #president, #missing { order: 0; }
}
@media (min-width: 1240px) {
  .board { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr) minmax(0, .9fr); }
  .col-c { grid-column: auto; position: sticky; top: 12px; }
  .col-c #overview .card-body { max-height: calc(100dvh - 120px); overflow: auto; }
}

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 6px 20px #0A1A3314; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card h2 { margin: 0; font-size: 17px; font-weight: 800; letter-spacing: -.02em; color: var(--brand); }
.card h2 small, .card h3 small, .card h4 small { font-weight: 500; font-size: 11px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.placeholder, .muted { color: var(--muted); }
.small { font-size: 11px; }
.error { color: var(--err); font-size: 12px; }
.stale { font-size: 11px; color: var(--warn); background: var(--warn-bg); border-radius: 6px; padding: 6px 8px; margin: 10px 0 0; }
.meta { font-size: 11px; color: var(--muted); margin: 6px 0 12px; }

.ghost { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--lime); min-height: 34px; }
.ghost.wide { width: 100%; margin-top: 10px; }
.link { border: 0; background: none; padding: 2px 0; color: var(--lime); font-size: 11px; font-weight: 650; min-height: 28px; }
.icon { border: 0; background: none; font-size: 20px; line-height: 1; width: 34px; height: 34px; border-radius: 8px; color: var(--muted); margin-left: auto; }
.icon:hover { background: var(--soft); color: var(--ink); }
.badge { display: inline-block; font-style: normal; font-size: 10px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: var(--soft); color: var(--lime); border: 1px solid var(--line); }
.badge.ok { background: var(--gold); color: var(--brand); border-color: var(--gold); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }

/* segmented controls */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; padding: 2px; background: var(--soft); }
.seg button { border: 0; background: none; border-radius: 7px; padding: 6px 10px; font-size: 12px; font-weight: 600; color: var(--muted); min-height: 32px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px #0001; }
.seg.small button { font-size: 11px; padding: 4px 8px; min-height: 28px; }
.sortline { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin: -4px 0 12px; flex-wrap: wrap; }

/* progress */
.progress { margin: 4px 0 10px; }
.track { height: 8px; border-radius: 6px; background: repeating-linear-gradient(-45deg, #FFC20E 0 5px, #FFC20E66 5px 10px); overflow: hidden; border: 1px solid var(--line); }
.track i { display: block; height: 100%; background: var(--brand); border-radius: 6px 0 0 6px; transition: width .6s; }
.progress.big .track { height: 14px; }
.progress-text { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; margin-top: 6px; font-size: 12px; color: var(--muted); }
.progress-text strong { font-size: 18px; color: var(--ink); font-variant-numeric: tabular-nums; }
.progress.big .progress-text strong { font-size: 30px; letter-spacing: -.03em; }
.progress-text .left { margin-left: auto; }
.progress-text .left b { color: var(--ink); }

/* candidates */
.cands { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.cands li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; row-gap: 3px; align-items: center; }
.cands .who { min-width: 0; overflow-wrap: anywhere; }
.cands .name { font-weight: 650; }
.cands small { color: var(--muted); font-size: 10px; }
.cands .share { font-weight: 750; font-size: 18px; font-variant-numeric: tabular-nums; text-align: right; }
.cands .votes { grid-column: 2 / 4; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cands .bar { grid-column: 1 / 4; height: 6px; border-radius: 4px; background: var(--todo); overflow: hidden; }
.cands .bar i { display: block; height: 100%; background: var(--c); border-radius: 4px; transition: width .6s; }
.cands.compact { gap: 6px; }
.cands.compact .share { font-size: 14px; }
.cands.compact .votes { display: none; }
.cands.compact .bar { height: 4px; }
.rest { font-size: 11px; color: var(--muted); margin: 8px 0 0; }
.decision { margin-top: 12px; padding: 8px 10px; border-radius: 8px; background: var(--soft); font-size: 12px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.decision.eleito_tse .badge, .decision.eleito_matematicamente .badge { background: var(--gold); color: var(--brand); border-color: var(--gold); }
.decision.segundo_turno .badge { background: var(--brand); color: var(--gold); border-color: var(--brand); }

/* ---------- onde mais falta ---------- */
.insight { margin: 0 0 8px; font-size: 13px; }
.stack { display: flex; height: 22px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.stack span { display: grid; place-items: center; min-width: 2px; border-right: 1px solid var(--surface); }
.stack em { font-style: normal; font-size: 10px; font-weight: 700; white-space: nowrap; overflow: hidden; }
.stack-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 0; margin: 6px 0 14px; font-size: 10px; color: var(--muted); }
.stack-legend li { display: inline-flex; align-items: center; gap: 4px; }
.stack-legend i { width: 9px; height: 9px; border-radius: 2px; border: 1px solid var(--line); }
.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.mrow { border: 1px solid var(--line); border-radius: 10px; padding: 10px; }
.mrow.most { border-color: var(--gold); background: linear-gradient(120deg, #FFC20E1F, var(--surface)); }
.mrow.most .place::after { content: "mais falta"; font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; background: var(--gold); color: var(--brand); padding: 2px 5px; border-radius: 4px; margin-left: 6px; }
.mrow-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.place { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.place small { color: var(--muted); font-weight: 500; font-size: 10px; }
.mleft { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mleft b { color: var(--ink); }
.mtrack { display: flex; height: 10px; border-radius: 5px; overflow: hidden; margin: 7px 0 6px; border: 1px solid var(--line); }
.mtrack .done { background: var(--brand); }
.mtrack .todo { background: repeating-linear-gradient(-45deg, #FFC20E 0 5px, #FFC20E66 5px 10px); }
.mrow-foot { display: flex; align-items: center; gap: 4px 12px; flex-wrap: wrap; font-size: 11px; }
.leaders { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.leaders > span { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.leaders .dot { width: 8px; height: 8px; }
.mrow-foot .link { margin-left: auto; }
.exterior { font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; margin-top: 10px; }
.flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; border: 1px solid var(--line); flex: none; }

/* ---------- governors ---------- */
.switch { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--lime); cursor: pointer; }
.switch input { width: 34px; height: 20px; appearance: none; background: var(--todo); border-radius: 999px; position: relative; border: 1px solid var(--line); cursor: pointer; margin: 0; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); box-shadow: 0 1px 2px #0003; transition: left .2s; }
.switch input:checked { background: var(--lime); }
.switch input:checked::after { left: 16px; }
.picker { border: 1px dashed var(--gray, #9AA5B1); border-radius: 10px; padding: 8px 10px; margin-bottom: 12px; }
.picker summary { cursor: pointer; font-size: 12px; font-weight: 700; color: var(--lime); list-style: none; min-height: 28px; display: flex; align-items: center; gap: 6px; }
.picker summary::-webkit-details-marker { display: none; }
.hint { font-size: 11px; color: var(--muted); margin: 4px 0 8px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 6px 8px; font-size: 12px; font-weight: 650; min-height: 34px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--gold); border-color: var(--brand); }
.empty { text-align: center; padding: 10px 0; color: var(--muted); }
.empty .chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 8px; }
.followed { display: grid; gap: 12px; }
.gov { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.gov-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.gov-head h3 { margin: 0; font-size: 15px; font-weight: 750; }
.senate { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.senate h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; }
@media (min-width: 560px) and (max-width: 819px) { .followed { grid-template-columns: 1fr 1fr; } }

/* ---------- overview ---------- */
#overview select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface); font-size: 12px; min-height: 34px; }
.olist { list-style: none; margin: 0; padding: 0; }
.olist li { display: grid; grid-template-columns: 30px 52px minmax(0, 1fr) 74px; align-items: center; gap: 6px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 12px; }
.olist li:first-child { border-top: 0; }
.star { border: 0; background: none; font-size: 17px; color: #9AA5B1; width: 30px; height: 30px; border-radius: 6px; padding: 0; }
.star[aria-pressed="true"] { color: var(--brand); }
.star:hover:not(:disabled) { background: var(--soft); }
.ouf { display: inline-flex; align-items: center; gap: 5px; }
.olead { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.olead .name { font-weight: 600; }
.olead small { color: var(--muted); font-size: 10px; }
.olead b { font-variant-numeric: tabular-nums; }
.oprog { display: flex; align-items: center; gap: 5px; justify-content: flex-end; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini { width: 34px; height: 5px; border-radius: 3px; background: var(--gold); overflow: hidden; flex: none; }
.mini i { display: block; height: 100%; background: var(--brand); }

/* ---------- busca + candidatos que sigo ---------- */
.search-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--lime); font-size: 12px; font-weight: 700; }
.search-btn:hover { border-color: var(--lime); }
.mine { width: calc(100% - 32px); max-width: 1448px; margin: 14px auto 0; }
.mine .card-head { margin-bottom: 10px; }
.mine-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 10px; }
.mine-empty { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin: 0; }
.mine-empty p { margin: 0; flex: 1 1 280px; }
.mine-empty .search-btn { background: var(--gold); color: var(--brand); border-color: var(--gold); }
.cand { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 6px; align-content: start; min-width: 0; background: var(--surface); }
.cand.elected { border-color: var(--lime); box-shadow: inset 0 0 0 1px var(--lime); }
.cand-head { display: flex; align-items: flex-start; gap: 10px; }
.cand-photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--soft); border: 1px solid var(--line); flex: none; }
.cand-id { flex: 1; min-width: 0; }
.cand-id h3 { margin: 0; font-size: 15px; font-weight: 750; overflow-wrap: anywhere; }
.cand-id p { margin: 1px 0 0; font-size: 11px; color: var(--muted); }
.cand-head .icon { margin: -6px -6px 0 0; }
.cand-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.cand-nums { display: flex; align-items: baseline; gap: 4px 12px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.cand-nums .share { font-size: 24px; font-weight: 750; letter-spacing: -.03em; }
.cand-nums .votes { font-size: 12px; color: var(--muted); }
.cand-nums .votes b { color: var(--ink); }
.cand-pos { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
.cand-pos b { font-variant-numeric: tabular-nums; }
.cand-prog { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cand-prog .mini { width: 60px; height: 6px; }
.cand-note { margin: 0; font-size: 11px; color: var(--muted); background: var(--soft); border-radius: 6px; padding: 6px 8px; }
.cand-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); }
.cand-foot a { color: var(--lime); font-weight: 700; }
.cand .stale { margin: 0; }

.foot { max-width: 1480px; margin: 0 auto; padding: 12px 16px 16px; display: flex; flex-wrap: wrap; gap: 6px 18px; justify-content: space-between; font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }

@media (max-width: 420px) {
  .progress-text .left { margin-left: 0; width: 100%; }
  .olist li { grid-template-columns: 28px 46px minmax(0, 1fr) 66px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
