/**
 * Pantheon Cemetery — System-Wide High Contrast / Dark Mode Stylesheet
 * Provides a unified, accessible, premium dark high-contrast theme across:
 * - Admin Dashboard (dashboard.php)
 * - Clerk / Staff Dashboard (clerk_dashboard.php)
 * - Caretaker Dashboard (caretaker_dashboard.php)
 * - Interactive Cemetery Map (cemetery_map.php)
 * - Landing Page (landing.php)
 * - Login Page (login.php)
 * - Password Reset (change_password.php)
 * - Printable Schedule Slip (print_schedule.php)
 */

/* ===== 1. ROOT VARIABLES IN HIGH CONTRAST ===== */
html.high-contrast,
body.high-contrast {
    --gray-50: #0f172a;        /* Deep slate background */
    --gray-100: #1e293b;       /* Surface / card / hover */
    --gray-200: #334155;       /* Card borders / dividers */
    --gray-300: #475569;       /* Input borders */
    --gray-400: #94a3b8;       /* Muted text / icons */
    --white: #1e293b;          /* White replacement */
    --dark: #f8fafc;           /* Crisp primary text */
    --dark-600: #e2e8f0;       /* High-contrast subheadings */
    --dark-500: #cbd5e1;       /* Secondary readable text */
    --green-900: #061e11;      /* Deep forest obsidian sidebar */
    --green-800: #4ade80;      /* Vibrant emerald headers */
    --green-700: #16a34a;      /* Active state green */
    --green-600: #22c55e;
    --green-500: #22c55e;
    --green-100: rgba(34, 197, 94, 0.16);
    --gold-600: #ca8a04;
    --gold-500: #facc15;       /* Bright gold accents */
    --gold-400: #fde047;
    --gold-300: #fef08a;
    --gold-100: rgba(250, 204, 21, 0.15);
    --blue-500: #60a5fa;
    --blue-100: rgba(96, 165, 250, 0.18);
    --amber-500: #fbbf24;
    --amber-100: rgba(251, 191, 36, 0.18);
    --emerald-500: #34d399;
    --emerald-100: rgba(52, 211, 153, 0.18);
    --red-500: #f87171;
    --red-100: rgba(248, 113, 113, 0.18);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.5);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.5);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.7);
    color-scheme: dark;
}

/* ===== 2. BASE DOCUMENT & TYPOGRAPHY ===== */
body.high-contrast {
    background-color: #0f172a !important;
    color: #f8fafc !important;
}

body.high-contrast h1,
body.high-contrast h2,
body.high-contrast h3,
body.high-contrast h4,
body.high-contrast h5,
body.high-contrast h6 {
    color: #f8fafc;
}

body.high-contrast p,
body.high-contrast span,
body.high-contrast label,
body.high-contrast strong {
    color: inherit;
}

body.high-contrast hr {
    border-color: #334155 !important;
}

/* ===== 3. SIDEBAR NAVIGATION ===== */
body.high-contrast .sidebar {
    background: #061e11 !important;
    border-right: 1px solid #1b3524 !important;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4) !important;
}

body.high-contrast .sidebar-brand {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

body.high-contrast .sidebar-brand h2 {
    color: #fde047 !important;
}

body.high-contrast .sidebar-brand span {
    color: rgba(255, 255, 255, 0.6) !important;
}

body.high-contrast .sidebar-menu-label {
    color: rgba(255, 255, 255, 0.45) !important;
}

body.high-contrast .sidebar-link {
    color: #cbd5e1 !important;
}

body.high-contrast .sidebar-link:hover {
    background: rgba(255, 255, 255, 0.09) !important;
    color: #ffffff !important;
}

body.high-contrast .sidebar-link.active {
    background: #16a34a !important;
    color: #ffffff !important;
    box-shadow: 0 2px 10px rgba(22, 163, 74, 0.4) !important;
}

body.high-contrast .sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* ===== 4. TOPBAR ===== */
body.high-contrast .topbar {
    background: #152238 !important;
    border-bottom: 1px solid #28374f !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35) !important;
}

body.high-contrast .topbar-title {
    color: #f8fafc !important;
}

body.high-contrast .topbar-toggle {
    border-color: #3b4d66 !important;
    color: #e2e8f0 !important;
    background: #1e293b !important;
}

body.high-contrast .topbar-user {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
}

body.high-contrast .topbar-user i {
    color: #4ade80 !important;
}

/* ===== 5. PANELS, CARDS & CONTAINERS ===== */
body.high-contrast .data-card,
body.high-contrast .stat-card,
body.high-contrast .report-card,
body.high-contrast .schedule-card,
body.high-contrast .card {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35) !important;
}

body.high-contrast .data-card-header {
    border-bottom: 1px solid #334155 !important;
    background: transparent !important;
}

body.high-contrast .data-card-header h2,
body.high-contrast .report-card h3 {
    color: #f8fafc !important;
}

body.high-contrast .stat-card h3 {
    color: #f8fafc !important;
}

body.high-contrast .stat-card .stat-title {
    color: #f8fafc !important;
}

body.high-contrast .stat-card .stat-sub {
    color: #94a3b8 !important;
}

body.high-contrast .page-header h1 {
    color: #4ade80 !important;
}

body.high-contrast .page-header p {
    color: #94a3b8 !important;
}

/* ===== 6. DATA TABLES ===== */
body.high-contrast .data-table {
    border-color: #334155 !important;
}

body.high-contrast .data-table th {
    background: #0f172a !important;
    color: #94a3b8 !important;
    border-bottom: 1px solid #334155 !important;
}

body.high-contrast .data-table td {
    background: transparent !important;
    color: #e2e8f0 !important;
    border-bottom: 1px solid #28374f !important;
}

body.high-contrast .data-table tbody tr:hover {
    background: #152238 !important;
}

body.high-contrast .data-table tbody tr:hover td {
    color: #ffffff !important;
}

/* ===== 7. FORM INPUTS & SELECTS ===== */
body.high-contrast input[type="text"],
body.high-contrast input[type="search"],
body.high-contrast input[type="password"],
body.high-contrast input[type="email"],
body.high-contrast input[type="date"],
body.high-contrast input[type="time"],
body.high-contrast input[type="number"],
body.high-contrast select,
body.high-contrast textarea,
body.high-contrast .search-input,
body.high-contrast .form-group input,
body.high-contrast .form-group select,
body.high-contrast .form-group textarea {
    background: #0f172a !important;
    border: 1.5px solid #334155 !important;
    color: #f8fafc !important;
}

