/* ==========================================================================
   ELEIÇÕES 2026 — GEEKIKI
   Design system editorial · mobile-first · tema claro (padrão) e escuro
   ========================================================================== */

:root {
    --bg: #f2f4f9;
    --surface: #ffffff;
    --surface-2: #f6f8fc;
    --line: #e2e6f0;
    --line-strong: #cfd5e4;

    --text: #0d1324;
    --text-2: #475069;
    --muted: #7b869d;

    --accent: #2850ff;
    --accent-ink: #1636c9;
    --accent-soft: rgba(40, 80, 255, 0.09);
    --live: #e5322d;
    --ok: #0f9d58;
    --ok-soft: rgba(15, 157, 88, 0.1);
    --warn: #b77700;
    --warn-soft: rgba(224, 161, 0, 0.14);
    --danger-soft: rgba(229, 72, 77, 0.1);

    --ink: #0b1020;           /* barra superior */
    --map-empty: #dde2ee;
    --map-stroke: #ffffff;

    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-display: 'Outfit', 'Inter', system-ui, sans-serif;

    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 18px;
    --r-full: 999px;

    --shadow-sm: 0 1px 2px rgba(13, 19, 36, 0.05), 0 1px 1px rgba(13, 19, 36, 0.03);
    --shadow-md: 0 8px 24px -8px rgba(13, 19, 36, 0.14);
    --shadow-lg: 0 24px 60px -12px rgba(13, 19, 36, 0.35);

    --gutter: 14px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
    --bg: #080c15;
    --surface: #101727;
    --surface-2: #151e31;
    --line: #212b43;
    --line-strong: #2e3a58;

    --text: #eef1f9;
    --text-2: #a9b3c9;
    --muted: #7a859e;

    --accent: #7b93ff;
    --accent-ink: #a9b8ff;
    --accent-soft: rgba(123, 147, 255, 0.14);
    --ok: #3ddc97;
    --ok-soft: rgba(61, 220, 151, 0.12);
    --warn: #f2b632;
    --warn-soft: rgba(242, 182, 50, 0.13);
    --danger-soft: rgba(255, 107, 111, 0.12);

    --ink: #05080f;
    --map-empty: #1d2740;
    --map-stroke: #101727;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, 0.6);
}

@media (min-width: 768px) { :root { --gutter: 24px; } }

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--accent-ink); }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
img { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -0.01em; line-height: 1.2; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip-link {
    position: absolute; left: 12px; top: -48px; z-index: 999;
    background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--r-sm);
    font-weight: 600; text-decoration: none; transition: top 0.2s;
}
.skip-link:focus { top: 10px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }

/* --------------------------------------------------------------------------
   Barra superior
   -------------------------------------------------------------------------- */
.topbar {
    background: var(--ink);
    color: #fff;
    padding-top: env(safe-area-inset-top);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
}

.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; flex: none; }

.brand-mark {
    width: 30px; height: 30px; border-radius: 9px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #3b63ff 0%, #8b5cf6 100%);
    font: 800 17px/1 var(--font-display);
    box-shadow: 0 4px 14px -4px rgba(91, 99, 255, 0.7);
}

.brand-name { font: 700 18px/1 var(--font-display); letter-spacing: -0.02em; }

.topbar-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, 0.18); flex: none; }

.topbar-title { font: 500 16px/1 var(--font-display); color: rgba(255, 255, 255, 0.82); white-space: nowrap; }
.topbar-title strong { color: #fff; font-weight: 800; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.live-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 11px; border-radius: var(--r-full);
    background: rgba(255, 255, 255, 0.08);
    font-size: 11px; letter-spacing: 0.04em; white-space: nowrap;
}
.live-chip b { font-weight: 700; }
.live-chip small { display: none; color: rgba(255, 255, 255, 0.6); font-size: 11px; letter-spacing: 0; }

.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #ff4d49; box-shadow: 0 0 0 0 rgba(255, 77, 73, 0.7);
    animation: pulse 1.8s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 77, 73, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(255, 77, 73, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 77, 73, 0); }
}

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-width: 38px; height: 38px; padding: 0 9px;
    background: rgba(255, 255, 255, 0.08); color: #fff;
    border: 0; border-radius: var(--r-full);
    font-size: 13px; font-weight: 600;
    transition: background 0.2s;
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.16); }
.icon-btn svg { width: 18px; height: 18px; flex: none; }
.icon-btn--label span { display: none; }

