/* assets/css/style.css */

/* Tipografia · identidade visual V2 */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');
@import url('app-tabs.css');

:root {
    --bg-main: #030507;
    --bg-gradient:
        radial-gradient(ellipse 120% 80% at 50% -25%, rgba(94, 234, 212, 0.16) 0%, transparent 52%),
        radial-gradient(ellipse 70% 50% at 100% 0%, rgba(167, 139, 250, 0.14) 0%, transparent 48%),
        radial-gradient(ellipse 50% 40% at 0% 80%, rgba(244, 114, 182, 0.06) 0%, transparent 45%),
        linear-gradient(185deg, #0b1220 0%, #050810 38%, #020306 100%);

    --accent-cyan: #5eead4;
    --accent-purple: #c4b5fd;
    --gradient-glow: linear-gradient(118deg, #5eead4 0%, #38bdf8 40%, #a78bfa 78%, #f0abfc 100%);

    --glass-bg: rgba(15, 23, 42, 0.58);
    --glass-hover: rgba(30, 41, 59, 0.82);
    --glass-border: rgba(148, 163, 184, 0.14);

    --text-primary: #f8fafc;
    --text-muted: #94a3b8;
    --text-secondary: #cbd5e1;

    /* Barra superior + coluna lateral (mesma superfície) */
    --chrome-h: 64px;
    --chrome-bg: linear-gradient(180deg, rgba(3, 7, 18, 0.96) 0%, rgba(3, 7, 18, 0.78) 100%);
    --chrome-border: 1px solid rgba(148, 163, 184, 0.12);

    /** Fundo único da sidebar — evita divergência com o strip da logo */
    --sidebar-surface-bg: linear-gradient(195deg, #060a14 0%, #050811 42%, #04060d 100%);
}

/* --- Reset Global de Caixas --- */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* --- Animações Globais --- */
@keyframes fadeUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
    }

    50% {
        box-shadow: 0 0 24px rgba(94, 234, 212, 0.45);
    }

    100% {
        box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
    }
}

/* --- Reset e Base --- */
body {
    background-color: var(--bg-main);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Instrument Sans', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    /* <-- Zeramos o espaçamento externo aqui! */
    overflow: hidden;
    /* <-- Isso trava a rolagem global da página */
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    animation: fadeUp 0.8s ease-out forwards;
}

/* --- Cabeçalho --- */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 28px;
    font-weight: 700;
    background: var(--gradient-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header p {
    margin: 5px 0 0 0;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 300;
}

.header a {
    color: var(--accent-cyan);
    text-decoration: none;
    transition: 0.3s;
}

.header a:hover {
    text-shadow: 0 0 8px rgba(56, 189, 248, 0.55);
}

/* --- Inputs e Botões Elegantes --- */
input,
select {
    width: 100%;
    padding: 12px 16px;
    background-color: rgba(2, 6, 23, 0.65);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Instrument Sans', system-ui, sans-serif;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(94, 234, 212, 0.2);
}

button,
.btn {
    padding: 12px 24px;
    background: var(--gradient-glow);
    color: #020617;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 32px rgba(56, 189, 248, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.12);
    filter: brightness(1.05);
}

.btn-outline {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: rgba(94, 234, 212, 0.45);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* --- Cards de Vidro (Glassmorphism) --- */
.panel,
.card,
.kpi-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 24px;
    transition: border-color 0.35s ease, box-shadow 0.35s ease, background 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.panel:hover,
.card:hover,
.kpi-card:hover {
    background: var(--glass-hover);
    transform: translateY(-2px);
    border-color: rgba(94, 234, 212, 0.35);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(167, 139, 250, 0.08);
}

.panel h3,
.card h3 {
    color: var(--text-primary);
    font-size: 18px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 12px;
    font-weight: 500;
}

/* --- Grid de KPIs (Os números grandes) --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 40px;
}

.kpi-card {
    position: relative;
    overflow: hidden;
}

/* Uma linha neon sutil no topo de cada card */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-cyan);
    box-shadow: 0 0 10px var(--accent-cyan);
    opacity: 0.7;
    transition: 0.3s;
}

.kpi-card:hover::before {
    opacity: 1;
    height: 3px;
    box-shadow: 0 0 10px var(--accent-cyan);
}

.kpi-card h3 {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    padding: 0;
    margin-bottom: 10px;
}

.kpi-card .value {
    font-size: 38px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* --- Outras Grids --- */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.grid-forms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.geo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

/* --- Tabelas Modernas --- */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    /* Cria barra de rolagem se a tabela for muito grande */
    background: transparent;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    margin-bottom: 30px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

/* FIX APLICADO AQUI: Garante que tabelas com scroll fiquem largas, 
mas tabelas nos painéis menores não empurrem os botões para fora */
.table-responsive table {
    min-width: 700px;
}

.panel table {
    width: 100%;
    min-width: 100%;
    table-layout: fixed;
}

th,
td {
    text-align: left;
    padding: 16px;
    border-bottom: 1px solid var(--glass-border);
}

th {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.02);
}

td {
    font-size: 14px;
    font-weight: 300;
    word-break: break-word;
    /* FIX: URLs longas agora quebram linha em vez de esticar a tela */
}

tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

/* --- Barras de Progresso --- */
.progress-bar {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 10px;
    overflow: hidden;
    height: 8px;
    margin-top: 8px;
    border: 1px solid var(--glass-border);
}

.progress-fill {
    background: var(--gradient-glow);
    height: 100%;
    border-radius: 10px;
    transition: width 1s ease-in-out;
}

/* --- Tela de Login --- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-box {
    background: var(--glass-bg);
    padding: 50px 40px;
    border-radius: 20px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    width: 100%;
    max-width: 420px;
    animation: fadeUp 0.6s ease-out;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 30px;
    background: var(--gradient-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 28px;
}

/* --- Formulários e Botões --- */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0.5px;
}