body.high-contrast input:focus,
body.high-contrast select:focus,
body.high-contrast textarea:focus,
body.high-contrast .search-input:focus {
    border-color: #22c55e !important;
    background: #0b1120 !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22) !important;
}

body.high-contrast input::placeholder,
body.high-contrast textarea::placeholder {
    color: #64748b !important;
}

body.high-contrast .form-group label {
    color: #cbd5e1 !important;
}

body.high-contrast select option {
    background: #0f172a !important;
    color: #f8fafc !important;
}

/* Landing Page Hero Search Bar (Keeps sleek translucent glass styling in dark mode) */
body.high-contrast .search-box,
body.high-contrast #hero-search-box {
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45) !important;
}

body.high-contrast .search-box:focus-within,
body.high-contrast #hero-search-box:focus-within {
    background: rgba(15, 23, 42, 0.88) !important;
    border-color: #facc15 !important;
    box-shadow: 0 0 30px rgba(250, 204, 21, 0.22) !important;
}

body.high-contrast .search-box input,
body.high-contrast #hero-search-input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: #f8fafc !important;
}

body.high-contrast .search-box input:focus,
body.high-contrast #hero-search-input:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

body.high-contrast .search-box input::placeholder,
body.high-contrast #hero-search-input::placeholder {
    color: rgba(255, 255, 255, 0.55) !important;
}

body.high-contrast .search-icon {
    color: rgba(255, 255, 255, 0.6) !important;
}

body.high-contrast .search-results {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65) !important;
}

body.high-contrast .search-result-item {
    border-bottom: 1px solid #1e293b !important;
}

body.high-contrast .search-result-item:hover {
    background: #1e293b !important;
}

body.high-contrast .search-result-name {
    color: #f8fafc !important;
}


/* ===== 8. BUTTONS ===== */
body.high-contrast .btn-secondary {
    background: #273549 !important;
    border: 1px solid #3b4d66 !important;
    color: #e2e8f0 !important;
}

body.high-contrast .btn-secondary:hover {
    background: #334661 !important;
    color: #ffffff !important;
    border-color: #4b6282 !important;
}

body.high-contrast .btn-primary {
    background: #16a34a !important;
    color: #ffffff !important;
}

body.high-contrast .btn-primary:hover {
    background: #15803d !important;
}

body.high-contrast .btn-danger {
    background: #dc2626 !important;
    color: #ffffff !important;
}

body.high-contrast .btn-danger:hover {
    background: #b91c1c !important;
}

body.high-contrast .btn-gold {
    background: linear-gradient(135deg, #facc15, #ca8a04) !important;
    color: #0f172a !important;
    font-weight: 700 !important;
}

/* ===== 9. MODALS ===== */
body.high-contrast .modal-overlay {
    background: rgba(0, 0, 0, 0.78) !important;
    backdrop-filter: blur(6px) !important;
}

body.high-contrast .modal-box {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.75) !important;
}

body.high-contrast .modal-header {
    border-bottom: 1px solid #334155 !important;
}

body.high-contrast .modal-header h3 {
    color: #4ade80 !important;
}

body.high-contrast .modal-close {
    background: #273549 !important;
    color: #94a3b8 !important;
}

body.high-contrast .modal-close:hover {
    background: #334661 !important;
    color: #ffffff !important;
}

body.high-contrast .modal-footer {
    border-top: 1px solid #334155;
    background: #162030;
}
body.high-contrast .modal-footer[style*="border-top:none"],
body.high-contrast .modal-footer[style*="border-top: none"],
body.high-contrast .modal-footer[style*="border:0"],
body.high-contrast .modal-footer[style*="border: 0"],
body.high-contrast #profileLogoutModal .modal-footer,
body.high-contrast #logoutModal .modal-footer,
body.high-contrast #logout-modal .modal-footer,
body.high-contrast .confirm-modal .modal-footer {
    border-top: none !important;
    background: transparent !important;
}

/* ===== 10. ACTIVITY LOGS, STATS & BADGES ===== */
body.high-contrast .activity-item {
    background: #162234 !important;
    border: 1px solid #28374f !important;
}

body.high-contrast .activity-item .activity-text p {
    color: #e2e8f0 !important;
}

body.high-contrast .activity-item .activity-text small {
    color: #94a3b8 !important;
}

body.high-contrast .report-stat-list li {
    border-bottom: 1px solid #28374f !important;
}

body.high-contrast .report-stat-list .label {
    color: #94a3b8 !important;
}

body.high-contrast .report-stat-list .value {
    color: #f8fafc !important;
}

body.high-contrast .badge-code {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80 !important;
    border-color: rgba(34, 197, 94, 0.3) !important;
}

body.high-contrast .empty-state {
    color: #64748b !important;
}

/* Status Badges */
body.high-contrast .badge-gold {
    background: rgba(250, 204, 21, 0.2) !important;
    color: #facc15 !important;
    border: 1px solid rgba(250, 204, 21, 0.4) !important;
}
body.high-contrast .badge-blue {
    background: rgba(96, 165, 250, 0.2) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(96, 165, 250, 0.4) !important;
}
body.high-contrast .badge-green {
    background: rgba(52, 211, 153, 0.2) !important;
    color: #6ee7b7 !important;
    border: 1px solid rgba(52, 211, 153, 0.4) !important;
}
body.high-contrast .badge-red {
    background: rgba(248, 113, 113, 0.2) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(248, 113, 113, 0.4) !important;
}
body.high-contrast .badge-gray {
    background: rgba(148, 163, 184, 0.2) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(148, 163, 184, 0.4) !important;
}
body.high-contrast .badge-amber {
    background: rgba(251, 191, 36, 0.2) !important;
    color: #fcd34d !important;
    border: 1px solid rgba(251, 191, 36, 0.4) !important;
}

