/* ==========================================================================
   AssistCare - Shared Dark Theme Overrides
   Applied globally in dark mode. Modals intentionally stay light (see
   _HeadCSS.cshtml modal-content rule) so do not target .modal-content here.
   ========================================================================== */

/* ---- Card surfaces ---- */
[data-bs-theme=dark] .card,
[data-bs-theme=dark] .metric-card {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border-color: rgba(255,255,255,0.06) !important;
}
[data-bs-theme=dark] .card .card {
    background-color: #243142 !important;
}
[data-bs-theme=dark] .card .card-title,
[data-bs-theme=dark] .card .fw-bold,
[data-bs-theme=dark] .card .fw-semibold,
[data-bs-theme=dark] .card .fw-medium,
[data-bs-theme=dark] .card strong,
[data-bs-theme=dark] .card h3,
[data-bs-theme=dark] .card h5,
[data-bs-theme=dark] .card h6 {
    color: #f1f5f9 !important;
}
[data-bs-theme=dark] .card .text-muted,
[data-bs-theme=dark] .card-body .text-muted {
    color: #94a3b8 !important;
}

/* ---- Section Headers (dark tints) ---- */
[data-bs-theme=dark] .section-header-green {
    background: rgba(5, 150, 105, 0.18) !important;
    border-bottom-color: rgba(5, 150, 105, 0.35) !important;
}
[data-bs-theme=dark] .section-header-green .header-icon { background: rgba(5, 150, 105, 0.28); color: #6ee7b7; }
[data-bs-theme=dark] .section-header-green .section-header-sub { color: #6ee7b7; }

[data-bs-theme=dark] .section-header-blue {
    background: rgba(78, 115, 223, 0.2) !important;
    border-bottom-color: rgba(78, 115, 223, 0.4) !important;
}
[data-bs-theme=dark] .section-header-blue .header-icon { background: rgba(78, 115, 223, 0.3); color: #93c5fd; }
[data-bs-theme=dark] .section-header-blue .section-header-sub { color: #93c5fd; }

[data-bs-theme=dark] .section-header-cyan {
    background: rgba(8, 145, 178, 0.18) !important;
    border-bottom-color: rgba(8, 145, 178, 0.35) !important;
}
[data-bs-theme=dark] .section-header-cyan .header-icon { background: rgba(8, 145, 178, 0.28); color: #67e8f9; }
[data-bs-theme=dark] .section-header-cyan .section-header-sub { color: #67e8f9; }

[data-bs-theme=dark] .section-header-rose {
    background: rgba(225, 29, 72, 0.18) !important;
    border-bottom-color: rgba(225, 29, 72, 0.35) !important;
}
[data-bs-theme=dark] .section-header-rose .header-icon { background: rgba(225, 29, 72, 0.28); color: #fda4af; }
[data-bs-theme=dark] .section-header-rose .section-header-sub { color: #fda4af; }

[data-bs-theme=dark] .section-header-teal {
    background: rgba(13, 158, 126, 0.2) !important;
    border-bottom-color: rgba(13, 158, 126, 0.4) !important;
}
[data-bs-theme=dark] .section-header-teal .header-icon { background: rgba(13, 158, 126, 0.3); color: #5eead4; }
[data-bs-theme=dark] .section-header-teal .section-header-sub { color: #5eead4; }

[data-bs-theme=dark] .section-header-amber {
    background: rgba(217, 119, 6, 0.2) !important;
    border-bottom-color: rgba(217, 119, 6, 0.4) !important;
}
[data-bs-theme=dark] .section-header-amber .header-icon { background: rgba(217, 119, 6, 0.3); color: #fbbf24; }
[data-bs-theme=dark] .section-header-amber .section-header-sub { color: #fbbf24; }

[data-bs-theme=dark] .section-header-violet,
[data-bs-theme=dark] .section-header-purple {
    background: rgba(124, 58, 237, 0.18) !important;
    border-bottom-color: rgba(124, 58, 237, 0.35) !important;
}
[data-bs-theme=dark] .section-header-violet .header-icon,
[data-bs-theme=dark] .section-header-purple .header-icon { background: rgba(124, 58, 237, 0.28); color: #c4b5fd; }
[data-bs-theme=dark] .section-header-violet .section-header-sub,
[data-bs-theme=dark] .section-header-purple .section-header-sub { color: #c4b5fd; }

/* ---- Metric cards ---- */
[data-bs-theme=dark] .metric-card-green { background: rgba(5, 150, 105, 0.15) !important; border-left-color: #10b981 !important; }
[data-bs-theme=dark] .metric-card-green h3 { color: #bbf7d0 !important; }
[data-bs-theme=dark] .metric-card-green .metric-label { color: #86efac !important; }
[data-bs-theme=dark] .metric-icon-green { background: rgba(5, 150, 105, 0.3); color: #86efac; }

[data-bs-theme=dark] .metric-card-blue { background: rgba(78, 115, 223, 0.15) !important; border-left-color: #60a5fa !important; }
[data-bs-theme=dark] .metric-card-blue h3 { color: #dbeafe !important; }
[data-bs-theme=dark] .metric-card-blue .metric-label { color: #93c5fd !important; }
[data-bs-theme=dark] .metric-icon-blue { background: rgba(78, 115, 223, 0.3); color: #93c5fd; }

[data-bs-theme=dark] .metric-card-violet { background: rgba(124, 58, 237, 0.15) !important; border-left-color: #a78bfa !important; }
[data-bs-theme=dark] .metric-card-violet h3 { color: #e9d5ff !important; }
[data-bs-theme=dark] .metric-card-violet .metric-label { color: #c4b5fd !important; }
[data-bs-theme=dark] .metric-icon-violet { background: rgba(124, 58, 237, 0.3); color: #c4b5fd; }

[data-bs-theme=dark] .metric-card-amber { background: rgba(217, 119, 6, 0.15) !important; border-left-color: #f59e0b !important; }
[data-bs-theme=dark] .metric-card-amber h3 { color: #fde68a !important; }
[data-bs-theme=dark] .metric-card-amber .metric-label { color: #fbbf24 !important; }
[data-bs-theme=dark] .metric-icon-amber { background: rgba(217, 119, 6, 0.3); color: #fbbf24; }

[data-bs-theme=dark] .metric-card-cyan { background: rgba(8, 145, 178, 0.15) !important; border-left-color: #22d3ee !important; }
[data-bs-theme=dark] .metric-card-cyan h3 { color: #cffafe !important; }
[data-bs-theme=dark] .metric-card-cyan .metric-label { color: #67e8f9 !important; }
[data-bs-theme=dark] .metric-icon-cyan { background: rgba(8, 145, 178, 0.3); color: #67e8f9; }

[data-bs-theme=dark] .metric-card-rose { background: rgba(225, 29, 72, 0.15) !important; border-left-color: #fb7185 !important; }
[data-bs-theme=dark] .metric-card-rose h3 { color: #fecdd3 !important; }
[data-bs-theme=dark] .metric-card-rose .metric-label { color: #fda4af !important; }
[data-bs-theme=dark] .metric-icon-rose { background: rgba(225, 29, 72, 0.3); color: #fda4af; }

[data-bs-theme=dark] .metric-card-teal { background: rgba(13, 158, 126, 0.15) !important; border-left-color: #2dd4bf !important; }
[data-bs-theme=dark] .metric-card-teal h3 { color: #ccfbf1 !important; }
[data-bs-theme=dark] .metric-card-teal .metric-label { color: #5eead4 !important; }
[data-bs-theme=dark] .metric-icon-teal { background: rgba(13, 158, 126, 0.3); color: #5eead4; }

[data-bs-theme=dark] .metric-card:hover { box-shadow: 0 8px 22px rgba(0,0,0,0.45) !important; }

/* ---- Borders & dividers ---- */
[data-bs-theme=dark] .card .border-bottom,
[data-bs-theme=dark] .card .border-top,
[data-bs-theme=dark] .card .border,
[data-bs-theme=dark] .card .divide-y > * {
    border-color: rgba(255,255,255,0.08) !important;
}
[data-bs-theme=dark] .activity-item { border-bottom-color: rgba(255,255,255,0.08); }

/* Inline light hex borders used in several dashboards */
[data-bs-theme=dark] .card [style*="#f1f5f9"],
[data-bs-theme=dark] .card [style*="#eef0f5"],
[data-bs-theme=dark] .card [style*="#eaecf4"] {
    border-color: rgba(255,255,255,0.1) !important;
    border-top-color: rgba(255,255,255,0.1) !important;
    border-bottom-color: rgba(255,255,255,0.1) !important;
}

/* Dark-green (#166534) inline "Clocked In" label is unreadable on dark */
[data-bs-theme=dark] .card [style*="#166534"] { color: #34d399 !important; }

/* ---- Subtle badge tints - keep hue, lighten text ---- */
[data-bs-theme=dark] .bg-success-subtle { background-color: rgba(16, 185, 129, 0.2) !important; }
[data-bs-theme=dark] .bg-success-subtle.text-success,
[data-bs-theme=dark] .card .text-success { color: #6ee7b7 !important; }
[data-bs-theme=dark] .bg-info-subtle { background-color: rgba(8, 145, 178, 0.22) !important; }
[data-bs-theme=dark] .bg-info-subtle.text-info,
[data-bs-theme=dark] .card .text-info { color: #67e8f9 !important; }
[data-bs-theme=dark] .bg-secondary-subtle { background-color: rgba(148, 163, 184, 0.2) !important; }
[data-bs-theme=dark] .bg-secondary-subtle.text-secondary { color: #cbd5e1 !important; }
[data-bs-theme=dark] .bg-warning-subtle { background-color: rgba(217, 119, 6, 0.22) !important; }
[data-bs-theme=dark] .bg-warning-subtle.text-warning,
[data-bs-theme=dark] .card .text-warning { color: #fbbf24 !important; }
[data-bs-theme=dark] .bg-purple-subtle { background-color: rgba(124, 58, 237, 0.22) !important; }
[data-bs-theme=dark] .card .text-purple { color: #c4b5fd !important; }
[data-bs-theme=dark] .bg-danger-subtle { background-color: rgba(225, 29, 72, 0.22) !important; }
[data-bs-theme=dark] .bg-danger-subtle.text-danger,
[data-bs-theme=dark] .card .text-danger { color: #fda4af !important; }

/* ---- Progress bars ---- */
[data-bs-theme=dark] .progress-thin,
[data-bs-theme=dark] .progress { background-color: rgba(255,255,255,0.08); }

/* ---- Empty state ---- */
[data-bs-theme=dark] .empty-state-icon {
    background: rgba(255,255,255,0.05);
    color: #64748b;
}

/* ---- Scrollbars (cards) ---- */
[data-bs-theme=dark] .card-body::-webkit-scrollbar-thumb { background: #475569; }
[data-bs-theme=dark] .card-body::-webkit-scrollbar-thumb:hover { background: #64748b; }
[data-bs-theme=dark] .card-body { scrollbar-color: #475569 transparent; }

/* ---- Alerts ---- */
[data-bs-theme=dark] .alert-warning {
    background-color: rgba(217, 119, 6, 0.18) !important;
    color: #fde68a !important;
    border-color: rgba(217, 119, 6, 0.35) !important;
}
[data-bs-theme=dark] .alert-warning .alert-icon,
[data-bs-theme=dark] .alert-warning strong { color: #fbbf24 !important; }

[data-bs-theme=dark] .alert-info {
    background-color: rgba(8, 145, 178, 0.18) !important;
    color: #cffafe !important;
    border-color: rgba(8, 145, 178, 0.35) !important;
}
[data-bs-theme=dark] .alert-success {
    background-color: rgba(16, 185, 129, 0.18) !important;
    color: #d1fae5 !important;
    border-color: rgba(16, 185, 129, 0.35) !important;
}
[data-bs-theme=dark] .alert-danger {
    background-color: rgba(225, 29, 72, 0.18) !important;
    color: #fecdd3 !important;
    border-color: rgba(225, 29, 72, 0.35) !important;
}

/* ---- Buttons (soft / outline variants) ---- */
[data-bs-theme=dark] .btn-soft-secondary {
    background-color: rgba(255,255,255,0.08);
    color: #e2e8f0;
    border-color: transparent;
}
[data-bs-theme=dark] .btn-soft-secondary:hover {
    background-color: rgba(255,255,255,0.15);
    color: #f1f5f9;
}
[data-bs-theme=dark] .btn-outline-secondary {
    color: #cbd5e1;
    border-color: rgba(255,255,255,0.2);
}
[data-bs-theme=dark] .btn-outline-primary {
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.4);
}

/* ---- Spinner ---- */
[data-bs-theme=dark] .card .spinner-border { color: #94a3b8; }

/* ---- Generic content surfaces on non-card pages ---- */
[data-bs-theme=dark] .content-page { color: #e2e8f0; }
[data-bs-theme=dark] .page-title,
[data-bs-theme=dark] .page-title-box h4 { color: #f1f5f9 !important; }

/* ---- Tables (outside modals) ---- */
[data-bs-theme=dark] .table:not(.modal-content .table) {
    --bs-table-bg: transparent;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: rgba(255,255,255,0.08);
    --bs-table-striped-bg: rgba(255,255,255,0.03);
    --bs-table-hover-bg: rgba(255,255,255,0.06);
    --bs-table-hover-color: #f1f5f9;
}
[data-bs-theme=dark] .table:not(.modal-content .table) thead th {
    background-color: rgba(255,255,255,0.04);
    color: #cbd5e1;
    border-color: rgba(255,255,255,0.08);
}

/* ---- DataTables wrapper (outside modals) ---- */
[data-bs-theme=dark] .dataTables_wrapper:not(.modal-content .dataTables_wrapper) .dataTables_info,
[data-bs-theme=dark] .dataTables_wrapper:not(.modal-content .dataTables_wrapper) .dataTables_length label,
[data-bs-theme=dark] .dataTables_wrapper:not(.modal-content .dataTables_wrapper) .dataTables_filter label {
    color: #94a3b8;
}
[data-bs-theme=dark] .dataTables_wrapper:not(.modal-content .dataTables_wrapper) .paginate_button.page-item .page-link {
    background-color: transparent;
    border-color: rgba(255,255,255,0.1);
    color: #cbd5e1;
}
[data-bs-theme=dark] .dataTables_wrapper:not(.modal-content .dataTables_wrapper) .paginate_button.page-item.active .page-link {
    background-color: rgba(26, 179, 148, 0.25);
    border-color: rgba(26, 179, 148, 0.5);
    color: #5eead4;
}

/* ---- Form controls on card surfaces (modals keep light per _HeadCSS.cshtml) ---- */
[data-bs-theme=dark] .card .form-control,
[data-bs-theme=dark] .card .form-select,
[data-bs-theme=dark] .card-body .form-control,
[data-bs-theme=dark] .card-body .form-select {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: rgba(255,255,255,0.12);
}
[data-bs-theme=dark] .card .form-control::placeholder,
[data-bs-theme=dark] .card-body .form-control::placeholder { color: #64748b; }
[data-bs-theme=dark] .card .form-control:focus,
[data-bs-theme=dark] .card .form-select:focus {
    background-color: #0f172a;
    color: #f1f5f9;
    border-color: #1ab394;
    box-shadow: 0 0 0 3px rgba(26, 179, 148, 0.2);
}
[data-bs-theme=dark] .card .form-label,
[data-bs-theme=dark] .card-body .form-label { color: #cbd5e1 !important; }

/* Chosen controls on cards */
[data-bs-theme=dark] .card .chosen-container-single .chosen-single,
[data-bs-theme=dark] .card .chosen-container-multi .chosen-choices {
    background-color: #0f172a !important;
    color: #e2e8f0 !important;
    border-color: rgba(255,255,255,0.12) !important;
}
[data-bs-theme=dark] .card .chosen-container-single .chosen-default span { color: #64748b; }
[data-bs-theme=dark] .card .chosen-container .chosen-drop {
    background-color: #1e293b;
    border-color: rgba(255,255,255,0.12);
}
[data-bs-theme=dark] .card .chosen-container .chosen-results li { color: #e2e8f0; }
[data-bs-theme=dark] .card .chosen-container .chosen-results li.result-selected {
    background-color: rgba(255,255,255,0.08);
    color: #f1f5f9;
}

/* ==========================================================================
   Modals — DARK surface in dark mode (applied globally)
   Matches the Referral/Details modal treatment. Uses !important throughout
   to beat page-local inline styles (color: #1e293b, border: 2px solid #e2e8f0,
   background: #f8fafc, etc.) commonly scattered through the app's modals.
   ========================================================================== */

/* Shell */
[data-bs-theme=dark] .modal-content {
    background-color: #1e1f27 !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
}

[data-bs-theme=dark] .modal-body,
[data-bs-theme=dark] .modal-footer {
    color: #e2e8f0;
    background: transparent;
}

[data-bs-theme=dark] .modal-header {
    border-bottom-color: #334155;
}

[data-bs-theme=dark] .modal-footer {
    border-top-color: #334155;
}

/* All labels + plain headings/paragraphs inside modals — force light.
   Attribute selectors with !important beat inline `color: #1e293b` etc. */
[data-bs-theme=dark] .modal-content label,
[data-bs-theme=dark] .modal-content .form-label,
[data-bs-theme=dark] .modal-content .col-form-label,
[data-bs-theme=dark] .modal-content h1,
[data-bs-theme=dark] .modal-content h2,
[data-bs-theme=dark] .modal-content h3,
[data-bs-theme=dark] .modal-content h4,
[data-bs-theme=dark] .modal-content h5,
[data-bs-theme=dark] .modal-content h6,
[data-bs-theme=dark] .modal-content p,
[data-bs-theme=dark] .modal-content strong,
[data-bs-theme=dark] .modal-content .fw-bold,
[data-bs-theme=dark] .modal-content .fw-semibold,
[data-bs-theme=dark] .modal-content .fw-medium {
    color: #e2e8f0 !important;
}

/* Uppercase / letter-spaced meta labels (inline color:#64748b) stay muted */
[data-bs-theme=dark] .modal-content label[style*="text-transform"],
[data-bs-theme=dark] .modal-content label[style*="letter-spacing"] {
    color: #94a3b8 !important;
}

/* Re-assert white on text that's explicitly white (gradient banner headers inside modals) */
[data-bs-theme=dark] .modal-content .text-white,
[data-bs-theme=dark] .modal-content h1.text-white,
[data-bs-theme=dark] .modal-content h2.text-white,
[data-bs-theme=dark] .modal-content h3.text-white,
[data-bs-theme=dark] .modal-content h4.text-white,
[data-bs-theme=dark] .modal-content h5.text-white,
[data-bs-theme=dark] .modal-content h6.text-white {
    color: #ffffff !important;
}

[data-bs-theme=dark] .modal-content .text-white-50 {
    color: rgba(255, 255, 255, 0.7) !important;
}

[data-bs-theme=dark] .modal-content [style*="color: #fff"],
[data-bs-theme=dark] .modal-content [style*="color:#fff"],
[data-bs-theme=dark] .modal-content [style*="color: white"],
[data-bs-theme=dark] .modal-content [style*="color:white"] {
    color: #ffffff !important;
}

/* Standard colored headers (bg-primary, etc.) keep white text */
[data-bs-theme=dark] .modal-header.bg-primary,
[data-bs-theme=dark] .modal-header.text-white,
[data-bs-theme=dark] .modal-header.bg-success,
[data-bs-theme=dark] .modal-header.bg-info,
[data-bs-theme=dark] .modal-header.bg-warning,
[data-bs-theme=dark] .modal-header.bg-danger,
[data-bs-theme=dark] .modal-header.bg-dark {
    color: #ffffff;
}

[data-bs-theme=dark] .modal-header.bg-primary .modal-title,
[data-bs-theme=dark] .modal-header.text-white .modal-title,
[data-bs-theme=dark] .modal-header.bg-success .modal-title,
[data-bs-theme=dark] .modal-header.bg-info .modal-title,
[data-bs-theme=dark] .modal-header.bg-warning .modal-title,
[data-bs-theme=dark] .modal-header.bg-danger .modal-title,
[data-bs-theme=dark] .modal-header.bg-dark .modal-title {
    color: #ffffff !important;
}

/* Form controls — override inline light borders (e.g. border: 2px solid #e2e8f0) */
[data-bs-theme=dark] .modal-content .form-control,
[data-bs-theme=dark] .modal-content .form-select,
[data-bs-theme=dark] .modal-content textarea,
[data-bs-theme=dark] .modal-content input[type="text"],
[data-bs-theme=dark] .modal-content input[type="date"],
[data-bs-theme=dark] .modal-content input[type="time"],
[data-bs-theme=dark] .modal-content input[type="datetime-local"],
[data-bs-theme=dark] .modal-content input[type="email"],
[data-bs-theme=dark] .modal-content input[type="number"],
[data-bs-theme=dark] .modal-content input[type="password"],
[data-bs-theme=dark] .modal-content input[type="search"],
[data-bs-theme=dark] .modal-content input[type="tel"],
[data-bs-theme=dark] .modal-content input[type="url"],
[data-bs-theme=dark] .modal-content select {
    background-color: #252734 !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme=dark] .modal-content .form-control::placeholder,
[data-bs-theme=dark] .modal-content textarea::placeholder,
[data-bs-theme=dark] .modal-content input::placeholder {
    color: #64748b !important;
    opacity: 1;
}

[data-bs-theme=dark] .modal-content .form-control:focus,
[data-bs-theme=dark] .modal-content .form-select:focus,
[data-bs-theme=dark] .modal-content textarea:focus,
[data-bs-theme=dark] .modal-content input:focus {
    background-color: #252734 !important;
    border-color: #1ab394 !important;
    color: #e2e8f0 !important;
    box-shadow: 0 0 0 3px rgba(26, 179, 148, 0.25) !important;
}

/* Browser-native select options */
[data-bs-theme=dark] .modal-content .form-select option,
[data-bs-theme=dark] .modal-content select option {
    background-color: #252734;
    color: #e2e8f0;
}

/* Read-only / disabled inputs */
[data-bs-theme=dark] .modal-content .form-control:disabled,
[data-bs-theme=dark] .modal-content .form-control[readonly],
[data-bs-theme=dark] .modal-content .form-select:disabled {
    background-color: #1e1f27 !important;
    color: #94a3b8 !important;
}

/* Check/radio */
[data-bs-theme=dark] .modal-content .form-check-input {
    background-color: #252734;
    border-color: #475569;
}

[data-bs-theme=dark] .modal-content .form-check-input:checked {
    background-color: #1ab394;
    border-color: #1ab394;
}

/* Date/time picker icons — invert for visibility */
[data-bs-theme=dark] .modal-content input[type="date"]::-webkit-calendar-picker-indicator,
[data-bs-theme=dark] .modal-content input[type="time"]::-webkit-calendar-picker-indicator,
[data-bs-theme=dark] .modal-content input[type="datetime-local"]::-webkit-calendar-picker-indicator,
[data-bs-theme=dark] .modal-content input[type="date"]::-webkit-inner-spin-button,
[data-bs-theme=dark] .modal-content input[type="time"]::-webkit-inner-spin-button {
    filter: invert(1) brightness(1.5);
}

/* Inline light backgrounds on "view" boxes and panels */
[data-bs-theme=dark] .modal-content [style*="background: #f8fafc"],
[data-bs-theme=dark] .modal-content [style*="background:#f8fafc"],
[data-bs-theme=dark] .modal-content [style*="background: #f8f9fa"],
[data-bs-theme=dark] .modal-content [style*="background:#f8f9fa"],
[data-bs-theme=dark] .modal-content [style*="background: #fff"],
[data-bs-theme=dark] .modal-content [style*="background:#fff"],
[data-bs-theme=dark] .modal-content [style*="background: white"],
[data-bs-theme=dark] .modal-content [style*="background:white"] {
    background-color: #252734 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

/* Inline light borders */
[data-bs-theme=dark] .modal-content [style*="border: 1px solid #e2e8f0"],
[data-bs-theme=dark] .modal-content [style*="border:1px solid #e2e8f0"],
[data-bs-theme=dark] .modal-content [style*="border: 1px solid #dee2e6"],
[data-bs-theme=dark] .modal-content [style*="border:1px solid #dee2e6"],
[data-bs-theme=dark] .modal-content [style*="border: 1px solid #e5e7eb"] {
    border-color: #334155 !important;
}

/* Buttons */
[data-bs-theme=dark] .modal-content .btn-light {
    background-color: #252734 !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155 !important;
}

[data-bs-theme=dark] .modal-content .btn-light:hover {
    background-color: #334155 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

[data-bs-theme=dark] .modal-content .btn-secondary {
    background-color: #334155;
    border-color: #475569;
    color: #e2e8f0;
}

[data-bs-theme=dark] .modal-content .btn-secondary:hover {
    background-color: #475569;
    color: #ffffff;
}

[data-bs-theme=dark] .modal-content .btn-outline-success { color: #86efac; border-color: #86efac; }
[data-bs-theme=dark] .modal-content .btn-outline-success:hover { background-color: #86efac; color: #1e1f27; }
[data-bs-theme=dark] .modal-content .btn-outline-info    { color: #67e8f9; border-color: #67e8f9; }
[data-bs-theme=dark] .modal-content .btn-outline-info:hover    { background-color: #67e8f9; color: #1e1f27; }
[data-bs-theme=dark] .modal-content .btn-outline-secondary { color: #cbd5e1; border-color: rgba(255,255,255,0.25); }
[data-bs-theme=dark] .modal-content .btn-outline-secondary:hover { background-color: #334155; color: #ffffff; }
[data-bs-theme=dark] .modal-content .btn-outline-primary { color: #93c5fd; border-color: rgba(147,197,253,0.5); }
[data-bs-theme=dark] .modal-content .btn-outline-primary:hover { background-color: #3b82f6; color: #ffffff; }
[data-bs-theme=dark] .modal-content .btn-outline-warning { color: #fcd34d; border-color: #fcd34d; }
[data-bs-theme=dark] .modal-content .btn-outline-warning:hover { background-color: #fcd34d; color: #1e1f27; }
[data-bs-theme=dark] .modal-content .btn-outline-danger  { color: #fca5a5; border-color: #fca5a5; }
[data-bs-theme=dark] .modal-content .btn-outline-danger:hover  { background-color: #fca5a5; color: #1e1f27; }

/* Close button on plain (non-coloured) headers gets inverted;
   .btn-close-white on gradient headers stays white. */
[data-bs-theme=dark] .modal-content .btn-close {
    filter: invert(1) grayscale(100%) brightness(1.5);
}

[data-bs-theme=dark] .modal-content .btn-close.btn-close-white {
    filter: none;
}

/* Alerts inside modals */
[data-bs-theme=dark] .modal-content .alert-success {
    background-color: rgba(16, 185, 129, 0.18) !important;
    color: #86efac !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

[data-bs-theme=dark] .modal-content .alert-info {
    background-color: rgba(8, 145, 178, 0.18) !important;
    color: #67e8f9 !important;
    border-color: rgba(8, 145, 178, 0.4) !important;
}

[data-bs-theme=dark] .modal-content .alert-warning {
    background-color: rgba(217, 119, 6, 0.18) !important;
    color: #fcd34d !important;
    border-color: rgba(217, 119, 6, 0.4) !important;
}

[data-bs-theme=dark] .modal-content .alert-danger {
    background-color: rgba(220, 38, 38, 0.18) !important;
    color: #fca5a5 !important;
    border-color: rgba(220, 38, 38, 0.4) !important;
}

/* Text utilities inside modals */
[data-bs-theme=dark] .modal-content .text-muted,
[data-bs-theme=dark] .modal-content .text-secondary,
[data-bs-theme=dark] .modal-content small.text-muted {
    color: #94a3b8 !important;
}

[data-bs-theme=dark] .modal-content .text-dark {
    color: #e2e8f0 !important;
}

[data-bs-theme=dark] .modal-content .text-success { color: #86efac !important; }
[data-bs-theme=dark] .modal-content .text-info    { color: #67e8f9 !important; }
[data-bs-theme=dark] .modal-content .text-warning { color: #fcd34d !important; }
[data-bs-theme=dark] .modal-content .text-danger  { color: #fca5a5 !important; }
[data-bs-theme=dark] .modal-content .text-primary { color: #93c5fd !important; }
[data-bs-theme=dark] .modal-content .text-purple  { color: #c4b5fd !important; }

/* Subtle badge tints in modals */
[data-bs-theme=dark] .modal-content .bg-success-subtle   { background-color: rgba(16, 185, 129, 0.2) !important; color: #86efac !important; }
[data-bs-theme=dark] .modal-content .bg-info-subtle      { background-color: rgba(8, 145, 178, 0.2) !important;  color: #67e8f9 !important; }
[data-bs-theme=dark] .modal-content .bg-warning-subtle   { background-color: rgba(217, 119, 6, 0.2) !important;  color: #fcd34d !important; }
[data-bs-theme=dark] .modal-content .bg-danger-subtle    { background-color: rgba(220, 38, 38, 0.2) !important;  color: #fca5a5 !important; }
[data-bs-theme=dark] .modal-content .bg-primary-subtle   { background-color: rgba(59, 130, 246, 0.2) !important; color: #93c5fd !important; }
[data-bs-theme=dark] .modal-content .bg-secondary-subtle { background-color: rgba(148, 163, 184, 0.25) !important; color: #cbd5e1 !important; }
[data-bs-theme=dark] .modal-content .bg-purple-subtle    { background-color: rgba(124, 58, 237, 0.2) !important; color: #c4b5fd !important; }

/* Tables inside modals */
[data-bs-theme=dark] .modal-content .table {
    --bs-table-bg: transparent;
    --bs-table-color: #e2e8f0;
    --bs-table-border-color: rgba(255,255,255,0.08);
    --bs-table-striped-bg: rgba(255,255,255,0.03);
    --bs-table-hover-bg: rgba(255,255,255,0.06);
    --bs-table-hover-color: #f1f5f9;
}

[data-bs-theme=dark] .modal-content .table thead th {
    background-color: #252734;
    color: #cbd5e1;
    border-color: #334155;
}

/* Horizontal rules */
[data-bs-theme=dark] .modal-content hr {
    border-top-color: #334155;
    color: #334155;
    opacity: 1;
}

/* Progress bars */
[data-bs-theme=dark] .modal-content .progress {
    background-color: #334155;
}

/* Input group addon text */
[data-bs-theme=dark] .modal-content .input-group-text {
    background-color: #252734;
    border-color: #334155;
    color: #e2e8f0;
}

/* Invalid feedback (form validation) */
[data-bs-theme=dark] .modal-content .invalid-feedback {
    color: #fca5a5;
}

/* Spinner inside modals */
[data-bs-theme=dark] .modal-content .spinner-border {
    color: #5eead4;
}

/* Dropzone (file uploads) inside modals */
[data-bs-theme=dark] .modal-content .doc-dropzone,
[data-bs-theme=dark] .modal-content .dropzone {
    background-color: #252734 !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}

[data-bs-theme=dark] .modal-content .doc-dropzone:hover,
[data-bs-theme=dark] .modal-content .doc-dropzone.dz-drag-hover,
[data-bs-theme=dark] .modal-content .dropzone:hover,
[data-bs-theme=dark] .modal-content .dropzone.dz-drag-hover {
    background-color: #1e1f27 !important;
    border-color: #1ab394 !important;
}

[data-bs-theme=dark] .modal-content .doc-dropzone h6,
[data-bs-theme=dark] .modal-content .dropzone h6 {
    color: #e2e8f0;
}

/* =================== Chosen.js dropdowns inside modals =================== */
[data-bs-theme=dark] .modal .chosen-container .chosen-single,
[data-bs-theme=dark] .modal .chosen-container-active.chosen-with-drop .chosen-single,
[data-bs-theme=dark] .modal .chosen-container-active .chosen-single {
    background-color: #252734 !important;
    background-image: none !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
    box-shadow: none !important;
}

[data-bs-theme=dark] .modal .chosen-container .chosen-single span {
    color: #e2e8f0 !important;
}

[data-bs-theme=dark] .modal .chosen-container-single .chosen-default span {
    color: #64748b !important;
}

[data-bs-theme=dark] .modal .chosen-container .chosen-drop {
    background-color: #252734 !important;
    border-color: #334155 !important;
}

[data-bs-theme=dark] .modal .chosen-container .chosen-results {
    background-color: #252734;
    color: #e2e8f0;
    margin: 0;
}

[data-bs-theme=dark] .modal .chosen-container .chosen-results li,
[data-bs-theme=dark] .modal .chosen-container .chosen-results li.active-result {
    color: #e2e8f0;
    background: transparent;
}

[data-bs-theme=dark] .modal .chosen-container .chosen-results li.highlighted {
    background-color: rgba(26, 179, 148, 0.3) !important;
    color: #ffffff !important;
}

[data-bs-theme=dark] .modal .chosen-container .chosen-results li.result-selected {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

[data-bs-theme=dark] .modal .chosen-container .chosen-results li.no-results {
    background-color: #1e1f27;
    color: #94a3b8;
}

[data-bs-theme=dark] .modal .chosen-container-single .chosen-search input[type="text"],
[data-bs-theme=dark] .modal .chosen-container-multi .chosen-choices input[type="text"] {
    background-color: #1e1f27 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme=dark] .modal .chosen-container-multi .chosen-choices {
    background-color: #252734 !important;
    border-color: #334155 !important;
}

[data-bs-theme=dark] .modal .chosen-container-multi .chosen-choices li.search-choice {
    background-color: #1ab394;
    color: #ffffff;
}

/* Chosen dropdown caret */
[data-bs-theme=dark] .modal .chosen-container-single .chosen-single div::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

[data-bs-theme=dark] .modal .chosen-container-single .chosen-single abbr {
    filter: invert(1) brightness(1.3);
}

/* =================== Chosen.js dropdowns — global baseline ===================
   Chosen is initialized on every <select> app-wide. The .card / .modal rules
   above cover those contexts; this unscoped baseline catches every other
   container (e.g. .section-card filter cards, bare page selects) so no Chosen
   widget renders light-on-dark. Lower specificity than the scoped rules above,
   so those still win where they apply. */
[data-bs-theme=dark] .chosen-container .chosen-single,
[data-bs-theme=dark] .chosen-container-active.chosen-with-drop .chosen-single,
[data-bs-theme=dark] .chosen-container-active .chosen-single {
    background-color: #252734 !important;
    background-image: none !important;
    border: 1px solid #334155 !important;
    color: #e2e8f0 !important;
    box-shadow: none !important;
}

[data-bs-theme=dark] .chosen-container .chosen-single span {
    color: #e2e8f0 !important;
}

[data-bs-theme=dark] .chosen-container-single .chosen-default span {
    color: #94a3b8 !important;
}

[data-bs-theme=dark] .chosen-container .chosen-drop {
    background-color: #252734 !important;
    border-color: #334155 !important;
}

[data-bs-theme=dark] .chosen-container .chosen-results {
    background-color: #252734;
    color: #e2e8f0;
    margin: 0;
}

[data-bs-theme=dark] .chosen-container .chosen-results li,
[data-bs-theme=dark] .chosen-container .chosen-results li.active-result {
    color: #e2e8f0;
    background: transparent;
}

[data-bs-theme=dark] .chosen-container .chosen-results li.highlighted {
    background-color: rgba(26, 179, 148, 0.3) !important;
    color: #ffffff !important;
}

[data-bs-theme=dark] .chosen-container .chosen-results li.result-selected {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f1f5f9;
}

[data-bs-theme=dark] .chosen-container .chosen-results li.no-results {
    background-color: #1e1f27;
    color: #94a3b8;
}

[data-bs-theme=dark] .chosen-container-single .chosen-search input[type="text"],
[data-bs-theme=dark] .chosen-container-multi .chosen-choices input[type="text"] {
    background-color: #1e1f27 !important;
    border-color: #334155 !important;
    color: #e2e8f0 !important;
}

[data-bs-theme=dark] .chosen-container-multi .chosen-choices {
    background-color: #252734 !important;
    border-color: #334155 !important;
}

[data-bs-theme=dark] .chosen-container-multi .chosen-choices li.search-choice {
    background-color: #1ab394;
    color: #ffffff;
}

/* Chosen dropdown caret + clear (deselect) icon */
[data-bs-theme=dark] .chosen-container-single .chosen-single div::after {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23cbd5e1' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e") !important;
}

[data-bs-theme=dark] .chosen-container-single .chosen-single abbr {
    filter: invert(1) brightness(1.3);
}