/* --- Animações Interativas da IA --- */

/* 1. Efeito do cursor piscando enquanto digita */
.typing-cursor::after {
    content: '|';
    animation: blink 0.8s step-end infinite;
    color: var(--accent-cyan);
    font-weight: bold;
    margin-left: 2px;
}

@keyframes blink {
    50% {
        opacity: 0;
    }
}

/* 2. Estado vazio (Convite para gerar análise) */
.ai-empty-state {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
}

.ai-empty-state span {
    font-size: 28px;
    display: block;
    margin-bottom: 12px;
    animation: floatSparkle 3s ease-in-out infinite;
}

@keyframes floatSparkle {

    0%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
        text-shadow: 0 0 10px rgba(94, 234, 212, 0.2);
    }

    50% {
        transform: translateY(-5px) scale(1.1);
        opacity: 1;
        text-shadow: 0 0 20px rgba(94, 234, 212, 0.55);
    }
}

/* 3. Bolinhas de "IA Pensando" */
.ai-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px 0;
    color: var(--accent-cyan);
    font-weight: 500;
    letter-spacing: 1px;
}

.ai-loading-dot {
    width: 8px;
    height: 8px;
    background: var(--accent-cyan);
    box-shadow: 0 0 8px var(--accent-cyan);
    border-radius: 50%;
    animation: aiBounce 1.4s infinite ease-in-out both;
}

.ai-loading-dot:nth-child(2) {
    animation-delay: -0.32s;
}

.ai-loading-dot:nth-child(3) {
    animation-delay: -0.16s;
}

.ai-loading-dot:nth-child(4) {
    animation-delay: 0s;
}

@keyframes aiBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
        opacity: 0.3;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Efeito de Pulsar Neon para o Ao Vivo */
.live-dot {
    width: 12px;
    height: 12px;
    background-color: #10B981;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
    box-shadow: 0 0 10px #10B981;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* ==========================================
   NOVO LAYOUT: SIDEBAR & MAIN CONTENT
   ========================================== */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
}

/* --- Menu Lateral --- */
/* Estilos movidos para sidebar.php para maior controle e customização premium */

