/* ══════════════════════════════════════════════════════
   VoxEra Mia — Design System v3 · CRM Signal Dashboard
   ══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* ── Palette ── */
    --purple:      #7C3AED;
    --purple-2:    #6D28D9;
    --purple-soft: rgba(124,58,237,0.18);
    --purple-mid:  #8B5CF6;
    --pink:        #EC4899;
    --pink-2:      #DB2777;
    --pink-soft:   rgba(236,72,153,0.15);
    --orange:      #F97316;
    --orange-2:    #EA6C0D;
    --orange-soft: rgba(249,115,22,0.15);
    --teal:        #0EA5E9;
    --teal-soft:   rgba(14,165,233,0.15);
    --green:       #10B981;
    --green-soft:  rgba(16,185,129,0.15);
    --red:         #EF4444;
    --red-soft:    rgba(239,68,68,0.15);
    --yellow:      #F59E0B;
    --yellow-soft: rgba(245,158,11,0.15);

    /* ── Backgrounds ── */
    --bg:        #0D0B18;
    --surface:   #16122A;
    --surface-2: #1E1A34;

    /* ── Text ── */
    --text:      #EDE9FF;
    --text-2:    #A89BC4;
    --text-3:    #6B5F8A;
    --text-inv:  #FFFFFF;

    /* ── Border ── */
    --border:    rgba(255,255,255,0.06);
    --border-2:  rgba(255,255,255,0.11);

    /* ── Shadow ── */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
    --shadow:    0 4px 16px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.2);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.5), 0 4px 12px rgba(0,0,0,0.3);

    /* ── Shape ── */
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* ── Sidebar ── */
    --sidebar-w: 240px;

    /* ── Motion ── */
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
    --t:    0.18s var(--ease);
}

html { -webkit-font-smoothing: antialiased; }
body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    font-size: 14px;
    line-height: 1.5;
}

/* ══ SCROLLBAR ══ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.15); border-radius: 3px; }

/* ══════════════════════════════════════════════════════
   LOGIN
══════════════════════════════════════════════════════ */
.login-screen {
    width: 100%; min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7C3AED 0%, #EC4899 50%, #F97316 100%);
    position: relative;
}
.login-screen::before {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,0.15) 0%, transparent 60%);
}
.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    width: 100%; max-width: 400px;
    box-shadow: var(--shadow-lg);
    position: relative; z-index: 1;
}
.login-logo { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 1.75rem; }
.logo-icon {
    width: 44px; height: 44px; border-radius: var(--radius);
    background: linear-gradient(135deg, var(--purple), var(--pink));
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; font-weight: 800; color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.login-logo-text .brand { display: block; font-size: 1.1rem; font-weight: 700; color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif; }
.login-logo-text .sub { display: block; font-size: 0.75rem; color: var(--text-3); }
.login-title { font-size: 1.35rem; font-weight: 700; color: var(--text); margin-bottom: 0.25rem; font-family: 'Plus Jakarta Sans', sans-serif; }
.login-subtitle { font-size: 0.85rem; color: var(--text-3); margin-bottom: 1.5rem; }
.login-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.375rem; }
.form-group input {
    width: 100%; padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
    font-size: 0.9rem; background: var(--surface-2); color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
    outline: none;
}
.form-group input:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}
.login-error { font-size: 0.82rem; color: var(--red); min-height: 1rem; }
.btn-login {
    width: 100%; padding: 0.75rem;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    color: white; border: none; border-radius: var(--radius-sm);
    font-size: 0.95rem; font-weight: 600; cursor: pointer;
    transition: opacity var(--t), transform var(--t);
    font-family: 'Inter', sans-serif;
}
.btn-login:hover { opacity: 0.92; transform: translateY(-1px); }

/* ══════════════════════════════════════════════════════
   APP SHELL
══════════════════════════════════════════════════════ */
.app-shell { display: flex; width: 100%; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
    width: var(--sidebar-w); min-height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 8px rgba(0,0,0,0.04);
}
.sidebar-top { padding: 1.25rem 1rem 0.75rem; }
.sidebar-brand { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border); }
.sidebar-logo {
    width: 36px; height: 36px; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--purple), var(--pink));
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; font-weight: 800; color: white;
    font-family: 'Plus Jakarta Sans', sans-serif;
    flex-shrink: 0;
}
.sidebar-brand-text .name { display: block; font-size: 0.95rem; font-weight: 700; color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif; }
.sidebar-brand-text .tagline { display: block; font-size: 0.7rem; color: var(--text-3); }

