/* ============================================================
   DIREITA NAS AMÉRICAS — Design System v2.0
   Paleta: Azul náutico escuro · Ouro · Vermelho · Verde
   ============================================================ */

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Cores principais */
    --bg-deep:      #04080f;
    --bg-base:      #07101e;
    --bg-surface:   #0d1b2e;
    --bg-card:      #0f2035;
    --bg-elevated:  #142640;

    /* Azul (direita / brand) */
    --blue-dim:     #1e3a5f;
    --blue-mid:     #1d4ed8;
    --blue-vivid:   #3b82f6;
    --blue-light:   #60a5fa;
    --blue-pale:    #bfdbfe;

    /* Ouro (destaque / CTA) */
    --gold-deep:    #92400e;
    --gold-base:    #d97706;
    --gold-vivid:   #f59e0b;
    --gold-light:   #fcd34d;

    /* Vermelho (esquerda) */
    --red-deep:     #7f1d1d;
    --red-base:     #b91c1c;
    --red-vivid:    #ef4444;
    --red-light:    #fca5a5;

    /* Verde (transicao) */
    --green-deep:   #064e3b;
    --green-base:   #059669;
    --green-vivid:  #10b981;
    --green-light:  #6ee7b7;

    /* Ambar (eleicoes proximas) */
    --amber-base:   #d97706;
    --amber-vivid:  #f59e0b;
    --amber-light:  #fde68a;

    /* Texto */
    --text-primary:   #f0f4ff;
    --text-secondary: rgba(220, 235, 255, 0.7);
    --text-muted:     rgba(160, 190, 230, 0.5);

    /* Bordas / divisores */
    --border-subtle:  rgba(100, 160, 240, 0.12);
    --border-default: rgba(100, 160, 240, 0.22);
    --border-bright:  rgba(100, 160, 240, 0.45);

    /* Glassmorphism */
    --glass-bg:    rgba(7, 16, 30, 0.85);
    --glass-blur:  blur(20px) saturate(180%);

    /* Sombras */
    --shadow-sm:  0 2px 8px rgba(0,0,0,.45);
    --shadow-md:  0 6px 24px rgba(0,0,0,.55);
    --shadow-lg:  0 12px 48px rgba(0,0,0,.65);
    --shadow-blue: 0 0 30px rgba(59, 130, 246, .2);

    /* Raios */
    --r-sm:  8px;
    --r-md:  14px;
    --r-lg:  20px;
    --r-xl:  28px;
    --r-pill: 999px;

    /* Transicoes */
    --t-fast:   0.15s ease;
    --t-mid:    0.25s cubic-bezier(.4,0,.2,1);
    --t-slow:   0.4s cubic-bezier(.4,0,.2,1);
}

html, body {
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Header ────────────────────────────────────────────────── */
header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: clamp(8px, 1.6vw, 14px) clamp(14px, 3vw, 32px);
    background: linear-gradient(180deg,
        rgba(4, 8, 15, 0.96) 0%,
        rgba(7, 16, 30, 0.92) 100%);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid var(--border-default);
    box-shadow: 0 1px 0 rgba(100,160,240,.08), var(--shadow-sm);
    position: relative;
    z-index: 200000;
}

header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--blue-mid) 20%,
        var(--gold-vivid) 50%,
        var(--blue-mid) 80%,
        transparent 100%);
    opacity: .7;
}

.header-brand {
    flex: 1;
    text-align: center;
    min-width: 0;
}

header h1 {
    font-size: clamp(.95rem, 2.6vw, 1.65rem);
    margin: 0 0 1px;
    background: linear-gradient(135deg,
        #fff 0%,
        var(--blue-pale) 35%,
        var(--gold-light) 65%,
        #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: .5px;
    white-space: nowrap;
    line-height: 1.15;
}

header h5 {
    font-size: clamp(.45rem, 1vw, .6rem);
    color: var(--gold-vivid);
    font-weight: 600;
    margin: 0;
    letter-spacing: 2px;
    text-transform: uppercase;
    opacity: .9;
}

header .subtitle {
    font-size: clamp(.48rem, 1.1vw, .64rem);
    color: var(--text-muted);
    font-weight: 400;
    margin: 2px 0 0;
    letter-spacing: .5px;
}

/* ── Nav ───────────────────────────────────────────────────── */
.top-nav {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    justify-content: flex-end;
    flex-shrink: 0;
    max-width: 58vw;
}

.top-nav a {
    color: var(--blue-light);
    text-decoration: none;
    font-size: .82rem;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: var(--r-pill);
    border: 1px solid rgba(59, 130, 246, .2);
    background: rgba(15, 32, 53, .5);
    transition: all var(--t-mid);
    white-space: nowrap;
    letter-spacing: .2px;
}

.top-nav a:hover {
    background: rgba(59, 130, 246, .18);
    border-color: rgba(59, 130, 246, .55);
    color: #fff;
    box-shadow: 0 4px 18px rgba(59, 130, 246, .2);
    transform: translateY(-1px);
}

.top-nav a:focus-visible {
    outline: 2px solid var(--blue-vivid);
    outline-offset: 2px;
}

.top-nav a.nav-loja {
    color: #fff;
    background: linear-gradient(135deg, rgba(185,28,28,.75), rgba(127,13,13,.6));
    border-color: rgba(239,68,68,.45);
    font-weight: 700;
}

.top-nav a.nav-loja:hover {
    background: linear-gradient(135deg, rgba(220,38,38,.9), rgba(153,27,27,.85));
    border-color: rgba(239,68,68,.8);
    box-shadow: 0 6px 22px rgba(220,38,38,.35);
}

/* ── Seletor de idioma ────────────────────────────────────── */
.lang-selector {
    position: relative;
    flex-shrink: 0;
    z-index: 200;
}

.lang-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(13, 27, 46, .75);
    border: 1px solid var(--border-default);
    border-radius: var(--r-pill);
    color: var(--blue-pale);
    font-size: .75rem;
    font-weight: 700;
    padding: 5px 11px;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast);
    letter-spacing: .5px;
    white-space: nowrap;
    font-family: inherit;
}

.lang-btn:hover {
    background: rgba(59, 130, 246, .16);
    border-color: var(--border-bright);
}

