:root { 
    --gelb-black: #1a1a1a; 
    --gelb-yellow: #fdd835; 
    --gelb-gray: #f4f6f9; 
    --text-dark: #212529; 
    --success-green: #27ae60;
}

body { 
    background-color: var(--gelb-gray); 
    font-family: 'Segoe UI', sans-serif; 
    overflow-x: hidden; 
}

/* --- OVERRIDES DE BIBLIOTECAS --- */
.select2-container { width: 100% !important; }
.select2-selection--single { height: 31px !important; padding-top: 2px !important; border: 1px solid #dee2e6 !important; }
.select2-selection--multiple { min-height: 31px !important; border: 1px solid #dee2e6 !important; }
.select2-selection__arrow { top: 2px !important; }

/* --- TELA DE LOGIN --- */
#login-screen { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; 
    background-color: var(--gelb-black); z-index: 9999; 
    display: flex; justify-content: center; align-items: center; flex-direction: column; 
}
.login-card { 
    background: white; border-radius: 15px; padding: 40px; width: 400px; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); text-align: center; border-top: 5px solid var(--gelb-yellow); 
}

/* --- NAVBAR & MENU --- */
.navbar { background-color: var(--gelb-black); box-shadow: 0 4px 10px rgba(0,0,0,0.1); min-height: 60px; }
.navbar-brand { color: white !important; font-weight: 700; font-size: 1.2rem; letter-spacing: 0.5px; }
.offcanvas { background-color: var(--gelb-black); color: white; width: 260px !important; }
.offcanvas-header .btn-close { filter: invert(1); }
.nav-link { color: rgba(255,255,255,0.7) !important; transition: 0.3s; padding: 10px 20px; }
.nav-link.active { background-color: var(--gelb-yellow) !important; color: var(--gelb-black) !important; font-weight: bold; }