/* --- Área de Conteúdo --- */
.main-content {
    flex: 1;
    --main-gutter-x: 36px;
    padding: 0 var(--main-gutter-x) 40px var(--main-gutter-x);
    height: 100vh;
    overflow-y: auto;
    box-sizing: border-box;
    scroll-behavior: smooth;
    position: relative;
    z-index: 1;
}

/* --- Top header: três colunas (menu | logo | ações), logo de facto centrado --- */
.top-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    min-height: var(--chrome-h);
    margin: 0 calc(-1 * var(--main-gutter-x, 36px)) 24px;
    padding: 0 12px 0 8px;
    border-bottom: var(--chrome-border);
    position: sticky;
    top: 0;
    z-index: 9999;
    background: var(--chrome-bg);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
}

.top-header-cell {
    display: flex;
    align-items: center;
    min-height: var(--chrome-h);
}

.top-header-cell--left,
.top-header-cell--right {
    flex: 1 1 0;
    min-width: 0;
}

.top-header-cell--left {
    justify-content: flex-start;
}

.top-header-cell--right {
    justify-content: flex-end;
}

.top-header-cell--center {
    flex: 0 0 auto;
    justify-content: center;
    padding: 0 8px;
}

.logo-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 21px;
    font-weight: 800;
    background: var(--gradient-glow);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.top-header .logo-center {
    background: none;
    -webkit-text-fill-color: unset;
    letter-spacing: normal;
    text-transform: none;
}

.top-header-logo-link {
    display: flex;
    align-items: center;
    line-height: 0;
    text-decoration: none;
}

.top-header-logo-img {
    height: 32px;
    width: auto;
    max-width: min(200px, 42vw);
    object-fit: contain;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.top-header-logo-link:hover .top-header-logo-img {
    transform: scale(1.04);
    opacity: 0.95;
}

.top-header-agency-logo {
    height: 30px;
    max-width: 140px;
    object-fit: contain;
    border-radius: 6px;
}

.top-header-logo-sep {
    display: inline-block;
    width: 1px;
    height: 26px;
    background: var(--glass-border);
    flex-shrink: 0;
}

/* --- Nova Grid para os Gráficos Principais --- */
.dual-charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 30px;
}

/* Customização da Barra de Rolagem (Estilo Mac/Dark) */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: rgba(71, 85, 105, 0.85);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(94, 234, 212, 0.35);
    background-clip: padding-box;
}

/* --- Estilização dos Ícones (Boxicons) --- */
.sidebar-link i {
    font-size: 20px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.sidebar-link:hover i,
.sidebar-link.active i {
    color: var(--accent-cyan);
}

.kpi-card h3 i,
.panel h3 i {
    font-size: 18px;
    margin-right: 6px;
    vertical-align: middle;
}

.kpi-card h3,
.panel h3 {
    display: flex;
    align-items: center;
}

/* ==========================================
   ANIMAÇÕES E UTILITÁRIOS NOVOS
   ========================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    margin-right: 15px;
}

/* ==========================================
   MEDIA QUERIES (RESPONSIVIDADE PREMIUM)
   ========================================== */
@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .dual-charts-grid {
        grid-template-columns: 1fr;
    }

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

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

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

    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        width: min(280px, 88vw);
        max-width: min(280px, 88vw);
        flex: none;
        z-index: 1000;
        transition: left 0.35s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.55);
    }

    .sidebar.sidebar-open {
        left: 0;
    }

    .main-content {
        --main-gutter-x: 15px;
        padding: 15px;
    }

    .top-header {
        margin: 0 calc(-1 * var(--main-gutter-x, 15px)) 20px;
        padding: 0 8px 0 4px;
    }

    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Permite botões em grid principal quebrarem barra no topo */
    .dashboard-header-actions {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px;
    }

    .dashboard-header-actions .btn-outline {
        width: 100%;
        justify-content: center;
    }

    .dashboard-header-actions select {
        width: 100%;
    }
}

/* ==========================================
   SELECTS PREMIUM & ONBOARDING
   ========================================== */
.premium-select-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.premium-select-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--accent-cyan);
    pointer-events: none;
    font-size: 16px;
    z-index: 2;
}

