/* Holy Family — FIDES-style dark theme overrides */

html[data-bs-theme="dark"] {
    color-scheme: dark;
    --hf-card-bg: #0d0d0d;
    --sidebar-bg: #0d0d0d;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --sidebar-active: rgba(220, 53, 69, 0.2);
    --portal-sidebar-bg: #0d0d0d;
    --portal-sidebar-hover: rgba(255, 255, 255, 0.08);
    --portal-sidebar-active: rgba(220, 53, 69, 0.2);
    --bs-body-bg: #0d0d0d;
    --bs-body-color: #e5e5e5;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: rgba(255, 255, 255, 0.65);
    --bs-tertiary-color: rgba(255, 255, 255, 0.45);
    --bs-border-color: rgba(255, 255, 255, 0.1);
    --bs-light: #1a1a1a;
    --bs-light-rgb: 26, 26, 26;
}

/* ── Base surfaces ─────────────────────────────────────────── */
html[data-bs-theme="dark"] body,
html[data-bs-theme="dark"] body.cms-body,
html[data-bs-theme="dark"] body.portal-app-body {
    background-color: #0d0d0d !important;
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .main-content,
html[data-bs-theme="dark"] .content-wrapper,
html[data-bs-theme="dark"] .portal-main-content,
html[data-bs-theme="dark"] .portal-content-wrapper,
html[data-bs-theme="dark"] main,
html[data-bs-theme="dark"] .portal-public-main {
    background-color: #0d0d0d !important;
    color: #e5e5e5;
}

/* ── Chrome: sidebar, topbar, footer ───────────────────────── */
html[data-bs-theme="dark"] #sidebar {
    background: #0d0d0d !important;
    border-right-color: rgba(255, 255, 255, 0.08) !important;
    box-shadow: none;
}

html[data-bs-theme="dark"] .sidebar-brand-wrap {
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-bs-theme="dark"] .sidebar-close-btn {
    color: rgba(255, 255, 255, 0.85);
}

html[data-bs-theme="dark"] .sidebar-close-btn:hover {
    color: #fff;
}

html[data-bs-theme="dark"] .brand-name {
    color: #fff;
}

html[data-bs-theme="dark"] #sidebar .nav-item {
    color: rgba(255, 255, 255, 0.75);
}

html[data-bs-theme="dark"] #sidebar .nav-item > i:first-child {
    color: rgba(255, 255, 255, 0.65);
}

html[data-bs-theme="dark"] #sidebar .nav-item:hover {
    color: rgba(255, 255, 255, 0.95);
    background: var(--sidebar-hover);
}

html[data-bs-theme="dark"] #sidebar .nav-item:hover > i:first-child {
    color: rgba(255, 255, 255, 0.95);
}

html[data-bs-theme="dark"] #sidebar .nav-item.active {
    color: #fff;
}

html[data-bs-theme="dark"] #sidebar .nav-item.active:not([data-menu-id="dashboard"]) {
    background: var(--sidebar-active);
    color: #fff;
}

html[data-bs-theme="dark"] #sidebar .nav-item.active:not([data-menu-id="dashboard"]) > i:first-child {
    color: #ff6b7a;
}

html[data-bs-theme="dark"] #sidebar .sidebar-nav > * + * {
    border-top-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] #sidebar .nav-submenu {
    background: rgba(0, 0, 0, 0.25);
    border-top-color: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] #sidebar .nav-subitem {
    color: rgba(255, 255, 255, 0.7);
    border-top-color: rgba(255, 255, 255, 0.06);
}

html[data-bs-theme="dark"] #sidebar .nav-subitem > i {
    color: rgba(255, 255, 255, 0.55);
}

html[data-bs-theme="dark"] #sidebar .nav-subitem:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

html[data-bs-theme="dark"] #sidebar .nav-subitem.active {
    background: var(--sidebar-active);
    color: #fff;
}

html[data-bs-theme="dark"] #sidebar .nav-subitem.active > i {
    color: #ff6b7a;
}

html[data-bs-theme="dark"] #sidebar .nav-group-toggle .nav-chevron {
    color: rgba(255, 255, 255, 0.55);
}

html[data-bs-theme="dark"] .navbar-top,
html[data-bs-theme="dark"] .portal-navbar-top {
    background: #0d0d0d !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-bs-theme="dark"] .sidebar-toggle {
    color: rgba(255, 255, 255, 0.75);
}