.lang-dropdown {
    display: none;
    flex-direction: column;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    background: rgba(7, 16, 30, .97);
    border: 1px solid var(--border-default);
    border-radius: var(--r-md);
    overflow: hidden;
    min-width: 140px;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.lang-dropdown.open { display: flex; }

.lang-option {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: .8rem;
    font-family: inherit;
    padding: 10px 15px;
    text-align: left;
    cursor: pointer;
    transition: background var(--t-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.lang-option:hover {
    background: rgba(59, 130, 246, .13);
    color: #fff;
}

.lang-option.active {
    color: var(--blue-light);
    font-weight: 700;
}

.lang-flag {
    width: 18px;
    height: 13px;
    object-fit: cover;
    border-radius: 2px;
    vertical-align: middle;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Stats Bar ─────────────────────────────────────────────── */
.stats-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: clamp(10px, 2vw, 18px);
    padding: clamp(5px, .8vw, 9px) clamp(12px, 5vw, 32px);
    background: linear-gradient(180deg,
        rgba(4, 8, 15, .85) 0%,
        rgba(7, 16, 30, .7) 100%);
    border-bottom: 1px solid var(--border-subtle);
    position: relative;
    overflow: hidden;
}

.flags-carousel {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    display: flex;
    align-items: center;
}

.flags-track {
    display: flex;
    gap: 32px;
    animation: scroll-flags 70s linear infinite;
    position: absolute;
    white-space: nowrap;
    align-items: center;
}

@keyframes scroll-flags {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.flag-svg {
    height: 32px;
    width: auto;
    opacity: .08;
    display: inline-block;
    border-radius: 3px;
}

.stats-group,
.search-container {
    position: relative;
    z-index: 1;
}

.stats-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(14px, 4vw, 36px);
    flex-wrap: wrap;
    grid-column: 2;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(.7rem, 2.2vw, .88rem);
    letter-spacing: .1px;
}

.stat-color {
    width: 13px;
    height: 13px;
    border-radius: 4px;
    flex-shrink: 0;
}

.stat-color.green  { background: linear-gradient(135deg, var(--green-base), var(--green-vivid)); }
.stat-color.red    { background: linear-gradient(135deg, var(--red-base), var(--red-vivid)); }
.stat-color.blue   { background: linear-gradient(135deg, var(--blue-mid), var(--blue-vivid)); }
.stat-color.yellow { background: linear-gradient(135deg, var(--amber-base), var(--amber-vivid)); }

.stat-count {
    font-weight: 800;
    font-size: clamp(.95rem, 2.8vw, 1.25rem);
    color: #fff;
    min-width: 1.6ch;
    line-height: 1;
}

.search-container {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 7px;
    align-items: center;
    grid-column: 3;
    justify-self: end;
    max-width: 380px;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 8px 13px;
    border-radius: var(--r-pill);
    border: 1px solid var(--border-default);
    background: rgba(13, 27, 46, .75);
    color: var(--text-primary);
    outline: none;
    font-size: .85rem;
    font-family: inherit;
    transition: border-color var(--t-mid), box-shadow var(--t-mid), background var(--t-mid);
}

.search-input::-webkit-calendar-picker-indicator {
    filter: invert(1) opacity(.4);
}

.search-input::placeholder { color: var(--text-muted); }

.search-input:focus {
    border-color: var(--blue-vivid);
    background: rgba(13, 27, 46, .95);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.search-btn {
    padding: 8px 18px;
    border-radius: var(--r-pill);
    border: 1px solid rgba(59, 130, 246, .35);
    background: linear-gradient(135deg, rgba(29,78,216,.55), rgba(59,130,246,.4));
    color: #fff;
    font-weight: 700;
    font-size: .82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--t-mid);
    letter-spacing: .2px;
    white-space: nowrap;
}

.search-btn:hover {
    background: linear-gradient(135deg, rgba(29,78,216,.8), rgba(59,130,246,.65));
    border-color: rgba(59, 130, 246, .65);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, .25);
}

.search-hint {
    grid-column: 1 / -1;
    font-size: .8rem;
    color: var(--text-muted);
    min-height: 1.1em;
    display: none;
    padding: 0 4px;
}

/* ── Mapa ──────────────────────────────────────────────────── */
#map {
    width: 100%;
    flex: 1;
    background: linear-gradient(180deg, #020912 0%, #04101f 100%);
    position: relative;
}

.leaflet-container {
    background: linear-gradient(180deg, #020912 0%, #04101f 100%);
}

.leaflet-interactive:hover {
    filter: brightness(1.35) saturate(1.2);
    cursor: pointer;
}

.country-tooltip {
    background: rgba(5, 12, 22, .98);
    border: 1px solid var(--border-default);
    border-radius: var(--r-md);
    padding: 10px 16px;
    color: #fff;
    font-weight: 600;
    font-size: .9rem;
    box-shadow: var(--shadow-lg), var(--shadow-blue);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
}

.country-tooltip::before {
    border-top-color: rgba(5, 12, 22, .98) !important;
}

/* ── Legenda ───────────────────────────────────────────────── */
.bottom-left-stack {
    position: absolute;
    left: 14px;
    bottom: calc(40px + 5px);
    z-index: 100000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-start;
}

.legend {
    background: var(--glass-bg);
    padding: 12px 16px;
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--border-default);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text-primary);
    min-width: 155px;
    z-index: 100000;
    border: 1px solid var(--border-subtle);
}

.legend h3 {
    margin-bottom: 9px;
    font-size: .7rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 7px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 7px 0;
    font-size: .68rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    margin-right: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0,0,0,.35);
}

.legend-color.green  { background: linear-gradient(135deg, var(--green-base), var(--green-vivid)); }
.legend-color.red    { background: linear-gradient(135deg, var(--red-base), var(--red-vivid)); }
.legend-color.blue   { background: linear-gradient(135deg, var(--blue-mid), var(--blue-vivid)); }
.legend-color.yellow { background: linear-gradient(135deg, var(--amber-base), var(--amber-vivid)); }

