/* ============================================================
   SISTEMA PESQUISA ELEITORAL TO 2026 — Design System v2
   Tema: Glassmorphism + Gradientes + Paleta Institucional 2026
   ============================================================

   PALETA PRINCIPAL — Neutro + Patriótica Moderna
   ─────────────────────────────────────────────────────────────
   Primary   (ação, botões CTA, links)   → Azul Democrático #0057B8
   Secondary (sucesso, progresso)        → Verde Esperança  #009C3B
   Accent    (destaques, energia)        → Ouro Brasil      #FFCC00
   ─────────────────────────────────────────────────────────────
   Neutros
     Background principal  → #F8FAFC  (cinza gelo)
     Surface / cards       → #FFFFFF  com borda #E2E8F0
     Text primary          → #0F172A  (quase preto)
     Text secondary        → #475569  (cinza médio)
     Text muted            → #94A3B8  (cinza claro)
     Borders / dividers    → #CBD5E1
   ─────────────────────────────────────────────────────────────
   Semânticas
     Sucesso  → #16A34A
     Erro     → #DC2626
     Aviso    → #D97706
   ─────────────────────────────────────────────────────────────
   Variações alternativas documentadas:
   1. Institucional / TSE-like → Primary #003366, Accent #FFD700
   2. Moderna / tech 2026      → Primary #3B82F6, Secondary #10B981, Accent #F59E0B
   3. Energia de campanha      → Primary #C8102E, Secondary #228B22, Accent #FFA500
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* ─── Paleta nominal (para referência direta) ─── */
    --color-blue: #0057B8;
    /* Azul Democrático — Primary */
    --color-green: #009C3B;
    /* Verde Esperança  — Secondary */
    --color-gold: #FFCC00;
    /* Ouro Brasil      — Accent */
    --color-navy: #003366;
    /* Azul marinho (var. institucional) */
    --color-red-err: #DC2626;
    /* Erro */
    --color-green-ok: #16A34A;
    /* Sucesso semântico */
    --color-amber: #D97706;
    /* Aviso */

    /* ─── Papéis funcionais ─── */
    --accent: #0057B8;
    --accent-hover: #004099;
    --accent-glow: rgba(0, 87, 184, 0.22);
    --accent-light: rgba(0, 87, 184, 0.10);

    --success: #16A34A;
    --success-light: rgba(22, 163, 74, 0.12);

    --danger: #DC2626;
    --danger-light: rgba(220, 38, 38, 0.12);

    --warning: #D97706;
    --warning-light: rgba(217, 119, 6, 0.12);

    --gold: #FFCC00;
    --gold-light: rgba(255, 204, 0, 0.18);
    --gold-dark: #B8900A;
    /* texto sobre fundo gold */

    --purple: #7C3AED;

    /* ─── Backgrounds ─── */
    --bg-primary: #F8FAFC;
    --bg-secondary: #F1F5F9;
    --bg-card: rgba(255, 255, 255, 0.80);
    --bg-card-hover: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.55);
    --bg-glass-dark: rgba(15, 23, 42, 0.55);

    /* ─── Texto ─── */
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --black: #0F172A;

    /* ─── Bordas ─── */
    --border: #E2E8F0;
    --border-glass: rgba(255, 255, 255, 0.50);
    --border-subtle: #CBD5E1;

    /* ─── Superfície de cards ─── */
    --surface: rgba(255, 255, 255, 0.88);

    /* ─── Aliases de compatibilidade ─── */
    --bg-card: rgba(255, 255, 255, 0.80);
    --bg-secondary: #F1F5F9;
    --border-color: #E2E8F0;

    /* ─── Cores extras ─── */
    --dodger-blue: #60A5FA;

    /* ─── Sombras ─── */
    --shadow-sm: 0 1px 4px rgba(15, 23, 42, 0.06);
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.09);
    --shadow-lg: 0 8px 40px rgba(15, 23, 42, 0.13);
    --shadow-accent: 0 4px 20px rgba(0, 87, 184, 0.22);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.70);

    /* ─── Gradientes ─── */
    --gradient-bg: linear-gradient(145deg, #EBF0F8 0%, #E2EAF5 50%, #E8EDF8 100%);
    --gradient-accent: linear-gradient(135deg, #0057B8 0%, #003C8C 100%);
    --gradient-success: linear-gradient(135deg, #16A34A 0%, #0E7A32 100%);
    --gradient-danger: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%);
    --gradient-gold: linear-gradient(135deg, #FFCC00 0%, #E6B800 100%);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.88) 0%, rgba(255, 255, 255, 0.68) 100%);
    --gradient-nav: linear-gradient(180deg, #0F2247 0%, #0A1A38 100%);
    --gradient-hero: linear-gradient(135deg, #0057B8 0%, #003C8C 60%, #002870 100%);

    /* ─── Transições ─── */
    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.38s cubic-bezier(0.4, 0, 0.2, 1);

    /* ─── Border radius ─── */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius: 0.875rem;
    --radius-lg: 1.25rem;
    --radius-xl: 1.75rem;
}

/* ============================= RESET ============================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--gradient-bg);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Fundo com radial gradients sutis nas cores institucionais */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 15% 40%, rgba(0, 87, 184, 0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 85% 20%, rgba(0, 156, 59, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 55% 85%, rgba(255, 204, 0, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

body>* {
    position: relative;
    z-index: 1;
}

/* ========================= SIDEBAR ========================= */
.main-sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--gradient-nav);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    z-index: 1100;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    transition: transform var(--transition);
}

.sidebar-brand {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.01em;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}

.sidebar-links::-webkit-scrollbar {
    width: 4px;
}

.sidebar-links::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-links::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.15);
    border-radius: 99px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    padding: 0.65rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.18s ease;
    letter-spacing: 0.01em;
}

.sidebar-link i,
.sidebar-link .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity 0.18s ease;
}

.sidebar-link:hover {
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.07);
}

.sidebar-link:hover .icon {
    opacity: 1;
}

.sidebar-link.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    font-weight: 600;
}