html[data-bs-theme="dark"] .sidebar-toggle:hover {
    color: #fff;
}

html[data-bs-theme="dark"] .tenant-name,
html[data-bs-theme="dark"] .portal-topbar-title {
    color: #f5f5f5;
}

html[data-bs-theme="dark"] .user-icon-btn {
    color: rgba(255, 255, 255, 0.75);
}

html[data-bs-theme="dark"] .user-icon-btn:hover {
    color: #fff;
}

html[data-bs-theme="dark"] .main-footer,
html[data-bs-theme="dark"] .portal-main-footer,
html[data-bs-theme="dark"] .hf-footer {
    background: #0d0d0d !important;
    border-top-color: rgba(255, 255, 255, 0.08) !important;
    color: rgba(255, 255, 255, 0.55);
}

html[data-bs-theme="dark"] .site-copyright {
    color: rgba(255, 255, 255, 0.55);
}

html[data-bs-theme="dark"] .site-copyright-link {
    color: #4ade80;
}

html[data-bs-theme="dark"] .site-copyright-link:hover {
    color: #86efac;
}

/* ── Page chrome ───────────────────────────────────────────── */
html[data-bs-theme="dark"] .page-header h1,
html[data-bs-theme="dark"] .page-header h2 {
    color: #f5f5f5;
}

html[data-bs-theme="dark"] .page-header p {
    color: rgba(255, 255, 255, 0.65) !important;
}

/* ── Cards & dashboard ─────────────────────────────────────── */
html[data-bs-theme="dark"] .card,
html[data-bs-theme="dark"] .cms-card,
html[data-bs-theme="dark"] .dk,
html[data-bs-theme="dark"] .welcome-banner,
html[data-bs-theme="dark"] .stat-card,
html[data-bs-theme="dark"] .dashboard-panel,
html[data-bs-theme="dark"] .finance-kpi,
html[data-bs-theme="dark"] .fides-detail-page .detail-section-card,
html[data-bs-theme="dark"] .fides-detail-page .detail-stat-card {
    background: var(--hf-card-bg) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e5e5e5 !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] .card-header,
html[data-bs-theme="dark"] .cms-card .card-header,
html[data-bs-theme="dark"] .welcome-banner h2,
html[data-bs-theme="dark"] .welcome-banner #bannerDateTime {
    background: var(--hf-card-bg) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e5e5e5 !important;
}

html[data-bs-theme="dark"] .welcome-banner .welcome-meta,
html[data-bs-theme="dark"] .welcome-banner .welcome-scope {
    color: rgba(255, 255, 255, 0.65);
}

html[data-bs-theme="dark"] .dk-stat .s-val {
    color: #f5f5f5;
}

html[data-bs-theme="dark"] .dk-stat .s-lbl,
html[data-bs-theme="dark"] .dk-stat .s-val-unit {
    color: rgba(255, 255, 255, 0.6);
}

html[data-bs-theme="dark"] .finance-kpi-value {
    color: #f5f5f5;
}

html[data-bs-theme="dark"] .finance-kpi-label,
html[data-bs-theme="dark"] .finance-report-label {
    color: rgba(255, 255, 255, 0.6);
}

html[data-bs-theme="dark"] .finance-report-period {
    color: rgba(255, 255, 255, 0.75);
}

html[data-bs-theme="dark"] .fides-detail-page .detail-field-label {
    color: rgba(255, 255, 255, 0.6);
}