/* ── Botao reset zoom ──────────────────────────────────────── */
.reset-btn {
    background: var(--glass-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    padding: 10px 18px;
    border-radius: var(--r-md);
    cursor: pointer;
    font-size: .85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 7px;
    transition: all var(--t-mid);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    font-family: inherit;
}

.zoom-reset-btn {
    position: absolute;
    top: 241px;
    left: 9px;
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 1000;
    border-radius: var(--r-sm);
    box-shadow: var(--shadow-sm);
}

.reset-btn:hover {
    background: rgba(29, 78, 216, .25);
    border-color: rgba(59, 130, 246, .5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, .2);
}

/* ── Painel de informacoes do pais ─────────────────────────── */
.info-panel {
    position: absolute;
    top: 255px;
    right: 18px;
    width: 390px;
    max-height: calc(100vh - 290px);
    background: var(--glass-bg);
    border-radius: var(--r-xl);
    z-index: 1000;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-default), var(--shadow-blue);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text-primary);
    overflow-y: auto;
    transition: all var(--t-slow);
    border: 1px solid var(--border-subtle);
}

.info-panel::-webkit-scrollbar { width: 5px; }
.info-panel::-webkit-scrollbar-track { background: transparent; }
.info-panel::-webkit-scrollbar-thumb {
    background: rgba(100, 160, 240, .2);
    border-radius: 10px;
}
.info-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 160, 240, .35);
}

.info-panel.hidden {
    transform: translateX(440px);
    opacity: 0;
    pointer-events: none;
}

/* ── Botao fechar ──────────────────────────────────────────── */
.close-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(127, 29, 29, .6);
    border: 1px solid rgba(239,68,68,.3);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--t-mid);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(185, 28, 28, .35);
}

.close-btn:hover {
    background: rgba(185, 28, 28, .85);
    border-color: rgba(239, 68, 68, .65);
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 5px 18px rgba(185, 28, 28, .5);
}

/* ── Conteudo do painel ────────────────────────────────────── */
#panel-content { padding: 22px; }

.country-header {
    text-align: center;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 18px;
}

.country-header h2 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 4px;
    font-weight: 700;
}

.country-flag-large {
    width: 130px;
    height: auto;
    border-radius: var(--r-sm);
    margin: 12px auto;
    display: block;
    box-shadow: 0 6px 24px rgba(0,0,0,.55);
    border: 2px solid var(--border-default);
}

.country-header .flag-emoji {
    font-size: 4.5rem;
    margin-bottom: 12px;
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,.4));
}

.orientation-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 20px;
    border-radius: var(--r-pill);
    font-size: .88rem;
    font-weight: 700;
    color: white;
    margin-top: 10px;
    letter-spacing: .3px;
}

.orientation-badge.right {
    background: linear-gradient(135deg, var(--blue-mid) 0%, var(--blue-vivid) 100%);
    box-shadow: 0 4px 16px rgba(59, 130, 246, .35);
}

.orientation-badge.left {
    background: linear-gradient(135deg, var(--red-base) 0%, var(--red-vivid) 100%);
    box-shadow: 0 4px 16px rgba(239, 68, 68, .35);
}

.orientation-badge.transition {
    background: linear-gradient(135deg, var(--green-base) 0%, var(--green-vivid) 100%);
    box-shadow: 0 4px 16px rgba(16, 185, 129, .35);
}

.orientation-badge.election {
    background: linear-gradient(135deg, var(--amber-base) 0%, var(--amber-vivid) 100%);
    box-shadow: 0 4px 16px rgba(245, 158, 11, .35);
}

.section { margin: 20px 0; }

.section h3 {
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    letter-spacing: .2px;
}

.section h3 .icon { font-size: 1.2rem; opacity: .85; }

.info-grid { display: grid; gap: 8px; }

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 13px;
    background: rgba(255,255,255,.04);
    border-radius: var(--r-md);
    font-size: .85rem;
    transition: background var(--t-fast);
    border: 1px solid var(--border-subtle);
}

.info-item:hover {
    background: rgba(59, 130, 246, .07);
    border-color: var(--border-default);
}

.info-item .label {
    color: var(--text-muted);
    font-weight: 500;
    font-size: .82rem;
}

.info-item .value {
    color: var(--text-primary);
    font-weight: 600;
    text-align: right;
    max-width: 55%;
    font-size: .85rem;
}

.president-card {
    background: linear-gradient(135deg,
        rgba(29, 78, 216, .12) 0%,
        rgba(13, 27, 46, .6) 100%);
    border-radius: var(--r-lg);
    padding: 22px;
    text-align: center;
    border: 1px solid rgba(59, 130, 246, .18);
    margin-bottom: 14px;
}

.president-photo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-default);
    margin: 0 auto 12px;
    display: block;
    box-shadow: 0 6px 28px rgba(0,0,0,.5), var(--shadow-blue);
    background: rgba(255,255,255,.06);
}

.photo-placeholder,
.president-photo-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(29, 78, 216, .2), rgba(13, 27, 46, .6));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.2rem;
    margin: 0 auto 12px;
    border: 3px solid var(--border-default);
}

.winner-photo-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    border: 2px solid var(--border-default);
    flex-shrink: 0;
}

.president-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

.president-party {
    font-size: .88rem;
    color: var(--text-secondary);
}

/* ── Secao de Eleicoes ─────────────────────────────────────── */
.election-section {
    background: linear-gradient(135deg,
        rgba(29, 78, 216, .15) 0%,
        rgba(13, 27, 46, .55) 100%);
    border-radius: var(--r-lg);
    padding: 16px;
    margin: 16px 0;
    border: 1px solid rgba(59, 130, 246, .22);
}

.election-section.pending {
    background: linear-gradient(135deg,
        rgba(217, 119, 6, .15) 0%,
        rgba(13, 27, 46, .55) 100%);
    border-color: rgba(245, 158, 11, .25);
}

.election-section h3 {
    color: var(--blue-light);
    margin-bottom: 12px;
    font-size: .95rem;
}

.election-section.pending h3 { color: var(--amber-vivid); }

.election-header {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 13px;
}

.clock-icon {
    font-size: 1.3rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.12); opacity: .75; }
}

.winner-card {
    background: rgba(255,255,255,.07);
    border-radius: var(--r-md);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 13px;
    margin-top: 12px;
    border: 1px solid var(--border-subtle);
}

.winner-photo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-default);
}