.sidebar-link.active .icon {
    opacity: 1;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    margin: 0.35rem 0;
}

/* ========================= HEADER ========================= */
.main-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 72px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--border);
    margin-left: 260px;
    transition: margin-left var(--transition);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 0;
}

.header-page-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.header-page-title {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.header-page-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
}

.header-page-subtitle:empty {
    display: none;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

@keyframes pulse-dot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.6;
        transform: scale(1.2);
    }
}

@media (max-width: 1024px) {
    #mobile-toggle {
        display: block !important;
    }
}

/* ========================= LAYOUT ========================= */
.container {
    max-width: 1440px;
    margin-left: 260px;
    padding: 2rem 2rem 3rem;
    transition: margin-left var(--transition);
}

/* ========================= RESULTS CARDS ========================= */
.consolidated-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.cons-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    box-shadow: var(--shadow);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cons-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 87, 184, 0.25);
}

/* Faixa colorida no topo do card */
.cons-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-accent);
    border-radius: var(--radius) var(--radius) 0 0;
}

.cons-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.cons-card-code {
    padding: 0.15rem 0.5rem;
    background: rgba(0, 87, 184, 0.08);
    color: var(--accent);
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.cons-card-n {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.cons-card-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

/* Mini Bar Progress — layout inline */
.mini-bars {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.1rem;
}

.mini-bar-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px 38px;
    align-items: start;
    gap: 0.4rem;
    padding: 0.18rem 0;
    border-radius: 4px;
    transition: background 0.15s;
}

.mini-bar-row:hover {
    background: rgba(0, 87, 184, 0.04);
}

.mini-bar-row.is-leader {
    background: rgba(22, 163, 74, 0.06);
}

.mini-bar-row.is-leader:hover {
    background: rgba(22, 163, 74, 0.1);
}

.mini-bar-label {
    font-size: 0.73rem;
    color: var(--text-secondary);
    white-space: normal;
    word-break: break-word;
    line-height: 1.3;
    font-weight: 500;
}

.mini-bar-row.is-leader .mini-bar-label {
    color: var(--text-primary);
    font-weight: 700;
}

.mini-bar-track {
    height: 6px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 99px;
    overflow: hidden;
    position: relative;
    margin-top: 0.35rem;
}

.mini-bar-row.is-leader .mini-bar-track {
    height: 7px;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 99px;
    width: 0%;
    transition: width 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.mini-bar-pct {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: right;
    white-space: nowrap;
    margin-top: 0.3rem;
}

.mini-bar-row.is-leader .mini-bar-pct {
    color: var(--text-primary);
}

.cons-card-footer {
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.1rem;
}

.winner-badge {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: #166534;
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.2);
    padding: 0.18rem 0.55rem;
    border-radius: 99px;
    max-width: 72%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 1024px) {
    .main-sidebar {
        transform: translateX(-100%);
        width: 240px;
    }

    .main-header,
    .container {
        margin-left: 0;
    }

    .main-sidebar.active {
        transform: translateX(0);
    }
}

/* ========================= HEADINGS ========================= */
h1 {
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    font-weight: 800;
    color: var(--black);
    letter-spacing: -0.03em;
    line-height: 1.2;
}

h2 {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    letter-spacing: -0.01em;
}

h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ========================= PAGE HEADER ========================= */
.page-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.page-header h1 {
    margin-bottom: 0;
}

/* ========================= STAT CARDS ========================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 1.4rem 1.5rem;
    box-shadow: var(--shadow), var(--shadow-inset);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform var(--transition), box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg), var(--shadow-inset);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card .label {
    font-size: 0.73rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
}

.stat-card .value {
    font-size: 2.1rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.04em;
    line-height: 1;
}

.stat-card .value.green {
    color: var(--success);
}

.stat-card .value.orange {
    color: var(--danger);
}

/* ========================= CARDS ========================= */
.chart-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow), var(--shadow-inset);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform var(--transition), box-shadow var(--transition);
    min-height: 320px;
}

