
:root { --page: #E3E5E0; --panel: #F2F3EF; --ink: #16191A; --ink-2: #4B514E; --line: #C5C9C2;
        --lula: #C8102E; --blue: #27468C; --grey-a: #7D847F; --grey-b: #AEB4AD;
        --up: #1F7A38; --down: #B85F08; }
@media (prefers-color-scheme: dark) {
  :root { --page: #101312; --panel: #1A1E1D; --ink: #ECEEEA; --ink-2: #A3AAA5; --line: #2C3230;
          --lula: #F0415A; --blue: #6F8FE0; --grey-a: #7D847F; --grey-b: #4E5551;
          --up: #4CC16B; --down: #F0983A; } }
* { box-sizing: border-box; margin: 0; }
html { background: var(--page); }
body { color: var(--ink); background: var(--page); min-height: 100vh;
       font: 400 17px/1.4 "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
       font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
main { max-width: 1180px; margin: 0 auto; padding: 8px 24px 64px; }
:focus-visible { outline: 3px solid var(--lula); outline-offset: 3px; }
.condensed { font-stretch: 75%; }


.hero { padding: 36px 0 44px; }
.hero .where { font-size: 22px; font-weight: 600; }
.hero .where span { color: var(--ink-2); font-weight: 400; }
.duel { display: flex; gap: clamp(16px, 4vw, 56px); margin: 18px 0 18px -6px; }
.big { font-stretch: 75%; font-weight: 800; letter-spacing: -0.025em;
       font-size: clamp(52px, 10.5vw, 150px); line-height: .9; }
.big small { font-size: .38em; letter-spacing: 0; margin-left: .04em; }
.big .who { display: block; font-size: clamp(14px, 1.6vw, 20px); font-stretch: 100%; font-weight: 600;
            letter-spacing: 0; line-height: 1.2; margin-bottom: 8px; white-space: nowrap; }
.big.lula-n, .big.lula-n .who { color: var(--lula); }
.big.rival-n, .big.rival-n .who { color: var(--blue); }
.big { padding-bottom: 8px; border-bottom: 10px solid transparent; }
.big.lead { border-bottom-color: currentColor; }
.big.empty { color: var(--line); font-size: clamp(72px, 12vw, 140px); margin: 18px 0; }
.hero-grid { display: grid; grid-template-columns: 1fr minmax(300px, 420px); gap: 8px 56px; align-items: end; }
.verdict { font-size: clamp(24px, 3.2vw, 36px); font-weight: 700; line-height: 1.15; max-width: 22ch; }
.vs { margin-top: 14px; font-size: 19px; color: var(--ink-2); }
.vs b { font-weight: 700; }
.up { color: var(--up); } .down { color: var(--down); }
.moved { display: block; margin-top: 4px; font-size: 15px; color: var(--ink-2); }
.moved:empty { display: none; }
.cands { list-style: none; padding: 0; }
.cands li { display: grid; grid-template-columns: 14px 1fr auto; gap: 4px 12px; align-items: baseline;
            padding: 7px 0; border-bottom: 1px solid var(--line); }
.cands .dot { width: 14px; height: 14px; border-radius: 50%; align-self: center; }
.cands .pct { font-weight: 700; font-size: 22px; font-stretch: 75%; }
.cands .votos { grid-column: 2 / 4; color: var(--ink-2); font-size: 14px; margin-top: -4px; }
.cands li.lula .nome { font-weight: 700; }

.ribbon { position: relative; margin-top: 40px; }
.ribbon .track { display: flex; height: 44px; border-radius: 22px; overflow: hidden; background: var(--line); }
.seg { height: 100%; flex: none; display: flex; align-items: center; padding: 0 14px; color: #fff;
       font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; }
.tick { position: absolute; top: -16px; bottom: -8px; width: 0; border-left: 2px solid var(--ink); }
.tick span { position: absolute; top: -22px; left: 6px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.progress { margin-top: 26px; display: flex; align-items: center; gap: 14px; font-size: 16px; }
.progress .bar { flex: 1; max-width: 360px; height: 6px; border-radius: 3px; background: var(--line); }
.progress .bar i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }

.state { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.state::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--ink); }
.state.final::before { background: var(--ink); }
.state.partial::before { background: linear-gradient(90deg, var(--ink) 50%, transparent 50%); }
.state.waiting::before { border-style: dashed; }

.ledger { background: var(--panel); border-radius: 18px; overflow: hidden; }
.cols, .row > summary { display: grid; align-items: center; gap: 16px;
        grid-template-columns: minmax(150px, 1.5fr) minmax(150px, 1.2fr) 100px 100px minmax(170px, 1.2fr); }
.cols { padding: 14px 24px; color: var(--ink-2); font-size: 14px; border-bottom: 1px solid var(--line); }
.row { border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row > summary { padding: 18px 24px; cursor: pointer; list-style: none; }
.row > summary::-webkit-details-marker { display: none; }
.row > summary:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.row .name { font-size: 24px; font-weight: 700; line-height: 1.1; }
.row .name span { display: block; font-size: 14px; font-weight: 400; color: var(--ink-2); margin-top: 2px; }
.row .num { font-stretch: 75%; font-weight: 800; font-size: 40px; line-height: 1; }
.row .num.lula { color: var(--lula); }
.row .num.old { color: var(--ink-2); font-weight: 600; }
.row .prog { font-size: 14px; color: var(--ink-2); }
.row .prog .bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 6px; }
.row .prog .bar i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }
.delta { position: relative; height: 28px; }
.delta::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid var(--ink-2); }
.delta .fill { position: absolute; top: 9px; height: 10px; border-radius: 5px; }
.delta .fill.up { background: var(--up); left: 50%; }
.delta .fill.down { background: var(--down); right: 50%; }
.delta .txt { position: absolute; top: 4px; font-size: 14px; font-weight: 700; white-space: nowrap; }
.row .detail { padding: 4px 24px 28px; display: grid; grid-template-columns: 1fr minmax(260px, 380px);
               gap: 8px 48px; align-items: center; }
.row .detail .ribbon { margin-top: 28px; }
.empty { color: var(--ink-2); font-weight: 400; }

[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header and tabs */
.bar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--page) 88%, transparent);
       backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.bar-in { max-width: 1180px; margin: 0 auto; padding: 12px 24px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
         font-weight: 800; font-size: 20px; font-stretch: 85%; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 28px; height: 28px; flex: none; }