[data-theme="light"] .i-sun, [data-theme="dark"] .i-moon { display: none; }

@media (min-width: 640px) {
    .live-chip small { display: inline; }
    .icon-btn--label { padding: 0 14px 0 11px; }
    .icon-btn--label span { display: inline; }
    .topbar-title { font-size: 18px; }
}

@media (max-width: 400px) {
    .brand-name { display: none; }
    .live-chip b { display: none; }
}

/* --------------------------------------------------------------------------
   Navegação (abas)
   -------------------------------------------------------------------------- */
.tabs {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(1.5) blur(14px);
    -webkit-backdrop-filter: saturate(1.5) blur(14px);
    border-bottom: 1px solid var(--line);
}

.tabs-scroll {
    display: flex; align-items: stretch; gap: 2px;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    margin: 0 calc(var(--gutter) * -1); padding: 0 calc(var(--gutter) - 8px);
    scroll-snap-type: x proximity;
}
.tabs-scroll::-webkit-scrollbar { display: none; }

.tab {
    position: relative; flex: none; scroll-snap-align: center;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 0 13px; height: 50px;
    background: none; border: 0;
    font-size: 13.5px; font-weight: 600; color: var(--text-2);
    white-space: nowrap; transition: color 0.2s;
}
.tab svg { width: 17px; height: 17px; opacity: 0.8; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active svg { opacity: 1; color: var(--accent); }
.tab.active::after {
    content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px;
    border-radius: 3px 3px 0 0; background: var(--accent);
    animation: tab-in 0.3s var(--ease);
}
@keyframes tab-in { from { transform: scaleX(0.3); opacity: 0; } to { transform: scaleX(1); opacity: 1; } }

.tab-sep { flex: none; width: 1px; margin: 14px 6px; background: var(--line-strong); }

/* --------------------------------------------------------------------------
   Painel de totalização
   -------------------------------------------------------------------------- */
.main { padding-top: 16px; padding-bottom: 8px; }

.summary {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 16px;
    box-shadow: var(--shadow-sm);
}

.summary-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }

.eyebrow { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); }

.summary-pct { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.summary-pct strong { font: 800 40px/1.05 var(--font-display); letter-spacing: -0.03em; }
.summary-pct span { color: var(--text-2); font-size: 14px; }

.status-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px; border-radius: var(--r-full);
    font-size: 12px; font-weight: 700; white-space: nowrap;
    background: var(--surface-2); color: var(--text-2);
}
.status-chip i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-chip.is-warn { background: var(--warn-soft); color: var(--warn); }
.status-chip.is-warn i { animation: blink 1.6s infinite; }
.status-chip.is-live { background: var(--danger-soft); color: var(--live); }
.status-chip.is-live i { animation: blink 1.2s infinite; }
.status-chip.is-ok { background: var(--ok-soft); color: var(--ok); }
@keyframes blink { 50% { opacity: 0.25; } }

.progress { height: 10px; margin: 14px 0 10px; background: var(--surface-2); border-radius: var(--r-full); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.progress-fill {
    height: 100%; border-radius: inherit; min-width: 0;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    transition: width 0.9s var(--ease);
}

.summary-meta { display: flex; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.summary-meta b { color: var(--text); font-weight: 600; }

.dist { margin: 16px 0 12px; }
.dist-bar {
    display: flex; height: 8px; border-radius: var(--r-full); overflow: hidden;
    background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line);
}
.dist-bar span { background: var(--c); width: 0; transition: width 0.9s var(--ease); }

.metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.metric {
    display: flex; flex-direction: column; gap: 2px;
    padding: 11px 12px; min-width: 0;
    background: var(--surface-2); border-radius: var(--r-md);
    border: 1px solid transparent;
}
.metric-label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-2); line-height: 1.25; }
.metric-label i { width: 8px; height: 8px; border-radius: 3px; background: var(--c); flex: none; }
.metric-value { font: 700 20px/1.2 var(--font-display); letter-spacing: -0.01em; overflow-wrap: anywhere; }
.metric-sub { font-size: 11px; color: var(--muted); }

@media (min-width: 640px) {
    .summary { padding: 22px 24px; }
    .summary-pct strong { font-size: 52px; }
    .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
    .metric-value { font-size: 22px; }
}

