/* ══════════════════════════════════════════════════════════
   VORTEX — Design System
   Sistema de Governança Comercial
   ══════════════════════════════════════════════════════════ */

/* ── Google Fonts ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variables ─────────────────────────────────────── */
:root {
    color-scheme: dark;
    /* Typography */
    --font-sans: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-heading: 'Montserrat', sans-serif;

    /* Colors - Dark Theme */
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --bg-sidebar: rgba(15, 23, 42, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --bg-input: rgba(255, 255, 255, 0.06);
    --multi-select-bg: #111827;

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --text-accent: #38bdf8;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(56, 189, 248, 0.3);

    /* Status Colors */
    --green: #22c55e;
    --green-bg: rgba(34, 197, 94, 0.12);
    --green-border: rgba(34, 197, 94, 0.3);
    --yellow: #eab308;
    --yellow-bg: rgba(234, 179, 8, 0.12);
    --yellow-border: rgba(234, 179, 8, 0.3);
    --red: #ef4444;
    --red-bg: rgba(239, 68, 68, 0.12);
    --red-border: rgba(239, 68, 68, 0.3);

    /* Temperature */
    --hot: #f97316;
    --hot-bg: rgba(249, 115, 22, 0.12);
    --warm: #eab308;
    --warm-bg: rgba(234, 179, 8, 0.12);
    --cold: #3b82f6;
    --cold-bg: rgba(59, 130, 246, 0.12);

    /* Accent Gradients */
    --gradient-primary: linear-gradient(135deg, #0A1F8F 0%, #00A0DF 100%);
    --gradient-success: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    --gradient-warning: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
    --gradient-danger: linear-gradient(135deg, #dc2626 0%, #ef4444 50%, #f87171 100%);
    --gradient-info: linear-gradient(135deg, #0284c7 0%, #0ea5e9 50%, #38bdf8 100%);
    --gradient-hero: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.15);
    --shadow-glow-red: 0 0 20px rgba(239, 68, 68, 0.15);
    --shadow-glow-blue: 0 0 20px rgba(56, 189, 248, 0.15);
    --shadow-glow-purple: 0 0 20px rgba(10, 31, 143, 0.2);

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --main-padding: 28px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Notification Colors - Dark Theme */
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-blue: #3b82f6;
}

/* ── Light Theme ───────────────────────────────────────── */
[data-theme="light"] {
    color-scheme: light;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(241, 245, 249, 0.95);
    --bg-sidebar: rgba(255, 255, 255, 0.98);
    --bg-glass: rgba(0, 0, 0, 0.02);
    --bg-glass-hover: rgba(0, 0, 0, 0.04);
    --bg-input: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-accent: #0284c7;
    --border-subtle: #e2e8f0;
    --multi-select-bg: #ffffff;
    --border-medium: rgba(0, 0, 0, 0.1);
    --border-accent: rgba(2, 132, 199, 0.3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);

    /* Notification Colors - Light Theme */
    --accent-green: #15803d;
    --accent-red: #b91c1c;
    --accent-blue: #0369a1;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--text-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ── Global Form Elements ───────────────────────────── */
select option {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Specific fix for some browsers where select background might still show light */
select {
    background-color: var(--bg-input);
    color: var(--text-primary);
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ══════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    pointer-events: none;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    bottom: -100px;
    left: -50px;
    pointer-events: none;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.6s ease-out;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-size: 1.75rem;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 6px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    outline: none;
}

.form-group input:focus {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    outline: none;
}

.btn-primary {
    width: 100%;
    background: var(--gradient-primary);
    color: #fff;
    padding: 14px;
    font-size: 0.95rem;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-medium);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn-clear-filters {
    background: transparent;
    color: var(--text-secondary);
    border: 1px dashed var(--border-medium);
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.btn-clear-filters:hover {
    color: var(--text-primary);
    border-color: var(--text-secondary);
    background: var(--bg-glass);
}

.ai-share-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    z-index: 100;
    min-width: 160px;
}

.ai-share-option {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    padding: 9px 14px;
    font-size: 0.85rem;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    white-space: nowrap;
}

.ai-share-option:hover {
    background: var(--bg-glass-hover);
}

.btn-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1rem;
    box-shadow: var(--shadow-sm);
}

.btn-icon:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-medium);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.login-error {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    display: none;
}

/* ══════════════════════════════════════════════════════════
   DASHBOARD LAYOUT
   ══════════════════════════════════════════════════════════ */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: width var(--transition-slow);
    overflow: hidden;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: var(--header-height);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: #fff;
    font-size: 1rem;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    transition: opacity var(--transition-base);
}

.sidebar-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .sidebar-title,
.sidebar.collapsed .sidebar-subtitle {
    opacity: 0;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 8px;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 4px;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar.collapsed .nav-section-label {
    opacity: 0;
    height: 0;
    padding: 0;
    margin: 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    position: relative;
    font-size: 0.9rem;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(0, 160, 223, 0.12);
    color: #00A0DF;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.nav-label {
    overflow: hidden;
    transition: opacity var(--transition-base);
}

.sidebar.collapsed .nav-label {
    opacity: 0;
    width: 0;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.logout-btn {
    background: none;
    border: none;
    width: 100%;
    color: var(--text-muted);
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    color: #ef4444 !important;
}

.sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    width: 100%;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.85rem;
}

.sidebar-toggle:hover {
    background: var(--bg-glass-hover);
    color: var(--text-secondary);
}

/* ── Main Content ──────────────────────────────────────── */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left var(--transition-slow);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-collapsed);
}

/* ── Header ────────────────────────────────────────────── */
.top-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px var(--main-padding);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: var(--header-height);
    flex-shrink: 0;
}

