/* ============================================================
   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=DM+Sans:opsz,wght@9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* ─── Paleta nominal (para referência direta) ─── */
    --color-blue: #0064E0;
    /* Meta Blue — Primary AW7 */
    --color-green: #31A24C;
    /* Sucesso */
    --color-gold: #F7B928;
    /* Aviso / destaque */
    --color-navy: #0143B5;
    /* Azul hover */
    --color-red-err: #E41E3F;
    /* Erro */
    --color-green-ok: #31A24C;
    /* Sucesso semântico */
    --color-amber: #D97706;
    /* Aviso */

    /* ─── Papéis funcionais ─── */
    --accent: #0064E0;
    --accent-hover: #0143B5;
    --accent-glow: rgba(0, 100, 224, 0.20);
    --accent-light: #E8F3FF;

    --success: #31A24C;
    --success-light: rgba(49, 162, 76, 0.12);

    --danger: #E41E3F;
    --danger-light: rgba(228, 30, 63, 0.10);

    --warning: #D97706;
    --warning-light: rgba(247, 185, 40, 0.16);

    --gold: #F7B928;
    --gold-light: rgba(247, 185, 40, 0.18);
    --gold-dark: #8a5a00;
    /* texto sobre fundo gold */

    --purple: #6441D2;

    /* ─── Backgrounds ─── */
    --bg-primary: #F1F4F7;
    --bg-secondary: #F7F8FA;
    --bg-card: #FFFFFF;
    --bg-card-hover: #FFFFFF;
    --bg-glass: #FFFFFF;
    --bg-glass-dark: rgba(28, 30, 33, 0.85);

    /* ─── Texto ─── */
    --text-primary: #1C2B33;
    --text-secondary: #5D6C7B;
    --text-muted: #8595A4;
    --black: #1C2B33;

    /* ─── Bordas ─── */
    --border: #DEE3E9;
    --border-glass: #DEE3E9;
    --border-subtle: #CED0D4;

    /* ─── Superfície de cards ─── */
    --surface: #FFFFFF;

    /* ─── Aliases de compatibilidade ─── */
    --border-color: #DEE3E9;
    --primary: #0064E0;
    --primary-light: #E8F3FF;
    --muted: #8595A4;
    --secondary: #31A24C;
    --radius-card: 20px;

    /* ─── Cores extras ─── */
    --dodger-blue: #47A5FA;

    /* ─── Sombras ─── */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 28px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-accent: 0 4px 16px rgba(0, 100, 224, 0.20);
    --shadow-inset: none;

    /* ─── Gradientes ─── */
    --gradient-bg: #F1F4F7;
    --gradient-accent: linear-gradient(135deg, #0064E0 0%, #0143B5 100%);
    --gradient-success: linear-gradient(135deg, #31A24C 0%, #007D1E 100%);
    --gradient-danger: linear-gradient(135deg, #E41E3F 0%, #C80A28 100%);
    --gradient-gold: linear-gradient(135deg, #F7B928 0%, #E6A800 100%);
    --gradient-card: #FFFFFF;
    --gradient-nav: #FFFFFF;
    --gradient-hero: linear-gradient(135deg, #0064E0 0%, #0143B5 60%, #004BB9 100%);

    /* ─── Transições ─── */
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* ─── Border radius ─── */
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius: 20px;
    --radius-lg: 24px;
    --radius-xl: 28px;
}

/* ============================= RESET ============================= */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    padding-top: var(--topbar-h);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body>* {
    position: relative;
    z-index: 1;
}

/* ========================= BARRA SUPERIOR ========================= */
:root { --topbar-h: 64px; }
.topbar {
    position: fixed; top: 0; left: 0; right: 0; height: var(--topbar-h);
    background: #FFFFFF; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.25rem 0 1rem; z-index: 1200;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.topbar-left { flex: 1; min-width: 0; }
.topbar-right { flex: none; }
.topbar-sep { width: 1px; height: 32px; background: var(--border); flex: none; }
.topbar .header-page-info { min-width: 0; }
.topbar .header-page-title { font-size: 0.98rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.topbar .header-page-subtitle { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
/* seletor de pesquisa: pílula azul + menu próprio (o select nativo cortava o nome) */
.topbar-pesq { position: relative; flex: none; max-width: 520px; }
.topbar-pesq-btn { display: inline-flex; align-items: center; gap: 0.55rem; height: 36px; padding: 0 0.85rem 0 1rem; border: 0; border-radius: 100px; background: var(--gradient-accent, var(--accent)); color: #fff; font: inherit; cursor: pointer; max-width: 100%; box-shadow: 0 1px 2px rgba(0, 100, 224, 0.25); transition: filter .15s, transform .1s; }
.topbar-pesq-btn:hover { filter: brightness(1.06); }
.topbar-pesq-btn:active { transform: scale(.985); }
.topbar-pesq-btn:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
.topbar-pesq-nome { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 330px; }
.topbar-pesq-cod { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.68rem; font-weight: 600; color: rgba(255,255,255,0.85); background: rgba(255,255,255,0.18); border-radius: 100px; padding: 0.1rem 0.5rem; white-space: nowrap; }
.topbar-pesq-seta { width: 7px; height: 7px; border-right: 2px solid rgba(255,255,255,0.95); border-bottom: 2px solid rgba(255,255,255,0.95); transform: translateY(-2px) rotate(45deg); flex: none; }
.topbar-pesq-menu { position: absolute; top: calc(100% + 8px); left: 0; min-width: 360px; max-width: min(520px, calc(100vw - 32px)); background: #fff; border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 12px 28px rgba(0,0,0,0.14), 0 2px 4px rgba(0,0,0,0.06); padding: 0.4rem; z-index: 1300; }
.topbar-pesq-cab { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); padding: 0.45rem 0.75rem 0.35rem; }
.topbar-pesq-item { display: flex; align-items: center; gap: 0.6rem; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 10px; padding: 0.5rem 0.7rem; font: inherit; cursor: pointer; color: var(--text-primary); }
.topbar-pesq-item:hover, .topbar-pesq-item:focus-visible { background: var(--bg-secondary, #F7F8FA); outline: none; }
.topbar-pesq-item.atual { background: #E8F3FF; }
.tpi-check { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--border); flex: none; position: relative; }
.topbar-pesq-item.atual .tpi-check { border-color: var(--accent); background: var(--accent); }
.topbar-pesq-item.atual .tpi-check::after { content: ''; position: absolute; left: 4.5px; top: 2px; width: 4px; height: 7px; border-right: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(45deg); }
.tpi-txt { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.25; }
.tpi-nome { font-size: 0.84rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpi-sub { display: flex; gap: 0.5rem; align-items: center; font-size: 0.7rem; color: var(--text-muted); }
.tpi-sub code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.66rem; background: var(--bg-secondary, #F7F8FA); border-radius: 6px; padding: 0.05rem 0.4rem; color: var(--text-secondary); }
.tpi-sub i { font-style: normal; }
.tpi-status { flex: none; font-size: 0.64rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 100px; padding: 0.15rem 0.55rem; background: var(--bg-secondary, #F7F8FA); color: var(--text-muted); }
.tpi-status.ok { background: #E9F5ED; color: #1A7F37; }
.tpi-status.fim { background: #F2F4F7; color: #667085; }
.tpi-status.draft { background: #FFF6E5; color: #B45309; }
@media (max-width: 1200px) { .topbar .header-page-subtitle { display: none; } }
@media (max-width: 1024px) { .topbar-sep, .topbar .header-page-info { display: none; } .topbar-pesq { max-width: 230px; } .topbar-pesq-nome { max-width: 130px; } .topbar-pesq-cod { display: none; } .topbar-pesq-menu { position: fixed; left: 12px; right: 12px; top: calc(var(--topbar-h) + 6px); min-width: 0; max-width: none; } }
@media (max-width: 768px) { #sp-abs-header { display: none; } .topbar-right { gap: 0.5rem; } }
@media (max-width: 480px) { .topbar-pesq { max-width: 150px; } .topbar-pesq-nome { max-width: 95px; font-size: 0.74rem; } .topbar-pesq-btn { padding: 0 0.7rem; height: 32px; } }
.topbar-brand { display: flex; align-items: center; height: 100%; text-decoration: none; }
.topbar-brand img { width: 150px; max-height: 46px; height: auto; display: block; object-fit: contain; }
.topbar-menu { display: none; border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 36px; height: 36px; font-size: 1.1rem; cursor: pointer; color: var(--text-secondary); }
.topbar-status { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; font-weight: 600; color: var(--text-secondary); }
.topbar-status i { width: 8px; height: 8px; border-radius: 50%; background: #16A34A; display: inline-block; animation: pulse-dot 2s infinite; }
.topbar-time { font-size: 0.76rem; color: var(--text-muted); font-weight: 500; white-space: nowrap; }
.topbar-user { text-decoration: none; display: flex; align-items: center; gap: 0.55rem; padding: 0.25rem 0.6rem 0.25rem 0.3rem; border-radius: 100px; background: var(--bg-secondary, #F7F8FA); max-width: 240px; }
.topbar-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 0.72rem; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.topbar-user-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.topbar-user-txt b { font-size: 0.78rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-user-txt small { font-size: 0.65rem; color: var(--text-muted); }
.topbar-sair { border: 1px solid var(--border); background: #fff; color: var(--text-secondary); border-radius: 100px; padding: 0.35rem 0.85rem; font: inherit; font-size: 0.76rem; font-weight: 600; cursor: pointer; transition: background .15s, color .15s; }
.topbar-sair:hover { background: #FDECEF; color: #C4314B; border-color: #F5C2CB; }
@media (max-width: 1024px) {
    .topbar-menu { display: inline-flex; align-items: center; justify-content: center; }
    .topbar-time, .topbar-status { display: none; }
    .topbar-user-txt { display: none; }
    .topbar-user { padding-right: 0.3rem; }
}
@media (max-width: 480px) {
    .topbar-brand img { width: 124px; }
}

/* ========================= SIDEBAR ========================= */
.main-sidebar {
    width: 260px;
    height: calc(100vh - var(--topbar-h));
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    background: #FFFFFF;
    border-right: 1px solid var(--border);
    z-index: 1100;
    padding: 1.25rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    transition: transform var(--transition);
}

.sidebar-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand img.brand-logo {
    width: 130px;
    height: auto;
    display: block;
}

.sidebar-brand .brand-sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

.sidebar-links {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--border-subtle) transparent;
}

.sidebar-links::-webkit-scrollbar {
    width: 4px;
}

.sidebar-links::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-links::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 99px;
}

.sidebar-group-label {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: var(--text-muted);
    padding: 0.9rem 0.75rem 0.3rem;
    user-select: none;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #4B4C4F;
    text-decoration: none;
    padding: 0.55rem 0.75rem;
    border-radius: 12px;
    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: var(--text-primary);
    background: var(--bg-primary);
}

.sidebar-link:hover .icon {
    opacity: 1;
}

.sidebar-link.active {
    color: var(--accent);
    background: var(--accent-light);
    font-weight: 600;
}

.sidebar-link.active .icon {
    opacity: 1;
}

/* ========================= 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: var(--topbar-h);
    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;
}

@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);
}

/* ========================= MINI BARS (container) ========================= */
.mini-bars {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.1rem;
}

@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;
}

/* ========================= 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.2rem;
    border-radius: 100px;
    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: var(--gradient-accent);
    color: #fff;
    box-shadow: 0 2px 10px rgba(0, 100, 224, 0.30);
}

.btn-accent:hover {
    box-shadow: 0 4px 18px rgba(0, 100, 224, 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;
}

/* ========================= 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-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);
}

/* ========================= SKELETON / LOADING ========================= */
/* @keyframes shimmer fica na seção SKELETON LOADER (final do arquivo) */
.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: 200% 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--radius-sm);
}

/* ========================= 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;
    white-space: nowrap;
}

/* ========================= 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;
}

/* ========================= 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;
}

/* ========================= 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 p {
    font-size: 0.9rem;
}

/* ========================= RESPONSIVE ========================= */
@media (max-width: 768px) {
    /* Header global: no celular ele quebra em linhas, nada sobrepõe nada. */
    .main-header {
        flex-wrap: wrap;
        height: auto;
        min-height: 56px;
        padding: 0.55rem 0.9rem;
        gap: 0.35rem 0.75rem;
    }

    .header-left {
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 0.4rem;
        min-width: 0;
    }

    .header-page-subtitle { display: none; }

    #header-pesquisa-info {
        margin-left: 0 !important;
        flex: 1 1 100%;
        min-width: 0;
    }

    #header-pesquisa-info > div:first-child { display: none; }

    #header-pesquisa-link { max-width: 100%; min-width: 0; }

    #header-pesquisa-nome {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 55vw;
    }

    .main-header .status-indicator,
    #header-time { display: none !important; }

    .header-actions { flex: 0 0 auto; margin-left: auto; }

    .stats-grid {
        grid-template-columns: 1fr 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;
    }
}

/* ========================= 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);
    }
}

/* ========================= SECTION HEADER (index.html) ========================= */
.section-header {
    background: rgba(0, 87, 184, 0.04);
    font-size: 1rem;
    padding: 1.25rem;
}

/* ========================= 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; }
}
/* ============================================================
   TEMA AW7 2026 — complementos de compatibilidade
   ============================================================ */

/* grupos.html usa .btn-secondary, que não existia — alias do outline */
.btn-secondary {
    background: #fff;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background: var(--accent-light);
}

/* Números sempre tabulares em KPIs e tabelas */
.stat-card .value,
.pub-kpi .value,
table td {
    font-variant-numeric: tabular-nums;
}

/* Toast compartilhado (digitacao, configuracoes, grupos, contatos)
   Mostra com .show ou .on; erro com .error ou .erro */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: #fff;
    padding: .7rem 1.4rem;
    border-radius: 100px;
    font-weight: 700;
    font-size: .9rem;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: none;
    max-width: min(92vw, 560px);
    text-align: center;
}
.toast.erro,
.toast.error { background: var(--danger); }
.toast.info { background: var(--accent); }
.toast.on,
.toast.show { display: block; }

/* Scrollbar padrão AW7 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #F1F4F7; }
::-webkit-scrollbar-thumb { background: #CED0D4; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #8595A4; }

/* Abas de grupo (Analisar / Análises IA / Pessoas) */
.page-tabs {
    margin-left: 260px;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 1rem 2rem 0;
    transition: margin-left var(--transition);
}

.page-tab {
    padding: 0.42rem 1.05rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: #fff;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
}

.page-tab:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.page-tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

@media (max-width: 1024px) {
    .page-tabs { margin-left: 0; padding: 0.75rem 1rem 0; }
}

/* Multiusuário: o que é só do admin some para leitor e adm. de equipe */
body.papel-leitor [data-so-admin], body.papel-equipe [data-so-admin], body.papel-cliente [data-so-admin], body.papel-digitador [data-so-admin] { display: none !important; }
body.papel-leitor .kpi-row, body.papel-equipe .kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