.brand small { display: block; font-size: 12px; font-weight: 400; font-stretch: 100%; color: var(--ink-2);
               letter-spacing: 0; line-height: 1.1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 16px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-weight: 600;
          font-size: 16px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 7%, transparent); }
.tabs a[aria-selected="true"] { background: var(--ink); color: var(--page); }
.live { margin-left: auto; text-align: right; font-size: 14px; color: var(--ink-2); line-height: 1.25; white-space: nowrap; }
.live b { color: var(--ink); font-weight: 600; }
.live.offline span { color: var(--down); font-weight: 600; }

.panel { padding-top: 28px; }
.h2 { font-size: 28px; font-weight: 800; font-stretch: 85%; margin: 44px 0 16px; letter-spacing: -0.01em; }
.h2 span { font-size: 16px; font-weight: 400; font-stretch: 100%; color: var(--ink-2); letter-spacing: 0; margin-left: 10px; }
.panel > .hero:first-child { padding-top: 8px; }
.empty-note { padding: 28px 24px; background: var(--panel); border-radius: 18px; color: var(--ink-2); }

/* info cards: one sheet, hairline cells */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line);
         border-radius: 18px; overflow: hidden; }
.card { background: var(--panel); padding: 22px 24px 20px; display: flex; flex-direction: column; gap: 2px; }
.card-label { font-size: 15px; color: var(--ink-2); }
.card-value { font-size: 46px; font-weight: 800; font-stretch: 75%; line-height: 1.05; letter-spacing: -0.01em; }
.card:first-child .card-value { color: var(--lula); }
.card-value.up { color: var(--up); } .card-value.down { color: var(--down); }
.card-note { font-size: 14px; color: var(--ink-2); }

/* states tab */
.states-top { display: grid; grid-template-columns: minmax(300px, 500px) 1fr; gap: 24px 56px; align-items: center; }
.tilemap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.tile { aspect-ratio: 1; border-radius: 12px; display: flex; flex-direction: column; align-items: center;
        justify-content: center; font-stretch: 75%; line-height: 1.1; background: var(--panel); }