/* Activity Badge Contrast Fixes */
body.high-contrast .data-table td .badge[style*="#fee2e2"],
body.high-contrast .data-table td .badge[style*="b91c1c"] {
    background: rgba(239, 68, 68, 0.22) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.4) !important;
}
body.high-contrast .data-table td .badge[style*="#d1fae5"],
body.high-contrast .data-table td .badge[style*="047857"] {
    background: rgba(16, 185, 129, 0.22) !important;
    color: #6ee7b7 !important;
    border: 1px solid rgba(16, 185, 129, 0.4) !important;
}
body.high-contrast .data-table td .badge[style*="#dbeafe"],
body.high-contrast .data-table td .badge[style*="1d4ed8"] {
    background: rgba(59, 130, 246, 0.22) !important;
    color: #93c5fd !important;
    border: 1px solid rgba(59, 130, 246, 0.4) !important;
}
body.high-contrast .data-table td .badge[style*="#fef3c7"],
body.high-contrast .data-table td .badge[style*="b45309"] {
    background: rgba(245, 158, 11, 0.22) !important;
    color: #fcd34d !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
}
body.high-contrast .data-table td .badge[style*="#ede9fe"],
body.high-contrast .data-table td .badge[style*="6d28d9"] {
    background: rgba(139, 92, 246, 0.22) !important;
    color: #c4b5fd !important;
    border: 1px solid rgba(139, 92, 246, 0.4) !important;
}
body.high-contrast .data-table td .badge[style*="#f3f4f6"],
body.high-contrast .data-table td .badge[style*="374151"] {
    background: rgba(148, 163, 184, 0.2) !important;
    color: #cbd5e1 !important;
    border: 1px solid rgba(148, 163, 184, 0.3) !important;
}
body.high-contrast .data-table td .badge[style*="#ffedd5"],
body.high-contrast .data-table td .badge[style*="c2410c"] {
    background: rgba(249, 115, 22, 0.22) !important;
    color: #fdba74 !important;
    border: 1px solid rgba(249, 115, 22, 0.4) !important;
}

/* ===== 11. GRAVE PLOT NICHE GRID & SHOWCASE (CLERK & ADMIN) ===== */
body.high-contrast #unplottedDeceasedScrollBox,
body.high-contrast #schedDeceasedScrollBox {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.high-contrast .unplotted-card-item {
    border-bottom: 1px solid #28374f !important;
}

body.high-contrast .unplotted-card-item:hover {
    background: #152238 !important;
}

body.high-contrast #plotSelectedBanner {
    background: rgba(16, 185, 129, 0.15) !important;
    border-color: #10b981 !important;
}

body.high-contrast #plotSelectedName {
    color: #6ee7b7 !important;
}

body.high-contrast #plotSelectedRel {
    color: #a7f3d0 !important;
}

body.high-contrast .plot-niche-cell.available {
    background: rgba(34, 197, 94, 0.18) !important;
    border-color: #22c55e !important;
    color: #4ade80 !important;
}

body.high-contrast .plot-niche-cell.occupied {
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: #ef4444 !important;
    color: #f87171 !important;
}

body.high-contrast .plot-niche-cell.selected {
    background: #16a34a !important;
    border-color: #4ade80 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(74, 222, 128, 0.6) !important;
}

body.high-contrast .grid-level-header {
    background: #152238 !important;
    color: #4ade80 !important;
    border: 1px solid #28374f !important;
}

body.high-contrast [style*="border:1px solid var(--gray-200);"][style*="background:#fff"] {
    background: #1e293b !important;
    border-color: #334155 !important;
}

/* ===== 12. INTERACTIVE CEMETERY MAP (cemetery_map.php) ===== */
body.high-contrast .topbar {
    background: #111827 !important;
    border-bottom: 1px solid #374151 !important;
}

body.high-contrast .topbar-title {
    color: #f8fafc !important;
    font-weight: 700 !important;
}

body.high-contrast .btn-back {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: #22c55e !important;
    color: #4ade80 !important;
}

body.high-contrast .btn-back:hover {
    background: #16a34a !important;
    color: #ffffff !important;
}

body.high-contrast .search-bar {
    background: rgba(15, 23, 42, 0.95) !important;
    border: 1.5px solid #334155 !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
    border-radius: 9999px !important;
}

body.high-contrast .search-bar:focus-within {
    border-color: #22c55e !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.22), 0 8px 32px rgba(0, 0, 0, 0.6) !important;
}

body.high-contrast .search-bar .search-input {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    color: #f8fafc !important;
}

body.high-contrast .search-bar .search-input:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

body.high-contrast .search-input::placeholder {
    color: #94a3b8 !important;
}

body.high-contrast .search-clear {
    background: #334155 !important;
    color: #cbd5e1 !important;
}

body.high-contrast .search-clear:hover {
    background: #475569 !important;
    color: #ffffff !important;
}

body.high-contrast .search-results {
    background: #1e293b !important;
    border-color: #334155 !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5) !important;
}

body.high-contrast .search-result-item {
    color: #f8fafc !important;
    border-bottom-color: #28374f !important;
}

body.high-contrast .search-result-item:hover {
    background: #273549 !important;
}

body.high-contrast .legend-panel {
    background: rgba(30, 41, 59, 0.95) !important;
    border-color: #475569 !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5) !important;
}