.header-left h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.header-left p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-actions .badge {
    padding: 0 16px;
    height: 38px;
    font-size: 0.85rem;
    font-weight: 700;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-green {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
}

.badge-yellow {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid var(--yellow-border);
}

.badge-red {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}

.badge-blue {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

/* Temperature Badges */
.badge-temp-quente {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Laranja */
.badge-temp-morno {
    background: rgba(234, 179, 8, 0.12);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

/* Amarelo */
.badge-temp-frio {
    background: rgba(14, 165, 233, 0.12);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

/* Azul Claro */
.badge-temp-congelado {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Azul Médio */

/* ── Module Content Area ───────────────────────────────── */
.module-content {
    padding: 24px var(--main-padding);
    position: relative;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

.module-section {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.module-section.active {
    display: block;
}

/* ══════════════════════════════════════════════════════════
   KPI CARDS (Module A)
   ══════════════════════════════════════════════════════════ */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.exec-radar-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-top: 8px;
    width: 50%;
}

.exec-radar-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.exec-radar-container {
    width: 100%;
}

/* ── Visão Geral — Gráficos ──────────────────────────── */
.exec-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.exec-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition-base);
}

.exec-chart-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.exec-chart-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.exec-chart-container {
    position: relative;
    height: 260px;
}

@media (max-width: 900px) {
    .exec-charts-row {
        grid-template-columns: 1fr;
    }
}

.kpi-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition-base);
    position: relative;
    /* overflow: hidden removed to allow tooltips to show */
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.kpi-card.accent-green::before {
    background: var(--gradient-success);
}

.kpi-card.accent-yellow::before {
    background: var(--gradient-warning);
}

.kpi-card.accent-red::before {
    background: var(--gradient-danger);
}

.kpi-card.accent-blue::before {
    background: var(--gradient-info);
}

.kpi-card.accent-purple::before {
    background: var(--gradient-primary);
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    z-index: 100;
    /* Create stacking context above siblings */
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-icon {
    font-size: 16px;
    font-weight: 400;
    /* Reset font-weight to prevent bolding */
    text-transform: none;
    /* Reset text-transform */
    color: var(--text-muted);
    cursor: help;
    opacity: 0.8;
    transition: all 0.2s;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.info-icon:hover {
    opacity: 1;
    color: var(--accent-purple);
    z-index: 10001;
}

/* Tooltip implementation - Now appearing downwards to avoid sticky header */
.info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 125%;
    /* Changed to downward */
    left: 0;
    transform: translateY(-10px);
    background: #ffffff;
    color: #0a0e1a;
    opacity: 0;
    /* Note: this is for transition */
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
    white-space: pre-wrap;
    width: 250px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-medium);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9999;
    line-height: 1.5;
    text-align: left;
    pointer-events: auto;
    /* Allow interaction if needed */
}

.info-icon:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

h1,
h2,
h3,
h4,
h5,
h6,
.sidebar-title,
.kpi-value,
.kanban-column-header,
.modal-title,
.btn,
.filter-btn {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.2;
    font-family: var(--font-heading);
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 6px;
    line-height: 1.1;
}

.kpi-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════
   KANBAN (Module B)
   ══════════════════════════════════════════════════════════ */
.kanban-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    font-family: inherit;
}

.filter-btn:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.filter-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #a78bfa;
}

.kanban-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
}

.kanban-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(8px);
    transition: var(--transition-fast);
    font-size: 1.2rem;
    padding: 0;
}