.chart-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-inset);
}

.chart-card h3 {
    font-size: 0.85rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.4;
}

.chart-card-full {
    grid-column: 1 / -1;
}

/* ========================= CHARTS GRID ========================= */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

/* ========================= ACCORDION ========================= */
.accordion {
    background: var(--gradient-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm), var(--shadow-inset);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.accordion:hover {
    box-shadow: var(--shadow), var(--shadow-inset);
}

.accordion-header {
    padding: 1rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
    transition: background var(--transition);
}

.accordion-header:hover {
    background: rgba(26, 148, 255, 0.05);
}

.accordion-header::after {
    content: '›';
    font-size: 1.3rem;
    color: var(--accent);
    transform: rotate(90deg);
    transition: transform var(--transition);
    flex-shrink: 0;
    line-height: 1;
}

.accordion.active .accordion-header {
    background: rgba(26, 148, 255, 0.06);
    border-bottom: 1px solid var(--border);
}

.accordion.active .accordion-header::after {
    transform: rotate(-90deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.38s cubic-bezier(0.4, 0, 0.2, 1), padding var(--transition);
    padding: 0 1.25rem;
}

.accordion.active .accordion-content {
    max-height: 900px;
    padding: 1.25rem;
}

/* ========================= TABLES ========================= */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-glass);
    background: var(--gradient-card);
    box-shadow: var(--shadow), var(--shadow-inset);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86rem;
}

th,
td {
    padding: 0.72rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: rgba(2, 2, 10, 0.03);
    position: sticky;
    top: 0;
}

tr:hover {
    background: rgba(0, 87, 184, 0.04);
}

tr:last-child td {
    border-bottom: none;
}

/* ========================= BUTTONS ========================= */
.btn {
    padding: 0.5rem 1.1rem;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 0.84rem;
    cursor: pointer;
    font-weight: 600;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    letter-spacing: 0.01em;
    position: relative;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0);
    transition: background var(--transition);
    pointer-events: none;
}