@media (min-width: 1024px) {
    .metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .metric-value { font-size: 19px; }
}

/* --------------------------------------------------------------------------
   Vista (área dinâmica)
   -------------------------------------------------------------------------- */
.view { margin-top: 22px; min-height: 420px; scroll-margin-top: 64px; }
.view.is-entering > * { animation: rise 0.45s var(--ease) both; }
.view.is-entering > *:nth-child(2) { animation-delay: 0.05s; }
.view.is-entering > *:nth-child(3) { animation-delay: 0.1s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.view-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.view-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.view-title h2 { font-size: 21px; font-weight: 700; }
.view-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }

@media (min-width: 640px) {
    .view-head { flex-direction: row; justify-content: space-between; align-items: center; }
    .view-title h2 { font-size: 24px; }
}

.loading, .empty {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    padding: 48px 16px; color: var(--muted); font-size: 14px; text-align: center;
    background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg);
}
.empty { flex-direction: column; }

.spinner {
    width: 18px; height: 18px; border-radius: 50%;
    border: 2px solid var(--line-strong); border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Selos de confiabilidade */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: var(--r-full);
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
    background: var(--accent-soft); color: var(--accent-ink);
}
.badge--official { background: var(--accent-soft); color: var(--accent-ink); }
.badge--estimate { background: var(--warn-soft); color: var(--warn); }
.badge--news { background: rgba(139, 92, 246, 0.12); color: #7c4ddb; }
[data-theme="dark"] .badge--news { color: #b79bff; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--plain { background: var(--surface-2); color: var(--text-2); }

/* Segmented control (filtros) */
.segmented {
    display: inline-flex; padding: 3px; gap: 2px; max-width: 100%;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-full);
    overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.seg-btn {
    flex: none; padding: 7px 14px; border: 0; background: transparent;
    border-radius: var(--r-full); font-size: 12.5px; font-weight: 600; color: var(--text-2);
    white-space: nowrap; transition: background 0.2s, color 0.2s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--text); color: var(--bg); }

/* Painéis */
.panel {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
    padding: 16px; min-width: 0;
}
.panel + .panel, .split + .panel { margin-top: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-head h3 { font-size: 17px; font-weight: 700; }
.panel-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.panel--flush { padding: 0; overflow: hidden; }

@media (min-width: 768px) { .panel { padding: 22px; } }

.split { display: grid; gap: 16px; }
@media (min-width: 1024px) {
    .split { grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr); align-items: start; }
    .split-side { position: sticky; top: 66px; }
}

/* Avisos */
.notice {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; border-radius: var(--r-md);
    background: var(--accent-soft); color: var(--text);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    margin-bottom: 12px;
}
.notice svg { width: 20px; height: 20px; flex: none; margin-top: 2px; color: var(--accent); }
.notice h3 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.notice p { font-size: 13px; color: var(--text-2); }
.notice.is-warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.notice.is-warn svg { color: var(--warn); }
.notice-count {
    display: inline-flex; align-items: center; gap: 8px; margin-top: 8px;
    padding: 5px 12px; border-radius: var(--r-full); background: var(--surface);
    font-size: 12px; color: var(--text-2); border: 1px solid var(--line);
}
.notice-count strong { font: 700 15px var(--font-display); color: var(--text); font-variant-numeric: tabular-nums; }

.winner {
    padding: 20px; margin-bottom: 14px; text-align: center; color: #fff;
    border-radius: var(--r-lg);
    background: linear-gradient(135deg, #0f9d58, #0b7a6e);
    box-shadow: var(--shadow-md);
}
.winner small { display: block; font-size: 11px; font-weight: 700; letter-spacing: 0.12em; opacity: 0.85; }
.winner h2 { font-size: 24px; margin: 4px 0; }
.winner p { font-size: 13.5px; opacity: 0.9; }

/* --------------------------------------------------------------------------
   Ranking de candidatos
   -------------------------------------------------------------------------- */
.rank-list { display: flex; flex-direction: column; gap: 0; }

.cand-row {
    --party: #64748b;
    position: relative;
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    transition: background 0.2s;
}
.cand-row:last-child { border-bottom: 0; }
.cand-row:hover { background: var(--surface-2); }

.cand-row.is-leader { background: color-mix(in srgb, var(--party) 7%, var(--surface)); }
.cand-row.is-leader::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--party);
}