.kanban-nav-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-accent);
    transform: translateY(-50%) scale(1.05);
}

.kanban-nav-left {
    left: -15px;
}

.kanban-nav-right {
    right: -15px;
}

.kanban-board {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
}

.kanban-column {
    min-width: 280px;
    max-width: 320px;
    flex-shrink: 0;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.kanban-count {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.kanban-cards {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    padding: 8px;
    max-height: 600px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 14px;
    cursor: pointer;
    transition: var(--transition-fast);
    border-left: 3px solid transparent;
}

.kanban-card:hover {
    background: var(--bg-card-hover);
    transform: translateX(2px);
}

.kanban-card.border-green {
    border-left-color: var(--green);
}

.kanban-card.border-yellow {
    border-left-color: var(--yellow);
}

.kanban-card.border-red {
    border-left-color: var(--red);
}

.kanban-card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.kanban-card-client {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.kanban-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.kanban-card-value {
    font-weight: 700;
    color: var(--text-accent);
}

/* ══════════════════════════════════════════════════════════
   TABLE FILTERS
   ══════════════════════════════════════════════════════════ */
.table-filters {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.filter-group-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.filter-input,
.filter-select {
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-fast);
}

.filter-input:focus,
.filter-select:focus {
    border-color: var(--text-accent);
    background: var(--bg-glass-hover);
}

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

.filter-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

.filter-range {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.filter-input-sm {
    width: 120px;
}

#filter-search {
    flex: 1;
    min-width: 200px;
}

/* ══════════════════════════════════════════════════════════
   RISK TABLE (Module C)
   ══════════════════════════════════════════════════════════ */
.data-table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: var(--transition-fast);
}

.data-table th:hover {
    color: var(--text-primary);
    background: var(--bg-glass-hover);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition-fast);
    cursor: pointer;
}

.data-table tbody tr:hover {
    background: var(--bg-glass-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.risk-score {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
}

.risk-score.low {
    background: var(--green-bg);
    color: var(--green);
}

.risk-score.medium {
    background: var(--yellow-bg);
    color: var(--yellow);
}

.risk-score.high {
    background: var(--red-bg);
    color: var(--red);
}

/* ══════════════════════════════════════════════════════════
   RADAR (Module D)
   ══════════════════════════════════════════════════════════ */
.radar-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.radar-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.radar-section-header {
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    border-bottom: 1px solid var(--border-subtle);
}

.radar-section.hot .radar-section-header {
    background: var(--hot-bg);
    color: var(--hot);
}

.radar-section.warm .radar-section-header {
    background: var(--warm-bg);
    color: var(--warm);
}

.radar-section.cold .radar-section-header {
    background: var(--cold-bg);
    color: var(--cold);
}

.radar-items {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 500px;
    overflow-y: auto;
}

.radar-item {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: var(--transition-fast);
}

.radar-item:hover {
    background: var(--bg-glass-hover);
    transform: translateX(2px);
}

.radar-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.radar-item-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ══════════════════════════════════════════════════════════
   RESPONSAVEL CARDS (Module E)
   ══════════════════════════════════════════════════════════ */
.responsavel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.responsavel-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: var(--transition-base);
    position: relative;
}

.responsavel-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
    z-index: 10;
}

.responsavel-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.responsavel-avatar {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.responsavel-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.responsavel-stat {
    background: var(--bg-glass);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
}

.responsavel-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.responsavel-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════
   AI INSIGHTS (Module F)
   ══════════════════════════════════════════════════════════ */
.ai-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    align-items: center;
}

.ai-controls select,
.ai-controls input {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition-fast);
}

