:root {
    --bg: #03060b;
    --surface: rgba(10, 13, 20, 0.8);
    --border: rgba(6, 214, 208, 0.08);
    --border-hover: rgba(6, 214, 208, 0.15);
    --accent: #06d6d0;
    --accent-glow: rgba(6, 214, 208, 0.25);
    --purple: #7c3aed;
    --text: #e0f0f0;
    --text-muted: #7ea6a8;
    --text-dim: #4a6668;
    --green: #22c55e;
    --red: #ef4444;
    --font: 'Inter', -apple-system, sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

:root[data-theme="light"] {
    --bg: #f4f6f9;
    --surface: rgba(255, 255, 255, 0.85);
    --border: rgba(0, 0, 0, 0.08);
    --border-hover: rgba(13, 148, 136, 0.25);
    --accent: #0d9488;
    --accent-glow: rgba(13, 148, 136, 0.2);
    --purple: #6d28d9;
    --text: #0f172a;
    --text-muted: #475569;
    --text-dim: #64748b;
    --green: #16a34a;
    --red: #dc2626;
}
:root[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.92);
}
:root[data-theme="light"] .glass-card {
    background: rgba(255, 255, 255, 0.9);
}
:root[data-theme="light"] .agency-node {
    background: rgba(255, 255, 255, 0.9);
}
:root[data-theme="light"] .canvas-toolbar {
    background: rgba(244, 246, 249, 0.9);
}
:root[data-theme="light"] .canvas-fullscreen {
    background:
        radial-gradient(circle at 50% 50%, rgba(13, 148, 136, 0.04) 0%, transparent 70%),
        linear-gradient(rgba(0, 0, 0, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.04) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
}
:root[data-theme="light"] .canvas-welcome {
    background: rgba(244, 246, 249, 0.95);
}
:root[data-theme="light"] .form-group input {
    background: rgba(255,255,255,0.8);
    color: #0f172a;
}
:root[data-theme="light"] .bg-orb { opacity: 0.04; }
:root[data-theme="light"] .nav-tabs {
    background: rgba(0, 0, 0, 0.04);
}
:root[data-theme="light"] .model-select {
    background: rgba(255,255,255,0.8);
    color: #475569;
}
:root[data-theme="light"] .preset-dropdown option {
    background: #fff;
    color: #0f172a;
}
:root[data-theme="light"] .role-dropdown-list {
    background: rgba(255, 255, 255, 0.97);
}
:root[data-theme="light"] .panel {
    background: rgba(255, 255, 255, 0.85);
}
:root[data-theme="light"] .code-panel-content {
    background: rgba(255, 255, 255, 0.9);
    color: #1e293b;
}
:root[data-theme="light"] .stream-container {
    color: #334155;
}
:root[data-theme="light"] .aion-thread {
    background: rgba(255, 255, 255, 0.6);
}
:root[data-theme="light"] #center-chat-panel {
    background: var(--bg) !important;
}
:root[data-theme="light"] .aion-input-bar {
    background: rgba(255, 255, 255, 0.9);
}
:root[data-theme="light"] .modal-content {
    background: rgba(255, 255, 255, 0.95) !important;
}
:root[data-theme="light"] .upsell-card {
    background: rgba(255, 255, 255, 0.95);
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    height: 100vh;
    overflow: hidden;
    font-size: 14px;
}

/* Ambient BG */
.bg-orb { position: fixed; border-radius: 50%; filter: blur(160px); z-index: -1; opacity: 0.12; }
.orb-1 { width: 60vw; height: 60vh; background: #0a3d3b; top: -20vh; left: -10vw; }
.orb-2 { width: 40vw; height: 40vh; background: #0f2d3d; bottom: -10vh; right: -5vw; }
.orb-3 { width: 30vw; height: 30vh; background: #1a0a3d; top: 30vh; left: 40vw; opacity: 0.06; }

/* ─── Login ────────── */
#login-view {
    display: flex; align-items: center; justify-content: center;
    height: 100vh;
}
.glass-card {
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.login-card {
    padding: 2.5rem;
    width: 100%; max-width: 380px;
    text-align: center;
}
.brand h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.5px; margin-bottom: 0.25rem; }
.brand p { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 2rem; }
.form-group input {
    width: 100%; padding: 0.75rem 0.85rem;
    background: rgba(0,0,0,0.4); border: 1px solid var(--border);
    border-radius: 8px; color: var(--text); font-size: 0.85rem;
    font-family: var(--font); outline: none;
    transition: all 0.15s; margin-bottom: 1rem;
}
.form-group input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
.glow-btn {
    width: 100%; padding: 0.75rem;
    background: linear-gradient(135deg, var(--accent), var(--purple)); color: white;
    border: none; border-radius: 8px;
    font-size: 0.85rem; font-weight: 600;
    font-family: var(--font); cursor: pointer;
    transition: all 0.2s;
}
.glow-btn:hover { box-shadow: 0 0 30px var(--accent-glow); transform: translateY(-1px); }

/* ─── Top Bar ────────── */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0 1rem; height: 48px;
    background: rgba(3, 6, 11, 0.95);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 0.5rem; }
.logo-text { font-weight: 700; font-size: 0.95rem; letter-spacing: 0.05em; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; position: relative; }
.status-indicator { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: var(--text-muted); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; }
.status-dot.online { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,0.5); }
.avatar-small { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--purple)); }
.plan-badge {
    display: inline-flex; align-items: center;
    padding: 0.15rem 0.55rem; border-radius: 4px;
    font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em;
    background: rgba(167,139,250,0.12); color: var(--purple);
    border: 1px solid rgba(167,139,250,0.25);
    text-decoration: none; transition: all 0.2s; cursor: pointer;
}
.plan-badge:hover { background: rgba(167,139,250,0.2); border-color: rgba(167,139,250,0.4); }
.plan-badge.pro { background: rgba(6,214,208,0.12); color: var(--accent); border-color: rgba(6,214,208,0.25); }
.plan-badge.enterprise { background: linear-gradient(135deg, rgba(6,214,208,0.15), rgba(167,139,250,0.15)); color: #e2e8f0; border-color: rgba(167,139,250,0.3); }
.token-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.2rem 0.7rem; border-radius: 10px;
    font-size: 0.72rem; font-weight: 600;
    background: rgba(6, 214, 208, 0.1); color: var(--accent);
    border: 1px solid rgba(6, 214, 208, 0.25);
    transition: all 0.3s;
}
.token-badge.warning {
    background: rgba(239, 68, 68, 0.15); color: #f87171;
    border-color: rgba(239, 68, 68, 0.3);
    animation: tokenWarn 1.5s ease-in-out infinite;
}
@keyframes tokenWarn { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }

