/* ═══════════════════════════════════════════════════════════════
   CFO-Connect Midnight Theme — Meia-Noite
   Azul escuro elegante com toques de vinho
   ═══════════════════════════════════════════════════════════════ */

body.theme-midnight {
    --bg: #0f1729;
    --bg-card: #162038;
    --text: #e4e8f0;
    --text-light: #94a3c0;
    --text-muted: #5f7090;
    --border: #243352;
    --border-light: #1c2a45;

    --background: #0f1729;
    --foreground: #e4e8f0;
    --card: #162038;
    --card-foreground: #e4e8f0;
    --muted-foreground: #5f7090;
    --primary: var(--wine, #8B2E5A);
    --primary-foreground: #ffffff;
    --secondary: hsl(345, 50%, 18%);

    --success: #34d058;
    --warning: #f0b832;
    --danger: #f85149;
    --info: #58a6ff;

    --sidebar-bg: var(--wine-dark, #4A1832);

    background: var(--background) !important;
    color: var(--foreground) !important;
    font-family: var(--font-body, 'Inter', sans-serif) !important;
}

body.theme-midnight h1, body.theme-midnight h2, body.theme-midnight h3,
body.theme-midnight h4, body.theme-midnight h5, body.theme-midnight h6 {
    font-family: var(--font-display, 'Exo 2', sans-serif) !important;
    color: var(--foreground) !important;
}

/* ── Topbar ── */
body.theme-midnight .app-layout.cfo-connect-layout .topbar {
    background: rgba(22, 32, 56, 0.75) !important;
    backdrop-filter: blur(14px) !important;
    -webkit-backdrop-filter: blur(14px) !important;
    border-bottom: 1px solid rgba(88, 166, 255, 0.08) !important;
    color: var(--foreground) !important;
}

body.theme-midnight .app-layout.cfo-connect-layout .topbar-title,
body.theme-midnight .app-layout.cfo-connect-layout .topbar-brand .topbar-title {
    color: var(--foreground) !important;
    font-family: var(--font-display, 'Exo 2', sans-serif) !important;
}

body.theme-midnight .app-layout.cfo-connect-layout .user-name {
    color: var(--text-light) !important;
}

body.theme-midnight .app-layout.cfo-connect-layout .topbar-icon {
    color: var(--muted-foreground) !important;
}

body.theme-midnight .app-layout.cfo-connect-layout .topbar-icon:hover {
    color: #58a6ff !important;
    background: rgba(88, 166, 255, 0.08) !important;
}

body.theme-midnight .app-layout.cfo-connect-layout .user-role {
    background: rgba(139, 46, 90, 0.25) !important;
    color: #e4e8f0 !important;
}

body.theme-midnight .page-title {
    color: var(--foreground) !important;
}

/* ── Content area ── */
body.theme-midnight .app-layout.cfo-connect-layout .content-area {
    background: var(--background);
}

/* ── Cards ── */
body.theme-midnight .card,
body.theme-midnight .home-card,
body.theme-midnight .home-sala-card,
body.theme-midnight .kpi-card,
body.theme-midnight .system-card,
body.theme-midnight .gov-content-block,
body.theme-midnight .gov-benefit-card,
body.theme-midnight .manage-item,
body.theme-midnight .quick-action,
body.theme-midnight .indicator,
body.theme-midnight .team-dept,
body.theme-midnight .floormap-container {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
    color: var(--card-foreground) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

body.theme-midnight .card:hover,
body.theme-midnight .home-card:hover,
body.theme-midnight .home-sala-card:hover,
body.theme-midnight .system-card:hover,
body.theme-midnight .manage-item:hover,
body.theme-midnight .quick-action:hover,
body.theme-midnight .indicator:hover {
    border-color: rgba(88, 166, 255, 0.2) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
}

/* ── Títulos ── */
body.theme-midnight .home-section-title,
body.theme-midnight .home-card-title,
body.theme-midnight .gov-section-title,
body.theme-midnight .gov-hero-title,
body.theme-midnight .card-header h3,
body.theme-midnight .detail-section h3 {
    color: var(--foreground) !important;
}

body.theme-midnight .home-section-title .material-icons-outlined,
body.theme-midnight .home-card-title .material-icons-outlined,
body.theme-midnight .gov-section-title .material-icons-outlined {
    color: #58a6ff !important;
}

/* ── Links ── */
body.theme-midnight a[href] {
    color: var(--wine, #8B2E5A) !important;
}
body.theme-midnight .home-card-link:hover {
    color: #58a6ff !important;
}

/* ── Tabelas ── */
body.theme-midnight .data-table th,
body.theme-midnight .catalog-table th {
    background: #1a2b4a !important;
    color: var(--text-light) !important;
    border-bottom-color: var(--border) !important;
}
body.theme-midnight .data-table td,
body.theme-midnight .catalog-table td {
    border-bottom-color: var(--border-light) !important;
    color: var(--text) !important;
}
body.theme-midnight .data-table tbody tr:hover,
body.theme-midnight .catalog-table tbody tr:hover {
    background: rgba(88, 166, 255, 0.04) !important;
}

/* ── Formulários ── */
body.theme-midnight .form-control {
    background: #1a2b4a !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
body.theme-midnight .form-control:focus {
    border-color: #58a6ff !important;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.12) !important;
}
body.theme-midnight .form-group label {
    color: var(--text-light) !important;
}
body.theme-midnight select.form-control {
    background: #1a2b4a !important;
}

/* ── Botões ── */
body.theme-midnight .btn-outline {
    background: transparent !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}
body.theme-midnight .btn-outline:hover {
    background: rgba(88, 166, 255, 0.08) !important;
    border-color: rgba(88, 166, 255, 0.3) !important;
}

/* ── KPIs ── */
body.theme-midnight .kpi-icon.wine { background: rgba(139, 46, 90, 0.2) !important; color: #B04470 !important; }
body.theme-midnight .kpi-icon.gold { background: rgba(212, 160, 60, 0.15) !important; color: #E8C266 !important; }
body.theme-midnight .kpi-icon.success { background: rgba(52, 208, 88, 0.12) !important; color: #34d058 !important; }
body.theme-midnight .kpi-icon.danger { background: rgba(248, 81, 73, 0.12) !important; color: #f85149 !important; }
body.theme-midnight .kpi-icon.warning { background: rgba(240, 184, 50, 0.12) !important; color: #f0b832 !important; }
body.theme-midnight .kpi-icon.info { background: rgba(88, 166, 255, 0.12) !important; color: #58a6ff !important; }
body.theme-midnight .kpi-content h4 { color: var(--text) !important; }
body.theme-midnight .kpi-content p { color: var(--text-muted) !important; }
body.theme-midnight .indicator-value { color: #58a6ff !important; }
body.theme-midnight .indicator-label { color: var(--text-light) !important; }

/* ── Hero ── */
body.theme-midnight .hero-cfo-connect .hero-inner.mesh-gradient {
    background: linear-gradient(135deg, #162038 0%, #1a2b4a 25%, #243a5e 50%, #1a2b4a 75%, #162038 100%) !important;
    background-size: 400% 400% !important;
    animation: mesh-move 12s ease-in-out infinite;
}
body.theme-midnight .hero-cfo-connect .hero-inner {
    background: var(--card) !important;
    border: 1px solid var(--border) !important;
}

/* ── Team ── */
body.theme-midnight .team-dept-header { background: #1a2b4a !important; }
body.theme-midnight .team-dept-name { color: var(--foreground) !important; }
body.theme-midnight .team-member:hover { background: rgba(88, 166, 255, 0.06) !important; }
body.theme-midnight .team-member.active { background: rgba(139, 46, 90, 0.15) !important; }
body.theme-midnight .team-name { color: var(--text) !important; }
body.theme-midnight .team-role { color: var(--text-muted) !important; }

/* ── Misc ── */
body.theme-midnight .pillar,
body.theme-midnight .gov-pillar-item,
body.theme-midnight .gov-highlight-box,
body.theme-midnight .gov-content-footer { background: #1a2b4a !important; }

body.theme-midnight .person-detail { background: var(--card) !important; }
body.theme-midnight .sys-tag { background: rgba(88, 166, 255, 0.1) !important; color: #58a6ff !important; }

body.theme-midnight .modal { background: var(--card) !important; border: 1px solid var(--border) !important; }
body.theme-midnight .modal-overlay { background: rgba(0, 0, 0, 0.5) !important; }

body.theme-midnight .home-footer,
body.theme-midnight .gov-footer {
    border-top-color: var(--border) !important;
    color: var(--text-muted) !important;
    background: var(--card) !important;
}

body.theme-midnight .gov-area { background: var(--card) !important; border: 1px solid var(--border) !important; }
body.theme-midnight .gov-area:hover { background: rgba(88, 166, 255, 0.04) !important; }

body.theme-midnight .gov-login { background: #1a2b4a !important; border-color: var(--border) !important; }
body.theme-midnight .gov-login h3 { color: var(--foreground) !important; }

body.theme-midnight .portal-nav a { color: var(--text) !important; background: #1a2b4a !important; }
body.theme-midnight .portal-nav a:hover { background: #243352 !important; color: #58a6ff !important; }
body.theme-midnight .portal-nav a.active { background: var(--wine) !important; color: #fff !important; }

body.theme-midnight .catalog-group { border-color: var(--border-light) !important; }
body.theme-midnight .catalog-group-header { background: #1a2b4a !important; color: var(--text) !important; }

body.theme-midnight .quick-action:hover { border-color: rgba(88, 166, 255, 0.3) !important; background: rgba(88, 166, 255, 0.06) !important; }

body.theme-midnight .breadcrumb { color: var(--text-muted) !important; }
body.theme-midnight .breadcrumb a { color: var(--text-muted) !important; }
body.theme-midnight .breadcrumb a:hover { color: #58a6ff !important; }

body.theme-midnight .pagination-link { border-color: var(--border) !important; color: var(--text) !important; }
body.theme-midnight .pagination-link:hover { background: #1a2b4a !important; color: #58a6ff !important; }
body.theme-midnight .pagination-link.active { background: var(--wine) !important; color: #fff !important; border-color: var(--wine) !important; }

/* ── Alerts ── */
body.theme-midnight .alert-error { background: rgba(248, 81, 73, 0.1) !important; color: #f85149 !important; border-color: rgba(248, 81, 73, 0.2) !important; }
body.theme-midnight .alert-success { background: rgba(52, 208, 88, 0.1) !important; color: #34d058 !important; border-color: rgba(52, 208, 88, 0.2) !important; }
body.theme-midnight .alert-warning { background: rgba(240, 184, 50, 0.1) !important; color: #f0b832 !important; border-color: rgba(240, 184, 50, 0.2) !important; }
body.theme-midnight .alert-info { background: rgba(88, 166, 255, 0.1) !important; color: #58a6ff !important; border-color: rgba(88, 166, 255, 0.2) !important; }

/* ── Badges ── */
body.theme-midnight .badge-admin { background: var(--wine) !important; color: #fff !important; }
body.theme-midnight .badge-leitor { background: #243352 !important; color: var(--text-light) !important; }

/* ── Board ── */
body.theme-midnight .board-header .cell { background: #1a2b4a !important; color: var(--text-muted) !important; }
body.theme-midnight .board-header .cell-name { background: #1a2b4a !important; }
body.theme-midnight .board-header .cell-backlog { background: #1a2b4a !important; }
body.theme-midnight .board-header .cell.today { background: rgba(240, 184, 50, 0.12) !important; color: #f0b832 !important; }

/* ── Scrollbar ── */
body.theme-midnight ::-webkit-scrollbar { width: 6px; height: 6px; }
body.theme-midnight ::-webkit-scrollbar-track { background: var(--background); }
body.theme-midnight ::-webkit-scrollbar-thumb { background: #243352; border-radius: 3px; }
body.theme-midnight ::-webkit-scrollbar-thumb:hover { background: #2d4268; }

/* ── Sidebar ── */
body.theme-midnight .sidebar-icon {
    background: var(--sidebar-bg) !important;
}