.winner-info { flex: 1; }
.winner-name { font-size: 1rem; font-weight: 700; color: #fff; }
.winner-party { font-size: .8rem; color: var(--text-secondary); margin-top: 3px; }

.winner-orientation {
    display: inline-block;
    padding: 4px 11px;
    border-radius: var(--r-pill);
    font-size: .75rem;
    font-weight: 700;
    margin-top: 7px;
}

.winner-orientation.right {
    background: linear-gradient(135deg, var(--blue-mid), var(--blue-vivid));
    color: white;
}

.winner-orientation.left {
    background: linear-gradient(135deg, var(--red-base), var(--red-vivid));
    color: white;
}

.ending-soon-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: linear-gradient(135deg, var(--amber-base), var(--amber-vivid));
    border-radius: var(--r-pill);
    font-size: .82rem;
    font-weight: 700;
    color: #fff;
    margin-top: 10px;
    animation: glow 2.5s infinite;
    box-shadow: 0 3px 12px rgba(245, 158, 11, .35);
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 6px rgba(245, 158, 11, .4); }
    50%       { box-shadow: 0 0 22px rgba(245, 158, 11, .75); }
}

/* ── Modal ─────────────────────────────────────────────────── */
.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(2, 5, 12, .88);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity var(--t-mid);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
}

.modal.hidden { opacity: 0; pointer-events: none; }

.modal-content {
    background: linear-gradient(160deg, var(--bg-card) 0%, var(--bg-deep) 100%);
    border-radius: var(--r-xl);
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    color: var(--text-primary);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-default);
    border: 1px solid var(--border-subtle);
}

#modal-body { padding: 32px; }

.modal-header { text-align: center; margin-bottom: 28px; }

.modal-header h2 {
    font-size: 2rem;
    color: #fff;
    font-weight: 800;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* ── Loading ───────────────────────────────────────────────── */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.loading::after {
    content: "";
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255,255,255,.06);
    border-top: 3px solid var(--blue-vivid);
    border-right: 3px solid var(--gold-vivid);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    background: rgba(4, 8, 15, .97);
    border-top: 1px solid var(--border-subtle);
    padding: 6px 18px;
    z-index: 999999;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.footer-content {
    max-width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
    margin: 0;
    flex: 1;
}

.footer p { margin: 0; font-size: .68rem; color: var(--text-muted); }

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: .68rem;
    font-weight: 500;
    transition: color var(--t-fast);
    letter-spacing: .2px;
}

.footer-link:hover { color: var(--blue-light); }

.footer-attribution {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

.leaflet-control-attribution {
    background: transparent !important;
    padding: 0 !important;
    font-size: .62rem;
    color: var(--text-muted);
    line-height: 1.2;
    white-space: nowrap;
}

.leaflet-control-attribution a {
    color: rgba(160, 190, 230, .55);
    text-decoration: none;
    transition: color var(--t-fast);
    font-size: .62rem;
}

.leaflet-control-attribution a:hover { color: var(--blue-vivid); text-decoration: underline; }

.leaflet-attribution-flag {
    width: 10px;
    height: 7px;
    margin-right: 3px;
    vertical-align: middle;
    display: inline;
}

/* ── Acessibilidade ────────────────────────────────────────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(255,255,255,.03); }
::-webkit-scrollbar-thumb { background: rgba(59,130,246,.25); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(59,130,246,.45); }

/* ============================================================
   PAGINAS SECUNDARIAS
   ============================================================ */
body[data-page="blog"],
body[data-page="blog-post"],
body[data-page="guia"],
body[data-page="faq"],
body[data-page="sobre"],
body[data-page="eleicoes"],
body[data-page="processos"] {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    background: linear-gradient(160deg,
        var(--bg-deep) 0%,
        var(--bg-surface) 50%,
        var(--bg-deep) 100%);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 22px;
    padding: 10px 18px;
    background: rgba(13, 27, 46, .7);
    color: var(--blue-light);
    text-decoration: none;
    font-weight: 600;
    border-radius: var(--r-pill);
    border: 1px solid var(--border-default);
    transition: all var(--t-mid);
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: .82rem;
    outline: none;
}

.back-link:hover {
    background: rgba(29, 78, 216, .2);
    border-color: var(--blue-vivid);
    color: white;
    transform: translateX(-4px);
    box-shadow: 0 4px 16px rgba(59, 130, 246, .18);
}

/* ── FAQ ───────────────────────────────────────────────────── */
.faq-container {
    max-width: 860px;
    margin: 0 auto;
    padding: 48px 20px 100px;
}

.faq-header {
    text-align: center;
    margin-bottom: 48px;
}

.faq-header h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 12px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--blue-pale) 40%, var(--gold-light) 70%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.faq-header p { color: var(--text-secondary); font-size: 1.05rem; line-height: 1.7; }

.faq-item {
    background: rgba(7, 16, 30, .82);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 26px 28px;
    margin-bottom: 18px;
    transition: border-color var(--t-mid), box-shadow var(--t-mid);
    position: relative;
    overflow: hidden;
}

.faq-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: linear-gradient(180deg, var(--blue-mid), var(--blue-vivid));
    border-radius: 4px 0 0 4px;
}

.faq-item:hover {
    border-color: var(--border-bright);
    box-shadow: var(--shadow-md), var(--shadow-blue);
}

.faq-question {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--blue-pale);
    margin-bottom: 12px;
    line-height: 1.4;
}

.faq-answer {
    line-height: 1.85;
    color: var(--text-secondary);
    font-size: 1rem;
}

.faq-answer strong { color: var(--blue-light); font-weight: 700; }

.faq-answer a {
    color: var(--blue-light);
    text-decoration: underline;
    text-decoration-color: rgba(96, 165, 250, .4);
    transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

.faq-answer a:hover {
    color: #fff;
    text-decoration-color: rgba(96, 165, 250, .8);
}

/* ── Blog ──────────────────────────────────────────────────── */
.blog-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 20px 80px;
}

.search-filter-bar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 40px;
}

.search-box { width: 100%; max-width: 420px; }

.search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border-default);
    border-radius: var(--r-pill);
    background: rgba(13, 27, 46, .8);
    color: var(--text-primary);
    font-size: .9rem;
    font-family: inherit;
    outline: none;
    transition: border-color var(--t-mid), box-shadow var(--t-mid);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box input:focus {
    border-color: var(--blue-vivid);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
    background: rgba(13, 27, 46, .95);
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.post-card {
    background: rgba(7, 16, 30, .82);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 24px;
    transition: all var(--t-mid);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--blue-mid), var(--gold-base));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--t-mid);
}

