/* Vision — Component Styles */
/* ── Sidebar ─── */
        .sidebar {
            width: var(--sidebar-width);
            background: var(--surface-2);
            border-right: 1px solid var(--border-subtle);
            display: flex;
            flex-direction: column;
            height: 100vh;
            flex-shrink: 0;
            overflow-y: auto;
            overflow-x: hidden;
            position: relative;
            z-index: 100;
            transition: width 0.25s var(--ease-out);
        }

        /* ── Collapsed State ── */
        .sidebar.collapsed {
            width: var(--sidebar-collapsed-width);
            overflow-y: hidden;
            overflow-x: hidden;
        }

        .sidebar.collapsed .sidebar-brand > div,
        .sidebar.collapsed .nav-section-label,
        .sidebar.collapsed .nav-link-text,
        .sidebar.collapsed .nav-submenu,
        .sidebar.collapsed #sidebar-auto-mode,
        .sidebar.collapsed #dev-mode-badge,
        .sidebar.collapsed .sidebar-env-details,
        .sidebar.collapsed .sidebar-env-label,
        .sidebar.collapsed .user-identity-text {
            display: none;
        }

        .sidebar.collapsed .sidebar-brand {
            justify-content: center;
            padding: var(--s3) 0;
            gap: 0;
        }

        .sidebar.collapsed .sidebar-brand-logo {
            width: 26px;
            height: 26px;
        }

        .sidebar.collapsed .sidebar-collapse-btn {
            position: absolute;
            opacity: 0;
            pointer-events: none;
        }

        .sidebar.collapsed .nav-section {
            padding: 0;
        }

        .sidebar.collapsed .nav-link {
            justify-content: center;
            padding: var(--s2) 0;
            gap: 0;
        }

        .sidebar.collapsed .nav-link .nav-link-icon {
            margin: 0;
        }

        .sidebar.collapsed .nav-link.active::before {
            left: 0;
        }

        /* User identity badge — collapsed: show only icon centered */
        .sidebar.collapsed #user-identity-badge {
            justify-content: center;
            padding: 8px !important;
            gap: 0 !important;
        }

        .sidebar.collapsed #user-identity-badge svg {
            flex-shrink: 0;
        }

        /* Hide logout button text, show icon-like button */
        .sidebar.collapsed .btn.w-full {
            justify-content: center;
            padding: 8px !important;
            font-size: 0 !important;
        }

        /* Collapse padding on user identity container */
        .sidebar.collapsed .sidebar > div:last-of-type,
        .sidebar.collapsed > div[style*="padding: 12px 16px"] {
            padding: 8px !important;
        }

        .sidebar.collapsed .sidebar-collapse-btn svg {
            transform: rotate(180deg);
        }

        .sidebar.collapsed .sidebar-env-info {
            margin: 0 auto 8px;
            padding: 8px 4px;
            align-items: center;
            width: calc(100% - 12px);
        }

        .sidebar.collapsed .sidebar-env-row svg,
        .sidebar.collapsed .sidebar-env-dot {
            margin: 0;
        }

        /* ── Hover-Expand from collapsed ── */
        .sidebar.collapsed:hover {
            width: var(--sidebar-width);
            position: fixed !important;
            top: 0;
            left: 0;
            height: 100vh;
            box-shadow: 8px 0 30px rgba(0, 0, 0, 0.4);
            z-index: 200;
            overflow-y: auto !important;
            overflow-x: hidden;
        }

        .sidebar.collapsed:hover .sidebar-brand > div,
        .sidebar.collapsed:hover .nav-section-label,
        .sidebar.collapsed:hover .nav-link-text,
        .sidebar.collapsed:hover .nav-submenu,
        .sidebar.collapsed:hover #sidebar-auto-mode,
        .sidebar.collapsed:hover #dev-mode-badge,
        .sidebar.collapsed:hover .sidebar-env-details,
        .sidebar.collapsed:hover .sidebar-env-label,
        .sidebar.collapsed:hover .user-identity-text {
            display: revert;
        }

        .sidebar.collapsed:hover #user-identity-badge {
            justify-content: flex-start !important;
            padding: 8px 10px !important;
            gap: 10px !important;
        }

        .sidebar.collapsed:hover .btn.w-full {
            font-size: 11px !important;
            padding: 10px !important;
        }

        .sidebar.collapsed:hover > div[style*="padding: 12px 16px"] {
            padding: 12px 16px !important;
        }

        .sidebar.collapsed:hover .sidebar-brand {
            justify-content: flex-start;
            padding: var(--s6) var(--s5);
            gap: var(--s3);
        }

        .sidebar.collapsed:hover .sidebar-brand-logo {
            width: 28px;
            height: 28px;
        }

        .sidebar.collapsed:hover .sidebar-collapse-btn {
            position: static;
            opacity: 1;
            pointer-events: auto;
            transition: opacity 0.2s ease 0.1s;
        }

        .sidebar.collapsed:hover .nav-section {
            padding: 0 var(--s3);
        }

        .sidebar.collapsed:hover .nav-link {
            justify-content: flex-start;
            padding: var(--s2) var(--s3);
            gap: var(--s3);
            margin: 0;
        }

        .sidebar.collapsed:hover .sidebar-env-info {
            margin: 0 12px 8px;
            padding: 10px 12px;
            align-items: flex-start;
        }

        /* Collapsed main viewport margin compensation */
        body.sidebar-collapsed .main-viewport {
            margin-left: var(--sidebar-collapsed-width);
        }

        body.sidebar-collapsed .sidebar {
            position: fixed;
            top: 0;
            left: 0;
            bottom: 0;
        }

        /* ── Collapse Toggle Button ── */
        .sidebar-collapse-btn {
            display: flex;
            align-items: center;
            justify-content: center;
            width: 24px;
            height: 24px;
            border-radius: 6px;
            border: 1px solid var(--border-subtle);
            background: var(--surface-3);
            color: var(--text-muted);
            cursor: pointer;
            flex-shrink: 0;
            transition: all 0.18s ease;
        }

        .sidebar-collapse-btn:hover {
            background: var(--surface-hover);
            border-color: var(--border-default);
            color: var(--text-primary);
        }

        .sidebar-collapse-btn svg {
            width: 12px;
            height: 12px;
            transition: transform 0.25s var(--ease-out);
        }

        /* ── Sidebar Environment Info ── */
        .sidebar-env-info {
            display: flex;
            flex-direction: column;
            gap: 6px;
            padding: 10px 12px;
            margin: 0 12px 8px;
            background: rgba(15, 23, 42, 0.5);
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-md);
            transition: all 0.2s ease;
        }

        .sidebar-env-row {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 10px;
            font-weight: 700;
            color: var(--text-muted);
            letter-spacing: 0.5px;
        }

        .sidebar-env-row svg {
            width: 12px;
            height: 12px;
            flex-shrink: 0;
            opacity: 0.6;
        }

        .sidebar-env-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .sidebar-env-dot.dev {
            background: var(--warning);
            box-shadow: 0 0 6px var(--warning-glow);
        }

        .sidebar-env-dot.prod {
            background: var(--success);
            box-shadow: 0 0 6px var(--success-glow);
        }

        /* ── Nav Sub-menus ── */
        .nav-submenu {
            display: flex;
            flex-direction: column;
            padding: 2px 0 4px 0;
            margin: 0 0 2px 0;
            overflow: hidden;
            transition: max-height 0.25s var(--ease-out), opacity 0.2s ease;
        }

        .nav-submenu .nav-sub-item {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 5px 12px 5px 38px;
            color: var(--text-muted);
            font-size: 12px;
            font-weight: 500;
            cursor: pointer;
            border-radius: var(--r-sm);
            margin: 0 var(--s1);
            transition: all 0.15s ease;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .nav-sub-item:hover {
            background: var(--surface-hover);
            color: var(--text-primary);
        }

        .nav-sub-item.active {
            color: var(--accent-light);
            font-weight: 600;
            background: var(--surface-active);
        }

        .nav-sub-item svg {
            width: 13px;
            height: 13px;
            flex-shrink: 0;
            opacity: 0.5;
        }

        .nav-sub-item.active svg {
            opacity: 1;
        }

        .sidebar h2 {
            /* legacy compat */
            color: var(--text-primary);
            font-size: 15px;
            margin-bottom: 0;
            font-weight: 800;
            letter-spacing: 0.05rem;
        }

        .sidebar-brand {
            display: flex;
            align-items: center;
            gap: var(--s3);
            padding: var(--s6) var(--s5);
            border-bottom: 1px solid var(--border-subtle);
            margin-bottom: var(--s4);
            cursor: pointer;
            text-decoration: none;
            transition: opacity 0.2s ease;
        }

        .sidebar-brand:hover {
            opacity: 0.8;
        }

        .sidebar-brand-logo {
            width: 28px;
            height: 28px;
            flex-shrink: 0;
            filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.7));
        }

        .sidebar-brand-name {
            font-size: 20px;
            font-weight: 800;
            letter-spacing: 0.15rem;
            background: var(--grad-accent);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            color: transparent;
        }

        .sidebar-brand-sub {
            font-size: 9px;
            font-weight: 600;
            color: var(--text-muted);
            letter-spacing: 0.1rem;
            text-transform: uppercase;
            display: block;
            margin-top: -2px;
        }

        .nav-section {
            padding: 0 var(--s3);
            margin-bottom: var(--s2);
        }

        .nav-section-label {
            font-size: 10px;
            font-weight: 700;
            color: var(--text-muted);
            letter-spacing: 0.12rem;
            text-transform: uppercase;
            padding: var(--s3) var(--s3) var(--s2) var(--s3);
        }

        .nav-link {
            display: flex;
            align-items: center;
            gap: var(--s3);
            padding: var(--s2) var(--s3);
            color: var(--text-secondary);
            border-radius: var(--r-md);
            font-size: 13.5px;
            font-weight: 500;
            cursor: pointer;
            border: 1px solid transparent;
            transition: all 0.18s var(--ease-out);
            position: relative;
            margin-bottom: 2px;
            user-select: none;
        }

        .nav-link-icon {
            width: 18px;
            height: 18px;
            opacity: 0.6;
            flex-shrink: 0;
            transition: opacity 0.18s ease;
        }

        .nav-link:hover {
            background: var(--surface-hover);
            color: var(--text-primary);
            border-color: var(--border-subtle);
        }

        .nav-link:hover .nav-link-icon {
            opacity: 0.9;
        }

        .nav-link.active {
            background: var(--surface-active);
            color: var(--accent-light);
            border-color: var(--border-default);
            font-weight: 600;
        }

        .nav-link.active .nav-link-icon {
            opacity: 1;
        }

        .nav-link.active::before {
            content: '';
            position: absolute;
            left: 0;
            top: 25%;
            bottom: 25%;
            width: 2.5px;
            background: var(--accent-light);
            border-radius: 0 4px 4px 0;
            box-shadow: 0 0 8px var(--accent-glow);
        }

        .sidebar-footer {
            margin-top: auto;
            padding: var(--s4) var(--s3);
            border-top: 1px solid var(--border-subtle);
        }

        .sidebar-status-chip {
            display: flex;
            align-items: center;
            gap: var(--s2);
            padding: var(--s2) var(--s3);
            background: var(--surface-3);
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-md);
            font-size: 10px;
            font-weight: 700;
            color: var(--text-muted);
            letter-spacing: 0.05rem;
        }

        .status-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--success);
            box-shadow: 0 0 8px var(--success-glow);
            animation: pulse-dot 2s ease infinite;
            flex-shrink: 0;
        }

        @keyframes pulse-dot {

            0%,
            100% {
                opacity: 1;
            }

            50% {
                opacity: 0.35;
            }
        }

        /* ── Main ─── */
        .main-viewport {
            flex: 1;
            height: 100vh;
            overflow-y: auto;
            overflow-x: hidden;
            display: flex;
            flex-direction: column;
            position: relative;
            z-index: 1;
        }

        .topbar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: var(--s4) var(--s10);
            border-bottom: 1px solid var(--border-subtle);
            background: rgba(6, 8, 16, 0.72);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            position: sticky;
            top: 0;
            z-index: 50;
            min-height: 56px;
        }

        .breadcrumb {
            display: flex;
            align-items: center;
            gap: var(--s2);
            font-size: 13px;
            color: var(--text-muted);
            font-weight: 500;
        }

        .breadcrumb-sep {
            color: var(--text-disabled);
        }

        .breadcrumb-item {
            color: var(--text-muted);
            cursor: pointer;
            transition: color 0.16s;
        }

        .breadcrumb-item:hover {
            color: var(--text-primary);
        }

        .breadcrumb-item.current {
            color: var(--text-primary);
            font-weight: 600;
            cursor: default;
        }

        .topbar-actions {
            display: flex;
            align-items: center;
            gap: var(--s3);
        }

        .content-area {
            padding: var(--s8) var(--s10);
            flex: 1;
        }

        /* ── Section header ─── */
        .section-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            margin-bottom: var(--s8);
        }

        .section-title {
            font-size: 22px;
            font-weight: 800;
            color: var(--text-primary);
            letter-spacing: -0.4px;
        }

        .section-subtitle {
            font-size: 13px;
            color: var(--text-secondary);
            margin-top: 2px;
        }

        /* ── Cards ─── */
        .card {
            background: var(--surface-1);
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-xl);
            padding: var(--s6);
            position: relative;
            overflow: hidden;
            transition: border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
        }

        .card:hover {
            border-color: var(--border-default);
        }

        .pipeline-card:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 24px rgba(0,0,0,0.3);
            border-color: var(--accent-light) !important;
        }

        .metric-card {
            background: var(--surface-1);
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-xl);
            padding: var(--s5) var(--s6);
            position: relative;
            overflow: hidden;
            transition: all 0.22s var(--ease-out);
        }

        .metric-card::after {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 1px;
            background: var(--grad-accent);
            opacity: 0.5;
        }

        .metric-card:hover {
            border-color: var(--border-default);
            transform: translateY(-2px);
            box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.5);
        }

        .metric-label {
            font-size: 11px;
            font-weight: 700;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 0.08rem;
            margin-bottom: var(--s3);
        }

        .metric-value {
            font-size: 28px;
            font-weight: 900;
            letter-spacing: -0.8px;
            background: var(--grad-accent);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
            color: transparent;
            line-height: 1;
            margin-bottom: var(--s2);
        }

        .metric-trend {
            font-size: 11px;
            font-weight: 600;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .metric-trend.up {
            color: var(--success);
        }

        .metric-trend.down {
            color: var(--danger);
        }

        .metric-trend.flat {
            color: var(--text-muted);
        }

        .entity-card {
            background: var(--surface-1);
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-xl);
            padding: var(--s5) var(--s6);
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: all 0.22s var(--ease-out);
        }

        .entity-card::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: var(--grad-accent);
            opacity: 0;
            transition: opacity 0.22s ease;
        }

        .entity-card:hover {
            border-color: var(--border-default);
            background: var(--surface-hover);
            transform: translateX(4px);
        }

        .entity-card:hover::before {
            opacity: 1;
        }

        .entity-card-title {
            font-size: 14px;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 4px;
        }

        .entity-card-meta {
            font-size: 12px;
            color: var(--text-secondary);
        }

        /* ── Status Pills ─── */
        .pill {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 3px 10px;
            border-radius: 100px;
            font-size: 10.5px;
            font-weight: 700;
            letter-spacing: 0.04rem;
            text-transform: uppercase;
        }

        .pill-dot {
            width: 5px;
            height: 5px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .pill.active {
            background: rgba(16, 185, 129, 0.1);
            color: var(--success);
            border: 1px solid rgba(16, 185, 129, 0.2);
        }

        .pill.active .pill-dot {
            background: var(--success);
            box-shadow: 0 0 5px var(--success);
        }

        .pill.working {
            background: rgba(124, 58, 237, 0.1);
            color: var(--accent-light);
            border: 1px solid rgba(124, 58, 237, 0.2);
        }

        .pill.working .pill-dot {
            background: var(--accent-light);
        }

        .pill.idle {
            background: rgba(245, 158, 11, 0.1);
            color: var(--warning);
            border: 1px solid rgba(245, 158, 11, 0.2);
        }

        .pill.idle .pill-dot {
            background: var(--warning);
        }

        .pill.error {
            background: rgba(239, 68, 68, 0.1);
            color: var(--danger);
            border: 1px solid rgba(239, 68, 68, 0.2);
        }

        .pill.error .pill-dot {
            background: var(--danger);
        }

        /* ── Buttons ─── */
        .btn {
            display: inline-flex;
            align-items: center;
            gap: var(--s2);
            font-family: 'Inter', sans-serif;
            font-weight: 700;
            font-size: 12.5px;
            letter-spacing: 0.02rem;
            cursor: pointer;
            border: none;
            border-radius: var(--r-md);
            transition: all 0.18s var(--ease-out);
            white-space: nowrap;
            position: relative;
            overflow: hidden;
            text-decoration: none;
            padding: 9px 18px;
            background: var(--surface-3);
            color: var(--text-primary);
        }

        .btn:hover {
            transform: translateY(-1px);
            filter: brightness(1.1);
        }

        .btn-primary {
            background: linear-gradient(135deg, var(--accent), var(--accent-dim));
            color: #fff;
            box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.3), 0 8px 20px -4px rgba(124, 58, 237, 0.4);
        }

        .btn-primary:hover {
            box-shadow: 0 0 0 1px rgba(124, 58, 237, 0.5), 0 12px 28px -4px rgba(124, 58, 237, 0.5);
        }

        .btn-secondary {
            background: var(--surface-3);
            color: var(--text-primary);
            border: 1px solid var(--border-default);
        }

        .btn-secondary:hover {
            background: var(--surface-hover);
            border-color: var(--border-strong);
        }

        .btn-ghost {
            background: transparent !important;
            border: 1px solid var(--border-default) !important;
            color: var(--text-secondary) !important;
            padding: 9px 16px !important;
            box-shadow: none !important;
        }

        .btn-ghost:hover {
            background: var(--surface-hover) !important;
            color: var(--text-primary) !important;
            border-color: var(--border-strong) !important;
        }

        .btn-danger {
            background: rgba(239, 68, 68, 0.1);
            color: var(--danger);
            border: 1px solid rgba(239, 68, 68, 0.2);
        }

        /* ── DB Explorer Quick Query Pills ─── */
        .db-quick-pill {
            font-size: 9px;
            padding: 3px 10px;
            border-radius: 12px;
            border: 1px solid var(--border-subtle);
            background: rgba(139, 92, 246, 0.06);
            color: #8b5cf6;
            cursor: pointer;
            font-weight: 700;
            font-family: 'Inter', sans-serif;
            transition: all 0.15s;
        }
        .db-quick-pill:hover {
            background: rgba(139, 92, 246, 0.15);
            border-color: rgba(139, 92, 246, 0.3);
        }

        /* ── Project Memory Enhancements ─── */
        .vision-core-block {
            background: linear-gradient(165deg, rgba(124, 58, 237, 0.15) 0%, rgba(6, 182, 212, 0.05) 100%) !important;
            border: 1.5px solid var(--accent-glow) !important;
            box-shadow: 0 0 30px rgba(124, 58, 237, 0.1);
        }

        .perspective-icon {
            font-size: 24px;
            filter: drop-shadow(0 0 8px var(--accent-light));
            animation: pulse-gear 4s linear infinite;
        }

        @keyframes pulse-gear {
            0% { transform: rotate(0deg) scale(1); opacity: 0.8; }
            50% { transform: rotate(180deg) scale(1.1); opacity: 1; }
            100% { transform: rotate(360deg) scale(1); opacity: 0.8; }
        }

        .cognitive-badge {
            font-size: 9px;
            font-weight: 900;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            padding: 4px 10px;
            border-radius: 100px;
            background: rgba(124, 58, 237, 0.1);
            color: var(--accent-light);
            border: 1px solid var(--accent-glow);
        }

        .sync-action-bar {
            position: sticky;
            bottom: 20px;
            left: 50%;
            transform: translateX(-50%);
            z-index: 100;
            background: rgba(10, 13, 26, 0.8);
            backdrop-filter: blur(20px);
            border: 1px solid var(--border-default);
            padding: 12px 24px;
            border-radius: 100px;
            display: flex;
            align-items: center;
            gap: 20px;
            box-shadow: 0 20px 40px rgba(0,0,0,0.5);
            animation: slide-up 0.4s var(--ease-out);
        }

        @keyframes slide-up {
            from { transform: translate(-50%, 40px); opacity: 0; }
            to { transform: translate(-50%, 0); opacity: 1; }
        }


        .btn-danger:hover {
            background: rgba(239, 68, 68, 0.18);
            border-color: rgba(239, 68, 68, 0.4);
            transform: none;
            filter: none;
        }

        .btn-sm {
            padding: 6px 14px !important;
            font-size: 12px !important;
            border-radius: var(--r-sm) !important;
        }

        /* ── Inputs ─── */
        input[type="text"],
        input[type="email"],
        input[type="number"],
        select,
        textarea {
            background: var(--surface-2);
            border: 1px solid var(--border-default);
            color: var(--text-primary);
            border-radius: var(--r-md);
            padding: 9px 14px;
            font-family: 'Inter', sans-serif;
            font-size: 13.5px;
            width: 100%;
            outline: none;
            transition: border-color 0.18s ease, box-shadow 0.18s ease;
            -webkit-appearance: none;
            appearance: none;
        }

        input:focus,
        select:focus,
        textarea:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px var(--accent-glow);
        }

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

        select option {
            background: var(--surface-3);
            color: var(--text-primary);
        }

        .field-label {
            display: block;
            font-size: 11px;
            font-weight: 700;
            color: var(--text-secondary);
            text-transform: uppercase;
            letter-spacing: 0.08rem;
            margin-bottom: 6px;
        }

        /* ── Grids & helpers ─── */
        .grid-3 {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: var(--s5);
        }

        .grid-2 {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: var(--s5);
        }

        .grid-auto {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: var(--s5);
        }

        .flex-row {
            display: flex;
            gap: var(--s5);
            align-items: center;
        }

        .flex-between {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .flex-col {
            display: flex;
            flex-direction: column;
            gap: var(--s5);
        }

        .mb-6 {
            margin-bottom: var(--s6);
        }

        .mb-8 {
            margin-bottom: var(--s8);
        }

        .sep {
            height: 1px;
            background: var(--border-subtle);
            margin: var(--s6) 0;
        }

        /* ── Modals ─── */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(6, 8, 16, 0.75);
            backdrop-filter: blur(8px);
            display: none;
            justify-content: center;
            align-items: center;
            z-index: 500;
        }

        .modal {
            background: var(--surface-2);
            border: 1px solid var(--border-default);
            border-radius: var(--r-2xl);
            padding: var(--s10);
            width: 520px;
            max-width: 90vw;
            box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.7);
            position: relative;
        }

        .modal::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 1px;
            background: var(--grad-accent);
            opacity: 0.4;
            border-radius: var(--r-2xl) var(--r-2xl) 0 0;
        }

        .modal h2 {
            font-size: 18px;
            font-weight: 800;
            margin-bottom: var(--s6);
            color: var(--text-primary);
        }

        .modal .field-group {
            display: flex;
            flex-direction: column;
            gap: var(--s5);
        }

        .modal .modal-actions {
            display: flex;
            gap: var(--s3);
            margin-top: var(--s8);
        }

        .modal-content {
            background: var(--surface-2);
            border-radius: var(--r-2xl);
            padding: var(--s10);
            border: 1px solid var(--border-default);
            position: relative;
            max-width: 520px;
            width: 100%;
        }

        /* ── Wizard ─── */
        .wizard-step {
            flex: 1;
            padding: 8px 10px;
            font-size: 11px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            background: rgba(255,255,255,0.02);
            border: 1px solid var(--border-subtle);
            border-radius: 8px;
            text-align: center;
            transition: all 0.2s ease;
        }
        .wizard-step span {
            display: inline-block;
            width: 18px;
            height: 18px;
            line-height: 18px;
            border-radius: 50%;
            background: rgba(255,255,255,0.05);
            font-size: 10px;
            margin-right: 4px;
            vertical-align: middle;
        }
        .wizard-step.active {
            color: var(--text-primary);
            background: rgba(6, 182, 212, 0.08);
            border-color: var(--accent);
        }
        .wizard-step.active span {
            background: var(--accent);
            color: #fff;
        }
        .wizard-step.done {
            color: var(--success);
            border-color: rgba(16, 185, 129, 0.2);
        }
        .wizard-step.done span {
            background: var(--success);
            color: #fff;
        }

        /* ── Discovery Chat Styles ────────────────────────────── */
        .disc-step {
            flex: 1;
            padding: 7px 10px;
            font-size: 10px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.05em;
            color: var(--text-muted);
            background: rgba(255,255,255,0.02);
            border: 1px solid var(--border-subtle);
            border-radius: 8px;
            text-align: center;
            transition: all 0.3s ease;
        }
        .disc-step.active {
            color: var(--text-primary);
            background: rgba(6, 182, 212, 0.08);
            border-color: var(--accent);
        }
        .disc-step.done {
            color: var(--success);
            background: rgba(16, 185, 129, 0.06);
            border-color: rgba(16, 185, 129, 0.2);
        }

        .disc-msg {
            display: flex;
            gap: 10px;
            animation: discFadeIn 0.3s ease-out;
        }
        @keyframes discFadeIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .disc-msg.disc-user {
            flex-direction: row-reverse;
        }
        .disc-avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
            flex-shrink: 0;
            background: rgba(255,255,255,0.04);
        }
        .disc-bubble {
            background: var(--surface-3);
            border: 1px solid var(--border-subtle);
            border-radius: 14px;
            padding: 12px 16px;
            font-size: 13px;
            line-height: 1.5;
            max-width: 85%;
        }
        .disc-msg.disc-user .disc-bubble {
            background: rgba(6, 182, 212, 0.1);
            border-color: rgba(6, 182, 212, 0.2);
        }
        .disc-msg.disc-ai .disc-bubble {
            background: rgba(139, 92, 246, 0.06);
            border-color: rgba(139, 92, 246, 0.15);
        }
        .disc-model-sig {
            display: block;
            font-size: 9px;
            color: var(--text-muted);
            opacity: 0.45;
            text-align: right;
            margin-top: 6px;
            font-style: italic;
        }
        /* Expert Progress Panel */
        .disc-expert-progress {
            padding: 14px 16px;
            line-height: 1.8;
        }
        .disc-expert-progress .expert-step {
            font-size: 12px;
            color: var(--text-muted);
            opacity: 0.4;
            transition: opacity 0.4s, color 0.4s;
        }
        .disc-expert-progress .expert-step.active {
            opacity: 1;
            color: var(--accent);
        }
        .disc-expert-progress .expert-step.done {
            opacity: 0.7;
            color: var(--text-secondary);
        }
        .disc-expert-progress .expert-step .expert-icon {
            display: inline-block;
            width: 16px;
            text-align: center;
            margin-right: 4px;
        }

        /* Live Understanding Panel — horizontal strip */
        .disc-understand-panel {
            display: none;
            border-bottom: 1px solid var(--border-subtle);
            background: rgba(139, 92, 246, 0.03);
            padding: 10px 24px;
            flex-shrink: 0;
            flex-direction: column;
            gap: 6px;
            max-height: 0;
            overflow: hidden;
            opacity: 0;
            transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.3s ease;
        }
        .disc-understand-panel.visible {
            display: flex;
            max-height: 240px;
            opacity: 1;
            overflow-y: auto;
        }
        .disc-understand-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 8px;
        }
        .disc-understand-title {
            font-size: 9px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.06em;
            color: var(--text-muted);
            display: flex;
            align-items: center;
            gap: 5px;
        }
        .disc-understand-title .disc-pulse-dot {
            width: 5px; height: 5px;
            background: var(--accent-cyan);
            border-radius: 50%;
            animation: discPulse 2s ease-in-out infinite;
        }
        .disc-understand-synthesis {
            font-size: 11px;
            color: var(--text-secondary);
            line-height: 1.55;
            animation: discFadeIn 0.3s ease-out;
        }
        .disc-understand-synthesis strong {
            color: var(--text-primary);
            font-weight: 600;
        }
        .disc-understand-empty {
            font-size: 11px;
            color: var(--text-muted);
            font-style: italic;
        }
        .disc-end-discovery-btn {
            padding: 4px 12px;
            border: 1px solid rgba(6, 182, 212, 0.3);
            border-radius: 14px;
            background: rgba(6, 182, 212, 0.08);
            color: var(--accent-cyan);
            font-size: 9px;
            font-weight: 700;
            cursor: pointer;
            transition: all 0.2s;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            white-space: nowrap;
            flex-shrink: 0;
        }
        .disc-end-discovery-btn:hover {
            background: rgba(6, 182, 212, 0.15);
            border-color: var(--accent-cyan);
            transform: translateY(-1px);
        }
        .disc-end-discovery-btn:disabled {
            opacity: 0.4;
            pointer-events: none;
        }

        .disc-question-card {
            background: var(--surface-2);
            border: 1px solid var(--border-default);
            border-radius: 10px;
            padding: 12px;
            margin-top: 8px;
        }
        .disc-question-card label {
            display: block;
            font-size: 12px;
            font-weight: 600;
            color: var(--text-secondary);
            margin-bottom: 6px;
        }
        .disc-question-card input[type="text"],
        .disc-question-card textarea {
            width: 100%;
            background: rgba(0,0,0,0.2);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: var(--text-primary);
            padding: 8px 12px;
            font-family: inherit;
            font-size: 12px;
            outline: none;
        }
        .disc-question-card textarea {
            resize: vertical;
            min-height: 36px;
        }
        .disc-choice-grid {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
        }
        .disc-choice-btn {
            padding: 6px 12px;
            border: 1px solid var(--border);
            border-radius: 20px;
            background: rgba(255,255,255,0.02);
            color: var(--text-secondary);
            font-size: 11px;
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
            position: relative;
        }
        .disc-choice-btn:hover {
            border-color: var(--accent-cyan);
            color: var(--accent-cyan);
            transform: scale(1.03);
            background: rgba(6, 182, 212, 0.06);
        }
        .disc-choice-btn.selected {
            background: rgba(6, 182, 212, 0.15);
            border-color: var(--accent-cyan);
            color: var(--accent-cyan);
            font-weight: 700;
        }
        .disc-choice-btn.disc-recommended {
            border-color: rgba(139, 92, 246, 0.4);
            background: rgba(139, 92, 246, 0.06);
        }
        .disc-choice-btn.disc-recommended::after {
            content: 'Recommended';
            position: absolute;
            top: -8px;
            right: 8px;
            font-size: 8px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04em;
            color: var(--accent-purple);
            background: var(--surface-2);
            padding: 1px 5px;
            border-radius: 4px;
            border: 1px solid rgba(139, 92, 246, 0.3);
        }
        .disc-choice-btn.disc-other-btn {
            border-style: dashed;
        }
        .disc-question-card.disc-answered {
            position: relative;
        }
        .disc-question-card.disc-answered > label,
        .disc-question-card.disc-answered > .disc-choice-grid,
        .disc-question-card.disc-answered > .disc-other-wrap,
        .disc-question-card.disc-answered > .disc-multi-confirm,
        .disc-question-card.disc-answered > .disc-question-counter,
        .disc-question-card.disc-answered > .disc-skip-link,
        .disc-question-card.disc-answered > input {
            opacity: 0.35;
            pointer-events: none;
        }
        .disc-answer-actions {
            display: none;
            position: absolute;
            top: 6px;
            right: 6px;
            gap: 4px;
            z-index: 5;
        }
        .disc-question-card.disc-answered .disc-answer-actions {
            display: flex;
        }
        .disc-answer-action-btn {
            padding: 4px 10px;
            border-radius: 8px;
            font-size: 10px;
            font-weight: 700;
            letter-spacing: 0.02em;
            border: 1px solid rgba(139, 92, 246, 0.3);
            background: rgba(139, 92, 246, 0.1);
            color: var(--accent-purple);
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 4px;
            text-transform: uppercase;
        }
        .disc-answer-action-btn:hover {
            background: rgba(139, 92, 246, 0.2);
            color: #c4b5fd;
            border-color: var(--accent-purple);
            transform: translateY(-1px);
        }
        .disc-answer-action-btn.disc-action-clear {
            border-color: rgba(239, 68, 68, 0.25);
            background: rgba(239, 68, 68, 0.08);
            color: #f87171;
        }
        .disc-answer-action-btn.disc-action-clear:hover {
            border-color: #ef4444;
            color: #fca5a5;
            background: rgba(239, 68, 68, 0.15);
        }
        .disc-question-counter {
            font-size: 10px;
            color: var(--text-muted);
            margin-top: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        .disc-question-counter .disc-counter-bar {
            flex: 1;
            height: 3px;
            background: rgba(255,255,255,0.06);
            border-radius: 2px;
            overflow: hidden;
        }
        .disc-question-counter .disc-counter-fill {
            height: 100%;
            background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple));
            border-radius: 2px;
            transition: width 0.5s ease;
        }
        .disc-skip-link {
            display: block;
            text-align: center;
            margin-top: 8px;
            font-size: 10px;
            color: var(--text-muted);
            cursor: pointer;
            opacity: 0.6;
            transition: all 0.2s;
        }
        .disc-skip-link:hover {
            opacity: 1;
            color: var(--text-secondary);
        }
        .disc-other-submit {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            height: 28px;
            border-radius: 50%;
            background: var(--accent-purple);
            border: none;
            cursor: pointer;
            color: white;
            position: absolute;
            right: 6px;
            top: 50%;
            transform: translateY(-50%);
            transition: transform 0.15s ease;
        }
        .disc-other-submit:hover {
            transform: translateY(-50%) scale(1.1);
        }
        .disc-other-wrap {
            position: relative;
            display: none;
            margin-top: 8px;
        }
        .disc-other-wrap input {
            width: 100%;
            background: rgba(0,0,0,0.3);
            border: 1px solid var(--border);
            border-radius: 8px;
            padding: 8px 40px 8px 12px;
            color: var(--text-primary);
            font-size: 12px;
            font-family: inherit;
            outline: none;
        }
        .disc-starter-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 8px;
            margin-top: 16px;
        }
        .disc-starter-card {
            background: rgba(255,255,255,0.02);
            border: 1px solid var(--border-subtle);
            border-radius: 10px;
            padding: 14px 12px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: flex-start;
            gap: 10px;
        }
        .disc-starter-card:hover {
            border-color: var(--accent-cyan);
            background: rgba(6, 182, 212, 0.04);
            transform: translateY(-1px);
        }
        .disc-starter-card .disc-starter-icon {
            width: 32px;
            height: 32px;
            border-radius: 8px;
            background: rgba(139, 92, 246, 0.1);
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            color: var(--accent-purple);
        }
        .disc-starter-card .disc-starter-text {
            font-size: 12px;
            font-weight: 600;
            color: var(--text-primary);
            line-height: 1.3;
        }
        .disc-starter-card .disc-starter-text span {
            display: block;
            font-size: 10px;
            font-weight: 400;
            color: var(--text-muted);
            margin-top: 2px;
        }
        .disc-step.thinking {
            animation: discPulse 1.5s ease-in-out infinite;
        }
        @keyframes discPulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(6, 182, 212, 0); }
            50% { box-shadow: 0 0 12px 2px rgba(6, 182, 212, 0.25); }
        }
        .disc-multi-confirm {
            display: none;
            margin-top: 10px;
            text-align: right;
        }
        .disc-multi-confirm button {
            font-size: 11px;
            padding: 6px 18px;
            background: var(--accent-purple);
            color: white;
            border: none;
            border-radius: 20px;
            cursor: pointer;
            font-weight: 600;
            transition: transform 0.15s;
        }
        .disc-multi-confirm button:hover {
            transform: scale(1.04);
        }

        .disc-typing {
            display: flex;
            gap: 4px;
            padding: 8px 16px;
        }
        .disc-typing span {
            width: 6px;
            height: 6px;
            background: var(--accent-purple);
            border-radius: 50%;
            animation: discBounce 1.2s infinite;
        }
        .disc-typing span:nth-child(2) { animation-delay: 0.15s; }
        .disc-typing span:nth-child(3) { animation-delay: 0.3s; }
        @keyframes discBounce {
            0%, 60%, 100% { transform: translateY(0); }
            30% { transform: translateY(-6px); }
        }

        .disc-review-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 0;
            font-size: 12px;
            border-bottom: 1px solid rgba(255,255,255,0.04);
        }
        .disc-review-row:last-child { border-bottom: none; }
        .disc-review-label {
            color: var(--text-muted);
            font-weight: 600;
            text-transform: uppercase;
            font-size: 10px;
            letter-spacing: 0.03em;
        }
        .disc-review-value {
            color: var(--text-primary);
            font-weight: 500;
        }

        /* V4: Claims */
        .disc-claims {
            display: flex;
            flex-direction: column;
            gap: 6px;
            margin: 10px 0 4px;
        }
        .disc-claim {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 8px 10px;
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 8px;
            font-size: 12px;
            transition: all 0.2s;
        }
        .disc-claim:hover { background: rgba(255,255,255,0.06); }
        .disc-claim-validated {
            border-color: rgba(16,185,129,0.3) !important;
            background: rgba(16,185,129,0.06) !important;
        }
        .disc-claim-invalidated {
            border-color: rgba(239,68,68,0.3) !important;
            background: rgba(239,68,68,0.06) !important;
        }
        .disc-claim-icon { font-size: 14px; flex-shrink: 0; }
        .disc-claim-text { flex: 1; color: var(--text-primary); }
        .disc-claim-conf {
            font-size: 10px;
            color: var(--text-muted);
            background: rgba(255,255,255,0.05);
            padding: 2px 6px;
            border-radius: 6px;
            white-space: nowrap;
        }
        .disc-claim-actions {
            display: flex;
            gap: 4px;
            flex-shrink: 0;
        }
        .disc-claim-btn {
            width: 24px;
            height: 24px;
            border-radius: 6px;
            border: 1px solid rgba(255,255,255,0.1);
            background: transparent;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 12px;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.15s;
        }
        .disc-claim-btn.disc-claim-validate:hover {
            border-color: rgba(16,185,129,0.5);
            background: rgba(16,185,129,0.15);
            color: #34d399;
        }
        .disc-claim-btn.disc-claim-invalidate:hover {
            border-color: rgba(239,68,68,0.5);
            background: rgba(239,68,68,0.15);
            color: #f87171;
        }
        .disc-claim-correction {
            width: 100%;
            margin-top: 6px;
            padding: 6px 0 0;
            border-top: 1px solid rgba(255,255,255,0.06);
        }
        .disc-claim-correction input {
            width: 100%;
            padding: 6px 10px;
            background: rgba(0,0,0,0.3);
            border: 1px solid var(--border);
            border-radius: 6px;
            color: var(--text-primary);
            font-size: 12px;
            outline: none;
        }
        .disc-claim-correction input:focus { border-color: var(--accent-purple); }
        .disc-claim-correction .disc-claim-btn {
            width: auto;
            padding: 4px 10px;
            font-size: 10px;
            font-weight: 600;
        }

        /* V4: Knowledge Sidebar */
        .disc-knowledge-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 14px;
            font-size: 13px;
            font-weight: 700;
            color: var(--text-primary);
            border-bottom: 1px solid rgba(255,255,255,0.06);
        }
        .disc-knowledge-count {
            background: var(--accent-purple);
            color: white;
            font-size: 10px;
            font-weight: 700;
            padding: 2px 8px;
            border-radius: 10px;
        }
        .disc-knowledge-item {
            padding: 10px 14px;
            border-bottom: 1px solid rgba(255,255,255,0.04);
            transition: background 0.15s;
        }
        .disc-knowledge-item:hover { background: rgba(255,255,255,0.03); }
        .disc-knowledge-title {
            display: flex;
            align-items: center;
            gap: 6px;
            font-size: 12px;
            margin-bottom: 4px;
        }
        .disc-knowledge-title strong {
            color: var(--text-primary);
            font-weight: 600;
        }
        .disc-knowledge-expert {
            font-size: 10px;
            color: var(--accent-purple);
            background: rgba(139,92,246,0.1);
            padding: 1px 6px;
            border-radius: 6px;
            font-weight: 600;
        }
        .disc-knowledge-content {
            font-size: 11px;
            color: var(--text-muted);
            line-height: 1.5;
        }
        .disc-knowledge-meta {
            font-size: 10px;
            color: var(--text-tertiary);
            margin-top: 3px;
        }

        /* V4: Project name suggestion animation */
        .disc-name-suggested {
            animation: discNamePulse 0.6s ease;
        }
        @keyframes discNamePulse {
            0% { border-color: transparent; }
            50% { border-color: var(--accent-cyan); box-shadow: 0 0 12px rgba(6,182,212,0.2); }
            100% { border-color: transparent; }
        }

            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 6px;
            padding: 14px 8px;
            border: 1px solid var(--border-subtle);
            border-radius: 10px;
            background: rgba(255,255,255,0.02);
            color: var(--text-muted);
            cursor: pointer;
            transition: all 0.15s ease;
            font-size: 11px;
            font-weight: 600;
        }
        .type-card:hover {
            border-color: var(--border-default);
            background: rgba(255,255,255,0.04);
            color: var(--text-primary);
        }
        .type-card.active {
            border-color: var(--accent);
            background: rgba(6, 182, 212, 0.08);
            color: var(--accent);
            box-shadow: 0 0 16px rgba(6, 182, 212, 0.1);
        }
        .type-card svg { opacity: 0.6; }
        .type-card.active svg { opacity: 1; }

        .wizard-panel {
            min-height: 200px;
            animation: fadeInUp 0.2s ease;
        }
        @keyframes fadeInUp {
            from { opacity: 0; transform: translateY(6px); }
            to { opacity: 1; transform: translateY(0); }
        }

        /* ── Loader ─── */
        .neural-sync {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: var(--s5);
            padding: 80px 40px;
        }

        .sync-ring {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: 2px solid transparent;
            border-top-color: var(--accent);
            border-right-color: var(--accent-cyan);
            animation: obs-spin 0.9s linear infinite;
            position: relative;
        }

        .sync-label {
            font-size: 11px;
            font-weight: 700;
            letter-spacing: 0.15rem;
            text-transform: uppercase;
            color: var(--text-muted);
        }

        @keyframes obs-spin {
            to {
                transform: rotate(360deg);
            }
        }
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        /* ── Project Memory Refinements ── */
        .memory-block-item {
            transition: border-left 0.3s ease, box-shadow 0.3s ease;
        }
        .memory-block-item.dirty {
            border-left: 4px solid var(--warning) !important;
            box-shadow: 0 0 20px rgba(245, 158, 11, 0.1);
        }
        .unsaved-indicator {
            font-size: 8px;
            font-weight: 900;
            color: var(--warning);
            letter-spacing: 1px;
            text-transform: uppercase;
            animation: pulse-warn 2s infinite;
            display: none;
        }
        .dirty .unsaved-indicator {
            display: inline-block;
        }
        @keyframes pulse-warn {
            0% { opacity: 0.6; }
            50% { opacity: 1; }
            100% { opacity: 0.6; }
        }
        .memory-actions-overlay {
            display: none;
            gap: 12px;
            margin-top: 16px;
            padding-top: 16px;
            border-top: 1px solid rgba(255,255,255,0.05);
        }
        .dirty .memory-actions-overlay {
            display: flex;
        }
        .project-core-block {
            border: 1px solid var(--accent-cyan) !important;
            background: linear-gradient(135deg, rgba(30, 41, 59, 0.6) 0%, rgba(15, 23, 42, 0.8) 100%) !important;
        }

        /* ── New memory spotlight ── */
        @keyframes memory-spotlight-pulse {
            0%   { border-color: rgba(251, 146, 60, 0.9);  box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.25), 0 0 20px rgba(251, 146, 60, 0.15); }
            50%  { border-color: rgba(251, 191, 36, 0.95); box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.20), 0 0 32px rgba(251, 191, 36, 0.20); }
            100% { border-color: rgba(251, 146, 60, 0.9);  box-shadow: 0 0 0 2px rgba(251, 146, 60, 0.25), 0 0 20px rgba(251, 146, 60, 0.15); }
        }
        .memory-new-spotlight {
            animation: memory-spotlight-pulse 1.4s ease-in-out infinite !important;
            background: linear-gradient(135deg, rgba(251, 146, 60, 0.07) 0%, rgba(30, 41, 59, 0.5) 100%) !important;
        }
        /* Remove global sync bar */
        .sync-action-bar { display: none !important; }

        /* ── Toast ─── */
        #toast {
            position: fixed;
            bottom: 28px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--surface-3);
            border: 1px solid var(--border-default);
            color: var(--text-primary);
            padding: 10px 24px;
            border-radius: 100px;
            font-weight: 700;
            font-size: 13px;
            display: none;
            z-index: 2000;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
            backdrop-filter: blur(20px);
        }

        /* ── Sub-tabs ─── */
        .cockpit-tabs {
            display: flex;
            gap: 4px;
            padding: 4px;
            background: var(--surface-2);
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-lg);
        }

        .tab-btn {
            background: transparent;
            border: none;
            color: var(--text-secondary);
            padding: 6px 14px;
            border-radius: var(--r-md);
            font-size: 12.5px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.18s var(--ease-out);
            font-family: 'Inter', sans-serif;
            white-space: nowrap;
        }

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

        .tab-btn.active {
            background: var(--surface-active);
            color: var(--accent-light);
            box-shadow: inset 0 0 0 1px var(--border-default);
        }

        /* ── Legacy compat shims ─── */
        .item-card {
            background: var(--surface-1);
            border: 1px solid var(--border-subtle);
            padding: var(--s5) var(--s6);
            border-radius: var(--r-xl);
            margin-bottom: var(--s4);
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: all 0.22s var(--ease-out);
            position: relative;
            overflow: hidden;
            cursor: pointer;
        }

        .item-card::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            width: 3px;
            background: var(--grad-accent);
            opacity: 0;
            transition: opacity 0.22s ease;
        }

        .item-card:hover {
            border-color: var(--border-default);
            background: var(--surface-hover);
            transform: translateX(4px);
        }

        .item-card:hover::before {
            opacity: 1;
        }

        .item-title {
            font-weight: 700;
            font-size: 14px;
            color: var(--text-primary);
        }

        .item-meta {
            font-size: 12px;
            color: var(--text-secondary);
            margin-top: 3px;
        }

        .module {
            background: var(--surface-1);
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-xl);
            padding: var(--s6);
            margin-bottom: var(--s6);
            position: relative;
            overflow: hidden;
            transition: border-color 0.22s ease;
        }

        .module:hover {
            border-color: var(--border-default);
        }

        .status-tag {
            display: inline-flex;
            align-items: center;
            gap: 5px;
            padding: 3px 10px;
            border-radius: 100px;
            font-size: 10.5px;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.04rem;
        }

        .status-tag.working {
            background: rgba(124, 58, 237, 0.1);
            color: var(--accent-light);
            border: 1px solid rgba(124, 58, 237, 0.2);
        }

        .status-tag.done {
            background: rgba(16, 185, 129, 0.1);
            color: var(--success);
            border: 1px solid rgba(16, 185, 129, 0.2);
        }

        .status-tag.todo {
            background: rgba(245, 158, 11, 0.1);
            color: var(--warning);
            border: 1px solid rgba(245, 158, 11, 0.2);
        }

        .micro-animation-hover {
            transition: transform 0.22s var(--ease-out);
        }

        .micro-animation-hover:hover {
            transform: translateY(-2px);
        }

        .neural-ring {
            width: 48px;
            height: 48px;
            border-radius: 50%;
            border: 2px solid var(--accent);
            display: flex;
            justify-content: center;
            align-items: center;
            animation: pulseRing 3s infinite;
        }

        @keyframes pulseRing {
            0% {
                box-shadow: 0 0 0 0 var(--accent-glow);
            }

            70% {
                box-shadow: 0 0 0 10px rgba(168, 85, 247, 0);
            }

            100% {
                box-shadow: 0 0 0 0 rgba(168, 85, 247, 0);
            }
        }

        .hud-scanline {
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 2px;
            background: rgba(124, 58, 237, 0.08);
            animation: scan 12s linear infinite;
            pointer-events: none;
            z-index: 10;
        }

        @keyframes scan {
            from {
                top: 0;
            }

            to {
                top: 100%;
            }
        }

        .nested-container {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.4s ease, opacity 0.4s ease;
            opacity: 0;
        }

        .nested-container.active {
            max-height: 600px;
            opacity: 1;
        }

        .toggle-btn {
            cursor: pointer;
            display: inline-block;
            width: 20px;
            text-align: center;
        }

        .mono {
            font-family: 'JetBrains Mono', monospace;
        }

        .log-stream {
            background: #030408;
            border: 1px solid var(--border-subtle);
            border-radius: var(--r-lg);
            padding: var(--s5);
            font-family: 'JetBrains Mono', monospace;
            font-size: 12px;
            color: var(--success);
            height: 360px;
            overflow-y: auto;
            line-height: 1.6;
        }

        .log-entry {
            margin-bottom: 6px;
        }

        .timestamp {
            color: var(--text-muted);
            margin-right: 8px;
        }

        .feature-locked {
            opacity: 0.35;
            pointer-events: none;
            filter: grayscale(1);
            position: relative;
        }

        .feature-locked::after {
            content: "SOON";
            position: absolute;
            top: 2px;
            right: 5px;
            font-size: 9px;
            background: var(--accent);
            color: #fff;
            padding: 2px 5px;
            border-radius: 4px;
            font-weight: 800;
        }

        .switch {
            position: relative;
            display: inline-block;
            width: 38px;
            height: 20px;
        }

        .switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .slider {
            position: absolute;
            cursor: pointer;
            inset: 0;
            background: var(--surface-3);
            border: 1px solid var(--border-default);
            transition: .3s;
            border-radius: 20px;
        }

        .slider:before {
            position: absolute;
            content: "";
            height: 13px;
            width: 13px;
            left: 3px;
            bottom: 3px;
            background: var(--text-muted);
            transition: .3s;
            border-radius: 50%;
        }

        input:checked+.slider {
            background: var(--accent);
            border-color: var(--accent);
        }

        input:checked+.slider:before {
            transform: translateX(17px);
            background: #fff;
        }

        .proposition-view {
            background: var(--surface-2);
            border: 1px solid var(--border-default);
            border-radius: var(--r-lg);
            padding: var(--s5);
            font-family: 'JetBrains Mono', monospace;
            font-size: 13px;
            color: var(--accent-light);
            max-height: 300px;
            overflow-y: auto;
            white-space: pre-wrap;
            display: none;
        }

        .loading-proposition {
            display: none;
            text-align: center;
            padding: 40px;
            color: var(--accent-light);
            font-weight: 700;
            letter-spacing: 2px;
            animation: pulse-dot 1.5s infinite;
        }

        .status-pulse {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background: var(--success);
            box-shadow: 0 0 10px var(--success-glow);
            animation: pulse-dot 2s infinite;
        }

        .flex-chart {
            display: flex;
            align-items: flex-end;
            gap: 6px;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--border-subtle);
        }

        .chart-bar {
            flex: 1;
            background: linear-gradient(to top, var(--accent), var(--accent-cyan));
            border-radius: 4px 4px 0 0;
        }

        .tab-content {
            animation: fadeIn 0.2s ease;
        }

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