.tenant-selector label { display: block; font-size: 0.7rem; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.375rem; }
.tenant-selector select {
    width: 100%; padding: 0.5rem 0.625rem; border: 1.5px solid var(--border-2);
    border-radius: var(--radius-sm); font-size: 0.82rem; background: var(--surface-2);
    color: var(--text); cursor: pointer; outline: none;
}
.tenant-selector select:focus { border-color: var(--purple); }

.sidebar-nav { flex: 1; padding: 0.5rem 0.75rem; overflow-y: auto; }
.nav-section { margin-bottom: 1.25rem; }
.nav-section-label { font-size: 0.68rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; padding: 0 0.5rem; margin-bottom: 0.375rem; }
.nav-item {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.5rem 0.625rem; border-radius: var(--radius-sm);
    cursor: pointer; transition: all var(--t);
    font-size: 0.875rem; color: var(--text-2); font-weight: 500;
    margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--purple-soft); color: var(--purple); font-weight: 600; }
.nav-item .icon { font-size: 1rem; width: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; gap: 0.5rem;
}
.user-pill { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--purple), var(--pink));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 700; color: white;
}
.user-info { min-width: 0; }
.user-name { font-size: 0.82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.7rem; color: var(--text-3); }
.btn-logout {
    background: none; border: none; color: var(--text-3);
    cursor: pointer; font-size: 1rem; padding: 0.25rem;
    border-radius: var(--radius-sm); transition: color var(--t);
    flex-shrink: 0;
}
.btn-logout:hover { color: var(--red); }

/* ── Main ── */
.main-content {
    flex: 1; margin-left: var(--sidebar-w);
    display: flex; flex-direction: column;
    min-height: 100vh;
}
.page-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1.25rem 1.75rem;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 10;
}
.page-header-left {}
.page-title { font-size: 1.2rem; font-weight: 700; color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif; }
.page-subtitle { font-size: 0.78rem; color: var(--text-3); margin-top: 1px; }
.page-body { padding: 1.5rem 1.75rem; flex: 1; }

/* ══════════════════════════════════════════════════════
   BUTTONS
══════════════════════════════════════════════════════ */
.btn {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.5rem 1rem; border-radius: var(--radius-sm);
    font-size: 0.85rem; font-weight: 600; cursor: pointer;
    border: none; transition: all var(--t); font-family: inherit;
    white-space: nowrap;
}
.btn-primary { background: var(--purple); color: white; }
.btn-primary:hover { background: var(--purple-2); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124,58,237,0.3); }
.btn-secondary { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border-2); }
.btn-secondary:hover { background: var(--bg); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: var(--red); color: white; }
.btn-sm { padding: 0.375rem 0.75rem; font-size: 0.8rem; }

/* ══════════════════════════════════════════════════════
   FORMS
══════════════════════════════════════════════════════ */
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-2); margin-bottom: 0.375rem; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 0.5625rem 0.75rem;
    border: 1.5px solid var(--border-2); border-radius: var(--radius-sm);
    font-size: 0.875rem; background: var(--surface); color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
    outline: none; font-family: inherit;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--purple);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.1);
}
.form-textarea { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; margin-bottom: 0.875rem; }
.form-group { margin-bottom: 0.875rem; }