.btn:hover::after {
    background: rgba(255, 255, 255, 0.12);
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-accent);
    color: #fff;
    box-shadow: 0 2px 10px rgba(26, 148, 255, 0.30);
}

.btn-primary:hover {
    box-shadow: 0 4px 18px rgba(26, 148, 255, 0.45);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--gradient-success);
    color: #fff;
    box-shadow: 0 2px 10px rgba(48, 107, 52, 0.30);
}

.btn-success:hover {
    box-shadow: 0 4px 18px rgba(48, 107, 52, 0.45);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--gradient-danger);
    color: #fff;
    box-shadow: 0 2px 10px rgba(222, 84, 30, 0.30);
}

.btn-danger:hover {
    box-shadow: 0 4px 18px rgba(222, 84, 30, 0.45);
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
    box-shadow: 0 2px 10px rgba(180, 83, 9, 0.30);
}

.btn-warning:hover {
    box-shadow: 0 4px 18px rgba(180, 83, 9, 0.45);
    transform: translateY(-1px);
}

.btn-accent {
    background: linear-gradient(135deg, #0057b8, #003d82);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 87, 184, 0.30);
}

.btn-accent:hover {
    box-shadow: 0 4px 18px rgba(0, 87, 184, 0.45);
    transform: translateY(-1px);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.55);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.btn-outline:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--accent-light);
}

.btn-sm {
    padding: 0.28rem 0.65rem;
    font-size: 0.76rem;
}

.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

/* ========================= FORMS ========================= */
input,
select,
textarea {
    background: rgba(255, 255, 255, 0.80);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.6rem 0.9rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    width: 100%;
    font-family: inherit;
    transition: all var(--transition);
    backdrop-filter: blur(4px);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input[type="number"] {
    appearance: textfield;
    -moz-appearance: textfield;
    -webkit-appearance: textfield;
}

label {
    display: block;
    font-size: 0.77rem;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1rem;
}

/* ========================= FILTER BAR ========================= */
.filter-bar {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
    padding: 1.2rem 1.4rem;
    background: var(--gradient-card);
    border-radius: var(--radius);
    border: 1px solid var(--border-glass);
    align-items: flex-end;
    box-shadow: var(--shadow), var(--shadow-inset);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.filter-bar .form-group {
    margin: 0;
    flex: 1;
    min-width: 130px;
}

/* ========================= LOGS ========================= */
.logs-container {
    background: linear-gradient(145deg, #0a0a12 0%, #02020a 100%);
    color: #4ade80;
    font-family: 'Courier New', Courier, monospace;
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    height: 280px;
    overflow-y: auto;
    font-size: 0.82rem;
    border: 1px solid rgba(255, 255, 255, 0.06);
    margin-bottom: 1.75rem;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.3);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.logs-container::-webkit-scrollbar {
    width: 5px;
}

.logs-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.log-item {
    margin-bottom: 0.25rem;
    padding-bottom: 0.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    line-height: 1.5;
}

.log-item .time {
    color: rgba(255, 255, 255, 0.28);
    margin-right: 0.5rem;
    font-size: 0.78rem;
}

.log-item.in {
    color: var(--dodger-blue);
}

.log-item.out {
    color: #4ade80;
}

.log-item.ai {
    color: #c084fc;
}

.log-item.error {
    color: #fb923c;
}

.log-item.info {
    color: rgba(208, 204, 202, 0.7);
}

/* ========================= MODAL ========================= */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(2, 2, 10, 0.55);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.18s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal {
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 92%;
    max-width: 620px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg), 0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    animation: slideUp 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(16px);
}

.modal h2 {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* ========================= BADGES ========================= */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.65rem;
    border-radius: 999px;
    font-size: 0.70rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-active {
    background: var(--success-light);
    color: var(--success);
}

.badge-inactive {
    background: var(--danger-light);
    color: var(--danger);
}

.badge-estimulada {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-espontanea {
    background: var(--warning-light);
    color: #b45309;
}

.badge-pending {
    background: var(--warning-light);
    color: #b45309;
}

.badge-sent {
    background: var(--accent-light);
    color: var(--accent);
}

.badge-completed {
    background: var(--success-light);
    color: var(--success);
}

/* ========================= SECTION LABELS ========================= */
.section-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-label::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ========================= LOGIN ========================= */
.login-container {
    max-width: 420px;
    margin: 10vh auto;
    padding: 2.5rem;
    background: var(--gradient-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-lg), var(--shadow-inset);
    text-align: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.login-container h1 {
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.login-container p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

/* ========================= SKELETON / LOADING ========================= */
@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.06) 25%, rgba(0, 0, 0, 0.10) 37%, rgba(0, 0, 0, 0.06) 63%);
    background-size: 1000px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--radius-sm);
}

/* ========================= SCROLLBARS ========================= */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(2, 2, 10, 0.18);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(2, 2, 10, 0.28);
}

/* ========================= CHART PROGRESS BAR ========================= */
.mini-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.55rem;
}