.cand-avatar { position: relative; width: 52px; height: 52px; flex: none; }
.cand-row.is-leader .cand-avatar { width: 60px; height: 60px; }

.avatar {
    width: 100%; height: 100%; border-radius: 50%; object-fit: cover; object-position: top center;
    background: var(--party); border: 2px solid var(--surface); box-shadow: 0 0 0 2px var(--party);
}
.avatar--fallback { display: grid; place-items: center; color: #fff; font: 800 16px var(--font-display); }

.cand-pos {
    position: absolute; left: -4px; top: -4px; z-index: 1;
    width: 21px; height: 21px; border-radius: 50%;
    display: grid; place-items: center;
    background: var(--text); color: var(--bg); font: 700 11px var(--font-display);
    border: 2px solid var(--surface);
}

.cand-main { min-width: 0; }
.cand-name { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.cand-name h3 { font: 700 15.5px/1.2 var(--font-display); overflow-wrap: anywhere; }
.cand-row.is-leader .cand-name h3 { font-size: 17px; }

.party-tag {
    display: inline-block; padding: 2px 7px; border-radius: 6px;
    background: var(--party); color: #fff;
    font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; white-space: nowrap;
}
.cand-sub { font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }

.cand-bar { height: 6px; margin-top: 8px; background: var(--line); border-radius: var(--r-full); overflow: hidden; }
.cand-bar span { display: block; height: 100%; width: 0; background: var(--party); border-radius: inherit; transition: width 0.9s var(--ease); }

.cand-score { text-align: right; line-height: 1.15; }
.cand-score strong { display: block; font: 800 21px/1.1 var(--font-display); letter-spacing: -0.02em; }
.cand-row.is-leader .cand-score strong { font-size: 25px; }
.cand-score small { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.cand-row.is-idle .cand-score strong { color: var(--muted); }

.cand-extra { grid-column: 2 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: -2px; }
.lead-diff { font-size: 12px; color: var(--text-2); }
.lead-diff b { color: var(--accent-ink); }

/* Compacto (legislativo) */
.cand-row--compact { grid-template-columns: 28px minmax(0, 1fr) auto; padding: 11px 14px; gap: 10px; }
.cand-row--compact .cand-rankno { font: 700 13px var(--font-display); color: var(--muted); text-align: center; }
.cand-row--compact .cand-name h3 { font-size: 14.5px; }
.cand-row--compact .cand-score strong { font-size: 17px; }
.cand-row.is-elected .cand-rankno { color: var(--ok); }

@media (min-width: 640px) {
    .cand-row { padding: 14px 18px; gap: 16px; }
    .cand-avatar { width: 58px; height: 58px; }
    .cand-row.is-leader .cand-avatar { width: 68px; height: 68px; }
}

/* --------------------------------------------------------------------------
   Mapa
   -------------------------------------------------------------------------- */
.map-wrap { position: relative; display: flex; justify-content: center; align-items: center; min-height: 260px; }
.brazil-svg-map { width: 100%; max-width: 520px; height: auto; }

.state-path {
    fill: var(--map-empty);
    stroke: var(--map-stroke); stroke-width: 1.4px; stroke-linejoin: round;
    cursor: pointer; transition: fill 0.3s, opacity 0.3s, stroke 0.2s;
}
.state-path:hover, .state-path:focus { stroke: var(--text); stroke-width: 2px; opacity: 1 !important; }

.map-tooltip {
    position: absolute; z-index: 20; pointer-events: none; min-width: 210px; max-width: 260px;
    padding: 12px 14px; border-radius: var(--r-md);
    background: var(--ink); color: #fff; box-shadow: var(--shadow-lg);
    opacity: 0; transform: translate(-50%, -110%); transition: opacity 0.15s;
    font-size: 12px;
}
.map-tooltip.visible { opacity: 1; }
.tt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.14); }
.tt-head strong { font: 700 14px var(--font-display); }
.tt-pill { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-full); background: rgba(255, 255, 255, 0.14); white-space: nowrap; }
.tt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tt-row i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tt-row span { flex: 1; min-width: 0; }
.tt-row b { font-variant-numeric: tabular-nums; }
.tt-dim { color: rgba(255, 255, 255, 0.62); }
.tt-foot { margin-top: 8px; padding-top: 7px; border-top: 1px dashed rgba(255, 255, 255, 0.18); font-size: 11px; color: rgba(255, 255, 255, 0.7); }