html[data-bs-theme="dark"] .fides-detail-page .detail-field-value {
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .fides-detail-page .detail-photo-wrap {
    background: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .fides-detail-page .detail-table thead th,
html[data-bs-theme="dark"] .finance-report-table thead th {
    background: #111 !important;
    color: rgba(255, 255, 255, 0.65) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-bs-theme="dark"] .fides-detail-page .detail-table tbody td {
    border-color: rgba(255, 255, 255, 0.08);
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .cms-settings-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .cms-settings-tabs .nav-link {
    color: rgba(255, 255, 255, 0.65);
}

html[data-bs-theme="dark"] .cms-settings-tabs .nav-link:hover {
    color: #4ade80;
    background: rgba(255, 255, 255, 0.04);
}

html[data-bs-theme="dark"] .cms-settings-tabs .nav-link.active {
    color: #4ade80;
    background: var(--hf-card-bg);
    border-bottom-color: #4ade80;
}

/* ── Public portal hero ────────────────────────────────────── */
html[data-bs-theme="dark"] .hero-section {
    background: #0d0d0d !important;
    color: #e5e5e5 !important;
}

html[data-bs-theme="dark"] .hero-auth-prompt {
    color: rgba(255, 255, 255, 0.75);
}

html[data-bs-theme="dark"] .hero-auth-prompt a {
    color: #93c5fd;
}

/* ── CMS tables (override cms.css hardcoded light thead/tbody) ─ */
html[data-bs-theme="dark"] .main-content .table,
html[data-bs-theme="dark"] .cms-card .table,
html[data-bs-theme="dark"] .portal-content-wrapper .table {
    border-color: rgba(255, 255, 255, 0.08) !important;
    color: #e5e5e5 !important;
    --bs-table-bg: var(--hf-card-bg);
    --bs-table-color: #e5e5e5;
    --bs-table-border-color: rgba(255, 255, 255, 0.08);
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.04);
    --bs-table-hover-color: #fff;
}

html[data-bs-theme="dark"] .main-content .table > :not(caption) > * > *,
html[data-bs-theme="dark"] .cms-card .table > :not(caption) > * > *,
html[data-bs-theme="dark"] .portal-content-wrapper .table > :not(caption) > * > * {
    border-color: rgba(255, 255, 255, 0.08) !important;
    background-color: var(--hf-card-bg) !important;
    color: #e5e5e5 !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] .main-content .table thead th,
html[data-bs-theme="dark"] .cms-card .table thead th,
html[data-bs-theme="dark"] .portal-content-wrapper .table thead th,
html[data-bs-theme="dark"] .finance-report-table thead th,
html[data-bs-theme="dark"] .fides-detail-page .detail-table thead th,
html[data-bs-theme="dark"] .portal-profile-page .detail-table thead th {
    background: #111 !important;
    color: rgba(255, 255, 255, 0.78) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    --bs-table-bg: #111;
    --bs-table-color: rgba(255, 255, 255, 0.78);
}

html[data-bs-theme="dark"] .main-content .table tbody td,
html[data-bs-theme="dark"] .cms-card .table tbody td,
html[data-bs-theme="dark"] .portal-content-wrapper .table tbody td,
html[data-bs-theme="dark"] .fides-detail-page .detail-table tbody td,
html[data-bs-theme="dark"] .portal-profile-page .detail-table tbody td {
    color: #e5e5e5 !important;
    border-bottom-color: rgba(255, 255, 255, 0.08) !important;
    background-color: var(--hf-card-bg) !important;
}

html[data-bs-theme="dark"] .main-content .table-hover > tbody > tr:hover > *,
html[data-bs-theme="dark"] .cms-card .table-hover > tbody > tr:hover > *,
html[data-bs-theme="dark"] .portal-content-wrapper .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: #fff !important;
}

html[data-bs-theme="dark"] .main-content .table .text-muted,
html[data-bs-theme="dark"] .cms-card .table .text-muted,
html[data-bs-theme="dark"] .portal-content-wrapper .table .text-muted {
    color: rgba(255, 255, 255, 0.55) !important;
}

/* ── Forms & labels ─────────────────────────────────────────── */
html[data-bs-theme="dark"] .form-label,
html[data-bs-theme="dark"] label.form-label {
    color: rgba(255, 255, 255, 0.85) !important;
}

html[data-bs-theme="dark"] .form-control:focus,
html[data-bs-theme="dark"] .form-select:focus {
    border-color: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] .form-check-label {
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .input-group-text {
    background-color: #141414;
    color: rgba(255, 255, 255, 0.75);
}

/* ── Buttons ─────────────────────────────────────────────────── */
html[data-bs-theme="dark"] .btn-green,
html[data-bs-theme="dark"] a.btn-green {
    background: transparent !important;
    border-color: #4ade80 !important;
    color: #4ade80 !important;
}

html[data-bs-theme="dark"] .btn-green:hover,
html[data-bs-theme="dark"] a.btn-green:hover {
    background: #198754 !important;
    border-color: #198754 !important;
    color: #fff !important;
}

html[data-bs-theme="dark"] .btn-outline-primary {
    color: #6ea8fe;
    border-color: #6ea8fe;
}

html[data-bs-theme="dark"] .btn-outline-primary:hover {
    background: #0d6efd;
    border-color: #0d6efd;
    color: #fff;
}

html[data-bs-theme="dark"] .btn-outline-secondary {
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.25);
}

html[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.35);
    color: #fff;
}

html[data-bs-theme="dark"] .btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
}