.ai-controls select:focus,
.ai-controls input:focus {
    border-color: var(--text-accent);
}

.ai-controls select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-ai {
    background: var(--gradient-primary);
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-ai:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-ai:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-output {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    min-height: 200px;
}

.ai-output h1,
.ai-output h2,
.ai-output h3 {
    color: var(--text-primary);
    margin-bottom: 8px;
}

.ai-output h2 {
    font-size: 1.1rem;
    margin-top: 20px;
}

.ai-output h3 {
    font-size: 0.95rem;
    margin-top: 16px;
}

.ai-output p {
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.7;
}

.ai-output ul,
.ai-output ol {
    padding-left: 20px;
    margin-bottom: 12px;
}

.ai-output li {
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.ai-output strong {
    color: var(--text-primary);
}

.ai-reports-list {
    margin-top: 24px;
}

.ai-report-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-glass);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.ai-report-item:hover {
    background: var(--bg-glass-hover);
}

.ai-report-item:hover .chat-item-delete {
    opacity: 1;
}

.ai-report-item.active {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--accent-purple);
}

.report-item-text {
    flex: 1;
    min-width: 0;
}

/* ══════════════════════════════════════════════════════════
   CONFIG (Admin)
   ══════════════════════════════════════════════════════════ */
.config-section {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
}

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

.config-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.config-row label {
    min-width: 150px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.config-row input,
.config-row select {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}

.config-row input:focus,
.config-row select:focus {
    border-color: var(--text-accent);
}

/* ══════════════════════════════════════════════════════════
   DEAL DETAIL MODAL
   ══════════════════════════════════════════════════════════ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.3s ease-out;
    position: relative;
    /* Allow tooltips inside to overflow correctly */
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 14px;
}

/* ── Header Profile ─────────────────────────────────────── */
.header-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-xl);
    transition: var(--transition-fast);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
}

.header-profile:hover {
    background: var(--bg-glass-hover);
    border-color: var(--border-medium);
    transform: translateY(-1px);
}

.header-avatar-container {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border-accent);
    box-shadow: var(--shadow-glow-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gradient-primary);
}

.header-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-avatar-initials {
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
}

.header-profile-text {
    display: flex;
    flex-direction: column;
}

.header-profile-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.header-profile-role {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Hide text when header is small or on mobile if needed */
@media (max-width: 768px) {
    .header-profile-text {
        display: none;
    }
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.detail-item {
    background: var(--bg-glass);
    padding: 12px 14px;
    border-radius: var(--radius-sm);
}

.detail-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-top: 2px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-item {
    padding: 10px 14px;
    border-left: 2px solid var(--border-medium);
    margin-left: 8px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 14px;
    width: 8px;
    height: 8px;
    background: var(--text-accent);
    border-radius: 50%;
}

.timeline-desc {
    color: var(--text-primary);
}

.timeline-date {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 2px;
}

/* ══════════════════════════════════════════════════════════
   LOADING & EMPTY STATES
   ══════════════════════════════════════════════════════════ */

.loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease;
}

.loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--text-muted);
    gap: 12px;
    font-size: 0.9rem;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-subtle);
    border-top: 3px solid var(--text-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 0.9rem;
}