body.high-contrast .legend-header {
    background: linear-gradient(135deg, #15803d, #166534) !important;
}

body.high-contrast .legend-section-title {
    color: #94a3b8 !important;
}

body.high-contrast .legend-item {
    color: #f8fafc !important;
}

body.high-contrast .legend-hint {
    color: #94a3b8 !important;
}

body.high-contrast .layer-btn {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

body.high-contrast .layer-btn:hover {
    border-color: #475569 !important;
    background: #1e293b !important;
}

body.high-contrast .layer-btn.active {
    background: #16a34a !important;
    border-color: #16a34a !important;
    color: #ffffff !important;
}

/* Map Grid Modal */
body.high-contrast .grid-modal {
    background: #0b1329 !important;
    border: 1px solid #1e293b !important;
    color: #f8fafc !important;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7) !important;
}

body.high-contrast .grid-modal-header {
    background: #0f172a !important;
    border-bottom: 1px solid #1e293b !important;
}

body.high-contrast .grid-modal-header-left h2,
body.high-contrast .grid-modal-header-text h2 {
    color: #f8fafc !important;
}

body.high-contrast .grid-modal-header-left p,
body.high-contrast .grid-modal-header-text p {
    color: #94a3b8 !important;
}

body.high-contrast .cluster-type-badge {
    background: rgba(34, 197, 94, 0.15) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(34, 197, 94, 0.35) !important;
}

body.high-contrast .cluster-type-badge.ug {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #fbbf24 !important;
    border-color: rgba(245, 158, 11, 0.35) !important;
}

body.high-contrast .grid-modal-close {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1.5px solid #475569 !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5) !important;
}

body.high-contrast .grid-modal-close:hover,
body.high-contrast .grid-modal-close:active {
    background: #334155 !important;
    color: #ffffff !important;
    border-color: #64748b !important;
}

body.high-contrast .grid-filter-group {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
}

body.high-contrast .grid-filter-btn {
    color: #94a3b8 !important;
}

body.high-contrast .grid-filter-btn.active {
    background: #334155 !important;
    color: #f8fafc !important;
}

body.high-contrast .grid-filter-btn.btn-available.active {
    color: #4ade80 !important;
}

body.high-contrast .grid-filter-btn.btn-occupied.active {
    color: #cbd5e1 !important;
}

body.high-contrast .grid-helper-bar {
    background: #111a28 !important;
    border-color: #243449 !important;
    color: #cbd5e1 !important;
}

body.high-contrast .helper-hint {
    color: #94a3b8 !important;
    border-color: #243449 !important;
}

body.high-contrast .dip-backdrop {
    background: rgba(3, 7, 18, 0.7) !important;
}

body.high-contrast .grid-modal-content-row.dip-open .grid-modal-body {
    filter: blur(5px) brightness(0.65) !important;
    opacity: 0.5 !important;
}

body.high-contrast .dip-sheet-handle {
    background: #475569 !important;
}
body.high-contrast .dip-sheet-handle:hover {
    background: #facc15 !important;
}

body.high-contrast .dip-return-btn {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%) !important;
    border: 1.5px solid #eab308 !important;
    color: #facc15 !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45), 0 0 10px rgba(234, 179, 8, 0.2) !important;
}
body.high-contrast .dip-return-btn:hover {
    background: linear-gradient(135deg, #334155 0%, #1e293b 100%) !important;
    border-color: #fde047 !important;
    color: #ffffff !important;
    box-shadow: 0 6px 22px rgba(234, 179, 8, 0.35) !important;
}
body.high-contrast .dip-return-icon-circle {
    background: rgba(234, 179, 8, 0.2) !important;
    color: #facc15 !important;
}
body.high-contrast .dip-return-chip {
    background: rgba(234, 179, 8, 0.15) !important;
    color: #fde047 !important;
}

body.high-contrast .dip-deceased-id-badge {
    background: #1e293b !important;
    color: #facc15 !important;
    border: 1px solid #eab308 !important;
}

body.high-contrast .deceased-info-panel {
    background: #0f172a !important;
    border-left: 1px solid #1e293b !important;
}

body.high-contrast .deceased-info-panel .dip-header {
    color: #facc15 !important;
}

body.high-contrast .deceased-info-panel .dip-name {
    color: #f8fafc !important;
}

body.high-contrast .deceased-info-panel .dip-detail .dip-value {
    color: #cbd5e1 !important;
}

body.high-contrast .deceased-info-panel .dip-location {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

body.high-contrast .apartment-cell {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

body.high-contrast .apartment-cell:hover {
    background: rgba(34, 197, 94, 0.2) !important;
    border-color: #22c55e !important;
    color: #4ade80 !important;
}

body.high-contrast .apartment-cell.occupied {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.high-contrast .apartment-cell.occupied .cell-label {
    color: #94a3b8 !important;
}

body.high-contrast .cell-detail-toast {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6) !important;
}
body.high-contrast .cell-detail-toast.show {
    display: flex !important;
}

body.high-contrast .grid-helper-bar {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

body.high-contrast .grid-scroll-wrapper {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.high-contrast .grid-corner-header,
body.high-contrast .grid-col-header {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #94a3b8 !important;
}

body.high-contrast .grid-level-header {
    background: #152238 !important;
    border-color: #1e3a8a !important;
    color: #38bdf8 !important;
}

body.high-contrast .grid-level-header small {
    color: #60a5fa !important;
}

body.high-contrast .grid-filter-group {
    background: #0f172a !important;
}

body.high-contrast .grid-filter-btn {
    color: #94a3b8 !important;
}

body.high-contrast .grid-filter-btn:hover {
    background: #1e293b !important;
    color: #f8fafc !important;
}

body.high-contrast .grid-filter-btn.active {
    background: #1e293b !important;
    color: #f8fafc !important;
}

body.high-contrast .grid-filter-btn.btn-available.active {
    color: #4ade80 !important;
}

body.high-contrast .grid-filter-btn.btn-occupied.active {
    color: #cbd5e1 !important;
}

body.high-contrast .dip-card {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.high-contrast .dip-niche-code {
    color: #f8fafc !important;
}

body.high-contrast .dip-name-large {
    color: #f8fafc !important;
}

body.high-contrast .dip-data-label {
    color: #64748b !important;
}

body.high-contrast .dip-data-val {
    color: #e2e8f0 !important;
}

body.high-contrast .btn-dip-action.btn-secondary {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #cbd5e1 !important;
}

body.high-contrast .btn-dip-action.btn-secondary:hover {
    background: #273549 !important;
    color: #ffffff !important;
}

/* Leaflet Popups */
body.high-contrast .leaflet-popup-content-wrapper {
    background: #1e293b !important;
    color: #f8fafc !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

body.high-contrast .leaflet-popup-tip {
    background: #1e293b !important;
}

body.high-contrast .leaflet-container a {
    color: #4ade80 !important;
}

/* ===== 13. CARETAKER DASHBOARD ===== */
body.high-contrast .topbar-logo {
    border-color: #facc15 !important;
}

body.high-contrast .topbar-title {
    color: #f8fafc !important;
}

body.high-contrast .left-panel .brand h1 {
    color: #ffffff !important;
}

body.high-contrast .left-panel .tagline {
    color: rgba(255, 255, 255, 0.85) !important;
}

body.high-contrast .schedule-card.today {
    border-left: 4px solid #facc15 !important;
}

/* ===== 14. CHANGE PASSWORD & AUTH CARDS ===== */
body.high-contrast .login-card,
body.high-contrast .auth-card,
body.high-contrast .card {
    background: #1e293b !important;
    border-color: #334155 !important;
}

/* ===== 15. PRINT SCHEDULE TOOLBAR & PREVIEW ===== */
body.high-contrast .no-print-toolbar {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.high-contrast .sheet {
    background: #152238 !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.high-contrast .sheet table th {
    background: #0f172a !important;
    color: #94a3b8 !important;
}

body.high-contrast .sheet table td {
    color: #e2e8f0 !important;
    border-color: #334155 !important;
}

@media print {
    body.high-contrast {
        background: #fff !important;
        color: #000 !important;
    }
    body.high-contrast .sheet {
        background: #fff !important;
        color: #000 !important;
        border: none !important;
        box-shadow: none !important;
    }
}

/* ===== 16. CONTRAST / DARK MODE TOGGLE BUTTONS ===== */
.acc-contrast-toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    border: 1.5px solid var(--gray-300);
    background: var(--gray-100);
    color: var(--dark-500);
    transition: all 0.25s ease;
    user-select: none;
    text-decoration: none;
    line-height: 1.2;
}

.acc-contrast-toggle:hover {
    background: var(--gray-200);
    color: var(--dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.acc-contrast-toggle i {
    font-size: 0.95rem;
    transition: transform 0.4s ease;
}

.acc-contrast-toggle:hover i {
    transform: rotate(20deg);
}

body.high-contrast .acc-contrast-toggle {
    background: #273549 !important;
    border-color: #4b6282 !important;
    color: #facc15 !important;
    box-shadow: 0 0 14px rgba(250, 204, 21, 0.2) !important;
}

body.high-contrast .acc-contrast-toggle:hover {
    background: #334661 !important;
    border-color: #facc15 !important;
    color: #fef08a !important;
}

/* ===== 17. CUSTOM SCROLLBARS ===== */
body.high-contrast ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
body.high-contrast ::-webkit-scrollbar-track {
    background: #0f172a;
}
body.high-contrast ::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}
body.high-contrast ::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* ===== 18. UNIVERSAL INLINE COLOR & CONTRAST FIXES ===== */
body.high-contrast [style*="color:#065f46"],
body.high-contrast [style*="color:#047857"],
body.high-contrast [style*="color:#166534"],
body.high-contrast [style*="color:#15803d"],
body.high-contrast [style*="color: #065f46"],
body.high-contrast [style*="color: #047857"],
body.high-contrast [style*="color: #166534"],
body.high-contrast [style*="color: #15803d"] {
    color: #4ade80 !important;
}

body.high-contrast [style*="color:#991b1b"],
body.high-contrast [style*="color:#b91c1c"],
body.high-contrast [style*="color:#7f1d1d"],
body.high-contrast [style*="color: #991b1b"],
body.high-contrast [style*="color: #b91c1c"],
body.high-contrast [style*="color: #7f1d1d"] {
    color: #f87171 !important;
}

body.high-contrast .alert-box-warning {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
}
body.high-contrast .alert-box-warning .alert-title,
body.high-contrast .alert-box-warning strong,
body.high-contrast .alert-box-warning .alert-desc,
body.high-contrast .alert-box-warning p {
    color: #fde047 !important;
}
body.high-contrast .pending-schedule-alert-banner {
    background: rgba(245, 158, 11, 0.15) !important;
    border-color: rgba(245, 158, 11, 0.5) !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
}
body.high-contrast .pending-schedule-alert-banner .pending-alert-title,
body.high-contrast .pending-schedule-alert-banner strong {
    color: #fde047 !important;
}
body.high-contrast .pending-schedule-alert-banner .pending-alert-body,
body.high-contrast .pending-schedule-alert-banner .pending-alert-body div {
    color: #fef08a !important;
}

/* Mobile Bottom Nav in Dark Mode */
body.high-contrast .mobile-bottom-nav,
html.high-contrast .mobile-bottom-nav {
    background: rgba(15, 23, 42, 0.95) !important;
    backdrop-filter: blur(20px) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4) !important;
}
body.high-contrast .mob-nav-item,
html.high-contrast .mob-nav-item {
    color: #94a3b8 !important;
}
body.high-contrast .mob-nav-item.active,
body.high-contrast .mob-nav-item:hover,
html.high-contrast .mob-nav-item.active,
html.high-contrast .mob-nav-item:hover {
    color: #4ade80 !important;
}

body.high-contrast [style*="color:#78350f"],
body.high-contrast [style*="color: #78350f"],
body.high-contrast [style*="color:#854d0e"],
body.high-contrast [style*="color:#92400e"],
body.high-contrast [style*="color:#b45309"],
body.high-contrast [style*="color: #854d0e"],
body.high-contrast [style*="color: #92400e"],
body.high-contrast [style*="color: #b45309"] {
    color: #fcd34d !important;
}

body.high-contrast [style*="color:#1e40af"],
body.high-contrast [style*="color:#1e3a8a"],
body.high-contrast [style*="color:#1d4ed8"],
body.high-contrast [style*="color: #1e40af"],
body.high-contrast [style*="color: #1e3a8a"],
body.high-contrast [style*="color: #1d4ed8"] {
    color: #93c5fd !important;
}

body.high-contrast [style*="color:#111827"],
body.high-contrast [style*="color:#1f2937"],
body.high-contrast [style*="color:#374151"],
body.high-contrast [style*="color:#334155"],
body.high-contrast [style*="color: #111827"],
body.high-contrast [style*="color: #1f2937"],
body.high-contrast [style*="color: #374151"],
body.high-contrast [style*="color: #334155"] {
    color: #f8fafc !important;
}

body.high-contrast [style*="color:#475569"],
body.high-contrast [style*="color:#64748b"],
body.high-contrast [style*="color:#6b7280"],
body.high-contrast [style*="color: #475569"],
body.high-contrast [style*="color: #64748b"],
body.high-contrast [style*="color: #6b7280"] {
    color: #cbd5e1 !important;
}

/* Background overrides for badges and cards with inline light backgrounds */
body.high-contrast [style*="background:#fffbeb"],
body.high-contrast [style*="background:#fefce8"],
body.high-contrast [style*="background:#fef3c7"],
body.high-contrast [style*="background: #fffbeb"],
body.high-contrast [style*="background: #fefce8"],
body.high-contrast [style*="background: #fef3c7"] {
    background: rgba(245, 158, 11, 0.18) !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

body.high-contrast [style*="background:#d1fae5"],
body.high-contrast [style*="background:#f0fdf4"],
body.high-contrast [style*="background:#dcfce7"],
body.high-contrast [style*="background:#ecfdf5"],
body.high-contrast [style*="background: #d1fae5"],
body.high-contrast [style*="background: #f0fdf4"],
body.high-contrast [style*="background: #dcfce7"],
body.high-contrast [style*="background: #ecfdf5"] {
    background: rgba(16, 185, 129, 0.18) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

body.high-contrast [style*="background:#fee2e2"],
body.high-contrast [style*="background:#fef2f2"],
body.high-contrast [style*="background: #fee2e2"],
body.high-contrast [style*="background: #fef2f2"] {
    background: rgba(239, 68, 68, 0.18) !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
}

body.high-contrast [style*="background:#dbeafe"],
body.high-contrast [style*="background:#eff6ff"],
body.high-contrast [style*="background:#e0e7ff"],
body.high-contrast [style*="background: #dbeafe"],
body.high-contrast [style*="background: #eff6ff"],
body.high-contrast [style*="background: #e0e7ff"] {
    background: rgba(59, 130, 246, 0.18) !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
}

body.high-contrast [style*="background:#f1f5f9"],
body.high-contrast [style*="background:#f3f4f6"],
body.high-contrast [style*="background:#e5e7eb"],
body.high-contrast [style*="background: #f1f5f9"],
body.high-contrast [style*="background: #f3f4f6"],
body.high-contrast [style*="background: #e5e7eb"] {
    background: #1e293b !important;
    border-color: #334155 !important;
}

/* Schedule location badges */
body.high-contrast .sched-loc-badge {
    background: rgba(34, 197, 94, 0.15) !important;
    border-color: rgba(34, 197, 94, 0.35) !important;
    color: #4ade80 !important;
}

body.high-contrast .sched-loc-badge:hover {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}

/* Niche unburied cells & badges */
body.high-contrast .apartment-cell.unburied {
    background: rgba(245, 158, 11, 0.2) !important;
    border-color: #f59e0b !important;
}

body.high-contrast .apartment-cell.unburied .cell-label {
    color: #fcd34d !important;
}

body.high-contrast .apartment-cell.unburied .cell-occupant {
    color: #fef08a !important;
}

body.high-contrast .apartment-cell.searched-cell {
    background: rgba(245, 158, 11, 0.3) !important;
    border-color: #facc15 !important;
}

body.high-contrast .apartment-cell.searched-cell .cell-label {
    color: #fef08a !important;
}

body.high-contrast .dip-badge.unburied {
    background: rgba(245, 158, 11, 0.22) !important;
    color: #fcd34d !important;
    border-color: rgba(245, 158, 11, 0.4) !important;
}

body.high-contrast .dip-badge.available,
body.high-contrast .dip-badge.buried {
    background: rgba(16, 185, 129, 0.22) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

body.high-contrast .dip-badge.occupied {
    background: rgba(148, 163, 184, 0.22) !important;
    color: #cbd5e1 !important;
    border-color: rgba(148, 163, 184, 0.4) !important;
}

/* ==========================================================================
   TOPBAR PROFILE OVAL & PROFESSIONAL CUSTOM DROPDOWN
   ========================================================================== */
.topbar-profile-wrapper {
    position: relative;
    display: inline-block;
}

.topbar-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 14px 5px 7px;
    background: var(--gray-100, #f1f5f9);
    border: 1.5px solid #e2e8f0;
    border-radius: 9999px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--dark, #0f172a);
    cursor: pointer;
    transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.topbar-user-pill:hover {
    background: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.topbar-user-pill:focus-visible {
    box-shadow: 0 0 0 3px rgba(30, 86, 49, 0.25);
    border-color: #1e5631;
}

.topbar-profile-wrapper.open .topbar-user-pill {
    background: #e2e8f0;
    border-color: #1e5631;
    box-shadow: 0 0 0 3px rgba(30, 86, 49, 0.16);
}

.user-avatar-circle {
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1e5631, #2d7a46);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(30, 86, 49, 0.25);
}

.user-avatar-circle .user-status-dot {
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #22c55e;
    border: 2px solid #ffffff;
    box-shadow: 0 0 4px rgba(34, 197, 94, 0.6);
}

.user-pill-name {
    max-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit;
    font-weight: 600;
}

.topbar-user-pill .role-tag {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 8px;
    border-radius: 9999px;
    background: #e0f2fe;
    color: #0369a1;
}

.topbar-user-pill .profile-chevron {
    font-size: 0.72rem;
    color: #64748b;
    margin-left: 2px;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), color 0.2s ease;
}

.topbar-profile-wrapper.open .profile-chevron {
    transform: rotate(180deg);
    color: #1e5631;
}

/* Floating Dropdown Card */
.topbar-profile-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 300px;
    background: #ffffff;
    border-radius: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.03);
    padding: 10px;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px) scale(0.96);
    transform-origin: top right;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.topbar-profile-wrapper.open .topbar-profile-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: linear-gradient(135deg, rgba(30, 86, 49, 0.08), rgba(217, 119, 6, 0.05));
    border-radius: 12px;
    border: 1px solid rgba(30, 86, 49, 0.08);
}

.profile-header-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, #1e5631, #15803d);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(30, 86, 49, 0.25);
}

.profile-header-info {
    flex: 1;
    min-width: 0;
}

.profile-header-name {
    font-weight: 700;
    font-size: 0.94rem;
    color: #0f172a;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
}

.profile-role-badge {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 7px;
    border-radius: 9999px;
    background: #e0f2fe;
    color: #0369a1;
}

.profile-status-text {
    font-size: 0.72rem;
    color: #16a34a;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.profile-status-text i {
    font-size: 0.45rem;
}

.profile-dropdown-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 8px 0;
}

.profile-dropdown-menu,
.profile-dropdown-footer {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    border: none;
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    transition: background 0.16s ease, transform 0.16s ease;
    color: inherit;
    text-decoration: none;
    outline: none;
}

.profile-menu-item:hover,
.profile-menu-item:focus-visible {
    background: #f8fafc;
}

.menu-item-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-menu-item:hover .menu-item-icon-box {
    transform: scale(1.08);
}

.theme-icon-box {
    background: #f1f5f9;
    color: #475569;
}

.key-icon-box {
    background: #fef3c7;
    color: #d97706;
}

.logout-icon-box {
    background: #fee2e2;
    color: #ef4444;
}

.menu-item-text {
    flex: 1;
    min-width: 0;
}

.menu-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2;
}

.menu-item-sub {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 2px;
}

.menu-trail-arrow {
    font-size: 0.75rem;
    color: #cbd5e1;
    transition: transform 0.2s ease, color 0.2s ease;
}

.profile-menu-item:hover .menu-trail-arrow {
    transform: translateX(3px);
    color: #64748b;
}

/* Custom Interactive Switch Slider */
.menu-switch-pill {
    position: relative;
    width: 40px;
    height: 22px;
    border-radius: 9999px;
    background: #cbd5e1;
    transition: background 0.25s ease;
    flex-shrink: 0;
}

.menu-switch-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.profile-menu-item.acc-contrast-toggle.active .menu-switch-pill,
body.high-contrast .profile-menu-item.acc-contrast-toggle .menu-switch-pill {
    background: #10b981;
}

.profile-menu-item.acc-contrast-toggle.active .menu-switch-thumb,
body.high-contrast .profile-menu-item.acc-contrast-toggle .menu-switch-thumb {
    transform: translateX(18px);
}

/* Logout Button Accent */
.profile-logout-btn:hover {
    background: #fff1f2;
}

.profile-logout-btn:hover .menu-item-title {
    color: #e11d48;
}

.profile-logout-btn:hover .menu-item-sub {
    color: #f43f5e;
}

.profile-logout-btn:hover .menu-trail-arrow {
    color: #e11d48;
    transform: translateX(3px);
}

/* High Contrast / Dark Mode Overrides for Profile Components */
body.high-contrast .topbar-user-pill {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

body.high-contrast .topbar-user-pill:hover,
body.high-contrast .topbar-profile-wrapper.open .topbar-user-pill {
    background: #27354a !important;
    border-color: #4ade80 !important;
}

body.high-contrast .user-pill-name {
    color: #f8fafc !important;
}

body.high-contrast .topbar-user-pill .role-tag {
    background: #1e3a5f !important;
    color: #38bdf8 !important;
    border: 1px solid #0284c7 !important;
}

body.high-contrast .topbar-user-pill .profile-chevron {
    color: #94a3b8 !important;
}

body.high-contrast .topbar-profile-wrapper.open .profile-chevron {
    color: #4ade80 !important;
}

body.high-contrast .user-avatar-circle .user-status-dot {
    border-color: #1e293b !important;
}

body.high-contrast .topbar-profile-dropdown {
    background: #0f172a !important;
    border-color: #334155 !important;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.75) !important;
}

body.high-contrast .profile-dropdown-header {
    background: #1e293b !important;
    border-color: #334155 !important;
}

body.high-contrast .profile-header-name {
    color: #f8fafc !important;
}

body.high-contrast .profile-dropdown-divider {
    background: #28374f !important;
}

body.high-contrast .profile-menu-item:hover,
body.high-contrast .profile-menu-item:focus-visible {
    background: #1e293b !important;
}

body.high-contrast .menu-item-title {
    color: #f8fafc !important;
}

body.high-contrast .menu-item-sub {
    color: #94a3b8 !important;
}

body.high-contrast .theme-icon-box {
    background: #334155 !important;
    color: #facc15 !important;
}

body.high-contrast .key-icon-box {
    background: rgba(217, 119, 6, 0.2) !important;
    color: #fcd34d !important;
}

body.high-contrast .logout-icon-box {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #fca5a5 !important;
}

body.high-contrast .menu-trail-arrow {
    color: #475569 !important;
}

body.high-contrast .profile-menu-item:hover .menu-trail-arrow {
    color: #94a3b8 !important;
}

body.high-contrast .profile-logout-btn:hover {
    background: rgba(239, 68, 68, 0.15) !important;
}

body.high-contrast .profile-logout-btn:hover .menu-item-title {
    color: #f87171 !important;
}

body.high-contrast .profile-logout-btn:hover .menu-item-sub {
    color: #fca5a5 !important;
}

/* ===== 22. DATA IMPORT & MIGRATION PANEL IN DARK MODE ===== */
body.high-contrast #importDropZone {
    background: #0f172a !important;
    border-color: #475569 !important;
}

body.high-contrast #importDropZone:hover {
    border-color: #facc15 !important;
    background: rgba(250, 204, 21, 0.05) !important;
}

body.high-contrast #importDropZone h3 {
    color: #f8fafc !important;
}

body.high-contrast #importDropZone p {
    color: #94a3b8 !important;
}

body.high-contrast #importFilePreview {
    background: #062817 !important;
    border-color: #166534 !important;
}

body.high-contrast #importFileName {
    color: #f8fafc !important;
}

body.high-contrast #importFileSize {
    color: #94a3b8 !important;
}