.post-card:hover::before { transform: scaleX(1); }

.post-card-link { display: block; color: inherit; text-decoration: none; }

.post-card-link:focus-visible .post-card {
    outline: 2px solid var(--blue-vivid);
    outline-offset: 3px;
}

.post-card:hover {
    background: rgba(13, 27, 46, .9);
    border-color: var(--border-bright);
    transform: translateY(-5px);
    box-shadow: var(--shadow-md), var(--shadow-blue);
}

.post-date {
    color: var(--blue-light);
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: 10px;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.post-title {
    font-size: clamp(1.1rem, 3.5vw, 1.35rem);
    color: #fff;
    margin-bottom: 10px;
    font-weight: 700;
    line-height: 1.35;
}

.post-excerpt {
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 14px;
    font-size: clamp(.88rem, 1.8vw, .95rem);
}

.post-author { color: var(--text-muted); font-size: clamp(.75rem, 1.3vw, .85rem); font-style: italic; }

/* ── Guia Politico ─────────────────────────────────────────── */
.guide-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 20px 100px;
}

.guide-header { text-align: center; margin-bottom: 48px; }

.guide-header h1 {
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 12px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--blue-pale) 40%, var(--gold-light) 70%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.guide-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto;
}

.guide-article {
    background: rgba(7, 16, 30, .82);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 36px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    transition: border-color var(--t-mid);
}

.guide-article::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: linear-gradient(180deg, var(--gold-base), var(--blue-mid));
    border-radius: 3px 0 0 3px;
}

.guide-article:hover { border-color: var(--border-bright); }

.guide-article h2 {
    font-size: clamp(1.4rem, 3.5vw, 1.9rem);
    margin-bottom: 18px;
    color: var(--blue-pale);
    font-weight: 800;
    line-height: 1.25;
}

.guide-article h3 {
    font-size: clamp(1.15rem, 3vw, 1.4rem);
    font-weight: 700;
    color: var(--blue-light);
    margin: 28px 0 12px;
    line-height: 1.3;
}

.guide-article p {
    line-height: 1.85;
    margin-bottom: 14px;
    color: var(--text-secondary);
    font-size: clamp(.92rem, 2vw, 1rem);
}

.guide-article p:last-child { margin-bottom: 0; }

.guide-article strong { color: var(--blue-light); font-weight: 700; }

.guide-article ul {
    line-height: 1.85;
    color: var(--text-secondary);
    padding-left: 22px;
    margin-bottom: 14px;
}

.guide-article li { margin-bottom: 10px; }

/* ── Footer das paginas internas ───────────────────────────── */
.inner-footer {
    background: rgba(4, 8, 15, .96);
    border-top: 1px solid var(--border-subtle);
    padding: 28px 24px;
    text-align: center;
    margin-top: 40px;
}

.inner-footer p { font-size: .75rem; color: var(--text-muted); margin-bottom: 10px; }

/* ── Classes utilitárias de cor política ───────────────────── */
.color-right       { color: var(--blue-light) !important; font-weight: 700; }
.color-left        { color: var(--red-vivid) !important; font-weight: 700; }
.color-transition  { color: var(--green-vivid) !important; font-weight: 700; }
.color-election    { color: var(--amber-vivid) !important; font-weight: 700; }

/* ── Blog — intro SEO ──────────────────────────────────────── */
.blog-intro {
    margin-bottom: 28px;
    padding: 22px 26px;
    background: rgba(7, 16, 30, .7);
    border-left: 3px solid var(--blue-mid);
    border-radius: 0 var(--r-md) var(--r-md) 0;
}

.blog-intro h2 {
    font-size: clamp(1.3rem, 3.5vw, 1.6rem);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    line-height: 1.3;
}

.blog-intro p {
    color: var(--text-secondary);
    line-height: 1.75;
    font-size: clamp(.88rem, 2vw, .97rem);
    max-width: 780px;
    margin: 0;
}

