/* ============================================
   MASJID ACCOUNTS — DESIGN SYSTEM v3.0
   ============================================
   1. DESIGN TOKENS
   2. DARK MODE TOKENS
   3. RESET & BASE
   4. TYPOGRAPHY
   5. LAYOUT
   6. NAVIGATION
   7. COMPONENTS
   8. UTILITIES
   9. PAGE-SPECIFIC
   10. RESPONSIVE
   ============================================ */

/* ── 1. DESIGN TOKENS ──────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Primary: Teal */
    --primary: #00897B;
    --primary-dark: #00695C;
    --primary-light: rgba(0, 137, 123, 0.1);
    --primary-hover: #00695C;

    /* Sidebar */
    --sidebar-bg: #004D40;
    --sidebar-hover: #00695C;
    --sidebar-active: #00897B;
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 70px;

    /* Surfaces */
    --bg-body: #f1f5f9;
    --bg-surface: #ffffff;
    --bg-surface-raised: #f8fafc;

    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    /* Semantic Colors */
    --success: #16a34a;
    --success-light: rgba(22, 163, 74, 0.1);
    --warning: #d97706;
    --warning-light: rgba(217, 119, 6, 0.1);
    --error: #dc2626;
    --error-light: rgba(220, 38, 38, 0.1);
    --info: #00897B;
    --info-light: rgba(0, 137, 123, 0.1);

    /* Borders */
    --border-color: #e2e8f0;
    --border-radius-sm: 0.375rem;
    --border-radius-md: 0.5rem;
    --border-radius-lg: 0.75rem;
    --border-radius-xl: 1rem;
    --border-radius-2xl: 1.25rem;
    --border-radius-full: 9999px;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    /* Typography Scale */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-xs: 0.6875rem;
    --text-sm: 0.75rem;
    --text-base: 0.8125rem;
    --text-lg: 0.875rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.25rem;
    --text-3xl: 1.5rem;
    --text-4xl: 1.75rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Legacy aliases (backward compat) */
    --radius-md: var(--border-radius-lg);
    --radius-lg: var(--border-radius-xl);
    --radius-xl: var(--border-radius-2xl);
    --text-main: var(--text-primary);
    --bg-body-old: var(--bg-body);
}

/* ── 2. DARK MODE TOKENS ───────────────────── */
[data-theme="dark"] {
    --primary: #4DB6AC;
    --primary-dark: #26A69A;
    --primary-light: rgba(77, 182, 172, 0.15);
    --primary-hover: #26A69A;

    --sidebar-bg: #00251A;
    --sidebar-hover: #004D40;
    --sidebar-active: #4DB6AC;

    --bg-body: #0D1F1C;
    --bg-surface: #162E2A;
    --bg-surface-raised: #1E3935;

    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-main: #f1f5f9;

    --border-color: #334155;

    --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.2);
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.3), 0 1px 2px -1px rgb(0 0 0 / 0.2);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.3), 0 2px 4px -2px rgb(0 0 0 / 0.2);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3), 0 4px 6px -4px rgb(0 0 0 / 0.2);

    --success: #22c55e;
    --success-light: rgba(34, 197, 94, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --error: #ef4444;
    --error-light: rgba(239, 68, 68, 0.15);
    --info: #4DB6AC;
    --info-light: rgba(77, 182, 172, 0.15);
}

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

[data-theme="dark"] .card,
[data-theme="dark"] .card-premium { background: var(--bg-surface); border-color: var(--border-color); color: var(--text-primary); }

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