/* --- COMPONENTES GERAIS --- */
.card { border: none; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 0; }
.btn-gelb { background-color: var(--gelb-yellow); color: var(--gelb-black); font-weight: bold; border: none; }
.btn-dark-gelb { background-color: var(--gelb-black); color: white; }
.btn-outline-dark { border-color: #212529; color: #212529; }
.btn-outline-dark:hover { background-color: #212529; color: white; }

/* --- DASHBOARD & KPIS --- */
.kpi-card { 
    border-left: 5px solid var(--gelb-yellow); 
    padding: 10px 12px; 
    height: 100%; 
    background: #fff; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07), 0 1px 3px rgba(0,0,0,0.05);
}
.kpi-value { 
    font-size: 2rem; 
    font-weight: 800; 
    color: var(--gelb-black); 
    line-height: 1.1;
    margin-bottom: 0;
}
.kpi-label { 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    color: #555; 
    font-weight: 700; 
    margin-bottom: 2px;
    letter-spacing: 0.5px;
}
.chart-wrapper { position: relative; height: 300px; width: 100%; }

/* --- CARDS DE PDV --- */
.pdv-card { 
    transition: all 0.2s; border: 1px solid #eee; height: 100%; 
    background: #fff; padding: 12px; border-radius: 8px; cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
}
.pdv-card:hover { 
    transform: translateY(-3px); border-color: var(--gelb-yellow); 
    box-shadow: 0 6px 20px rgba(0,0,0,0.1); 
}
.pdv-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.9rem; }
.progress-micro { height: 4px; margin: 5px 0 8px 0; }
.product-list-item { font-size: 0.75rem; border-bottom: 1px solid #f8f8f8; padding: 4px 0; display: flex; justify-content: space-between; }

/* --- ESTRUTURA E LISTAS --- */
.config-list-container { max-height: 600px; overflow-y: auto; padding-right: 5px; }
.polo-header { background-color: #1a1a1a; border-bottom: 1px solid #eee; padding: 8px 12px; font-size: 0.85rem; color: #fdd835; border-radius: 0; display: flex; justify-content: space-between; align-items: center; }
.pdv-item { padding: 6px 12px 6px 20px; border-bottom: 1px solid #f0f0f0; display: flex; justify-content: space-between; align-items: center; background: #fff; font-size: 0.82rem; transition: background 0.15s; }
.pdv-item:last-child { border-bottom: none; }
.pdv-item:hover { background: #fffcf0; }

/* --- INDICADORES VISUAIS --- */
.text-up    { color: #e74c3c !important; font-weight: 600; }
.text-down  { color: #27ae60 !important; font-weight: 600; }
.text-neutral { color: #999 !important; }

/* --- LOADER --- */
#loading-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh; 
    background: rgba(255,255,255,0.9); z-index: 9998; display: none; 
    justify-content: center; align-items: center; flex-direction: column; 
}

/* --- TABELAS E FILTROS --- */
.no-scroll-container { max-height: 85vh; overflow-y: auto; overflow-x: hidden; padding-bottom: 50px; }
.log-table thead th { font-size: 0.85rem; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.log-table tbody td { font-size: 0.9rem; padding: 12px 15px; border-bottom: 1px solid #f0f0f0; }
.filter-input { width: 100%; padding: 3px; font-size: 0.75rem; border: 1px solid #ddd; border-radius: 3px; margin-top: 5px; }
.mini-list-polo { font-size: 0.8rem; max-height: 80px; overflow-y: auto; }
.mini-list-item { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding: 2px 0; }

/* --- ESTILOS DO MODAL TRIMESTRAL E CARD --- */
.card[onclick] { transition: all 0.2s ease-in-out; }
.card[onclick]:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 24px rgba(0,0,0,0.1) !important; 
}
#modalAnaliseTrimestral canvas { max-width: 100%; }
#modalAnaliseTrimestral .modal-body { background-color: #f8f9fa; padding: 1.5rem; }
#modalAnaliseTrimestral .table th { font-size: 0.75rem; color: #6c757d; letter-spacing: 0.5px; text-transform: uppercase; }
#modalAnaliseTrimestral .table td { vertical-align: middle; font-size: 0.85rem; }
#listaTriAtipicos .list-group-item { background: transparent; border: none; border-bottom: 1px dashed #eee; }

/* --- TIMELINE DE LOGS --- */
.timeline-container { position: relative; padding-left: 20px; }
.timeline-item { position: relative; padding-left: 30px; padding-bottom: 25px; border-left: 2px solid #e9ecef; }
.timeline-item:last-child { border-left: 2px solid transparent; }
.timeline-marker { position: absolute; left: -9px; top: 0; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 3px solid var(--gelb-yellow); }
.timeline-content { background: #fff; padding: 15px; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); border: 1px solid #f0f0f0; }
.timeline-date { font-size: 0.75rem; color: #999; font-weight: bold; text-transform: uppercase; margin-bottom: 5px; }
.timeline-user { font-weight: bold; color: var(--gelb-black); }
.timeline-action { font-size: 0.9rem; color: #555; }
.timeline-badge { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; background: #eee; color: #555; margin-left: 5px; }

/* --- TABELA DE SOLUÇÃO --- */
.table-solucao tbody tr { transition: background 0.2s; }
.table-solucao tbody tr:hover { background-color: #fffcf2; }
.check-solucao { transform: scale(1.2); cursor: pointer; }
.badge-solucao { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; }

/* ─── CVD v2 extras ─────────────────────────────────────────── */

/* KPI card trimestral no dashboard */
#kpiTotalTrimestral { transition: color 0.3s; }
#kpiProjecaoTri { min-height: 14px; }

/* KPIs executivos do modal */
.kpi-exec-card { background: #fdfdfd; transition: box-shadow 0.2s; }
.kpi-exec-card:hover { box-shadow: 0 3px 10px rgba(0,0,0,0.08); }
.kpi-exec-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.5px; color: #999; margin-bottom: 4px; }
.kpi-exec-value { font-size: 1.05rem; font-weight: 700; color: #1a1a1a; line-height: 1.2; }

/* Estrutura polo/PDV no config */
.polo-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; background: #1a1a1a; color: #fdd835; font-size: 0.85rem; }

/* Modal trimestral */
#modalAnaliseTrimestral .modal-header { border-bottom: 2px solid #fdd835; }
#modalAnaliseTrimestral .card-header { font-size: 0.82rem; }
#progressTriShare { transition: width 0.6s ease; }

/* DataTable pagination */
#tabelaRegistros_wrapper .dataTables_paginate { margin-top: 8px; }
#tabelaRegistros_wrapper .paginate_button { font-size: 0.78rem !important; padding: 2px 7px !important; }

/* Alertas inteligentes */
#triAlertas .border-start, #listaTriAtipicos .border-start {
    border-left-width: 4px !important; border-radius: 0 4px 4px 0;
    background: #fafafa; transition: background 0.15s;
}
#triAlertas .border-start:hover, #listaTriAtipicos .border-start:hover { background: #f5f5f5; }
#triInsightTendencia p { line-height: 1.5; font-size: 0.88rem; }
#tblTriEvolucao td:first-child small { font-size: 0.62rem !important; line-height: 1.2; }
#tblTriEvolucao td:last-child { max-width: 260px; white-space: normal; line-height: 1.4; }

/* Period toggle buttons */
.btn-period { transition: all 0.2s; cursor: pointer; }
.btn-period.active { background: #1a1a1a !important; color: #fdd835 !important; border-color: #fdd835 !important; }
.btn-period:not(.active) { background: transparent !important; color: #666 !important; border-color: #ccc !important; }
.btn-period:not(.active):hover { background: #f5f5f5 !important; border-color: #999 !important; color: #333 !important; }

/* SubMotivo filter */
#divFilterSubMotivo { transition: opacity 0.2s; }

/* Registros total bar */
#spanTotalFiltrados { font-size: 0.8rem !important; background: #fffcf0 !important; border-color: #fdd835 !important; }

/* ─── Corporate KPI cards ────────────────────────────── */
.kpi-corp-card {
    border-radius: 10px;
    border: none;
    background: #fff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.07), 0 1px 4px rgba(0,0,0,0.05);
    transition: all 0.2s;
    cursor: pointer;
}
.kpi-corp-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.11), 0 2px 6px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.kpi-corp-title {
    font-size: 0.65rem; text-transform: uppercase;
    letter-spacing: 0.6px; color: #999; font-weight: 600; margin-bottom: 4px;
}
.kpi-corp-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.kpi-corp-badge {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px;
    font-size: 1.1rem; flex-shrink: 0;
}
.kpi-corp-hint { font-size: 0.67rem; color: #999; line-height: 1.45; }