body.high-contrast #page-records .data-card div[style*="background:var(--gray-50)"] {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
}

body.high-contrast #page-records .data-card strong {
    color: #f8fafc !important;
}

body.high-contrast #page-records .data-card span[style*="color:var(--dark-500)"] {
    color: #94a3b8 !important;
}

body.high-contrast #importResultBox .import-stat-box {
    background: #0f172a !important;
    border-color: #334155 !important;
}

body.high-contrast #importResultBox .import-stat-box div:last-child {
    color: #94a3b8 !important;
}

/* Landing Page Map Location Bar High Contrast Fix */
body.high-contrast .map-info-bar,
.high-contrast .map-info-bar {
    background: #061e11 !important;
    color: #ffffff !important;
    border-bottom: 2px solid var(--gold-500) !important;
}

body.high-contrast .map-info-item,
body.high-contrast .map-info-item span,
.high-contrast .map-info-item span {
    color: #ffffff !important;
    font-weight: 600 !important;
}

/* Clerk Dashboard Active Phase Indicator Banner in Dark Mode */
body.high-contrast #activePhaseIndicatorBanner {
    background: #0f172a !important;
    border-bottom-color: #334155 !important;
}

body.high-contrast #activePhaseBannerDesc {
    color: #cbd5e1 !important;
}