/* ══════════════════════════════════════════════════════
   PANELS
══════════════════════════════════════════════════════ */
.panel {
    background: var(--surface); border-radius: var(--radius-lg);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.panel-header {
    padding: 1rem 1.25rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.panel-title { font-size: 0.875rem; font-weight: 700; color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif; }
.panel-meta { font-size: 0.72rem; color: var(--text-3); }
.panel-body { padding: 1.25rem; }

/* ══════════════════════════════════════════════════════
   KPI CARDS
══════════════════════════════════════════════════════ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.kpi-grid-6 {
    grid-template-columns: repeat(3, 1fr);
}
.kpi-card {
    border-radius: var(--radius-lg); padding: 1.25rem 1.375rem;
    position: relative; overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.kpi-card::before {
    content: ''; position: absolute;
    top: -30px; right: -30px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
}
.kpi-card.kp-purple { background: linear-gradient(135deg, #7C3AED, #9D5CF5); color: white; }
.kpi-card.kp-pink   { background: linear-gradient(135deg, #EC4899, #F472B6); color: white; }
.kpi-card.kp-orange { background: linear-gradient(135deg, #F97316, #FB923C); color: white; }
.kpi-card.kp-teal   { background: linear-gradient(135deg, #0EA5E9, #38BDF8); color: white; }
.kpi-card.kp-green  { background: linear-gradient(135deg, #10B981, #34D399); color: white; }
.kpi-card.kp-dark   { background: linear-gradient(135deg, #1E1B4B, #312E81); color: white; }
.kpi-label { font-size: 0.75rem; font-weight: 600; opacity: 0.85; margin-bottom: 0.625rem; letter-spacing: 0.02em; }
.kpi-value { font-size: 2.25rem; font-weight: 800; font-family: 'Plus Jakarta Sans', sans-serif; line-height: 1; margin-bottom: 0.5rem; }
.kpi-footer { font-size: 0.72rem; opacity: 0.75; }
.kpi-icon { position: absolute; top: 1rem; right: 1.25rem; font-size: 1.5rem; opacity: 0.4; }

/* ══════════════════════════════════════════════════════
   DASHBOARD GRIDS
══════════════════════════════════════════════════════ */
.dash-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 1rem; margin-bottom: 1rem;
}
.dash-grid-3 {
    display: grid; grid-template-columns: 1.6fr 1fr;
    gap: 1rem; margin-bottom: 1rem;
}
.dash-grid-full { margin-bottom: 1rem; }

/* ══════════════════════════════════════════════════════
   DONUT CHART (CSS)
══════════════════════════════════════════════════════ */
.donut-wrap { display: flex; align-items: center; gap: 1.5rem; }
.donut {
    width: 100px; height: 100px;
    border-radius: 50%;
    flex-shrink: 0;
    position: relative;
}
.donut-center {
    position: absolute; inset: 16px;
    border-radius: 50%; background: var(--surface);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
}
.donut-center-value { font-size: 1.1rem; font-weight: 800; color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif; }
.donut-center-label { font-size: 0.6rem; color: var(--text-3); }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; }
.donut-item { display: flex; align-items: center; gap: 0.5rem; }
.donut-dot { width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.donut-item-label { font-size: 0.78rem; color: var(--text-2); flex: 1; }
.donut-item-val { font-size: 0.78rem; font-weight: 700; color: var(--text); }

/* ══════════════════════════════════════════════════════
   SIGNAL FEED
══════════════════════════════════════════════════════ */
.signal-feed { display: flex; flex-direction: column; gap: 0.5rem; max-height: 340px; overflow-y: auto; }
.signal-item {
    display: flex; align-items: flex-start; gap: 0.625rem;
    padding: 0.625rem 0.75rem; border-radius: var(--radius-sm);
    background: var(--bg); border: 1px solid var(--border);
    transition: background var(--t);
}
.signal-item:hover { background: var(--surface-2); }
.signal-icon {
    width: 28px; height: 28px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; flex-shrink: 0;
}
.signal-body { flex: 1; min-width: 0; }
.signal-tipo { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1px; }
.signal-desc { font-size: 0.78rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal-meta { font-size: 0.68rem; color: var(--text-3); margin-top: 1px; }
.signal-badge {
    font-size: 0.65rem; font-weight: 700; padding: 0.125rem 0.375rem;
    border-radius: 20px; flex-shrink: 0; align-self: center;
}

/* Signal type colors — dark mode */
.sig-apoio_forte      { background: rgba(16,185,129,0.1); } .sig-apoio_forte .signal-tipo { color: #34D399; } .sig-apoio_forte .signal-icon { background: rgba(16,185,129,0.18); color: #34D399; }
.sig-quer_participar  { background: rgba(124,58,237,0.12); } .sig-quer_participar .signal-tipo { color: var(--purple-mid); } .sig-quer_participar .signal-icon { background: rgba(124,58,237,0.2); color: var(--purple-mid); }
.sig-interesse_produto,.sig-interesse_pauta { background: rgba(249,115,22,0.1); } .sig-interesse_produto .signal-tipo,.sig-interesse_pauta .signal-tipo { color: #FB923C; } .sig-interesse_produto .signal-icon,.sig-interesse_pauta .signal-icon { background: rgba(249,115,22,0.18); color: #FB923C; }
.sig-reclamacao_saude,.sig-reclamacao_seguranca,.sig-reclamacao_educacao,.sig-reclamacao_infraestrutura,.sig-reclamacao_outro { background: rgba(239,68,68,0.1); }
.sig-reclamacao_saude .signal-tipo,.sig-reclamacao_seguranca .signal-tipo,.sig-reclamacao_educacao .signal-tipo,.sig-reclamacao_infraestrutura .signal-tipo,.sig-reclamacao_outro .signal-tipo { color: #F87171; }
.sig-reclamacao_saude .signal-icon,.sig-reclamacao_seguranca .signal-icon,.sig-reclamacao_educacao .signal-icon,.sig-reclamacao_infraestrutura .signal-icon,.sig-reclamacao_outro .signal-icon { background: rgba(239,68,68,0.18); color: #F87171; }
.sig-pedido_agenda    { background: rgba(14,165,233,0.1); } .sig-pedido_agenda .signal-tipo { color: #38BDF8; } .sig-pedido_agenda .signal-icon { background: rgba(14,165,233,0.18); color: #38BDF8; }
.sig-objacao          { background: rgba(245,158,11,0.1); } .sig-objacao .signal-tipo { color: #FCD34D; } .sig-objacao .signal-icon { background: rgba(245,158,11,0.18); color: #FCD34D; }
.sig-lider_potencial  { background: rgba(236,72,153,0.1); } .sig-lider_potencial .signal-tipo { color: #F472B6; } .sig-lider_potencial .signal-icon { background: rgba(236,72,153,0.18); color: #F472B6; }
.sig-informou_territorio { background: rgba(124,58,237,0.08); } .sig-informou_territorio .signal-tipo { color: var(--text-2); } .sig-informou_territorio .signal-icon { background: rgba(124,58,237,0.18); color: var(--purple-mid); }
.sig-tem_grupo_local  { background: rgba(124,58,237,0.08); } .sig-tem_grupo_local .signal-tipo { color: var(--purple-mid); } .sig-tem_grupo_local .signal-icon { background: rgba(124,58,237,0.18); color: var(--purple-mid); }
.sig-pediu_material   { background: rgba(249,115,22,0.08); } .sig-pediu_material .signal-tipo { color: #FB923C; } .sig-pediu_material .signal-icon { background: rgba(249,115,22,0.15); color: #FB923C; }
.sig-citou_concorrente{ background: rgba(239,68,68,0.08); } .sig-citou_concorrente .signal-tipo { color: #F87171; } .sig-citou_concorrente .signal-icon { background: rgba(239,68,68,0.15); color: #F87171; }
.sig-recusou_contato  { background: rgba(255,255,255,0.04); } .sig-recusou_contato .signal-tipo { color: var(--text-3); } .sig-recusou_contato .signal-icon { background: rgba(255,255,255,0.06); color: var(--text-3); }

/* Intensity badge — dark mode */
.int-alta   { background: rgba(16,185,129,0.18); color: #34D399; }
.int-media  { background: rgba(245,158,11,0.18); color: #FCD34D; }
.int-baixa  { background: rgba(255,255,255,0.06); color: var(--text-3); }

/* ══════════════════════════════════════════════════════
   TERRITORY LIST
══════════════════════════════════════════════════════ */
.territory-list { display: flex; flex-direction: column; gap: 0.5rem; }
.territory-item { display: flex; align-items: center; gap: 0.75rem; }
.territory-name { font-size: 0.82rem; color: var(--text-2); width: 120px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.territory-bar-wrap { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.territory-bar { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--purple), var(--pink)); }
.territory-count { font-size: 0.78rem; font-weight: 700; color: var(--text); width: 24px; text-align: right; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   CONV FEED (recent conversations)
══════════════════════════════════════════════════════ */
.conv-feed { display: flex; flex-direction: column; gap: 0; }
.conv-feed-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.75rem 0; border-bottom: 1px solid var(--border);
    cursor: pointer; transition: background var(--t);
    border-radius: var(--radius-sm);
    padding-left: 0.375rem; padding-right: 0.375rem;
}
.conv-feed-item:last-child { border-bottom: none; }
.conv-feed-item:hover { background: var(--bg); }
.conv-avatar {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.85rem; font-weight: 700; color: white;
}
.conv-info { flex: 1; min-width: 0; }
.conv-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-preview { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-side { text-align: right; flex-shrink: 0; }
.conv-time { font-size: 0.7rem; color: var(--text-3); }

/* ══════════════════════════════════════════════════════
   BAR CHART
══════════════════════════════════════════════════════ */
.bar-chart { display: flex; flex-direction: column; gap: 0.5rem; }
.bar-row { display: flex; align-items: center; gap: 0.75rem; }
.bar-label { font-size: 0.78rem; color: var(--text-2); width: 90px; flex-shrink: 0; text-align: right; }
.bar-track { flex: 1; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; transition: width 0.6s var(--ease); }
.bar-value { font-size: 0.78rem; font-weight: 700; color: var(--text); width: 28px; flex-shrink: 0; }

/* Timeline bars */
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 80px; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.timeline-bar { width: 100%; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--purple), var(--pink)); min-height: 2px; transition: height 0.5s var(--ease); }
.bar-day { font-size: 0.6rem; color: var(--text-3); }

/* ══════════════════════════════════════════════════════
   BADGES & STATUS
══════════════════════════════════════════════════════ */
.badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.2rem 0.6rem; border-radius: 20px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
    white-space: nowrap;
}
.badge.green  { background: rgba(16,185,129,0.15); color: #34D399; }
.badge.blue   { background: rgba(14,165,233,0.15); color: #38BDF8; }
.badge.yellow { background: rgba(245,158,11,0.15); color: #FCD34D; }
.badge.red    { background: rgba(239,68,68,0.15); color: #F87171; }
.badge.purple { background: rgba(124,58,237,0.18); color: #A78BFA; }
.badge.orange { background: rgba(249,115,22,0.15); color: #FB923C; }
.badge.gray   { background: rgba(255,255,255,0.06); color: var(--text-3); }

/* Journey status — dark mode */
.journey-apoiador    { background: rgba(16,185,129,0.15); color: #34D399; }
.journey-simpatizante{ background: rgba(14,165,233,0.15); color: #38BDF8; }
.journey-voluntario  { background: rgba(124,58,237,0.18); color: #A78BFA; }
.journey-indeciso    { background: rgba(245,158,11,0.15); color: #FCD34D; }
.journey-opositor    { background: rgba(239,68,68,0.15); color: #F87171; }

/* ══════════════════════════════════════════════════════
   DATA TABLE
══════════════════════════════════════════════════════ */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    padding: 0.75rem 1rem; text-align: left;
    font-size: 0.72rem; font-weight: 700; color: var(--text-3);
    text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--surface-2); border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 0.75rem 1rem; font-size: 0.83rem; color: var(--text-2);
    border-bottom: 1px solid var(--border);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg); cursor: pointer; }
.data-table .td-main { font-weight: 600; color: var(--text); }

/* ══════════════════════════════════════════════════════
   FILTER BAR
══════════════════════════════════════════════════════ */
.filter-bar {
    display: flex; align-items: center; gap: 0.75rem;
    margin-bottom: 1rem; flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════
   MODAL
══════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,11,30,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(4px);
    padding: 1.5rem;
}
.modal {
    background: var(--surface); border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg); width: 100%; max-width: 520px;
    max-height: 90vh; display: flex; flex-direction: column;
    overflow: hidden;
}
.modal-xlarge { max-width: 960px; }
.modal-header {
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
    display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
    flex-shrink: 0;
}
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); font-family: 'Plus Jakarta Sans', sans-serif; }
.modal-subtitle { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }
.modal-close {
    background: none; border: none; font-size: 1.25rem;
    color: var(--text-3); cursor: pointer; padding: 0.125rem;
    border-radius: var(--radius-sm); transition: color var(--t);
    flex-shrink: 0; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid var(--border);
    display: flex; justify-content: flex-end; gap: 0.5rem; flex-shrink: 0;
}

/* Conversation detail modal */
.conv-detail-layout { display: grid; grid-template-columns: 280px 1fr; height: calc(80vh - 80px); }
.crm-panel { border-right: 1px solid var(--border); overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.crm-section {}
.crm-section-title { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin-bottom: 0.5rem; padding-bottom: 0.375rem; border-bottom: 1px solid var(--border); }
.crm-field { margin-bottom: 0.5rem; }
.crm-field-label { font-size: 0.7rem; color: var(--text-3); margin-bottom: 1px; }
.crm-field-value { font-size: 0.82rem; color: var(--text); font-weight: 500; }
.messages-panel { overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: 0.625rem; background: var(--bg); }
.msg-bubble { max-width: 72%; padding: 0.625rem 0.875rem; border-radius: 12px; font-size: 0.85rem; line-height: 1.45; }
.msg-bubble.user { background: var(--surface-2); border: 1px solid var(--border-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg-bubble.assistant { background: linear-gradient(135deg, var(--purple), var(--purple-mid)); color: white; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg-time { font-size: 0.65rem; opacity: 0.6; margin-top: 3px; }

/* Contact signals in modal */
.signals-mini { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.signal-chip {
    font-size: 0.68rem; font-weight: 600;
    padding: 0.2rem 0.5rem; border-radius: 20px;
}

/* ══════════════════════════════════════════════════════
   STATS LIST (top orgs)
══════════════════════════════════════════════════════ */
.stats-list { display: flex; flex-direction: column; gap: 0.625rem; }
.stats-item { display: flex; align-items: center; gap: 0.625rem; }
.stats-rank { font-size: 0.7rem; font-weight: 700; color: var(--text-3); width: 18px; flex-shrink: 0; }
.stats-bar-wrap { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.stats-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--purple), var(--pink)); }
.stats-label { font-size: 0.78rem; color: var(--text-2); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-count { font-size: 0.78rem; font-weight: 700; color: var(--text); width: 24px; text-align: right; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════
   EMPTY STATE
══════════════════════════════════════════════════════ */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 3rem 1rem; color: var(--text-3);
}
.empty-icon { font-size: 2rem; margin-bottom: 0.75rem; opacity: 0.5; }
.empty-title { font-size: 0.875rem; font-weight: 600; color: var(--text-2); }
.empty-sub { font-size: 0.78rem; color: var(--text-3); margin-top: 0.25rem; }
.loading-spinner {
    width: 24px; height: 24px;
    border: 2px solid var(--border-2);
    border-top-color: var(--purple);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{ opacity:1 } 50%{ opacity:0.4 } }

/* ══════════════════════════════════════════════════════
   LIVE INDICATOR
══════════════════════════════════════════════════════ */
.live-bar {
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green); box-shadow: 0 0 6px var(--green);
    animation: pulse 2s infinite; flex-shrink: 0;
}
.live-label { font-size: 0.75rem; color: var(--text-3); font-weight: 500; }
.live-updated { font-size: 0.72rem; color: var(--text-3); }
.btn-calendar {
    font-size: 0.78rem; font-weight: 600;
    background: linear-gradient(135deg, #1967D2, #4285F4);
    color: white; border: none; border-radius: var(--radius);
    padding: 0.3rem 0.75rem; cursor: pointer;
    transition: opacity 0.15s;
}
.btn-calendar:hover { opacity: 0.88; }

/* ══════════════════════════════════════════════════════
   APPOINTMENTS PANEL
══════════════════════════════════════════════════════ */
.appt-list { display: flex; flex-direction: column; gap: 0; }
.appt-item {
    display: grid;
    grid-template-columns: 2.5rem 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
    cursor: default;
}
.appt-item:last-child { border-bottom: none; }
.appt-item:hover { background: var(--hover); }
.appt-avatar {
    width: 2.25rem; height: 2.25rem; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.9rem; color: #fff; flex-shrink: 0;
}
.appt-info { min-width: 0; }
.appt-name { font-weight: 600; font-size: 0.875rem; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt-sub  { font-size: 0.75rem; color: var(--text-3); margin-top: 0.1rem; }
.appt-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.appt-date { font-size: 0.75rem; color: var(--text-3); white-space: nowrap; }
.appt-cal-link {
    font-size: 0.72rem; font-weight: 600;
    color: #4285F4; text-decoration: none; display: flex; align-items: center; gap: 0.2rem;
}
.appt-cal-link:hover { text-decoration: underline; }

/* ══════════════════════════════════════════════════════
   DOCUMENTS PAGE
══════════════════════════════════════════════════════ */
.rag-result { padding: 0.75rem; background: var(--bg); border-radius: var(--radius-sm); margin-bottom: 0.5rem; }
.rag-result-title { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; }
.rag-result-text { font-size: 0.78rem; color: var(--text-2); line-height: 1.5; }
.rag-result-score { font-size: 0.7rem; color: var(--text-3); margin-top: 0.25rem; }

/* ══════════════════════════════════════════════════════
   TOAST
══════════════════════════════════════════════════════ */
#toast {
    position: fixed; bottom: 1.5rem; right: 1.5rem;
    z-index: 9999; display: flex; flex-direction: column; gap: 0.5rem;
}
.toast-item {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0.75rem 1rem;
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem; font-weight: 500; color: var(--text);
    display: flex; align-items: center; gap: 0.5rem;
    animation: toastIn 0.3s var(--ease);
    min-width: 240px;
}
.toast-item.success { border-left: 3px solid var(--green); }
.toast-item.error   { border-left: 3px solid var(--red); }
@keyframes toastIn { from { opacity:0; transform: translateY(10px); } to { opacity:1; transform: translateY(0); } }

/* ══════════════════════════════════════════════════════
   CRM — CONTACTS PAGE
══════════════════════════════════════════════════════ */
.crm-page { display: flex; flex-direction: column; gap: 1rem; }
.crm-toolbar {
    display: flex; align-items: center; gap: 0.625rem; flex-wrap: wrap;
    padding: 0.875rem 1rem;
    background: var(--surface); border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}
.crm-lider-check {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.82rem; color: var(--text-2); cursor: pointer; white-space: nowrap;
}
.crm-lider-check input { cursor: pointer; accent-color: var(--purple); }
.crm-total-badge {
    margin-left: auto; font-size: 0.75rem; font-weight: 700;
    color: var(--text-3); white-space: nowrap;
}

/* Journey badges in CRM table */
.jornada-badge {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.2rem 0.55rem; border-radius: 20px;
    font-size: 0.7rem; font-weight: 700; white-space: nowrap;
}
.jornada-apoiador     { background: rgba(16,185,129,0.15); color: #34D399; }
.jornada-simpatizante { background: rgba(14,165,233,0.15); color: #38BDF8; }
.jornada-voluntario   { background: rgba(124,58,237,0.18); color: #A78BFA; }
.jornada-indeciso     { background: rgba(245,158,11,0.15); color: #FCD34D; }
.jornada-opositor     { background: rgba(239,68,68,0.15);  color: #F87171; }
.eng-alto   { background: rgba(16,185,129,0.12); color: #34D399; font-size:0.68rem; padding:0.15rem 0.45rem; border-radius:20px; font-weight:700; }
.eng-medio  { background: rgba(245,158,11,0.12); color: #FCD34D; font-size:0.68rem; padding:0.15rem 0.45rem; border-radius:20px; font-weight:700; }
.eng-baixo  { background: rgba(255,255,255,0.06); color: var(--text-3); font-size:0.68rem; padding:0.15rem 0.45rem; border-radius:20px; font-weight:700; }

/* ══════════════════════════════════════════════════════
   MAPA ELEITORAL
══════════════════════════════════════════════════════ */
.mapa-page {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 1rem;
    height: calc(100vh - 140px);
    min-height: 520px;
}
.mapa-sidebar {
    background: var(--surface); border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 1rem; overflow-y: auto;
    display: flex; flex-direction: column; gap: 1rem;
}
.mapa-legend-title {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.07em; color: var(--text-3);
    margin-bottom: 0.5rem;
}
.legend-item {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8rem; color: var(--text-2); margin-bottom: 0.3rem;
}
.legend-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.mapa-territory-list { display: flex; flex-direction: column; gap: 0.375rem; max-height: 200px; overflow-y: auto; }
.mapa-territory-item {
    font-size: 0.75rem; color: var(--text-2);
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.25rem 0.375rem; border-radius: 4px;
    cursor: pointer; transition: background var(--t);
}
.mapa-territory-item:hover { background: var(--bg); }
.mapa-territory-count { font-weight: 700; color: var(--text); }
.mapa-radio, .mapa-check {
    display: flex; align-items: center; gap: 0.4rem;
    font-size: 0.8rem; color: var(--text-2); cursor: pointer;
}
.mapa-radio input, .mapa-check input { cursor: pointer; accent-color: var(--purple); }
.mapa-container {
    position: relative; border-radius: var(--radius-lg);
    overflow: hidden; border: 1px solid var(--border);
}
.google-map { width: 100%; height: 100%; }
.mapa-loading {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.75rem; background: rgba(13,11,24,0.7);
    backdrop-filter: blur(4px);
    font-size: 0.85rem; color: var(--text-3);
    z-index: 10;
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 1400px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1024px) {
    :root { --sidebar-w: 64px; }
    .sidebar-brand-text, .nav-item span:not(.icon), .nav-section-label,
    .tenant-selector, .user-info { display: none; }
    .sidebar-brand { justify-content: center; }
    .nav-item { justify-content: center; padding: 0.625rem; }
    .sidebar-footer { justify-content: center; padding: 0.75rem 0.5rem; }
}
@media (max-width: 768px) {
    .dash-grid, .dash-grid-3 { grid-template-columns: 1fr; }
    .conv-detail-layout { grid-template-columns: 1fr; }
    .page-body { padding: 1rem; }
    .form-row { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   ATHIA — INTELIGÊNCIA TERRITORIAL
══════════════════════════════════════════════════════ */

/* 4-column KPI grid */
.kpi-grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Main layout: territory table (wide) + priority sidebar */
.athia-page { display: flex; flex-direction: column; gap: 1rem; }
.athia-grid-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1rem;
    margin-bottom: 0;
}

/* ── Priority ranking list ── */
.athia-priority-item {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--border);
}
.athia-priority-item:last-child { border-bottom: none; }
.athia-priority-rank {
    width: 22px; height: 22px; border-radius: 6px;
    background: var(--surface-2); display: flex; align-items: center;
    justify-content: center; font-size: 0.72rem; font-weight: 700;
    color: var(--text-3); flex-shrink: 0;
}
.athia-priority-name {
    flex: 1; font-size: 0.82rem; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.athia-priority-meta {
    font-size: 0.72rem; color: var(--text-3); white-space: nowrap;
}
.athia-prio-badge {
    font-size: 0.65rem; font-weight: 700; padding: 0.1rem 0.45rem;
    border-radius: 20px; white-space: nowrap;
}
.athia-prio-alta  { background: rgba(16,185,129,0.2);  color: #34D399; }
.athia-prio-media { background: rgba(245,158,11,0.2);  color: #F59E0B; }
.athia-prio-baixa { background: rgba(107,114,128,0.2); color: #9CA3AF; }

/* ── Territory table priority badge ── */
.prio-alta  { color: #10B981; font-weight: 700; font-size: 0.75rem; }
.prio-media { color: #F59E0B; font-weight: 700; font-size: 0.75rem; }
.prio-baixa { color: #6B7280; font-weight: 600; font-size: 0.75rem; }

/* ── Density bar ── */
.density-bar-wrap {
    display: flex; align-items: center; gap: 0.375rem;
}
.density-bar-track {
    flex: 1; height: 5px; border-radius: 3px;
    background: var(--surface-2); min-width: 40px;
}
.density-bar-fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, #10B981, #34D399);
    transition: width 0.3s ease;
}
.density-pct { font-size: 0.72rem; color: var(--text-2); white-space: nowrap; }

/* ── Themes list ── */
.athia-theme-territory {
    margin-bottom: 0.875rem;
}
.athia-theme-territory-name {
    font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.06em; color: var(--text-3); margin-bottom: 0.375rem;
}
.athia-theme-chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.athia-theme-chip {
    display: inline-flex; align-items: center; gap: 0.25rem;
    padding: 0.2rem 0.6rem; border-radius: 20px; font-size: 0.73rem;
    background: var(--surface-2); color: var(--text-2);
    border: 1px solid var(--border);
}
.athia-theme-chip-count {
    font-weight: 700; color: var(--accent); font-size: 0.68rem;
}

/* ── TSE empty state ── */
.athia-tse-empty {
    display: flex; flex-direction: column; align-items: center;
    text-align: center; padding: 1rem 0.5rem;
}
.athia-tse-icon { font-size: 2rem; margin-bottom: 0.625rem; opacity: 0.7; }
.athia-tse-title { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 0.375rem; }
.athia-tse-desc  { font-size: 0.78rem; color: var(--text-2); margin-bottom: 0.75rem; }
.athia-tse-list {
    list-style: none; text-align: left; width: 100%;
    display: flex; flex-direction: column; gap: 0.35rem; padding: 0;
}
.athia-tse-list li {
    font-size: 0.78rem; color: var(--text-3);
    padding-left: 1.1rem; position: relative;
}
.athia-tse-list li::before {
    content: '→'; position: absolute; left: 0; color: var(--teal); font-size: 0.72rem;
}

/* ── ATHIA formula cards ── */
.athia-formulas {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.875rem;
}
.athia-formula-card {
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 1rem; position: relative;
}
.athia-formula-badge {
    font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em;
    padding: 0.125rem 0.4rem; border-radius: 4px; margin-bottom: 0.5rem;
    display: inline-block;
}
.athia-fc-live    { border-color: rgba(16,185,129,0.3); }
.athia-fc-live    .athia-formula-badge { background: rgba(16,185,129,0.15); color: #34D399; }
.athia-fc-tse     { border-color: rgba(14,165,233,0.3); }
.athia-fc-tse     .athia-formula-badge { background: rgba(14,165,233,0.15); color: #38BDF8; }
.athia-fc-partial { border-color: rgba(245,158,11,0.3); }
.athia-fc-partial .athia-formula-badge { background: rgba(245,158,11,0.15); color: #F59E0B; }
.athia-formula-name {
    font-size: 0.82rem; font-weight: 700; color: var(--text); margin-bottom: 0.375rem;
}
.athia-formula-expr {
    font-size: 0.78rem; color: var(--text-2); font-style: italic;
    margin-bottom: 0.5rem; line-height: 1.4;
    font-family: 'Plus Jakarta Sans', sans-serif;
}
.athia-formula-source { font-size: 0.7rem; color: var(--text-3); }

@media (max-width: 1100px) {
    .athia-formulas { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); }
    .athia-grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .athia-formulas { grid-template-columns: 1fr; }
}
