        /* ===================================================================
           DESIGN TOKENS — Set by main/static/js/ui.js syncTokensToCSS() on load.
           Do not duplicate token values here; change them only in ui.js.
           =================================================================== */
        :root {
            /* All token vars (--color-*, --gradient-*, --shadow-*, --space-*,
               --font-sans, --text-*, --font-*, --radius-*, --transition-*)
               are injected by ui.js. Light theme overrides below. */
        }

        /* Light Theme */
        [data-theme="light"] {
            --color-background: #ffffff;
            --color-surface: rgba(0, 0, 0, 0.03);
            --color-surface-hover: rgba(0, 0, 0, 0.06);
            --color-surface-active: rgba(0, 0, 0, 0.1);
            --color-border: rgba(0, 0, 0, 0.1);
            --color-border-hover: rgba(0, 0, 0, 0.2);
            --color-text-primary: #111827;
            --color-text-secondary: #4b5563;
            --color-text-tertiary: #9ca3af;
        }

        /* ===================================================================
           BASE STYLES
           =================================================================== */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

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

        /* ── Global Scrollbar (design-system standard) ── */
        ::-webkit-scrollbar { width: 6px; height: 6px; }
        ::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
        ::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.28); border-radius: 3px; transition: background 0.2s; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.55); }
        html { scrollbar-width: thin; scrollbar-color: rgba(139,92,246,0.28) transparent; }

        body.theme-transitioning,
        body.theme-transitioning * {
            transition: background-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
                        border-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
                        color 300ms cubic-bezier(0.4, 0, 0.2, 1) !important;
        }

        /* ===================================================================
           UTILITY CLASSES
           =================================================================== */
        .gradient-bg { background: var(--gradient-primary); }

        .glass-effect {
            background: var(--color-surface-sub);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid var(--color-border);
        }

        /* ── Range Slider (.slider-input) and Input Field (.input-field) ───────
           Styles are now injected by ui.js (injectUIStyles) so they apply
           in both the main app and design-system.html from a single source.
           Do not duplicate them here.
           =================================================================== */

        /* ===================================================================
           LAYOUT COMPONENTS
           =================================================================== */
        .sidebar {
            background: var(--gradient-sidebar);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border-right: 1px solid var(--color-border);
            box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
        }

        /* ===================================================================
           TIMELINE — Production-Grade NLE Upgrades
           =================================================================== */

        /* Resize handles on timeline clips */
        .clip-resize-handle {
            position: absolute;
            top: 0;
            bottom: 0;
            width: 7px;
            cursor: ew-resize;
            background: rgba(255,255,255,0.15);
            transition: background 0.15s, box-shadow 0.15s;
            z-index: 2;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        .clip-resize-handle::after {
            content: '';
            width: 2px;
            height: 60%;
            border-radius: 1px;
            background: rgba(255,255,255,0.4);
            transition: background 0.15s;
        }
        .clip-resize-handle:hover {
            background: rgba(139,92,246,0.45);
            box-shadow: inset 0 0 8px rgba(139,92,246,0.5);
        }
        .clip-resize-handle:hover::after {
            background: rgba(255,255,255,0.9);
        }

        /* Sidebar Header */
        .sidebar-header {
            padding: 1.5rem;
            border-bottom: 1px solid var(--color-border);
            background: linear-gradient(180deg, var(--color-primary-surface) 0%, transparent 100%);
        }

        .sidebar-logo {
            display: flex;
            align-items: center;
            gap: 0.75rem;
            margin-bottom: 1rem;
        }

        .sidebar-logo-icon {
            width: 48px;
            height: 48px;
            min-width: 48px;
            background: var(--gradient-primary);
            border-radius: var(--radius-lg);
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: var(--shadow-primary);
        }

        .sidebar-logo-icon i {
            font-size: 1.5rem;
            color: var(--color-text-primary);
        }

        .sidebar-logo-text {
            font-size: var(--text-xl);
            font-weight: var(--font-bold);
            line-height: 1.3;
            margin-left: var(--space-2);
            background: linear-gradient(135deg, var(--color-primary-400) 0%, var(--color-secondary-500) 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
        }

        .sidebar-user-info {
            padding: var(--space-3);
            background: var(--color-surface-sub);
            border-radius: var(--radius-lg);
            border: 1px solid var(--color-border);
        }

        .sidebar-username {
            font-weight: var(--font-semibold);
            color: var(--color-text-primary);
            font-size: var(--text-base);
        }

        .sidebar-user-meta {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 0.375rem;
        }

        .sidebar-plan-badge {
            font-size: var(--text-xs);
            padding: var(--space-1) var(--space-2);
            border-radius: var(--radius-full);
            background: var(--color-info-surface);
            color: var(--color-info-light);
            border: 1px solid var(--color-info-surface);
            text-transform: capitalize;
            font-weight: var(--font-medium);
        }

        .sidebar-standalone-badge {
            font-size: var(--text-xs);
            padding: var(--space-1) var(--space-2);
            border-radius: var(--radius-full);
            background: var(--color-success-surface);
            color: var(--color-success-light);
            border: 1px solid var(--color-success-surface);
            font-weight: var(--font-medium);
        }

        /* Sidebar Navigation Buttons */
        .sidebar-nav-btn {
            width: 100%;
            text-align: left;
            padding: 0.875rem 1rem;
            min-height: 44px;
            border-radius: 10px;
            margin-bottom: 0.375rem;
            background: transparent;
            border: 1px solid transparent;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 0.75rem;
            color: rgba(255, 255, 255, 0.85);
            font-weight: 500;
            font-size: 0.9375rem;
        }

        .sidebar-nav-btn i {
            width: 20px;
            text-align: center;
            font-size: 1rem;
            opacity: 0.9;
        }

        .sidebar-nav-btn::before {
            content: '';
            position: absolute;
            inset: 0;
            background: var(--color-primary-surface);
            opacity: 0;
            transition: opacity 0.3s ease;
            border-radius: inherit;
        }

        .sidebar-nav-btn:hover {
            color: var(--color-text-primary);
            border-color: var(--color-primary-border);
            transform: translateX(4px);
            box-shadow: var(--shadow-primary);
        }

        .sidebar-nav-btn:hover::before {
            opacity: 1;
        }

        /* Active sidebar button */
        .sidebar-nav-btn.active {
            background: var(--gradient-primary) !important;
            border-color: var(--color-border-hover);
            box-shadow: var(--shadow-primary-hover), inset 0 1px 0 rgba(255, 255, 255, 0.2);
            color: var(--color-text-primary);
        }

        .sidebar-nav-btn.active i {
            opacity: 1;
        }

        /* Legacy support */
        .sidebar nav button {
            background: transparent;
            border: 1px solid transparent;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
        }

        .sidebar nav button::before {
            content: '';
            position: absolute;
            inset: 0;
            background: var(--color-primary-surface);
            opacity: 0;
            transition: opacity 0.3s ease;
            border-radius: inherit;
        }

        .sidebar nav button:hover::before {
            opacity: 1;
        }

        .sidebar nav button:hover {
            border-color: var(--color-primary-border);
            transform: translateX(4px);
            box-shadow: var(--shadow-primary);
        }

        /* Active sidebar button */
        .sidebar nav button.bg-gradient-to-r {
            background: var(--gradient-primary) !important;
            border-color: var(--color-border-hover);
            box-shadow: var(--shadow-primary-hover), inset 0 1px 0 rgba(255, 255, 255, 0.2);
        }

        /* Logout button styling */
        .sidebar > div:last-child button {
            background: var(--color-danger-surface) !important;
            border: 1px solid var(--color-danger-surface) !important;
            transition: var(--transition-slow);
        }

        .sidebar > div:last-child button:hover {
            background: var(--color-danger-surface) !important;
            border-color: var(--color-error) !important;
            box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
            transform: translateX(4px);
        }

        /* ===================================================================
           CARD COMPONENTS - GLASSMORPHISM
           =================================================================== */
        .card {
            background: var(--gradient-glass);
            backdrop-filter: blur(12px);
            -webkit-backdrop-filter: blur(12px);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-xl);
            transition: var(--transition-slow);
            box-shadow: var(--shadow-card);
        }

        .card:hover,
        .card-hover:hover {
            background: var(--gradient-glass-hover);
            transform: translateY(-4px) scale(1.01);
            border-color: var(--color-primary-border);
            box-shadow: var(--shadow-primary-hover), inset 0 1px 0 rgba(255, 255, 255, 0.15);
        }

        .card-static {
            background: var(--gradient-glass);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-xl);
            box-shadow: var(--shadow-md);
            /* position + z-index needed so the :has([aria-expanded]) rule below can
               lift this card above its siblings when a dropdown is open.
               backdrop-filter creates a stacking context — without z-index management
               a later sibling card will always paint on top of this card's dropdown. */
            position: relative;
            z-index: 1;
        }

        /* Lift the card above all siblings while one of its dropdowns is open.
           This ensures the absolutely-positioned dropdown panel clears the next card. */
        .card-static:has([role="combobox"][aria-expanded="true"]) {
            z-index: 50;
        }

        /* Stats Cards Enhancement */
        .card-static:has(h3) {
            /* position: relative already set on .card-static above */
            /* overflow intentionally NOT hidden — dropdowns inside must be able to escape */
        }

        .card-static:has(h3)::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 3px;
            background: var(--gradient-primary);
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .card-static:has(h3):hover::before {
            opacity: 1;
        }

        /* ===================================================================
           BUTTON COMPONENTS - GLASSMORPHISM
           =================================================================== */
        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.75rem 1.5rem;
            border-radius: var(--radius-lg);
            font-size: var(--text-base);
            font-weight: var(--font-semibold);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            border: none;
            outline: none;
            text-decoration: none;
            position: relative;
            overflow: hidden;
        }

        .btn::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
            transition: left 0.5s ease;
        }

        .btn:hover::before {
            left: 100%;
        }

        .btn:focus-visible {
            box-shadow: var(--focus-ring);
        }

        .btn-primary {
            background: var(--gradient-primary-animated);
            background-size: 200% 200%;
            color: var(--color-text-primary);
            box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.2);
            border: 1px solid var(--color-border);
            animation: gradientShift 3s ease infinite;
        }

        @keyframes gradientShift {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }

        .btn-primary:hover:not(:disabled) {
            transform: translateY(-3px) scale(1.02);
            box-shadow: var(--shadow-primary-hover), inset 0 1px 0 rgba(255, 255, 255, 0.3);
        }

        .btn-primary:active:not(:disabled) {
            transform: translateY(-1px) scale(1.01);
        }

        .btn-primary:disabled {
            opacity: 0.5;
            cursor: not-allowed;
            transform: none;
            animation: none;
        }

        .btn-primary,
        .btn-secondary,
        .btn-danger,
        .btn-success {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.75rem 1.5rem;
            border-radius: var(--radius-lg);
            font-size: var(--text-base);
            font-weight: var(--font-semibold);
            font-family: var(--font-sans);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            outline: none;
            text-decoration: none;
        }

        .btn-secondary {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            color: var(--color-text-primary);
            border: 1px solid rgba(255, 255, 255, 0.15);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        .btn-secondary:hover:not(:disabled) {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
            border-color: rgba(255, 255, 255, 0.25);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
        }

        .btn-danger {
            background: var(--color-danger-surface);
            color: var(--color-danger-light);
            border: 1px solid var(--color-error);
            box-shadow: var(--shadow-md);
        }

        .btn-danger:hover:not(:disabled) {
            background: var(--color-danger-surface);
            border-color: var(--color-error);
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }

        .btn-success {
            background: var(--color-success-surface);
            color: var(--color-success-light);
            border: 1px solid var(--color-success);
            box-shadow: var(--shadow-md);
        }

        .btn-success:hover:not(:disabled) {
            background: var(--color-success-surface);
            border-color: var(--color-success);
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }

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

        .btn-lg {
            padding: 1rem 2rem;
            font-size: var(--text-lg);
        }

        /* Action Button - For Dashboard/Projects Quick Actions */
        .btn-action {
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 1rem 1.5rem;
            border-radius: var(--radius-xl);
            font-size: var(--text-base);
            font-weight: var(--font-semibold);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            border: none;
            outline: none;
            position: relative;
            overflow: hidden;
            gap: 0.75rem;
        }

        .btn-action-primary {
            background: var(--gradient-primary-animated);
            background-size: 200% 200%;
            color: var(--color-text-primary);
            box-shadow: var(--shadow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.2);
            border: 1px solid var(--color-border-hover);
            animation: gradientShift 3s ease infinite;
        }

        .btn-action-primary:hover {
            transform: translateY(-3px) scale(1.02);
            box-shadow: var(--shadow-primary-hover);
        }

        .btn-action-primary:active {
            transform: translateY(-1px) scale(1.01);
        }

        .btn-action-secondary {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.06) 100%);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            color: var(--color-text-primary);
            border: 1px solid rgba(255, 255, 255, 0.2);
            box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
        }

        .btn-action-secondary:hover {
            background: var(--gradient-glass-hover);
            border-color: var(--color-primary-border);
            transform: translateY(-3px);
            box-shadow: var(--shadow-primary);
        }

        .btn-action-secondary:active {
            transform: translateY(-1px);
        }

        /* Wizard Navigation Buttons */
        .btn-wizard {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0.875rem 2rem;
            border-radius: var(--radius-lg);
            font-size: var(--text-base);
            font-weight: var(--font-semibold);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            gap: 0.5rem;
        }

        .btn-wizard-primary {
            background: var(--gradient-primary);
            color: var(--color-text-primary);
            border: 1px solid var(--color-border-hover);
            box-shadow: var(--shadow-primary);
        }

        .btn-wizard-primary:hover:not(:disabled) {
            transform: translateY(-2px);
            box-shadow: var(--shadow-primary-hover);
        }

        .btn-wizard-primary:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .btn-wizard-secondary {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
            color: var(--color-text-primary);
            border: 1px solid rgba(255, 255, 255, 0.15);
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        }

        .btn-wizard-secondary:hover {
            background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.08) 100%);
            border-color: rgba(255, 255, 255, 0.25);
            transform: translateY(-2px);
        }

        .btn-wizard-secondary:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .btn-wizard-warning {
            background: var(--color-warning-surface);
            color: var(--color-warning-light);
            border: 1px solid var(--color-warning-surface);
            box-shadow: var(--shadow-md);
        }

        .btn-wizard-warning:hover {
            background: var(--color-warning-surface);
            border-color: var(--color-warning);
            transform: translateY(-2px);
        }

        .btn-wizard-warning:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        .btn-wizard-danger {
            background: var(--color-danger-surface);
            color: var(--color-danger-light);
            border: 1px solid var(--color-danger-surface);
            box-shadow: var(--shadow-md);
        }

        .btn-wizard-danger:hover {
            background: var(--color-danger-surface);
            border-color: var(--color-error);
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }

        .btn-wizard-success {
            background: var(--color-success-surface);
            color: var(--color-success-light);
            border: 1px solid var(--color-success-surface);
            box-shadow: var(--shadow-md);
        }

        .btn-wizard-success:hover {
            background: var(--color-success-surface);
            border-color: var(--color-success);
            transform: translateY(-2px);
            box-shadow: var(--shadow-lg);
        }

        /* Quick Actions Container */
        .quick-actions {
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }

        /* ===================================================================
           FORM COMPONENTS - GLASSMORPHISM
           =================================================================== */
        input,
        textarea,
        select {
            background: var(--gradient-glass);
            backdrop-filter: blur(10px);
            -webkit-backdrop-filter: blur(10px);
            border: 1px solid var(--color-border);
            color: var(--color-text-primary);
            padding: var(--space-3) var(--space-4);
            border-radius: var(--radius-lg);
            width: 100%;
            font-family: var(--font-sans);
            font-size: var(--text-base);
            transition: var(--transition-slow);
            box-shadow: var(--shadow-sm);
        }

        input::placeholder,
        textarea::placeholder {
            color: var(--color-text-tertiary);
        }

        input:hover:not(:disabled):not(:focus),
        textarea:hover:not(:disabled):not(:focus),
        select:hover:not(:disabled):not(:focus) {
            border-color: var(--color-border-hover);
            background: var(--gradient-glass-hover);
        }

        input:focus,
        textarea:focus,
        select:focus {
            outline: none;
            border-color: var(--color-primary-500);
            background: var(--color-primary-surface);
            box-shadow: var(--focus-ring), var(--shadow-primary);
        }

        input:disabled,
        textarea:disabled,
        select:disabled {
            opacity: 0.6;
            cursor: not-allowed;
        }

        select option {
            background: var(--color-background);
            color: var(--color-text-primary);
            padding: var(--space-3) var(--space-4);
            font-family: var(--font-sans);
        }

        select option:hover,
        select option:checked {
            background: var(--color-primary-surface);
        }

        /* Close button - branded */
        .btn-close {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 32px;
            height: 32px;
            border-radius: var(--radius-md);
            border: 1px solid var(--color-border);
            background: var(--color-surface-sub);
            color: var(--color-text-secondary);
            cursor: pointer;
            transition: var(--transition-fast);
        }

        .btn-close:hover {
            background: var(--color-danger-surface);
            border-color: var(--color-error);
            color: var(--color-danger-light);
            transform: scale(1.1);
        }

        /* Link-style button */
        .btn-link {
            background: none;
            border: none;
            color: var(--color-primary-400);
            cursor: pointer;
            font-family: var(--font-sans);
            padding: var(--space-2) var(--space-4);
            border-radius: var(--radius-md);
            transition: var(--transition-fast);
        }

        .btn-link:hover {
            color: var(--color-primary-300);
            background: var(--color-primary-surface);
        }

        .checkbox-custom {
            width: 20px;
            height: 20px;
            cursor: pointer;
            accent-color: var(--color-primary-500);
        }

        /* ===================================================================
           ALERT/NOTIFICATION COMPONENTS
           =================================================================== */
        .alert {
            padding: 1rem;
            border-radius: var(--radius-md);
            margin-bottom: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .alert-error {
            background: var(--color-danger-surface);
            border: 1px solid var(--color-error);
            color: var(--color-error);
        }

        .alert-success {
            background: var(--color-success-surface);
            border: 1px solid var(--color-success);
            color: var(--color-success);
        }

        .alert-warning {
            background: var(--color-warning-surface);
            border: 1px solid var(--color-warning);
            color: var(--color-warning);
        }

        .alert-info {
            background: var(--color-info-surface);
            border: 1px solid var(--color-info);
            color: var(--color-info);
        }

        /* ===================================================================
           TOAST NOTIFICATIONS - GLASSMORPHISM
           =================================================================== */
        .toast-container {
            position: fixed;
            top: 1rem;
            right: 1rem;
            z-index: 9999;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
            pointer-events: none;
        }

        .toast {
            pointer-events: auto;
            min-width: 340px;
            background: var(--gradient-modal);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-xl);
            padding: var(--space-4) var(--space-6);
            box-shadow: var(--shadow-modal);
            display: flex;
            align-items: center;
            gap: var(--space-3);
        }

        .toast-success {
            border-left: 4px solid var(--color-success);
            box-shadow: var(--shadow-modal);
        }

        .toast-error {
            border-left: 4px solid var(--color-error);
            box-shadow: var(--shadow-modal);
        }

        .toast-warning {
            border-left: 4px solid var(--color-warning);
            box-shadow: var(--shadow-modal);
        }

        .toast-info {
            border-left: 4px solid var(--color-info);
            box-shadow: var(--shadow-modal);
        }

        /* ===================================================================
           MODAL COMPONENTS - GLASSMORPHISM
           =================================================================== */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: var(--color-overlay);
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            z-index: 9998;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: var(--space-4);
        }

        .modal {
            background: var(--gradient-modal);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-xl);
            box-shadow: var(--shadow-modal);
            width: 100%;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
        }

        .modal.max-w-md { max-width: 28rem; }
        .modal.max-w-2xl { max-width: 42rem; }
        .modal.max-w-4xl { max-width: 56rem; }
        .modal.max-w-6xl { max-width: 72rem; }

        .modal-header {
            padding: var(--space-6);
            border-bottom: 1px solid var(--color-border);
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--color-surface);
        }

        .modal-body {
            padding: var(--space-6);
            overflow-y: auto;
            flex: 1;
        }

        .modal-footer {
            padding: var(--space-6);
            border-top: 1px solid var(--color-border);
            display: flex;
            justify-content: flex-end;
            gap: var(--space-3);
            background: var(--color-surface-sub);
        }

        /* ===================================================================
           BADGE COMPONENTS - GLASSMORPHISM
           =================================================================== */
        .badge {
            display: inline-flex;
            align-items: center;
            padding: 0.35rem 0.875rem;
            border-radius: var(--radius-full);
            font-size: var(--text-xs);
            font-weight: var(--font-semibold);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            backdrop-filter: blur(8px);
            -webkit-backdrop-filter: blur(8px);
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
            transition: all 0.3s ease;
        }

        .badge:hover {
            transform: scale(1.05);
        }

        .badge-draft {
            background: var(--color-surface-mid);
            color: var(--color-text-secondary);
            border: 1px solid var(--color-border);
            box-shadow: var(--shadow-sm);
        }

        .badge-processing {
            background: var(--color-warning-surface);
            color: var(--color-warning-light);
            border: 1px solid var(--color-warning);
            box-shadow: var(--shadow-md);
            animation: processingPulse 2s ease-in-out infinite;
        }

        @keyframes processingPulse {
            0%, 100% { box-shadow: var(--shadow-md); }
            50% { box-shadow: var(--shadow-primary); }
        }

        .badge-completed {
            background: var(--color-success-surface);
            color: var(--color-success-light);
            border: 1px solid var(--color-success);
            box-shadow: var(--shadow-md);
        }

        .badge-failed {
            background: var(--color-danger-surface);
            color: var(--color-danger-light);
            border: 1px solid var(--color-error);
            box-shadow: var(--shadow-md);
        }

        .badge-awaiting_review {
            background: rgba(245, 158, 11, 0.15);
            color: #f59e0b;
            border: 1px solid #f59e0b;
            box-shadow: var(--shadow-md);
        }

        /* ===================================================================
           COMING SOON BADGE
           =================================================================== */
        .badge-coming-soon {
            display: inline-block;
            background: var(--color-surface-hover);
            color: var(--color-text-secondary);
            font-size: var(--text-xs);
            font-weight: var(--font-bold);
            padding: var(--space-1) var(--space-2);
            border-radius: var(--radius-tag);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border: 1px solid var(--color-border);
        }

        /* ===================================================================
           LOADING COMPONENTS - ENHANCED
           =================================================================== */
        .loading {
            display: inline-block;
            width: 24px;
            height: 24px;
            border: 3px solid var(--color-primary-surface);
            border-radius: 50%;
            border-top-color: var(--color-primary-500);
            animation: spin 0.8s ease-in-out infinite;
        }

        .loading-lg {
            width: 48px;
            height: 48px;
            border-width: 4px;
        }

        /* Skeleton Loading */
        .skeleton {
            background: var(--color-surface);
            border-radius: var(--radius-md);
            position: relative;
            overflow: hidden;
        }

        .skeleton-shimmer {
            animation: shimmer 1.5s ease-in-out infinite;
            background: linear-gradient(
                90deg,
                var(--color-surface) 0%,
                var(--color-surface-hover) 50%,
                var(--color-surface) 100%
            );
            background-size: 200% 100%;
        }

        /* ===================================================================
           PROGRESS COMPONENTS
           =================================================================== */
        .progress-bar {
            height: 8px;
            border-radius: var(--radius-full);
            background: var(--color-surface);
            overflow: hidden;
        }

        .progress-bar-fill {
            height: 100%;
            background: var(--gradient-primary);
            transition: width 500ms cubic-bezier(0.4, 0, 0.2, 1);
            border-radius: var(--radius-full);
        }

        /* ===================================================================
           STEP INDICATOR
           =================================================================== */
        .step-indicator {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            font-weight: var(--font-bold);
            transition: var(--transition-normal);
        }

        .step-active {
            background: var(--gradient-primary);
            color: white;
            box-shadow: var(--shadow-primary);
        }

        .step-completed {
            background: var(--color-success);
            color: white;
        }

        .step-pending {
            background: var(--color-surface);
            color: var(--color-text-tertiary);
            border: 2px solid var(--color-border);
        }

        /* ===================================================================
           PAGINATION
           =================================================================== */
        .pagination-btn {
            padding: 0.5rem 0.75rem;
            border-radius: var(--radius-md);
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            color: var(--color-text-primary);
            cursor: pointer;
            transition: var(--transition-fast);
            min-width: 40px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
        }

        .pagination-btn:hover:not(:disabled) {
            background: var(--color-surface-hover);
            border-color: var(--color-border-hover);
        }

        .pagination-btn.active {
            background: var(--gradient-primary);
            border-color: transparent;
            color: white;
        }

        .pagination-btn:disabled {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* ===================================================================
           SCROLLBAR UTILITY
           Global ::-webkit-scrollbar rules are defined in BASE STYLES.
           .scrollbar-thin is kept for explicit use on overflow containers.
           =================================================================== */
        .scrollbar-thin::-webkit-scrollbar { width: 6px; height: 6px; }
        .scrollbar-thin::-webkit-scrollbar-track { background: transparent; border-radius: 3px; }
        .scrollbar-thin::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.28); border-radius: 3px; transition: background 0.2s; }
        .scrollbar-thin::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.55); }
        .scrollbar-thin { scrollbar-width: thin; scrollbar-color: rgba(139,92,246,0.28) transparent; }

        /* ===================================================================
           PREVIEW CONTENT
           =================================================================== */
        .preview-content {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            padding: 1.25rem 1.5rem;
            max-height: 500px;
            overflow-y: auto;
            white-space: pre-wrap;
            font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
            font-size: 0.9375rem;
            line-height: 1.8;
            color: var(--color-text);
            letter-spacing: 0.01em;
        }

        .preview-editable {
            display: block;
            width: 100%;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            padding: 1.25rem 1.5rem;
            max-height: 560px;
            overflow-y: auto;
            white-space: pre-wrap;
            font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
            font-size: 0.9375rem;
            line-height: 1.8;
            color: var(--color-text);
            letter-spacing: 0.01em;
            resize: vertical;
            outline: none;
            box-sizing: border-box;
            transition: border-color 0.15s ease;
        }

        .preview-editable:focus {
            border-color: var(--color-primary);
            box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.18);
        }

        /* ===================================================================
           ANIMATIONS & KEYFRAMES
           =================================================================== */
        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes fadeOut {
            from { opacity: 1; }
            to { opacity: 0; }
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes fadeInDown {
            from {
                opacity: 0;
                transform: translateY(-20px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        @keyframes slideInRight {
            from {
                opacity: 0;
                transform: translateX(100%);
            }
            to {
                opacity: 1;
                transform: translateX(0);
            }
        }

        @keyframes slideOutRight {
            from {
                opacity: 1;
                transform: translateX(0);
            }
            to {
                opacity: 0;
                transform: translateX(100%);
            }
        }

        @keyframes scaleIn {
            from {
                opacity: 0;
                transform: scale(0.95);
            }
            to {
                opacity: 1;
                transform: scale(1);
            }
        }

        @keyframes scaleOut {
            from {
                opacity: 1;
                transform: scale(1);
            }
            to {
                opacity: 0;
                transform: scale(0.95);
            }
        }

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

        @keyframes bounce {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-10px); }
        }

        /* Animation Utility Classes */
        .animate-fadeIn { animation: fadeIn 250ms cubic-bezier(0, 0, 0.2, 1); }
        .animate-fadeOut { animation: fadeOut 250ms cubic-bezier(0.4, 0, 1, 1); }
        .animate-fadeInUp { animation: fadeInUp 250ms cubic-bezier(0, 0, 0.2, 1); }
        .animate-fadeInDown { animation: fadeInDown 250ms cubic-bezier(0, 0, 0.2, 1); }
        .animate-slideInRight { animation: slideInRight 300ms cubic-bezier(0, 0, 0.2, 1); }
        .animate-slideOutRight { animation: slideOutRight 300ms cubic-bezier(0.4, 0, 1, 1); }
        .animate-scaleIn { animation: scaleIn 250ms cubic-bezier(0, 0, 0.2, 1); }
        .animate-scaleOut { animation: scaleOut 250ms cubic-bezier(0.4, 0, 1, 1); }
        .animate-spin { animation: spin 1s linear infinite; }
        .animate-bounce { animation: bounce 1s ease-in-out infinite; }

        /* ===================================================================
           RESPONSIVE DESIGN
           =================================================================== */
        @media (max-width: 768px) {
            .sidebar {
                position: fixed;
                left: -100%;
                z-index: 40;
                transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            }

            .sidebar.open {
                left: 0;
            }

            .mobile-overlay {
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.5);
                z-index: 30;
            }

            .toast-container {
                left: 1rem;
                right: 1rem;
            }

            .toast {
                min-width: auto;
                width: 100%;
            }
        }

        /* Skip link - visible on focus only */
        .skip-link {
            position: absolute;
            left: -9999px;
            z-index: 99999;
            padding: 0.75rem 1.5rem;
            background: var(--color-primary-500);
            color: white;
            font-weight: 600;
            border-radius: var(--radius-md);
            transition: left 0.2s ease;
        }
        .skip-link:focus {
            left: 1rem;
            top: 1rem;
            outline: 2px solid white;
            outline-offset: 2px;
        }

        /* ===================================================================
           ACCESSIBILITY
           =================================================================== */
        @media (prefers-reduced-motion: reduce) {
            *,
            *::before,
            *::after {
                animation-duration: 0.01ms !important;
                animation-iteration-count: 1 !important;
                transition-duration: 0.01ms !important;
            }
        }

        /* Touch targets - min 44px for primary actions (accessibility) */
        .touch-target-min {
            min-width: 44px;
            min-height: 44px;
        }

        /* Focus visible for keyboard navigation */
        :focus-visible {
            outline: 2px solid var(--color-primary-500);
            outline-offset: 2px;
        }

        /* ===================================================================
           UTILITY CLASSES
           =================================================================== */
        /* Layout */
        .min-h-screen { min-height: 100vh; }
        .h-screen { height: 100vh; }
        .h-full { height: 100%; }
        .w-full { width: 100%; }
        .w-64 { width: 16rem; }
        .w-32 { width: 8rem; }
        .w-40 { width: 10rem; }
        .flex { display: flex; }
        .inline-flex { display: inline-flex; }
        .flex-col { flex-direction: column; }
        .flex-wrap { flex-wrap: wrap; }
        .flex-1 { flex: 1; }
        .flex-shrink-0 { flex-shrink: 0; }
        .items-center { align-items: center; }
        .items-start { align-items: flex-start; }
        .items-end { align-items: flex-end; }
        .justify-center { justify-content: center; }
        .justify-between { justify-content: space-between; }
        .justify-end { justify-content: flex-end; }
        .gap-1 { gap: 0.25rem; }
        .gap-2 { gap: 0.5rem; }
        .gap-3 { gap: 0.75rem; }
        .gap-4 { gap: 1rem; }
        .gap-6 { gap: 1.5rem; }
        .gap-x-4 { column-gap: 1rem; }
        .gap-y-1 { row-gap: 0.25rem; }
        .gap-y-2 { row-gap: 0.5rem; }
        .space-y-1 > * + * { margin-top: 0.25rem; }
        .space-y-2 > * + * { margin-top: 0.5rem; }
        .space-y-3 > * + * { margin-top: 0.75rem; }
        .space-y-4 > * + * { margin-top: 1rem; }
        .space-y-6 > * + * { margin-top: 1.5rem; }
        .overflow-hidden { overflow: hidden; }
        .overflow-auto { overflow: auto; }
        .overflow-y-auto { overflow-y: auto; }
        
        /* Grid */
        .grid { display: grid; }
        .grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
        .grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        .grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
        .col-span-1 { grid-column: span 1 / span 1; }
        .col-span-2 { grid-column: span 2 / span 2; }
        .col-span-3 { grid-column: span 3 / span 3; }
        
        /* Positioning */
        .relative { position: relative; }
        .absolute { position: absolute; }
        .fixed { position: fixed; }
        .inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
        .z-10 { z-index: 10; }
        .z-20 { z-index: 20; }
        .z-30 { z-index: 30; }
        .z-40 { z-index: 40; }
        .z-50 { z-index: 50; }
        
        /* Sizing */
        .min-w-\[200px\] { min-width: 200px; }
        
        /* Spacing - Margins */
        .mb-1 { margin-bottom: 0.25rem; }
        .mb-2 { margin-bottom: 0.5rem; }
        .mb-3 { margin-bottom: 0.75rem; }
        .mb-4 { margin-bottom: 1rem; }
        .mb-5 { margin-bottom: 1.25rem; }
        .mb-6 { margin-bottom: 1.5rem; }
        .mb-8 { margin-bottom: 2rem; }
        .mt-1 { margin-top: 0.25rem; }
        .mt-2 { margin-top: 0.5rem; }
        .mt-3 { margin-top: 0.75rem; }
        .mt-4 { margin-top: 1rem; }
        .mt-6 { margin-top: 1.5rem; }
        .mt-16 { margin-top: 4rem; }
        .mr-1 { margin-right: 0.25rem; }
        .mr-2 { margin-right: 0.5rem; }
        .mr-3 { margin-right: 0.75rem; }
        .ml-2 { margin-left: 0.5rem; }
        .ml-auto { margin-left: auto; }
        
        /* Spacing - Padding */
        .p-1 { padding: 0.25rem; }
        .p-2 { padding: 0.5rem; }
        .p-3 { padding: 0.75rem; }
        .p-4 { padding: 1rem; }
        .p-5 { padding: 1.25rem; }
        .p-6 { padding: 1.5rem; }
        .p-8 { padding: 2rem; }
        .px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
        .px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
        .px-4 { padding-left: 1rem; padding-right: 1rem; }
        .py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
        .py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
        .py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
        .py-8 { padding-top: 2rem; padding-bottom: 2rem; }
        .py-12 { padding-top: 3rem; padding-bottom: 3rem; }
        
        /* Text */
        .text-center { text-align: center; }
        .text-left { text-align: left; }
        .text-right { text-align: right; }
        .font-bold { font-weight: var(--font-bold); }
        .font-semibold { font-weight: var(--font-semibold); }
        .font-medium { font-weight: var(--font-medium); }
        .text-xs { font-size: 0.75rem; }
        .text-sm { font-size: var(--text-sm); }
        .text-base { font-size: 1rem; }
        .text-lg { font-size: var(--text-lg); }
        .text-xl { font-size: var(--text-xl); }
        .text-2xl { font-size: 1.5rem; }
        .text-3xl { font-size: 1.875rem; }
        .text-4xl { font-size: 2.25rem; }
        .text-5xl { font-size: 3rem; }
        .text-6xl { font-size: 3.75rem; }
        .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .capitalize { text-transform: capitalize; }
        .uppercase { text-transform: uppercase; }
        .font-mono { font-family: 'Courier New', Courier, monospace; }
        .whitespace-pre-wrap { white-space: pre-wrap; }
        .select-all { user-select: all; }
        
        /* Colors */
        .text-white { color: white; }
        .text-gray-300 { color: #d1d5db; }
        .text-gray-400 { color: #9ca3af; }
        .text-gray-500 { color: #6b7280; }
        .text-gray-600 { color: #4b5563; }
        .text-red-400 { color: #f87171; }
        .text-green-400 { color: #4ade80; }
        .text-blue-400 { color: #60a5fa; }
        .text-yellow-400 { color: #facc15; }
        .text-purple-400 { color: #c084fc; }
        .text-purple-500 { color: #a855f7; }
        .bg-gray-700 { background-color: #374151; }
        .bg-gray-800 { background-color: #1f2937; }
        .bg-gray-900 { background-color: #111827; }
        .bg-black { background-color: #000; }
        .bg-purple-500 { background-color: #a855f7; }
        .bg-purple-600 { background-color: #9333ea; }
        .bg-blue-500 { background-color: #3b82f6; }
        .bg-green-500 { background-color: #22c55e; }
        .bg-red-500 { background-color: #ef4444; }
        .bg-yellow-500 { background-color: #eab308; }
        .bg-opacity-20 { --tw-bg-opacity: 0.2; }
        .bg-opacity-50 { --tw-bg-opacity: 0.5; }
        .bg-opacity-80 { --tw-bg-opacity: 0.8; }
        .bg-white\/5  { background-color: rgba(255, 255, 255, 0.05); }
        .bg-white\/10 { background-color: rgba(255, 255, 255, 0.10); }
        .bg-white\/20 { background-color: rgba(255, 255, 255, 0.20); }
        .border-white\/10 { border-color: rgba(255, 255, 255, 0.10); }
        .border-white\/20 { border-color: rgba(255, 255, 255, 0.20); }
        
        /* Borders */
        .border { border-width: 1px; }
        .border-t { border-top-width: 1px; }
        .border-b { border-bottom-width: 1px; }
        .border-l { border-left-width: 1px; }
        .border-r { border-right-width: 1px; }
        .border-gray-700 { border-color: #374151; }
        .border-gray-800 { border-color: #1f2937; }
        .border-green-500 { border-color: #22c55e; }
        .border-opacity-30 { --tw-border-opacity: 0.3; }
        .rounded { border-radius: 0.25rem; }
        .rounded-lg { border-radius: var(--radius-lg); }
        .rounded-xl { border-radius: var(--radius-xl); }
        .rounded-full { border-radius: var(--radius-full); }
        
        /* Display */
        .block { display: block; }
        .hidden { display: none; }
        
        /* Hover states */
        .hover\:bg-gray-700:hover { background: #374151; }
        .hover\:bg-gray-800:hover { background: rgba(255, 255, 255, 0.05); }
        .hover\:bg-purple-500:hover { background: #a855f7; }
        .hover\:text-white:hover { color: white; }
        .hover\:text-purple-300:hover { color: #d8b4fe; }
        .hover\:bg-opacity-100:hover { --tw-bg-opacity: 1; }
        
        /* Transitions */
        .transition-all { transition: all 150ms cubic-bezier(0, 0, 0.2, 1); }
        .transition-colors { transition: color 150ms cubic-bezier(0, 0, 0.2, 1), background-color 150ms cubic-bezier(0, 0, 0.2, 1); }
        
        /* Transforms */
        .active\:scale-95:active { transform: scale(0.95); }
        
        /* Scrollbar */
        /* Ring */
        .ring-2 { box-shadow: 0 0 0 2px; }
        .ring-white { --tw-ring-color: white; }
        
        /* Responsive: Small screens (≥ 640px) */
        @media (min-width: 640px) {
            .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .sm\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
        }

        /* Responsive: Medium screens (≥ 768px) */
        @media (min-width: 768px) {
            .md\:hidden { display: none; }
            .md\:flex { display: flex; }
            .md\:flex-row { flex-direction: row; }
            .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .md\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
            .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
            .md\:col-span-1 { grid-column: span 1 / span 1; }
            .md\:col-span-2 { grid-column: span 2 / span 2; }
            .md\:col-span-3 { grid-column: span 3 / span 3; }
        }

        /* Responsive: Large screens (≥ 1024px) */
        @media (min-width: 1024px) {
            .lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
            .lg\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
            .lg\:col-span-2 { grid-column: span 2 / span 2; }
        }