[data-theme="dark"] .table thead th { background-color: var(--bg-surface-raised); color: var(--text-muted); border-color: var(--border-color); }
[data-theme="dark"] .table tbody td { color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .table-hover tbody tr:hover { background-color: var(--bg-surface-raised); }
[data-theme="dark"] .table-warning { background-color: rgba(217, 119, 6, 0.1) !important; }

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select { background-color: var(--bg-surface-raised); border-color: var(--border-color); color: var(--text-primary); }
[data-theme="dark"] .form-control::placeholder { color: var(--text-muted); }
[data-theme="dark"] .form-label { color: var(--text-secondary); }

[data-theme="dark"] .modal-content { background-color: var(--bg-surface); color: var(--text-primary); border-color: var(--border-color); }
[data-theme="dark"] .modal-header { border-color: var(--border-color); }
[data-theme="dark"] .modal-footer { border-color: var(--border-color); }
[data-theme="dark"] .btn-close { filter: invert(1); }

[data-theme="dark"] .bg-light { background-color: var(--bg-surface-raised) !important; }
[data-theme="dark"] .bg-white { background-color: var(--bg-surface) !important; }
[data-theme="dark"] .text-dark { color: var(--text-primary) !important; }
[data-theme="dark"] .text-muted { color: var(--text-muted) !important; }
[data-theme="dark"] .text-secondary { color: var(--text-secondary) !important; }
[data-theme="dark"] .border-bottom { border-color: var(--border-color) !important; }
[data-theme="dark"] .border { border-color: var(--border-color) !important; }
[data-theme="dark"] .list-group-item { background-color: var(--bg-surface); border-color: var(--border-color); color: var(--text-primary); }

[data-theme="dark"] .alert { border-color: var(--border-color); }
[data-theme="dark"] .alert-warning { background-color: var(--warning-light); color: var(--warning); border-color: rgba(217, 119, 6, 0.3); }
[data-theme="dark"] .alert-primary { background-color: var(--primary-light); color: var(--primary); }

[data-theme="dark"] .page-header,
[data-theme="dark"] .glass-dark { background: var(--sidebar-bg) !important; }

[data-theme="dark"] .dropdown-menu { background-color: var(--bg-surface); border-color: var(--border-color); }
[data-theme="dark"] .dropdown-item { color: var(--text-primary); }
[data-theme="dark"] .dropdown-item:hover { background-color: var(--bg-surface-raised); }

[data-theme="dark"] hr { border-color: var(--border-color); }
[data-theme="dark"] .progress { background-color: var(--bg-surface-raised); }
[data-theme="dark"] .input-group-text { background-color: var(--bg-surface-raised); border-color: var(--border-color); color: var(--text-secondary); }

/* ── 3. RESET & BASE ──────────────────────── */
*,
*::before,
*::after { box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-size: var(--text-lg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ── 4. TYPOGRAPHY ─────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); font-weight: 600; }
h6 { font-size: var(--text-base); font-weight: 600; }

.fs-xs { font-size: var(--text-xs) !important; }
.fs-sm { font-size: var(--text-sm) !important; }
.fs-base { font-size: var(--text-base) !important; }
.fs-lg { font-size: var(--text-lg) !important; }

.letter-spacing-1 { letter-spacing: 0.05em; }
.letter-spacing-2 { letter-spacing: 0.1em; }

/* ── 5. LAYOUT ─────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    transition: all var(--transition-slow);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Desktop icon-only collapse handled in @media (min-width: 992px) below */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin var(--transition-slow);
    min-width: 0;
}

.main-content.expanded { margin-left: 0; }

.mt-n5 {
    margin-top: -6rem !important;
    pointer-events: none;
}

.mt-n5 > * { pointer-events: auto; }

/* ── 6. NAVIGATION ─────────────────────────── */
.sidebar-header {
    padding: 1.25rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

/* Sidebar collapse toggle button (desktop only) */
.sidebar-collapse-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: rgba(255, 255, 255, 0.65);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background var(--transition-base), color var(--transition-base);
}
.sidebar-collapse-btn:hover { background: rgba(255,255,255,0.2); color: white; }
.sidebar-collapse-btn svg { width: 15px; height: 15px; }

.sidebar-brand {
    text-decoration: none;
    display: flex;
    align-items: center;
    color: white !important;
    gap: 0.75rem;
}

.sidebar-brand:hover { color: white !important; }

.sidebar-content {
    flex: 1;
    padding: 0.75rem 0;
    overflow-y: auto;
}

.sidebar-content::-webkit-scrollbar { width: 4px; }
.sidebar-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.15);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-nav {
    list-style: none;
    padding: 0 0.75rem;
    margin: 0;
}

.sidebar-item { margin-bottom: 2px; }

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.625rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--border-radius-lg);
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: var(--text-base);
    gap: 0.75rem;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.sidebar-link.active {
    background: var(--sidebar-active);
    color: white;
    font-weight: 600;
}

.sidebar-link svg,
.sidebar-link i {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    stroke-width: 2;
}

/* Sidebar collapsible submenu */
.sidebar-submenu { padding-left: 0.75rem; list-style: none; margin: 0; }
.sidebar-sublink { font-size: 0.875rem; padding: 0.4rem 1rem; }
.sidebar-chevron { transition: transform 0.25s ease; width: 16px !important; height: 16px !important; }
.sidebar-link:not(.collapsed) .sidebar-chevron { transform: rotate(180deg); }