.chips { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.chip i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

/* --------------------------------------------------------------------------
   Evolução da apuração (slider)
   -------------------------------------------------------------------------- */
.slider-actions { display: flex; gap: 6px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 14px; border-radius: var(--r-full);
    background: var(--surface-2); border: 1px solid var(--line); color: var(--text);
    font-size: 12.5px; font-weight: 600; transition: background 0.2s, border-color 0.2s;
}
.btn:hover { border-color: var(--line-strong); background: var(--surface); }
.btn.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn svg { width: 14px; height: 14px; }

.slider-row { display: flex; align-items: center; gap: 12px; margin: 6px 0 14px; }
.slider-time { font: 700 17px var(--font-display); min-width: 52px; color: var(--accent-ink); }
.slider-pct { font-size: 12px; color: var(--muted); min-width: 90px; text-align: right; }

.time-range-input {
    flex: 1; -webkit-appearance: none; appearance: none; height: 6px; border-radius: var(--r-full);
    background: var(--line); outline: none; cursor: pointer; touch-action: pan-y;
}
.time-range-input::-webkit-slider-thumb {
    -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
    background: var(--accent); border: 4px solid var(--surface); box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}
.time-range-input::-moz-range-thumb {
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--accent); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--accent);
}

.snap-card { background: var(--surface-2); border-radius: var(--r-md); padding: 14px; }
.snap-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.snap-line + .cand-bar { margin-bottom: 14px; }
.snap-who { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; min-width: 0; }
.snap-who i { width: 11px; height: 11px; border-radius: 50%; flex: none; background: var(--party); }
.snap-pct { font: 700 20px var(--font-display); }
.snap-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Estados
   -------------------------------------------------------------------------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
@media (min-width: 640px) { .toolbar { width: auto; } }

.field, .select {
    height: 40px; padding: 0 14px; min-width: 0;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--line-strong); border-radius: var(--r-full);
    font: 500 14px var(--font-body); outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.field:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select { padding-right: 34px; -webkit-appearance: none; appearance: none; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%237b869d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 14px center; }
.toolbar .field { flex: 1 1 160px; }
.toolbar .select { flex: 1 1 140px; }

.states-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 640px) { .states-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (min-width: 1024px) { .states-grid { grid-template-columns: repeat(3, 1fr); } }

.state-card {
    --party: var(--line-strong);
    display: block; width: 100%; text-align: left;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 14px; transition: transform 0.2s var(--ease), box-shadow 0.2s, border-color 0.2s;
}
.state-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.state-top { display: flex; align-items: center; gap: 12px; }
.state-uf {
    width: 44px; height: 44px; border-radius: 12px; flex: none;
    display: grid; place-items: center;
    background: var(--surface-2); color: var(--text);
    font: 800 15px var(--font-display); border: 1px solid var(--line);
}
.state-name { font: 700 15.5px var(--font-display); }
.state-region { font-size: 12px; color: var(--muted); }
.state-top .badge { margin-left: auto; }
.state-lead {
    display: flex; justify-content: space-between; align-items: center; gap: 10px;
    margin-top: 12px; padding: 9px 12px; border-radius: var(--r-sm);
    background: var(--surface-2); border-left: 4px solid var(--party);
    font-size: 13px; font-weight: 600;
}
.state-lead small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.state-lead b { font: 700 16px var(--font-display); }
.state-idle { margin-top: 12px; font-size: 12.5px; color: var(--muted); padding: 9px 12px; border-radius: var(--r-sm); background: var(--surface-2); }

/* --------------------------------------------------------------------------
   Notícias
   -------------------------------------------------------------------------- */
.news-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 640px) { .news-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; } }
@media (min-width: 1024px) { .news-grid { grid-template-columns: repeat(3, 1fr); gap: 20px; } }