/* ===== SIDEBAR BACKDROP & MOBILE TOPBAR ERGONOMICS ===== */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

@media (max-width: 768px) {
    .topbar {
        padding: 0 12px !important;
        gap: 8px !important;
        left: 0 !important;
    }
    .topbar-left {
        gap: 8px !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        overflow: hidden !important;
    }
    .topbar-title {
        font-size: 0.95rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-width: 0 !important;
        line-height: 1.2 !important;
    }
    .topbar-right {
        gap: 8px !important;
        flex-shrink: 0 !important;
    }
    .topbar-user-pill {
        padding: 4px 8px 4px 4px !important;
        gap: 6px !important;
        flex-shrink: 0 !important;
        max-width: 140px !important;
    }
    .topbar-user-pill .user-pill-name {
        display: none !important; /* Hide long name on mobile so CLERK/badge is never cropped */
    }
    .topbar-user-pill .user-avatar-circle {
        width: 28px !important;
        height: 28px !important;
        font-size: 0.85rem !important;
    }
    .topbar-user-pill .role-tag {
        font-size: 0.62rem !important;
        padding: 2px 6px !important;
    }
    .topbar-user-pill .profile-chevron {
        display: none !important;
    }
    .topbar-profile-dropdown {
        width: calc(100vw - 24px) !important;
        max-width: 320px !important;
        right: 0 !important;
    }
}

