:root {
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --sidebar-bg: #111827;
    --sidebar-text: #f3f4f6;
    --sidebar-hover: rgba(255, 255, 255, 0.08);
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);

    /* Status Colors */
    --danger-bg: #fef2f2;
    --danger-text: #ef4444;
    --success-bg: #f0fdf4;
    --success-text: #22c55e;
    --warning-bg: #fffbeb;
    --warning-text: #f59e0b;
    --info-bg: #eff6ff;
    --info-text: #3b82f6;
}

[data-theme="dark"] {
    --bg-main: #0B0E14;
    /* Deep, premium dark */
    --bg-card: #151A23;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --sidebar-bg: #07090D;
    --sidebar-text: #e2e8f0;
    --sidebar-hover: rgba(255, 255, 255, 0.05);
    --border: #262D3D;
    --border-light: #1A202C;
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(21, 26, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.05);

    /* Status Colors */
    --danger-bg: rgba(239, 68, 68, 0.15);
    --danger-text: #fca5a5;
    --success-bg: rgba(34, 197, 94, 0.15);
    --success-text: #86efac;
    --warning-bg: rgba(245, 158, 11, 0.15);
    --warning-text: #fcd34d;
    --info-bg: rgba(59, 130, 246, 0.15);
    --info-text: #93c5fd;
}

/* Prevent transition flash on page load */
.preload,
.preload * {
    transition: none !important;
}

/* Base Resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

select {
    color: var(--text-main);
    background-color: var(--bg-card);
}

select option {
    background-color: var(--bg-card) !important;
    color: var(--text-main) !important;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    font-size: 15px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

/* Glassmorphism utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
}

/* Layout Config */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Sidebar Branding */
.sidebar-header {
    padding: 32px 24px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 16px;
}

.brand-icon {
    font-size: 36px;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 12px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
    width: 100%;
}

/* Navigation Menu */
.menu-section {
    padding: 16px 0;
}

.menu-label {
    padding: 0 24px 8px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 600;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.65);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    gap: 12px;
}

.menu-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.menu-item.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.15) 0%, transparent 100%);
    border-left-color: var(--primary);
    color: #fff;
}

.menu-item i {
    font-size: 20px;
    width: 24px;
    display: flex;
    justify-content: center;
}

/* Context actions */
.sidebar-footer {
    margin-top: auto;
    padding: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.theme-toggle,
.logout {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    width: 100%;
    background: transparent;
    text-align: left;
    font-size: 14px;
}

.theme-toggle {
    color: var(--sidebar-text);
    margin-bottom: 8px;
}

.theme-toggle:hover {
    background: var(--sidebar-hover);
}

.logout {
    color: #ef4444;
}

.logout:hover {
    background: rgba(239, 68, 68, 0.1);
}

.logout i,
.theme-toggle i {
    font-size: 20px;
}

/* Main content wrapper */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 40px;
    min-height: 100vh;
    min-width: 0;
    /* Prevents flex blowout to allow kanban horizontal scrolling */
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive constraints */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.5);
        /* backdrop hack */
    }

    .main-content {
        margin-left: 0;
        padding: 24px;
    }

    .mobile-nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .content-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
}