:root {
  /* Identidade Comab (tirada de comabimobiliaria.com.br). Navy e vermelho são cores de INTERFACE, nunca de candidato. */
  --comab-navy: #1F2D5C;
  --comab-red: #D32027;
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-2: #F2EFE8;
  --line: #E8E6E1;
  --line-2: #C8C5BD;
  --ink: #0A0A0A;
  --ink-2: #4A4A4A;
  --muted: #8A8A8A;
  --warn-bg: #FFF6DB;
  --warn-ink: #6B5200;
  --radius: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 400 15px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: Fraunces, Georgia, serif; font-weight: 600; letter-spacing: -0.01em; margin: 0; color: var(--comab-navy); }
a { color: inherit; }
.num { font-variant-numeric: tabular-nums; }

.top { display: flex; align-items: center; gap: 16px; padding: 10px 16px; background: var(--surface); border-bottom: 3px solid var(--comab-red); position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 8px rgba(31, 45, 92, .06); }
.brand img { display: block; height: 48px; width: auto; }
.top-title { flex: 1; min-width: 0; border-left: 1px solid var(--line); padding-left: 16px; }
.top-title h1 { font-size: 20px; line-height: 1.2; }
.times { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); margin-top: 3px; align-items: center; }
.times b { color: var(--ink); font-weight: 600; }
.site-link { font-size: 13px; font-weight: 600; color: var(--comab-navy); text-decoration: none; white-space: nowrap; border: 1px solid var(--line-2); padding: 6px 12px; border-radius: 99px; }
.site-link:hover { border-color: var(--comab-navy); }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 99px; background: var(--comab-navy); color: #fff; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.pill.live { background: var(--comab-red); }
.pill.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.notice { margin: 10px 16px 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-bg); color: var(--warn-ink); font-size: 13px; }
.notice.demo { background: #EDE7F6; color: #3A2350; font-weight: 600; text-align: center; letter-spacing: .03em; }

.tabs { display: flex; gap: 6px; padding: 14px 16px 0; max-width: 1180px; margin: 0 auto; }
.tabs button { flex: 1; max-width: 220px; padding: 10px 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 10px; font: 600 14px Inter, sans-serif; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--comab-navy); color: #fff; border-color: var(--comab-navy); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 16px 0; max-width: 1180px; margin: 0 auto; }
.chips button { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); font: 600 13px Inter, sans-serif; cursor: pointer; }
.chips button[aria-pressed="true"] { background: var(--comab-navy); color: #fff; border-color: var(--comab-navy); }

main { padding: 12px 16px 24px; display: grid; gap: 12px; max-width: 1180px; margin: 0 auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; box-shadow: 0 1px 2px rgba(10, 10, 10, .03); }
.card h2 { font-size: 17px; margin-bottom: 2px; }
.card .sub { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

.race-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.race-head h2 { font-size: 24px; }
.race-head .progress { font-size: 13px; color: var(--ink-2); font-weight: 600; }

.probbar { position: relative; display: flex; height: 40px; border-radius: 8px; overflow: hidden; background: var(--surface-2); margin: 6px 0; gap: 2px; }
.probbar > div { height: 100%; display: flex; align-items: center; padding: 0 10px; font-weight: 700; font-size: 15px; color: #fff; transition: width .6s ease; min-width: 0; white-space: nowrap; overflow: hidden; }
.probbar .b { justify-content: flex-end; }
.probbar .mid { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--surface); }
.problabels { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 10px; }

.cands { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.cand { border-radius: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-top: 5px solid var(--c); }
.cand .name { font-weight: 700; font-size: 16px; line-height: 1.2; color: var(--ink); }
.cand .party { color: var(--muted); font-size: 12px; }
.cand .duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.cand .metric { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; }
.cand .metric.prob { background: var(--c-soft); }
.cand .metric .l { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); font-weight: 600; }
.cand .metric .v { font: 700 30px/1.1 Inter, sans-serif; color: var(--ink); margin-top: 2px; }
.cand .metric .s { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.cand .foot2 { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }

.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.kpi { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; }
.kpi .l { color: var(--ink-2); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .v { font-weight: 700; font-size: 18px; }
.kpi .s { color: var(--ink-2); font-size: 12px; }
.kpi .v .s { display: block; font-weight: 500; font-size: 12px; color: var(--ink-2); margin-top: 2px; }

.decided { margin-top: 12px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--comab-navy); color: var(--comab-navy); font-weight: 600; background: #F4F6FB; }
.waiting { text-align: center; padding: 16px 12px 4px; }
.waiting h3 { font-size: 20px; margin-bottom: 6px; }
.waiting p { color: var(--ink-2); margin: 0; }

.grid2 { display: grid; gap: 12px; }
.chart { width: 100%; height: 280px; }
.chart.map { height: 380px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.stat .l { color: var(--ink-2); font-size: 12px; font-weight: 600; }
.stat .v { font-weight: 700; font-size: 20px; }
.stat .s { color: var(--ink-2); font-size: 12px; }

.tablewrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); }
th { color: var(--ink-2); font-weight: 600; font-size: 12px; cursor: pointer; user-select: none; }
th[aria-sort="ascending"]::after { content: " ▲"; }
th[aria-sort="descending"]::after { content: " ▼"; }
tr.flip td { background: #F4F6FB; }
tr.flip td:first-child { background: #EEF1F8; box-shadow: inset 3px 0 0 var(--comab-navy); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.flag { font-size: 10px; font-weight: 700; color: var(--comab-navy); margin-left: 4px; }
.more { margin-top: 8px; background: none; border: 1px solid var(--line-2); color: var(--ink-2); border-radius: 8px; padding: 6px 10px; cursor: pointer; font: 500 13px Inter, sans-serif; }
input.search { width: 100%; max-width: 280px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font: 14px Inter, sans-serif; margin-bottom: 8px; }

.foot { background: var(--comab-navy); padding: 22px 16px 32px; text-align: center; color: #D9DEEA; font-size: 13px; margin-top: 8px; }
.foot p { margin: 0 0 8px; }
.foot .method { color: #AEB6CC; font-size: 12px; max-width: 760px; margin: 0 auto 14px; }
.cta { display: inline-block; padding: 9px 16px; border-radius: 99px; background: #fff; color: var(--comab-navy); text-decoration: none; font-size: 13px; }
.cta b { color: var(--comab-red); }
.cta:hover { box-shadow: 0 0 0 2px var(--comab-red); }

@media (min-width: 760px) {
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .cand .metric .v { font-size: 38px; }
  .top-title h1 { font-size: 22px; }
}
@media (max-width: 640px) {
  /* No celular: % de votos em cima, chance de vitória embaixo. */
  .cand .duo { grid-template-columns: 1fr; gap: 6px; }
  .cand { padding: 10px; }
  .cand .metric .v { font-size: 26px; }
}
@media (max-width: 520px) {
  .top { position: static; padding: 8px 12px; gap: 8px 10px; flex-wrap: wrap; }
  .brand img { height: 40px; }
  .top-title { border-left: 0; padding-left: 0; flex-basis: 100%; order: 2; }
  .top-title h1 { font-size: 17px; }
  .times { font-size: 11px; gap: 2px 8px; }
  .site-link { margin-left: auto; }
  main { padding: 10px 12px 20px; }
  .tabs, .chips { padding-left: 12px; padding-right: 12px; }
  .notice { margin: 8px 12px 0; }
  .chart.map { height: 320px; }
  .probbar > div { font-size: 13px; padding: 0 6px; }
}