.news-card {
    display: flex; flex-direction: column; overflow: hidden;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
    transition: transform 0.25s var(--ease), box-shadow 0.25s;
}
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.news-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--surface-2); }
.news-content { display: flex; flex-direction: column; flex: 1; padding: 14px 16px 16px; }
.news-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 11.5px; color: var(--muted); }
.news-title { font: 700 16px/1.3 var(--font-display); margin-bottom: 8px; }
.news-summary { font-size: 13.5px; color: var(--text-2); margin-bottom: 14px; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.news-link { font-size: 13px; font-weight: 600; text-decoration: none; color: var(--accent-ink); }
.news-link:hover { text-decoration: underline; }

@media (min-width: 1024px) {
    .news-card.featured { grid-column: span 2; flex-direction: row; }
    .news-card.featured .news-thumb { width: 52%; aspect-ratio: auto; height: auto; min-height: 100%; }
    .news-card.featured .news-title { font-size: 21px; }
    .news-card.featured .news-content { padding: 22px; justify-content: center; }
    .news-card.featured .news-summary { -webkit-line-clamp: 6; }
}

/* --------------------------------------------------------------------------
   Pesquisas e boca de urna
   -------------------------------------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 14px; }
.card-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 768px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }

.poll-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.poll-head h3 { font-size: 17px; font-weight: 700; }
.poll-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.poll-meta b { color: var(--text-2); font-weight: 600; }

.bar-row + .bar-row { margin-top: 12px; }
.bar-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 5px; font-size: 13.5px; }
.bar-row-top strong { font-weight: 600; }
.bar-row-top span { font: 700 14px var(--font-display); color: var(--warn); white-space: nowrap; }
.bar-row-top small { font: 500 11px var(--font-body); color: var(--muted); margin-left: 4px; }
.bar-track { height: 8px; border-radius: var(--r-full); background: var(--line); overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: #e0a100; transition: width 0.9s var(--ease); }
.poll-method { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }

.lock-box { background: var(--surface-2); border-radius: var(--r-md); padding: 14px; }
.lock-box strong { display: block; font-size: 13px; color: var(--warn); margin-bottom: 6px; }
.lock-box p { font-size: 12.5px; color: var(--text-2); margin-bottom: 10px; }

.est-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); }
.est-row + .est-row { margin-top: 8px; }
.est-row strong { font-size: 14px; font-weight: 600; }

/* --------------------------------------------------------------------------
   Linha do tempo
   -------------------------------------------------------------------------- */
.tl { position: relative; max-width: 760px; margin: 0 auto; padding-left: 4px; }
.tl::before { content: ""; position: absolute; left: 76px; top: 8px; bottom: 8px; width: 2px; background: var(--line-strong); }
.tl-item { position: relative; display: grid; grid-template-columns: 56px 1fr; gap: 0 36px; padding-bottom: 16px; }
.tl-time { font: 700 14px var(--font-display); color: var(--accent-ink); text-align: right; padding-top: 14px; }
.tl-dot {
    position: absolute; left: 70px; top: 18px; width: 14px; height: 14px; border-radius: 50%;
    background: var(--surface); border: 3px solid var(--accent);
}
.tl-item.is-milestone .tl-dot { border-color: var(--ok); }
.tl-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 13px 15px; }
.tl-card strong { display: block; font: 700 15px var(--font-display); margin-bottom: 3px; }
.tl-card p { font-size: 13px; color: var(--text-2); }

/* --------------------------------------------------------------------------
   Exterior
   -------------------------------------------------------------------------- */
.hero-note {
    display: flex; flex-direction: column; gap: 14px; margin-bottom: 16px;
    padding: 16px; border-radius: var(--r-lg);
    background: linear-gradient(135deg, var(--accent-soft), rgba(139, 92, 246, 0.1));
    border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
}
.hero-note h3 { font-size: 18px; margin: 6px 0; }
.hero-note p { font-size: 13px; color: var(--text-2); max-width: 720px; }
.hero-stats { display: flex; gap: 18px; padding: 12px 16px; background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--line); align-self: flex-start; }
.hero-stats small { display: block; font-size: 11px; color: var(--muted); }
.hero-stats strong { font: 700 19px var(--font-display); }
.hero-stats div + div { padding-left: 18px; border-left: 1px solid var(--line); }
@media (min-width: 768px) { .hero-note { flex-direction: row; align-items: center; justify-content: space-between; padding: 22px; } }

.country-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .country-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; } }
@media (min-width: 1024px) { .country-grid { grid-template-columns: repeat(3, 1fr); } }