/* ── Progress bar ──────────────────────────────────────── */
.progress-bar {
    height: 6px;
    background: var(--bg-glass);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
}

.progress-fill.green {
    background: var(--gradient-success);
}

.progress-fill.yellow {
    background: var(--gradient-warning);
}

.progress-fill.red {
    background: var(--gradient-danger);
}

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Table Row elevation for tooltips */
.data-table tbody tr {
    position: relative;
    transition: z-index 0.2s;
}

.data-table tbody tr:hover {
    z-index: 50;
}

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

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .sidebar .nav-label,
    .sidebar .sidebar-title,
    .sidebar .sidebar-subtitle,
    .sidebar .nav-section-label {
        opacity: 0;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed);
    }

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

    .module-content {
        padding: 16px;
    }
}

/* ── Utility Classes ───────────────────────────────────── */
.text-green {
    color: var(--green);
}

.text-yellow {
    color: var(--yellow);
}

.text-red {
    color: var(--red);
}

.text-blue {
    color: var(--text-accent);
}

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

.text-bold {
    font-weight: 700;
}

.text-sm {
    font-size: 0.8rem;
}

.text-xs {
    font-size: 0.72rem;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 16px;
}

.mb-4 {
    margin-bottom: 16px;
}

.flex {
    display: flex;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.hidden {
    display: none !important;
}

/* ══════════════════════════════════════════════════════════
   Agente Vortex (Module G)
   ══════════════════════════════════════════════════════════ */
.agent-container {
    display: flex;
    gap: 20px;
    height: calc(100vh - var(--header-height) - 40px);
    width: 100%;
}

.agent-sidebar {
    width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
}

.agent-history-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}

.agent-history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--bg-glass);
    border: 1px solid transparent;
    transition: var(--transition-fast);
}

.agent-history-item:hover {
    background: var(--bg-glass-hover);
}

.agent-history-item.active {
    background: rgba(56, 189, 248, 0.1);
    border-color: var(--border-accent);
}

.chat-item-text {
    flex: 1;
    min-width: 0;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.chat-item-delete {
    flex-shrink: 0;
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 2px 6px;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s, color 0.2s;
}

.agent-history-item:hover .chat-item-delete {
    opacity: 1;
}

.chat-item-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.agent-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.agent-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-message {
    display: flex;
    gap: 16px;
    max-width: 85%;
}

.chat-message.ai {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-glass);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.chat-message.ai .chat-avatar {
    background: var(--border-accent);
}

.chat-bubble {
    padding: 16px;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    line-height: 1.5;
}

.chat-message.ai .chat-bubble {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-top-left-radius: 4px;
}

.chat-message.user .chat-bubble {
    background: #0A1F8F;
    color: #fff;
    border-top-right-radius: 4px;
}

.chat-message p {
    margin-bottom: 8px;
}

.chat-message p:last-child {
    margin-bottom: 0;
}

.agent-input-container {
    padding: 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.agent-input-container textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 14px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    outline: none;
    transition: var(--transition-fast);
    line-height: 1.4;
    min-height: 48px;
    max-height: 150px;
    border-radius: 24px;
}

.agent-input-container textarea:focus {
    border-color: var(--text-accent);
    background: var(--bg-glass-hover);
}

.agent-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #ffffff !important;
}

.agent-send-btn svg {
    stroke: #ffffff !important;
}

.agent-sidebar .btn-primary {
    color: #ffffff !important;
}

/* ══════════════════════════════════════════════════════════
   RELATÓRIOS — SCHEDULE MODULE
   ══════════════════════════════════════════════════════════ */

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.schedule-count {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.schedule-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.schedule-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all 0.2s ease;
    position: relative;
}