/* Upsell Modal */
.upsell-modal {
    position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.7); backdrop-filter: blur(8px); animation: fadeIn 0.2s ease;
}
.upsell-card {
    background: rgba(15,18,28,0.95); border: 1px solid rgba(255,255,255,0.1); border-radius: 16px;
    padding: 2rem 2.2rem; max-width: 400px; text-align: center; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.upsell-close {
    position: absolute; top: 0.8rem; right: 1rem; background: none; border: none;
    color: var(--text-muted); font-size: 1.4rem; cursor: pointer; transition: color 0.2s;
}
.upsell-close:hover { color: var(--text); }
.upsell-icon { font-size: 2.5rem; margin-bottom: 0.8rem; }
.upsell-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 0.5rem; }
.upsell-card p { color: var(--text-muted); font-size: 0.82rem; line-height: 1.5; margin-bottom: 1rem; }
.upsell-discount {
    display: flex; align-items: center; justify-content: center; gap: 0.6rem;
    background: rgba(251,191,36,0.08); border: 1px solid rgba(251,191,36,0.25);
    padding: 0.6rem 1rem; border-radius: 8px; margin-bottom: 1.2rem;
}
.discount-code {
    font-family: 'JetBrains Mono', monospace; font-size: 1.1rem; font-weight: 800;
    color: #fbbf24; letter-spacing: 0.08em;
}
.discount-label { color: #fbbf24; font-size: 0.72rem; font-weight: 600; }
.upsell-cta {
    display: block; padding: 0.7rem; border-radius: 8px; font-size: 0.85rem; font-weight: 600;
    background: linear-gradient(135deg, #06d6d0, #0ea5e9); color: #000; text-decoration: none;
    transition: all 0.3s; margin-bottom: 0.6rem;
}
.upsell-cta:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(6,214,208,0.3); }
.upsell-hint { color: var(--text-muted); font-size: 0.65rem; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Navigation Tabs ────────── */
.nav-tabs {
    display: flex; gap: 2px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px; padding: 3px;
}
.nav-tab {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 1rem;
    background: transparent; border: none;
    border-radius: 6px;
    color: var(--text-dim); font-size: 0.8rem; font-weight: 600;
    font-family: var(--font); cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.nav-tab:hover { color: var(--text-muted); background: rgba(255,255,255,0.04); }
.nav-tab.active {
    background: rgba(6, 214, 208, 0.12);
    color: var(--accent);
    box-shadow: 0 0 12px rgba(6, 214, 208, 0.15);
}
.nav-tab svg { opacity: 0.6; }
.nav-tab.active svg { opacity: 1; }

/* ─── App Views ────────── */
.app-view {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
#account-view {
    overflow-y: auto;
}
.app-view[style*="display:none"], .app-view[style*="display: none"] {
    display: none !important;
}
#dash-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ═══════════ HOME — Full-Screen Canvas ═══════════ */
.canvas-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.25rem;
    background: rgba(3, 6, 11, 0.7);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.canvas-toolbar-left {
    display: flex; align-items: center; gap: 0.5rem;
    font-size: 0.8rem; font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.canvas-toolbar-left svg { color: var(--purple); }
.canvas-toolbar-right { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }

.preset-dropdown {
    background: rgba(6, 214, 208, 0.06);
    border: 1px solid rgba(6, 214, 208, 0.3);
    color: var(--accent);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    min-width: 170px;
    transition: all 0.2s;
}
.preset-dropdown:hover { border-color: var(--accent); background: rgba(6, 214, 208, 0.1); }
.preset-dropdown:focus { border-color: var(--accent); box-shadow: 0 0 8px rgba(6, 214, 208, 0.2); }
.preset-dropdown option { background: var(--bg); color: var(--text); }
.preset-dropdown optgroup { color: var(--text-muted); font-weight: 600; font-style: normal; }

.preset-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.72rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    white-space: nowrap;
}
.preset-btn:hover { background: rgba(255,255,255,0.08); color: var(--text); border-color: var(--border-hover); }
.preset-btn.danger:hover { color: #f87171; border-color: rgba(239, 68, 68, 0.4); }

/* Full-Screen Canvas */
.canvas-fullscreen {
    flex: 1;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 50% 50%, rgba(6, 214, 208, 0.03) 0%, transparent 70%),
        linear-gradient(rgba(6, 214, 208, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(6, 214, 208, 0.015) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
}

/* Canvas Welcome Overlay */
.canvas-welcome {
    position: absolute; inset: 0; z-index: 50;
    display: flex; align-items: center; justify-content: center;
    pointer-events: all;
    background: rgba(7,9,15,0.92);
    backdrop-filter: blur(12px);
}
.welcome-content {
    text-align: center; position: relative; animation: welcomeFade 0.6s ease;
}
.welcome-glow {
    position: absolute; top: -100px; left: 50%; transform: translateX(-50%);
    width: 300px; height: 300px; border-radius: 50%;
    background: radial-gradient(circle, rgba(6,214,208,0.08) 0%, transparent 70%);
    pointer-events: none;
}
.welcome-content h2 {
    font-size: 1.6rem; font-weight: 700; margin-bottom: 0.4rem;
    background: linear-gradient(135deg, #e2e8f0, #06d6d0);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.welcome-content > p { color: var(--text-muted); font-size: 0.82rem; margin-bottom: 1.5rem; }
.welcome-cards {
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.8rem;
    margin-bottom: 1.2rem;
}
@media (max-width: 700px) { .welcome-cards { grid-template-columns: repeat(2, 1fr); } }
.welcome-card {
    display: flex; flex-direction: column; align-items: center; gap: 0.3rem;
    padding: 1.2rem 1rem; border-radius: 12px; cursor: pointer;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    transition: all 0.3s; min-width: 120px;
}
.welcome-card:hover {
    background: rgba(6,214,208,0.06); border-color: rgba(6,214,208,0.25);
    transform: translateY(-4px); box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.wc-icon { font-size: 1.8rem; }
.wc-title { font-size: 0.78rem; font-weight: 600; color: var(--text); }
.wc-sub { font-size: 0.62rem; color: var(--text-muted); }
.welcome-hint { color: var(--text-muted); font-size: 0.68rem; }
.canvas-welcome.hidden { display: none; }
@keyframes welcomeFade { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

/* SVG Connection Layer */
.canvas-svg {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1;
}
.canvas-svg line {
    stroke: rgba(124, 58, 237, 0.35);
    stroke-width: 2;
    stroke-dasharray: 6, 4;
    animation: dashFlow 1s linear infinite;
}
.canvas-svg line.active {
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-dasharray: 8, 4;
    filter: drop-shadow(0 0 4px var(--accent-glow));
}
@keyframes dashFlow {
    to { stroke-dashoffset: -10; }
}

/* Animated Observer Node */
.observer-mini-circle {
    transition: all 0.3s ease;
    pointer-events: all;
    cursor: pointer;
}
.observer-mini-circle.pulse-active {
    animation: obsActivePulse 1.5s ease-in-out infinite;
    stroke: #fbbf24;
    stroke-width: 2.5px;
    filter: drop-shadow(0 0 4px rgba(251,191,36,0.8));
}
.observer-mini-icon {
    transition: all 0.3s ease;
}
.observer-mini-icon.pulse-active {
    fill: #fbbf24;
}
@keyframes obsActivePulse {
    0%, 100% { r: 14; stroke-width: 2px; }
    50% { r: 16; stroke-width: 3px; }
}

/* ─── Draggable Agency Nodes ────────── */
.agency-node {
    position: absolute;
    background: rgba(10, 13, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 12px;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    padding: 0.85rem;
    gap: 0.5rem;
    cursor: grab;
    z-index: 10;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    user-select: none;
}
.agency-node:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.agency-node:active { cursor: grabbing; }
.agency-node.dragging {
    z-index: 100;
    box-shadow: 0 8px 40px rgba(6, 214, 208, 0.2), 0 0 0 1px var(--accent);
    border-color: var(--accent);
}

/* Order badge (numbered circle) */
.order-badge {
    position: absolute;
    top: -10px; right: -10px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--accent));
    color: white;
    font-size: 0.65rem; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.5);
    z-index: 20;
    pointer-events: none;
}

/* SVG step number labels */
.step-label {
    fill: rgba(124, 58, 237, 0.8);
    font-size: 12px;
    font-family: var(--font);
    font-weight: 700;
    pointer-events: none;
}

/* Locked-shake animation (drag attempt during processing) */
.agency-node.locked-shake {
    animation: lockedShake 0.4s ease;
    cursor: not-allowed !important;
}
@keyframes lockedShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-6px); }
    30% { transform: translateX(5px); }
    45% { transform: translateX(-4px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
}

/* AION Hub — Special */
.agency-node.aion-hub {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.4);
    box-shadow:
        0 0 40px rgba(124, 58, 237, 0.15),
        inset 0 0 20px rgba(124, 58, 237, 0.05);
    min-width: 160px;
    cursor: grab;
    z-index: 5;
}
.agency-node.aion-hub.dragging {
    z-index: 100;
    box-shadow: 0 8px 40px rgba(124, 58, 237, 0.4), 0 0 0 1px var(--purple);
}
.aion-hub .node-header { justify-content: center; }
.aion-hub .node-icon { font-size: 1.3rem; }
.aion-hub .node-title-static {
    font-size: 0.85rem; font-weight: 700;
    color: var(--text);
    background: linear-gradient(135deg, var(--accent), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hub-label {
    font-size: 0.65rem; color: var(--text-dim);
    text-align: center; text-transform: uppercase;
    letter-spacing: 0.08em;
}
.hub-status {
    font-size: 0.7rem; color: var(--accent);
    text-align: center; font-weight: 600;
    font-family: var(--mono);
}

/* Multi-Process Premium Toggle */
.hub-multi-process {
    display: flex; align-items: center; justify-content: center;
    gap: 0.4rem; margin-top: 0.3rem;
    padding-top: 0.35rem;
    border-top: 1px solid rgba(124, 58, 237, 0.15);
}
.multi-toggle {
    display: flex; align-items: center; gap: 0.25rem;
    cursor: pointer; padding: 0.15rem 0.4rem;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.65rem;
}
.multi-toggle:hover { background: rgba(124, 58, 237, 0.15); }
.multi-icon { font-size: 0.75rem; }
.multi-label { color: var(--text-dim); font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em; }
.multi-badge {
    font-size: 0.5rem; font-weight: 800;
    padding: 0.1rem 0.35rem; border-radius: 3px;
    letter-spacing: 0.08em;
}
.multi-badge.free {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.multi-badge.active {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Node Processing States */
.agency-node.processing {
    border-color: rgba(6, 214, 208, 0.8);
    box-shadow: 0 0 25px rgba(6, 214, 208, 0.3), inset 0 0 15px rgba(6, 214, 208, 0.08);
    animation: nodePulse 1.5s infinite;
}
.agency-node.done {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.12);
}
@keyframes nodePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 25px rgba(6, 214, 208, 0.3); }
    50% { transform: scale(1.02); box-shadow: 0 0 40px rgba(6, 214, 208, 0.5); }
}
.node-spinner {
    display: inline-block;
    width: 14px; height: 14px;
    border: 2px solid rgba(6, 214, 208, 0.3);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: auto;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
@keyframes planBtnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
    50% { box-shadow: 0 0 12px 3px rgba(52,211,153,0.35); }
}

/* Node Content */
.node-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.node-icon { font-size: 1rem; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; flex-shrink: 0; }
.node-icon svg { width: 16px; height: 16px; }
.role-dropdown {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
    padding: 0.1rem 0;
}
.role-current {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.role-arrow {
    font-size: 0.6rem;
    color: var(--text-dim);
    flex-shrink: 0;
}
.role-dropdown:hover .role-current { color: var(--accent); }
.role-dropdown:hover .role-arrow { color: var(--accent); }

/* Custom dropdown list */
.role-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 9999;
    background: rgba(12, 15, 25, 0.97);
    border: 1px solid rgba(6, 214, 208, 0.2);
    border-radius: 8px;
    backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    max-height: 280px;
    overflow-y: auto;
    padding: 4px;
}
.role-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.role-option:last-child { border-bottom: none; }
.role-option:hover { background: rgba(6, 214, 208, 0.1); }
.role-option.selected { background: rgba(6, 214, 208, 0.15); border-left: 2px solid var(--accent); }
.role-opt-icon { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; line-height: 1; }
.role-opt-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.role-opt-name { display: block; font-size: 0.72rem; font-weight: 600; color: var(--text); white-space: nowrap; line-height: 1.4; }
.role-opt-desc { display: block; font-size: 0.58rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }

/* Custom Prompt Toggle Button */
.node-prompt-toggle {
    background: transparent; border: none;
    color: var(--text-dim); cursor: pointer;
    font-size: 0.8rem; padding: 0 0.15rem;
    transition: all 0.2s; line-height: 1;
    opacity: 0.5;
}
.node-prompt-toggle:hover { opacity: 0.9; }
.node-prompt-toggle.active {
    opacity: 1;
    filter: drop-shadow(0 0 3px rgba(6, 214, 208, 0.5));
}

/* Custom Prompt Textarea Area */
.node-prompt-area {
    margin-top: 0.25rem;
    animation: promptSlide 0.2s ease;
}
@keyframes promptSlide {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 120px; }
}
.node-custom-prompt {
    width: 100%; resize: vertical;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(6,214,208,0.15);
    border-radius: 6px;
    color: var(--text-muted);
    padding: 0.35rem 0.5rem;
    font-family: var(--font);
    font-size: 0.68rem;
    line-height: 1.4;
    outline: none;
    min-height: 36px; max-height: 80px;
    transition: border-color 0.2s;
}
.node-custom-prompt::placeholder {
    color: var(--text-dim); font-style: italic;
}
.node-custom-prompt:focus {
    border-color: rgba(6,214,208,0.4);
    box-shadow: 0 0 8px rgba(6,214,208,0.06);
}

.role-select option {
    background: var(--bg);
    color: var(--text);
    font-size: 0.8rem;
}
.role-select:focus { border-bottom: 1px solid var(--accent); }

.node-body {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.model-select {
    background: rgba(0,0,0,0.5);
    border: 1px solid var(--border);
    color: var(--text-dim);
    border-radius: 4px;
    padding: 0.3rem;
    font-size: 0.7rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    appearance: none;
}
.model-select:focus { border-color: var(--accent); }

/* Per-Node Observer Toggle */
.node-observer-row {
    margin: 0.3rem 0 0.15rem; display: flex; align-items: center;
}
.observer-toggle {
    display: flex; align-items: center; gap: 0.35rem; cursor: pointer;
    font-size: 0.68rem; color: var(--text-muted); transition: color 0.2s;
    user-select: none;
}
.observer-toggle:hover { color: var(--text); }
.observer-check {
    width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer;
    border-radius: 3px;
}
.observer-label { transition: color 0.2s; }
.observer-icon { flex-shrink: 0; opacity: 0.6; }
.observer-toggle:has(.observer-check:checked) .observer-label { color: var(--accent); font-weight: 600; }
.observer-toggle:has(.observer-check:checked) .observer-icon { opacity: 1; stroke: var(--accent); }

/* Active observer glow on node */
.agency-node.observer-active {
    border-color: rgba(6,214,208,0.4);
    box-shadow: 0 0 15px rgba(6,214,208,0.12), 0 2px 10px rgba(0,0,0,0.3);
}

/* Visual AION Observer Node */
.observer-visual-node {
    position: absolute; z-index: 45;
    display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
    padding: 0.5rem 0.8rem; border-radius: 10px;
    background: rgba(6,214,208,0.06); border: 1px solid rgba(6,214,208,0.3);
    box-shadow: 0 0 20px rgba(6,214,208,0.08);
    animation: welcomeFade 0.3s ease;
    cursor: grab;
    user-select: none;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}
.observer-visual-node:hover {
    border-color: rgba(6,214,208,0.5);
    box-shadow: 0 4px 20px rgba(6,214,208,0.15);
}
.observer-visual-node:active { cursor: grabbing; }
.observer-visual-node.dragging {
    z-index: 100;
    box-shadow: 0 8px 40px rgba(6,214,208,0.3), 0 0 0 1px var(--accent);
}
.obs-icon { font-size: 1.1rem; display: flex; align-items: center; }
.obs-label { font-size: 0.68rem; font-weight: 700; color: var(--accent); }
.obs-status { font-size: 0.55rem; color: var(--text-muted); display: flex; align-items: center; gap: 0.3rem; }

/* Observer visual node states */
.observer-visual-node.obs-loading {
    border-color: rgba(251,191,36,0.5);
    box-shadow: 0 0 20px rgba(251,191,36,0.15);
    animation: obsAnalyze 1.5s ease-in-out infinite;
}
.observer-visual-node.obs-approved {
    border-color: rgba(34,197,94,0.6);
    box-shadow: 0 0 20px rgba(34,197,94,0.2);
    animation: none;
}
.observer-visual-node.obs-rejected {
    border-color: rgba(248,113,113,0.6);
    box-shadow: 0 0 20px rgba(248,113,113,0.2);
    animation: none;
}
@keyframes obsAnalyze {
    0%, 100% { box-shadow: 0 0 15px rgba(251,191,36,0.1); }
    50% { box-shadow: 0 0 30px rgba(251,191,36,0.25); }
}
.obs-spinner {
    display: inline-block; width: 10px; height: 10px;
    border: 2px solid rgba(251,191,36,0.3);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
/* Observer approval/rejection badges on agent nodes */
.observer-badge {
    font-size: 0.55rem; font-weight: 700; padding: 0.1rem 0.35rem;
    border-radius: 4px; margin-left: auto;
}
.observer-badge.approved {
    background: rgba(34,197,94,0.15); color: #34d399;
    border: 1px solid rgba(34,197,94,0.3);
}
.observer-badge.rejected {
    background: rgba(248,113,113,0.15); color: #f87171;
    border: 1px solid rgba(248,113,113,0.3);
}

/* Plan Bubble (soft upsell tooltip) */
.plan-bubble {
    position: absolute; top: 100%; right: 0; margin-top: 0.5rem;
    background: rgba(15,18,28,0.95); border: 1px solid rgba(251,191,36,0.3);
    border-radius: 8px; padding: 0.6rem 0.8rem;
    font-size: 0.68rem; color: var(--text-muted); line-height: 1.4;
    white-space: nowrap; z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    animation: bubbleIn 0.3s ease;
}
.plan-bubble a {
    color: #fbbf24; text-decoration: none; font-weight: 600; margin-left: 0.3rem;
}
.plan-bubble a:hover { text-decoration: underline; }
.plan-bubble.fade-out { opacity: 0; transition: opacity 0.7s ease; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; transform: translateY(0); } }

.node-cost {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-align: right;
}

.node-delete {
    background: transparent; border: none;
    color: var(--text-dim); cursor: pointer;
    font-size: 1.1rem; padding: 0 0.2rem;
    transition: color 0.2s;
    line-height: 1;
}
.node-delete:hover { color: #f87171; }

/* ═══════════ WORKFLOW VIEW ═══════════ */

/* Team Summary Bar */
.team-summary-bar {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 1.25rem;
    background: linear-gradient(135deg, rgba(124,58,237,0.06), rgba(6,214,208,0.04));
    border-bottom: 1px solid rgba(124,58,237,0.12);
    flex-shrink: 0;
    backdrop-filter: blur(12px);
}
.team-summary-label {
    font-size: 0.68rem; font-weight: 700;
    color: var(--text-dim); text-transform: uppercase;
    letter-spacing: 0.1em; white-space: nowrap;
    font-family: var(--mono);
}
.team-summary-nodes { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.team-chip {
    display: inline-flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.7rem; border-radius: 20px;
    font-size: 0.68rem; font-weight: 600;
    background: linear-gradient(135deg, rgba(124,58,237,0.12), rgba(6,214,208,0.08));
    border: 1px solid rgba(124,58,237,0.2);
    color: var(--text-muted);
    letter-spacing: 0.02em;
    transition: all 0.3s;
}
.team-chip:hover {
    border-color: rgba(6,214,208,0.3);
    box-shadow: 0 0 12px rgba(6,214,208,0.1);
}
.team-chip .chip-icon { font-size: 0.85rem; }
.team-chip.chip-active {
    background: linear-gradient(135deg, rgba(6,214,208,0.25), rgba(124,58,237,0.2));
    border-color: var(--accent);
    color: var(--accent);
    box-shadow: 0 0 16px rgba(6,214,208,0.25);
    animation: chipPulse 1.5s ease-in-out infinite;
}
@keyframes chipPulse {
    0%, 100% { box-shadow: 0 0 12px rgba(6,214,208,0.2); }
    50% { box-shadow: 0 0 24px rgba(6,214,208,0.4); }
}

/* ─── IDE Grid (3-column) ────────── */
.ide-grid {
    display: grid;
    grid-template-columns: var(--file-w, 220px) 12px 1fr 12px var(--code-w, 340px);
    grid-template-rows: 1fr;
    flex: 1;
    height: 100%;
    min-height: 0;
    width: 100%;
    overflow: hidden;
    max-width: 100vw;
}

/* Drag handles between panels */
.resize-handle {
    width: 12px; cursor: col-resize;
    background: rgba(255,255,255,0.04);
    transition: background 0.15s;
    position: relative; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.resize-handle::after {
    content: '⋮⋮';
    color: rgba(255,255,255,0.2);
    font-size: 12px;
    letter-spacing: 1px;
    pointer-events: none;
}
.resize-handle:hover {
    background: rgba(6,214,208,0.18);
}
.resize-handle:hover::after {
    color: rgba(6,214,208,0.7);
}
.resize-handle.active {
    background: rgba(6,214,208,0.3);
}

/* Horizontal drag handle between explorer ↕ execution */
.resize-handle-h {
    height: 10px; cursor: row-resize;
    background: rgba(255,255,255,0.04);
    transition: background 0.15s;
    position: relative; z-index: 10;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.resize-handle-h::after {
    content: '···';
    color: rgba(255,255,255,0.2);
    font-size: 10px;
    letter-spacing: 2px;
    pointer-events: none;
}
.resize-handle-h:hover {
    background: rgba(6,214,208,0.18);
}
.resize-handle-h:hover::after {
    color: rgba(6,214,208,0.7);
}
.resize-handle-h.active {
    background: rgba(6,214,208,0.3);
}

/* ─── Panels ────────── */
.panel {
    background: transparent;
    display: flex; flex-direction: column;
    overflow: hidden;
    min-width: 0;
}
.panel-title {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 0.85rem;
    font-size: 0.7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-dim);
    border-bottom: 1px solid rgba(6,214,208,0.06);
    flex-shrink: 0;
    font-family: var(--mono);
    background: linear-gradient(180deg, rgba(6,214,208,0.02), transparent);
}
.panel-title svg { opacity: 0.5; }

/* ─── File Explorer / Exec Panel ────────── */
.file-panel, .exec-panel {
    border-right: 1px solid rgba(6,214,208,0.06);
    background: rgba(3, 6, 11, 0.6);
    backdrop-filter: blur(8px);
}
.file-tree {
    flex: 1; overflow-y: auto;
    padding: 0.25rem 0;
}
.file-tree::-webkit-scrollbar { width: 3px; }
.file-tree::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.tree-empty { color: var(--text-dim); padding: 2rem 1rem; text-align: center; font-size: 0.82rem; }

.tree-item {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.25rem 0.75rem;
    font-size: 0.82rem; color: var(--text-muted);
    cursor: pointer; transition: all 0.15s;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    border-left: 2px solid transparent;
}
.tree-item:hover { background: rgba(6,214,208,0.04); color: var(--text); }
.tree-item.active { background: rgba(6,214,208,0.08); color: var(--text); border-left-color: var(--accent); }
.tree-item .icon { opacity: 0.6; font-size: 0.78rem; flex-shrink: 0; }
.tree-item.dir .icon { color: #facc15; }
.tree-item.file .icon { color: var(--accent); }

.tree-group > .tree-children { padding-left: 0.75rem; }

/* ─── Center Column ────────── */
.center-column {
    display: flex; flex-direction: column;
    overflow: hidden;
    border-right: 1px solid rgba(6,214,208,0.06);
    background: rgba(3,6,11,0.3);
}

/* ─── Stream ────────── */
.stream-panel { flex: 1; overflow: hidden; }
.stream-container {
    flex: 1; overflow-y: auto;
    padding: 0.6rem 0.85rem;
    font-size: 0.82rem;
    display: flex; flex-direction: column; gap: 0.15rem;
    background: radial-gradient(ellipse at 50% 0%, rgba(6,214,208,0.015) 0%, transparent 70%);
}
.stream-container::-webkit-scrollbar { width: 3px; }
.stream-container::-webkit-scrollbar-thumb { background: rgba(6,214,208,0.15); border-radius: 2px; }
.stream-empty {
    color: var(--text-dim); padding: 1.5rem; text-align: center;
    font-family: var(--mono); font-size: 0.75rem; letter-spacing: 0.05em;
}
.stream-item {
    padding: 0.35rem 0.5rem;
    color: #d4d4d8;
    line-height: 1.6;
    animation: streamSlideIn 0.25s ease-out;
    word-wrap: break-word;
    border-radius: 4px;
    transition: background 0.2s;
}
.stream-item:hover { background: rgba(255,255,255,0.02); }
.stream-item .time {
    color: var(--text-dim); font-size: 0.68rem;
    font-family: var(--mono); font-weight: 500;
    margin-right: 0.5rem; letter-spacing: 0.02em;
}
.stream-item .content { color: var(--text-muted); }
.stream-item .content.stream-tool { color: #60a5fa; }
.stream-item .content.stream-ok { color: #4ade80; }
.stream-item .content.stream-error { color: #f87171; }
.stream-item .content.stream-review { color: #fbbf24; }
.stream-item .content.stream-deploy { color: #c084fc; }
.stream-item .content.stream-warn { color: #fb923c; }
.stream-item .content.stream-info { color: #94a3b8; }
.stream-item .content.stream-plan { color: var(--accent); }

/* 🏛️ AION Architect messages */
.stream-item.stream-architect {
    border-left: 2px solid #7c3aed;
    background: rgba(124, 58, 237, 0.06);
    padding-left: 0.4rem;
    border-radius: 0 4px 4px 0;
    margin: 1px 0;
}
.stream-item .content.stream-architect-msg {
    color: #c4b5fd;
    font-weight: 500;
}

@keyframes streamSlideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes archPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(124,58,237,0.6); }
    50% { opacity: 0.6; box-shadow: 0 0 0 6px rgba(124,58,237,0); }
}

.stream-item.stream-task {
    background: linear-gradient(90deg, rgba(6,214,208,0.08), rgba(6,214,208,0.02));
    border-left: 3px solid var(--accent);
    padding: 0.55rem 0.85rem;
    margin-bottom: 0.3rem;
    border-radius: 0 6px 6px 0;
    font-weight: 500;
}
.stream-item.stream-thinking {
    background: linear-gradient(90deg, rgba(124,58,237,0.08), rgba(124,58,237,0.02));
    border-left: 3px solid var(--purple);
    padding: 0.55rem 0.85rem;
    border-radius: 0 6px 6px 0;
    animation: thinkPulse 1.5s ease-in-out infinite;
}
@keyframes thinkPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* Bouncing dots loading indicator */
.loading-dots { display: inline-flex; gap: 4px; align-items: center; margin-left: 6px; }
.loading-dots span {
    width: 5px; height: 5px; border-radius: 50%;
    background: var(--purple);
    animation: dotBounce 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.15s; }
.loading-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotBounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
    40% { transform: translateY(-8px); opacity: 1; }
}

textarea:disabled { opacity: 0.5; cursor: not-allowed; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.pulse-dot {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    animation: pulse 2s infinite;
}
.pulse-dot.processing {
    width: 14px; height: 14px;
    background: transparent;
    border: 2px solid rgba(6, 214, 208, 0.2);
    border-top-color: var(--accent);
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 12px rgba(6, 214, 208, 0.3);
}
.pulse-dot.done {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
    animation: pulse-green 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 var(--accent-glow); }
    70% { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes pulse-green {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.4); }
    70% { box-shadow: 0 0 0 6px transparent; }
    100% { box-shadow: 0 0 0 0 transparent; }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Execution panel processing state */
.exec-panel.is-processing {
    border-right-color: rgba(6, 214, 208, 0.15);
}
.exec-processing-label {
    font-size: 0.65rem; color: var(--accent); font-weight: 600;
    margin-left: auto; font-family: var(--mono);
    letter-spacing: 0.03em;
    animation: fadeIn 0.3s ease;
}

/* ─── Prompt Bar ────────── */
.prompt-panel {
    border-top: 1px solid rgba(6,214,208,0.08);
    padding: 0 0 0.7rem 0;
    background: linear-gradient(180deg, transparent, rgba(6,214,208,0.02));
    flex-shrink: 0;
    backdrop-filter: blur(8px);
}
/* Execution mode selector buttons */
.exec-mode-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 0.1rem; padding: 0.35rem 0.4rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; color: #71717a;
    font-size: 0.72rem; font-weight: 600;
    cursor: pointer; font-family: var(--font);
    transition: all 0.2s; line-height: 1.2;
    white-space: nowrap;
}
.exec-mode-btn:hover {
    background: rgba(255,255,255,0.07);
    color: #a1a1aa; border-color: rgba(255,255,255,0.15);
}
.exec-mode-btn.active {
    background: rgba(6,214,208,0.1);
    border-color: rgba(6,214,208,0.4);
    color: #06d6d0;
}
.mode-cost {
    font-size: 0.62rem; font-weight: 400;
    color: inherit; opacity: 0.75;
}
.prompt-bar {
    display: flex; gap: 0.5rem; align-items: flex-end;
}
#task-input {
    flex: 1; resize: none;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(6,214,208,0.1);
    border-radius: 10px;
    color: var(--text); padding: 0.7rem 0.9rem;
    font-family: var(--font); font-size: 0.85rem;
    font-weight: 400;
    line-height: 1.5; outline: none;
    transition: all 0.3s;
    max-height: 120px;
    letter-spacing: 0.01em;
}
#task-input::placeholder {
    color: var(--text-dim); font-weight: 400;
    letter-spacing: 0.02em;
}
#task-input:focus {
    border-color: rgba(6,214,208,0.3);
    box-shadow: 0 0 0 3px rgba(6,214,208,0.08), 0 0 20px rgba(6,214,208,0.06);
    background: rgba(0,0,0,0.5);
}
.send-btn {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, var(--accent), var(--purple)); border: none;
    border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: white; transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(6,214,208,0.15);
}
.send-btn:hover { box-shadow: 0 4px 24px rgba(6,214,208,0.25); transform: translateY(-2px); }
.send-btn:disabled { opacity: 0.3; cursor: not-allowed; transform: none; box-shadow: none; }
.status-msg { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.35rem; opacity: 0; transition: opacity 0.2s; font-family: var(--mono); }
.status-msg.show { opacity: 1; }

/* ─── Code + Preview Panel ────────── */
.code-panel {
    background: rgba(3, 6, 11, 0.6);
    display: flex; flex-direction: column;
    overflow: hidden;
    backdrop-filter: blur(8px);
}

/* Tabs */
.panel-tabs {
    display: flex; gap: 2px; background: rgba(0,0,0,0.3); border-radius: 6px; padding: 2px;
}
.panel-tab {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.3rem 0.65rem;
    background: transparent; border: none;
    border-radius: 5px;
    color: var(--text-dim); font-size: 0.7rem; font-weight: 600;
    font-family: var(--font); cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}
.panel-tab:hover { color: var(--text-muted); }
.panel-tab.active {
    background: rgba(6, 214, 208, 0.12);
    color: var(--accent);
    box-shadow: 0 0 8px rgba(6, 214, 208, 0.1);
}
.panel-tab svg { opacity: 0.7; }

/* Code View */
.code-view-active {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
}
.code-panel-content {
    flex: 1; overflow: auto;
    padding: 1rem;
    font-family: var(--mono); font-size: 0.78rem;
    line-height: 1.7; color: #c8d6d6;
    white-space: pre-wrap; word-wrap: break-word;
    background: rgba(0,0,0,0.2);
    margin: 0;
    tab-size: 4;
}
.code-panel-content::-webkit-scrollbar { width: 4px; }
.code-panel-content::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
.code-panel-empty {
    color: var(--text-dim);
    font-family: var(--font);
    font-style: normal;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

/* Preview iframe */
.preview-iframe {
    width: 100%; height: 100%;
    border: none; background: #fff;
}
.preview-empty {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.8rem;
    color: var(--text-dim);
    font-size: 0.82rem;
    text-align: center;
    padding: 2rem;
    background: rgba(0,0,0,0.15);
}
.preview-empty-icon { font-size: 2.5rem; opacity: 0.4; }

/* ─── Project Chat ────────── */
.project-chat-container {
    display: flex; flex-direction: column;
    border-top: 1px solid rgba(6,214,208,0.15);
    background: rgba(0,0,0,0.2);
    min-height: 180px; max-height: 45%; flex-shrink: 0;
}
.chat-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.85rem; font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim);
    border-bottom: 1px solid rgba(6,214,208,0.06); font-family: var(--mono);
    background: linear-gradient(180deg, rgba(6,214,208,0.04), transparent);
}
.chat-messages {
    flex: 1; overflow-y: auto; padding: 0.5rem 0.85rem; display: flex; flex-direction: column; gap: 0.5rem; font-size: 0.78rem;
}
.chat-messages::-webkit-scrollbar { width: 3px; }
.chat-messages::-webkit-scrollbar-thumb { background: rgba(6,214,208,0.15); border-radius: 2px; }

.chat-empty { color: var(--text-dim); font-size: 0.7rem; text-align: center; font-style: italic; opacity: 0.6; padding: 1rem 0; }
.chat-ms-user {
    align-self: flex-end; background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3); border-radius: 8px 8px 0 8px;
    padding: 0.4rem 0.6rem; color: #e9d5ff; max-width: 90%; word-break: break-word;
}
.chat-ms-ai {
    align-self: flex-start; background: rgba(6, 214, 208, 0.1);
    border: 1px solid rgba(6, 214, 208, 0.2); border-radius: 8px 8px 8px 0;
    padding: 0.4rem 0.6rem; color: #c8d6d6; max-width: 95%; word-break: break-word;
}

/* ─── Chat Bubbles (new) ────────── */
.chat-bubble { max-width: 88%; animation: fadeIn 0.25s ease; }
.chat-user {
    align-self: flex-end;
}
.chat-user .chat-bubble-content {
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3); border-radius: 12px 12px 2px 12px;
    padding: 0.5rem 0.75rem; color: #e9d5ff; font-size: 0.8rem; line-height: 1.4;
}
.chat-aion {
    align-self: flex-start;
}
.chat-aion .chat-bubble-content {
    background: rgba(6, 214, 208, 0.08);
    border: 1px solid rgba(6, 214, 208, 0.15); border-radius: 12px 12px 12px 2px;
    padding: 0.5rem 0.75rem; color: #c8d6d6; font-size: 0.8rem; line-height: 1.4;
}

/* ─── Project Manager Panel ────────── */
#proj-manager-panel {
    position: absolute;
    top: 0; left: 0; right: 0;
    background: rgba(8, 16, 26, 0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(6, 214, 208, 0.2);
    z-index: 200;
    transform: translateY(-100%);
    opacity: 0;
    transition: transform 0.2s ease, opacity 0.2s ease;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
}
#proj-manager-panel.pmp-visible {
    transform: translateY(0);
    opacity: 1;
}
.pmp-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.7rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.pmp-title { font-size: 0.72rem; font-weight: 700; color: #06d6d0; flex: 1; letter-spacing: 0.04em; }
.pmp-new {
    font-size: 0.65rem; padding: 0.2rem 0.5rem; border-radius: 4px;
    background: rgba(6,214,208,0.1); border: 1px solid rgba(6,214,208,0.25);
    color: #06d6d0; cursor: pointer; font-weight: 600; transition: background 0.15s;
}
.pmp-new:hover { background: rgba(6,214,208,0.2); }
.pmp-close {
    font-size: 0.75rem; background: none; border: none;
    color: var(--text-dim); cursor: pointer; opacity: 0.6; padding: 0 0.2rem;
}
.pmp-close:hover { opacity: 1; color: #ef4444; }
.pmp-list { overflow-y: auto; flex: 1; }
.pmp-empty { padding: 0.8rem 0.7rem; font-size: 0.72rem; color: var(--text-dim); }
.pmp-row {
    display: flex; align-items: center; gap: 0.4rem;
    padding: 0.45rem 0.7rem; cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.pmp-row:hover { background: rgba(6,214,208,0.05); }
.pmp-row.active {
    background: rgba(6,214,208,0.08);
    border-left: 2px solid #06d6d0;
}
.pmp-row-info { flex: 1; min-width: 0; }
.pmp-row-name {
    display: block; font-size: 0.73rem; font-weight: 600;
    color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pmp-row.active .pmp-row-name { color: #06d6d0; }
.pmp-row-meta { font-size: 0.62rem; color: var(--text-dim); }
.pmp-row-actions { display: flex; gap: 0.2rem; flex-shrink: 0; }
.pmp-action-btn {
    font-size: 0.8rem; background: none; border: none; cursor: pointer;
    padding: 0.1rem 0.3rem; border-radius: 4px; opacity: 0.5;
    transition: all 0.15s; color: var(--text);
}
.pmp-action-btn:hover { opacity: 1; background: rgba(255,255,255,0.08); }
.pmp-action-btn.danger:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* ─── Plan Card ────────── */
.plan-card {
    background: rgba(6, 214, 208, 0.04);
    border: 1px solid rgba(6, 214, 208, 0.15);
    border-radius: 12px;
    padding: 0;
    margin: 0.25rem 0;
    overflow: hidden;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(8px);
}
.plan-header {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    background: rgba(6, 214, 208, 0.06);
    border-bottom: 1px solid rgba(6, 214, 208, 0.1);
    font-size: 0.72rem;
}
.plan-icon { font-size: 1rem; }
.plan-title { font-weight: 700; color: var(--accent, #06d6d0); flex: 1; text-transform: uppercase; letter-spacing: 0.05em; }
.plan-credits {
    background: rgba(167, 139, 250, 0.15); color: #c084fc;
    padding: 0.15rem 0.5rem; border-radius: 999px;
    font-size: 0.65rem; font-weight: 700; font-family: var(--mono);
}
.plan-summary {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem; color: var(--text); font-weight: 500;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.plan-steps { padding: 0.4rem 0.8rem; }
.plan-step {
    display: flex; align-items: flex-start; gap: 0.5rem;
    padding: 0.25rem 0; font-size: 0.75rem; color: var(--text-muted);
}
.plan-step-num {
    background: rgba(6, 214, 208, 0.12); color: var(--accent);
    min-width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; font-weight: 700; flex-shrink: 0;
}
.plan-files {
    padding: 0.3rem 0.8rem 0.4rem;
    display: flex; flex-wrap: wrap; gap: 0.3rem;
}
.plan-file-tag {
    font-size: 0.65rem; padding: 0.1rem 0.4rem; border-radius: 4px;
    font-family: var(--mono); font-weight: 500;
}
.plan-file-new { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.plan-file-mod { background: rgba(251, 191, 36, 0.12); color: #fbbf24; }

.plan-agents-suggest {
    padding: 0.4rem 0.8rem;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.plan-agents-title {
    font-size: 0.7rem; font-weight: 600; color: #fbbf24;
    margin-bottom: 0.3rem;
}
.plan-agent-rec {
    display: flex; flex-direction: column; gap: 0.1rem;
    padding: 0.2rem 0; font-size: 0.72rem;
}
.plan-agent-rec strong { color: var(--text); }
.plan-agent-reason { color: var(--text-dim); font-size: 0.65rem; font-style: italic; }

.plan-notes {
    padding: 0.3rem 0.8rem 0.4rem;
    font-size: 0.68rem; color: var(--text-dim); font-style: italic;
    border-top: 1px solid rgba(255,255,255,0.04);
}

.plan-actions {
    display: flex; gap: 0.5rem;
    padding: 0.6rem 0.8rem;
    border-top: 1px solid rgba(6, 214, 208, 0.2);
    background: rgba(6, 14, 26, 0.95);
    backdrop-filter: blur(8px);
    position: sticky;
    bottom: 0;
    z-index: 10;
}
.plan-btn {
    padding: 0.35rem 0.8rem; border-radius: 6px;
    font-size: 0.72rem; font-weight: 600; cursor: pointer;
    border: 1px solid transparent;
    font-family: var(--font, 'Inter', sans-serif);
    transition: all 0.2s;
}
.plan-btn-start {
    flex: 1; background: rgba(52, 211, 153, 0.2); color: #34d399;
    border-color: rgba(52, 211, 153, 0.5);
    font-size: 0.8rem; padding: 0.5rem 1rem;
    animation: planBtnPulse 2s ease-in-out infinite;
}
.plan-btn-start:hover {
    background: rgba(52, 211, 153, 0.25);
    box-shadow: 0 0 12px rgba(52, 211, 153, 0.2);
}
.plan-btn-accept {
    flex: 2; background: linear-gradient(135deg, rgba(6,214,208,0.25), rgba(124,58,237,0.15));
    color: #06d6d0; border-color: rgba(6,214,208,0.5);
    font-size: 0.82rem; padding: 0.5rem 1rem; font-weight: 700;
    animation: planBtnPulse 2s ease-in-out infinite;
}
.plan-btn-accept:hover {
    background: linear-gradient(135deg, rgba(6,214,208,0.35), rgba(124,58,237,0.25));
    box-shadow: 0 0 16px rgba(6,214,208,0.3);
}
.plan-btn-cancel {
    background: rgba(239, 68, 68, 0.1); color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}
.plan-btn-cancel:hover {
    background: rgba(239, 68, 68, 0.2);
}
.chat-input-wrapper {
    display: flex; gap: 0.4rem; padding: 0.5rem 0.6rem;
    background: rgba(0,0,0,0.4); border-top: 1px solid rgba(6,214,208,0.08); align-items: flex-end;
}
#chat-input {
    flex: 1; resize: none; background: transparent; border: none; color: var(--text);
    font-family: inherit; font-size: 0.8rem; outline: none; padding: 0.2rem;
    max-height: 80px; min-height: 24px;
}
#chat-input::placeholder { color: var(--text-dim); }

/* ─── File Modal ────────── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; backdrop-filter: blur(4px);
}
.modal-content {
    width: 90%; max-width: 700px; max-height: 80vh;
    display: flex; flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem; font-family: var(--font);
    color: var(--text-muted);
}
.modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.25rem; cursor: pointer;
    padding: 0 0.25rem; line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-code {
    flex: 1; overflow: auto;
    padding: 1rem;
    font-family: var(--mono); font-size: 0.8rem;
    line-height: 1.6; color: #d4d4d8;
    white-space: pre-wrap; word-wrap: break-word;
    background: rgba(0,0,0,0.3);
    margin: 0;
}
.modal-code::-webkit-scrollbar { width: 4px; }
.modal-code::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* ─── Download Button ────────── */
.download-btn {
    background: none; border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 6px; cursor: pointer;
    color: rgba(255,255,255,0.4); transition: all 0.2s ease;
    display: flex; align-items: center; justify-content: center;
}
.download-btn:hover {
    color: var(--accent);
    border-color: rgba(6,214,208,0.4);
    background: rgba(6,214,208,0.08);
}

/* ─── Responsive ────────── */
@media (max-width: 900px) {
    .ide-grid { grid-template-columns: 180px 12px 1fr 12px 0px; }
    .ide-grid .code-panel { display: none; }
    .code-panel { display: none; }
    .nav-tabs { gap: 0; }
    .nav-tab { padding: 0.35rem 0.6rem; font-size: 0.72rem; }
}
@media (max-width: 600px) {
    .ide-grid { grid-template-columns: 1fr; }
    .ide-grid .code-panel, .ide-grid .resize-handle { display: none; }
    .file-panel, .exec-panel { display: none; }
    .topbar { height: auto; padding: 0.5rem; flex-wrap: wrap; gap: 0.3rem; }
    .canvas-toolbar { flex-direction: column; gap: 0.5rem; }
    .canvas-toolbar-right { justify-content: center; }
}

/* ═══ AION Chat CTA: Pulsing "Chat with me" Button ═══ */
@keyframes aion-pulse {
    0%, 100% { box-shadow: 0 0 20px rgba(124,58,237,0.4), 0 0 60px rgba(6,214,208,0.15); transform: scale(1); }
    50% { box-shadow: 0 0 35px rgba(124,58,237,0.7), 0 0 90px rgba(6,214,208,0.3); transform: scale(1.03); }
}
@keyframes aion-glow-ring {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.15); }
}
#aion-chat-cta {
    position: relative;
    top: auto; left: auto;
    transform: none;
    z-index: 50;
    display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
    cursor: pointer;
    margin-top: 0.7rem;
    padding-top: 0.6rem;
    border-top: 1px solid rgba(124,58,237,0.15);
}
#aion-chat-cta .cta-glow-ring {
    position: absolute;
    width: 100%; height: 40px;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50px;
    border: 2px solid rgba(124,58,237,0.3);
    animation: aion-glow-ring 2.5s ease-in-out infinite;
    pointer-events: none;
}
#aion-chat-cta .cta-btn {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 1.3rem;
    background: linear-gradient(135deg, rgba(124,58,237,0.85), rgba(6,214,208,0.65));
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 50px;
    color: white; font-size: 0.82rem; font-weight: 700;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.03em;
    animation: aion-pulse 2.5s ease-in-out infinite;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    cursor: pointer;
}
#aion-chat-cta .cta-btn:hover {
    box-shadow: 0 0 50px rgba(124,58,237,0.8), 0 0 100px rgba(6,214,208,0.4) !important;
}
#aion-chat-cta .cta-subtitle {
    font-size: 0.72rem; color: rgba(255,255,255,0.5);
    font-weight: 500; letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ═══ Chat Overlay: Close Button ═══ */
#briefing-close-btn {
    position: absolute; top: 12px; right: 14px;
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 8px;
    color: rgba(255,255,255,0.6);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}
#briefing-close-btn:hover {
    background: rgba(239,68,68,0.2);
    border-color: rgba(239,68,68,0.4);
    color: #ef4444;
}

/* ═══ Mini Chat Icon on Architect Node ═══ */
#aion-mini-chat-btn {
    position: absolute; bottom: -8px; right: -8px;
    width: 28px; height: 28px;
    display: none; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #7c3aed, #06d6d0);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 50%;
    font-size: 0.75rem;
    cursor: pointer;
    z-index: 20;
    transition: all 0.2s;
    box-shadow: 0 2px 12px rgba(124,58,237,0.5);
}
#aion-mini-chat-btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 20px rgba(124,58,237,0.7);
}
@keyframes mini-chat-notify {
    0%, 100% { box-shadow: 0 2px 12px rgba(124,58,237,0.5); }
    50% { box-shadow: 0 2px 20px rgba(6,214,208,0.8); }
}
#aion-mini-chat-btn.has-message {
    animation: mini-chat-notify 1.5s ease-in-out infinite;
}

/* ─── Floating Status Indicator ────────── */
#aion-floating-status {
    position: fixed;
    top: 52px;
    right: 1rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.85rem;
    background: rgba(10, 13, 20, 0.92);
    border: 1px solid rgba(6, 214, 208, 0.3);
    border-radius: 8px;
    z-index: 500;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(6, 214, 208, 0.08);
    font-family: 'Inter', sans-serif;
    animation: afsSlideIn 0.3s ease;
}
@keyframes afsSlideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.afs-pulse {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #06d6d0;
    box-shadow: 0 0 6px rgba(6, 214, 208, 0.6);
    animation: afsPulse 1.5s ease-in-out infinite;
    flex-shrink: 0;
}
@keyframes afsPulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(6, 214, 208, 0.4); }
    50% { opacity: 0.4; box-shadow: 0 0 12px rgba(6, 214, 208, 0.8); }
}
.afs-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: #06d6d0;
    letter-spacing: 0.02em;
}
.afs-agent {
    font-size: 0.68rem;
    font-weight: 500;
    color: #a78bfa;
    font-family: 'JetBrains Mono', monospace;
}
#aion-floating-status.afs-done {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5), 0 0 15px rgba(34, 197, 94, 0.1);
}
#aion-floating-status.afs-done .afs-pulse {
    background: #34d399;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
    animation: none;
}
#aion-floating-status.afs-done .afs-label {
    color: #34d399;
}