.blog-intro a,
.blog-intro p a {
    color: var(--blue-light);
    text-decoration: underline;
    text-decoration-color: rgba(96, 165, 250, .4);
    transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

.blog-intro a:hover,
.blog-intro p a:hover {
    color: #fff;
    text-decoration-color: rgba(96, 165, 250, .8);
}

/* ── Eleições — intro SEO ──────────────────────────────────── */
.seo-intro {
    margin-bottom: 32px;
    padding: 20px 24px;
    background: rgba(59, 130, 246, .07);
    border-left: 3px solid var(--blue-mid);
    border-radius: 0 var(--r-md) var(--r-md) 0;
}

.seo-intro h2 {
    font-size: 1.05rem;
    color: var(--blue-light);
    margin-bottom: 8px;
    font-weight: 700;
}

.seo-intro p {
    color: rgba(255, 255, 255, .82);
    line-height: 1.75;
    font-size: .97rem;
    margin: 0;
}

.seo-intro a {
    color: var(--blue-light);
    text-decoration: underline;
    text-decoration-color: rgba(96, 165, 250, .4);
    transition: color var(--t-fast);
}

.seo-intro a:hover { color: #fff; }

/* ── Post full — alias post-content ────────────────────────── */
.post-content {
    line-height: 1.85;
    color: var(--text-secondary);
    font-size: clamp(.92rem, 2vw, 1.02rem);
}

.post-content h2 {
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    font-weight: 800;
    color: var(--blue-pale);
    margin: 36px 0 14px;
    line-height: 1.25;
}

.post-content h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 28px 0 10px;
}

.post-content p { margin-bottom: 18px; }

.post-content strong { color: var(--blue-light); font-weight: 700; }

.post-content ul,
.post-content ol { padding-left: 24px; margin-bottom: 18px; }

.post-content li { margin-bottom: 8px; }

.post-content a {
    color: var(--blue-light);
    text-decoration: underline;
    text-decoration-color: rgba(96, 165, 250, .4);
    transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

.post-content a:hover {
    color: #fff;
    text-decoration-color: rgba(96, 165, 250, .9);
}

.post-content blockquote {
    border-left: 3px solid var(--blue-vivid);
    padding: 14px 20px;
    margin: 22px 0;
    background: rgba(29, 78, 216, .1);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

.inner-footer .footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.inner-footer .footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: .75rem;
    font-weight: 500;
    transition: color var(--t-fast);
}

.inner-footer .footer-links a:hover { color: var(--blue-light); }

/* ── Sobre Nós — conteúdo ──────────────────────────────────── */
.about-container {
    max-width: 820px;
    margin: 0 auto;
    padding: 48px 20px 100px;
}

.about-content {
    background: rgba(7, 16, 30, .82);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    border-radius: var(--r-lg);
    padding: 36px;
    line-height: 1.85;
    font-size: clamp(.92rem, 2vw, 1.02rem);
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.about-content::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: linear-gradient(180deg, var(--gold-base), var(--blue-mid));
    border-radius: 3px 0 0 3px;
}

.about-content p { margin-bottom: 18px; }
.about-content p:last-child { margin-bottom: 0; }
.about-content strong { color: var(--blue-pale); font-weight: 700; }
.about-content ul { padding-left: 22px; margin-bottom: 18px; }
.about-content li { margin-bottom: 10px; }

.age-dynamic { color: var(--blue-light); font-weight: 700; }

/* ── No posts / Not found ──────────────────────────────────── */
.no-posts,
.post-not-found {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1.05rem;
}

.no-posts h2,
.post-not-found h2 {
    color: var(--text-secondary);
    font-size: 1.5rem;
    margin-bottom: 12px;
    font-weight: 700;
}

/* ── Blog post individual ──────────────────────────────────── */
.post-full { max-width: 800px; margin: 0 auto; }

.post-full h1 {
    font-size: clamp(1.6rem, 4vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.2;
    color: #fff;
}

.post-full .post-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.post-full .post-meta span { font-size: .82rem; color: var(--text-muted); }
.post-full .post-meta .post-date { color: var(--blue-light); font-weight: 700; }

.post-full .post-body {
    line-height: 1.85;
    color: var(--text-secondary);
    font-size: clamp(.92rem, 2vw, 1.02rem);
}

.post-full .post-body h2 {
    font-size: clamp(1.3rem, 3vw, 1.7rem);
    font-weight: 800;
    color: var(--blue-pale);
    margin: 36px 0 14px;
    line-height: 1.25;
}

.post-full .post-body h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.35rem);
    font-weight: 700;
    color: var(--text-primary);
    margin: 28px 0 10px;
}

.post-full .post-body p { margin-bottom: 18px; }

.post-full .post-body strong { color: var(--blue-light); font-weight: 700; }

.post-full .post-body ul,
.post-full .post-body ol { padding-left: 24px; margin-bottom: 18px; }

.post-full .post-body li { margin-bottom: 8px; }

.post-full .post-body a {
    color: var(--blue-light);
    text-decoration: underline;
    text-decoration-color: rgba(96, 165, 250, .4);
    transition: color var(--t-fast), text-decoration-color var(--t-fast);
}

.post-full .post-body a:hover {
    color: #fff;
    text-decoration-color: rgba(96, 165, 250, .9);
}

.post-full .post-body blockquote {
    border-left: 3px solid var(--blue-vivid);
    padding: 14px 20px;
    margin: 22px 0;
    background: rgba(29, 78, 216, .1);
    border-radius: 0 var(--r-sm) var(--r-sm) 0;
    color: var(--text-secondary);
    font-style: italic;
}

/* ============================================================
   RESPONSIVIDADE
   ============================================================ */
@media (max-width: 700px) {
    header { flex-wrap: wrap; gap: 8px; padding: 10px 14px; }
    .header-brand { order: -1; flex: 0 0 100%; }
    .lang-selector { order: 0; flex-shrink: 0; }
    .top-nav { order: 1; max-width: 100%; justify-content: center; }
    .top-nav a { font-size: .75rem; padding: 4px 9px; }
}

@media (max-width: 768px) {
    .modal-grid { grid-template-columns: 1fr; }

    .info-panel {
        width: calc(100% - 20px);
        right: 10px; left: 10px;
        top: auto; bottom: 52px;
        max-height: 42vh;
        border-radius: var(--r-lg);
    }

    .info-panel.hidden { display: none; }

    .bottom-left-stack {
        left: 10px; right: auto;
        bottom: calc(16px + env(safe-area-inset-bottom));
        width: auto;
        max-width: calc(100vw - 20px);
        z-index: 999;
    }

    .legend {
        max-width: min(320px, calc(100vw - 20px));
        padding: 10px 13px;
        min-width: unset;
        max-height: 50vh;
        overflow-y: auto;
    }

    .legend h3 { font-size: .68rem; margin-bottom: 7px; }
    .legend-item { margin: 5px 0; font-size: .65rem; }
    .legend-color { width: 16px; height: 16px; margin-right: 8px; }

    .leaflet-control-attribution { display: none !important; }

    .stats-bar {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px 12px;
        justify-items: center;
    }

    .stats-group {
        grid-column: 1;
        gap: 16px;
        order: 1;
        justify-content: center;
    }

    .search-container {
        grid-column: 1;
        order: 2;
        justify-self: stretch;
        max-width: 100%;
    }
}

@media (max-width: 1024px) {
    .stats-group { gap: 24px; }
    .bottom-left-stack { left: 10px; bottom: 20px; }
    .info-panel { width: 340px; }
}

@media (max-width: 480px) {
    header h1 { font-size: 1.05rem; }
    header .subtitle { font-size: .6rem; }
    .stats-bar { padding: 8px 10px; gap: 7px; }
    .stat-item { font-size: .65rem; gap: 5px; }
    .stat-color { width: 12px; height: 12px; }
    .stat-count { font-size: 1rem; }
    .search-input { padding: 7px 11px; font-size: .82rem; }
    .search-btn   { padding: 7px 12px; font-size: .78rem; }
    .info-panel { max-height: 38vh; bottom: 52px; right: 6px; left: 6px; }
    .legend { padding: 9px 11px; font-size: .65rem; max-height: 38vh; }
}

@media (max-width: 360px) {
    header h1 { font-size: .98rem; }
    .bottom-left-stack {
        bottom: calc(16px + env(safe-area-inset-bottom));
        left: 6px;
        max-width: calc(100vw - 12px);
    }
    .legend { padding: 8px 9px; min-width: unset; }
}

@media (max-width: 600px) {
    .footer {
        padding: 8px 10px;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        min-height: 45px;
        gap: 5px;
    }
    .footer-attribution { justify-content: flex-end; width: 100%; }
    .footer-content { gap: 10px; width: 100%; justify-content: center; }
    .footer p, .footer-link { font-size: .63rem; }

    .leaflet-control-attribution { font-size: .6rem; line-height: 1.1; white-space: normal; }
    .leaflet-control-attribution a { font-size: .6rem; }
}

/* ═══════════════════════════════════════════════════════════
   ELEIÇÕES BRASIL
═══════════════════════════════════════════════════════════ */

body[data-page="eleicoes"] {
    background: var(--bg-deep);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100%;
    height: auto;
    padding-bottom: 0;
}

.eleicoes-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 48px 20px 100px;
}

