        /* System preference dark mode (when no explicit theme is set) */
        @media (prefers-color-scheme: dark) {
            :root:not([data-theme="light"]) {
                /* Colors - Backgrounds */
                --bg-primary: #1A1A1A;
                --bg-main: #121212;
                --bg-sidebar: #1E1E1E;
                --bg-secondary: #1E1E1E;
                --bg-tertiary: #252525;
                --bg-light: #1F1F1F;
                --bg-elevated: #2A2A2A;
                --bg-card: #242424;
                --bg-hover: rgba(255, 255, 255, 0.06);

                /* Modal scrim — pure black in dark mode (ink would vanish) */
                --modal-overlay-bg: rgba(0, 0, 0, 0.45);

                /* Colors - Text */
                --text-primary: #F5F5F5;
                --text-secondary: #B3B3B3;
                --text-tertiary: #8A8A8A;
                --text-quaternary: #666666;

                /* Colors - Accent */
                --accent-blue: #5B9FE3;
                --text-completed: #5B9FE3; /* 6.2:1 on #1A1A1A — the accent already clears AA here */
                --accent-blue-light: rgba(91, 159, 227, 0.12);
                --accent-blue-hover: rgba(91, 159, 227, 0.18);
                --accent-blue-focus: rgba(91, 159, 227, 0.2);
                --accent-blue-bg: rgba(91, 159, 227, 0.08);
                --accent-blue-border: rgba(91, 159, 227, 0.4);
                --accent-blue-dark: #4A90D9;
                --accent-blue-gradient-end: #7BB3EA;

                /* Colors - Borders & Surfaces */
                --border-light: rgba(255, 255, 255, 0.08);
                --border-medium: rgba(255, 255, 255, 0.12);
                --surface-hover: rgba(255, 255, 255, 0.04);
                --surface-active: rgba(255, 255, 255, 0.08);
                --surface-elevated: #2A2A2A;
                --surface-base: #1E1E1E;

                /* Shadows */

                /* Priority badge colours - slightly lighter for dark backgrounds */
                --badge-priority-p3: #8A8A8A;

                /* Accent Opacity Scale */
                --accent-blue-opacity-3: rgba(91, 159, 227, 0.05);
                --accent-blue-opacity-5: rgba(91, 159, 227, 0.08);
                --accent-blue-opacity-8: rgba(91, 159, 227, 0.12);
                --accent-blue-opacity-10: rgba(91, 159, 227, 0.15);
                --accent-blue-opacity-12: rgba(91, 159, 227, 0.18);
                --accent-blue-opacity-15: rgba(91, 159, 227, 0.2);
                --accent-blue-opacity-20: rgba(91, 159, 227, 0.25);

                /* Hover States */
                --hover-light: rgba(255, 255, 255, 0.04);
                --hover-accent: var(--accent-blue-opacity-8);
            }
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: var(--font-family);
            background: var(--bg-main);
            color: var(--text-primary);
            line-height: 1.6;
            overflow: hidden;
            height: 100vh;
        }

        /* Skip Link for Keyboard Navigation */
        .skip-link {
            position: absolute;
            top: -40px;
            left: 0;
            background: var(--primary);
            color: white;
            padding: 8px 16px;
            z-index: var(--z-layer-top);
            text-decoration: none;
            font-weight: 500;
            border-radius: 0 0 var(--radius-sm) 0;
            transition: top var(--duration-normal) var(--ease-in-out);
        }

        .skip-link:focus {
            top: 0;
            outline: 2px solid var(--primary);
            outline-offset: 2px;
        }

        /* Loading Screen */
        .loading-screen {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            background: var(--bg-main);
            z-index: calc(var(--z-layer-top) - 1);
        }

        .loading-content {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 24px;
        }

        .loading-message {
            color: var(--text-secondary);
            font-size: var(--font-size-14);
            font-weight: 500;
            margin: 0;
            text-align: center;
            min-height: 20px;
            animation: fadeInOut 2s ease-in-out infinite;
        }

        @keyframes fadeInOut {
            0%, 100% {
                opacity: 0.7;
            }
            50% {
                opacity: 1;
            }
        }

        .loading-circles {
            position: relative;
            width: 100px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .loading-circle {
            position: absolute;
            border-radius: var(--radius-circle);
            background: #357ABD;
            top: 50%;
            transform: translateY(-50%);
        }

        /* Large circle - centered anchor with subtle breathing */
        .loading-circle.circle-3 {
            width: 44px;
            height: 44px;
            opacity: 1;
            z-index: 1;
            left: 50%;
            transform: translate(-50%, -50%);
            animation: breathe 2.4s ease-in-out infinite;
        }

        /* Medium circle - bounces in from center to left */
        .loading-circle.circle-2 {
            width: 32px;
            height: 32px;
            opacity: 0;
            z-index: 2;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
            animation: bounceInMedium 2.4s ease-out infinite;
        }

        /* Small circle - bounces in furthest left */
        .loading-circle.circle-1 {
            width: 22px;
            height: 22px;
            opacity: 0;
            z-index: 3;
            left: 50%;
            transform: translate(-50%, -50%) scale(0);
            animation: bounceInSmall 2.4s ease-out infinite;
        }

        /* Subtle breathing pulse for main circle */
        @keyframes breathe {
            0%, 100% {
                transform: translate(-50%, -50%) scale(1);
            }
            50% {
                transform: translate(-50%, -50%) scale(0.92);
            }
        }

        /* Medium circle bounces in and settles to the left, then instantly resets */
        @keyframes bounceInMedium {
            0%, 8% {
                opacity: 0;
                transform: translate(-50%, -50%) scale(0);
            }
            15% {
                opacity: 0.75;
                transform: translate(-130%, -50%) scale(1.1);
            }
            22% {
                opacity: 0.7;
                transform: translate(-115%, -50%) scale(0.95);
            }
            30%, 84.9% {
                opacity: 0.7;
                transform: translate(-120%, -50%) scale(1);
            }
            85%, 100% {
                opacity: 0;
                transform: translate(-50%, -50%) scale(0);
            }
        }

        /* Small circle bounces in last and settles furthest left, then instantly resets */
        @keyframes bounceInSmall {
            0%, 20% {
                opacity: 0;
                transform: translate(-50%, -50%) scale(0);
            }
            28% {
                opacity: 0.45;
                transform: translate(-240%, -50%) scale(1.15);
            }
            36% {
                opacity: 0.4;
                transform: translate(-220%, -50%) scale(0.9);
            }
            44%, 84.9% {
                opacity: 0.4;
                transform: translate(-230%, -50%) scale(1);
            }
            85%, 100% {
                opacity: 0;
                transform: translate(-50%, -50%) scale(0);
            }
        }

        /* Session Expired Overlay */
        .session-expired-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            display: none;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, rgba(245, 247, 250, 0.95) 0%, rgba(237, 241, 247, 0.95) 100%);
            backdrop-filter: blur(8px);
            z-index: var(--z-layer-top);
        }

        [data-theme="dark"] .session-expired-overlay {
            background: linear-gradient(135deg, rgba(17, 24, 39, 0.95) 0%, rgba(31, 41, 55, 0.95) 100%);
        }

        .session-expired-overlay.visible {
            display: flex;
        }

        .session-expired-card {
            width: 100%;
            max-width: 420px;
            background: var(--bg-primary);
            border-radius: var(--radius-xl);
            box-shadow: var(--shadow-3);
            border: 1px solid var(--border-light);
            padding: var(--space-8);
            text-align: center;
            animation: sessionExpiredFadeIn var(--duration-slow) var(--ease-in-out);
        }

        @keyframes sessionExpiredFadeIn {
            from {
                opacity: 0;
                transform: scale(0.95) translateY(-10px);
            }
            to {
                opacity: 1;
                transform: scale(1) translateY(0);
            }
        }

        /* Logo */
        .session-expired-logo {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-3);
            margin-bottom: var(--space-6);
        }

        .session-expired-logo-text {
            font-size: var(--font-size-xl);
            font-weight: 700;
            color: var(--text-primary);
            letter-spacing: -0.5px;
        }

        /* Icon container with subtle background */
        .session-expired-icon-container {
            display: flex;
            align-items: center;
            justify-content: center;
            margin-bottom: var(--space-5);
        }

        .session-expired-icon {
            width: 72px;
            height: 72px;
            padding: 16px;
            background: linear-gradient(135deg, rgba(53, 122, 189, 0.08) 0%, rgba(53, 122, 189, 0.04) 100%);
            border-radius: var(--radius-circle);
            color: var(--primary);
        }

        [data-theme="dark"] .session-expired-icon {
            background: linear-gradient(135deg, rgba(53, 122, 189, 0.15) 0%, rgba(53, 122, 189, 0.08) 100%);
        }

        .session-expired-icon svg {
            width: 100%;
            height: 100%;
        }

        /* Title */
        .session-expired-title {
            margin: 0 0 var(--space-2);
            font-size: var(--font-size-22);
            font-weight: 600;
            color: var(--text-primary);
        }

        /* Text */
        .session-expired-text {
            margin: 0 0 var(--space-6);
            color: var(--text-secondary);
            font-size: var(--font-size-14);
            line-height: 1.6;
        }

        /* Actions */
        .session-expired-actions {
            display: flex;
            flex-direction: column;
            gap: var(--space-3);
        }

        .session-expired-btn-primary {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-2);
            width: 100%;
            padding: 12px 24px;
            background: var(--primary);
            color: white;
            border: none;
            border-radius: var(--radius-lg);
            font-size: var(--font-size-base);
            font-weight: 500;
            cursor: pointer;
            transition: all var(--duration-normal) var(--ease-in-out);
        }

        .session-expired-btn-primary:hover {
            background: var(--primary-hover);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(53, 122, 189, 0.3);
        }

        .session-expired-btn-primary:active {
            transform: translateY(0);
        }

        .session-expired-btn-primary svg {
            width: 18px;
            height: 18px;
        }

        .session-expired-btn-secondary {
            padding: var(--space-3) var(--space-6);
            background: transparent;
            color: var(--text-secondary);
            border: none;
            border-radius: var(--radius-lg);
            font-size: var(--font-size-14);
            font-weight: 500;
            cursor: pointer;
            transition: all var(--duration-normal) var(--ease-in-out);
        }

        .session-expired-btn-secondary:hover {
            color: var(--primary);
            background: rgba(53, 122, 189, 0.06);
        }