.premium-select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    padding-left: 38px;
    padding-right: 38px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    height: 42px;
}

.premium-select-wrapper select:hover {
    border-color: rgba(94, 234, 212, 0.4);
    box-shadow: 0 0 10px rgba(94, 234, 212, 0.1);
}

.premium-select-wrapper::after {
    content: "\ebdb";
    /* bx-chevron-down */
    font-family: 'boxicons';
    font-size: 16px;
    color: var(--text-muted);
    position: absolute;
    right: 14px;
    pointer-events: none;
}

/* ==========================================
   ALERTA PROATIVO (Canto Superior Direito)
   ========================================== */
.header-actions-right {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.notif-bell {
    position: relative;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    transition: color 0.3s ease;
}

.notif-bell:hover {
    color: var(--accent-cyan);
}

.notif-bell .badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: #EF4444;
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--bg-main);
}

/* --- Notification Dropdown CSS --- */
.notif-container { position: relative; }
.notif-badge { 
    position: absolute; top: -5px; right: -5px; 
    background: #EF4444; color: white; font-size: 10px; 
    font-weight: bold; width: 16px; height: 16px; 
    border-radius: 50%; display: flex; align-items: center; 
    justify-content: center; border: 2px solid var(--bg-main); 
}
.notif-popup { 
    display: none; position: absolute; top: calc(100% + 15px); 
    right: 0; width: 320px; background: var(--glass-bg); 
    border: 1px solid var(--glass-border); border-radius: 12px; 
    box-shadow: 0 15px 35px rgba(0,0,0,0.8); z-index: 99999; 
    transform-origin: top right; 
    text-align: left;
}
.notif-popup.active { display: block; animation: fadeUp 0.15s ease-out; }
.notif-header { padding: 15px 20px; border-bottom: 1px solid var(--glass-border); }
.notif-header h4 { margin: 0; font-size: 14px; color: var(--text-primary); font-weight: 500; }
.notif-body { padding: 0; max-height: 350px; overflow-y: auto; }
.notif-item { display: flex; gap: 15px; padding: 15px 20px; border-bottom: 1px solid var(--glass-border); transition: 0.2s; cursor: pointer; }
.notif-item:hover { background: rgba(255,255,255,0.02); }
.notif-item:last-child { border-bottom: none; }
.notif-item strong { font-size: 13px; display: block; margin-bottom: 4px; color: var(--text-primary); }
.notif-item p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.notif-item small { font-size: 10px; color: #555; display: block; margin-top: 6px; }

/* ==========================================
   LIGHT MODE (White Mode)
   ========================================== */
body.light-mode {
    /* Fundo principal: cinza-ardósia médio — cria profundidade visual */
    --bg-main: #dce3ec;
    --bg-gradient: radial-gradient(circle at top center, rgba(14, 116, 144, 0.08), transparent 600px);

    --chrome-bg: rgba(248, 250, 252, 0.92);
    --chrome-border: 1px solid var(--glass-border);

    --sidebar-surface-bg: #c8d5e3;

    /* Accent teal escuro — contraste WCAG AA ~4.7:1 sobre branco */
    --accent-cyan: #0e7490;
    --accent-purple: #1d4ed8;
    --gradient-glow: linear-gradient(135deg, #0e7490 0%, #1d4ed8 100%);

    /* Cards/painéis brancos contrastam com o fundo cinza */
    --glass-bg: #ffffff;
    --glass-hover: #f8fafc;
    --glass-border: #b8c8d8;

    /* Texto escuro nítido */
    --text-primary: #0f172a;
    --text-muted: #4a5568;
}

body.light-mode {
    background: var(--bg-main);
    color: var(--text-primary);
}

/* ── Inputs e selects ────────────────────────── */
body.light-mode input,
body.light-mode select {
    background-color: #f1f5f9;
    color: var(--text-primary);
    border-color: var(--glass-border);
}

body.light-mode input:focus,
body.light-mode select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(14, 116, 144, 0.18);
}

/* ── Top header ──────────────────────────────── */
body.light-mode .top-header {
    background: rgba(220, 227, 236, 0.95);
    border-bottom-color: var(--glass-border);
    backdrop-filter: blur(12px);
}

/* ── Sidebar ─────────────────────────────────── */
body.light-mode .sidebar {
    background: #c8d5e3;
    border-right: 1px solid #b0c0d0;
    box-shadow: 2px 0 14px rgba(0, 0, 0, 0.08);
}

body.light-mode .sidebar-link {
    color: #2d3e50;
}

body.light-mode .sidebar-link:hover {
    background: rgba(14, 116, 144, 0.1);
    color: #0f172a;
}

body.light-mode .sidebar-link.active {
    background: rgba(14, 116, 144, 0.15);
    color: var(--accent-cyan);
    border-color: rgba(14, 116, 144, 0.35);
}

body.light-mode .sidebar-link i {
    color: #4a6070;
}

body.light-mode .sidebar-link:hover i,
body.light-mode .sidebar-link.active i {
    color: var(--accent-cyan);
}

/* Sidebar groups */
body.light-mode .sb-group-header {
    color: #4a6070;
}

body.light-mode .sb-group-header:hover {
    background: rgba(14, 116, 144, 0.1);
    color: #0f172a;
}

body.light-mode .sb-group-header.open {
    color: var(--accent-cyan);
}

/* ── Tabelas ─────────────────────────────────── */
body.light-mode th {
    background: rgba(14, 116, 144, 0.07);
    color: var(--text-muted);
}

body.light-mode tr:hover td {
    background: rgba(14, 116, 144, 0.05);
}

body.light-mode .table-responsive {
    border-color: var(--glass-border);
    background: #ffffff;
}

/* ── Cards / Painéis / KPI ───────────────────── */
body.light-mode .panel,
body.light-mode .card,
body.light-mode .kpi-card {
    background: #ffffff;
    border-color: var(--glass-border);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0,0,0,0.04);
}