/* Sidebar toggle (mobile) */
.sidebar-toggler {
    display: none;
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    background: var(--primary);
    color: white;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-full);
    box-shadow: var(--shadow-lg);
    align-items: center;
    justify-content: center;
    transition: background var(--transition-base);
    cursor: pointer;
}

.sidebar-toggler:hover { background: var(--primary-dark); }
.sidebar-toggler svg { width: 20px; height: 20px; }

/* Dark mode toggle */
.sidebar-toggle-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.sidebar-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.375rem 0.5rem;
    font-size: var(--text-xs);
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
}

.sidebar-toggle-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.12);
}

.sidebar-toggle-btn svg { width: 14px; height: 14px; }

/* Navbar (admin pages) */
.navbar {
    padding: 0.75rem 0;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
}

.navbar.sticky-top { z-index: 1100 !important; }

.navbar-brand {
    font-weight: 700;
    font-size: 1.125rem;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── 7. COMPONENTS ─────────────────────────── */

/* Cards */
.card-premium {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-2xl);
    background: var(--bg-surface);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-base);
}

.card-premium:hover { box-shadow: var(--shadow-sm); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body { padding: 1.25rem; }

.card-footer {
    background: transparent;
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1.25rem;
}

.card-title-pill {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    font-size: var(--text-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--border-radius-full);
    margin-bottom: 0.375rem;
}

/* Tables */
.table { margin-bottom: 0; }

.table thead th {
    background-color: var(--bg-surface-raised);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: var(--text-xs);
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    font-size: var(--text-base);
}

.table-hover tbody tr:hover { background-color: var(--bg-surface-raised); }

.th-sortable {
    cursor: pointer;
    user-select: none;
}
.th-sortable:hover { color: var(--primary); text-decoration: underline; }

/* Buttons */
.btn {
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-md);
    transition: all var(--transition-base);
    font-size: var(--text-base);
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }

.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-light {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-light:hover {
    background: var(--bg-surface-raised);
    border-color: var(--text-muted);
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.375rem 0.75rem;
}

.btn-ghost:hover { background: var(--bg-surface-raised); color: var(--text-primary); }

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-outline-primary:hover {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

[data-theme="dark"] .btn-light {
    background: var(--bg-surface-raised);
    border-color: var(--border-color);
    color: var(--text-primary);
}
[data-theme="dark"] .btn-light:hover { background: rgba(255,255,255,0.1); }
[data-theme="dark"] .btn-outline-light { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.7); }
[data-theme="dark"] .btn-outline-light:hover { background: rgba(255,255,255,0.1); color: white; }

/* Form Controls */
.form-control,
.form-select {
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    font-size: var(--text-base);
    transition: border-color var(--transition-base), box-shadow var(--transition-base);
    background-color: var(--bg-surface);
    color: var(--text-primary);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-label {
    font-weight: 500;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-text { font-size: var(--text-xs); color: var(--text-muted); }

/* Badges */
.badge {
    padding: 0.375em 0.625em;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    font-size: var(--text-xs);
    letter-spacing: 0.02em;
}

/* Icon wash */
.icon-wash {
    width: 42px;
    height: 42px;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.icon-wash svg { width: 20px; height: 20px; }

.icon-wash-primary { background: var(--primary-light); color: var(--primary); }
.icon-wash-success { background: var(--success-light); color: var(--success); }
.icon-wash-danger { background: var(--error-light); color: var(--error); }
.icon-wash-warning { background: var(--warning-light); color: var(--warning); }
.icon-wash-info { background: var(--info-light); color: var(--info); }

/* Modals */
.modal-content {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-body { padding: 1.25rem; }
.modal-footer { padding: 0.75rem 1.25rem; border-top: 1px solid var(--border-color); }

/* Alerts */
.alert {
    border-radius: var(--border-radius-lg);
    font-size: var(--text-base);
    padding: 0.75rem 1rem;
}

/* Feather icon sizing */
.icon-sm { width: 16px; height: 16px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 32px; height: 32px; }
.icon-2xl { width: 48px; height: 48px; }

/* Loading states */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface-raised) 25%, var(--border-color) 50%, var(--bg-surface-raised) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-md);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ── 8. UTILITIES ──────────────────────────── */

/* Color backgrounds */
.bg-primary-light { background-color: var(--primary-light) !important; }
.bg-secondary-light { background-color: rgba(15, 23, 42, 0.05) !important; }
.bg-success-light { background-color: var(--success-light) !important; }
.bg-danger-light { background-color: var(--error-light) !important; }
.bg-warning-light { background-color: var(--warning-light) !important; }
.bg-info-light { background-color: var(--info-light) !important; }

.bg-gradient-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.bg-gradient-emerald { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.bg-gradient-indigo { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }

/* Text colors */
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-error { color: var(--error) !important; }
.text-info { color: var(--info) !important; }
.text-indigo { color: var(--primary) !important; }

/* Semantic badge backgrounds */
.bg-primary { background-color: var(--primary) !important; }
.bg-success { background-color: var(--success) !important; }
.bg-danger { background-color: var(--error) !important; }

/* Z-Index */
.z-0 { z-index: 0 !important; }
.z-1 { z-index: 10 !important; }
.z-2 { z-index: 20 !important; }
.z-3 { z-index: 30 !important; }
.z-n1 { z-index: -1 !important; }

/* Glassmorphism */
.glass {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-dark {
    background: var(--sidebar-bg) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in { animation: fadeIn 0.4s ease-out forwards; }

.hover-opacity-100:hover { opacity: 1 !important; }
.transition-all { transition: all var(--transition-base); }

/* Stat card glow effect */
.stat-card { position: relative; overflow: hidden; }
.stat-card::after {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

/* Misc utilities */
.bg-indigo-light { background-color: var(--primary-light); }
.bg-rose-light { background-color: var(--primary-light); }

/* ── 9. PAGE-SPECIFIC ──────────────────────── */

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background-color: var(--primary);
    position: relative;
    overflow: hidden;
}

.login-card {
    border: none;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--bg-surface);
}

.login-left {
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-right {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 3rem;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-right::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('https://images.unsplash.com/photo-1564121211835-e88c852648ab?auto=format&fit=crop&q=80') center/cover;
    opacity: 0.1;
    mix-blend-mode: overlay;
}

[data-theme="dark"] .login-page { background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%); }
[data-theme="dark"] .login-card { background: var(--bg-surface); }

/* Split-screen login layout */
.display-screen {
    background: linear-gradient(to right, var(--primary) 60%, #ffffff 40%);
    min-height: 100vh;
}
.display-text {
    font-size: 28px;
    font-weight: bold;
    color: white;
}

/* ── Desktop sidebar icon-only collapse ── */
@media (min-width: 992px) {
    #sidebar.collapsed {
        width: var(--sidebar-collapsed-width);
    }
    .main-content.sidebar-collapsed {
        margin-left: var(--sidebar-collapsed-width);
    }
    /* Hide text labels, submenus, toggles */
    #sidebar.collapsed .sidebar-brand-text,
    #sidebar.collapsed .sidebar-link-text,
    #sidebar.collapsed .sidebar-chevron,
    #sidebar.collapsed .sidebar-submenu,
    #sidebar.collapsed .sidebar-toggle-group,
    #sidebar.collapsed .user-details {
        display: none !important;
    }
    /* Center icons */
    #sidebar.collapsed .sidebar-link {
        justify-content: center;
        padding: 0.625rem 0;
        gap: 0;
    }
    #sidebar.collapsed .sidebar-brand {
        justify-content: center;
    }
    #sidebar.collapsed .sidebar-header {
        padding: 1rem 0;
        justify-content: center;
        flex-direction: column;
    }
    #sidebar.collapsed .sidebar-nav {
        padding: 0 0.5rem;
    }
    #sidebar.collapsed .sidebar-footer {
        padding: 0.5rem;
    }
    #sidebar.collapsed .sidebar-footer .rounded-3 {
        display: flex;
        justify-content: center;
        background: transparent !important;
        border: none !important;
    }
    /* Keep the collapse button visible and centred when collapsed */
    #sidebar.collapsed .sidebar-collapse-btn {
        margin-top: 0;
    }
}

/* Print */
@media print {
    #sidebar, .sidebar-toggler, .sidebar-toggle-group,
    .main-content > header, .no-print { display: none !important; }

    .main-content { margin-left: 0 !important; }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    .card-premium { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
    .table thead th { background: #f0f0f0 !important; }
}

/* ── 10. RESPONSIVE ────────────────────────── */

/* Sidebar backdrop overlay (mobile) */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    animation: backdropFadeIn 0.25s ease;
}
.sidebar-backdrop.active { display: block; }
@keyframes backdropFadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 991.98px) {
    #sidebar {
        left: calc(-1 * var(--sidebar-width));
        transition: left 0.25s ease, box-shadow 0.25s ease;
        box-shadow: none;
    }
    #sidebar.active {
        left: 0;
        box-shadow: 6px 0 24px rgba(0, 0, 0, 0.25);
    }
    .main-content { margin-left: 0 !important; }
    .sidebar-toggler {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    /* Header padding on mobile — leave room for hamburger button */
    .main-content > header .container { padding-right: 4rem; }
}

