:root {
    --fl-primary: #0d3b66;
    --fl-primary-dark: #082744;
    --fl-primary-light: #14588f;
    --fl-green: #16a34a;
    --fl-green-dark: #15803d;
    --fl-gray-50: #f8fafc;
    --fl-gray-100: #f1f5f9;
    --fl-gray-200: #e2e8f0;
    --fl-gray-500: #64748b;
    --fl-gray-700: #334155;
    --fl-gray-900: #0f172a;
    --fl-red: #dc2626;
    --fl-orange: #ea580c;
    --fl-yellow: #ca8a04;
    --fl-blue: #2563eb;
    --sidebar-width: 250px;
}

body {
    background: var(--fl-gray-100);
    color: var(--fl-gray-900);
    font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
}

/* ---------- Login ---------- */
.login-page { background: linear-gradient(135deg, var(--fl-primary-dark), var(--fl-primary) 60%, var(--fl-green-dark)); min-height: 100vh; display: flex; align-items: center; }
.login-wrapper { width: 100%; display: flex; justify-content: center; padding: 20px; }
.login-card { background: #fff; border-radius: 14px; padding: 36px; width: 100%; max-width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand i { font-size: 34px; color: var(--fl-primary); }
.login-brand strong { display: block; font-size: 18px; color: var(--fl-gray-900); }
.login-brand span { display: block; font-size: 12px; color: var(--fl-gray-500); }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--fl-primary-dark);
    color: #fff;
    flex-shrink: 0;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .2s ease;
}
.sidebar .brand { padding: 18px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand i { font-size: 24px; color: var(--fl-green); }
.sidebar .brand strong { font-size: 15px; }
.sidebar .brand small { display: block; font-size: 11px; color: rgba(255,255,255,.6); }

.sidebar-nav { padding: 10px 0 30px; }
.sidebar-nav .nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: rgba(255,255,255,.4); padding: 14px 20px 6px; }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 9px 20px; color: rgba(255,255,255,.85); text-decoration: none; font-size: 14px; border-left: 3px solid transparent; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: rgba(255,255,255,.1); border-left-color: var(--fl-green); color: #fff; font-weight: 600; }
.sidebar-nav a i { width: 18px; text-align: center; }

.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar { background: #fff; border-bottom: 1px solid var(--fl-gray-200); padding: 12px 24px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1020; }
.topbar .btn-toggle-sidebar { display: none; }

.page-content { padding: 24px; flex: 1; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .topbar .btn-toggle-sidebar { display: inline-flex; }
}

/* ---------- Cards / KPIs ---------- */
.kpi-card { background: #fff; border-radius: 10px; padding: 18px 20px; border: 1px solid var(--fl-gray-200); height: 100%; }
.kpi-card .kpi-label { font-size: 12px; color: var(--fl-gray-500); text-transform: uppercase; letter-spacing: .03em; }
.kpi-card .kpi-value { font-size: 22px; font-weight: 700; color: var(--fl-gray-900); margin-top: 4px; }
.kpi-card .kpi-icon { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; color: #fff; }
.kpi-card.positive .kpi-value { color: var(--fl-green-dark); }
.kpi-card.negative .kpi-value { color: var(--fl-red); }

.bg-fl-primary { background: var(--fl-primary) !important; }
.bg-fl-green { background: var(--fl-green) !important; }
.bg-fl-red { background: var(--fl-red) !important; }
.bg-fl-orange { background: var(--fl-orange) !important; }
.bg-fl-yellow { background: var(--fl-yellow) !important; }
.bg-fl-blue { background: var(--fl-blue) !important; }
.bg-fl-gray { background: var(--fl-gray-500) !important; }

.panel { background: #fff; border-radius: 10px; border: 1px solid var(--fl-gray-200); }
.panel-header { padding: 14px 18px; border-bottom: 1px solid var(--fl-gray-200); font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.panel-body { padding: 18px; }

/* ---------- Status de vencimento (item 8 do prompt) ---------- */
.status-pago, .badge-status-PAGA, .badge-status-RECEBIDA { background: var(--fl-green) !important; }
.badge-status-PENDENTE { background: var(--fl-blue) !important; }
.badge-status-VENCE_EM_BREVE { background: var(--fl-yellow) !important; color:#1f2937 !important; }
.badge-status-VENCE_HOJE { background: var(--fl-orange) !important; }
.badge-status-VENCIDA { background: var(--fl-red) !important; }
.badge-status-CANCELADA, .badge-status-PAGA_PARCIAL, .badge-status-RECEBIDA_PARCIAL { background: var(--fl-gray-500) !important; }

table.table-fl thead { background: var(--fl-primary-dark); color: #fff; }
table.table-fl thead th { border: none; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }

.text-money-positive { color: var(--fl-green-dark); font-weight: 600; }
.text-money-negative { color: var(--fl-red); font-weight: 600; }

.stock-low { background: #fef2f2 !important; }