body.light-mode .panel:hover,
body.light-mode .card:hover,
body.light-mode .kpi-card:hover {
    background: #f8fafc;
    border-color: var(--accent-cyan);
    box-shadow: 0 8px 28px rgba(14, 116, 144, 0.14);
    transform: translateY(-5px);
}

body.light-mode .panel h3,
body.light-mode .card h3 {
    border-bottom-color: var(--glass-border);
}

/* KPI values — texto preto nítido */
body.light-mode .kpi-card .value {
    color: var(--text-primary);
    text-shadow: none;
}

/* Linha neon do topo dos kpi cards — suavizada */
body.light-mode .kpi-card::before {
    box-shadow: 0 0 8px rgba(14, 116, 144, 0.35);
    opacity: 0.6;
}

/* ── Barra de progresso ──────────────────────── */
body.light-mode .progress-bar {
    background: rgba(0, 0, 0, 0.1);
    border-color: var(--glass-border);
}

/* ── Login box ───────────────────────────────── */
body.light-mode .login-box {
    background: #ffffff;
    border-color: var(--glass-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* ── Notificações ────────────────────────────── */
body.light-mode .notif-popup {
    background: #ffffff;
    border-color: var(--glass-border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
}

body.light-mode .notif-header {
    border-bottom-color: var(--glass-border);
}

body.light-mode .notif-item {
    border-bottom-color: var(--glass-border);
}

body.light-mode .notif-item strong {
    color: var(--text-primary);
}

body.light-mode .notif-item:hover {
    background: rgba(14, 116, 144, 0.05);
}

body.light-mode .notif-badge,
body.light-mode .notif-bell .badge {
    border-color: var(--bg-main);
}

/* ── Override cores hardcoded (#83f1f7) ─────── */
/* Ciano claro original é invisível sobre fundo claro */
body.light-mode [style*="color:#83f1f7"],
body.light-mode [style*="color: #83f1f7"] {
    color: #0e7490 !important;
}

body.light-mode [style*="background:rgba(131,241,247"],
body.light-mode [style*="background: rgba(131,241,247"] {
    background: rgba(14, 116, 144, 0.15) !important;
    color: #0e7490 !important;
}

/* ── Logo toda preta no Light Mode ──────────── */
body.light-mode .top-header img {
    filter: brightness(0);
    opacity: 0.85;
}

/* ── Dashboard — Command Header (dashboard.php inline styles) ── */

/* Grid background do main-content — remover no light mode */
body.light-mode .main-content {
    background-image: none !important;
}

/* Borda inferior do cmd-header */
body.light-mode .cmd-header {
    border-bottom-color: var(--glass-border) !important;
}

body.light-mode .cmd-header::after {
    background: linear-gradient(90deg, #0e7490, transparent) !important;
    box-shadow: none !important;
}

/* Título principal — era #fff (branco sobre branco) */
body.light-mode .cmd-title {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

/* .grad — gradiente #83f1f7→#fff invisível no light mode */
body.light-mode .cmd-title .grad {
    background: linear-gradient(135deg, #0e7490 0%, #1d4ed8 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
}

/* Botões de ação — cmd-btn quase invisíveis (rgba muito baixo) */
body.light-mode .cmd-btn {
    border-color: rgba(14, 116, 144, 0.35) !important;
    color: #0e7490 !important;
    background: rgba(14, 116, 144, 0.05) !important;
}

body.light-mode .cmd-btn:hover {
    background: rgba(14, 116, 144, 0.12) !important;
    border-color: #0e7490 !important;
    color: #0c5f73 !important;
}

body.light-mode .cmd-btn.cmd-btn-danger {
    border-color: rgba(239, 68, 68, 0.35) !important;
    color: #dc2626 !important;
    background: rgba(239, 68, 68, 0.06) !important;
}

body.light-mode .cmd-btn.cmd-btn-danger:hover {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: #dc2626 !important;
    color: #b91c1c !important;
}

/* Breadcrumb e subtítulo */
body.light-mode .cmd-breadcrumb {
    color: var(--text-muted) !important;
}

body.light-mode .cmd-subtitle-text {
    color: var(--text-muted) !important;
}

/* ── Labels e textos utilitários ─────────────── */
body.light-mode .sidebar-title {
    color: #3a5065;
}

body.light-mode label {
    color: var(--text-muted);
}

/* ── Scrollbar ───────────────────────────────── */
body.light-mode ::-webkit-scrollbar-track {
    background: #c8d5e3;
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: #94a8bb;
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
    background: #6e8699;
}

/* ── Select premium ──────────────────────────── */
body.light-mode .premium-select-wrapper select {
    background: #ffffff;
    color: var(--text-primary);
    border-color: var(--glass-border);
}

body.light-mode .premium-select-wrapper select:hover {
    border-color: rgba(14, 116, 144, 0.5);
    box-shadow: 0 0 10px rgba(14, 116, 144, 0.1);
}

/* ── Btn outline ─────────────────────────────── */
body.light-mode .btn-outline {
    border-color: #94a8bb;
    color: #4a6070;
}

body.light-mode .btn-outline:hover {
    background: rgba(14, 116, 144, 0.08);
    color: var(--text-primary);
    border-color: var(--accent-cyan);
}

/* ── Header ──────────────────────────────────── */
body.light-mode .header {
    border-bottom-color: var(--glass-border);
}

/* ── Sidebar overlay mobile ──────────────────── */
body.light-mode .sidebar-overlay {
    background: rgba(0, 0, 0, 0.35);
}

@media (max-width: 768px) {
    body.light-mode .sidebar {
        box-shadow: 5px 0 25px rgba(0, 0, 0, 0.2);
    }
}

/* Theme toggle button */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    border-radius: 6px;
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 15px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    margin-left: auto;
}

.theme-toggle-btn:hover {
    background: rgba(94, 234, 212, 0.1);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
    transform: none;
    box-shadow: none;
}

body.light-mode .theme-toggle-btn:hover {
    background: rgba(8, 145, 178, 0.08);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

body.light-mode .sidebar-chrome-bar {
    background: transparent;
    border-bottom-color: var(--glass-border);
}