.mini-bar-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    min-width: 90px;
    max-width: 130px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.mini-bar-track {
    flex: 1;
    height: 8px;
    background: rgba(2, 2, 10, 0.07);
    border-radius: 999px;
    overflow: hidden;
}

.mini-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: var(--gradient-accent);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.mini-bar-pct {
    font-size: 0.77rem;
    font-weight: 700;
    color: var(--text-secondary);
    min-width: 40px;
    text-align: right;
}

/* ========================= VOTER DETAIL CARD ========================= */
.voter-card {
    background: var(--gradient-card);
    padding: 1.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border-glass);
    margin-top: 1rem;
    box-shadow: var(--shadow), var(--shadow-inset);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: slideUp 0.22s ease;
}

.voter-card h2 {
    color: var(--text-primary);
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ========================= RESULTS HEADER ========================= */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.75rem;
}

.results-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========================= PROGRESS BAR WIDGET ========================= */
.progress-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ========================= TOOLTIP ========================= */
[data-tooltip] {
    position: relative;
}

[data-tooltip]:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(2, 2, 10, 0.88);
    color: #fff;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1000;
    box-shadow: var(--shadow);
}

/* ========================= ANIMATIONS ========================= */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-in {
    animation: fadeInUp 0.3s ease both;
}

.animate-in:nth-child(1) {
    animation-delay: 0.05s;
}

.animate-in:nth-child(2) {
    animation-delay: 0.10s;
}

.animate-in:nth-child(3) {
    animation-delay: 0.15s;
}

.animate-in:nth-child(4) {
    animation-delay: 0.20s;
}

.animate-in:nth-child(5) {
    animation-delay: 0.25s;
}

.animate-in:nth-child(6) {
    animation-delay: 0.30s;
}

/* ========================= CONSOLIDATED MINI CARD ========================= */
.mini-chart-card {
    background: var(--gradient-card);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    box-shadow: var(--shadow-sm), var(--shadow-inset);
    backdrop-filter: blur(8px);
    transition: transform var(--transition), box-shadow var(--transition);
}

.mini-chart-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow), var(--shadow-inset);
}