.schedule-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.schedule-card.inactive {
    opacity: 1;
}

.schedule-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.schedule-card-name {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.schedule-card-actions {
    display: flex;
    gap: 4px;
}

.schedule-card-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.schedule-card-actions button:hover {
    background: var(--bg-glass-hover);
}

.schedule-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.schedule-badge {
    font-size: 0.72rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.schedule-badge.freq-diario {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.schedule-badge.freq-semanal {
    background: rgba(0, 160, 223, 0.15);
    color: #00A0DF;
}

.schedule-badge.freq-mensal {
    background: rgba(139, 92, 246, 0.15);
    color: #8b5cf6;
}

.schedule-badge.status-ativo {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.schedule-badge.status-inativo {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.schedule-card-info {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.schedule-card-info span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Form Elements (Modal) ──────────────────────────────── */

.form-group {
    flex: 1;
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dow-check-label {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.dow-check-label:has(input:checked) {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--text-accent);
    color: var(--text-accent);
    font-weight: 600;
}
.dow-check-label input[type="checkbox"] {
    display: none;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 12px 0 8px;
    margin: 8px 0;
    border-top: 1px solid var(--border-subtle);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

/* ── Toggle Switch ──────────────────────────────────────── */

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
}

.toggle-label input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    background: var(--border-medium);
    border-radius: 11px;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}

.toggle-label input:checked+.toggle-switch {
    background: var(--gradient-primary);
}

.toggle-label input:checked+.toggle-switch::after {
    transform: translateX(18px);
}

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

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .schedule-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
}

/* ── Toast Notifications ────────────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    color: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.toast.success {
    background: var(--accent-green);
}

.toast.error {
    background: var(--accent-red);
}

.toast.info {
    background: var(--accent-blue);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }

    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ══════════════════════════════════════════════════════════
   PROFILE MODULE
   ══════════════════════════════════════════════════════════ */
.profile-container {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.profile-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.profile-avatar-large {
    width: 120px;
    height: 120px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    margin: 0 auto;
    box-shadow: var(--shadow-glow-blue);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.profile-avatar-large:hover {
    transform: scale(1.05);
}

.profile-avatar-edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-size: 0.8rem;
    font-weight: 600;
}

.profile-avatar-large:hover .profile-avatar-edit-overlay {
    opacity: 1;
}

.profile-avatar-edit-overlay i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.profile-avatar-wrapper {
    margin-bottom: 24px;
}

.profile-info h3 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.profile-info .profile-email {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 16px;
}

.profile-info .profile-role {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 32px;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-actions .btn {
    width: 100%;
    padding: 14px;
}

/* ══════════════════════════════════════════════════════════
   MULTI-SELECT FILTER (Visão Geral)
   ══════════════════════════════════════════════════════════ */
.filter-container-exec {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.multi-select-wrapper {
    position: relative;
    width: 300px;
    user-select: none;
}

.multi-select-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
    display: block;
    font-weight: 500;
}

.multi-select-trigger {
    background: var(--multi-select-bg);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.multi-select-trigger:hover {
    border-color: var(--text-accent);
    background: var(--bg-glass-hover);
}

.multi-select-trigger.active {
    border-color: var(--text-accent);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.multi-select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--multi-select-bg);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    max-height: 250px;
    overflow-y: auto;
    display: none;
    animation: fadeInDown 0.2s ease-out;
}

.multi-select-options.show {
    display: block;
}

.multi-select-option {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: var(--transition-fast);
}

.multi-select-option:hover {
    background: var(--bg-glass-hover);
}

.multi-select-option.selected {
    background: rgba(99, 102, 241, 0.1);
}

.multi-select-option input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--accent-purple);
}

.multi-select-option label {
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex: 1;
}

.multi-select-option.selected label {
    color: var(--text-primary);
    font-weight: 600;
}

.multi-select-summary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 10px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}