/* Sidebar footer is strictly mobile-only (hamburger drawer) - never visible on desktop */
.sidebar-footer {
    display: none !important;
}

@media (max-width: 768px) {
    .sidebar-footer {
        display: block !important;
    }
}

/* Universal high-priority centered modal overlay */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 99999 !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}
.modal-overlay.active {
    display: flex !important;
}
.modal-overlay .modal-box {
    margin: auto !important;
    position: relative !important;
    width: 90% !important;
}
.modal-overlay#logout-modal .modal-box,
.modal-overlay#logoutModal .modal-box,
.modal-overlay#profileLogoutModal .modal-box,
.modal-overlay.confirm-modal .modal-box {
    max-width: 400px !important;
}

/* Ensure notifications & toasts are always in FRONT of modals and backdrops */
.toast,
.notification-toast,
#toast,
body.high-contrast .toast {
    z-index: 100005 !important;
}

/* ===== 25. CALENDAR (High Contrast / Dark Mode) ===== */
body.high-contrast .calendar-wrapper {
    background: #111a28 !important;
    border-color: #26354a !important;
}
body.high-contrast .calendar-header {
    background: #091a10 !important;
    border-bottom: 1px solid #1f3525 !important;
    color: #ffffff !important;
}
body.high-contrast .calendar-header h3 {
    color: #fde047 !important;
}
body.high-contrast .calendar-header button {
    background: rgba(255, 255, 255, 0.12) !important;
    color: #f8fafc !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}
body.high-contrast .calendar-header button:hover {
    background: rgba(255, 255, 255, 0.22) !important;
}
body.high-contrast .calendar-grid {
    background: #243449 !important;
}
body.high-contrast .calendar-day-header {
    background: #162234 !important;
    color: #94a3b8 !important;
}
body.high-contrast .calendar-day {
    background: #111a28 !important;
    color: #f8fafc !important;
}
body.high-contrast .calendar-day .day-num {
    color: #cbd5e1 !important;
    font-weight: 700 !important;
}
body.high-contrast .calendar-day.other-month {
    background: #0d1522 !important;
}
body.high-contrast .calendar-day.other-month .day-num {
    color: #475569 !important;
}

/* Today cell: clean dark background with vivid emerald inner glow, NEVER blinding white/mint! */
body.high-contrast .calendar-day.today {
    background: rgba(34, 197, 94, 0.12) !important;
    box-shadow: inset 0 0 0 2px #22c55e !important;
}
body.high-contrast .calendar-day.today .day-num {
    color: #4ade80 !important;
    font-weight: 800 !important;
}

/* Calendar Event Pills: crisp, readable text on elegant tinted backgrounds */
body.high-contrast .calendar-day .cal-event {
    background: rgba(245, 158, 11, 0.22) !important;
    color: #fef08a !important;
    border: 1px solid rgba(245, 158, 11, 0.5) !important;
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}
body.high-contrast .calendar-day.today .cal-event {
    background: rgba(245, 158, 11, 0.28) !important;
    color: #fef08a !important;
    border: 1px solid #f59e0b !important;
}
body.high-contrast .calendar-day .cal-event.completed {
    background: rgba(34, 197, 94, 0.22) !important;
    color: #86efac !important;
    border: 1px solid rgba(34, 197, 94, 0.5) !important;
}
body.high-contrast .calendar-day .cal-event.cancelled {
    background: rgba(239, 68, 68, 0.22) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.5) !important;
}
body.high-contrast .cal-tooltip {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    color: #f8fafc !important;
    box-shadow: 0 12px 40px rgba(0,0,0,0.7) !important;
}
body.high-contrast .cal-tooltip .tt-name {
    color: #fde047 !important;
}
body.high-contrast .cal-tooltip .tt-detail {
    color: #94a3b8 !important;
}

