body { 
            font-family: 'Inter', sans-serif;
            --bg-primary: #0F172A;
            --bg-secondary: #1E293B;
            --bg-card: rgba(30,41,59,0.4);
            --bg-card-hover: rgba(30,41,59,0.6);
            --bg-sidebar: #0F172A;
            --bg-header: rgba(15,23,42,0.8);
            --text-primary: #FFFFFF;
            --text-secondary: #94A3B8;
            --text-muted: #64748B;
            --border-color: rgba(255,255,255,0.06);
            --border-hover: rgba(255,255,255,0.1);
            --input-bg: rgba(15,23,42,0.5);
            transition: background-color 0.3s, color 0.3s;
        }
        
        body.light-theme {
            --bg-primary: #F8FAFC;
            --bg-secondary: #F1F5F9;
            --bg-card: rgba(255,255,255,0.8);
            --bg-card-hover: rgba(255,255,255,1);
            --bg-sidebar: #FFFFFF;
            --bg-header: rgba(255,255,255,0.85);
            --text-primary: #0F172A;
            --text-secondary: #475569;
            --text-muted: #94A3B8;
            --border-color: rgba(0,0,0,0.08);
            --border-hover: rgba(0,0,0,0.12);
            --input-bg: rgba(241,245,249,0.8);
        }
        
        /* Apply theme variables */
        body { background-color: var(--bg-primary); color: var(--text-primary); }
        
        /* Sidebar */
        body.light-theme #sidebar { background: var(--bg-sidebar); border-right: 1px solid var(--border-color); box-shadow: 2px 0 8px rgba(0,0,0,0.05); }
        body.light-theme #sidebar .text-white { color: #0F172A; }
        body.light-theme #sidebar .text-slate-400 { color: #334155; }
        body.light-theme #sidebar .text-slate-500 { color: #475569; }
        body.light-theme #sidebar .text-slate-300 { color: #1E293B; }
        body.light-theme #sidebar .bg-white\/5 { background: rgba(0,0,0,0.05); }
        body.light-theme #sidebar .hover\:bg-white\/5:hover { background: rgba(0,0,0,0.06); }
        body.light-theme #sidebar .bg-emerald-400\/10 { background: rgba(16,185,129,0.1); }
        body.light-theme #sidebar .text-violet-400\/60 { color: #7C3AED; }
        
        /* Header */
        body.light-theme header, body.light-theme .sticky { background: var(--bg-header) !important; backdrop-filter: blur(12px); border-color: var(--border-color) !important; }
        body.light-theme header .text-white { color: #0F172A; }
        body.light-theme header .text-slate-400 { color: #475569; }
        body.light-theme header .hover\:bg-white\/10:hover { background: rgba(0,0,0,0.06); }
        body.light-theme header .bg-slate-800 { background: #F1F5F9 !important; }
        
        /* Content area */
        body.light-theme #contentArea { color: #0F172A; }
        body.light-theme #contentArea .text-white { color: #0F172A; }
        body.light-theme #contentArea .text-slate-300 { color: #1E293B; }
        body.light-theme #contentArea .text-slate-400 { color: #475569; }
        body.light-theme #contentArea .text-slate-500 { color: #64748B; }
        body.light-theme #contentArea .text-slate-600 { color: #94A3B8; }
        
        /* Cards */
        body.light-theme .bg-slate-800\/40,
        body.light-theme .bg-slate-800\/50,
        body.light-theme .bg-slate-800\/30 { 
            background: var(--bg-card) !important; 
            border-color: var(--border-color) !important;
            box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        }
        body.light-theme .hover\:bg-slate-800\/60:hover,
        body.light-theme .hover\:bg-slate-800\/70:hover,
        body.light-theme .hover\:bg-slate-800\/50:hover {
            background: var(--bg-card-hover) !important;
            box-shadow: 0 2px 8px rgba(0,0,0,0.08);
        }
        
        /* Kanban columns */
        body.light-theme .bg-slate-900\/30 {
            background: rgba(241,245,249,0.6) !important;
            border-color: var(--border-color) !important;
        }
        
        /* Inputs */
        body.light-theme input, body.light-theme select, body.light-theme textarea {
            background: var(--input-bg) !important;
            color: var(--text-primary) !important;
            border-color: var(--border-color) !important;
        }
        body.light-theme input:focus, body.light-theme select:focus {
            border-color: rgba(16,185,129,0.4) !important;
        }
        body.light-theme input::placeholder { color: var(--text-muted) !important; }
        
        /* Modals */
        body.light-theme .bg-slate-800 { background: #FFFFFF !important; color: var(--text-primary); box-shadow: 0 8px 30px rgba(0,0,0,0.12); }
        body.light-theme .bg-slate-900 { background: #F1F5F9 !important; }
        
        /* Notification dropdown */
        body.light-theme #notifDropdown { background: #FFFFFF !important; border-color: var(--border-color) !important; box-shadow: 0 8px 30px rgba(0,0,0,0.12) !important; }
        body.light-theme #notifDropdown .text-white { color: var(--text-primary); }
        body.light-theme #notifDropdown .hover\:bg-white\/5:hover { background: rgba(0,0,0,0.03); }
        
        /* Borders */
        body.light-theme .border-white\/10,
        body.light-theme .border-white\/\[0\.06\],
        body.light-theme .border-white\/\[0\.03\],
        body.light-theme .border-white\/\[0\.04\] {
            border-color: var(--border-color) !important;
        }
        body.light-theme .border-t.border-white\/10 { border-color: var(--border-color) !important; }
        
        /* Overdue banner */
        body.light-theme .bg-red-500\/10 { background: rgba(239,68,68,0.06) !important; }
        
        /* Status badges - keep colored */
        body.light-theme .bg-emerald-400\/20 { background: rgba(16,185,129,0.12) !important; }
        body.light-theme .bg-blue-400\/20 { background: rgba(59,130,246,0.12) !important; }
        body.light-theme .bg-amber-400\/20 { background: rgba(245,158,11,0.12) !important; }
        body.light-theme .bg-red-500\/15 { background: rgba(239,68,68,0.1) !important; }
        body.light-theme .bg-yellow-500\/15 { background: rgba(245,158,11,0.1) !important; }
        body.light-theme .bg-slate-500\/15 { background: rgba(100,116,139,0.1) !important; }
        body.light-theme .bg-white\/10 { background: rgba(0,0,0,0.06) !important; }
        body.light-theme .bg-slate-600 { background: #94A3B8 !important; }
        body.light-theme .bg-slate-700\/50 { background: #E2E8F0 !important; }
        body.light-theme .hover\:bg-white\/5:hover { background: rgba(0,0,0,0.04) !important; }
        body.light-theme .text-\[10px\] { color: #475569; }
        
        /* Scrollbar */
        body.light-theme ::-webkit-scrollbar-track { background: #F1F5F9; }
        body.light-theme ::-webkit-scrollbar-thumb { background: #CBD5E1; }
        body.light-theme ::-webkit-scrollbar-thumb:hover { background: #94A3B8; }
        
        /* Theme toggle button */
        .theme-toggle { cursor: pointer; transition: all 0.3s; }
        .theme-toggle:hover { transform: scale(1.1); }

        /* Generic light theme - all pages */
        body.light-theme { background: #F8FAFC !important; color: #0F172A; }
        body.light-theme .text-white { color: #0F172A; }
        body.light-theme .text-slate-300 { color: #1E293B; }
        body.light-theme .text-slate-400 { color: #475569; }
        body.light-theme .text-slate-500 { color: #64748B; }
        body.light-theme .text-slate-600 { color: #94A3B8; }
        body.light-theme .bg-\[\#0F172A\] { background: #F8FAFC !important; }
        body.light-theme .bg-slate-900\/80 { background: rgba(255,255,255,0.85) !important; }
        body.light-theme .bg-slate-900\/50 { background: rgba(248,250,252,0.8) !important; }
        body.light-theme .bg-slate-900 { background: #F1F5F9 !important; }
        body.light-theme .bg-slate-800 { background: #FFFFFF !important; }
        body.light-theme .border-white\/5 { border-color: rgba(0,0,0,0.06) !important; }
        body.light-theme .hover\:bg-white\/5:hover { background: rgba(0,0,0,0.04) !important; }
        body.light-theme .hover\:bg-white\/10:hover { background: rgba(0,0,0,0.06) !important; }
        body.light-theme .shadow-2xl { box-shadow: 0 8px 30px rgba(0,0,0,0.12) !important; }
        
        /* Admin specific */
        body.light-theme table thead { background: rgba(241,245,249,0.8) !important; }
        body.light-theme table .border-white\/5 { border-color: rgba(0,0,0,0.05) !important; }
        body.light-theme table .hover\:bg-white\/5:hover { background: rgba(0,0,0,0.03) !important; }
        body.light-theme .tab-btn { color: #64748B; }
        body.light-theme .tab-btn.active, body.light-theme .tab-btn:hover { color: #0F172A; }
        
        /* Task page */
        body.light-theme .bg-slate-800\/80 { background: rgba(255,255,255,0.9) !important; }
        body.light-theme .bg-slate-700 { background: #E2E8F0 !important; }
        body.light-theme .bg-slate-700\/30 { background: rgba(226,232,240,0.5) !important; }
        body.light-theme .border-slate-700 { border-color: #E2E8F0 !important; }
        body.light-theme .text-gray-400 { color: #64748B; }

        /* Main content area background fix */
        body.light-theme main { background: #F1F5F9 !important; }
        body.light-theme #contentArea { background: #F1F5F9 !important; }
        body.light-theme .min-h-screen { background: #F8FAFC !important; }
        body.light-theme .bg-\[\#0F172A\] { background: #F8FAFC !important; }
        
        /* Kanban columns */
        body.light-theme .bg-slate-900\/30,
        body.light-theme .bg-slate-800\/20 { 
            background: rgba(255,255,255,0.6) !important; 
            border-color: rgba(0,0,0,0.08) !important;
        }
        
        /* Feed cards inside kanban */
        body.light-theme .feed-item,
        body.light-theme .task-row,
        body.light-theme .my-task-row {
            background: #FFFFFF !important;
            border-color: rgba(0,0,0,0.08) !important;
        }
        body.light-theme .feed-item:hover,
        body.light-theme .task-row:hover,
        body.light-theme .my-task-row:hover {
            background: #F8FAFC !important;
            box-shadow: 0 2px 8px rgba(0,0,0,0.06);
        }
        
        /* Section headers */
        body.light-theme .text-emerald-400 { color: #059669; }
        body.light-theme .text-blue-400 { color: #2563EB; }
        body.light-theme .text-amber-400 { color: #D97706; }
        body.light-theme .text-red-400 { color: #DC2626; }
        body.light-theme .text-violet-400 { color: #7C3AED; }
        
        /* "No tasks" placeholder */
        body.light-theme .rounded-xl.border-dashed { 
            background: rgba(241,245,249,0.5) !important;
            border-color: rgba(0,0,0,0.1) !important;
        }

        /* Force light background on main content */
        body.light-theme main { background: #F8FAFC !important; color: #0F172A !important; }
        body.light-theme main * { --tw-text-opacity: 1; }
        
        /* Dividers */
        body.light-theme .w-px.bg-white\/10 { background: rgba(0,0,0,0.1) !important; }
        
        /* Logo dark in light mode */
        
        

        /* Body background override */
        body.light-theme.bg-\[\#0F172A\] { background: #F8FAFC !important; }
        body.light-theme[class*="bg-"] { background: #F8FAFC !important; }
        
        /* Logo swap */
        body.light-theme .logo-light { display: none !important; }
        body.light-theme .logo-dark { display: block !important; }
        

        /* Force main content light */
        body.light-theme #mainContent { background: #F8FAFC !important; }
        body.light-theme #mainContent .bg-slate-900\/30 { background: rgba(241,245,249,0.8) !important; }

        /* Logo toggle - clean */
        .logo-dark { display: none !important; }
        body.light-theme .logo-dark { display: inline !important; }
        body.light-theme .logo-light { display: none !important; }

/* ============================================
   COLLAPSIBLE SIDEBAR
   ============================================ */
    content: attr(data-tooltip); position: absolute; left: 100%; top: 50%;
    transform: translateY(-50%); margin-left: 8px; padding: 4px 10px;
    background: #1E293B; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 100; color: white;
}

/* Auto-collapse on medium screens */
@media (min-width: 768px) and (max-width: 1536px) {
    #sidebar:not(.mobile-open) { width: 60px !important; }
    #sidebar:not(.mobile-open) .sidebar-logo-text, #sidebar:not(.mobile-open) .sidebar-search,
    #sidebar:not(.mobile-open) .sidebar-label, #sidebar:not(.mobile-open) .sidebar-text,
    #sidebar:not(.mobile-open) .sidebar-count, #sidebar:not(.mobile-open) .sidebar-settings,
    #sidebar:not(.mobile-open) #spaceList .text-sm, #sidebar:not(.mobile-open) #spaceList span.truncate,
    #sidebar:not(.mobile-open) #spaceList span.text-xs { display: none !important; }
    #sidebar:not(.mobile-open) .sidebar-nav-item { justify-content: center; padding: 0.5rem; }
    #sidebar:not(.mobile-open) .sidebar-nav-item i { margin-right: 0; font-size: 1.2rem; }
    #sidebar:not(.mobile-open) ~ main { margin-left: 72px !important; }
}
@media (max-width: 767px) {
    #sidebar:not(.mobile-open) ~ main { margin-left: 0 !important; }
    #sidebar:not(.mobile-open) [data-tooltip] { position: relative; }
    #sidebar:not(.mobile-open) [data-tooltip]:hover::after {
        content: attr(data-tooltip); position: absolute; left: 100%; top: 50%;
        transform: translateY(-50%); margin-left: 8px; padding: 4px 10px;
        background: #1E293B; border: 1px solid rgba(255,255,255,0.1);
        border-radius: 6px; font-size: 12px; white-space: nowrap; z-index: 100; color: white;
    }
}

/* Mobile: always full sidebar */
@media (max-width: 767px) {
    #sidebar, #sidebar:not(.mobile-open) { width: 100% !important; max-width: 18rem; }
    #sidebar .sidebar-logo-text, #sidebar .sidebar-search, #sidebar .sidebar-label,
    #sidebar .sidebar-text, #sidebar .sidebar-count { display: inherit !important; }
    #sidebar .sidebar-nav-item { justify-content: flex-start; padding: 0.5rem 0.75rem; }
    #sidebar ~ main { margin-left: 0 !important; }
}

/* ============================================
   RESPONSIVE CONTENT AREA
   ============================================ */
/* Board columns: 3 → 2 → 1 based on available space */
#contentArea .grid-cols-1.lg\:grid-cols-3 {
    grid-template-columns: 1fr;
}
@media (min-width: 900px) {
    #contentArea .grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1400px) {
    #contentArea .grid-cols-1.lg\:grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Calendar sidebar: hide on tight screens, show when space allows */
#contentArea .xl\:grid-cols-\[1fr\2c 280px\] {
    grid-template-columns: 1fr;
}
@media (min-width: 1400px) {
    #contentArea .xl\:grid-cols-\[1fr\2c 280px\] {
        grid-template-columns: 1fr 280px;
    }
}

/* Compact header on smaller content areas */
@media (max-width: 1100px) {
    #contentArea h1 { font-size: 1.5rem; }
    #contentArea .task-row { padding: 0.75rem; }
    #contentArea .task-row .text-sm { font-size: 0.8rem; }
}

/* Stack header actions below title on tight space */
@media (max-width: 900px) {
    #contentArea .flex.items-start.justify-between {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 767px) {
    /* Content area full width, less padding */
    main { padding-left: 1rem !important; padding-right: 1rem !important; padding-top: 1rem !important; }
    
    /* Compact greeting */
    #contentArea h1 { font-size: 1.25rem; }
    #contentArea .text-2xl { font-size: 1.25rem; }
    
    /* Stack header actions */
    #contentArea .flex.items-start.justify-between {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    /* Board: single column */
    #contentArea .grid-cols-1.lg\:grid-cols-3,
    #contentArea .lg\:grid-cols-3 {
        grid-template-columns: 1fr !important;
    }
    
    /* Calendar: full width in modal */
    #calendarModal > div { max-width: 100% !important; margin: 0.5rem; border-radius: 1rem; }
    #calendarModal .min-h-\[90px\] { min-height: 60px; }
    #calendarModal .grid-cols-7 .text-xs { font-size: 9px; }
    #calendarModal .text-\[10px\] { font-size: 9px; }
    #calendarModal .p-6 { padding: 0.75rem; }
    
    /* Hide calendar sidebar on mobile */
    #contentArea .xl\:grid-cols-\[1fr\2c 280px\] {
        grid-template-columns: 1fr !important;
    }
    #contentArea .hidden.xl\:block { display: none !important; }
    
    /* Task cards: larger touch targets */
    .task-row, .feed-item { min-height: 48px; }
    #contentArea .task-row { padding: 0.875rem; }
    
    /* Overdue banner compact */
    #contentArea .mb-5.px-4.py-3 { padding: 0.75rem; }
    
    /* Quick access card */
    #contentArea .bg-blue-400\/\[0\.06\] { padding: 0.75rem; }
    
    /* Comments grid: single column */
    #contentArea .lg\:grid-cols-2 { grid-template-columns: 1fr !important; }
    
    /* Breadcrumb: scrollable */
    #breadcrumb { overflow-x: auto; white-space: nowrap; padding-bottom: 0.25rem; }
    #breadcrumb::-webkit-scrollbar { display: none; }
    
    /* Top bar compact */
    #topBar .px-6 { padding-left: 0.75rem; padding-right: 0.75rem; }
    
    /* Project view: subfolder grid */
    #contentArea .grid-cols-2.md\:grid-cols-3 {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    /* Stacked avatars smaller */
    .w-6.h-6 { width: 1.25rem; height: 1.25rem; font-size: 8px; }
    
    /* Filter/toggle buttons wrap */
    #contentArea .flex.items-center.gap-2 { flex-wrap: wrap; }
    
    /* Bottom safe area for iOS */
    body { padding-bottom: env(safe-area-inset-bottom); }
}

/* Small phones */
@media (max-width: 380px) {
    main { padding-left: 0.5rem !important; padding-right: 0.5rem !important; }
    #contentArea h1 { font-size: 1.1rem; }
    #contentArea .task-row .flex.items-center.gap-3.shrink-0 { display: none; }
    #contentArea .grid-cols-2.md\:grid-cols-3 { grid-template-columns: 1fr !important; }
}

/* ============================================
   SLIDE-UP PANEL
   ============================================ */
.slide-panel-overlay {
    position: fixed; inset: 0; z-index: 90;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.slide-panel-overlay.open { opacity: 1; pointer-events: auto; }

.slide-panel {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
    max-height: 90vh; min-height: 80vh; border-radius: 1.5rem 1.5rem 0 0;
    background: #1E293B; border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none; box-shadow: 0 -10px 40px rgba(0,0,0,0.4);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex; flex-direction: column;
}
.slide-panel.open { transform: translateY(0); }

.slide-panel-drag {
    padding: 12px 0 4px; cursor: grab; flex-shrink: 0;
    display: flex; justify-content: center;
}
.slide-panel-handle {
    width: 36px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.2);
}
.slide-panel-header {
    padding: 0.75rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.slide-panel-body {
    padding: 1.25rem; overflow-y: auto; flex: 1;
    -webkit-overflow-scrolling: touch;
}

/* Desktop: centered card instead of full-width */
@media (min-width: 900px) {
    .slide-panel {
        left: 50%; right: auto;
        transform: translateX(-50%) translateY(100%);
        width: 100%; max-width: 700px; max-height: 90vh; min-height: 80vh;
        border-radius: 1.25rem 1.25rem 0 0;
    }
    .slide-panel.open { transform: translateX(-50%) translateY(0); }
}

/* Light theme */
body.light-theme .slide-panel {
    background: #FFFFFF;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
}
body.light-theme .slide-panel-handle { background: rgba(0,0,0,0.15); }
body.light-theme .slide-panel-header { border-color: rgba(0,0,0,0.06); }

/* Slide panel mobile: near fullscreen */
@media (max-width: 767px) {
    .slide-panel {
        max-height: 95vh !important;
        min-height: auto !important; max-height: 60vh !important;
        border-radius: 1rem 1rem 0 0;
    }
    .slide-panel-body { padding: 1rem; }
    .slide-panel-header { padding: 0.75rem 1rem; }
}

/* ============================================
   FLOATING ACTION BUTTON
   ============================================ */
.fab-new {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 80;
    width: 56px; height: 56px; border-radius: 50%;
    background: #10B981; color: #000; border: none;
    box-shadow: 0 4px 20px rgba(16,185,129,0.4);
    display: none; align-items: center; justify-content: center;
    font-size: 1.5rem; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.fab-new:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(16,185,129,0.5); }
.fab-new:active { transform: scale(0.95); }

@media (max-width: 767px) {
    .fab-new { display: flex; }
    
    /* Hide desktop new button on mobile */
    #newDropdownBtn { display: none !important; }
    
    /* Topbar: minimal on mobile */
    #topBar .desktop-action { display: none !important; }
    
    /* Slide panel above FAB */
    .slide-panel { padding-bottom: 0; }
}

/* ============================================
   MOBILE ACTION SHEET (off-canvas menu)
   ============================================ */
.action-sheet-overlay {
    position: fixed; inset: 0; z-index: 95;
    background: rgba(0,0,0,0.5);
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s;
}
.action-sheet-overlay.open { opacity: 1; pointer-events: auto; }

.action-sheet {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 96;
    background: #1E293B; border: 1px solid rgba(255,255,255,0.08);
    border-bottom: none; border-radius: 1.25rem 1.25rem 0 0;
    padding: 0.5rem 0 env(safe-area-inset-bottom); max-height: 50vh; overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
}
.action-sheet.open { transform: translateY(0); }

.action-sheet-handle {
    width: 36px; height: 4px; border-radius: 2px;
    background: rgba(255,255,255,0.2);
    margin: 8px auto 12px;
}
.action-sheet-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.65rem 1.25rem; color: #CBD5E1; font-size: 0.9rem;
    transition: background 0.2s;
}
.action-sheet-item:hover, .action-sheet-item:active { background: rgba(255,255,255,0.05); }
.action-sheet-item i { font-size: 1.1rem; width: 24px; text-align: center; }
.action-sheet-divider { height: 1px; background: rgba(255,255,255,0.06); margin: 0.25rem 1rem; }

body.light-theme .action-sheet { background: #FFFFFF; border-color: rgba(0,0,0,0.08); }
body.light-theme .action-sheet-handle { background: rgba(0,0,0,0.15); }
body.light-theme .action-sheet-item { color: #334155; }
body.light-theme .action-sheet-item:hover { background: rgba(0,0,0,0.04); }
body.light-theme .action-sheet-divider { background: rgba(0,0,0,0.06); }

/* Mobile home tweaks */
@media (max-width: 767px) {
    /* Wrap stats */
    #contentArea .flex.items-center.gap-3.mt-1\.5.text-sm {
        flex-wrap: wrap; gap: 0.5rem;
    }
    
    /* Stack view toggle + new task button */
    #contentArea .flex.items-center.gap-2:has(.home-view-btn) {
        flex-wrap: wrap;
    }
    
    /* Hide breadcrumb on home */
    #breadcrumb { display: none; }
    
    /* Hide FAB when slide panel is open */
    .slide-panel.open ~ .fab-new { display: none; }
}

/* Fix: view toggle + ny oppgave button */
@media (max-width: 767px) {
    #contentArea .flex.items-start.justify-between > .flex.items-center.gap-2 {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
}

/* FAB: ensure always visible on mobile */
@media (max-width: 767px) {
    .fab-new {
        display: flex !important;
        z-index: 89 !important;
        position: fixed !important;
    }
}

/* Hide inline "Ny oppgave" on mobile - FAB replaces it */
@media (max-width: 767px) {
    #contentArea button[onclick="openNewTaskModal()"],
    #contentArea .proj-add-task {
        display: none !important;
    }
    
    /* Truncate stats to fit */
    #contentArea .flex.items-center.gap-3.mt-1\.5 {
        font-size: 0.75rem;
    }
    #contentArea .flex.items-center.gap-3.mt-1\.5 .flex.items-center {
        white-space: nowrap;
    }
}

/* Action sheet: taller on mobile */
@media (max-width: 767px) {
    .action-sheet {
        min-height: auto !important; max-height: 60vh !important;
        padding-bottom: 2rem !important;
    }
    .action-sheet-item {
        padding: 0.75rem 1.25rem !important;
        font-size: 1rem !important;
    }
    .action-sheet-item i {
        font-size: 1.25rem !important;
    }
}

/* Prevent horizontal scroll */
html, body { overflow-x: hidden !important; max-width: 100vw !important; }

/* Mobile content fixes */
@media (max-width: 767px) {
    /* Constrain content area */
    main { margin-left: 0 !important; max-width: 100vw; overflow-x: hidden; }
    #contentArea { max-width: 100%; overflow: hidden; }
    
    /* Cards: prevent overflow */
    #contentArea .rounded-xl,
    #contentArea .bg-slate-800\/50 { 
        max-width: 100%; 
        overflow: hidden;
        word-break: break-word;
    }
    
    /* Board columns full width */
    #contentArea .grid.gap-4 > div { min-width: 0 !important; }
    
    /* Overdue banner tighter */
    #contentArea .mb-5.px-4.py-3 { margin-left: 0; margin-right: 0; }
    
    /* View toggle: scrollable */
    #contentArea .bg-slate-800\/50.rounded-xl.p-1 {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        max-width: calc(100vw - 3rem);
    }
    
    /* Stats row compact */
    #contentArea .flex.items-center.gap-3.mt-1\.5 {
        flex-wrap: wrap;
        gap: 0.375rem 0.75rem;
        font-size: 0.8rem;
    }
    
    /* Header compact */
    #contentArea h1.text-2xl { font-size: 1.5rem; }
    
    /* Main padding */
    main.flex-1 { padding: 1rem !important; }
    
    /* Task card meta: stack on mobile */
    #contentArea .flex.items-center.gap-2.flex-wrap {
        gap: 0.25rem;
    }
    
    /* FAB spacing from bottom */
    .fab-new { bottom: 1.25rem; right: 1.25rem; }
}

/* Hard mobile width constraint */
@media (max-width: 767px) {
    #mainContent { 
        padding-left: 0.75rem !important; 
        padding-right: 0.75rem !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    #topBar > div {
        max-width: 100vw;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Nuclear: clip everything to viewport */
@media (max-width: 767px) {
    html { overflow-x: hidden !important; width: 100vw !important; }
    body { overflow-x: hidden !important; width: 100% !important; position: relative; }
    #sidebar { overflow: hidden; }
    
    /* Notif dropdown: constrain to screen */
    #notifDropdown { 
        width: calc(100vw - 1.5rem) !important; 
        right: 0.75rem !important;
        left: 0.75rem !important;
    }
    
    /* Topbar actions: tighter gap */
    #topBar .flex.items-center.gap-2 { gap: 0.25rem; }
}

/* Modal mobile adjustments */
@media (max-width: 767px) {
    #newTaskModal > div,
    #userModal > div,
    #helpModal > div,
    #newProjectModal > div {
        max-height: 80vh !important;
        overflow-y: auto !important;
        border-radius: 1.25rem !important;
        margin: 0 0.5rem;
        width: calc(100% - 1rem) !important;
    }
}

/* Slide panel close button */
.slide-panel-close-btn {
    position: absolute; top: 0.75rem; right: 0.75rem;
    width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,0.08); border: none;
    color: #94A3B8; display: flex; align-items: center;
    justify-content: center; cursor: pointer;
    transition: background 0.2s, color 0.2s;
    z-index: 10;
}
.slide-panel-close-btn:hover { background: rgba(255,255,255,0.15); color: white; }
body.light-theme .slide-panel-close-btn { background: rgba(0,0,0,0.06); color: #64748B; }
body.light-theme .slide-panel-close-btn:hover { background: rgba(0,0,0,0.1); color: #0F172A; }

/* Hide hamburger when sidebar is open */
@media (max-width: 767px) {
    #sidebar.open ~ #backdrop ~ header #openSidebar,
    #sidebar.open + #backdrop + header #openSidebar { display: none !important; }
}

/* Sidebar above header on mobile when open */
@media (max-width: 767px) {
    #sidebar.open { z-index: 70 !important; }
}

/* ============================================
   SEARCH MODAL
   ============================================ */
.search-modal {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 12vh; opacity: 0; pointer-events: none;
    transition: opacity 0.2s;
}
.search-modal.open { opacity: 1; pointer-events: auto; }

.search-modal-inner {
    width: 100%; max-width: 580px; max-height: 70vh;
    background: #1E293B; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 1.25rem; box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    display: flex; flex-direction: column;
    transform: scale(0.95) translateY(-10px);
    transition: transform 0.2s;
}
.search-modal.open .search-modal-inner {
    transform: scale(1) translateY(0);
}

.search-modal-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem; border-bottom: 1px solid rgba(255,255,255,0.06);
}
.search-input-wrap {
    flex: 1; display: flex; align-items: center; gap: 0.75rem;
    padding: 0.5rem 0.75rem;
}
.search-input-icon { color: #64748B; font-size: 1rem; }
.search-input-wrap input {
    flex: 1; background: none; border: none; outline: none;
    color: white; font-size: 1rem;
}
.search-input-wrap input::placeholder { color: #475569; }
.search-kbd {
    padding: 2px 6px; border-radius: 4px; font-size: 10px;
    background: rgba(255,255,255,0.06); color: #64748B;
    border: 1px solid rgba(255,255,255,0.1);
}
.search-close-btn {
    width: 36px; height: 36px; border-radius: 0.5rem;
    background: none; border: none; color: #64748B;
    cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all 0.2s;
}
.search-close-btn:hover { background: rgba(255,255,255,0.08); color: white; }

.search-results {
    flex: 1; overflow-y: auto; padding: 0.5rem;
    -webkit-overflow-scrolling: touch;
}
.search-empty {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; padding: 3rem 1rem; gap: 0.25rem;
}
.search-group-label {
    padding: 0.5rem 0.75rem 0.25rem; font-size: 10px;
    font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: #475569;
}
.search-item {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.625rem 0.75rem; border-radius: 0.75rem;
    cursor: pointer; transition: background 0.15s;
}
.search-item:hover, .search-item.active { background: rgba(255,255,255,0.06); }
.search-item-icon {
    width: 32px; height: 32px; border-radius: 0.5rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.search-item-content { flex: 1; min-width: 0; }
.search-item-title { font-size: 0.875rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-item-meta { display: flex; align-items: center; gap: 0.375rem; font-size: 0.7rem; color: #64748B; margin-top: 2px; }
.search-highlight { background: rgba(16,185,129,0.2); color: #6EE7B7; border-radius: 2px; padding: 0 1px; }

.search-footer {
    padding: 0.5rem 1rem; border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center;
}

/* Mobile: full screen search */
@media (max-width: 767px) {
    .search-modal { padding-top: 0; align-items: stretch; }
    .search-modal-inner {
        max-width: 100%; max-height: 100vh; height: 100vh;
        border-radius: 0; border: none;
    }
    .search-footer { display: none; }
    .search-input-wrap input { font-size: 1.1rem; }
}

/* Light theme */
body.light-theme .search-modal-inner { background: #FFFFFF; border-color: rgba(0,0,0,0.1); }
body.light-theme .search-input-wrap input { color: #0F172A; }
body.light-theme .search-input-wrap input::placeholder { color: #94A3B8; }
body.light-theme .search-item:hover, body.light-theme .search-item.active { background: rgba(0,0,0,0.04); }
body.light-theme .search-item-title { color: #0F172A; }
body.light-theme .search-highlight { background: rgba(16,185,129,0.15); color: #059669; }
body.light-theme .search-close-btn:hover { background: rgba(0,0,0,0.06); color: #0F172A; }

/* ============================================
   DESKTOP POLISH
   ============================================ */
/* Board columns: equal height, scrollable */
@media (min-width: 1024px) {
    #contentArea .grid-cols-1.lg\:grid-cols-3 {
        align-items: flex-start;
    }
    #contentArea .grid-cols-1.lg\:grid-cols-3 > div > .space-y-2 {
        max-height: calc(100vh - 380px);
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(255,255,255,0.08) transparent;
    }
    #contentArea .grid-cols-1.lg\:grid-cols-3 > div > .space-y-2::-webkit-scrollbar { width: 4px; }
    #contentArea .grid-cols-1.lg\:grid-cols-3 > div > .space-y-2::-webkit-scrollbar-thumb {
        background: rgba(255,255,255,0.08); border-radius: 2px;
    }
}

/* Compact overdue + continue on desktop */
@media (min-width: 1024px) {
    #contentArea .mb-5.px-4.py-3 { 
        margin-bottom: 0.75rem; 
        padding: 0.625rem 1rem;
    }
    #contentArea .mb-5:has(.bi-play-fill) {
        margin-bottom: 0.75rem;
    }
}

/* Wider content when sidebar collapsed */
@media (min-width: 900px) {
    #sidebar.collapsed ~ main {
        max-width: calc(100vw - 84px) !important;
    }
}

/* Better grid gap */
@media (min-width: 1400px) {
    #contentArea .grid-cols-1.lg\:grid-cols-3 { gap: 1rem; }
    #contentArea .xl\:grid-cols-\[1fr\2c 280px\] { gap: 1.5rem; }
}

/* Override: board columns accounting for sidebar */
#contentArea .grid-cols-1.lg\:grid-cols-3 { grid-template-columns: 1fr !important; }
@media (min-width: 950px) {
    #contentArea .grid-cols-1.lg\:grid-cols-3 { grid-template-columns: repeat(2, 1fr) !important; }
}
@media (min-width: 1500px) {
    #contentArea .grid-cols-1.lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr) !important; }
}

/* ============================================
   CUSTOM DROPDOWNS (Status / Priority)
   ============================================ */
.custom-dropdown { position: relative; }
.custom-dropdown-btn {
    display: flex; align-items: center; gap: 0.625rem;
    width: 100%; padding: 0.625rem 0.875rem; border-radius: 0.75rem;
    background: rgba(15, 23, 42, 0.5); border: 1px solid rgba(255,255,255,0.05);
    color: white; font-size: 0.875rem; cursor: pointer;
    transition: all 0.2s;
}
.custom-dropdown-btn:hover { border-color: rgba(255,255,255,0.12); }
.custom-dropdown-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.custom-dropdown-menu {
    position: absolute; top: calc(100% + 4px); left: 0; right: 0;
    background: #1E293B; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 0.75rem; padding: 0.25rem; z-index: 50;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
    display: none;
}
.custom-dropdown.open .custom-dropdown-menu { display: block; }
.custom-dropdown.open .custom-dropdown-btn { border-color: rgba(16,185,129,0.4); }
.custom-dropdown-item {
    display: flex; align-items: center; gap: 0.625rem;
    padding: 0.5rem 0.75rem; border-radius: 0.5rem;
    cursor: pointer; font-size: 0.875rem; color: #CBD5E1;
    transition: background 0.15s;
}
.custom-dropdown-item:hover { background: rgba(255,255,255,0.06); color: white; }
.custom-dropdown-item.active { background: rgba(16,185,129,0.1); color: white; }

/* Light theme */
body.light-theme .custom-dropdown-btn { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); color: #0F172A; }
body.light-theme .custom-dropdown-menu { background: #fff; border-color: rgba(0,0,0,0.1); box-shadow: 0 10px 25px rgba(0,0,0,0.12); }
body.light-theme .custom-dropdown-item { color: #334155; }
body.light-theme .custom-dropdown-item:hover { background: rgba(0,0,0,0.04); color: #0F172A; }

/* Project picker menu */
.project-picker-menu { 
    width: 280px; min-width: 100%;
}
.project-picker-menu .custom-dropdown-item { font-size: 0.8125rem; }

/* Dropdown button truncate */
.custom-dropdown-btn { overflow: hidden; }
.custom-dropdown-btn .custom-dropdown-label { 
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; 
}