.tile b { font-weight: 800; font-size: 20px; }
.tile span { font-size: 14px; font-weight: 600; }
.tile.up { background: color-mix(in srgb, var(--up) calc(var(--k) * 65%), var(--panel)); }
.tile.down { background: color-mix(in srgb, var(--down) calc(var(--k) * 65%), var(--panel)); }
.tile.wait { background: transparent; border: 1.5px dashed var(--line); color: var(--ink-2); }
.states-note p { font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; line-height: 1.2; max-width: 24ch; }
.legend { margin-top: 22px; max-width: 340px; font-size: 14px; color: var(--ink-2); }
.legend i { display: block; height: 10px; border-radius: 5px; margin-bottom: 6px;
            background: linear-gradient(90deg, var(--down), var(--panel) 50%, var(--up)); }
.legend span { display: flex; justify-content: space-between; }

/* detailed tables */
.tablewrap { background: var(--panel); border-radius: 18px; overflow-x: auto; }
table.detail { width: 100%; border-collapse: collapse; font-size: 16px; }
.detail th { padding: 14px 12px; text-align: left; font-weight: 400; font-size: 14px; color: var(--ink-2);
             border-bottom: 1px solid var(--line); white-space: nowrap; }
.detail th button { all: unset; cursor: pointer; }
.detail th button:focus-visible { outline: 3px solid var(--lula); outline-offset: 3px; }
.detail th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 11px; }
.detail th[aria-sort="descending"] button::after { content: " ▼"; font-size: 11px; }
.detail td { padding: 12px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.detail tr:last-child td { border-bottom: 0; }
.detail tbody tr:hover { background: color-mix(in srgb, var(--ink) 4%, transparent); }
.detail .local { font-weight: 700; font-size: 17px; white-space: normal; min-width: 170px; }
.detail .local span { color: var(--ink-2); font-weight: 400; font-size: 13px; margin-left: 6px; }
.detail .n { font-stretch: 75%; font-weight: 800; font-size: 24px; }
.detail .n.lula { color: var(--lula); } .detail .n.rival { color: var(--blue); }
.detail .n.old { color: var(--ink-2); font-weight: 600; }
.detail .n.quiet { font-size: 18px; font-weight: 600; color: var(--ink-2); }
.detail .delta { min-width: 130px; }
.detail .prog .state { display: flex; color: var(--ink); }
.detail .prog { min-width: 124px; font-size: 14px; color: var(--ink-2); }
.detail .prog .bar { height: 5px; border-radius: 3px; background: var(--line); margin-top: 6px; }
.detail .prog .bar i { display: block; height: 100%; border-radius: 3px; background: var(--ink); }
.toolbar { display: flex; align-items: center; gap: 16px; margin: 44px 0 16px; flex-wrap: wrap; }
.toolbar .h2 { margin: 0; }
.panel > .toolbar:first-child { margin-top: 0; }
.toolbar input { margin-left: auto; font: inherit; padding: 10px 16px; border-radius: 999px; min-width: 260px;
                 border: 1.5px solid var(--line); background: var(--panel); color: var(--ink); }
.toolbar input:focus-visible { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--lula) 40%, transparent); }
.more { margin-top: 14px; color: var(--ink-2); font-size: 15px; }

.foot { max-width: 1180px; margin: 0 auto; padding: 0 24px 40px; color: var(--ink-2); font-size: 14px; }
.foot p { max-width: 74ch; }
.nocmp { margin-top: 12px; max-width: 74ch; font-size: 14px; color: var(--ink-2); }
.nocmp summary { cursor: pointer; }
.nocmp p { margin: 8px 0 4px; }
.nocmp ul { list-style: none; padding: 0; columns: 2 220px; }
.nocmp li span { color: var(--ink-2); opacity: .8; font-size: 12px; margin-left: 4px; }

@media (max-width: 860px) {
  .foot { padding: 0 16px 32px; }
  .bar-in { flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px; }
  .tabs { order: 3; width: 100%; }
  .live { font-size: 13px; }
  .hero-grid, .states-top { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card-value { font-size: 38px; }
  .cols { display: none; }
  .row > summary { grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px 14px; padding: 16px; }
  .row .prog { grid-column: 1 / 4; grid-row: 2; }
  .row .delta { grid-column: 1 / 4; }
  .row .num { font-size: 32px; }
  .row .detail { grid-template-columns: 1fr; padding: 4px 16px 24px; }
  main { padding: 8px 16px 48px; }
  .toolbar input { margin-left: 0; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { .seg, .fill { transition: none !important; } }