/* ═══ PROJECT PICKER OVERLAY ═══════════════════════ */
#project-picker-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(5, 8, 18, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}
#project-picker-overlay.visible { opacity: 1; }
.pp-container {
    background: rgba(12, 16, 28, 0.95);
    border: 1px solid rgba(6, 214, 208, 0.2);
    border-radius: 16px;
    padding: 2rem 2.5rem;
    max-width: 600px;
    width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.pp-header {
    text-align: center;
    margin-bottom: 1.5rem;
}
.pp-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.3rem;
}
.pp-header p {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin: 0;
}
.pp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}
.pp-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 1.2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
.pp-card:hover {
    border-color: var(--accent);
    background: rgba(6, 214, 208, 0.08);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(6, 214, 208, 0.12);
}
.pp-card-icon { font-size: 2rem; margin-bottom: 0.5rem; }
.pp-card-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
    word-break: break-word;
}
.pp-card-files {
    font-size: 0.68rem;
    color: var(--text-dim);
}
.pp-card-new {
    border-style: dashed;
    border-color: rgba(6, 214, 208, 0.25);
    background: transparent;
}
.pp-card-new:hover {
    border-color: var(--accent);
    background: rgba(6, 214, 208, 0.05);
}

/* ─── Unified Project Manager Popup (Full List Layout) ─── */
.pp-container-full {
    padding: 0;
    max-width: 540px;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
}
.pp-close-btn {
    position: absolute; top: 0.8rem; right: 0.9rem;
    background: none; border: none; color: var(--text-dim);
    cursor: pointer; font-size: 0.9rem; opacity: 0.5;
    transition: opacity 0.15s;
}
.pp-close-btn:hover { opacity: 1; color: #ef4444; }
.pp-container-full .pp-header {
    padding: 1.2rem 1.5rem 0.8rem;
    text-align: left;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pp-container-full .pp-header h2 { font-size: 1rem; text-align: left; }
.pp-container-full .pp-header p { font-size: 0.72rem; text-align: left; }
.pp-list-full { overflow-y: auto; max-height: 50vh; }
.pp-empty-msg { padding: 1.5rem; font-size: 0.8rem; color: var(--text-dim); text-align: center; }
.pp-row-full {
    display: flex; align-items: center; gap: 0.75rem;
    padding: 0.6rem 1.2rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    flex-wrap: wrap;
}
.pp-row-full:hover { background: rgba(6,214,208,0.04); }
.pp-row-full.active { background: rgba(6,214,208,0.07); border-left: 2px solid #06d6d0; }
.pp-row-icon { font-size: 1.1rem; flex-shrink: 0; }
.pp-row-info-full { flex: 1; min-width: 0; }
.pp-row-name-full {
    font-size: 0.8rem; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pp-row-full.active .pp-row-name-full { color: #06d6d0; }
.pp-row-meta-full { font-size: 0.62rem; color: var(--text-dim); margin-top: 0.05rem; }
.pp-row-btns { display: flex; gap: 0.3rem; flex-shrink: 0; flex-wrap: wrap; }
.pp-row-btn {
    font-size: 0.68rem; padding: 0.22rem 0.55rem; border-radius: 5px;
    border: 1px solid transparent; cursor: pointer; font-weight: 600;
    transition: all 0.15s; white-space: nowrap;
}
.pp-row-btn.open {
    background: rgba(6,214,208,0.1); color: #06d6d0; border-color: rgba(6,214,208,0.25);
}
.pp-row-btn.open:hover { background: rgba(6,214,208,0.22); }
.pp-row-btn.dl {
    background: rgba(99,179,237,0.1); color: #63b3ed; border-color: rgba(99,179,237,0.25);
}
.pp-row-btn.dl:hover { background: rgba(99,179,237,0.22); }
.pp-row-btn.gh {
    background: rgba(255,255,255,0.06); color: var(--text-muted); border-color: rgba(255,255,255,0.12);
}
.pp-row-btn.gh:hover { background: rgba(255,255,255,0.12); }
.pp-row-btn.del {
    background: rgba(239,68,68,0.08); color: #ef4444; border-color: rgba(239,68,68,0.2);
}
.pp-row-btn.del:hover { background: rgba(239,68,68,0.18); }
.pp-gh-form {
    width: 100%; padding: 0.5rem 0 0;
    display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center;
}
.pp-gh-input {
    flex: 1; min-width: 120px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.12); border-radius: 5px;
    padding: 0.3rem 0.6rem; font-size: 0.72rem; color: var(--text);
    outline: none;
}
.pp-gh-input:focus { border-color: #06d6d0; }
.pp-gh-submit {
    background: rgba(52,211,153,0.15); color: #34d399;
    border: 1px solid rgba(52,211,153,0.3); border-radius: 5px;
    padding: 0.3rem 0.7rem; font-size: 0.72rem; cursor: pointer; font-weight: 600;
}
.pp-gh-submit:hover { background: rgba(52,211,153,0.28); }
.pp-footer-full {
    padding: 0.8rem 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.06);
    display: flex; justify-content: flex-end;
}
.pp-new-full { background: rgba(6,214,208,0.1); color: #06d6d0;
    border: 1px solid rgba(6,214,208,0.3); border-radius: 6px;
    padding: 0.4rem 1rem; font-size: 0.75rem; font-weight: 700; cursor: pointer;
    transition: background 0.15s;
}
.pp-new-full:hover { background: rgba(6,214,208,0.2); }

/* ═══════════════════════════════════════════════
   UNIFIED AION CHAT THREAD — New Design
   ═══════════════════════════════════════════════ */

/* ── Chat Header ── */
/* ════════════════════════════════════════════════════════════
   AION CHAT THREAD — Antigravity minimal style
   ════════════════════════════════════════════════════════════ */

/* ── Header ── */
.aion-chat-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.5rem 1rem;
    background: rgba(5,8,14,0.97);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
    gap: 0.75rem;
}
.aion-chat-header-left {
    display: flex; align-items: center; gap: 0.55rem;
}
.aion-chat-title {
    font-size: 0.72rem; font-weight: 700;
    color: #cbd5e1; letter-spacing: 0.08em;
    text-transform: uppercase; font-family: var(--mono);
}
.aion-chat-project-badge {
    font-size: 0.64rem; font-weight: 600;
    color: #4ade80;
    background: rgba(74,222,128,0.07);
    border: 1px solid rgba(74,222,128,0.18);
    border-radius: 3px;
    padding: 0.1rem 0.45rem;
    font-family: var(--mono);
    max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.aion-chat-project-badge:empty { display: none; }
.aion-chat-status-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 5px rgba(74,222,128,0.5);
    flex-shrink: 0;
}
.aion-chat-status-dot.busy {
    background: #fbbf24;
    box-shadow: 0 0 5px rgba(251,191,36,0.5);
    animation: dotBounce 0.8s ease-in-out infinite;
}
.chat-header-btn {
    display: flex; align-items: center; gap: 0.3rem;
    padding: 0.25rem 0.65rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 4px;
    color: #64748b; font-size: 0.7rem; font-weight: 600;
    cursor: pointer; font-family: var(--mono);
    transition: all 0.15s;
}
.chat-header-btn:hover {
    background: rgba(74,222,128,0.06);
    border-color: rgba(74,222,128,0.2);
    color: #4ade80;
}

/* ── Thread Container ── */
.aion-thread {
    flex: 1; overflow-y: auto;
    padding: 0.75rem 0.9rem;
    display: flex; flex-direction: column;
    gap: 0.2rem;
    background: #060910;
    scroll-behavior: smooth;
}
.aion-thread::-webkit-scrollbar { width: 3px; }
.aion-thread::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 2px; }

/* ── Empty State ── */
.aion-thread-empty {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 0.6rem; padding: 3rem 2rem; text-align: center;
    pointer-events: none;
}
.aion-thread-empty-icon { font-size: 1.8rem; opacity: 0.15; }
.aion-thread-empty-title { font-size: 0.78rem; font-weight: 700; color: #1e293b; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.aion-thread-empty-sub { font-size: 0.72rem; color: #1e293b; max-width: 280px; line-height: 1.6; }

/* ── User message ── */
.ti-user {
    display: flex; flex-direction: row-reverse; gap: 0.5rem;
    align-items: flex-start;
    animation: tiSlideRight 0.2s ease-out;
    padding: 0.15rem 0;
}
@keyframes tiSlideRight {
    from { opacity: 0; transform: translateX(8px); }
    to   { opacity: 1; transform: translateX(0); }
}
.ti-user-bubble {
    background: rgba(30,41,59,0.9);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 6px 6px 2px 6px;
    padding: 0.5rem 0.8rem;
    color: #e2e8f0; font-size: 0.83rem; line-height: 1.5;
    max-width: 80%; word-break: break-word;
}
.ti-user-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.6rem; font-weight: 700; color: #94a3b8;
    flex-shrink: 0; margin-top: 2px; font-family: var(--mono);
}

/* ── AION response ── */
.ti-aion {
    display: flex; gap: 0.5rem;
    align-items: flex-start;
    animation: tiSlideLeft 0.2s ease-out;
    padding: 0.15rem 0;
}
@keyframes tiSlideLeft {
    from { opacity: 0; transform: translateX(-6px); }
    to   { opacity: 1; transform: translateX(0); }
}
.ti-aion-avatar {
    width: 22px; height: 22px; border-radius: 50%;
    background: rgba(74,222,128,0.1);
    border: 1px solid rgba(74,222,128,0.2);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.62rem; flex-shrink: 0; margin-top: 2px;
}
.ti-aion-bubble {
    background: rgba(10,15,22,0.8);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 6px 6px 6px 2px;
    padding: 0.5rem 0.8rem;
    color: #94a3b8; font-size: 0.82rem; line-height: 1.55;
    max-width: 92%; word-break: break-word;
}
.ti-aion-bubble strong { color: #cbd5e1; }
.ti-aion-bubble ol, .ti-aion-bubble ul { padding-left: 1.2em; }
.ti-aion-bubble li { margin-bottom: 0.25em; }

/* ── Step events (stream) ── */
.ti-step {
    display: flex; gap: 0.55rem; align-items: flex-start;
    animation: fadein 0.18s ease;
    padding: 0.1rem 0;
}
.ti-step-bar {
    width: 2px; min-height: 16px; border-radius: 1px;
    background: rgba(255,255,255,0.1);
    flex-shrink: 0; margin-top: 4px; align-self: stretch;
}
.ti-step.step-arch .ti-step-bar  { background: rgba(167,139,250,0.5); }
.ti-step.step-tool .ti-step-bar  { background: rgba(96,165,250,0.4); }
.ti-step.step-ok   .ti-step-bar  { background: rgba(74,222,128,0.5); }
.ti-step.step-err  .ti-step-bar  { background: rgba(248,113,113,0.5); }
.ti-step.step-warn .ti-step-bar  { background: rgba(251,146,60,0.4); }
.ti-step.step-think .ti-step-bar { background: rgba(74,222,128,0.3); animation: thinkPulse 1.2s ease-in-out infinite; }
.ti-step-body { flex: 1; min-width: 0; }
.ti-step-text {
    font-size: 0.76rem; line-height: 1.5;
    color: #475569; word-break: break-word;
    font-family: var(--mono);
}
.ti-step.step-arch  .ti-step-text { color: #a78bfa; }
.ti-step.step-tool  .ti-step-text { color: #60a5fa; }
.ti-step.step-ok    .ti-step-text { color: #4ade80; }
.ti-step.step-err   .ti-step-text { color: #f87171; }
.ti-step.step-warn  .ti-step-text { color: #fb923c; }
.ti-step.step-think .ti-step-text { color: #64748b; }
.ti-step-time { display: none; }

/* ── Triage card ── */
.ti-triage {
    background: rgba(10,15,22,0.9);
    border: 1px solid rgba(74,222,128,0.12);
    border-left: 2px solid rgba(74,222,128,0.4);
    border-radius: 0 4px 4px 0;
    padding: 0.55rem 0.75rem;
    animation: tiSlideLeft 0.25s ease;
    margin: 0.2rem 0;
}
.ti-triage-header { display: flex; align-items: center; gap: 0.45rem; margin-bottom: 0.35rem; }
.ti-triage-badge {
    font-size: 0.58rem; font-weight: 700;
    color: #4ade80;
    border: 1px solid rgba(74,222,128,0.2);
    border-radius: 2px; padding: 0.05rem 0.4rem;
    text-transform: uppercase; letter-spacing: 0.06em;
    font-family: var(--mono);
}
.ti-triage-confidence {
    font-size: 0.6rem; color: #4ade80;
    font-family: var(--mono);
}
.ti-triage-confidence.low { color: #fb923c; }
.ti-triage-diagnosis { font-size: 0.76rem; color: #475569; line-height: 1.5; margin-bottom: 0.3rem; font-family: var(--mono); }
.ti-triage-fix { font-size: 0.74rem; color: #4ade80; line-height: 1.5; font-family: var(--mono); }
.ti-triage-fix::before { content: "→ "; opacity: 0.45; }

/* ── Done badge ── */
.ti-done {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.4rem 0.65rem;
    background: rgba(74,222,128,0.05);
    border: 1px solid rgba(74,222,128,0.15);
    border-radius: 4px;
    animation: tiSlideLeft 0.25s ease;
    margin: 0.3rem 0;
}
.ti-done-icon { font-size: 0.8rem; }
.ti-done-text { font-size: 0.75rem; color: #4ade80; font-weight: 600; flex: 1; font-family: var(--mono); }
.ti-done-cost {
    font-size: 0.68rem; color: #64748b;
    font-family: var(--mono);
}

/* ── Action button row (Start Dev, Confirm) ── */
.ti-start-dev {
    display: flex; justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.4rem 0 0.2rem 1.8rem;
    animation: fadeIn 0.3s ease;
}
.ti-start-btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.4rem 1.1rem;
    background: rgba(74,222,128,0.08);
    border: 1px solid rgba(74,222,128,0.25);
    border-radius: 4px;
    color: #4ade80; font-size: 0.78rem; font-weight: 600;
    cursor: pointer; font-family: var(--mono);
    transition: all 0.15s; letter-spacing: 0.02em;
}
.ti-start-btn:hover {
    background: rgba(74,222,128,0.14);
    border-color: rgba(74,222,128,0.4);
    color: #86efac;
}

/* ── Input Bar ── */
.aion-input-bar {
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(5,8,14,0.98);
    flex-shrink: 0;
    padding-bottom: 0.4rem;
}
.aion-input-row {
    display: flex; gap: 0.5rem; align-items: flex-end;
    padding: 0.5rem 0.75rem 0;
}
.aion-textarea {
    flex: 1; resize: none;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 4px;
    color: #cbd5e1; padding: 0.55rem 0.8rem;
    font-family: var(--font); font-size: 0.83rem;
    line-height: 1.5; outline: none;
    transition: border-color 0.2s;
    max-height: 120px;
}
.aion-textarea::placeholder { color: #1e293b; }
.aion-textarea:focus {
    border-color: rgba(74,222,128,0.2);
    background: rgba(255,255,255,0.04);
}
.aion-send-btn {
    width: 36px; height: 36px;
    background: rgba(74,222,128,0.1);
    border: 1px solid rgba(74,222,128,0.22);
    border-radius: 4px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: #4ade80; transition: all 0.15s; flex-shrink: 0;
}
.aion-send-btn:hover { background: rgba(74,222,128,0.18); border-color: rgba(74,222,128,0.4); }
.aion-send-btn:disabled { opacity: 0.2; cursor: not-allowed; }

