/* Dark Mode Theme - Fiacore 2025 */
/* Comprehensive dark theme with complete coverage for all components */
/* Based on 2025 Fintech Best Practices - WCAG AA Compliant */

/* ===== DARK MODE CSS VARIABLES ===== */
[data-theme="dark"],
.theme-dark,
html.dark {
    /* ===== OVERRIDE SEMANTIC TOKENS FOR DARK MODE ===== */
    /* Background Colors - Dark Navy Palette */
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --bg-card: #1E293B;
    --bg-hover: #334155;
    --color-bg-primary: #0F172A;
    --color-bg-secondary: #1E293B;
    --color-bg-tertiary: #334155;
    --color-bg-card: #1E293B;
    --color-bg-elevated: #334155;
    --color-bg-hover: #475569;
    --color-bg-input: #1E293B;
    --color-bg-overlay: rgba(0, 0, 0, 0.7);
    
    /* Text Colors - Light for Dark Backgrounds */
    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    --text-disabled: #64748B;
    --color-text-primary: #F1F5F9;
    --color-text-secondary: #CBD5E1;
    --color-text-muted: #94A3B8;
    --color-text-disabled: #64748B;
    --color-text-heading: #F1F5F9;
    --color-text-link: #60A5FA;
    --color-text-link-hover: #93C5FD;
    
    /* Border Colors - Subtle for Dark Mode */
    --border-primary: rgba(255, 255, 255, 0.1);
    --border-secondary: rgba(255, 255, 255, 0.05);
    --color-border-light: rgba(255, 255, 255, 0.1);
    --color-border-medium: rgba(255, 255, 255, 0.15);
    --color-border-dark: rgba(255, 255, 255, 0.2);
    --color-border-divider: rgba(255, 255, 255, 0.1);
    --color-border-focus: #60A5FA;
    
    /* Brand Primary - Lighter for Dark Mode */
    --color-primary: #60A5FA;
    --color-primary-light: #93C5FD;
    --color-primary-dark: #3B82F6;
    --color-primary-bg: rgba(96, 165, 250, 0.15);
    --color-primary-border: rgba(96, 165, 250, 0.3);
    
    /* Income/Success - WCAG Compliant Desaturated */
    --color-income: #5EEAD4;
    --color-income-light: #99F6E4;
    --color-income-dark: #2DD4BF;
    --color-income-bg: rgba(94, 234, 212, 0.15);
    --color-income-border: rgba(94, 234, 212, 0.3);
    --color-success: #5EEAD4;
    --color-success-bg: rgba(94, 234, 212, 0.15);
    
    /* Expense/Error - WCAG Compliant Desaturated */
    --color-expense: #FB7185;
    --color-expense-light: #FDA4AF;
    --color-expense-dark: #F43F5E;
    --color-expense-bg: rgba(251, 113, 133, 0.15);
    --color-expense-border: rgba(251, 113, 133, 0.3);
    
    /* Warning - WCAG Compliant */
    --color-warning: #FBBF24;
    --color-warning-light: #FCD34D;
    --color-warning-dark: #F59E0B;
    --color-warning-bg: rgba(251, 191, 36, 0.15);
    --color-warning-border: rgba(251, 191, 36, 0.3);
    
    /* Info */
    --color-info: #60A5FA;
    --color-info-light: #93C5FD;
    --color-info-bg: rgba(96, 165, 250, 0.15);
    
    /* Secondary / Violet - WCAG Compliant */
    --color-secondary: #A78BFA;
    --color-secondary-light: #C4B5FD;
    --color-secondary-bg: rgba(167, 139, 250, 0.15);
    
    /* ===== CHART COLORS - DESATURATED FOR DARK MODE ===== */
    --chart-income: #5EEAD4;
    --chart-expense: #FB7185;
    --chart-primary: #60A5FA;
    --chart-warning: #FBBF24;
    --chart-info: #A78BFA;
    --chart-secondary: #2DD4BF;
    --chart-neutral: #94A3B8;
    
    /* Chart Series - Dark Mode Optimized */
    --chart-series-1: #60A5FA;
    --chart-series-2: #5EEAD4;
    --chart-series-3: #FBBF24;
    --chart-series-4: #A78BFA;
    --chart-series-5: #FB7185;
    --chart-series-6: #22D3EE;
    --chart-series-7: #2DD4BF;
    --chart-series-8: #FCD34D;
    
    /* ===== GRADIENT BACKGROUNDS - DARK MODE ===== */
    --gradient-primary: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
    --gradient-income: linear-gradient(135deg, #2DD4BF 0%, #059669 100%);
    --gradient-expense: linear-gradient(135deg, #FB7185 0%, #E11D48 100%);
    --gradient-card: linear-gradient(135deg, #1E293B 0%, #0F172A 100%);
    --gradient-chart-bg: linear-gradient(135deg, #1E293B 0%, #334155 100%);
    
    /* ===== COMPONENT-SPECIFIC TOKENS - DARK MODE ===== */
    /* Stat Cards */
    --stat-card-bg: #1E293B;
    --stat-card-border: rgba(96, 165, 250, 0.2);
    --stat-label-color: #94A3B8;
    --stat-value-color: #F1F5F9;
    --stat-detail-color: #64748B;
    
    /* Progress Bars */
    --progress-bg: #334155;
    --progress-track: #475569;
    
    /* Toggle Switches - CRITICAL FIX */
    --toggle-track-bg: #475569;
    --toggle-track-active: #3B82F6;
    --toggle-knob-bg: #F1F5F9;
    --toggle-border: #64748B;
    --toggle-label-color: #94A3B8;
    --toggle-label-active: #60A5FA;
    
    /* Icon Backgrounds - Dark Mode */
    --icon-bg-income: rgba(94, 234, 212, 0.15);
    --icon-bg-expense: rgba(251, 113, 133, 0.15);
    --icon-bg-primary: rgba(96, 165, 250, 0.15);
    --icon-bg-warning: rgba(251, 191, 36, 0.15);
    --icon-bg-secondary: rgba(167, 139, 250, 0.15);
    
    /* ===== COMPONENT TOKENS (TIER 3) - DARK MODE ===== */
    /* Buttons */
    --button-primary-bg: #3B82F6;
    --button-primary-text: #FFFFFF;
    --button-primary-hover: #2563EB;
    --button-primary-border: #3B82F6;
    --button-secondary-bg: transparent;
    --button-secondary-text: #60A5FA;
    --button-secondary-hover: rgba(96, 165, 250, 0.15);
    --button-secondary-border: #60A5FA;
    --button-danger-bg: #F43F5E;
    --button-danger-text: #FFFFFF;
    --button-danger-hover: #E11D48;
    --button-success-bg: #10B981;
    --button-success-text: #FFFFFF;
    --button-success-hover: #059669;
    --button-disabled-bg: #334155;
    --button-disabled-text: #64748B;
    
    /* Cards */
    --card-bg: #1E293B;
    --card-border: rgba(255, 255, 255, 0.1);
    --card-header-bg: #0F172A;
    --card-header-text: #F1F5F9;
    --card-body-text: #CBD5E1;
    --card-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
    --card-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    
    /* Forms / Inputs */
    --input-bg: #1E293B;
    --input-border: rgba(255, 255, 255, 0.15);
    --input-text: #F1F5F9;
    --input-placeholder: #64748B;
    --input-focus-border: #60A5FA;
    --input-focus-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
    --input-disabled-bg: #0F172A;
    --input-disabled-text: #475569;
    --input-error-border: #FB7185;
    --input-success-border: #5EEAD4;
    
    /* Tables */
    --table-bg: #1E293B;
    --table-header-bg: #0F172A;
    --table-header-text: #F1F5F9;
    --table-row-hover: #334155;
    --table-border: rgba(255, 255, 255, 0.1);
    --table-stripe-bg: rgba(255, 255, 255, 0.03);
    
    /* Modals */
    --modal-bg: #1E293B;
    --modal-header-bg: #0F172A;
    --modal-header-text: #F1F5F9;
    --modal-body-text: #CBD5E1;
    --modal-footer-bg: #0F172A;
    --modal-overlay: rgba(0, 0, 0, 0.8);
    --modal-border: rgba(255, 255, 255, 0.1);
    --modal-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
    
    /* Dropdowns */
    --dropdown-bg: #1E293B;
    --dropdown-border: rgba(255, 255, 255, 0.1);
    --dropdown-item-hover: #334155;
    --dropdown-item-text: #F1F5F9;
    --dropdown-item-active-bg: rgba(96, 165, 250, 0.15);
    --dropdown-item-active-text: #60A5FA;
    --dropdown-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    
    /* Badges */
    --badge-success-bg: rgba(94, 234, 212, 0.15);
    --badge-success-text: #5EEAD4;
    --badge-danger-bg: rgba(251, 113, 133, 0.15);
    --badge-danger-text: #FB7185;
    --badge-warning-bg: rgba(251, 191, 36, 0.15);
    --badge-warning-text: #FBBF24;
    --badge-info-bg: rgba(96, 165, 250, 0.15);
    --badge-info-text: #60A5FA;
    --badge-neutral-bg: rgba(148, 163, 184, 0.15);
    --badge-neutral-text: #94A3B8;
    
    /* Alerts */
    --alert-success-bg: rgba(94, 234, 212, 0.1);
    --alert-success-border: rgba(94, 234, 212, 0.3);
    --alert-success-text: #5EEAD4;
    --alert-danger-bg: rgba(251, 113, 133, 0.1);
    --alert-danger-border: rgba(251, 113, 133, 0.3);
    --alert-danger-text: #FB7185;
    --alert-warning-bg: rgba(251, 191, 36, 0.1);
    --alert-warning-border: rgba(251, 191, 36, 0.3);
    --alert-warning-text: #FBBF24;
    --alert-info-bg: rgba(96, 165, 250, 0.1);
    --alert-info-border: rgba(96, 165, 250, 0.3);
    --alert-info-text: #60A5FA;
    
    /* Tabs / Navigation */
    --tab-bg: transparent;
    --tab-text: #94A3B8;
    --tab-active-bg: rgba(96, 165, 250, 0.15);
    --tab-active-text: #60A5FA;
    --tab-hover-bg: rgba(255, 255, 255, 0.05);
    --tab-border: rgba(255, 255, 255, 0.1);
    
    /* Chart.js Specific - Dark Mode */
    --chart-text-color: #94A3B8;
    --chart-grid-color: rgba(148, 163, 184, 0.12);
    --chart-tooltip-bg: #1E293B;
    --chart-tooltip-text: #F1F5F9;
    --chart-legend-text: #94A3B8;
    
    /* Shadows - Deeper for Dark Mode */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.7);
    --shadow-primary: 0 4px 14px rgba(96, 165, 250, 0.3);
    --shadow-income: 0 4px 14px rgba(94, 234, 212, 0.3);
    --shadow-expense: 0 4px 14px rgba(251, 113, 133, 0.3);
}

/* ===== GLOBAL DARK MODE STYLES ===== */
[data-theme="dark"] body,
.theme-dark body,
[data-theme="dark"],
.theme-dark {
    background-color: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] html,
.theme-dark html {
    background-color: var(--bg-primary) !important;
}

/* ===== NAVBAR - COMPLETE COVERAGE ===== */
[data-theme="dark"] .navbar,
[data-theme="dark"] .nav-header,
[data-theme="dark"] nav.navbar,
[data-theme="dark"] header,
.theme-dark .navbar {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .navbar .brand-text,
[data-theme="dark"] .navbar-brand,
[data-theme="dark"] .brand-logo,
.theme-dark .navbar .brand-text {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .navbar .nav-link,
[data-theme="dark"] .navbar .navbar-nav .nav-link,
.theme-dark .navbar .nav-link {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .navbar .nav-link:hover,
.theme-dark .navbar .nav-link:hover {
    color: var(--color-primary) !important;
}

/* Navbar Icons */
[data-theme="dark"] .navbar .nav-icon,
[data-theme="dark"] .navbar .notification-btn,
[data-theme="dark"] .navbar button,
.theme-dark .navbar button {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .navbar button:hover,
.theme-dark .navbar button:hover {
    color: var(--color-primary) !important;
    background: var(--bg-tertiary) !important;
}

/* Hamburger Menu Lines */
[data-theme="dark"] .hamburger-line,
.theme-dark .hamburger-line {
    background: var(--color-primary) !important;
}

/* ===== SIDEBAR - COMPLETE COVERAGE ===== */
[data-theme="dark"] .right-sidebar,
[data-theme="dark"] .sidebar,
[data-theme="dark"] #rightSidebar,
.theme-dark .right-sidebar {
    background: var(--bg-secondary) !important;
    border-left: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .sidebar-header,
.theme-dark .sidebar-header {
    background: var(--bg-tertiary) !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .sidebar-header h3,
[data-theme="dark"] .sidebar-header .sidebar-title,
.theme-dark .sidebar-header h3 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .sidebar-item,
[data-theme="dark"] .sidebar-menu a,
.theme-dark .sidebar-item {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .sidebar-item:hover,
[data-theme="dark"] .sidebar-menu a:hover,
.theme-dark .sidebar-item:hover {
    background: var(--bg-hover) !important;
    color: var(--color-primary) !important;
}

[data-theme="dark"] .sidebar-item.active,
.theme-dark .sidebar-item.active {
    background: rgba(96, 165, 250, 0.15) !important;
    color: var(--color-primary) !important;
}

[data-theme="dark"] .sidebar-section-title,
[data-theme="dark"] .sidebar-section-header span,
.theme-dark .sidebar-section-title {
    color: var(--text-muted) !important;
}


[data-theme="dark"] .sidebar-overlay,
.theme-dark .sidebar-overlay {
    background: rgba(0, 0, 0, 0.6) !important;
}

/* ===== PROFILE DROPDOWN ===== */
[data-theme="dark"] .profile-dropdown,
[data-theme="dark"] .profile-dropdown-menu,
.theme-dark .profile-dropdown {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .profile-dropdown-item,
.theme-dark .profile-dropdown-item {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .profile-dropdown-item:hover,
.theme-dark .profile-dropdown-item:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .profile-dropdown-divider,
.theme-dark .profile-dropdown-divider {
    background: var(--border-primary) !important;
}

[data-theme="dark"] .profile-dropdown-header,
.theme-dark .profile-dropdown-header {
    color: var(--text-primary) !important;
}

/* ===== CARDS ===== */
[data-theme="dark"] .card,
[data-theme="dark"] .analysis-card,
[data-theme="dark"] .dashboard-card,
[data-theme="dark"] .bg-white,
.theme-dark .card {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .card-header,
.theme-dark .card-header {
    background: var(--bg-tertiary) !important;
    border-bottom: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .card-body,
[data-theme="dark"] .card-body p,
[data-theme="dark"] .card-body span,
.theme-dark .card-body {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .card-title,
[data-theme="dark"] .card h4,
[data-theme="dark"] .card h5,
[data-theme="dark"] .card h6,
.theme-dark .card-title {
    color: var(--text-primary) !important;
}

/* ===== PAGE CONTENT ===== */
[data-theme="dark"] .content-wrapper,
[data-theme="dark"] .main-content,
[data-theme="dark"] main,
[data-theme="dark"] .container-fluid,
.theme-dark .content-wrapper {
    background: var(--bg-primary) !important;
}

/* ===== PAGE HEADERS ===== */
[data-theme="dark"] .page-header,
[data-theme="dark"] .hero-section,
[data-theme="dark"] .hero-banner-base,
.theme-dark .page-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-radius: 0 0 8px 8px !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

[data-theme="dark"] .page-header h1,
[data-theme="dark"] .page-header h2,
[data-theme="dark"] .hero-section h1,
.theme-dark .page-header h1 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .page-header p,
[data-theme="dark"] .hero-section p,
.theme-dark .page-header p {
    color: var(--text-secondary) !important;
}

/* ===== TEXT CLASSES ===== */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6,
.theme-dark h1, .theme-dark h2, .theme-dark h3,
.theme-dark h4, .theme-dark h5, .theme-dark h6 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] p,
[data-theme="dark"] span:not(.badge):not(.btn),
[data-theme="dark"] label,
.theme-dark p, .theme-dark span:not(.badge), .theme-dark label {
    color: var(--text-secondary);
}

[data-theme="dark"] .text-muted,
.theme-dark .text-muted {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .text-dark,
.theme-dark .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-secondary,
.theme-dark .text-secondary {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .text-body,
.theme-dark .text-body {
    color: var(--text-primary) !important;
}

/* ===== FORMS ===== */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
.theme-dark .form-control {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder,
.theme-dark input::placeholder {
    color: var(--text-muted) !important;
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus,
.theme-dark input:focus {
    background: var(--bg-secondary) !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2) !important;
}

[data-theme="dark"] .form-label,
.theme-dark .form-label {
    color: var(--text-secondary) !important;
}

/* Date inputs */
[data-theme="dark"] input[type="date"],
.theme-dark input[type="date"] {
    color-scheme: dark !important;
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* ===== BUTTONS ===== */
[data-theme="dark"] .btn-outline-primary,
.theme-dark .btn-outline-primary {
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

[data-theme="dark"] .btn-outline-primary:hover,
.theme-dark .btn-outline-primary:hover {
    background: var(--color-primary) !important;
    color: white !important;
}

[data-theme="dark"] .btn-outline-secondary,
.theme-dark .btn-outline-secondary {
    color: var(--text-secondary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .btn-light,
.theme-dark .btn-light {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

/* Removed duplicate - see consolidated button styles in section 1 */

/* ===== DATE RANGE FILTER BOX ===== */
[data-theme="dark"] .date-range-box,
[data-theme="dark"] .filter-box,
.theme-dark .date-range-box {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .date-range-box label,
[data-theme="dark"] .filter-box label,
.theme-dark .date-range-box label {
    color: var(--text-muted) !important;
}

/* ===== CATEGORY VIEW TOGGLE ===== */
[data-theme="dark"] .category-view-toggle,
[data-theme="dark"] [style*="linear-gradient(135deg, #f8fafc"],
.theme-dark .category-view-toggle {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .category-view-toggle span,
.theme-dark .category-view-toggle span {
    color: var(--text-secondary) !important;
}

/* ===== TABLES ===== */
[data-theme="dark"] .table,
.theme-dark .table {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .table thead th,
.theme-dark .table thead th {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .table tbody td,
.theme-dark .table tbody td {
    border-color: var(--border-secondary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
.theme-dark .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.02) !important;
}

[data-theme="dark"] .table-hover tbody tr:hover,
.theme-dark .table-hover tbody tr:hover {
    background: var(--bg-hover) !important;
}

/* ===== MODALS ===== */
[data-theme="dark"] .modal-content,
.theme-dark .modal-content {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .modal-header,
.theme-dark .modal-header {
    border-bottom: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .modal-footer,
.theme-dark .modal-footer {
    border-top: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .modal-title,
.theme-dark .modal-title {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .modal-body,
.theme-dark .modal-body {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .btn-close,
.theme-dark .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ===== DROPDOWNS ===== */
[data-theme="dark"] .dropdown-menu,
.theme-dark .dropdown-menu {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .dropdown-item,
.theme-dark .dropdown-item {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .dropdown-item:hover,
.theme-dark .dropdown-item:hover {
    background: var(--bg-hover) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .dropdown-divider,
.theme-dark .dropdown-divider {
    border-color: var(--border-primary) !important;
}

/* ===== PROGRESS BARS ===== */
[data-theme="dark"] .progress,
.theme-dark .progress {
    background: var(--bg-tertiary) !important;
}

/* ===== ALERTS ===== */
[data-theme="dark"] .alert-info,
.theme-dark .alert-info {
    background: rgba(96, 165, 250, 0.15) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    color: var(--color-primary) !important;
}

[data-theme="dark"] .alert-success,
.theme-dark .alert-success {
    background: var(--color-income-bg) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
    color: var(--color-income) !important;
}

[data-theme="dark"] .alert-warning,
.theme-dark .alert-warning {
    background: var(--color-warning-bg) !important;
    border-color: rgba(251, 191, 36, 0.3) !important;
    color: var(--color-warning) !important;
}

[data-theme="dark"] .alert-danger,
.theme-dark .alert-danger {
    background: var(--color-expense-bg) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: var(--color-expense) !important;
}

/* ===== TOOLTIPS ===== */
[data-theme="dark"] .tooltip-inner,
.theme-dark .tooltip-inner {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
}

/* ===== BADGES ===== */
[data-theme="dark"] .badge.bg-light,
.theme-dark .badge.bg-light {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

/* ===== CHARTS ===== */
[data-theme="dark"] .chart-container,
.theme-dark .chart-container {
    background: var(--bg-card) !important;
}

/* ===== LIST GROUPS ===== */
[data-theme="dark"] .list-group-item,
.theme-dark .list-group-item {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .list-group-item:hover,
.theme-dark .list-group-item:hover {
    background: var(--bg-hover) !important;
}

/* ===== ACCORDION ===== */
[data-theme="dark"] .accordion-item,
.theme-dark .accordion-item {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .accordion-button,
.theme-dark .accordion-button {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .accordion-button:not(.collapsed),
.theme-dark .accordion-button:not(.collapsed) {
    background: rgba(96, 165, 250, 0.15) !important;
    color: var(--color-primary) !important;
}

[data-theme="dark"] .accordion-body,
.theme-dark .accordion-body {
    background: var(--bg-card) !important;
    color: var(--text-secondary) !important;
}

/* ===== SKELETON LOADERS ===== */
[data-theme="dark"] .skeleton,
.theme-dark .skeleton {
    background: linear-gradient(90deg, #334155 25%, #475569 50%, #334155 75%) !important;
    background-size: 200% 100%;
}

/* ===== BREADCRUMBS ===== */
[data-theme="dark"] .breadcrumb,
.theme-dark .breadcrumb {
    background: transparent !important;
}

[data-theme="dark"] .breadcrumb-item,
[data-theme="dark"] .breadcrumb-item a,
.theme-dark .breadcrumb-item {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .breadcrumb-item.active,
.theme-dark .breadcrumb-item.active {
    color: var(--text-muted) !important;
}

/* ===== BACKGROUND UTILITIES ===== */
[data-theme="dark"] .bg-white,
.theme-dark .bg-white {
    background-color: var(--bg-card) !important;
}

[data-theme="dark"] .bg-light,
.theme-dark .bg-light {
    background-color: var(--bg-secondary) !important;
}

[data-theme="dark"] .bg-body,
.theme-dark .bg-body {
    background-color: var(--bg-primary) !important;
}

/* ===== BORDERS ===== */
[data-theme="dark"] .border,
.theme-dark .border {
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .border-bottom,
.theme-dark .border-bottom {
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .border-top,
.theme-dark .border-top {
    border-top-color: var(--border-primary) !important;
}

/* ===== FOOTER ===== */
[data-theme="dark"] .footer,
[data-theme="dark"] footer,
.theme-dark .footer {
    background: var(--bg-secondary) !important;
    border-top: 1px solid var(--border-primary) !important;
    color: var(--text-muted) !important;
}

/* ===== SCROLLBAR (Dark) ===== */
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ===== PAGE LOADING ===== */
[data-theme="dark"] .page-loading-overlay {
    background: var(--bg-primary) !important;
}

[data-theme="dark"] .page-loading-spinner {
    border-color: var(--border-primary) !important;
    border-top-color: var(--color-primary) !important;
}

[data-theme="dark"] .page-loading-text {
    color: var(--color-primary) !important;
}

/* ===== ACCESSIBILITY: REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    [data-theme="dark"] *,
    [data-theme="dark"] *::before,
    [data-theme="dark"] *::after {
        transition-duration: 0.01ms !important;
    }
}

/* ============================================ */
/* ===== ANIMATED SUN/MOON TOGGLE BUTTON ===== */
/* ============================================ */

/* Profile dropdown toggle styling */
button.profile-dropdown-item.theme-toggle-animated {
    width: 100% !important;
    height: auto !important;
    padding: 10px 16px !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    gap: 10px !important;
    border-radius: 8px !important;
    transition: background 0.2s ease !important;
}

button.profile-dropdown-item.theme-toggle-animated:hover {
    background: rgba(59, 130, 246, 0.08) !important;
}

[data-theme="dark"] button.profile-dropdown-item.theme-toggle-animated:hover {
    background: rgba(96, 165, 250, 0.12) !important;
}

/* SVG icon styling - ensure visibility */
button.profile-dropdown-item.theme-toggle-animated svg,
.theme-toggle-animated svg {
    width: 20px !important;
    height: 20px !important;
    min-width: 20px !important;
    min-height: 20px !important;
    stroke: #3b82f6 !important;
    stroke-width: 2 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    fill: none !important;
    transition: stroke 0.4s ease, transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
    flex-shrink: 0 !important;
}

[data-theme="dark"] button.profile-dropdown-item.theme-toggle-animated svg,
[data-theme="dark"] .theme-toggle-animated svg {
    stroke: #FBBF24 !important;
}

/* Sun Icon - visible in LIGHT mode (default) */
.theme-toggle-animated .sun-icon {
    stroke-dasharray: 100 !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
    transition: stroke-dashoffset 0.5s ease-in-out, opacity 0.3s ease-in-out !important;
}

/* Moon Icon - hidden in LIGHT mode (default) */
.theme-toggle-animated .moon-icon {
    stroke-dasharray: 100 !important;
    stroke-dashoffset: 100 !important;
    opacity: 0 !important;
    transition: stroke-dashoffset 0.5s ease-in-out, opacity 0.3s ease-in-out !important;
}

/* Dark mode - hide sun, show moon */
[data-theme="dark"] .theme-toggle-animated .sun-icon {
    stroke-dashoffset: 100 !important;
    opacity: 0 !important;
}

[data-theme="dark"] .theme-toggle-animated .moon-icon {
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
}

/* Hover animation - gentle glow */
.theme-toggle-animated:hover svg {
    filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.4));
}

[data-theme="dark"] .theme-toggle-animated:hover svg {
    filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
}

/* Rotation effect on click */
.theme-toggle-animated.rotating svg {
    animation: iconRotate 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@keyframes iconRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===== FORM SWITCHES IN DARK MODE ===== */
[data-theme="dark"] .form-check-input,
.theme-dark .form-check-input {
    background-color: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .form-check-input:checked,
.theme-dark .form-check-input:checked {
    background-color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

/* ===== GRADIENT BACKGROUNDS IN DARK MODE ===== */
[data-theme="dark"] [style*="linear-gradient(135deg, #f8fafc"],
[data-theme="dark"] [style*="linear-gradient(135deg, #e0e7ff"],
.theme-dark [style*="linear-gradient"] {
    background: var(--bg-tertiary) !important;
}

/* ===== SHADOW BOX IN DARK MODE ===== */
[data-theme="dark"] .shadow-sm,
.theme-dark .shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .shadow,
.theme-dark .shadow {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .shadow-lg,
.theme-dark .shadow-lg {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

/* ===== ROUNDED BOX CONTAINERS ===== */
[data-theme="dark"] .rounded-3,
[data-theme="dark"] .rounded-4,
.theme-dark .rounded-3 {
    background-color: var(--bg-card);
}

/* ===== INLINE STYLE OVERRIDES ===== */
[data-theme="dark"] [style*="background-color: #f8f9fa"],
[data-theme="dark"] [style*="background: #f8f9fa"],
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background-color: #fff"],
[data-theme="dark"] [style*="background: #fff"] {
    background-color: var(--bg-tertiary) !important;
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] [style*="color: #495057"],
[data-theme="dark"] [style*="color: #1e40af"],
[data-theme="dark"] [style*="color: #1F2937"] {
    color: var(--text-primary) !important;
}

/* ============================================ */
/* ===== COMPREHENSIVE DARK MODE OVERRIDES ==== */
/* ===== Based on Best Practices Research ===== */
/* ============================================ */

/* ===== SMOOTH DARK MODE TRANSITION ANIMATION ===== */
html {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

body,
.top-navbar,
.right-sidebar,
.card,
.modal-content,
.dropdown-menu,
.professional-stat-card,
.bg-white,
.rounded-3,
input,
select,
textarea {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode toggle ripple animation */
@keyframes darkModeRipple {
    0% {
        transform: scale(0);
        opacity: 0.5;
    }
    100% {
        transform: scale(4);
        opacity: 0;
    }
}

.dark-mode-transitioning::after {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    width: 100vmax;
    height: 100vmax;
    border-radius: 50%;
    background: radial-gradient(circle, var(--bg-primary) 0%, transparent 70%);
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    z-index: 9999;
    animation: darkModeRipple 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ===== TOP NAVBAR - COMPLETE DARK MODE ===== */
[data-theme="dark"] .top-navbar,
.theme-dark .top-navbar {
    background: var(--bg-secondary) !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .top-navbar .navbar-brand,
[data-theme="dark"] .top-navbar .brand-text,
.theme-dark .top-navbar .navbar-brand {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .top-navbar .navbar-actions button,
[data-theme="dark"] .top-navbar button,
.theme-dark .top-navbar button {
    color: var(--text-secondary) !important;
    background: transparent !important;
}

[data-theme="dark"] .top-navbar button:hover,
.theme-dark .top-navbar button:hover {
    color: var(--color-primary) !important;
    background: var(--bg-hover) !important;
}

[data-theme="dark"] .hamburger-menu .hamburger-line,
.theme-dark .hamburger-menu .hamburger-line {
    background: var(--color-primary) !important;
}

/* ===== PROFESSIONAL STAT CARDS - COMPLETE OVERRIDE ===== */
[data-theme="dark"] .professional-stat-card,
[data-theme="dark"] .professional-stat-card.animated-card,
[data-theme="dark"] div[class*="professional-stat-card"],
.theme-dark .professional-stat-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .professional-stat-card h3,
[data-theme="dark"] .professional-stat-card h4,
[data-theme="dark"] .professional-stat-card h5,
[data-theme="dark"] .professional-stat-card .card-title,
.theme-dark .professional-stat-card h3 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .professional-stat-card p,
[data-theme="dark"] .professional-stat-card span,
[data-theme="dark"] .professional-stat-card .text-muted,
.theme-dark .professional-stat-card p {
    color: var(--text-secondary) !important;
}

/* ===== INLINE STYLE BACKGROUND OVERRIDES ===== */
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] [style*="background-color: #ffffff"],
[data-theme="dark"] [style*="background-color:#ffffff"],
[data-theme="dark"] div[style*="background: #fff"],
[data-theme="dark"] div[style*="background:#fff"] {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
}

/* ===== INLINE STYLE BORDER OVERRIDES ===== */
[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
[data-theme="dark"] [style*="border:1px solid #e5e7eb"],
[data-theme="dark"] div[style*="border-color: #e5e7eb"] {
    border-color: var(--border-primary) !important;
}

/* ===== SECTION TITLES & HEADERS ===== */
[data-theme="dark"] .section-title,
[data-theme="dark"] .section-header h2,
[data-theme="dark"] .section-header h3,
[data-theme="dark"] .section-icon-title,
.theme-dark .section-title {
    color: var(--color-primary) !important;
}

/* ===== FINANCIAL AMOUNTS & NUMBERS ===== */
[data-theme="dark"] .amount,
[data-theme="dark"] .currency-amount,
[data-theme="dark"] .money-value,
[data-theme="dark"] .financial-amount,
[data-theme="dark"] [class*="amount"],
.theme-dark .amount {
    color: var(--text-primary) !important;
}

/* Income amounts - Green */
[data-theme="dark"] .income-amount,
[data-theme="dark"] .positive-amount,
[data-theme="dark"] .text-success,
.theme-dark .income-amount {
    color: var(--color-income) !important;
}

/* Expense amounts - Red */
[data-theme="dark"] .expense-amount,
[data-theme="dark"] .negative-amount,
[data-theme="dark"] .text-danger,
.theme-dark .expense-amount {
    color: var(--color-expense) !important;
}

/* ===== CHART STYLING FOR DARK MODE ===== */
[data-theme="dark"] .chart-container,
[data-theme="dark"] .chart-wrapper,
[data-theme="dark"] canvas[id*="Chart"],
.theme-dark .chart-container {
    background: var(--bg-card) !important;
}

/* Chart legends */
[data-theme="dark"] .chart-legend,
[data-theme="dark"] .chartjs-legend,
[data-theme="dark"] .legend-item,
.theme-dark .chart-legend {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .chart-legend li,
[data-theme="dark"] .chartjs-legend li,
.theme-dark .chart-legend li {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .chart-legend li:hover,
.theme-dark .chart-legend li:hover {
    background: var(--bg-hover) !important;
}

/* ===== TREND HIGHLIGHTS SECTION ===== */
[data-theme="dark"] .trend-highlight,
[data-theme="dark"] .highlight-card,
[data-theme="dark"] .summary-highlight,
.theme-dark .trend-highlight {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* ===== GOALS OVERVIEW CARDS ===== */
[data-theme="dark"] .goals-card,
[data-theme="dark"] .savings-goals-card,
[data-theme="dark"] .investment-goals-card,
.theme-dark .goals-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .goals-card h3,
[data-theme="dark"] .goals-card h4,
[data-theme="dark"] .goals-card .goal-title,
.theme-dark .goals-card h3 {
    color: var(--text-primary) !important;
}

/* ===== LOAN PORTFOLIO CARDS ===== */
[data-theme="dark"] .loan-card,
[data-theme="dark"] .loan-portfolio-card,
[data-theme="dark"] .credit-card-item,
.theme-dark .loan-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* ===== CREDIT UTILIZATION SECTION ===== */
[data-theme="dark"] .utilization-card,
[data-theme="dark"] .credit-utilization-card,
.theme-dark .utilization-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* ===== ROUNDED CONTAINERS WITH bg-white ===== */
[data-theme="dark"] .bg-white.rounded-3,
[data-theme="dark"] .bg-white.rounded-4,
[data-theme="dark"] div.bg-white,
.theme-dark .bg-white.rounded-3 {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
}

/* ===== EMPTY STATE MESSAGES ===== */
[data-theme="dark"] .empty-state,
[data-theme="dark"] .no-data-message,
[data-theme="dark"] .empty-message,
.theme-dark .empty-state {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .empty-state i,
[data-theme="dark"] .no-data-message i,
.theme-dark .empty-state i {
    color: var(--text-disabled) !important;
}

/* ===== HOVER STATES - FIX WHITE HOVER ===== */
[data-theme="dark"] .card:hover,
[data-theme="dark"] .professional-stat-card:hover,
[data-theme="dark"] .list-item:hover,
.theme-dark .card:hover {
    background: var(--bg-hover) !important;
}

[data-theme="dark"] a:hover,
[data-theme="dark"] button:hover,
.theme-dark a:hover {
    color: var(--color-primary);
}

/* ===== PAGINATION ===== */
[data-theme="dark"] .pagination .page-link,
.theme-dark .pagination .page-link {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .pagination .page-link:hover,
.theme-dark .pagination .page-link:hover {
    background: var(--bg-hover) !important;
    color: var(--color-primary) !important;
}

[data-theme="dark"] .pagination .page-item.active .page-link,
.theme-dark .pagination .page-item.active .page-link {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: white !important;
}

/* ===== METRIC LABELS & SUBTITLES ===== */
[data-theme="dark"] .metric-label,
[data-theme="dark"] .stat-label,
[data-theme="dark"] .card-subtitle,
.theme-dark .metric-label {
    color: var(--text-muted) !important;
}

/* ===== ICONS IN DARK MODE ===== */
[data-theme="dark"] .text-primary i,
[data-theme="dark"] .icon-primary,
.theme-dark .icon-primary {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .text-secondary i,
[data-theme="dark"] .icon-secondary,
.theme-dark .icon-secondary {
    color: var(--text-muted) !important;
}

/* ===== FILTER & DATE RANGE CONTAINERS ===== */
[data-theme="dark"] .filter-container,
[data-theme="dark"] .date-filter,
[data-theme="dark"] .collapsible-filter-bar,
.theme-dark .filter-container {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .filter-chip,
[data-theme="dark"] .active-filter-chip,
.theme-dark .filter-chip {
    background: var(--bg-hover) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-primary) !important;
}

/* ===== CATEGORY VIEW TOGGLE - DETAILED/SUMMARY ===== */
[data-theme="dark"] .category-toggle,
[data-theme="dark"] .view-toggle,
[data-theme="dark"] .toggle-switch,
.theme-dark .category-toggle {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .toggle-option,
[data-theme="dark"] .view-option,
.theme-dark .toggle-option {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .toggle-option.active,
[data-theme="dark"] .view-option.active,
.theme-dark .toggle-option.active {
    background: var(--color-primary) !important;
    color: white !important;
}

/* ===== CARD FOOTERS ===== */
[data-theme="dark"] .card-footer,
.theme-dark .card-footer {
    background: var(--bg-tertiary) !important;
    border-top-color: var(--border-primary) !important;
}

/* ===== SECTION DIVIDERS ===== */
[data-theme="dark"] hr,
[data-theme="dark"] .divider,
.theme-dark hr {
    border-color: var(--border-primary) !important;
    opacity: 0.3;
}

/* ===== MOBILE-SPECIFIC DARK MODE FIXES ===== */
@media (max-width: 768px) {
    [data-theme="dark"] .mobile-card,
    [data-theme="dark"] .mobile-list-item,
    .theme-dark .mobile-card {
        background: var(--bg-card) !important;
        border-color: var(--border-primary) !important;
    }
    
    [data-theme="dark"] .mobile-header,
    .theme-dark .mobile-header {
        background: var(--bg-secondary) !important;
    }
}

/* ===== FORCE OVERRIDE FOR INLINE WHITE BACKGROUNDS ===== */
/* This catches any remaining elements with inline white backgrounds */
[data-theme="dark"] *[style*="background: #ffffff" i],
[data-theme="dark"] *[style*="background-color: #ffffff" i],
[data-theme="dark"] *[style*="background: white" i],
[data-theme="dark"] *[style*="background-color: white" i] {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
}

/* ===== TEXT ON CARDS - ENSURE VISIBILITY ===== */
[data-theme="dark"] .card span,
[data-theme="dark"] .card p,
[data-theme="dark"] .card label,
[data-theme="dark"] .professional-stat-card span,
[data-theme="dark"] .professional-stat-card p,
.theme-dark .card span {
    color: var(--text-secondary) !important;
}

/* ===== BADGE COLORS IN DARK MODE ===== */
[data-theme="dark"] .badge.bg-secondary,
.theme-dark .badge.bg-secondary {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .badge.bg-primary,
.theme-dark .badge.bg-primary {
    background: var(--color-primary) !important;
}

[data-theme="dark"] .badge.bg-success,
.theme-dark .badge.bg-success {
    background: var(--color-income) !important;
}

[data-theme="dark"] .badge.bg-danger,
.theme-dark .badge.bg-danger {
    background: var(--color-expense) !important;
}

[data-theme="dark"] .badge.bg-warning,
.theme-dark .badge.bg-warning {
    background: var(--color-warning) !important;
    color: #1F2937 !important;
}

/* ===== NOTIFICATION BADGES ===== */
[data-theme="dark"] .notification-badge,
[data-theme="dark"] .badge-notification,
.theme-dark .notification-badge {
    background: var(--color-expense) !important;
    color: white !important;
}

/* ===== TABS IN DARK MODE ===== */
[data-theme="dark"] .nav-tabs,
.theme-dark .nav-tabs {
    border-bottom-color: var(--border-primary) !important;
}

[data-theme="dark"] .nav-tabs .nav-link,
.theme-dark .nav-tabs .nav-link {
    color: var(--text-secondary) !important;
    border-color: transparent !important;
}

[data-theme="dark"] .nav-tabs .nav-link:hover,
.theme-dark .nav-tabs .nav-link:hover {
    border-color: var(--border-primary) !important;
    color: var(--color-primary) !important;
}

[data-theme="dark"] .nav-tabs .nav-link.active,
.theme-dark .nav-tabs .nav-link.active {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) var(--border-primary) var(--bg-card) !important;
    color: var(--color-primary) !important;
}

/* ===== PILLS/NAV PILLS ===== */
[data-theme="dark"] .nav-pills .nav-link,
.theme-dark .nav-pills .nav-link {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .nav-pills .nav-link.active,
.theme-dark .nav-pills .nav-link.active {
    background: var(--color-primary) !important;
    color: white !important;
}

/* ============================================================= */
/* ===== COMPREHENSIVE FIXES - JANUARY 2026 AUDIT ============== */
/* ===== Based on Fintech Dark Mode Best Practices 2025 ======== */
/* ============================================================= */

/* ===== 1. HERO BANNER - UNIFIED DARK MODE (SINGLE SOURCE OF TRUTH) ===== */
/* Using uniform #0F172A (main body color) throughout - NO color variations */
/* All banner elements match the main page background for consistency */

/* Base banner - uniform dark navy background matching body */
html[data-theme="dark"] .hero-banner-base,
html[data-theme="dark"] .hero-banner,
html[data-theme="dark"] .page-banner,
html[data-theme="dark"] .gradient-banner,
html[data-theme="dark"] [class*="hero-banner"],
body.theme-dark .hero-banner-base,
[data-theme="dark"] .hero-banner-base,
.theme-dark .hero-banner-base {
    background: #0F172A !important;
    background-image: none !important;
    background-color: #0F172A !important;
    border: none !important;
    border-bottom: 1px solid rgba(96, 165, 250, 0.1) !important;
    overflow: visible !important;
}

/* Completely hide the mesh-gradient ::before pseudo-element */
html[data-theme="dark"] .hero-banner-base::before,
html[data-theme="dark"] .hero-banner::before,
html[data-theme="dark"] [class*="hero-banner"]::before,
[data-theme="dark"] .hero-banner-base::before,
.theme-dark .hero-banner-base::before {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    content: none !important;
    background: none !important;
}

/* Hero content container - same background */
html[data-theme="dark"] .hero-content-base,
html[data-theme="dark"] .hero-content,
[data-theme="dark"] .hero-content-base,
.theme-dark .hero-content-base {
    background: transparent !important;
    color: var(--text-primary) !important;
}

/* Hero titles - off-white text */
html[data-theme="dark"] .hero-banner-base h1,
html[data-theme="dark"] .hero-banner h1,
html[data-theme="dark"] .hero-title-base,
html[data-theme="dark"] .page-banner h1,
[data-theme="dark"] .hero-title-base,
.theme-dark .hero-banner-base h1 {
    color: #F1F5F9 !important;
}

/* Hero subtitles - muted text */
html[data-theme="dark"] .hero-banner-base p,
html[data-theme="dark"] .hero-banner p,
html[data-theme="dark"] .hero-subtitle-base,
html[data-theme="dark"] .page-banner p,
[data-theme="dark"] .hero-subtitle-base,
.theme-dark .hero-banner-base p {
    color: #94A3B8 !important;
}

/* Hero badges */
html[data-theme="dark"] .hero-badge-base,
[data-theme="dark"] .hero-badge-base,
.theme-dark .hero-badge-base {
    background: rgba(96, 165, 250, 0.15) !important;
    border-color: rgba(96, 165, 250, 0.25) !important;
    color: #60A5FA !important;
}

/* Banner button containers */
html[data-theme="dark"] .hero-banner-base .d-flex,
html[data-theme="dark"] .hero-content-base .d-flex,
[data-theme="dark"] .hero-banner-base .d-flex,
.theme-dark .hero-banner-base .d-flex {
    overflow: visible !important;
}

/* Banner buttons z-index */
html[data-theme="dark"] .hero-banner-base .btn,
html[data-theme="dark"] .hero-content-base .btn,
[data-theme="dark"] .hero-banner-base .btn,
.theme-dark .hero-banner-base .btn {
    position: relative;
    z-index: 10;
}

/* Banner action buttons - COMPREHENSIVE DARK MODE */
/* btn-gradient-hero (Add Transaction button) - Subtle dark mode styling */
html[data-theme="dark"] .btn-gradient-hero,
[data-theme="dark"] .btn-gradient-hero,
.theme-dark .btn-gradient-hero {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(37, 99, 235, 0.15) 100%) !important;
    color: #60A5FA !important;
    border: 1px solid rgba(59, 130, 246, 0.3) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="dark"] .btn-gradient-hero:hover,
[data-theme="dark"] .btn-gradient-hero:hover,
.theme-dark .btn-gradient-hero:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(37, 99, 235, 0.25) 100%) !important;
    color: #93C5FD !important;
    border-color: rgba(96, 165, 250, 0.4) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3) !important;
    transform: translateY(-2px) !important;
}

html[data-theme="dark"] .btn-gradient-hero:active,
[data-theme="dark"] .btn-gradient-hero:active,
.theme-dark .btn-gradient-hero:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2) !important;
}

/* btn-outline-hero (Analysis button) - Dark background, light border */
html[data-theme="dark"] .btn-outline-hero,
[data-theme="dark"] .btn-outline-hero,
.theme-dark .btn-outline-hero {
    background: rgba(30, 41, 59, 0.8) !important;
    color: var(--color-primary-light) !important;
    border: 2px solid rgba(96, 165, 250, 0.5) !important;
    backdrop-filter: blur(8px) !important;
}

html[data-theme="dark"] .btn-outline-hero:hover,
[data-theme="dark"] .btn-outline-hero:hover,
.theme-dark .btn-outline-hero:hover {
    background: rgba(96, 165, 250, 0.2) !important;
    color: white !important;
    border-color: var(--color-primary) !important;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.25) !important;
    transform: translateY(-2px) !important;
}

html[data-theme="dark"] .btn-outline-hero:active,
[data-theme="dark"] .btn-outline-hero:active,
.theme-dark .btn-outline-hero:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 4px rgba(96, 165, 250, 0.15) !important;
}

/* ===== 2. GOALS OVERVIEW CARDS ===== */
[data-theme="dark"] .goal-type-card,
[data-theme="dark"] .goals-overview-card,
[data-theme="dark"] [class*="goal-type-card"],
.theme-dark .goal-type-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .goal-type-card .card-body,
[data-theme="dark"] .goals-overview-card .card-body,
.theme-dark .goal-type-card .card-body {
    background: var(--bg-card) !important;
}

[data-theme="dark"] .goal-type-card h3,
[data-theme="dark"] .goal-type-card h4,
[data-theme="dark"] .goal-type-card h5,
[data-theme="dark"] .goal-type-card .card-title,
.theme-dark .goal-type-card h3 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .goal-type-card p,
[data-theme="dark"] .goal-type-card span,
[data-theme="dark"] .goal-type-card .text-muted,
.theme-dark .goal-type-card p {
    color: var(--text-secondary) !important;
}

/* Goal number cards */
[data-theme="dark"] .goal-number-card,
[data-theme="dark"] [class*="goal-number"],
.theme-dark .goal-number-card {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

/* ===== 3. INVESTMENT GOALS PROGRESS CARDS ===== */
[data-theme="dark"] .investment-card,
[data-theme="dark"] .investment-summary-card,
[data-theme="dark"] .investment-goal-card,
[data-theme="dark"] [class*="investment-card"],
.theme-dark .investment-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .investment-card .card-body,
[data-theme="dark"] .investment-summary-card .card-body,
.theme-dark .investment-card .card-body {
    background: var(--bg-card) !important;
}

[data-theme="dark"] .investment-card h3,
[data-theme="dark"] .investment-card h4,
[data-theme="dark"] .investment-card h5,
.theme-dark .investment-card h3 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .investment-card p,
[data-theme="dark"] .investment-card span,
.theme-dark .investment-card p {
    color: var(--text-secondary) !important;
}

/* ===== 4. SECTION TITLES - 2025 FINTECH BEST PRACTICE: CYAN ACCENT ===== */
/* Professional fintech dark mode: Use vibrant cyan (#5eead4) for section headings */
[data-theme="dark"] .text-primary.fw-bold,
[data-theme="dark"] h2.text-primary,
[data-theme="dark"] h3.text-primary,
[data-theme="dark"] .section-heading.text-primary,
.theme-dark .text-primary.fw-bold {
    color: #5eead4 !important;
}

/* Section icons in headings - matching cyan accent */
[data-theme="dark"] h2.text-primary i,
[data-theme="dark"] h3.text-primary i,
[data-theme="dark"] .text-primary.fw-bold i,
.theme-dark h2.text-primary i {
    color: #5eead4 !important;
}

/* ===== 4B. STAT CARDS - UNIFORM DARK BACKGROUND ===== */
/* Professional stat cards need dark background, not white */
html[data-theme="dark"] .professional-stat-card,
[data-theme="dark"] .professional-stat-card,
[data-theme="dark"] [class*="stat-card"],
[data-theme="dark"] .analytics-card,
[data-theme="dark"] .summary-card,
.theme-dark .professional-stat-card {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* Stat card labels - muted text */
html[data-theme="dark"] .stat-label,
[data-theme="dark"] .stat-label,
.theme-dark .stat-label {
    color: #94A3B8 !important;
}

/* Stat card details - subtle muted text */
html[data-theme="dark"] .stat-detail,
[data-theme="dark"] .stat-detail,
.theme-dark .stat-detail {
    color: #64748B !important;
}

/* ===== 4C. STAT ICONS - VIBRANT DARK MODE COLORS ===== */
/* Use softer, more vibrant colors for dark backgrounds */
html[data-theme="dark"] .stat-icon,
[data-theme="dark"] .stat-icon,
.theme-dark .stat-icon {
    background: rgba(96, 165, 250, 0.15) !important;
}

/* Income icon - vibrant teal */
html[data-theme="dark"] .stat-icon[style*="10b981"],
[data-theme="dark"] div[style*="color: #10b981"] .stat-icon,
.theme-dark .stat-icon[style*="10b981"] {
    color: #34D399 !important;
    background: rgba(52, 211, 153, 0.15) !important;
}

/* Expense icon - soft red */
html[data-theme="dark"] .stat-icon[style*="ef4444"],
[data-theme="dark"] div[style*="color: #ef4444"] .stat-icon,
.theme-dark .stat-icon[style*="ef4444"] {
    color: #F87171 !important;
    background: rgba(248, 113, 113, 0.15) !important;
}

/* Savings icon - bright blue */
html[data-theme="dark"] .stat-icon[style*="3b82f6"],
[data-theme="dark"] div[style*="color: #3b82f6"] .stat-icon,
.theme-dark .stat-icon[style*="3b82f6"] {
    color: #60A5FA !important;
    background: rgba(96, 165, 250, 0.15) !important;
}

/* Rate icon - vibrant purple */
html[data-theme="dark"] .stat-icon[style*="8b5cf6"],
[data-theme="dark"] div[style*="color: #8b5cf6"] .stat-icon,
.theme-dark .stat-icon[style*="8b5cf6"] {
    color: #A78BFA !important;
    background: rgba(167, 139, 250, 0.15) !important;
}

/* ===== 4D. AMOUNT VALUES - PROFESSIONAL FINTECH COLORS ===== */
/* Income amounts - vibrant emerald */
html[data-theme="dark"] .stat-value[style*="10b981"],
html[data-theme="dark"] [style*="color: #10b981"],
[data-theme="dark"] .stat-value[style*="10b981"],
.theme-dark .stat-value[style*="10b981"] {
    color: #34D399 !important;
}

/* Expense amounts - coral red */
html[data-theme="dark"] .stat-value[style*="ef4444"],
html[data-theme="dark"] [style*="color: #ef4444"],
[data-theme="dark"] .stat-value[style*="ef4444"],
.theme-dark .stat-value[style*="ef4444"] {
    color: #FB7185 !important;
}

/* Savings amounts - sky blue */
html[data-theme="dark"] .stat-value[style*="3b82f6"],
html[data-theme="dark"] [style*="color: #3b82f6"]:not(.text-primary),
[data-theme="dark"] .stat-value[style*="3b82f6"],
.theme-dark .stat-value[style*="3b82f6"] {
    color: #38BDF8 !important;
}

/* Rate/percentage amounts - lavender */
html[data-theme="dark"] .stat-value[style*="8b5cf6"],
html[data-theme="dark"] [style*="color: #8b5cf6"],
[data-theme="dark"] .stat-value[style*="8b5cf6"],
.theme-dark .stat-value[style*="8b5cf6"] {
    color: #C4B5FD !important;
}

/* Keep primary color for interactive elements and accents only */
[data-theme="dark"] a.text-primary,
[data-theme="dark"] button.text-primary,
.theme-dark a.text-primary {
    color: var(--color-primary) !important;
}

/* ===== 5. CHART COLORS - HIGH CONTRAST FOR DARK MODE ===== */
/* Improved color palette for better differentiation on dark backgrounds */
:root {
    /* Dark mode chart colors - vibrant and distinguishable */
    --chart-blue: #60A5FA;
    --chart-green: #4ADE80;
    --chart-red: #F87171;
    --chart-purple: #A78BFA;
    --chart-orange: #FB923C;
    --chart-cyan: #22D3EE;
    --chart-pink: #F472B6;
    --chart-yellow: #FBBF24;
    --chart-teal: #2DD4BF;
    --chart-indigo: #818CF8;
}

/* Chart container background fix */
[data-theme="dark"] .chart-container,
[data-theme="dark"] div[style*="linear-gradient(135deg, #fefcfb"],
[data-theme="dark"] div[style*="linear-gradient(135deg, #fef7f0"],
[data-theme="dark"] div[style*="linear-gradient(135deg, #fffbeb"],
.theme-dark .chart-container {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Chart titles inside containers */
[data-theme="dark"] .chart-container h5,
[data-theme="dark"] .chart-container h4,
[data-theme="dark"] .chart-container h6,
.theme-dark .chart-container h5 {
    color: var(--text-primary) !important;
}

/* Chart container gradient backgrounds override */
[data-theme="dark"] div[style*="background: linear-gradient"],
[data-theme="dark"] div[style*="background:linear-gradient"],
.theme-dark div[style*="background: linear-gradient"] {
    background: var(--bg-card) !important;
}

/* ===== 6. SYNCHRONIZED DARK MODE TRANSITION ===== */
/* Universal transition for ALL elements to ensure sync */
html.theme-transition,
html.theme-transition *,
html.theme-transition *::before,
html.theme-transition *::after {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                background 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                fill 0.35s cubic-bezier(0.4, 0, 0.2, 1),
                stroke 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Exclude transform transitions to prevent layout shift */
html.theme-transition .modal,
html.theme-transition .dropdown-menu,
html.theme-transition .tooltip {
    transition: background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* ===== 7. FILTER BAR DARK MODE ===== */
/* Filter bar matches main page background for consistency */
html[data-theme="dark"] .filter-bar,
[data-theme="dark"] .filter-bar,
.theme-dark .filter-bar {
    background: #0F172A !important;
    border: 1px solid rgba(96, 165, 250, 0.1) !important;
    border-radius: 8px !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .filter-toggle-btn,
[data-theme="dark"] .filter-toggle-btn,
.theme-dark .filter-toggle-btn {
    background: transparent !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .filter-toggle-btn i,
[data-theme="dark"] .filter-toggle-btn span,
.theme-dark .filter-toggle-btn span {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .filter-content,
.theme-dark .filter-content {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .preset-btn,
.theme-dark .preset-btn {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .preset-btn:hover,
[data-theme="dark"] .preset-btn.active,
.theme-dark .preset-btn:hover {
    background: var(--color-primary) !important;
    color: white !important;
}

/* ===== 8. MINI SWITCH TOGGLE ===== */
/* Mini switch styles defined in collapsible-filters.css */

/* Category toggle labels */
[data-theme="dark"] .category-toggle-compact label,
[data-theme="dark"] .category-toggle-compact span,
.theme-dark .category-toggle-compact label {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] #universalDetailedLabel,
[data-theme="dark"] #universalSummaryLabel,
.theme-dark #universalDetailedLabel {
    color: var(--text-secondary) !important;
}

/* ===== 9. MONTHLY MINI CARDS ===== */
[data-theme="dark"] .monthly-mini-card,
[data-theme="dark"] #monthly-cards,
.theme-dark .monthly-mini-card {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .monthly-mini-card .stat-value,
.theme-dark .monthly-mini-card .stat-value {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .monthly-mini-card .stat-label,
[data-theme="dark"] .monthly-mini-card .stat-detail,
.theme-dark .monthly-mini-card .stat-label {
    color: var(--text-muted) !important;
}

/* ===== 10. QUICK ACTIONS CARD ===== */
[data-theme="dark"] .quick-actions-card,
.theme-dark .quick-actions-card {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .quick-actions-card h5,
.theme-dark .quick-actions-card h5 {
    color: var(--text-primary) !important;
}

/* ===== 11. FEATURE CARDS ===== */
[data-theme="dark"] .feature-card,
.theme-dark .feature-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .feature-card h6,
.theme-dark .feature-card h6 {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .feature-card p,
.theme-dark .feature-card p {
    color: var(--text-secondary) !important;
}

/* ===== 12. STATS CARD ===== */
[data-theme="dark"] .stats-card,
.theme-dark .stats-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .stats-card h3,
[data-theme="dark"] .stats-card h4,
.theme-dark .stats-card h3 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .stats-card p,
.theme-dark .stats-card p {
    color: var(--text-secondary) !important;
}

/* ===== 13. YEAR DIALOG ===== */
[data-theme="dark"] .year-dialog,
.theme-dark .year-dialog {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .year-dialog-header,
.theme-dark .year-dialog-header {
    background: var(--bg-tertiary) !important;
    border-bottom-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .year-dialog-header h5,
.theme-dark .year-dialog-header h5 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .year-dialog-body,
.theme-dark .year-dialog-body {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .year-option,
.theme-dark .year-option {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .year-option:hover,
.theme-dark .year-option:hover {
    background: var(--color-primary) !important;
    color: white !important;
}

/* ===== 14. DIVIDER LINE FIX ===== */
[data-theme="dark"] div[style*="background: rgba(0, 0, 0"],
.theme-dark div[style*="background: rgba(0, 0, 0"] {
    background: var(--border-primary) !important;
}

/* ===== 15. CREDIT UTILIZATION CHART FIX ===== */
[data-theme="dark"] .utilization-chart-container,
[data-theme="dark"] #overallUtilizationChart,
.theme-dark .utilization-chart-container {
    background: transparent !important;
}

/* ===== 16. ALL INLINE WHITE BACKGROUNDS - COMPREHENSIVE ===== */
[data-theme="dark"] div[style*="background: #ffffff"],
[data-theme="dark"] div[style*="background:#ffffff"],
[data-theme="dark"] div[style*="background-color: #ffffff"],
[data-theme="dark"] div[style*="background-color:#ffffff"],
[data-theme="dark"] [style*="background: rgb(255, 255, 255)"],
[data-theme="dark"] [style*="background-color: rgb(255, 255, 255)"],
.theme-dark div[style*="background: #ffffff"] {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
}

/* ===== 17. SECTION DIVIDERS ===== */
[data-theme="dark"] div[style*="height: 1px"][style*="background"],
.theme-dark div[style*="height: 1px"][style*="background"] {
    background: var(--border-primary) !important;
}

/* ===== 18. EMPTY STATE ICONS ===== */
[data-theme="dark"] .empty-state-icon,
[data-theme="dark"] .no-data-icon,
.theme-dark .empty-state-icon {
    background: var(--bg-tertiary) !important;
    color: var(--text-muted) !important;
}

/* ===== 19. BOOTSTRAP BG-WHITE CLASS OVERRIDE ===== */
[data-theme="dark"] .bg-white,
.theme-dark .bg-white {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    background-color: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* REMOVED DUPLICATE - See Section 1 for hero-banner dark mode */

[data-theme="dark"] .bg-light,
.theme-dark .bg-light {
    background: var(--bg-secondary) !important;
    background-color: var(--bg-secondary) !important;
}

/* ===== 20. FIACORE CUSTOM MODALS ===== */
[data-theme="dark"] .fiacore-modal,
.theme-dark .fiacore-modal {
    background: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="dark"] .fiacore-modal-content,
.theme-dark .fiacore-modal-content {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border: 1px solid var(--border-primary) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .fiacore-modal-header,
.theme-dark .fiacore-modal-header {
    border-bottom: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .fiacore-modal-header h2,
[data-theme="dark"] .fiacore-modal-header h3,
.theme-dark .fiacore-modal-header h2 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .fiacore-modal-body,
[data-theme="dark"] .fiacore-modal-body p,
.theme-dark .fiacore-modal-body {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .fiacore-modal-btn-secondary,
.theme-dark .fiacore-modal-btn-secondary {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* ===== 21. QUICK YEAR SELECTION DIALOG ===== */
[data-theme="dark"] .year-dialog-overlay,
.theme-dark .year-dialog-overlay {
    background: rgba(15, 23, 42, 0.9) !important;
}

[data-theme="dark"] .year-dialog,
[data-theme="dark"] .year-selection-dialog,
[data-theme="dark"] .quick-year-modal,
.theme-dark .year-dialog {
    background: #0F172A !important;
    border: 1px solid rgba(96, 165, 250, 0.2) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .year-dialog-header,
.theme-dark .year-dialog-header {
    background: #0F172A !important;
    border-bottom-color: rgba(255, 255, 255, 0.1) !important;
}

[data-theme="dark"] .year-dialog-body,
.theme-dark .year-dialog-body {
    background: #0F172A !important;
    border-bottom: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .year-dialog-header h5,
[data-theme="dark"] .year-dialog h5,
.theme-dark .year-dialog-header h5 {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .year-dialog-close,
.theme-dark .year-dialog-close {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .year-dialog-close:hover,
.theme-dark .year-dialog-close:hover {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .year-dialog-body,
.theme-dark .year-dialog-body {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .year-dialog-body h6,
[data-theme="dark"] .year-dialog-body label,
.theme-dark .year-dialog-body h6 {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .year-grid .btn-outline-primary,
[data-theme="dark"] .year-option,
.theme-dark .year-option {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .year-grid .btn-outline-primary:hover,
[data-theme="dark"] .year-option:hover,
.theme-dark .year-option:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: white !important;
}

[data-theme="dark"] .year-grid .btn-primary,
[data-theme="dark"] .year-option.active,
.theme-dark .year-option.active {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: white !important;
}

/* ===== 21A. CHART CONTAINER INLINE STYLE OVERRIDES ===== */
[data-theme="dark"] .chart-container,
.theme-dark .chart-container {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

[data-theme="dark"] .chart-container.bg-gradient,
.theme-dark .chart-container.bg-gradient {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%) !important;
}

/* Fix chart hover tooltips dark */
[data-theme="dark"] .chartjs-tooltip,
.theme-dark .chartjs-tooltip {
    background: #0F172A !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    color: var(--text-primary) !important;
}

/* ===== 22. GOAL NUMBER CARDS (INLINE STYLE OVERRIDE) ===== */
[data-theme="dark"] .goal-number-card,
[data-theme="dark"] .goal-type-card,
[data-theme="dark"] .stats-card-item,
.theme-dark .goal-number-card {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border: 2px solid rgba(96, 165, 250, 0.3) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

[data-theme="dark"] .goal-number-card:hover,
.theme-dark .goal-number-card:hover {
    background: linear-gradient(135deg, #334155 0%, #1E293B 100%) !important;
    border-color: rgba(96, 165, 250, 0.5) !important;
    box-shadow: 0 12px 25px rgba(96, 165, 250, 0.15) !important;
}

[data-theme="dark"] .goal-number-card h5,
[data-theme="dark"] .goal-number-card h4,
.theme-dark .goal-number-card h5 {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .goal-number-card small,
[data-theme="dark"] .goal-number-card span,
.theme-dark .goal-number-card small {
    color: var(--text-secondary) !important;
}

/* ===== 23. INVESTMENT SUMMARY CARD ===== */
[data-theme="dark"] .investment-summary-card,
[data-theme="dark"] .investment-card,
[data-theme="dark"] .investment-goal-card,
[data-theme="dark"] [class*="investment-summary"],
.theme-dark .investment-summary-card {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .investment-summary-card h5,
[data-theme="dark"] .investment-summary-card h6,
[data-theme="dark"] .investment-summary-card .card-title,
.theme-dark .investment-summary-card h5 {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .investment-summary-card p,
[data-theme="dark"] .investment-summary-card span,
[data-theme="dark"] .investment-summary-card .text-muted,
.theme-dark .investment-summary-card p {
    color: var(--text-secondary) !important;
}

/* ===== 24. OVERALL UTILIZATION CHART CONTAINER ===== */
[data-theme="dark"] div[style*="min-height: 550px"].bg-white,
[data-theme="dark"] .credit-chart-container,
[data-theme="dark"] #creditOverallDoughnut,
.theme-dark #creditOverallDoughnut {
    background: transparent !important;
}

[data-theme="dark"] #creditOverallStats,
[data-theme="dark"] #topCreditCardsList,
.theme-dark #creditOverallStats {
    background: transparent !important;
    border-color: var(--border-primary) !important;
}

/* Fix inline border-top color */
[data-theme="dark"] [style*="border-top: 1px solid #e5e7eb"],
.theme-dark [style*="border-top: 1px solid #e5e7eb"] {
    border-top-color: var(--border-primary) !important;
}

/* Fix inline border color */
[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
.theme-dark [style*="border: 1px solid #e5e7eb"] {
    border-color: var(--border-primary) !important;
}

/* ===== 25. TOP CREDIT CARDS LIST DARK MODE ===== */
[data-theme="dark"] #topCreditCardsList,
.theme-dark #topCreditCardsList {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.6) 100%) !important;
    border-color: var(--border-primary) !important;
}

/* ===== 26. ALL CARDS TABLE CONTAINER ===== */
[data-theme="dark"] #allCardsTableContainer,
[data-theme="dark"] #allCardsTableContainer > div,
.theme-dark #allCardsTableContainer {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] #allCardsTable thead,
.theme-dark #allCardsTable thead {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] #allCardsTable th,
[data-theme="dark"] #allCardsTable td,
.theme-dark #allCardsTable th {
    color: var(--text-secondary) !important;
    border-color: var(--border-primary) !important;
}

/* ===== 27. INLINE GRADIENT BACKGROUND OVERRIDES ===== */
[data-theme="dark"] div[style*="background: linear-gradient(135deg, #EEF2FF"],
[data-theme="dark"] div[style*="background: linear-gradient(135deg, #fefefe"],
[data-theme="dark"] div[style*="background: linear-gradient(135deg, #f0f9ff"],
[data-theme="dark"] div[style*="background: linear-gradient(135deg, #fafbfc"],
.theme-dark div[style*="background: linear-gradient(135deg, #EEF2FF"] {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

/* ===== 28. CANVAS CHART PARENT CONTAINERS ===== */
[data-theme="dark"] canvas[id*="Chart"],
[data-theme="dark"] canvas[id*="chart"],
.theme-dark canvas[id*="Chart"] {
    background: transparent !important;
}

/* Chart container wrappers */
[data-theme="dark"] .chart-container,
[data-theme="dark"] .chart-wrapper,
[data-theme="dark"] [class*="chart-container"],
.theme-dark .chart-container {
    background: transparent !important;
}

/* ===== 29. TOOLTIP DARK MODE ===== */
[data-theme="dark"] .tooltip .tooltip-inner,
.theme-dark .tooltip .tooltip-inner {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .bs-tooltip-top .tooltip-arrow::before,
.theme-dark .bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--bg-tertiary) !important;
}

[data-theme="dark"] .bs-tooltip-bottom .tooltip-arrow::before,
.theme-dark .bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: var(--bg-tertiary) !important;
}

/* ===== 30. DATE PICKER / FILTER BAR DARK MODE ===== */
/* Consolidated filter bar - uses main page background color */
html[data-theme="dark"] .date-filter-container,
[data-theme="dark"] .date-filter-container,
.theme-dark .date-filter-container {
    background: #0F172A !important;
    border-color: rgba(96, 165, 250, 0.1) !important;
}

[data-theme="dark"] .filter-bar input,
[data-theme="dark"] .filter-bar select,
.theme-dark .filter-bar input {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* ===== 31. FEATURE ITEM CARDS ===== */
[data-theme="dark"] .feature-item-clean,
.theme-dark .feature-item-clean {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .feature-item-clean h6,
.theme-dark .feature-item-clean h6 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .feature-item-clean p,
.theme-dark .feature-item-clean p {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .feature-icon-clean,
.theme-dark .feature-icon-clean {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.2) 0%, rgba(96, 165, 250, 0.3) 100%) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
}

/* ===== 32. PROFESSIONAL STAT CARDS ===== */
[data-theme="dark"] .professional-stat-card,
.theme-dark .professional-stat-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.8) 100%) !important;
    border: 1px solid var(--border-primary) !important;
}

[data-theme="dark"] .professional-stat-card .stat-value,
[data-theme="dark"] .professional-stat-card .stat-label,
.theme-dark .professional-stat-card .stat-value {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .professional-stat-card .stat-detail,
.theme-dark .professional-stat-card .stat-detail {
    color: var(--text-muted) !important;
}

/* ===== 33. INVESTMENT CARDS (TRENDS PAGE) ===== */
/* Light mode defaults */
.investment-summary-card,
.investment-distribution-card {
    background: #ffffff;
}

.investment-metric-card {
    background: #f0f7ff;
    border: 1px solid #dbeafe;
}

.investment-metric-card .stat-label {
    color: #1e40af;
}

.investment-metric-card .stat-value {
    color: #3b82f6;
}

/* Dark mode overrides */
[data-theme="dark"] .investment-summary-card,
[data-theme="dark"] .investment-distribution-card,
.theme-dark .investment-summary-card {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
    min-height: 520px !important;
}

[data-theme="dark"] .investment-summary-card h3,
.theme-dark .investment-summary-card h3 {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .investment-summary-card .stat-icon,
.theme-dark .investment-summary-card .stat-icon {
    background: transparent !important;
    color: var(--color-primary) !important;
}

/* Fix black box on hover for investment cards */
[data-theme="dark"] .investment-distribution-card canvas,
[data-theme="dark"] .investment-distribution-card .chartjs-render-monitor,
.theme-dark .investment-distribution-card canvas {
    background: transparent !important;
}

[data-theme="dark"] .investment-distribution-card > div,
.theme-dark .investment-distribution-card > div {
    background: transparent !important;
}

[data-theme="dark"] .investment-summary-card h3,
[data-theme="dark"] .investment-distribution-card h6,
.theme-dark .investment-summary-card h3 {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .investment-summary-card p,
[data-theme="dark"] .investment-summary-card .text-muted,
.theme-dark .investment-summary-card p {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .investment-metric-card,
.theme-dark .investment-metric-card {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.1) 0%, rgba(96, 165, 250, 0.05) 100%) !important;
    border: 1px solid rgba(96, 165, 250, 0.2) !important;
}

[data-theme="dark"] .investment-metric-card .stat-label,
.theme-dark .investment-metric-card .stat-label {
    color: var(--color-primary-light) !important;
}

[data-theme="dark"] .investment-metric-card .stat-value,
.theme-dark .investment-metric-card .stat-value {
    color: var(--color-primary) !important;
}

/* ===== 34. LOAN STAT CARDS ===== */
/* Light mode defaults */
.loan-stat-card {
    background: #ffffff;
}

/* Dark mode overrides */
[data-theme="dark"] .loan-stat-card,
.theme-dark .loan-stat-card {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .loan-stat-card .stat-value,
.theme-dark .loan-stat-card .stat-value {
    color: var(--color-primary) !important;
}

[data-theme="dark"] .loan-stat-card .stat-label,
.theme-dark .loan-stat-card .stat-label {
    color: var(--text-secondary) !important;
}

/* ===== 35. OVERALL UTILIZATION CHART CONTAINER ===== */
/* Light mode defaults */
.utilization-chart-container {
    background: #ffffff;
}

.top-cards-list {
    background: #ffffff;
}

/* Dark mode - Fully dark with subtle depth */
[data-theme="dark"] .utilization-chart-container,
.theme-dark .utilization-chart-container {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .utilization-chart-container h6,
.theme-dark .utilization-chart-container h6 {
    color: var(--color-primary) !important;
}

/* Top Credit Cards List Container */
[data-theme="dark"] .top-cards-list,
[data-theme="dark"] #topCreditCardsList,
.theme-dark .top-cards-list {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(36, 52, 71, 0.6) 100%) !important;
    border-color: var(--border-primary) !important;
}

/* ===== 36. INDIVIDUAL INVESTMENT GOALS SECTION ===== */
[data-theme="dark"] div[style*="border: 2px solid #e0f2fe"],
.theme-dark div[style*="border: 2px solid #e0f2fe"] {
    border-color: var(--border-primary) !important;
    background: rgba(96, 165, 250, 0.05) !important;
}

[data-theme="dark"] div[style*="border: 2px solid #e0f2fe"] h6,
.theme-dark div[style*="border: 2px solid #e0f2fe"] h6 {
    color: var(--color-primary) !important;
}

/* ===== 37. INDIVIDUAL LOAN CARDS ===== */
[data-theme="dark"] #loanPortfolioCards .professional-stat-card,
.theme-dark #loanPortfolioCards .professional-stat-card {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-color: var(--border-primary) !important;
}

/* ===== 38. BLACK BOX FIX FOR INVESTMENT DISTRIBUTION CHART ===== */
[data-theme="dark"] .investment-distribution-card .flex-grow-1,
[data-theme="dark"] .investment-distribution-card [style*="flex: 1"],
.theme-dark .investment-distribution-card .flex-grow-1 {
    background: transparent !important;
}

/* Fix any inner chart wrappers */
[data-theme="dark"] .investment-distribution-card .chart-wrapper,
[data-theme="dark"] .investment-distribution-card .chart-area,
.theme-dark .investment-distribution-card .chart-wrapper {
    background: transparent !important;
}

/* Fix empty state boxes */
[data-theme="dark"] .investment-distribution-card .empty-state,
[data-theme="dark"] .investment-distribution-card [class*="empty"],
.theme-dark .investment-distribution-card .empty-state {
    background: rgba(30, 41, 59, 0.5) !important;
    border-color: var(--border-primary) !important;
}

/* ===== 39. YEAR DIALOG CLOSE BUTTON FIX ===== */
[data-theme="dark"] .year-dialog-close,
.theme-dark .year-dialog-close {
    color: var(--text-muted) !important;
    background: transparent !important;
}

[data-theme="dark"] .year-dialog-close:hover,
.theme-dark .year-dialog-close:hover {
    background: rgba(96, 165, 250, 0.2) !important;
    color: var(--color-primary) !important;
}

/* ===== 40. ACCESSIBILITY FOCUS STATES ===== */
[data-theme="dark"] *:focus-visible,
.theme-dark *:focus-visible {
    outline: 2px solid var(--color-primary) !important;
    outline-offset: 2px;
}

[data-theme="dark"] button:focus-visible,
[data-theme="dark"] a:focus-visible,
.theme-dark button:focus-visible {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3) !important;
}

/* ===== 41. LOADING BUTTON STATES ===== */
.btn.loading {
    position: relative;
    pointer-events: none;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

[data-theme="dark"] .btn.loading::after,
.theme-dark .btn.loading::after {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== 42. MOTION EFFECTS FOR TOUCH FEEDBACK ===== */
.touch-feedback {
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.touch-feedback:active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* ===== 43. ALL BG-WHITE AND WHITE BACKGROUND OVERRIDES ===== */
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background: #ffffff"],
[data-theme="dark"] [style*="background:#ffffff"],
.theme-dark [style*="background: white"] {
    background: var(--bg-card) !important;
}

/* ===== 44. ALL LIGHT GRADIENT OVERRIDES ===== */
[data-theme="dark"] [style*="linear-gradient(135deg, #f8fafc"],
[data-theme="dark"] [style*="linear-gradient(135deg, #fefcfb"],
[data-theme="dark"] [style*="linear-gradient(135deg, #fefefe"],
[data-theme="dark"] [style*="linear-gradient(135deg, #EEF2FF"],
.theme-dark [style*="linear-gradient(135deg, #f8fafc"] {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%) !important;
}

/* ===== 45. ALL LIGHT BORDER COLOR OVERRIDES ===== */
[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
[data-theme="dark"] [style*="border: 1px solid #e2e8f0"],
[data-theme="dark"] [style*="border-color: #e5e7eb"],
.theme-dark [style*="border: 1px solid #e5e7eb"] {
    border-color: var(--border-primary) !important;
}

/* ===== 46. ALL LIGHT TEXT COLOR OVERRIDES ===== */
[data-theme="dark"] [style*="color: #1e40af"],
[data-theme="dark"] [style*="color:#1e40af"],
.theme-dark [style*="color: #1e40af"] {
    color: var(--color-primary) !important;
}

[data-theme="dark"] [style*="color: #3b82f6"],
[data-theme="dark"] [style*="color:#3b82f6"],
.theme-dark [style*="color: #3b82f6"] {
    color: var(--color-primary) !important;
}

/* ===== 47. BLUE BUTTONS COMPREHENSIVE DARK MODE ===== */
/* Primary blue buttons - softer blue per 2025 fintech standards */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-gradient,
[data-theme="dark"] [class*="btn-primary"],
.theme-dark .btn-primary {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%) !important;
    border-color: #3B82F6 !important;
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25) !important;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-gradient:hover,
.theme-dark .btn-primary:hover {
    background: linear-gradient(135deg, #60A5FA 0%, #3B82F6 100%) !important;
    border-color: #60A5FA !important;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.35) !important;
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-primary:active,
.theme-dark .btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 4px rgba(59, 130, 246, 0.2) !important;
}

/* Outline blue buttons */
[data-theme="dark"] .btn-outline-primary,
.theme-dark .btn-outline-primary {
    background: transparent !important;
    border: 1.5px solid var(--color-primary) !important;
    color: var(--color-primary) !important;
}

[data-theme="dark"] .btn-outline-primary:hover,
.theme-dark .btn-outline-primary:hover {
    background: rgba(96, 165, 250, 0.15) !important;
    border-color: var(--color-primary-light) !important;
    color: var(--color-primary-light) !important;
}

/* Light/secondary buttons */
[data-theme="dark"] .btn-light,
[data-theme="dark"] .btn-secondary,
.theme-dark .btn-light {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .btn-light:hover,
[data-theme="dark"] .btn-secondary:hover,
.theme-dark .btn-light:hover {
    background: var(--bg-hover) !important;
    border-color: var(--color-primary) !important;
}

/* ===== 48. FIACORE BLUE TEXT - OPTIMIZED FOR DARK MODE ===== */
/* Using #60A5FA for readability on dark backgrounds (WCAG AA compliant) */
[data-theme="dark"] .text-primary,
[data-theme="dark"] .text-blue,
[data-theme="dark"] h1.text-primary,
[data-theme="dark"] h2.text-primary,
[data-theme="dark"] h3.text-primary,
[data-theme="dark"] h4.text-primary,
[data-theme="dark"] h5.text-primary,
[data-theme="dark"] h6.text-primary,
.theme-dark .text-primary {
    color: #60A5FA !important;
}

/* Icons in dark mode - slightly lighter for visibility */
[data-theme="dark"] .text-primary i,
[data-theme="dark"] i.text-primary,
[data-theme="dark"] .fa-primary,
.theme-dark .text-primary i {
    color: #60A5FA !important;
}

/* ===== 49. SECTION TITLE HEADERS ===== */
[data-theme="dark"] .section-title,
[data-theme="dark"] .card-header .text-primary,
[data-theme="dark"] h2[class*="text-primary"],
.theme-dark .section-title {
    color: #93C5FD !important;
}

/* ===== 50. ICON COLORS FOR DARK MODE ===== */
[data-theme="dark"] .stat-icon,
[data-theme="dark"] .card-icon,
[data-theme="dark"] .feature-icon,
.theme-dark .stat-icon {
    color: var(--color-primary) !important;
    background: rgba(96, 165, 250, 0.1) !important;
}

/* Muted icons */
[data-theme="dark"] .text-muted i,
[data-theme="dark"] i.text-muted,
.theme-dark .text-muted i {
    color: var(--text-muted) !important;
}

/* ===== 51. ACCESSIBILITY - SKIP LINK STYLES ===== */
/* Skip links completely hidden until focused - proper accessibility pattern */
.skip-link,
a.skip-link,
.skip-link.visually-hidden-focusable {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    clip-path: inset(50%) !important;
    white-space: nowrap !important;
    border: 0 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.skip-link:focus,
.skip-link:focus-visible,
a.skip-link:focus,
a.skip-link:focus-visible {
    position: fixed !important;
    top: 10px !important;
    left: 10px !important;
    width: auto !important;
    height: auto !important;
    padding: 12px 20px !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
    white-space: normal !important;
    background: var(--color-primary, #3B82F6) !important;
    color: white !important;
    z-index: 99999 !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ===== 52. FOCUS-VISIBLE STATES (KEYBOARD ONLY) ===== */
*:focus-visible {
    outline: 2px solid var(--color-primary, #3B82F6) !important;
    outline-offset: 2px !important;
}

[data-theme="dark"] *:focus-visible,
.theme-dark *:focus-visible {
    outline-color: #60A5FA !important;
}

/* Buttons focus ring */
[data-theme="dark"] .btn:focus-visible,
[data-theme="dark"] button:focus-visible,
.theme-dark .btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.4) !important;
    outline: none !important;
}

/* Links focus ring */
[data-theme="dark"] a:focus-visible,
.theme-dark a:focus-visible {
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3) !important;
    border-radius: 2px;
}

/* Cards focus ring */
[data-theme="dark"] .card:focus-visible,
[data-theme="dark"] .professional-stat-card:focus-visible,
.theme-dark .card:focus-visible {
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.3), var(--shadow-md) !important;
}

/* ===== 53. TOUCH FEEDBACK FOR MOBILE ===== */
@media (hover: none) and (pointer: coarse) {
    .btn, button, a, .card, .interactive {
        -webkit-tap-highlight-color: rgba(96, 165, 250, 0.2);
    }
    
    .btn:active, button:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
}

/* ===== 54. LOADING BUTTON STATE ANIMATIONS ===== */
.btn.is-loading,
.btn[data-loading="true"] {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after,
.btn[data-loading="true"]::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    top: 50%;
    left: 50%;
    margin-left: -9px;
    margin-top: -9px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: buttonSpinner 0.8s linear infinite;
}

@keyframes buttonSpinner {
    to { transform: rotate(360deg); }
}

/* Success state */
.btn.is-success {
    background: var(--color-success) !important;
    border-color: var(--color-success) !important;
}

/* Error state */
.btn.is-error {
    background: var(--color-expense) !important;
    border-color: var(--color-expense) !important;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* ===== 55. LANDMARK ROLES VISUAL HELPERS ===== */
[data-theme="dark"] [role="main"],
[data-theme="dark"] main,
.theme-dark [role="main"] {
    background: var(--bg-primary);
}

[data-theme="dark"] [role="navigation"],
.theme-dark [role="navigation"] {
    background: var(--bg-secondary);
}

/* ===== 56. SCREEN READER ONLY CLASS ===== */
.sr-only,
.visually-hidden,
.screen-reader-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* REMOVED DUPLICATE - See Section 1 for hero-banner button styles */

/* ===== 58. REDUCED MOTION PREFERENCE ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 59. PAGE TRANSITION ANIMATIONS ===== */
/* Fade-in animation for page content */
@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageFade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-transition-enter {
    animation: pageEnter 0.3s ease-out forwards;
}

.page-transition-fade {
    animation: pageFade 0.25s ease-out forwards;
}

/* Auto-apply to main content area */
main, [role="main"], .main-container {
    animation: pageFade 0.2s ease-out;
}

/* Cards stagger animation */
.stagger-animation > * {
    opacity: 0;
    animation: pageEnter 0.4s ease-out forwards;
}

.stagger-animation > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-animation > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-animation > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-animation > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-animation > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-animation > *:nth-child(6) { animation-delay: 0.3s; }

/* ===== 60. SWIPE GESTURES FOR MOBILE NAVIGATION ===== */
@media (max-width: 991px) {
    .swipe-container {
        touch-action: pan-x pan-y;
        overflow-x: hidden;
    }
    
    .swipe-indicator {
        position: fixed;
        top: 50%;
        left: 0;
        width: 4px;
        height: 60px;
        background: linear-gradient(180deg, transparent 0%, var(--color-primary) 50%, transparent 100%);
        border-radius: 0 4px 4px 0;
        opacity: 0;
        transform: translateY(-50%);
        transition: opacity 0.2s ease;
        z-index: 1000;
    }
    
    .swipe-indicator.visible {
        opacity: 0.6;
    }
    
    /* Sidebar swipe area */
    .sidebar-swipe-zone {
        position: fixed;
        left: 0;
        top: 0;
        width: 20px;
        height: 100%;
        z-index: 999;
    }
}

/* ===== 61. PULL-TO-REFRESH FOR DATA-HEAVY PAGES ===== */
.pull-to-refresh-container {
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.pull-to-refresh-indicator {
    position: absolute;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: top 0.2s ease;
    z-index: 100;
}

.pull-to-refresh-indicator.pulling {
    top: 10px;
}

.pull-to-refresh-indicator.refreshing .refresh-icon {
    animation: spin 0.8s linear infinite;
}

.refresh-icon {
    width: 24px;
    height: 24px;
    color: var(--color-primary);
}

[data-theme="dark"] .refresh-icon,
.theme-dark .refresh-icon {
    color: #60A5FA;
}

/* ===== 62. CONSISTENT ERROR MESSAGE STYLING ===== */
/* Form validation errors */
.form-error,
.error-message,
.validation-error,
.field-error,
.invalid-feedback {
    color: #EF4444 !important;
    font-size: 0.85rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.form-error::before,
.error-message::before {
    content: '\f06a';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.75rem;
}

[data-theme="dark"] .form-error,
[data-theme="dark"] .error-message,
[data-theme="dark"] .validation-error,
.theme-dark .form-error {
    color: #F87171 !important;
}

/* Input error state */
.form-control.is-invalid,
.form-control.error,
input.error,
select.error,
textarea.error {
    border-color: #EF4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
}

[data-theme="dark"] .form-control.is-invalid,
[data-theme="dark"] .form-control.error,
.theme-dark .form-control.is-invalid {
    border-color: #F87171 !important;
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2) !important;
}

/* Alert error styling */
.alert-danger,
.alert-error {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: #DC2626 !important;
    border-radius: 8px;
    padding: 1rem;
}

[data-theme="dark"] .alert-danger,
[data-theme="dark"] .alert-error,
.theme-dark .alert-danger {
    background: rgba(248, 113, 113, 0.1) !important;
    border-color: rgba(248, 113, 113, 0.3) !important;
    color: #F87171 !important;
}

/* Success message styling */
.alert-success,
.success-message {
    background: rgba(34, 197, 94, 0.1) !important;
    border: 1px solid rgba(34, 197, 94, 0.3) !important;
    color: #16A34A !important;
    border-radius: 8px;
    padding: 1rem;
}

[data-theme="dark"] .alert-success,
.theme-dark .alert-success {
    background: rgba(52, 211, 153, 0.1) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
    color: #34D399 !important;
}

/* ===== 63. EMPTY STATE ILLUSTRATIONS ===== */
.empty-state,
.no-data-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1.5rem;
    opacity: 0.4;
    color: var(--text-muted, #64748B);
}

[data-theme="dark"] .empty-state-icon,
.theme-dark .empty-state-icon {
    color: #64748B;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #1E293B);
    margin-bottom: 0.5rem;
}

[data-theme="dark"] .empty-state-title,
.theme-dark .empty-state-title {
    color: var(--text-primary);
}

.empty-state-description {
    font-size: 0.95rem;
    color: var(--text-muted, #64748B);
    max-width: 400px;
    line-height: 1.6;
}

[data-theme="dark"] .empty-state-description,
.theme-dark .empty-state-description {
    color: var(--text-secondary);
}

/* ===== 64. TYPOGRAPHY HIERARCHY - FINTECH BEST PRACTICES ===== */
/* Consistent heading sizes */
h1, .h1 {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h2, .h2 {
    font-size: 1.875rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.015em;
}

h3, .h3 {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

h4, .h4 {
    font-size: 1.25rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.005em;
}

h5, .h5 {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1.4;
}

h6, .h6 {
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
}

/* Body text - optimal for financial data */
body {
    font-size: 1rem;
    line-height: 1.6;
    letter-spacing: 0.01em;
}

/* Small text for labels and captions */
.text-sm, small {
    font-size: 0.875rem;
    line-height: 1.5;
}

.text-xs {
    font-size: 0.75rem;
    line-height: 1.4;
}

/* Financial amounts - monospace-like for alignment */
.amount, .currency-value, .stat-value {
    font-variant-numeric: tabular-nums;
    font-feature-settings: 'tnum' on;
}

/* ===== 65. ENHANCED TOUCH FEEDBACK ===== */
/* Touch ripple effect */
.touch-ripple {
    position: relative;
    overflow: hidden;
}

.touch-ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: width 0.4s ease, height 0.4s ease, opacity 0.4s ease;
}

.touch-ripple:active::after {
    width: 200%;
    height: 200%;
    opacity: 1;
    transition: 0s;
}

[data-theme="dark"] .touch-ripple::after,
.theme-dark .touch-ripple::after {
    background: rgba(96, 165, 250, 0.2);
}

/* ===== 66. UNIVERSAL BUTTON DARK MODE FIX ===== */
/* Catch-all for any remaining light buttons */
html[data-theme="dark"] .btn-outline-primary:not(.btn-outline-hero),
[data-theme="dark"] .btn-outline-primary:not(.btn-outline-hero),
.theme-dark .btn-outline-primary:not(.btn-outline-hero) {
    background: transparent !important;
    color: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

html[data-theme="dark"] .btn-outline-primary:not(.btn-outline-hero):hover,
[data-theme="dark"] .btn-outline-primary:not(.btn-outline-hero):hover,
.theme-dark .btn-outline-primary:not(.btn-outline-hero):hover {
    background: rgba(96, 165, 250, 0.15) !important;
    color: #93C5FD !important;
    border-color: #93C5FD !important;
}

html[data-theme="dark"] .btn-outline-secondary,
[data-theme="dark"] .btn-outline-secondary,
.theme-dark .btn-outline-secondary {
    background: transparent !important;
    color: var(--text-secondary) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .btn-outline-secondary:hover,
[data-theme="dark"] .btn-outline-secondary:hover,
.theme-dark .btn-outline-secondary:hover {
    background: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--text-muted) !important;
}

/* ===== 67. COMPREHENSIVE INLINE STYLE OVERRIDES ===== */
/* Override inline background: #ffffff on stat cards */
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] div[style*="#ffffff"],
[data-theme="dark"] [style*="background: #ffffff"],
.theme-dark [style*="background: #ffffff"] {
    background: #1E293B !important;
}

/* Override inline borders for dark mode */
html[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border-color: #e5e7eb"],
[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
.theme-dark [style*="border: 1px solid #e5e7eb"] {
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* Override inline icon colors - Income (green) */
html[data-theme="dark"] [style*="color: #10b981"],
[data-theme="dark"] [style*="color: #10b981"],
.theme-dark [style*="color: #10b981"] {
    color: #34D399 !important;
}

/* Override inline icon colors - Expense (red) */
html[data-theme="dark"] [style*="color: #ef4444"],
[data-theme="dark"] [style*="color: #ef4444"],
.theme-dark [style*="color: #ef4444"] {
    color: #F87171 !important;
}

/* Override inline icon colors - Blue */
html[data-theme="dark"] [style*="color: #3b82f6"]:not(a):not(button),
[data-theme="dark"] [style*="color: #3b82f6"]:not(a):not(button),
.theme-dark [style*="color: #3b82f6"]:not(a):not(button) {
    color: #60A5FA !important;
}

/* Override inline icon colors - Purple */
html[data-theme="dark"] [style*="color: #8b5cf6"],
[data-theme="dark"] [style*="color: #8b5cf6"],
.theme-dark [style*="color: #8b5cf6"] {
    color: #A78BFA !important;
}

/* Override inline icon backgrounds */
html[data-theme="dark"] [style*="background: rgba(16, 185, 129"],
[data-theme="dark"] [style*="background: rgba(16, 185, 129"],
.theme-dark [style*="background: rgba(16, 185, 129"] {
    background: rgba(52, 211, 153, 0.15) !important;
}

html[data-theme="dark"] [style*="background: rgba(239, 68, 68"],
[data-theme="dark"] [style*="background: rgba(239, 68, 68"],
.theme-dark [style*="background: rgba(239, 68, 68"] {
    background: rgba(248, 113, 113, 0.15) !important;
}

html[data-theme="dark"] [style*="background: rgba(59, 130, 246"],
[data-theme="dark"] [style*="background: rgba(59, 130, 246"],
.theme-dark [style*="background: rgba(59, 130, 246"] {
    background: rgba(96, 165, 250, 0.15) !important;
}

html[data-theme="dark"] [style*="background: rgba(139, 92, 246"],
[data-theme="dark"] [style*="background: rgba(139, 92, 246"],
.theme-dark [style*="background: rgba(139, 92, 246"] {
    background: rgba(167, 139, 250, 0.15) !important;
}

/* Override muted text colors for dark mode */
html[data-theme="dark"] [style*="color: #6b7280"],
[data-theme="dark"] [style*="color: #6b7280"],
.theme-dark [style*="color: #6b7280"] {
    color: #94A3B8 !important;
}

html[data-theme="dark"] [style*="color: #9ca3af"],
[data-theme="dark"] [style*="color: #9ca3af"],
.theme-dark [style*="color: #9ca3af"] {
    color: #64748B !important;
}

/* Override divider line backgrounds */
html[data-theme="dark"] [style*="background: rgba(0, 0, 0, 0.1)"],
[data-theme="dark"] [style*="background: rgba(0, 0, 0, 0.1)"],
.theme-dark [style*="background: rgba(0, 0, 0, 0.1)"] {
    background: rgba(96, 165, 250, 0.15) !important;
}

/* ===== 68. GOALS OVERVIEW & INVESTMENT CARDS - COMPLETE DARK MODE ===== */

/* Goals Overview wrapper - bg-white override - HIGH SPECIFICITY */
html[data-theme="dark"] .bg-white.rounded-3.shadow-sm.p-4,
html[data-theme="dark"] .bg-white.rounded-3.shadow-sm,
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] div.bg-white,
[data-theme="dark"] .bg-white.rounded-3.shadow-sm {
    background: #1E293B !important;
    background-color: #1E293B !important;
    border: 1px solid rgba(96, 165, 250, 0.15) !important;
}

/* Professional stat cards - Goals cards with inline styles - OVERRIDE !important */
html[data-theme="dark"] .professional-stat-card,
html[data-theme="dark"] .professional-stat-card.animated-card,
html[data-theme="dark"] .professional-stat-card.animated-card.shadow-sm.h-100,
html[data-theme="dark"] div.professional-stat-card,
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background:#ffffff"],
[data-theme="dark"] .professional-stat-card {
    background: #1E293B !important;
    background-color: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* Metric boxes inside Goals cards - Current/Target with purple bg */
html[data-theme="dark"] div[style*="background: #f5f3ff"],
html[data-theme="dark"] div[style*="background:#f5f3ff"],
[data-theme="dark"] div[style*="#f5f3ff"],
html[data-theme="dark"] .investment-metric-card,
[data-theme="dark"] .investment-metric-card {
    background: rgba(94, 234, 212, 0.1) !important;
    background-color: rgba(94, 234, 212, 0.1) !important;
    border: 1px solid rgba(94, 234, 212, 0.2) !important;
}

/* Specific fix for light mode metric cards */
.investment-metric-card {
    background: #f0f7ff;
    border: 1px solid #dbeafe;
}

/* Goals Overview metric cards - light mode */
.goals-metric-card {
    background: #f0f7ff;
    border: 1px solid #dbeafe;
}

/* Goals Overview metric cards - dark mode */
html[data-theme="dark"] .goals-metric-card,
[data-theme="dark"] .goals-metric-card {
    background: rgba(94, 234, 212, 0.1) !important;
    border: 1px solid rgba(94, 234, 212, 0.2) !important;
}

html[data-theme="dark"] .goals-metric-card .stat-label,
[data-theme="dark"] .goals-metric-card .stat-label {
    color: #94A3B8 !important;
}

html[data-theme="dark"] .goals-metric-card .stat-value,
[data-theme="dark"] .goals-metric-card .stat-value {
    color: #F1F5F9 !important;
}

.investment-summary-card h3 {
    margin-top: 10px;
}

.investment-distribution-card h6 {
    margin-top: 10px;
}

/* ===== 68A. GOALS CARDS - COMPLETE DARK MODE ===== */
/* Goals cards with new .goals-card class */
.goals-card {
    background: #ffffff;
    min-height: 520px !important;
    height: auto !important;
}

html[data-theme="dark"] .goals-card,
[data-theme="dark"] .goals-card,
.theme-dark .goals-card {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
    min-height: 520px !important;
    height: auto !important;
}

/* Goals card titles */
html[data-theme="dark"] .goals-card h3,
[data-theme="dark"] .goals-card h3 {
    color: #5eead4 !important;
}

/* Goals card subtitles */
html[data-theme="dark"] .goals-card p[style*="color: #8b5cf6"],
html[data-theme="dark"] .goals-card p[style*="#8b5cf6"],
[data-theme="dark"] .goals-card p[style*="#8b5cf6"] {
    color: #34D399 !important;
}

/* Progress percentage - updated to target #8b5cf6 which is now used */
html[data-theme="dark"] .goals-card .fw-bold[style*="color: #8b5cf6"],
html[data-theme="dark"] .goals-card div[style*="color: #8b5cf6"],
[data-theme="dark"] .goals-card div[style*="#8b5cf6"] {
    color: #5eead4 !important;
}

/* Goals icons */
html[data-theme="dark"] .goals-card .stat-icon,
[data-theme="dark"] .goals-card .stat-icon {
    color: #60A5FA !important;
}

/* Goals metric boxes */
html[data-theme="dark"] .goals-card div[style*="background: #f5f3ff"],
[data-theme="dark"] .goals-card div[style*="#f5f3ff"] {
    background: rgba(96, 165, 250, 0.1) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Stat values in goals */
html[data-theme="dark"] .goals-card .stat-value,
[data-theme="dark"] .goals-card .stat-value {
    color: #F1F5F9 !important;
}

/* Goals card titles - Savings Goals, Investment Goals */
html[data-theme="dark"] .professional-stat-card h3,
[data-theme="dark"] .professional-stat-card h3 {
    color: #5eead4 !important;
}

/* Goals card subtitles - "0 active goals" */
html[data-theme="dark"] .professional-stat-card h3 + p,
html[data-theme="dark"] .professional-stat-card p[style*="color: #8b5cf6"],
html[data-theme="dark"] .professional-stat-card p[style*="color: #3b82f6"],
[data-theme="dark"] .professional-stat-card p[style*="#8b5cf6"] {
    color: #34D399 !important;
}

/* Progress percentage text */
html[data-theme="dark"] .professional-stat-card .fw-bold[style*="color: #ef4444"],
[data-theme="dark"] .professional-stat-card .fw-bold[style*="#ef4444"] {
    color: #5eead4 !important;
}

/* Metric cards inside goals - Current/Target sections */
html[data-theme="dark"] .professional-stat-card div[style*="background: #f5f3ff"],
[data-theme="dark"] .professional-stat-card div[style*="#f5f3ff"] {
    background: rgba(94, 234, 212, 0.1) !important;
    border-color: rgba(94, 234, 212, 0.2) !important;
}

/* Stat labels - CURRENT, TARGET */
html[data-theme="dark"] .stat-label,
html[data-theme="dark"] div[style*="color: #6b7280"],
[data-theme="dark"] .stat-label {
    color: #94A3B8 !important;
}

/* Stat values - amounts */
html[data-theme="dark"] .stat-value,
html[data-theme="dark"] .professional-stat-card .stat-value,
[data-theme="dark"] .stat-value {
    color: #F1F5F9 !important;
}

/* Investment summary card */
html[data-theme="dark"] .investment-summary-card,
[data-theme="dark"] .investment-summary-card {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* Investment Summary title with icon */
html[data-theme="dark"] .investment-summary-card h3,
html[data-theme="dark"] h3[style*="color: #1e40af"],
[data-theme="dark"] h3[style*="#1e40af"] {
    color: #5eead4 !important;
}

/* Investment distribution card */
html[data-theme="dark"] .investment-distribution-card,
[data-theme="dark"] .investment-distribution-card {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* ===== 69. CHART TITLES - ALL CARDS & CONTAINERS ===== */
/* Fix all chart titles with inline blue colors */
html[data-theme="dark"] h6[style*="color: #2196f3"],
html[data-theme="dark"] h6[style*="color: #3b82f6"],
html[data-theme="dark"] .chart-container h6,
html[data-theme="dark"] .utilization-chart-container h6,
[data-theme="dark"] h6[style*="#2196f3"],
[data-theme="dark"] h6[style*="#3b82f6"] {
    color: #5eead4 !important;
}

/* Chart title icons */
html[data-theme="dark"] h6 i[style*="color: #3b82f6"],
html[data-theme="dark"] h6 i[style*="color: #2196f3"],
[data-theme="dark"] h6 i[style*="#3b82f6"] {
    color: #60A5FA !important;
}

/* ===== 70. UTILIZATION CONTAINERS ===== */
html[data-theme="dark"] .utilization-chart-container,
[data-theme="dark"] .utilization-chart-container {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* Top cards list container */
html[data-theme="dark"] .top-cards-list,
html[data-theme="dark"] #topCreditCardsList,
[data-theme="dark"] .top-cards-list {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: rgba(96, 165, 250, 0.1) !important;
}

/* ===== 71. CHART CONTAINERS WITH INLINE GRADIENTS ===== */
/* Override light mode gradients in chart containers */
html[data-theme="dark"] .chart-container[style*="background: linear-gradient"],
html[data-theme="dark"] .chart-container.bg-gradient,
[data-theme="dark"] .chart-container[style*="linear-gradient"] {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* ===== 72. SECTION TITLES - PROFESSIONAL COLORS ===== */
/* All h2 section titles with text-primary */
html[data-theme="dark"] h2.text-primary,
html[data-theme="dark"] .text-primary.fw-bold,
[data-theme="dark"] h2.text-primary {
    color: #5eead4 !important;
}

/* Section title icons */
html[data-theme="dark"] h2.text-primary i,
html[data-theme="dark"] .text-primary.fw-bold i,
[data-theme="dark"] h2.text-primary i {
    color: #60A5FA !important;
}

/* Section divider lines */
html[data-theme="dark"] div[style*="background: rgba(0, 0, 0, 0.1)"],
[data-theme="dark"] div[style*="rgba(0, 0, 0, 0.1)"] {
    background: rgba(96, 165, 250, 0.15) !important;
}

/* ===== 73. SVG RADIAL GAUGE - OVERALL UTILIZATION ===== */
html[data-theme="dark"] .radial-gauge-container {
    background: transparent !important;
}

html[data-theme="dark"] .radial-gauge-bg {
    stroke: rgba(96, 165, 250, 0.15) !important;
}

html[data-theme="dark"] .radial-gauge-progress {
    stroke: url(#gaugeGradientDark) !important;
}

html[data-theme="dark"] .radial-gauge-text {
    fill: #F1F5F9 !important;
}

html[data-theme="dark"] .radial-gauge-label {
    fill: #94A3B8 !important;
}

/* Gauge percent and label text in dark mode */
html[data-theme="dark"] .gauge-percent,
[data-theme="dark"] .gauge-percent {
    color: #F1F5F9 !important;
}

html[data-theme="dark"] .gauge-label,
[data-theme="dark"] .gauge-label {
    color: #94A3B8 !important;
}

html[data-theme="dark"] .gauge-stat-label,
[data-theme="dark"] .gauge-stat-label {
    color: #94A3B8 !important;
}

html[data-theme="dark"] .gauge-stat-value,
[data-theme="dark"] .gauge-stat-value {
    color: #5eead4 !important;
}

html[data-theme="dark"] #gaugeUsedAmount,
[data-theme="dark"] #gaugeUsedAmount {
    color: #A78BFA !important;
}

html[data-theme="dark"] #gaugeAvailableAmount,
[data-theme="dark"] #gaugeAvailableAmount {
    color: #34D399 !important;
}

/* ===== 74. CHART TITLE CLASS - UNIVERSAL STYLING ===== */
/* Light mode chart titles */
.chart-title {
    color: #6366f1 !important;
}

.chart-title i {
    color: #818cf8 !important;
}

/* Dark mode chart titles */
html[data-theme="dark"] .chart-title,
[data-theme="dark"] .chart-title {
    color: #5eead4 !important;
}

html[data-theme="dark"] .chart-title i,
[data-theme="dark"] .chart-title i {
    color: #60A5FA !important;
}

/* ===== 75. CHART CONTAINER BASE STYLING ===== */
/* Light mode chart containers */
.chart-container {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border: 1px solid #e2e8f0 !important;
}

/* Dark mode chart containers */
html[data-theme="dark"] .chart-container,
[data-theme="dark"] .chart-container {
    background: #1E293B !important;
    border: 1px solid rgba(96, 165, 250, 0.15) !important;
}

/* ===== 76. UTILIZATION CONTAINER STYLING ===== */
/* Light mode utilization containers */
.utilization-chart-container {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
}

/* Dark mode utilization containers */
html[data-theme="dark"] .utilization-chart-container,
[data-theme="dark"] .utilization-chart-container {
    background: #1E293B !important;
    border: 1px solid rgba(96, 165, 250, 0.15) !important;
}

/* Top cards list styling */
html[data-theme="dark"] .top-cards-list,
[data-theme="dark"] .top-cards-list {
    background: rgba(15, 23, 42, 0.5) !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* ===== CREDIT SUMMARY CARDS - GRADIENT BACKGROUNDS ===== */
/* Light mode - white background */
.credit-summary-purple,
.credit-summary-red,
.credit-summary-green,
.credit-summary-blue {
    background: #ffffff;
}

.credit-summary-purple .stat-value { color: #5b21b6; }
.credit-summary-red .stat-value { color: #ef4444; }
.credit-summary-green .stat-value { color: #10b981; }
.credit-summary-blue .stat-value { color: #3b82f6; }

.credit-summary-purple .stat-label,
.credit-summary-red .stat-label,
.credit-summary-green .stat-label,
.credit-summary-blue .stat-label { color: #6b7280; }

/* Dark mode - Light gradient backgrounds */
html[data-theme="dark"] .credit-summary-purple,
[data-theme="dark"] .credit-summary-purple {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(139, 92, 246, 0.05) 100%) !important;
    border-color: rgba(139, 92, 246, 0.3) !important;
}

html[data-theme="dark"] .credit-summary-red,
[data-theme="dark"] .credit-summary-red {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%) !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

html[data-theme="dark"] .credit-summary-green,
[data-theme="dark"] .credit-summary-green {
    background: linear-gradient(135deg, rgba(52, 211, 153, 0.15) 0%, rgba(52, 211, 153, 0.05) 100%) !important;
    border-color: rgba(52, 211, 153, 0.3) !important;
}

html[data-theme="dark"] .credit-summary-blue,
[data-theme="dark"] .credit-summary-blue {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.15) 0%, rgba(96, 165, 250, 0.05) 100%) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
}

/* Dark mode text colors */
html[data-theme="dark"] .credit-summary-purple .stat-value,
[data-theme="dark"] .credit-summary-purple .stat-value { color: #A78BFA !important; }

html[data-theme="dark"] .credit-summary-red .stat-value,
[data-theme="dark"] .credit-summary-red .stat-value { color: #F87171 !important; }

html[data-theme="dark"] .credit-summary-green .stat-value,
[data-theme="dark"] .credit-summary-green .stat-value { color: #34D399 !important; }

html[data-theme="dark"] .credit-summary-blue .stat-value,
[data-theme="dark"] .credit-summary-blue .stat-value { color: #60A5FA !important; }

html[data-theme="dark"] .credit-summary-purple .stat-label,
html[data-theme="dark"] .credit-summary-red .stat-label,
html[data-theme="dark"] .credit-summary-green .stat-label,
html[data-theme="dark"] .credit-summary-blue .stat-label,
[data-theme="dark"] .credit-summary-purple .stat-label,
[data-theme="dark"] .credit-summary-red .stat-label,
[data-theme="dark"] .credit-summary-green .stat-label,
[data-theme="dark"] .credit-summary-blue .stat-label {
    color: #94A3B8 !important;
}

/* Dark mode icon backgrounds */
html[data-theme="dark"] .credit-summary-purple .stat-icon,
[data-theme="dark"] .credit-summary-purple .stat-icon {
    background: rgba(139, 92, 246, 0.2) !important;
}

html[data-theme="dark"] .credit-summary-red .stat-icon,
[data-theme="dark"] .credit-summary-red .stat-icon {
    background: rgba(239, 68, 68, 0.2) !important;
}

html[data-theme="dark"] .credit-summary-green .stat-icon,
[data-theme="dark"] .credit-summary-green .stat-icon {
    background: rgba(52, 211, 153, 0.2) !important;
}

html[data-theme="dark"] .credit-summary-blue .stat-icon,
[data-theme="dark"] .credit-summary-blue .stat-icon {
    background: rgba(96, 165, 250, 0.2) !important;
}

/* ===== TRENDS PAGE DARK MODE COMPREHENSIVE FIXES ===== */

/* Hero title icon color */
html[data-theme="dark"] .hero-title-base i,
[data-theme="dark"] .hero-title-base i {
    color: #5eead4 !important;
}

/* Hero banner border fix - make edges visible, straight top corners */
html[data-theme="dark"] .hero-banner-base,
[data-theme="dark"] .hero-banner-base {
    border: 1px solid rgba(96, 165, 250, 0.2) !important;
    border-radius: 0 0 8px 8px !important;
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
}

/* Trend Highlights section title */
html[data-theme="dark"] h2.text-primary,
[data-theme="dark"] h2.text-primary {
    color: #5eead4 !important;
}

html[data-theme="dark"] h2.text-primary i,
[data-theme="dark"] h2.text-primary i {
    color: #5eead4 !important;
}

/* Trend Highlights divider line */
html[data-theme="dark"] div[style*="background: rgba(0, 0, 0, 0.1)"],
[data-theme="dark"] div[style*="background: rgba(0, 0, 0, 0.1)"] {
    background: rgba(96, 165, 250, 0.2) !important;
}

/* Trend Highlights cards - inline white background override */
html[data-theme="dark"] .professional-stat-card[style*="background: #ffffff"],
[data-theme="dark"] .professional-stat-card[style*="background: #ffffff"] {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Trend Highlights stat labels */
html[data-theme="dark"] .stat-label[style*="color: #6b7280"],
[data-theme="dark"] .stat-label[style*="color: #6b7280"] {
    color: #94A3B8 !important;
}

/* Trend Highlights stat details */
html[data-theme="dark"] .stat-detail[style*="color: #9ca3af"],
[data-theme="dark"] .stat-detail[style*="color: #9ca3af"] {
    color: #64748B !important;
}

/* Financial Charts section - chart container backgrounds */
html[data-theme="dark"] .chart-container[style*="background: linear-gradient"],
html[data-theme="dark"] .chart-container.bg-gradient,
html[data-theme="dark"] div.chart-container[style],
[data-theme="dark"] .chart-container[style*="background: linear-gradient"] {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Chart titles - fix blue color */
html[data-theme="dark"] .chart-container h5[style*="color: #2196f3"],
html[data-theme="dark"] h5[style*="color: #2196f3"],
[data-theme="dark"] h5[style*="color: #2196f3"] {
    color: #5eead4 !important;
}

html[data-theme="dark"] .chart-container h5 i,
html[data-theme="dark"] h5[style*="color: #2196f3"] i,
[data-theme="dark"] h5[style*="color: #2196f3"] i {
    color: #5eead4 !important;
}

/* Category toggle styling */
html[data-theme="dark"] .category-toggle,
html[data-theme="dark"] [class*="toggle"] label,
[data-theme="dark"] .category-toggle {
    color: #F1F5F9 !important;
}

/* Investment distribution card */
html[data-theme="dark"] .investment-distribution-card h6[style*="color: #3b82f6"],
[data-theme="dark"] h6[style*="color: #3b82f6"] {
    color: #5eead4 !important;
}

html[data-theme="dark"] .investment-distribution-card h6 i,
[data-theme="dark"] .investment-distribution-card h6 i {
    color: #5eead4 !important;
}

/* Individual Investment Goals / Borrowing Activity / Financial Activity charts */
html[data-theme="dark"] div[style*="border: 2px solid #e0f2fe"],
[data-theme="dark"] div[style*="border: 2px solid #e0f2fe"] {
    border-color: rgba(96, 165, 250, 0.3) !important;
    background: rgba(30, 41, 59, 0.5) !important;
}

/* Chart axis labels - ensure they're visible */
html[data-theme="dark"] canvas,
[data-theme="dark"] canvas {
    background: transparent !important;
}

/* ============================================================
   COMPREHENSIVE DARK MODE FIXES - AUDIT ITEMS
   Based on 2025 Fintech Best Practices & WCAG AA Standards
   ============================================================ */

/* ===== FIX #1: CATEGORY TOGGLE BUTTON ===== */
/* Toggle container/wrapper */
html[data-theme="dark"] .category-toggle-wrapper,
html[data-theme="dark"] div[style*="Category:"],
html[data-theme="dark"] .filter-toggle-container,
[data-theme="dark"] .category-toggle-wrapper {
    background: #1E293B !important;
    border: 1px solid #475569 !important;
    border-radius: 9999px !important;
}

/* Toggle track (the slider background) */
html[data-theme="dark"] input[type="checkbox"] + label,
html[data-theme="dark"] .toggle-switch label,
html[data-theme="dark"] .custom-toggle,
html[data-theme="dark"] .form-check-input,
html[data-theme="dark"] input[type="checkbox"][role="switch"],
[data-theme="dark"] .toggle-track {
    background: #475569 !important;
    border: 2px solid #64748B !important;
}

html[data-theme="dark"] input[type="checkbox"]:checked + label,
html[data-theme="dark"] .toggle-switch input:checked + label,
html[data-theme="dark"] .form-check-input:checked,
html[data-theme="dark"] input[type="checkbox"][role="switch"]:checked,
[data-theme="dark"] .toggle-track.active {
    background: #3B82F6 !important;
    border-color: #60A5FA !important;
}

/* Toggle knob */
html[data-theme="dark"] .toggle-knob,
html[data-theme="dark"] input[type="checkbox"] + label::before,
html[data-theme="dark"] .form-check-input::before,
[data-theme="dark"] .toggle-knob {
    background: #F1F5F9 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}

/* Toggle labels */
html[data-theme="dark"] span[id*="Label"][style*="color: #64748b"],
html[data-theme="dark"] span[id*="Label"][style*="color: #3b82f6"],
html[data-theme="dark"] span[style*="color: #64748b"],
[data-theme="dark"] .toggle-label {
    color: #94A3B8 !important;
}

html[data-theme="dark"] span[id*="Label"].active,
html[data-theme="dark"] span[style*="font-weight: 600"][style*="color"],
[data-theme="dark"] .toggle-label.active {
    color: #60A5FA !important;
}

/* Universal category toggle specific styling */
html[data-theme="dark"] #universalDetailedLabel,
html[data-theme="dark"] #universalSummaryLabel,
[data-theme="dark"] #universalDetailedLabel,
[data-theme="dark"] #universalSummaryLabel {
    color: #94A3B8 !important;
    transition: color 0.2s ease !important;
}

html[data-theme="dark"] #universalDetailedLabel[style*="font-weight: 600"],
html[data-theme="dark"] #universalSummaryLabel[style*="font-weight: 600"],
[data-theme="dark"] .toggle-label-active {
    color: #60A5FA !important;
}

/* Bootstrap form switches */
html[data-theme="dark"] .form-switch .form-check-input,
[data-theme="dark"] .form-switch .form-check-input {
    background-color: #475569 !important;
    border-color: #64748B !important;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23F1F5F9'/%3e%3c/svg%3e") !important;
}

html[data-theme="dark"] .form-switch .form-check-input:checked,
[data-theme="dark"] .form-switch .form-check-input:checked {
    background-color: #3B82F6 !important;
    border-color: #60A5FA !important;
}

/* ===== FIX #3: LOAN/GOAL/CREDIT CARD BACKGROUNDS ===== */
/* Goal cards */
html[data-theme="dark"] .goals-card,
html[data-theme="dark"] .investment-goal-card,
html[data-theme="dark"] .savings-goal-card,
html[data-theme="dark"] div[class*="goal"][style*="background: #ffffff"],
html[data-theme="dark"] div[class*="goal"][style*="background:#ffffff"],
html[data-theme="dark"] .animated-card[style*="background: #ffffff"],
[data-theme="dark"] .goals-card {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Loan cards */
html[data-theme="dark"] .loan-card,
html[data-theme="dark"] .loan-item,
html[data-theme="dark"] div[class*="loan"][style*="background: #ffffff"],
html[data-theme="dark"] .loan-portfolio-card,
[data-theme="dark"] .loan-card {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Credit card items */
html[data-theme="dark"] .credit-card-item,
html[data-theme="dark"] .card-item,
html[data-theme="dark"] div[class*="credit"][style*="background: #ffffff"],
html[data-theme="dark"] .utilization-card,
[data-theme="dark"] .credit-card-item {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Generic card white backgrounds */
html[data-theme="dark"] div[style*="background: #ffffff"],
html[data-theme="dark"] div[style*="background:#ffffff"],
html[data-theme="dark"] div[style*="background: white"],
html[data-theme="dark"] .card[style*="background: #ffffff"],
html[data-theme="dark"] .professional-stat-card[style*="background: #ffffff"] {
    background: #1E293B !important;
}

/* Monthly Rate sections inside goal cards */
html[data-theme="dark"] .goal-card-section,
html[data-theme="dark"] div[style*="Monthly Rate"],
html[data-theme="dark"] .monthly-rate-section {
    background: #334155 !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* ===== FIX #4: PROGRESS BAR BACKGROUNDS ===== */
html[data-theme="dark"] .progress,
html[data-theme="dark"] .progress-bar-container,
html[data-theme="dark"] div[class*="progress"][style*="background"],
[data-theme="dark"] .progress {
    background: #334155 !important;
}

html[data-theme="dark"] .progress-track,
html[data-theme="dark"] .progress-bg,
[data-theme="dark"] .progress-track {
    background: #475569 !important;
}

/* Progress bar fill colors - use theme colors */
html[data-theme="dark"] .progress-bar.bg-success,
[data-theme="dark"] .progress-bar.bg-success {
    background: #5EEAD4 !important;
}

html[data-theme="dark"] .progress-bar.bg-primary,
[data-theme="dark"] .progress-bar.bg-primary {
    background: #60A5FA !important;
}

html[data-theme="dark"] .progress-bar.bg-warning,
[data-theme="dark"] .progress-bar.bg-warning {
    background: #FBBF24 !important;
}

html[data-theme="dark"] .progress-bar.bg-danger,
[data-theme="dark"] .progress-bar.bg-danger {
    background: #FB7185 !important;
}

/* ===== FIX #5: DIVIDERS & SEPARATORS ===== */
html[data-theme="dark"] div[style*="background: rgba(0, 0, 0, 0.1)"],
html[data-theme="dark"] div[style*="background:rgba(0, 0, 0, 0.1)"],
html[data-theme="dark"] div[style*="background: rgba(0,0,0,0.1)"],
html[data-theme="dark"] hr,
html[data-theme="dark"] .divider,
html[data-theme="dark"] .separator,
[data-theme="dark"] .divider-theme {
    background: rgba(96, 165, 250, 0.15) !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

/* ===== FIX #6: CHART CONTAINER BACKGROUNDS ===== */
html[data-theme="dark"] .chart-container[style*="background: linear-gradient(135deg, #fefcfb"],
html[data-theme="dark"] .chart-container[style*="background: linear-gradient(135deg, #fefefe"],
html[data-theme="dark"] .chart-container[style*="background: linear-gradient(135deg, #f8fafc"],
html[data-theme="dark"] div[style*="background: linear-gradient(135deg, #f8fafc"],
[data-theme="dark"] .chart-container-light {
    background: linear-gradient(135deg, #1E293B 0%, #334155 100%) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* ===== FIX: CHART LEGEND TEXT ===== */
html[data-theme="dark"] .chart-legend,
html[data-theme="dark"] .legend-item,
html[data-theme="dark"] .chartjs-legend,
[data-theme="dark"] .chart-legend {
    color: #CBD5E1 !important;
}

html[data-theme="dark"] .chart-legend span,
html[data-theme="dark"] .legend-label,
[data-theme="dark"] .legend-label {
    color: #CBD5E1 !important;
}

/* ===== INLINE STYLE OVERRIDES FOR COMMON PATTERNS ===== */

/* Gray text colors */
html[data-theme="dark"] [style*="color: #6b7280"],
html[data-theme="dark"] [style*="color:#6b7280"],
html[data-theme="dark"] [style*="color: #64748b"],
html[data-theme="dark"] [style*="color:#64748b"] {
    color: #94A3B8 !important;
}

html[data-theme="dark"] [style*="color: #9ca3af"],
html[data-theme="dark"] [style*="color:#9ca3af"] {
    color: #64748B !important;
}

html[data-theme="dark"] [style*="color: #374151"],
html[data-theme="dark"] [style*="color:#374151"] {
    color: #CBD5E1 !important;
}

/* Light border colors */
html[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border:1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border-color: #e5e7eb"] {
    border-color: rgba(96, 165, 250, 0.2) !important;
}

html[data-theme="dark"] [style*="border: 1px solid #e2e8f0"],
html[data-theme="dark"] [style*="border-color: #e2e8f0"] {
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Light background colors */
html[data-theme="dark"] [style*="background: #f8f9fa"],
html[data-theme="dark"] [style*="background:#f8f9fa"],
html[data-theme="dark"] [style*="background: #f8fafc"],
html[data-theme="dark"] [style*="background:#f8fafc"],
html[data-theme="dark"] [style*="background: #f3f4f6"],
html[data-theme="dark"] [style*="background:#f3f4f6"] {
    background: #334155 !important;
}

html[data-theme="dark"] [style*="background: #e5e7eb"],
html[data-theme="dark"] [style*="background:#e5e7eb"],
html[data-theme="dark"] [style*="background: #e2e8f0"] {
    background: #475569 !important;
}

/* Icon background colors with light backgrounds */
html[data-theme="dark"] [style*="background: rgba(16, 185, 129, 0.1)"] {
    background: rgba(94, 234, 212, 0.15) !important;
}

html[data-theme="dark"] [style*="background: rgba(239, 68, 68, 0.1)"] {
    background: rgba(251, 113, 133, 0.15) !important;
}

html[data-theme="dark"] [style*="background: rgba(59, 130, 246, 0.1)"] {
    background: rgba(96, 165, 250, 0.15) !important;
}

html[data-theme="dark"] [style*="background: rgba(139, 92, 246, 0.1)"] {
    background: rgba(167, 139, 250, 0.15) !important;
}

html[data-theme="dark"] [style*="background: rgba(245, 158, 11, 0.1)"] {
    background: rgba(251, 191, 36, 0.15) !important;
}

/* Stat icon colors */
html[data-theme="dark"] .stat-icon[style*="color: #10b981"],
html[data-theme="dark"] [style*="color: #10b981"] {
    color: #5EEAD4 !important;
}

html[data-theme="dark"] .stat-icon[style*="color: #ef4444"],
html[data-theme="dark"] [style*="color: #ef4444"] {
    color: #FB7185 !important;
}

html[data-theme="dark"] .stat-icon[style*="color: #3b82f6"] {
    color: #60A5FA !important;
}

html[data-theme="dark"] .stat-icon[style*="color: #8b5cf6"] {
    color: #A78BFA !important;
}

/* Loan card names and APR text */
html[data-theme="dark"] .loan-card h5,
html[data-theme="dark"] .loan-card .loan-name,
html[data-theme="dark"] .loan-card .apr-text,
[data-theme="dark"] .loan-name {
    color: #F1F5F9 !important;
}

html[data-theme="dark"] .loan-card .apr,
html[data-theme="dark"] .loan-card small,
[data-theme="dark"] .loan-apr {
    color: #94A3B8 !important;
}

/* Repayment progress text */
html[data-theme="dark"] .repayment-progress,
html[data-theme="dark"] .repayment-label {
    color: #94A3B8 !important;
}

/* Goal card text */
html[data-theme="dark"] .goal-name,
html[data-theme="dark"] .goal-card h5,
html[data-theme="dark"] .investment-goal-card h5,
[data-theme="dark"] .goal-name {
    color: #F1F5F9 !important;
}

html[data-theme="dark"] .goal-type,
html[data-theme="dark"] .goal-card small,
[data-theme="dark"] .goal-type {
    color: #94A3B8 !important;
}

/* Credit card text */
html[data-theme="dark"] .credit-card-name,
html[data-theme="dark"] .card-name,
[data-theme="dark"] .credit-card-name {
    color: #F1F5F9 !important;
}

html[data-theme="dark"] .card-type,
html[data-theme="dark"] .credit-card-type,
[data-theme="dark"] .card-type {
    color: #94A3B8 !important;
}

/* Amount displays */
html[data-theme="dark"] .amount-used,
html[data-theme="dark"] .used-amount,
[data-theme="dark"] .amount-used {
    color: #5EEAD4 !important;
}

html[data-theme="dark"] .amount-limit,
html[data-theme="dark"] .limit-amount,
[data-theme="dark"] .amount-limit {
    color: #94A3B8 !important;
}

/* Utilization badges */
html[data-theme="dark"] .utilization-badge,
html[data-theme="dark"] .badge-utilization {
    background: rgba(96, 165, 250, 0.15) !important;
    color: #60A5FA !important;
}

html[data-theme="dark"] .utilization-badge.high,
html[data-theme="dark"] .badge-danger {
    background: rgba(251, 113, 133, 0.15) !important;
    color: #FB7185 !important;
}

html[data-theme="dark"] .utilization-badge.low,
html[data-theme="dark"] .badge-success {
    background: rgba(94, 234, 212, 0.15) !important;
    color: #5EEAD4 !important;
}

/* See All Cards link */
html[data-theme="dark"] a[style*="color: #3b82f6"],
html[data-theme="dark"] .see-all-link,
[data-theme="dark"] .see-all-link {
    color: #60A5FA !important;
}

html[data-theme="dark"] a[style*="color: #3b82f6"]:hover,
html[data-theme="dark"] .see-all-link:hover {
    color: #93C5FD !important;
}

/* ===== SIDE PANEL FILTER SYSTEM - DARK MODE ===== */
html[data-theme="dark"] .filter-side-panel,
[data-theme="dark"] .filter-side-panel {
    background: #1E293B !important;
    border-right: 1px solid rgba(96, 165, 250, 0.1) !important;
}

html[data-theme="dark"] .filter-panel-header,
[data-theme="dark"] .filter-panel-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-bottom: 1px solid rgba(96, 165, 250, 0.15) !important;
}

html[data-theme="dark"] .filter-panel-header h3,
[data-theme="dark"] .filter-panel-header h3 {
    color: #E2E8F0 !important;
}

html[data-theme="dark"] .filter-panel-close,
[data-theme="dark"] .filter-panel-close {
    color: #94A3B8 !important;
}

html[data-theme="dark"] .filter-panel-close:hover,
[data-theme="dark"] .filter-panel-close:hover {
    background: rgba(96, 165, 250, 0.1) !important;
    color: #E2E8F0 !important;
}

html[data-theme="dark"] .filter-section-title,
[data-theme="dark"] .filter-section-title {
    color: #94A3B8 !important;
}

html[data-theme="dark"] .filter-section input[type="date"],
[data-theme="dark"] .filter-section input[type="date"] {
    background: #0F172A !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
    color: #E2E8F0 !important;
}

html[data-theme="dark"] .filter-section input[type="date"]:focus,
[data-theme="dark"] .filter-section input[type="date"]:focus {
    border-color: #60A5FA !important;
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.15) !important;
}

html[data-theme="dark"] .filter-preset-btn,
[data-theme="dark"] .filter-preset-btn {
    background: rgba(96, 165, 250, 0.1) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
    color: #94A3B8 !important;
}

html[data-theme="dark"] .filter-preset-btn:hover,
html[data-theme="dark"] .filter-preset-btn.active,
[data-theme="dark"] .filter-preset-btn:hover,
[data-theme="dark"] .filter-preset-btn.active {
    background: #60A5FA !important;
    color: white !important;
    border-color: #60A5FA !important;
}

html[data-theme="dark"] .filter-panel-footer,
[data-theme="dark"] .filter-panel-footer {
    background: #0F172A !important;
    border-top: 1px solid rgba(96, 165, 250, 0.15) !important;
}

/* Filter Summary Bar - Dark Mode */
html[data-theme="dark"] .filter-summary-bar,
[data-theme="dark"] .filter-summary-bar {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
}

html[data-theme="dark"] .filter-summary-toggle,
[data-theme="dark"] .filter-summary-toggle {
    background: #60A5FA !important;
}

html[data-theme="dark"] .filter-summary-toggle:hover,
[data-theme="dark"] .filter-summary-toggle:hover {
    background: #3B82F6 !important;
}

html[data-theme="dark"] .filter-summary-chip,
[data-theme="dark"] .filter-summary-chip {
    background: rgba(96, 165, 250, 0.1) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
    color: #94A3B8 !important;
}

html[data-theme="dark"] .filter-summary-chip i,
[data-theme="dark"] .filter-summary-chip i {
    color: #60A5FA !important;
}

/* Settings Dropdown - Dark Mode */
html[data-theme="dark"] .settings-dropdown-btn,
[data-theme="dark"] .settings-dropdown-btn {
    background: rgba(96, 165, 250, 0.1) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    color: #60A5FA !important;
}

html[data-theme="dark"] .settings-dropdown-btn:hover,
[data-theme="dark"] .settings-dropdown-btn:hover {
    background: #60A5FA !important;
    color: white !important;
}

html[data-theme="dark"] .settings-dropdown-menu,
[data-theme="dark"] .settings-dropdown-menu {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.15) !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .settings-dropdown-header,
[data-theme="dark"] .settings-dropdown-header {
    color: #94A3B8 !important;
    border-bottom-color: rgba(96, 165, 250, 0.15) !important;
}

html[data-theme="dark"] .settings-dropdown-item,
[data-theme="dark"] .settings-dropdown-item {
    border-bottom-color: rgba(96, 165, 250, 0.1) !important;
}

html[data-theme="dark"] .settings-dropdown-item label,
[data-theme="dark"] .settings-dropdown-item label {
    color: #E2E8F0 !important;
}

/* ===== INVESTMENT GOALS SECTION - DYNAMIC DARK MODE ===== */
.investment-goals-section {
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    background: rgba(240, 249, 255, 0.3);
}

[data-theme="dark"] .investment-goals-section {
    border-color: rgba(96, 165, 250, 0.2) !important;
    background: rgba(30, 41, 59, 0.5) !important;
}

/* Investment Goal Cards - Dynamic Theme Support */
.investment-goal-card {
    border: 1px solid var(--border-primary, #e5e7eb);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.investment-goal-card .card-body {
    background: var(--bg-card, #fafafa);
}

.goal-card-title {
    color: var(--text-primary, #1f2937);
    font-weight: 600;
    font-size: 0.95rem;
}

.goal-progress-bar {
    height: 8px;
    background: var(--bg-tertiary, #e5e7eb);
    border-radius: 4px;
    overflow: hidden;
}

.goal-monthly-rate {
    background: var(--bg-secondary, white);
    border: 1px solid var(--border-primary, #e5e7eb);
}

.goal-projected-section {
    background: var(--bg-tertiary, #f3f4f6);
    border-left: 3px solid #2196f3;
}

.goal-projected-text {
    font-weight: 600;
    color: var(--text-primary, #1f2937);
    font-size: 0.9rem;
}

[data-theme="dark"] .investment-goal-card {
    border-color: rgba(96, 165, 250, 0.2) !important;
}

[data-theme="dark"] .investment-goal-card .card-body {
    background: var(--bg-card) !important;
}

[data-theme="dark"] .goal-card-title {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .goal-progress-bar {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .goal-monthly-rate {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .goal-projected-section {
    background: var(--bg-tertiary) !important;
}

[data-theme="dark"] .goal-projected-text {
    color: var(--text-primary) !important;
}

/* ===== CREDIT UTILIZATION CARDS - DYNAMIC DARK MODE ===== */
.utilization-chart-container {
    background: var(--bg-card, white);
    border: 1px solid var(--border-primary, #e5e7eb);
}

[data-theme="dark"] .utilization-chart-container {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

.credit-card-item {
    background: var(--bg-card, white);
    border: 1px solid var(--border-primary, #e5e7eb);
}

[data-theme="dark"] .credit-card-item {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Crypto Holdings section */
.crypto-holdings-section {
    background: var(--bg-card, white);
    border: 1px solid var(--border-primary, #e5e7eb);
}

[data-theme="dark"] .crypto-holdings-section {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Credit Cards Container */
.credit-cards-container {
    border: 1px solid var(--border-primary, #e5e7eb);
}

[data-theme="dark"] .credit-cards-container {
    border-color: var(--border-primary) !important;
}

/* Credit Card Item - Dynamic Theme */
.credit-card-item {
    background: var(--bg-tertiary, #f8fafc);
    border: 1px solid var(--border-primary, #e2e8f0);
}

html[data-theme="dark"] .credit-card-item,
[data-theme="dark"] .credit-card-item {
    background: #1E293B !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Credit Progress Bar */
.credit-progress-bar {
    background: var(--bg-tertiary, #e5e7eb);
}

html[data-theme="dark"] .credit-progress-bar,
[data-theme="dark"] .credit-progress-bar {
    background: #0F172A !important;
}

/* Credit Card Item Text - Dynamic Theme */
html[data-theme="dark"] .credit-card-item .text-brand,
[data-theme="dark"] .credit-card-item .text-brand {
    color: #60A5FA !important;
}

html[data-theme="dark"] .credit-card-item .text-muted,
[data-theme="dark"] .credit-card-item .text-muted {
    color: #94A3B8 !important;
}

/* Credit Card Icon Container */
.credit-card-icon-container {
    width: 48px;
    height: 48px;
    background: rgba(129, 140, 248, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.credit-card-icon {
    color: #818cf8;
    font-size: 1.3rem;
}

.credit-card-name {
    color: var(--text-primary, #1f2937);
    font-size: 0.95rem;
}

html[data-theme="dark"] .credit-card-icon-container,
[data-theme="dark"] .credit-card-icon-container {
    background: rgba(96, 165, 250, 0.2) !important;
}

html[data-theme="dark"] .credit-card-icon,
[data-theme="dark"] .credit-card-icon {
    color: #60A5FA !important;
}

html[data-theme="dark"] .credit-card-name,
[data-theme="dark"] .credit-card-name {
    color: #F1F5F9 !important;
}

/* All Cards Table Container */
.all-cards-table-container {
    background: var(--bg-card, linear-gradient(135deg, #fefefe 0%, #f9fafb 100%));
}

[data-theme="dark"] .all-cards-table-container {
    background: var(--bg-card) !important;
}

/* Dynamic Text Color Classes */
.text-primary-dynamic {
    color: var(--text-primary, #1f2937);
}

[data-theme="dark"] .text-primary-dynamic {
    color: var(--text-primary) !important;
}

/* ===== DASHBOARD CHARTS CONTAINER - OVERRIDE INLINE STYLES ===== */
html[data-theme="dark"] .dashboard-charts-container .card,
[data-theme="dark"] .dashboard-charts-container .card,
[data-theme="dark"] .dashboard-charts-container .card.h-100,
[data-theme="dark"] .dashboard-charts-container [class*="card"] {
    background: var(--bg-card) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .dashboard-charts-container .card:hover,
[data-theme="dark"] .dashboard-charts-container .card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4) !important;
}

/* Category View Toggle Banner */
html[data-theme="dark"] [style*="background: linear-gradient(135deg, #f8fafc"],
html[data-theme="dark"] [style*="background: linear-gradient(135deg, #e0f2fe"],
[data-theme="dark"] .category-view-banner,
[data-theme="dark"] .category-toggle-banner {
    background: linear-gradient(135deg, #1E293B 0%, rgba(59, 130, 246, 0.15) 100%) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
}

[data-theme="dark"] .category-view-banner .text-brand,
[data-theme="dark"] .category-toggle-banner .text-brand,
[data-theme="dark"] [style*="color: #1e40af"] {
    color: #60A5FA !important;
}

/* Analysis Page Category Toggle */
html[data-theme="dark"] .analysis-category-toggle,
[data-theme="dark"] [style*="background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%)"] {
    background: linear-gradient(135deg, #1E293B 0%, rgba(99, 102, 241, 0.15) 100%) !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
}

/* Universal View Hint */
[data-theme="dark"] #universalViewHint {
    color: var(--text-muted) !important;
}

/* Summary Cards Override */
html[data-theme="dark"] .summary-card,
html[data-theme="dark"] .stat-card,
html[data-theme="dark"] .metric-card,
[data-theme="dark"] .summary-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .metric-card {
    background: var(--bg-card) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

/* Chart Canvas Background */
html[data-theme="dark"] .chart-container,
html[data-theme="dark"] [class*="chart-wrapper"],
[data-theme="dark"] .chart-container,
[data-theme="dark"] [class*="chart-wrapper"] {
    background: transparent !important;
}

/* Borrowings & Loans Dark Mode */
html[data-theme="dark"] .borrowing-card,
html[data-theme="dark"] .loan-card,
html[data-theme="dark"] .lending-card,
[data-theme="dark"] .borrowing-card,
[data-theme="dark"] .loan-card,
[data-theme="dark"] .lending-card {
    background: var(--bg-card) !important;
    border-color: rgba(96, 165, 250, 0.2) !important;
}

html[data-theme="dark"] .borrowing-header,
html[data-theme="dark"] .loan-header,
[data-theme="dark"] .borrowing-header,
[data-theme="dark"] .loan-header {
    background: var(--bg-tertiary) !important;
    border-bottom-color: var(--border-primary) !important;
}

html[data-theme="dark"] .borrowing-title,
html[data-theme="dark"] .loan-title,
[data-theme="dark"] .borrowing-title,
[data-theme="dark"] .loan-title {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .borrowing-amount,
html[data-theme="dark"] .loan-amount,
[data-theme="dark"] .borrowing-amount,
[data-theme="dark"] .loan-amount {
    color: var(--color-primary) !important;
}

/* Payment Cards */
html[data-theme="dark"] .payment-card,
html[data-theme="dark"] .payment-item,
[data-theme="dark"] .payment-card,
[data-theme="dark"] .payment-item {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Timeline */
html[data-theme="dark"] .timeline-item,
[data-theme="dark"] .timeline-item {
    border-left-color: var(--color-primary) !important;
}

html[data-theme="dark"] .timeline-date,
[data-theme="dark"] .timeline-date {
    color: var(--text-muted) !important;
}

/* Person Profile Shared */
html[data-theme="dark"] .person-profile-card,
[data-theme="dark"] .person-profile-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .person-name,
[data-theme="dark"] .person-name {
    color: var(--text-primary) !important;
}

/* Inline Style Overrides */
html[data-theme="dark"] [style*="background: white"],
html[data-theme="dark"] [style*="background:#ffffff"],
html[data-theme="dark"] [style*="background: #ffffff"],
html[data-theme="dark"] [style*="background:#fff"],
html[data-theme="dark"] [style*="background: #fff"] {
    background: var(--bg-card) !important;
}

html[data-theme="dark"] [style*="color: #1f2937"],
html[data-theme="dark"] [style*="color:#1f2937"],
html[data-theme="dark"] [style*="color: #333"],
html[data-theme="dark"] [style*="color:#333"] {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] [style*="color: #6b7280"],
html[data-theme="dark"] [style*="color:#6b7280"],
html[data-theme="dark"] [style*="color: #666"],
html[data-theme="dark"] [style*="color:#666"] {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] [style*="border: 1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border:1px solid #e5e7eb"],
html[data-theme="dark"] [style*="border-color: #e5e7eb"] {
    border-color: var(--border-primary) !important;
}

/* ===== DASHBOARD CHART HEADERS FIX - OVERRIDE INLINE STYLES ===== */
html[data-theme="dark"] .card-header[style*="background: #ffffff"],
html[data-theme="dark"] .card-header[style*="background:#ffffff"],
html[data-theme="dark"] .card-header[style*="background-color: #ffffff"],
html[data-theme="dark"] .card-header[style*="background-color:#ffffff"],
html[data-theme="dark"] .card-header[style*="background: white"],
html[data-theme="dark"] [style*="background: #ffffff"].card-header,
[data-theme="dark"] .card-header[style*="background: #ffffff"],
[data-theme="dark"] .card-header[style*="background:#ffffff"] {
    background: #1E293B !important;
    background-image: none !important;
    border-bottom-color: #334155 !important;
}

html[data-theme="dark"] .card-header.bg-white,
[data-theme="dark"] .card-header.bg-white,
html[data-theme="dark"] .bg-white.card-header {
    background: #1E293B !important;
    background-color: #1E293B !important;
}

html[data-theme="dark"] .insight-card h5,
html[data-theme="dark"] .insight-card h6,
html[data-theme="dark"] .insight-card .card-header,
html[data-theme="dark"] .chart-container h5,
html[data-theme="dark"] .chart-container h6,
html[data-theme="dark"] .analytics-section h5,
html[data-theme="dark"] .analytics-section h6,
[data-theme="dark"] .insight-card,
[data-theme="dark"] .chart-section,
[data-theme="dark"] .analytics-chart-card {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] [class*="chart-card"],
html[data-theme="dark"] [class*="insight-card"],
[data-theme="dark"] .card-chart {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] [class*="chart-card"] h5,
html[data-theme="dark"] [class*="chart-card"] h6,
html[data-theme="dark"] [class*="insight-card"] h5,
html[data-theme="dark"] [class*="insight-card"] h6 {
    color: var(--text-primary) !important;
}

/* Dashboard Top 10 Spending, Budget vs Actual headers */
html[data-theme="dark"] .spending-insights-section,
html[data-theme="dark"] .budget-section,
html[data-theme="dark"] .category-chart-section,
html[data-theme="dark"] .expenses-section {
    background: var(--bg-card) !important;
}

/* ===== FILTER SIDEBAR IMPROVEMENTS ===== */
html[data-theme="dark"] .filter-sidebar,
html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .filters-dropdown,
[data-theme="dark"] .filter-container {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .filter-sidebar label,
html[data-theme="dark"] .filter-panel label,
[data-theme="dark"] .filter-container label {
    color: var(--text-primary) !important;
}

/* ===== GOALS PAGE - FEATURE CARDS HOVER FIX ===== */
html[data-theme="dark"] .feature-card,
[data-theme="dark"] .feature-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .feature-card:hover,
[data-theme="dark"] .feature-card:hover {
    background: var(--bg-hover) !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.2) !important;
}

html[data-theme="dark"] .feature-card h6,
[data-theme="dark"] .feature-card h6 {
    color: #60A5FA !important;
}

html[data-theme="dark"] .feature-card p,
[data-theme="dark"] .feature-card p {
    color: var(--text-secondary) !important;
}

/* ===== GOALS PAGE - BUTTON FONT COLORS FIX ===== */
html[data-theme="dark"] .btn-outline-primary,
[data-theme="dark"] .btn-outline-primary {
    color: #60A5FA !important;
    border-color: #3B82F6 !important;
    background: transparent !important;
}

html[data-theme="dark"] .btn-outline-primary:hover,
[data-theme="dark"] .btn-outline-primary:hover {
    color: #FFFFFF !important;
    background: #3B82F6 !important;
}

html[data-theme="dark"] .btn-outline-success,
[data-theme="dark"] .btn-outline-success {
    color: #34D399 !important;
    border-color: #10B981 !important;
    background: transparent !important;
}

html[data-theme="dark"] .btn-outline-success:hover,
[data-theme="dark"] .btn-outline-success:hover {
    color: #FFFFFF !important;
    background: #10B981 !important;
}

/* Create/Manage button styles for goals */
html[data-theme="dark"] a[href*="goals/create"],
html[data-theme="dark"] a[href*="manage"] .btn,
[data-theme="dark"] .goal-action-btn {
    color: #60A5FA !important;
}

/* ===== GOALS/78 - CHART GRIDLINES FIX ===== */
html[data-theme="dark"] .contribution-chart,
html[data-theme="dark"] .trends-chart,
[data-theme="dark"] canvas {
    filter: brightness(0.9) !important;
}

/* Chart.js gridline override - softer lines */
html[data-theme="dark"] .chartjs-render-monitor {
    opacity: 0.95 !important;
}

/* ===== GOALS FORMS - BANNER & BACK BUTTON FIX ===== */
html[data-theme="dark"] .hero-banner-base,
html[data-theme="dark"] .form-banner,
html[data-theme="dark"] .page-header-banner,
[data-theme="dark"] .hero-banner-base {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

html[data-theme="dark"] .hero-title-base,
html[data-theme="dark"] .hero-banner-base h1,
[data-theme="dark"] .hero-title-base {
    color: #60A5FA !important;
}

html[data-theme="dark"] .hero-subtitle-base,
html[data-theme="dark"] .hero-banner-base p,
[data-theme="dark"] .hero-subtitle-base {
    color: #94A3B8 !important;
}

/* Form back button fix */
html[data-theme="dark"] .form-header-back-btn,
[data-theme="dark"] .form-header-back-btn {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .form-header-back-btn:hover,
[data-theme="dark"] .form-header-back-btn:hover {
    background: var(--bg-hover) !important;
    border-color: #3B82F6 !important;
}

/* ===== UNIFIED FORM CARDS FIX ===== */
html[data-theme="dark"] .unified-form-card,
html[data-theme="dark"] .unified-card-header,
html[data-theme="dark"] .unified-card-body,
[data-theme="dark"] .unified-form-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .unified-card-header h5,
[data-theme="dark"] .unified-card-header h5 {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .unified-card-header small,
[data-theme="dark"] .unified-card-header small {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .form-section-title,
[data-theme="dark"] .form-section-title {
    color: #60A5FA !important;
}

html[data-theme="dark"] .form-label,
[data-theme="dark"] .form-label {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background: var(--bg-input) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background: var(--bg-card) !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

html[data-theme="dark"] .form-control::placeholder,
[data-theme="dark"] .form-control::placeholder {
    color: #64748B !important;
}

/* Header-create gradient fix */
html[data-theme="dark"] .header-create,
[data-theme="dark"] .header-create {
    background: linear-gradient(135deg, #1E3A5F 0%, #1E293B 100%) !important;
}

html[data-theme="dark"] .header-edit,
[data-theme="dark"] .header-edit {
    background: linear-gradient(135deg, #1E3A5F 0%, #1E293B 100%) !important;
}

/* Progress overview cards in add-progress page */
html[data-theme="dark"] .progress-overview-card,
html[data-theme="dark"] .goal-overview-section,
[data-theme="dark"] .progress-overview-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .progress-overview-card h5,
html[data-theme="dark"] .progress-overview-card h6,
[data-theme="dark"] .progress-overview-card h5 {
    color: var(--text-primary) !important;
}

/* ===== OVERVIEW CARD WRAPPER (Goals add-progress pages) ===== */
html[data-theme="dark"] .overview-card-wrapper,
[data-theme="dark"] .overview-card-wrapper {
    background: linear-gradient(135deg, #1E3A5F 0%, #1E293B 100%) !important;
}

html[data-theme="dark"] .overview-card-title,
[data-theme="dark"] .overview-card-title {
    color: #60A5FA !important;
}

html[data-theme="dark"] .overview-card-item,
[data-theme="dark"] .overview-card-item {
    background: var(--bg-card) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .overview-card-item-label,
[data-theme="dark"] .overview-card-item-label {
    color: #94A3B8 !important;
}

html[data-theme="dark"] .overview-card-item-value,
[data-theme="dark"] .overview-card-item-value {
    color: #34D399 !important;
}

/* ===== HERO BANNER PAY/PROGRESS PAGES ===== */
html[data-theme="dark"] .hero-banner-pay,
html[data-theme="dark"] .hero-banner-edit,
html[data-theme="dark"] .hero-banner-add,
[data-theme="dark"] .hero-banner-pay,
[data-theme="dark"] .hero-banner-edit,
[data-theme="dark"] .hero-banner-add {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

html[data-theme="dark"] .hero-title-pay,
html[data-theme="dark"] .hero-title-edit,
html[data-theme="dark"] .hero-title-add,
[data-theme="dark"] .hero-title-pay,
[data-theme="dark"] .hero-title-edit,
[data-theme="dark"] .hero-title-add {
    color: #60A5FA !important;
}

html[data-theme="dark"] .hero-subtitle-pay,
html[data-theme="dark"] .hero-subtitle-edit,
html[data-theme="dark"] .hero-subtitle-add,
[data-theme="dark"] .hero-subtitle-pay,
[data-theme="dark"] .hero-subtitle-edit,
[data-theme="dark"] .hero-subtitle-add {
    color: #94A3B8 !important;
}

/* Header-pay gradient fix */
html[data-theme="dark"] .header-pay,
[data-theme="dark"] .header-pay {
    background: linear-gradient(135deg, #065F46 0%, #1E293B 100%) !important;
}

html[data-theme="dark"] .header-pay h5,
[data-theme="dark"] .header-pay h5 {
    color: #34D399 !important;
}

/* ===== MONTHLY CONTRIBUTION TRENDS CHART FIX ===== */
html[data-theme="dark"] .card-header.bg-white,
[data-theme="dark"] .card-header.bg-white {
    background: #1E293B !important;
    background-color: #1E293B !important;
}

html[data-theme="dark"] .card-header.bg-white h5,
html[data-theme="dark"] .card-header.bg-white h6,
[data-theme="dark"] .card-header.bg-white h5,
[data-theme="dark"] .card-header.bg-white h6 {
    color: #60A5FA !important;
}

html[data-theme="dark"] .card-header.bg-white small,
[data-theme="dark"] .card-header.bg-white small {
    color: #94A3B8 !important;
}

/* ===== MANAGE SAVINGS/INVESTMENTS BUTTONS ===== */
html[data-theme="dark"] .goals-overview-card .btn,
html[data-theme="dark"] .goal-type-card .btn,
[data-theme="dark"] .goals-overview-card .btn {
    color: #60A5FA !important;
}

html[data-theme="dark"] .goals-overview-card .btn:hover,
html[data-theme="dark"] .goal-type-card .btn:hover,
[data-theme="dark"] .goals-overview-card .btn:hover {
    color: #FFFFFF !important;
    background: #3B82F6 !important;
}

/* ===== GOAL NUMBER CARDS STATS FIX ===== */
html[data-theme="dark"] .goal-number-card,
html[data-theme="dark"] .stats-card,
[data-theme="dark"] .goal-number-card {
    background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%) !important;
}

/* ===== ANALYSIS PAGE CHARTS FIX ===== */
html[data-theme="dark"] .analysis-chart-container,
html[data-theme="dark"] .financial-analysis-section,
[data-theme="dark"] .analysis-chart-container {
    background: var(--bg-card) !important;
}

html[data-theme="dark"] .chart-tabs .btn,
html[data-theme="dark"] .chart-filter-btn,
[data-theme="dark"] .chart-tabs .btn {
    color: var(--text-primary) !important;
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .chart-tabs .btn.active,
html[data-theme="dark"] .chart-tabs .btn-primary,
[data-theme="dark"] .chart-tabs .btn.active {
    color: #FFFFFF !important;
    background: #3B82F6 !important;
}

/* =========================================================================
   COMPREHENSIVE DARK MODE AUDIT - JANUARY 2026
   Covers: Budget, Subscriptions, Bills, Loans, Goals, Borrowings,
   Statement Import, Data Entry, Forms, Dropdowns, Search Bars
   ========================================================================= */

/* ===== BUDGET PAGE DARK MODE ===== */
html[data-theme="dark"] .budget-header,
[data-theme="dark"] .budget-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .budget-title,
[data-theme="dark"] .budget-title {
    color: #60A5FA !important;
}

html[data-theme="dark"] .month-nav-btn,
[data-theme="dark"] .month-nav-btn {
    background: rgba(59, 130, 246, 0.2) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
    color: #60A5FA !important;
}

html[data-theme="dark"] .month-nav-btn:hover,
[data-theme="dark"] .month-nav-btn:hover {
    background: rgba(59, 130, 246, 0.35) !important;
}

html[data-theme="dark"] .summary-card,
[data-theme="dark"] .summary-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .summary-card:hover,
[data-theme="dark"] .summary-card:hover {
    background: var(--bg-hover) !important;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.15) !important;
}

html[data-theme="dark"] .summary-value,
[data-theme="dark"] .summary-value {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .summary-label,
[data-theme="dark"] .summary-label {
    color: var(--text-secondary) !important;
}

/* ===== SUBSCRIPTIONS PAGE DARK MODE ===== */
html[data-theme="dark"] .sub-header,
[data-theme="dark"] .sub-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .sub-amount,
[data-theme="dark"] .sub-amount {
    color: #60A5FA !important;
}

html[data-theme="dark"] .sub-period,
[data-theme="dark"] .sub-period {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .summary-row,
[data-theme="dark"] .summary-row {
    border-top-color: var(--border-primary) !important;
}

html[data-theme="dark"] .summary-item-value,
[data-theme="dark"] .summary-item-value {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .summary-item-label,
[data-theme="dark"] .summary-item-label {
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .chart-card,
[data-theme="dark"] .chart-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .sub-card,
[data-theme="dark"] .sub-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .sub-card:hover,
[data-theme="dark"] .sub-card:hover {
    background: var(--bg-hover) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .section-title,
[data-theme="dark"] .section-title {
    color: #60A5FA !important;
}

/* ===== BILL REMINDERS PAGE DARK MODE ===== */
html[data-theme="dark"] .bills-header,
[data-theme="dark"] .bills-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

html[data-theme="dark"] .bills-title,
[data-theme="dark"] .bills-title {
    color: #60A5FA !important;
}

html[data-theme="dark"] .bill-card,
[data-theme="dark"] .bill-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .bill-card:hover,
[data-theme="dark"] .bill-card:hover {
    background: var(--bg-hover) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .bill-name,
[data-theme="dark"] .bill-name {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .bill-details,
[data-theme="dark"] .bill-details {
    color: var(--text-secondary) !important;
}

/* Summary cards with status colors - dark mode */
html[data-theme="dark"] .summary-card.overdue,
[data-theme="dark"] .summary-card.overdue {
    background: linear-gradient(135deg, #450a0a 0%, #7f1d1d 100%) !important;
    border-color: #991b1b !important;
}

html[data-theme="dark"] .summary-card.due-soon,
[data-theme="dark"] .summary-card.due-soon {
    background: linear-gradient(135deg, #451a03 0%, #78350f 100%) !important;
    border-color: #92400e !important;
}

html[data-theme="dark"] .summary-card.paid,
[data-theme="dark"] .summary-card.paid {
    background: linear-gradient(135deg, #052e16 0%, #14532d 100%) !important;
    border-color: #166534 !important;
}

/* ===== LOANS DASHBOARD DARK MODE ===== */
html[data-theme="dark"] .loan-type-card,
[data-theme="dark"] .loan-type-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .loan-type-card:hover,
[data-theme="dark"] .loan-type-card:hover {
    background: var(--bg-hover) !important;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.2) !important;
}

html[data-theme="dark"] .loan-number-card,
[data-theme="dark"] .loan-number-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Feature items clean - loans/goals pages */
html[data-theme="dark"] .feature-item-clean,
[data-theme="dark"] .feature-item-clean {
    background: var(--bg-card) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

html[data-theme="dark"] .feature-item-clean:hover,
[data-theme="dark"] .feature-item-clean:hover {
    background: linear-gradient(135deg, #1E293B 0%, #1E3A5F 100%) !important;
    border-color: rgba(59, 130, 246, 0.5) !important;
    box-shadow: 0 12px 25px rgba(59, 130, 246, 0.2) !important;
}

html[data-theme="dark"] .feature-icon-clean,
[data-theme="dark"] .feature-icon-clean {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0.35) 100%) !important;
    border-color: rgba(59, 130, 246, 0.3) !important;
}

html[data-theme="dark"] .feature-content-clean h6,
[data-theme="dark"] .feature-content-clean h6 {
    color: #60A5FA !important;
}

html[data-theme="dark"] .feature-content-clean p,
[data-theme="dark"] .feature-content-clean p {
    color: var(--text-secondary) !important;
}

/* Loan Management / Credit Card Management cards */
html[data-theme="dark"] .management-card,
html[data-theme="dark"] [class*="management-card"],
[data-theme="dark"] .management-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .management-card:hover,
[data-theme="dark"] .management-card:hover {
    background: var(--bg-hover) !important;
}

/* Ready to start section buttons */
html[data-theme="dark"] .cta-section,
html[data-theme="dark"] .start-journey-section,
[data-theme="dark"] .cta-section {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

html[data-theme="dark"] .cta-section .btn-outline-primary,
html[data-theme="dark"] .cta-section .btn-outline-success,
[data-theme="dark"] .cta-section .btn-outline-primary {
    color: #60A5FA !important;
    border-color: #3B82F6 !important;
    background: transparent !important;
}

html[data-theme="dark"] .cta-section .btn-outline-primary:hover,
html[data-theme="dark"] .cta-section .btn-outline-success:hover,
[data-theme="dark"] .cta-section .btn-outline-primary:hover {
    color: #FFFFFF !important;
    background: #3B82F6 !important;
}

/* ===== PAYMENT SIMULATOR DARK MODE ===== */
html[data-theme="dark"] .simulator-card,
html[data-theme="dark"] .payment-simulator,
html[data-theme="dark"] [class*="simulator"],
[data-theme="dark"] .simulator-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .simulator-section,
[data-theme="dark"] .simulator-section {
    background: var(--bg-card) !important;
}

html[data-theme="dark"] .simulator-input,
html[data-theme="dark"] .simulator-select,
[data-theme="dark"] .simulator-input {
    background: var(--bg-input) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

/* Current Status / Simulation Results cards */
html[data-theme="dark"] .status-card,
html[data-theme="dark"] .result-card,
html[data-theme="dark"] .simulation-results,
[data-theme="dark"] .status-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* ===== INVESTMENT STREAKS & ACHIEVEMENTS FIX ===== */
html[data-theme="dark"] .streak-card,
html[data-theme="dark"] .achievement-card,
html[data-theme="dark"] [class*="streak"],
html[data-theme="dark"] [class*="achievement"],
[data-theme="dark"] .streak-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .streak-card.active,
html[data-theme="dark"] .achievement-card.achieved,
[data-theme="dark"] .streak-card.active {
    background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%) !important;
}

/* Recent Investment History */
html[data-theme="dark"] .history-item,
html[data-theme="dark"] .investment-history-item,
html[data-theme="dark"] [class*="history-item"],
[data-theme="dark"] .history-item {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* ===== SEARCH BARS DARK MODE ===== */
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] input[type="text"][placeholder*="search" i],
html[data-theme="dark"] input[placeholder*="Search" i],
html[data-theme="dark"] .search-input,
html[data-theme="dark"] .search-box,
[data-theme="dark"] input[type="search"] {
    background: var(--bg-input) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] input[type="search"]::placeholder,
html[data-theme="dark"] .search-input::placeholder,
[data-theme="dark"] input[type="search"]::placeholder {
    color: #64748B !important;
}

html[data-theme="dark"] input[type="search"]:focus,
html[data-theme="dark"] .search-input:focus,
[data-theme="dark"] input[type="search"]:focus {
    background: var(--bg-card) !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* No results found empty state */
html[data-theme="dark"] .no-results,
html[data-theme="dark"] .empty-state,
html[data-theme="dark"] [class*="no-results"],
html[data-theme="dark"] [class*="empty-state"],
[data-theme="dark"] .no-results {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

html[data-theme="dark"] .no-results h5,
html[data-theme="dark"] .empty-state h5,
html[data-theme="dark"] .no-results h6,
[data-theme="dark"] .no-results h5 {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .no-results p,
html[data-theme="dark"] .empty-state p,
[data-theme="dark"] .no-results p {
    color: var(--text-secondary) !important;
}

/* ===== DROPDOWN AND SELECT DARK MODE ===== */
html[data-theme="dark"] select,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .dropdown-menu,
html[data-theme="dark"] .dropdown-item,
[data-theme="dark"] select,
[data-theme="dark"] .form-select {
    background: var(--bg-input) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] select option,
html[data-theme="dark"] .form-select option,
[data-theme="dark"] select option {
    background: #1E293B !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .dropdown-menu,
[data-theme="dark"] .dropdown-menu {
    background: #1E293B !important;
    border-color: var(--border-primary) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4) !important;
}

html[data-theme="dark"] .dropdown-item,
[data-theme="dark"] .dropdown-item {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus,
[data-theme="dark"] .dropdown-item:hover {
    background: #334155 !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .dropdown-divider,
[data-theme="dark"] .dropdown-divider {
    border-color: var(--border-primary) !important;
}

/* ===== STATEMENT IMPORT PAGES DARK MODE ===== */
html[data-theme="dark"] .import-card,
html[data-theme="dark"] .mapping-card,
html[data-theme="dark"] .upload-card,
html[data-theme="dark"] [class*="import-"],
html[data-theme="dark"] [class*="mapping-"],
[data-theme="dark"] .import-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .import-header,
html[data-theme="dark"] .mapping-header,
[data-theme="dark"] .import-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

html[data-theme="dark"] .preview-table,
html[data-theme="dark"] .mapping-table,
[data-theme="dark"] .preview-table {
    background: var(--bg-card) !important;
}

html[data-theme="dark"] .preview-table th,
html[data-theme="dark"] .mapping-table th,
[data-theme="dark"] .preview-table th {
    background: #1E3A5F !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .preview-table td,
html[data-theme="dark"] .mapping-table td,
[data-theme="dark"] .preview-table td {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .preview-table tr:hover,
html[data-theme="dark"] .mapping-table tr:hover,
[data-theme="dark"] .preview-table tr:hover {
    background: var(--bg-hover) !important;
}

/* ===== DATA ENTRY PAGES DARK MODE ===== */
html[data-theme="dark"] .data-entry-card,
html[data-theme="dark"] .csv-import-card,
html[data-theme="dark"] .bulk-add-card,
[data-theme="dark"] .data-entry-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .data-entry-header,
html[data-theme="dark"] .csv-import-header,
[data-theme="dark"] .data-entry-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

/* File upload areas */
html[data-theme="dark"] .upload-zone,
html[data-theme="dark"] .file-drop-zone,
html[data-theme="dark"] [class*="upload-"],
html[data-theme="dark"] [class*="drop-zone"],
[data-theme="dark"] .upload-zone {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
    border-style: dashed !important;
}

html[data-theme="dark"] .upload-zone:hover,
html[data-theme="dark"] .file-drop-zone:hover,
[data-theme="dark"] .upload-zone:hover {
    background: var(--bg-hover) !important;
    border-color: #3B82F6 !important;
}

/* ===== HORIZONTAL SEPARATION LINES - SIMPLE DIM ===== */
html[data-theme="dark"] hr,
html[data-theme="dark"] .divider,
html[data-theme="dark"] .separator,
[data-theme="dark"] hr {
    border-color: rgba(100, 116, 139, 0.3) !important;
    border-width: 1px !important;
    opacity: 0.5 !important;
}

html[data-theme="dark"] .border-bottom,
html[data-theme="dark"] .border-top,
[data-theme="dark"] .border-bottom {
    border-color: rgba(100, 116, 139, 0.3) !important;
}

/* Section headers with lines */
html[data-theme="dark"] .section-divider,
html[data-theme="dark"] .section-separator,
[data-theme="dark"] .section-divider {
    border-color: rgba(100, 116, 139, 0.25) !important;
    border-width: 1px !important;
}

/* ===== STANDARDIZED BUTTON UI ===== */
/* Create/Add buttons */
html[data-theme="dark"] .btn-create,
html[data-theme="dark"] [class*="btn-create"],
html[data-theme="dark"] a[href*="create"],
html[data-theme="dark"] a[href*="add"],
[data-theme="dark"] .btn-create {
    color: #60A5FA !important;
}

html[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-primary {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%) !important;
    border-color: #3B82F6 !important;
    color: #FFFFFF !important;
}

html[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-primary:hover {
    background: linear-gradient(135deg, #2563EB 0%, #1D4ED8 100%) !important;
    border-color: #2563EB !important;
}

html[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-secondary {
    background: #334155 !important;
    border-color: #475569 !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .btn-secondary:hover,
[data-theme="dark"] .btn-secondary:hover {
    background: #475569 !important;
    border-color: #64748B !important;
}

/* Back buttons */
html[data-theme="dark"] .btn-back,
html[data-theme="dark"] a[href*="back"],
[data-theme="dark"] .btn-back {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .btn-back:hover,
[data-theme="dark"] .btn-back:hover {
    background: var(--bg-hover) !important;
    border-color: #3B82F6 !important;
}

/* ===== ALL FORMS COMPREHENSIVE FIX ===== */
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .form-container,
html[data-theme="dark"] .form-wrapper,
[data-theme="dark"] .form-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .form-header,
html[data-theme="dark"] .form-title,
[data-theme="dark"] .form-header {
    color: #60A5FA !important;
}

html[data-theme="dark"] .form-group,
[data-theme="dark"] .form-group {
    background: transparent !important;
}

html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="date"],
html[data-theme="dark"] input[type="datetime-local"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="url"],
[data-theme="dark"] textarea,
[data-theme="dark"] input[type="text"] {
    background: var(--bg-input) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] input[type="text"]:focus,
html[data-theme="dark"] input[type="number"]:focus,
html[data-theme="dark"] input[type="email"]:focus,
html[data-theme="dark"] input[type="password"]:focus,
html[data-theme="dark"] input[type="date"]:focus,
[data-theme="dark"] textarea:focus,
[data-theme="dark"] input[type="text"]:focus {
    background: var(--bg-card) !important;
    border-color: #3B82F6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

html[data-theme="dark"] textarea::placeholder,
html[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: #64748B !important;
}

/* Disabled inputs */
html[data-theme="dark"] input:disabled,
html[data-theme="dark"] textarea:disabled,
html[data-theme="dark"] select:disabled,
[data-theme="dark"] input:disabled {
    background: #1E293B !important;
    color: #64748B !important;
    border-color: #334155 !important;
}

/* Radio and checkbox */
html[data-theme="dark"] input[type="radio"],
html[data-theme="dark"] input[type="checkbox"],
[data-theme="dark"] input[type="radio"] {
    accent-color: #3B82F6 !important;
}

html[data-theme="dark"] .form-check-label,
[data-theme="dark"] .form-check-label {
    color: var(--text-primary) !important;
}

/* ===== BORROWINGS FORMS & PROFILES ===== */
html[data-theme="dark"] .borrowing-card,
html[data-theme="dark"] .lending-card,
html[data-theme="dark"] .person-card,
[data-theme="dark"] .borrowing-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .borrowing-card:hover,
html[data-theme="dark"] .lending-card:hover,
html[data-theme="dark"] .person-card:hover,
[data-theme="dark"] .borrowing-card:hover {
    background: var(--bg-hover) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

html[data-theme="dark"] .person-profile-header,
html[data-theme="dark"] .profile-header,
[data-theme="dark"] .person-profile-header {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
}

/* Payment stats cards in borrowings */
html[data-theme="dark"] .payment-stats-card,
html[data-theme="dark"] [class*="payment-stats"],
[data-theme="dark"] .payment-stats-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Transaction records table */
html[data-theme="dark"] .records-table,
html[data-theme="dark"] .transaction-table,
[data-theme="dark"] .records-table {
    background: var(--bg-card) !important;
}

html[data-theme="dark"] .records-table th,
html[data-theme="dark"] .transaction-table th,
[data-theme="dark"] .records-table th {
    background: #1E3A5F !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .records-table td,
html[data-theme="dark"] .transaction-table td,
[data-theme="dark"] .records-table td {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* ===== TABLE IMPROVEMENTS ===== */
html[data-theme="dark"] table,
html[data-theme="dark"] .table,
[data-theme="dark"] table {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] thead,
html[data-theme="dark"] .table thead,
[data-theme="dark"] thead {
    background: #1E3A5F !important;
}

html[data-theme="dark"] th,
html[data-theme="dark"] .table th,
[data-theme="dark"] th {
    background: #1E3A5F !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] td,
html[data-theme="dark"] .table td,
[data-theme="dark"] td {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] tbody tr:hover,
html[data-theme="dark"] .table-hover tbody tr:hover,
[data-theme="dark"] tbody tr:hover {
    background: var(--bg-hover) !important;
}

html[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd),
[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(30, 41, 59, 0.5) !important;
}

/* ===== MODAL DARK MODE ===== */
html[data-theme="dark"] .modal-content,
[data-theme="dark"] .modal-content {
    background: #1E293B !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .modal-header,
[data-theme="dark"] .modal-header {
    background: #0F172A !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .modal-title,
[data-theme="dark"] .modal-title {
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .modal-body,
[data-theme="dark"] .modal-body {
    background: #1E293B !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .modal-footer,
[data-theme="dark"] .modal-footer {
    background: #0F172A !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .btn-close,
[data-theme="dark"] .btn-close {
    filter: invert(1) !important;
}

/* ===== TOAST/ALERT DARK MODE ===== */
html[data-theme="dark"] .toast,
html[data-theme="dark"] .alert,
[data-theme="dark"] .toast {
    background: #1E293B !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

html[data-theme="dark"] .toast-header,
[data-theme="dark"] .toast-header {
    background: #0F172A !important;
    color: var(--text-primary) !important;
    border-color: var(--border-primary) !important;
}

/* ===== CATEGORY VIEW/MANAGE PAGES ===== */
html[data-theme="dark"] .category-card,
html[data-theme="dark"] .category-item,
[data-theme="dark"] .category-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .category-card:hover,
html[data-theme="dark"] .category-item:hover,
[data-theme="dark"] .category-card:hover {
    background: var(--bg-hover) !important;
}

/* ===== WELLNESS/SMART INSIGHTS PAGES ===== */
html[data-theme="dark"] .wellness-card,
html[data-theme="dark"] .insight-panel,
html[data-theme="dark"] .life-event-card,
[data-theme="dark"] .wellness-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .wellness-score,
html[data-theme="dark"] .score-card,
[data-theme="dark"] .wellness-score {
    background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%) !important;
}

/* ===== INVESTMENTS PAGE ===== */
html[data-theme="dark"] .investment-card,
html[data-theme="dark"] .portfolio-card,
[data-theme="dark"] .investment-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

html[data-theme="dark"] .investment-card:hover,
html[data-theme="dark"] .portfolio-card:hover,
[data-theme="dark"] .investment-card:hover {
    background: var(--bg-hover) !important;
}

/* ===== NET WORTH PAGE ===== */
html[data-theme="dark"] .networth-card,
html[data-theme="dark"] .asset-card,
html[data-theme="dark"] .liability-card,
[data-theme="dark"] .networth-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* ===== PERFORMANCE SUMMARY CARDS (Goals) ===== */
html[data-theme="dark"] .performance-card,
html[data-theme="dark"] [class*="performance-"],
[data-theme="dark"] .performance-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Risk Assessment cards */
html[data-theme="dark"] .risk-card,
html[data-theme="dark"] [class*="risk-"],
[data-theme="dark"] .risk-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Portfolio Health Check */
html[data-theme="dark"] .health-check-card,
html[data-theme="dark"] [class*="health-check"],
[data-theme="dark"] .health-check-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* =========================================================================
   ANALYSIS PAGE - SUMMARY CARDS AND WRAPPERS
   ========================================================================= */

/* Summary cards wrapper */
[data-theme="dark"] #summary-cards-wrapper {
    background: var(--bg-secondary) !important;
    border-color: var(--border-primary) !important;
}

/* Dynamic summary cards container */
[data-theme="dark"] #dynamic-summary-cards-container {
    background: transparent !important;
}

/* All summary card variations on analysis page */
[data-theme="dark"] #dynamic-summary-cards-container > div,
[data-theme="dark"] .summary-card-responsive,
[data-theme="dark"] .summary-card-inner,
[data-theme="dark"] [data-summary-card] > div,
[data-theme="dark"] .modern-summary-card {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Fix the inline style background colors on analysis cards */
[data-theme="dark"] [style*="background: #374151"],
[data-theme="dark"] [style*="background:#374151"],
[data-theme="dark"] [style*="background-color: #374151"],
[data-theme="dark"] div[style*="background: linear-gradient"][style*="#374151"] {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
}

/* Analysis summary card headers and titles */
[data-theme="dark"] #dynamic-summary-cards-container h5,
[data-theme="dark"] #dynamic-summary-cards-container h6,
[data-theme="dark"] .summary-card-inner h5,
[data-theme="dark"] .modern-summary-card h5 {
    color: var(--text-primary) !important;
}

/* Analysis summary card values */
[data-theme="dark"] #dynamic-summary-cards-container .summary-value,
[data-theme="dark"] .summary-card-inner .summary-value,
[data-theme="dark"] .modern-summary-card .summary-value {
    color: var(--text-primary) !important;
}

/* Analysis summary card labels */
[data-theme="dark"] #dynamic-summary-cards-container .summary-label,
[data-theme="dark"] #dynamic-summary-cards-container small,
[data-theme="dark"] .summary-card-inner .summary-label,
[data-theme="dark"] .modern-summary-card .summary-label {
    color: var(--text-muted) !important;
}

/* Category View Toggle Banner */
[data-theme="dark"] [style*="background: linear-gradient(135deg, #f8fafc"] {
    background: linear-gradient(135deg, #1E293B 0%, #0F172A 100%) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] [style*="color: #1e40af"] {
    color: #60A5FA !important;
}

/* Chart containers on analysis page */
[data-theme="dark"] .bg-white.rounded-3.shadow-sm,
[data-theme="dark"] [data-chart-id] {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

/* Divider lines */
[data-theme="dark"] [style*="background: rgba(0, 0, 0, 0.1)"] {
    background: var(--border-primary) !important;
}

/* Dashboard page fixes */
[data-theme="dark"] .dashboard-page,
[data-theme="dark"] #dashboard-container {
    background: var(--bg-primary) !important;
}

/* Filter bar styling */
[data-theme="dark"] .filter-bar,
[data-theme="dark"] .filters-section,
[data-theme="dark"] [class*="filter-"] {
    background: var(--bg-card) !important;
    border-color: var(--border-primary) !important;
}

[data-theme="dark"] .filter-bar select,
[data-theme="dark"] .filter-bar input,
[data-theme="dark"] .filters-section select,
[data-theme="dark"] .filters-section input {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-primary) !important;
}

/* Quick date filter buttons */
[data-theme="dark"] .date-filter-btn,
[data-theme="dark"] .quick-filter-btn {
    background: var(--bg-tertiary) !important;
    border-color: var(--border-primary) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .date-filter-btn.active,
[data-theme="dark"] .quick-filter-btn.active {
    background: #3B82F6 !important;
    border-color: #3B82F6 !important;
    color: white !important;
}

/* =========================================================================
   BROWSER AUTOFILL OVERRIDE - Fix light background on autofilled inputs
   ========================================================================= */

/* Chrome, Safari, Edge autofill */
[data-theme="dark"] input:-webkit-autofill,
[data-theme="dark"] input:-webkit-autofill:hover,
[data-theme="dark"] input:-webkit-autofill:focus,
[data-theme="dark"] input:-webkit-autofill:active,
html[data-theme="dark"] input:-webkit-autofill,
.theme-dark input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #1E293B inset !important;
    -webkit-text-fill-color: #F1F5F9 !important;
    box-shadow: 0 0 0 1000px #1E293B inset !important;
    background-color: #1E293B !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    caret-color: #F1F5F9 !important;
    transition: background-color 5000s ease-in-out 0s !important;
}

/* Firefox autofill */
[data-theme="dark"] input:autofill,
html[data-theme="dark"] input:autofill,
.theme-dark input:autofill {
    background: #1E293B !important;
    background-color: #1E293B !important;
    color: #F1F5F9 !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Select and Textarea autofill */
[data-theme="dark"] select:-webkit-autofill,
[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill,
html[data-theme="dark"] textarea:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 1000px #1E293B inset !important;
    -webkit-text-fill-color: #F1F5F9 !important;
    box-shadow: 0 0 0 1000px #1E293B inset !important;
}