/* ===== 26. CLERK NICHE GRID (Grave Setup & Grid High Contrast) ===== */
body.high-contrast .clerk-niche-cell.niche-available {
    background: rgba(16, 185, 129, 0.18) !important;
    border: 1.5px solid rgba(52, 211, 153, 0.45) !important;
    color: #4ade80 !important;
}
body.high-contrast .clerk-niche-cell.niche-available .niche-badge {
    color: #86efac !important;
}
body.high-contrast .clerk-niche-cell.niche-available:hover {
    background: rgba(16, 185, 129, 0.35) !important;
    border-color: #34d399 !important;
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.35) !important;
    color: #ffffff !important;
}

body.high-contrast .clerk-niche-cell.niche-shared {
    background: rgba(59, 130, 246, 0.18) !important;
    border: 1.5px solid rgba(96, 165, 250, 0.45) !important;
    color: #60a5fa !important;
}
body.high-contrast .clerk-niche-cell.niche-shared .niche-badge {
    color: #93c5fd !important;
}
body.high-contrast .clerk-niche-cell.niche-shared:hover {
    background: rgba(59, 130, 246, 0.35) !important;
    border-color: #60a5fa !important;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.35) !important;
    color: #ffffff !important;
}

body.high-contrast .clerk-niche-cell.niche-occupied {
    background: #1e293b !important;
    border: 1.5px solid #475569 !important;
    color: #e2e8f0 !important;
}
body.high-contrast .clerk-niche-cell.niche-occupied .niche-badge {
    color: #cbd5e1 !important;
}
body.high-contrast .clerk-niche-cell.niche-occupied:hover {
    background: #334155 !important;
    border-color: #94a3b8 !important;
    box-shadow: 0 0 12px rgba(100, 116, 139, 0.35) !important;
    color: #ffffff !important;
}

body.high-contrast .clerk-niche-cell.niche-unburied {
    background: rgba(245, 158, 11, 0.22) !important;
    border: 1.5px solid rgba(251, 191, 36, 0.5) !important;
    color: #fbbf24 !important;
}
body.high-contrast .clerk-niche-cell.niche-unburied .niche-badge {
    color: #fef08a !important;
}
body.high-contrast .clerk-niche-cell.niche-unburied:hover {
    background: rgba(245, 158, 11, 0.38) !important;
    border-color: #facc15 !important;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.35) !important;
    color: #ffffff !important;
}

body.high-contrast .clerk-niche-cell.niche-empty {
    background: #111a28 !important;
    border: 1.5px solid #26354a !important;
    color: #64748b !important;
}
body.high-contrast .clerk-niche-cell.niche-empty:hover {
    background: #1e293b !important;
    border-color: #475569 !important;
}

body.high-contrast .clerk-level-label {
    background: rgba(16, 185, 129, 0.14) !important;
    color: #4ade80 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}