html[data-bs-theme="dark"] .btn-outline-warning:hover {
    background: #ffc107;
    color: #111;
}

html[data-bs-theme="dark"] .btn-outline-danger {
    color: #f87171;
    border-color: #f87171;
}

html[data-bs-theme="dark"] .btn-outline-danger:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

/* ── Detail pages (CMS + portal profile) ─────────────────────── */
html[data-bs-theme="dark"] .fides-detail-page .detail-section-card-header,
html[data-bs-theme="dark"] .portal-profile-page .detail-section-card-header {
    background: #111 !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.75) !important;
}

html[data-bs-theme="dark"] .fides-detail-page .detail-stat-value,
html[data-bs-theme="dark"] .portal-profile-page .detail-stat-value {
    color: #f5f5f5 !important;
}

html[data-bs-theme="dark"] .fides-detail-page .detail-stat-label,
html[data-bs-theme="dark"] .portal-profile-page .detail-stat-label {
    color: rgba(255, 255, 255, 0.6) !important;
}

html[data-bs-theme="dark"] .fides-detail-page .detail-field-value,
html[data-bs-theme="dark"] .portal-profile-page .detail-field-value {
    color: #e5e5e5 !important;
}

html[data-bs-theme="dark"] .portal-profile-page .portal-profile-title,
html[data-bs-theme="dark"] .portal-form-section-title {
    color: #f5f5f5 !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-bs-theme="dark"] .portal-profile-page .detail-stat-card,
html[data-bs-theme="dark"] .portal-profile-page .detail-section-card {
    background: var(--hf-card-bg) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] .portal-profile-page .detail-photo-wrap,
html[data-bs-theme="dark"] .portal-profile-photo,
html[data-bs-theme="dark"] .member-dashboard-photo {
    background: #141414 !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
}

html[data-bs-theme="dark"] .member-dashboard-photo {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

html[data-bs-theme="dark"] .dashboard-table-panel .dashboard-table-body {
    background: var(--hf-card-bg);
}

html[data-bs-theme="dark"] .dashboard-card-header > span {
    color: #e5e5e5;
}

/* ── Portal member area ──────────────────────────────────────── */
html[data-bs-theme="dark"] .stat-card {
    background: var(--hf-card-bg) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .card-header.bg-white {
    background: #111 !important;
    color: #e5e5e5 !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-bs-theme="dark"] .badge.bg-light.text-dark,
html[data-bs-theme="dark"] .badge.bg-light {
    background-color: rgba(255, 255, 255, 0.12) !important;
    color: #e5e5e5 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-bs-theme="dark"] .alert-success {
    background-color: rgba(40, 167, 69, 0.12);
    border-left-color: #28a745;
    color: #86efac;
}

html[data-bs-theme="dark"] .alert-info {
    background-color: rgba(23, 162, 184, 0.12);
    border-left-color: #17a2b8;
    color: #7dd3fc;
}

/* ── Auth pages (login) ──────────────────────────────────────── */
html[data-bs-theme="dark"] body.auth-page {
    background: #0d0d0d !important;
}

html[data-bs-theme="dark"] .login-container {
    background: #1a1a1a;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}

html[data-bs-theme="dark"] .login-form-panel {
    background: #1a1a1a;
}

html[data-bs-theme="dark"] .login-form-content h3,
html[data-bs-theme="dark"] .login-form-content .fw-bold {
    color: #f5f5f5 !important;
}

html[data-bs-theme="dark"] .login-form-logo {
    border-color: rgba(255, 255, 255, 0.15);
}

html[data-bs-theme="dark"] .login-copyright {
    color: rgba(255, 255, 255, 0.5);
}

html[data-bs-theme="dark"] .login-form-content a[style],
html[data-bs-theme="dark"] .login-form-content a.text-decoration-none {
    color: #93c5fd !important;
}

@media (max-width: 991.98px) {
    html[data-bs-theme="dark"] body.auth-page {
        background: #0d0d0d !important;
    }

    html[data-bs-theme="dark"] .login-form-content {
        background: rgba(26, 26, 26, 0.96) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    }
}

/* ── Bootstrap component overrides (FIDES parity) ────────────── */
html[data-bs-theme="dark"] .card-footer {
    background-color: var(--hf-card-bg) !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .card-title,
html[data-bs-theme="dark"] .card-text,
html[data-bs-theme="dark"] h1,
html[data-bs-theme="dark"] h2,
html[data-bs-theme="dark"] h3,
html[data-bs-theme="dark"] h4,
html[data-bs-theme="dark"] h5,
html[data-bs-theme="dark"] h6,
html[data-bs-theme="dark"] p,
html[data-bs-theme="dark"] label,
html[data-bs-theme="dark"] .form-label,
html[data-bs-theme="dark"] dd,
html[data-bs-theme="dark"] dt,
html[data-bs-theme="dark"] li,
html[data-bs-theme="dark"] td,
html[data-bs-theme="dark"] th,
html[data-bs-theme="dark"] span,
html[data-bs-theme="dark"] div {
    color: inherit;
}

html[data-bs-theme="dark"] .table {
    color: #e5e5e5 !important;
}

html[data-bs-theme="dark"] .table > :not(caption) > * > * {
    color: #e5e5e5 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
}

html[data-bs-theme="dark"] .table-light,
html[data-bs-theme="dark"] thead.table-light,
html[data-bs-theme="dark"] thead.table-light th,
html[data-bs-theme="dark"] .table-light > th,
html[data-bs-theme="dark"] .table-light > td,
html[data-bs-theme="dark"] .table > thead.table-light > tr > th {
    background-color: #111 !important;
    color: #e5e5e5 !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
    --bs-table-bg: #111;
    --bs-table-color: #e5e5e5;
}

html[data-bs-theme="dark"] .form-control,
html[data-bs-theme="dark"] .form-select,
html[data-bs-theme="dark"] .input-group-text {
    background-color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.12);
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .form-control::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

html[data-bs-theme="dark"] .text-muted,
html[data-bs-theme="dark"] .small.text-muted {
    color: rgba(255, 255, 255, 0.6) !important;
}

html[data-bs-theme="dark"] .dropdown-menu {
    background-color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .dropdown-item {
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .dropdown-item:hover,
html[data-bs-theme="dark"] .dropdown-item:focus {
    background-color: rgba(255, 255, 255, 0.06);
    color: #fff;
}

html[data-bs-theme="dark"] .dropdown-header {
    color: rgba(255, 255, 255, 0.6);
}

html[data-bs-theme="dark"] .dropdown-divider {
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .border,
html[data-bs-theme="dark"] .border-bottom,
html[data-bs-theme="dark"] .border-top,
html[data-bs-theme="dark"] .border-start,
html[data-bs-theme="dark"] .border-end {
    border-color: rgba(255, 255, 255, 0.1) !important;
}

html[data-bs-theme="dark"] .bg-light,
html[data-bs-theme="dark"] .bg-white {
    background-color: #1a1a1a !important;
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .text-dark,
html[data-bs-theme="dark"] .text-body {
    color: #e5e5e5 !important;
}

html[data-bs-theme="dark"] .modal-content {
    background-color: #1a1a1a;
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .modal-header,
html[data-bs-theme="dark"] .modal-footer {
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .list-group-item {
    background-color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .nav-tabs {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .nav-tabs .nav-link {
    color: rgba(255, 255, 255, 0.7);
    border-color: transparent;
}

html[data-bs-theme="dark"] .nav-tabs .nav-link.active {
    background-color: #1a1a1a;
    color: #fff;
    border-color: rgba(255, 255, 255, 0.1) rgba(255, 255, 255, 0.1) transparent;
}

html[data-bs-theme="dark"] .page-link {
    background-color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .page-item.active .page-link {
    background-color: #198754;
    border-color: #198754;
    color: #fff;
}

html[data-bs-theme="dark"] .page-item.disabled .page-link {
    background-color: #111;
    color: rgba(255, 255, 255, 0.4);
}

html[data-bs-theme="dark"] hr {
    border-color: rgba(255, 255, 255, 0.1);
}

html[data-bs-theme="dark"] .alert {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(251, 191, 36, 0.08);
    border-color: rgba(251, 191, 36, 0.3);
}

html[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(245, 108, 108, 0.12);
    border-color: rgba(245, 108, 108, 0.35);
    color: #fecaca;
}

html[data-bs-theme="dark"] .invalid-feedback,
html[data-bs-theme="dark"] .invalid-feedback.d-block {
    color: #f56c6c !important;
}

html[data-bs-theme="dark"] .btn-light {
    background-color: #1a1a1a;
    border-color: rgba(255, 255, 255, 0.1);
    color: #e5e5e5;
}

html[data-bs-theme="dark"] .btn-light:hover {
    background-color: #222;
    color: #fff;
}

html[data-bs-theme="dark"] .btn-outline-secondary,
html[data-bs-theme="dark"] .btn-outline-dark {
    color: #e5e5e5;
    border-color: rgba(255, 255, 255, 0.2);
}

html[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
    background-color: rgba(255, 255, 255, 0.04) !important;
    color: #fff !important;
}

html[data-bs-theme="dark"] .table-striped > tbody > tr > *,
html[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > *,
html[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(even) > * {
    background-color: transparent !important;
    color: #e5e5e5 !important;
}

html[data-bs-theme="dark"] a:not(.btn):not(.nav-link):not(.dropdown-item):not(.page-link):not(.list-group-item):not(.site-copyright-link) {
    color: #93c5fd;
}

html[data-bs-theme="dark"] .badge.bg-light {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #e5e5e5 !important;
}

html[data-bs-theme="dark"] .progress {
    background-color: rgba(255, 255, 255, 0.08);
}

html[data-bs-theme="dark"] .text-secondary,
html[data-bs-theme="dark"] small,
html[data-bs-theme="dark"] .small {
    color: rgba(255, 255, 255, 0.6) !important;
}

html[data-bs-theme="dark"] [style*="background: white"],
html[data-bs-theme="dark"] [style*="background:#fff"],
html[data-bs-theme="dark"] [style*="background: #fff"],
html[data-bs-theme="dark"] [style*="background-color: white"],
html[data-bs-theme="dark"] [style*="background-color:#fff"],
html[data-bs-theme="dark"] [style*="background-color: #fff"] {
    background: #1a1a1a !important;
    color: #e5e5e5 !important;
}

/* Light mode: re-affirm white chrome (cms.css defaults) */
html[data-bs-theme="light"] {
    --sidebar-bg: #ffffff;
    --sidebar-hover: rgba(0, 0, 0, 0.05);
    --sidebar-active: rgba(220, 53, 69, 0.12);
    --portal-sidebar-bg: #ffffff;
    --portal-sidebar-hover: rgba(0, 0, 0, 0.05);
    --portal-sidebar-active: rgba(220, 53, 69, 0.12);
}

html[data-bs-theme="light"] #sidebar {
    background: #ffffff !important;
    border-right: 1px solid #dee2e6;
    box-shadow: 2px 0 12px rgba(0, 0, 0, 0.04);
}

html[data-bs-theme="light"] .sidebar-brand-wrap {
    border-bottom-color: #dee2e6;
}

html[data-bs-theme="light"] .sidebar-close-btn {
    color: #495057;
}

html[data-bs-theme="light"] .sidebar-close-btn:hover {
    color: #212529;
}

html[data-bs-theme="light"] .brand-name {
    color: #0A0936;
}

html[data-bs-theme="light"] .navbar-top,
html[data-bs-theme="light"] .portal-navbar-top {
    background: #ffffff !important;
    border-bottom: 1px solid #dee2e6 !important;
}

html[data-bs-theme="light"] .sidebar-toggle {
    color: #495057;
}

html[data-bs-theme="light"] .sidebar-toggle:hover {
    color: #212529;
}

html[data-bs-theme="light"] .tenant-name,
html[data-bs-theme="light"] .portal-topbar-title {
    color: #212529;
}

html[data-bs-theme="light"] .user-icon-btn {
    color: #495057;
}

html[data-bs-theme="light"] .user-icon-btn:hover {
    color: #212529;
}