.eleicoes-header {
    text-align: center;
    margin-bottom: 44px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border-default);
}

.eleicoes-header h1 {
    font-size: clamp(1.7rem, 5vw, 2.4rem);
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 40%, var(--blue-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.update-info {
    font-size: .88rem;
    color: var(--text-muted);
    margin-top: 10px;
}

.turno-section {
    margin-bottom: 52px;
}

.turno-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--blue-light);
    border-left: 3px solid var(--blue-mid);
    padding-left: 12px;
}

.candidatos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-bottom: 30px;
}

.candidato-card {
    background: rgba(7, 16, 30, .82);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-default);
    border-radius: var(--r-xl);
    padding: 36px 26px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: transform var(--t-med) ease, box-shadow var(--t-med) ease, border-color var(--t-med) ease;
}

.candidato-card:hover {
    transform: translateY(-6px);
    border-color: var(--blue-mid);
    box-shadow: 0 12px 36px rgba(59, 130, 246, .22);
}

.candidato-foto {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    margin: 0 auto 26px;
    border: 3px solid var(--blue-mid);
    object-fit: cover;
    background: rgba(255,255,255,.06);
}

.candidato-nome {
    font-size: 1.45rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.2;
    min-height: calc(1.2em * 2);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.candidato-partido {
    font-size: 1rem;
    color: var(--green-vivid);
    margin-bottom: 26px;
    font-weight: 600;
    min-height: 1.2em;
}

.percentual-bar {
    background: rgba(255,255,255,.1);
    height: 12px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 14px;
    width: 100%;
    margin-top: auto;
}

.percentual-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue-mid), var(--green-vivid));
    transition: width .5s ease;
}

.percentual-valor {
    font-size: 2rem;
    font-weight: 800;
    color: var(--blue-light);
    text-align: center;
    width: 100%;
}

.pesquisas-info {
    background: rgba(59, 130, 246, .08);
    border-left: 3px solid var(--blue-mid);
    border-radius: 6px;
    padding: 14px 16px;
    margin-top: 28px;
    font-size: .88rem;
    color: var(--text-muted);
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-muted);
}

.error {
    background: rgba(185, 28, 28, .12);
    border-left: 3px solid var(--red-vivid);
    border-radius: 6px;
    padding: 14px 16px;
    color: #ffb3ba;
    margin: 20px 0;
}

.paginacao-pesquisas {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 10px 0 24px;
    flex-wrap: wrap;
}

.paginacao-btn {
    padding: 9px 16px;
    border-radius: var(--r-md);
    border: 1px solid rgba(59, 130, 246, .4);
    background: rgba(59, 130, 246, .12);
    color: var(--text-primary);
    font-weight: 600;
    cursor: pointer;
    transition: background var(--t-fast) ease, border-color var(--t-fast) ease;
    font-family: inherit;
    font-size: .9rem;
}

.paginacao-btn:hover:not(:disabled) {
    background: rgba(59, 130, 246, .22);
    border-color: var(--blue-mid);
}

.paginacao-btn:disabled {
    opacity: .4;
    cursor: not-allowed;
}

.paginacao-info {
    color: var(--blue-pale);
    font-size: .93rem;
    font-weight: 600;
}

@media (max-width: 1200px) {
    .candidatos-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .eleicoes-header h1 { font-size: 1.6rem; }
    .candidatos-grid { grid-template-columns: 1fr; }
    .candidato-foto { width: 130px; height: 130px; }
}

/* ═══════════════════════════════════════════════════════════
   PROCESSOS CANDIDATOS 2026
═══════════════════════════════════════════════════════════ */

body[data-page="processos"] {
    background:
        linear-gradient(180deg, rgba(8, 15, 28, .94) 0%, rgba(3, 7, 14, 1) 70%),
        var(--bg-deep);
    color: var(--text-primary);
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 100%;
    height: auto;
}

.processos-container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 42px 0 100px;
}

.processos-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 28px;
    align-items: end;
    padding: 44px 0 34px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.processos-kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #facc15;
    font-size: .76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 12px;
}

.processos-hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1;
    margin: 0 0 16px;
    max-width: 760px;
    color: #f8fafc;
}

.processos-hero p {
    max-width: 760px;
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1rem;
    margin: 0;
}

.processos-hero-panel {
    border: 1px solid rgba(250, 204, 21, .28);
    border-radius: 8px;
    padding: 18px;
    background: rgba(250, 204, 21, .07);
}

.processos-hero-panel strong {
    display: block;
    color: #fde68a;
    margin-bottom: 8px;
}

.processos-hero-panel p {
    font-size: .88rem;
    line-height: 1.6;
}

.processos-alert {
    margin: 24px 0;
    padding: 14px 16px;
    border-left: 3px solid #facc15;
    border-radius: 6px;
    background: rgba(250, 204, 21, .08);
    color: #fde68a;
    font-size: .92rem;
    line-height: 1.55;
}

.processos-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
}

.processos-stat {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    padding: 16px;
    background: rgba(7, 16, 30, .78);
}

.processos-stat span {
    display: block;
    color: #f8fafc;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 8px;
}

.processos-stat small {
    color: var(--text-muted);
    font-size: .78rem;
    text-transform: uppercase;
}

.processos-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 190px 210px auto;
    gap: 12px;
    align-items: end;
    margin: 18px 0;
    padding: 14px;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, .03);
}

.processos-field {
    display: grid;
    gap: 7px;
}