.country-card {
    --party: var(--line-strong);
    display: block; width: 100%; text-align: left;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 14px; transition: transform 0.2s var(--ease), box-shadow 0.2s;
}
.country-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.country-top { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.country-flag { font-size: 30px; line-height: 1; }
.country-top strong { display: block; font: 700 16px var(--font-display); }
.country-top small { font-size: 12px; color: var(--muted); }
.country-top .badge { margin-left: auto; }
.country-lead { padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); border-left: 4px solid var(--party); }
.country-lead small { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.country-lead div { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 600; font-size: 14px; }
.country-lead b { font: 700 18px var(--font-display); color: var(--accent-ink); }
.country-foot { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.country-foot span:last-child { color: var(--accent-ink); font-weight: 600; }

/* --------------------------------------------------------------------------
   Modal (bottom sheet no mobile, diálogo no desktop)
   -------------------------------------------------------------------------- */
.modal {
    position: fixed; inset: 0; z-index: 200;
    display: flex; align-items: flex-end; justify-content: center;
    background: rgba(5, 8, 16, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.modal.active { opacity: 1; pointer-events: auto; }

.modal-sheet {
    width: 100%; max-height: 90dvh; overflow-y: auto; overscroll-behavior: contain;
    background: var(--surface); color: var(--text);
    border-radius: 22px 22px 0 0; padding: 8px 18px calc(22px + env(safe-area-inset-bottom));
    transform: translateY(100%); transition: transform 0.35s var(--ease);
    box-shadow: var(--shadow-lg);
}
.modal.active .modal-sheet { transform: none; }
.modal-grabber { width: 38px; height: 4px; border-radius: 4px; background: var(--line-strong); margin: 4px auto 12px; }

.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { font-size: 20px; font-weight: 700; margin-top: 6px; }
.modal-close {
    flex: none; width: 36px; height: 36px; border-radius: 50%; border: 0;
    background: var(--surface-2); color: var(--text-2); display: grid; place-items: center;
}
.modal-close svg { width: 18px; height: 18px; }
.modal-close:hover { color: var(--text); background: var(--line); }

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-bottom: 18px; }
.kv-grid div { padding: 11px 12px; background: var(--surface-2); border-radius: var(--r-sm); }
.kv-grid small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.kv-grid strong { font: 700 16px var(--font-display); }

.modal-section { margin-bottom: 18px; }
.modal-section h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 8px; font-family: var(--font-body); font-weight: 700; }
.modal-line {
    --party: var(--line-strong);
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); border-left: 4px solid var(--party);
}
.modal-line + .modal-line { margin-top: 6px; }
.modal-line b { font: 700 15px var(--font-display); white-space: nowrap; }
.modal-line small { display: block; color: var(--muted); font-size: 11.5px; }
.modal-note { font-size: 12px; color: var(--muted); padding: 11px 13px; background: var(--surface-2); border-radius: var(--r-sm); }

.source-list { display: grid; gap: 8px; font-size: 13px; }
.source-list div { padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); overflow-wrap: anywhere; }
.source-list small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 1px; }
.source-list code { font: 500 12px ui-monospace, 'SF Mono', Consolas, monospace; }

@media (min-width: 768px) {
    .modal { align-items: center; padding: 24px; }
    .modal-sheet { max-width: 680px; border-radius: var(--r-lg); padding: 24px 28px 28px; transform: translateY(20px) scale(0.98); }
    .modal.active .modal-sheet { transform: none; }
    .modal-grabber { display: none; }
}

/* --------------------------------------------------------------------------
   Rodapé
   -------------------------------------------------------------------------- */
.footer { margin-top: 48px; padding: 28px 0 36px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.footer-inner p + p { margin-top: 6px; }
.footer a { color: var(--text-2); font-weight: 600; text-decoration: none; }
.footer a:hover { color: var(--text); text-decoration: underline; }

/* --------------------------------------------------------------------------
   Acessibilidade
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* --------------------------------------------------------------------------
   Link para o Modo Live / Estúdio na Topbar
   -------------------------------------------------------------------------- */
.live-studio-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15), rgba(220, 38, 38, 0.25));
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #ff6b6b;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 11px;
    border-radius: var(--r-full);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.2);
}
.live-studio-link:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 18px rgba(239, 68, 68, 0.5);
    transform: translateY(-1px);
}
.live-cam-icon {
    font-size: 10px;
    animation: liveCamPulse 1.2s infinite ease-in-out;
}
@keyframes liveCamPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(1.2); }
}