.mini-chart-card h4 {
    font-size: 0.80rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

/* ========================= EMPTY STATE ========================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
    text-align: center;
    gap: 0.75rem;
}

.empty-state-icon {
    font-size: 2.5rem;
    opacity: 0.4;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ========================= RESPONSIVE ========================= */
@media (max-width: 768px) {
    .main-nav {
        flex-direction: column;
        height: auto;
        gap: 0.5rem;
        padding: 0.6rem 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
    }

    .container {
        padding: 1.25rem 1rem 2rem;
    }

    h1 {
        font-size: 1.4rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================= EXPORT DROPDOWN ========================= */
.export-group {
    position: relative;
    display: inline-block;
}

.export-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    min-width: 180px;
    display: none;
    overflow: hidden;
    animation: slideDown 0.2s ease-out;
}

.export-group:hover .export-menu {
    display: block;
}

.export-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all var(--transition);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.export-item:last-child {
    border-bottom: none;
}

.export-item:hover {
    background: rgba(0, 87, 184, 0.06);
    color: var(--accent);
}

.export-item .icon {
    font-size: 1.1rem;
    opacity: 0.8;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================= NESTED ACCORDIONS ========================= */
.section-accordion {
    margin-bottom: 1.5rem;
    border-left: 4px solid var(--accent);
}

.section-header {
    background: rgba(0, 87, 184, 0.04);
    font-size: 1rem;
    padding: 1.25rem;
}

.section-icon,
.question-icon {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

.nested-questions-container {
    padding: 0.5rem 0 0.5rem 1rem;
    border-left: 1px dashed var(--border);
    margin-left: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.question-accordion {
    border: 1px solid var(--border-glass);
    box-shadow: none;
}

.question-header {
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
}

.question-accordion.active .question-header {
    background: white;
}
/* ========================= SURVEY PICKER BAR ========================= */
.survey-picker-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.65rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
}

.survey-picker-bar label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.survey-picker-bar select {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    padding: 0.38rem 0.75rem;
    font-size: 0.85rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.survey-picker-bar select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.survey-picker-bar .badge-ativa-bot,
.survey-picker-badge {
    background: var(--success-light);
    color: var(--success);
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    white-space: nowrap;
}

.survey-picker-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* ========================= PESQUISA CARDS ========================= */
.pesquisas-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.pesquisa-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.pesquisa-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Faixa de status no topo */
.pesquisa-card-stripe {
    height: 5px;
    width: 100%;
    background: var(--border);
}
.pesquisa-card.is-ativa .pesquisa-card-stripe,
.pesquisa-card[data-status="ativa"] .pesquisa-card-stripe {
    background: var(--success);
}
.pesquisa-card[data-status="encerrada"] .pesquisa-card-stripe {
    background: var(--danger);
}
.pesquisa-card[data-status="rascunho"] .pesquisa-card-stripe {
    background: #ca8a04;
}

.pesquisa-card-body {
    padding: 1.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    flex: 1;
}

.pesquisa-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.pesquisa-card-nome {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.pesquisa-card-codigo {
    font-family: monospace;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--accent-light);
    padding: 0.18rem 0.55rem;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

.pesquisa-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}

.pesquisa-card-badges {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.pesquisa-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    padding-top: 0.2rem;
    border-top: 1px solid var(--border);
}

.pesquisa-card-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.pesquisa-card-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.6rem;
    padding: 1rem 1.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
}

.pesquisa-card-actions .btn {
    justify-content: center;
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
    gap: 0.4rem;
}

.pesquisa-card-actions .btn svg,
.btn svg {
    flex-shrink: 0;
    display: block;
}

/* Status badges */
.badge-rascunho {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.badge-ativa {
    background: var(--success-light);
    color: var(--success);
}

.badge-encerrada {
    background: var(--danger-light);
    color: var(--danger);
}

/* Pulse dot for active survey */
.pesquisa-status-pulse {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.pesquisa-status-pulse::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.85); }
}

/* ========================= RODAPÉ ========================= */
.site-footer {
    margin-left: 260px;
    padding: 1.1rem 2rem;
    border-top: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    flex-wrap: wrap;
    text-align: center;
}

.site-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.site-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .site-footer { margin-left: 0; }
}


/* Loader para botões */
.loader-sw {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin-sw 0.8s linear infinite;
    display: inline-block;
    margin-right: 5px;
}
@keyframes spin-sw {
    to { transform: rotate(360deg); }
}

/* ========================= SKELETON LOADER ========================= */
.skel {
    height: 14px;
    border-radius: var(--radius-sm);
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
    background-size: 200%;
    animation: shimmer 1.4s infinite;
}

@keyframes shimmer {
    to { background-position: -200% center; }
}