.processos-field span {
    color: var(--text-muted);
    font-size: .76rem;
    font-weight: 700;
    text-transform: uppercase;
}

.processos-field input,
.processos-field select {
    width: 100%;
    min-height: 42px;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 6px;
    background: rgba(3, 7, 14, .82);
    color: var(--text-primary);
    padding: 0 12px;
    font: inherit;
}

.processos-field input:focus,
.processos-field select:focus {
    outline: none;
    border-color: var(--blue-mid);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .18);
}

.processos-refresh {
    min-height: 42px;
    border: 1px solid rgba(37, 99, 235, .55);
    border-radius: 6px;
    background: rgba(37, 99, 235, .18);
    color: #dbeafe;
    padding: 0 16px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
    transition: background var(--t-fast) ease, border-color var(--t-fast) ease;
}

.processos-refresh:hover:not(:disabled) {
    background: rgba(37, 99, 235, .28);
    border-color: var(--blue-mid);
}

.processos-refresh:disabled {
    opacity: .5;
    cursor: wait;
}

.processos-meta {
    color: var(--text-muted);
    font-size: .86rem;
    margin: 12px 0 22px;
}

.processos-feedback {
    margin: 14px 0;
    border-radius: 6px;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,.08);
    background: rgba(59, 130, 246, .1);
    color: #bfdbfe;
    font-size: .88rem;
}

.processos-feedback.success {
    background: rgba(34, 197, 94, .1);
    color: #bbf7d0;
}

.processos-feedback.error {
    background: rgba(239, 68, 68, .1);
    color: #fecaca;
}

.processos-list {
    display: grid;
    gap: 18px;
}

.processo-candidato {
    display: grid;
    grid-template-columns: 300px minmax(0, 1fr);
    gap: 0;
    border: 1px solid rgba(255,255,255,.09);
    border-radius: 8px;
    background: rgba(7, 16, 30, .72);
    overflow: hidden;
}

.processo-candidato-info {
    padding: 22px;
    background: linear-gradient(180deg, rgba(15, 32, 53, .92), rgba(7, 16, 30, .92));
    border-right: 1px solid rgba(255,255,255,.08);
}

.processos-party {
    display: inline-flex;
    margin-bottom: 12px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(34, 197, 94, .13);
    color: #bbf7d0;
    font-size: .76rem;
    font-weight: 800;
}

.processo-candidato-info h2 {
    margin: 0 0 12px;
    color: #f8fafc;
    font-size: 1.45rem;
    line-height: 1.16;
}

.processo-candidato-info p {
    margin: 0 0 18px;
    color: var(--text-secondary);
    line-height: 1.62;
    font-size: .9rem;
}

.processo-candidato-info dl {
    display: grid;
    gap: 10px;
    margin: 0 0 18px;
}

.processo-candidato-info dl div {
    display: grid;
    grid-template-columns: 82px 1fr;
    gap: 8px;
    align-items: baseline;
}

.processo-candidato-info dt {
    color: var(--text-muted);
    font-size: .72rem;
    text-transform: uppercase;
    font-weight: 800;
}

.processo-candidato-info dd {
    margin: 0;
    color: var(--text-primary);
    font-size: .88rem;
}

.processo-registros {
    display: grid;
    gap: 12px;
    padding: 18px;
}

.processo-item {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 8px;
    padding: 16px;
    background: rgba(3, 7, 14, .58);
}

.processo-item-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
}

.processo-item h3 {
    margin: 0 0 6px;
    color: #f8fafc;
    font-size: 1rem;
    line-height: 1.35;
}

.processo-item-head p {
    margin: 0;
    color: var(--text-muted);
    font-size: .82rem;
    line-height: 1.45;
}

.processos-badge {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    padding: 0 10px;
    font-size: .72rem;
    font-weight: 900;
    text-transform: uppercase;
    background: rgba(148, 163, 184, .16);
    color: #cbd5e1;
}

.status-em-andamento { background: rgba(59, 130, 246, .18); color: #bfdbfe; }
.status-arquivado,
.status-concluido { background: rgba(34, 197, 94, .16); color: #bbf7d0; }
.status-prescrito,
.status-anulado { background: rgba(250, 204, 21, .16); color: #fde68a; }
.status-sem-dados-suficientes { background: rgba(239, 68, 68, .14); color: #fecaca; }

.processo-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 14px 0;
}

.processo-tags span {
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 999px;
    padding: 4px 8px;
    color: var(--text-muted);
    font-size: .75rem;
}

.processo-resumo,
.processo-resultado {
    margin: 0 0 12px;
    color: var(--text-secondary);
    line-height: 1.65;
    font-size: .91rem;
}

.processo-resultado strong {
    color: #e2e8f0;
}

.processo-fontes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.processos-source {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 1px solid rgba(96, 165, 250, .28);
    border-radius: 999px;
    padding: 6px 9px;
    color: #bfdbfe;
    text-decoration: none;
    font-size: .76rem;
    font-weight: 700;
    max-width: 100%;
}

.processos-source:hover {
    border-color: var(--blue-light);
    color: #fff;
}

.processos-source span {
    color: var(--text-muted);
    font-weight: 600;
}

.processos-source.muted {
    border-color: rgba(255,255,255,.08);
    color: var(--text-muted);
}

.processos-empty,
.processos-empty-inline {
    border: 1px dashed rgba(255,255,255,.14);
    border-radius: 8px;
    padding: 22px;
    background: rgba(255,255,255,.03);
    color: var(--text-muted);
}

.processos-empty h2 {
    margin: 0 0 8px;
    color: var(--text-primary);
}

.processos-empty p {
    margin: 0;
    line-height: 1.6;
}

@media (max-width: 980px) {
    .processos-hero,
    .processo-candidato {
        grid-template-columns: 1fr;
    }

    .processo-candidato-info {
        border-right: 0;
        border-bottom: 1px solid rgba(255,255,255,.08);
    }

    .processos-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .processos-toolbar {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 620px) {
    .processos-container {
        width: min(100% - 24px, 1180px);
        padding-top: 28px;
    }

    .processos-hero {
        padding-top: 24px;
    }

    .processos-summary,
    .processos-toolbar {
        grid-template-columns: 1fr;
    }

    .processo-item-head {
        display: grid;
    }

    .processos-badge {
        justify-self: start;
    }
}