@media (max-width: 767.98px) {
    .login-right { display: none; }
    .login-left { padding: 2rem; }

    h1 { font-size: var(--text-3xl); }
    h2 { font-size: var(--text-2xl); }

    .card-body { padding: 1rem; }
    .card-header { padding: 0.75rem 1rem; }

    /* Touch-friendly minimum target sizes */
    .btn { min-height: 40px; }
    .btn-sm { min-height: 36px; padding: 0.35rem 0.75rem; }

    /* Mobile-friendly modals */
    .modal-dialog { margin: 0.75rem; }
    .modal-dialog.modal-sm { margin: 0.75rem auto; }

    /* Stack page header buttons vertically */
    .main-content > header .d-flex.gap-2 { flex-wrap: wrap; }

    /* Better pagination on mobile */
    .pagination .page-link { padding: 0.4rem 0.65rem; font-size: 0.85rem; }
}

@media (max-width: 575.98px) {
    .container, .container-fluid { padding-left: 0.85rem; padding-right: 0.85rem; }

    h1 { font-size: var(--text-2xl); }
    h2 { font-size: var(--text-xl); }

    /* Compact card padding on small phones */
    .card-body { padding: 0.75rem; }
    .card-header { padding: 0.6rem 0.75rem; }

    /* Smaller table font — rows still legible */
    .table-responsive { font-size: 0.78rem; }
    .table td, .table th { padding: 0.45rem 0.4rem; }

    .btn { font-size: var(--text-sm); padding: 0.4rem 0.75rem; }
    .btn-sm { font-size: 0.75rem; }

    /* Hamburger position fine-tune for very small phones */
    .sidebar-toggler { top: 0.6rem; right: 0.6rem; width: 40px; height: 40px; }

    /* KPI stat cards — full width stacking already via Bootstrap col */
    /* Full-width search bars on small phones */
    .input-group { width: 100%; }

    /* Reduce main content top padding */
    main.container { padding-top: 3.5rem !important; }
    main.py-5 { padding-top: 3.5rem !important; padding-bottom: 2rem !important; }

    /* Form inputs fill full width */
    .form-control, .form-select { font-size: 0.9rem; }
}

/* ── Bootstrap colour overrides ── */
.bg-secondary  { background-color: var(--sidebar-bg) !important; }
.bg-dark       { background-color: var(--sidebar-bg) !important; }
.btn-secondary, .btn-outline-secondary:hover { background-color: var(--sidebar-bg) !important; border-color: var(--sidebar-bg) !important; color: #fff !important; }
.btn-outline-secondary { color: var(--sidebar-bg) !important; border-color: var(--sidebar-bg) !important; }
.btn-dark, .btn-outline-dark:hover { background-color: var(--sidebar-bg) !important; border-color: var(--sidebar-bg) !important; color: #fff !important; }
.btn-outline-dark { color: var(--sidebar-bg) !important; border-color: var(--sidebar-bg) !important; }
.border-secondary { border-color: var(--primary) !important; }
.text-bg-secondary { background-color: var(--sidebar-bg) !important; color: #fff !important; }
.badge.bg-secondary { background-color: var(--sidebar-bg) !important; }
.badge.bg-dark      { background-color: var(--sidebar-bg) !important; }

/* ── Theme Colour Dot (admin dashboard table) ─────────────── */
.theme-dot { width:10px; height:10px; display:inline-block; border-radius:50%; background:var(--primary); flex-shrink:0; }
.theme-dot-green  { background:#2E7D32; }
.theme-dot-blue   { background:#1565C0; }
.theme-dot-purple { background:#6A1B9A; }
.theme-dot-teal   { background:#00695C; }
.theme-dot-orange { background:#E65100; }
/* pink is default — covered by .theme-dot base */

/* ── Theme Swatch Picker ───────────────────────────────────── */
.theme-swatch-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.theme-radio { display: none; }
.theme-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s, border-color 0.15s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.theme-swatch:hover { transform: scale(1.12); }
.theme-check-icon { width: 18px; height: 18px; color: white; opacity: 0; transition: opacity 0.15s; }
.theme-radio:checked + .theme-swatch { border-color: #fff; outline: 3px solid rgba(0,0,0,0.35); }
.theme-radio:checked + .theme-swatch .theme-check-icon { opacity: 1; }
.theme-label { font-weight: 600; color: #555; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.5px; }
