/* ═══════════════════════════════════════════════════════════════════
   Vibe-Kanban — Cyber Command Center
   Design Language: CoGecko Cockpit-grade quality
   Deep Navy + Glowing Status + Spring Animations + Glassmorphism
   ═══════════════════════════════════════════════════════════════════ */

/* ── 1. CSS Variables ─────────────────────────────────────────────── */
:root {
    /* Color Palette: Deep Navy Command Center */
    --bg-deep:       #080c14;
    --bg-primary:    #0c1018;
    --bg-surface:    #111820;
    --bg-card:       #151d28;
    --bg-elevated:   #1a2332;
    --bg-hover:      #1e2a3a;
    --border:        #1c2838;
    --border-bright: #2a3a4e;
    --border-glow:   rgba(88, 166, 255, 0.15);

    /* Text */
    --text-primary:   #e2e8f0;
    --text-secondary: #94a3b8;
    --text-dim:       #64748b;
    --text-muted:     #475569;

    /* Accent Colors */
    --accent-blue:    #58a6ff;
    --accent-green:   #4ade80;
    --accent-yellow:  #fbbf24;
    --accent-red:     #f87171;
    --accent-purple:  #c084fc;
    --accent-cyan:    #22d3ee;

    /* Status (semantic) */
    --status-active:  #4ade80;
    --status-idle:    #fbbf24;
    --status-gone:    #f87171;

    /* Project Colors */
    --project-cogecko: #c084fc;
    --project-trading: #fbbf24;
    --project-acc: #4ade80;
    --project-unknown: #64748b;

    /* Typography */
    --font-sans: system-ui, -apple-system, 'Segoe UI', 'Hiragino Kaku Gothic ProN', 'Meiryo', sans-serif;
    --font-mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', 'Consolas', monospace;

    /* Spacing & Radius */
    --radius-xs:  4px;
    --radius-sm:  6px;
    --radius:     8px;
    --radius-lg:  12px;
    --radius-xl:  16px;

    /* Easing */
    --ease-spring:   cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth:   cubic-bezier(0.16, 1, 0.3, 1);
    --ease-standard: cubic-bezier(0.4, 0, 0.2, 1);

    /* Shadows */
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow-glow-blue: 0 0 20px rgba(88, 166, 255, 0.12), 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-glow-green: 0 0 20px rgba(74, 222, 128, 0.12), 0 4px 12px rgba(0, 0, 0, 0.2);
    --shadow-elevated: 0 8px 32px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* ── 2. Reset & Base ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(88, 166, 255, 0.3);
    color: var(--text-primary);
}

/* ── 3. Keyframe Animations ───────────────────────────────────────── */
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slide-up {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slide-in-right {
    from { opacity: 0; transform: translateX(20px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes pop-in {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes dot-glow-green {
    0%, 100% { box-shadow: 0 0 4px var(--status-active), 0 0 1px var(--status-active); }
    50%      { box-shadow: 0 0 10px var(--status-active), 0 0 4px var(--status-active); }
}

@keyframes dot-glow-yellow {
    0%, 100% { box-shadow: 0 0 4px var(--status-idle), 0 0 1px var(--status-idle); }
    50%      { box-shadow: 0 0 8px var(--status-idle), 0 0 3px var(--status-idle); }
}

@keyframes dot-glow-red {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.5; }
}

@keyframes pulse-soft {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

@keyframes task-flash-complete {
    0%   { background-color: rgba(74, 222, 128, 0.25); }
    100% { background-color: transparent; }
}

@keyframes task-flash-progress {
    0%   { background-color: rgba(251, 191, 36, 0.2); }
    100% { background-color: transparent; }
}

@keyframes task-flash-pending {
    0%   { background-color: rgba(148, 163, 184, 0.15); }
    100% { background-color: transparent; }
}

@keyframes toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120%); opacity: 0; }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes header-glow {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

@keyframes scan-line {
    from { transform: translateY(-100%); }
    to   { transform: translateY(100vh); }
}

/* ── 4. Custom Scrollbars (scoped to panels, not global) ─────────── */
.panel, .output-viewer, #sessions-list, .center-panel {
    scrollbar-width: thin;
    scrollbar-color: var(--border-bright) transparent;
}

.panel::-webkit-scrollbar, .output-viewer::-webkit-scrollbar,
#sessions-list::-webkit-scrollbar,
.center-panel::-webkit-scrollbar { width: 5px; height: 5px; }
.panel::-webkit-scrollbar-track, .output-viewer::-webkit-scrollbar-track,
#sessions-list::-webkit-scrollbar-track,
.center-panel::-webkit-scrollbar-track { background: transparent; }
.panel::-webkit-scrollbar-thumb, .output-viewer::-webkit-scrollbar-thumb,
#sessions-list::-webkit-scrollbar-thumb,
.center-panel::-webkit-scrollbar-thumb {
    background: var(--border-bright);
    border-radius: 3px;
}
.panel::-webkit-scrollbar-thumb:hover, .output-viewer::-webkit-scrollbar-thumb:hover,
#sessions-list::-webkit-scrollbar-thumb:hover,
.center-panel::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── 5. App Layout: 3-Column Grid ─────────────────────────────────── */
.app {
    display: grid;
    grid-template-columns: 270px 1fr 310px;
    grid-template-rows: 48px 1fr;
    height: 100vh;
    height: 100dvh;
    background: var(--bg-deep);
    position: relative;
}

/* Subtle cyber grid overlay */
.app::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(34, 211, 238, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(34, 211, 238, 0.015) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.3) 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.3) 70%, transparent 100%);
}

/* ── 6. Header Bar ────────────────────────────────────────────────── */
.header {
    grid-column: 1 / -1;
    background: rgba(17, 24, 32, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

/* Subtle top accent line with glow pulse */
.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg,
        transparent,
        rgba(88, 166, 255, 0.3) 20%,
        rgba(34, 211, 238, 0.4) 50%,
        rgba(88, 166, 255, 0.3) 80%,
        transparent
    );
    animation: header-glow 4s ease-in-out infinite;
}

.header h1 {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-blue) 60%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Scan-line across header bottom */
.header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.5), transparent);
    animation: scan-line 8s linear infinite;
    opacity: 0.4;
    pointer-events: none;
}

.header-subtitle {
    font-size: 11px;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.header-version {
    font-size: 10px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 10px;
}

/* Header dashboard stats */
.header-stats {
    margin-left: auto;
    display: flex;
    gap: 16px;
    align-items: center;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.stat-value {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    line-height: 1;
}

.stat-label {
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    line-height: 1;
}

.header .ws-status {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    margin-left: 16px;
}

.ws-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--status-gone);
    transition: background 0.3s, box-shadow 0.3s;
}

.ws-dot.connected {
    background: var(--status-active);
    box-shadow: 0 0 6px var(--status-active), 0 0 2px var(--status-active);
    animation: dot-glow-green 2.5s ease-in-out infinite;
}

.ws-dot.reconnecting {
    background: var(--status-idle);
    box-shadow: 0 0 6px var(--status-idle);
    animation: dot-glow-yellow 1.5s ease-in-out infinite;
}

.ws-dot.disconnected {
    background: var(--status-gone);
    box-shadow: 0 0 4px var(--status-gone);
}

.header-keys {
    font-size: 10px;
    color: var(--text-muted);
    display: flex;
    gap: 4px;
    align-items: center;
}

.kbd {
    display: inline-block;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    color: rgba(255, 255, 255, 0.4);
    line-height: 1.4;
}

/* ── 7. Panel Common ──────────────────────────────────────────────── */
.panel {
    background: var(--bg-primary);
    overflow-y: auto;
    padding: 14px;
    position: relative;
    z-index: 1;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 16, 24, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 2;
    margin: -14px -14px 12px -14px;
    padding: 14px 14px 8px 14px;
}

.panel-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

/* Panel title without bottom border (when using panel-header) */
.panel-header .panel-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.panel-count {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-dim);
    padding: 1px 8px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
}

/* ── Task Filters ── */
.task-filters {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-pill {
    font-size: 9px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 12px;
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s var(--ease-standard);
    letter-spacing: 0.3px;
    user-select: none;
}

.filter-pill:hover {
    border-color: var(--border-bright);
    color: var(--text-secondary);
}

.filter-pill.active {
    border-color: rgba(88, 166, 255, 0.4);
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-blue);
    animation: pop-in 0.2s var(--ease-spring);
}

/* ── Collapsible Tree Nodes ── */
.node-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    font-size: 9px;
    color: var(--text-muted);
    transition: transform 0.2s var(--ease-standard);
    flex-shrink: 0;
    cursor: pointer;
}

.node-toggle.collapsed {
    transform: rotate(-90deg);
}

.node-children.collapsed {
    display: none;
}

/* ── 8. Goals Panel (Left) ────────────────────────────────────────── */
.goals-panel {
    border-right: 1px solid var(--border);
    background: var(--bg-primary);
}

.vision-node {
    margin-bottom: 14px;
    animation: slide-up 0.3s var(--ease-smooth) backwards;
}

.vision-node:nth-child(1) { animation-delay: 0ms; }
.vision-node:nth-child(2) { animation-delay: 60ms; }
.vision-node:nth-child(3) { animation-delay: 120ms; }
.vision-node:nth-child(4) { animation-delay: 180ms; }
.vision-node:nth-child(5) { animation-delay: 240ms; }
.vision-node:nth-child(n+6) { animation-delay: 300ms; }

.vision-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-purple);
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-purple);
    cursor: pointer;
    transition: background 0.2s var(--ease-standard), box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.vision-title:hover {
    background: rgba(192, 132, 252, 0.08);
    box-shadow: 0 0 12px rgba(192, 132, 252, 0.06);
}

.vision-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.vision-node:hover .vision-actions { opacity: 1; }

.goal-node {
    margin-left: 8px;
    margin-top: 2px;
}

.goal-title {
    font-size: 11px;
    color: var(--accent-blue);
    padding: 4px 8px;
    border-radius: var(--radius-xs);
    border-left: 3px solid rgba(88, 166, 255, 0.3);
    cursor: pointer;
    transition: background 0.2s var(--ease-standard);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.goal-title:hover {
    background: rgba(88, 166, 255, 0.06);
}

.goal-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.goal-node:hover > .goal-title .goal-actions { opacity: 1; }

.milestone-node {
    margin-left: 14px;
    margin-top: 1px;
}

.milestone-title {
    font-size: 10px;
    color: var(--text-secondary);
    padding: 2px 8px;
    border-left: 3px solid rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.milestone-title:hover {
    background: rgba(148, 163, 184, 0.04);
}

.milestone-actions {
    margin-left: auto;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}
.milestone-node:hover .milestone-actions { opacity: 1; }

/* ── Task Items ── */
.task-item {
    margin-left: 22px;
    font-size: 10.5px;
    padding: 2px 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background 0.15s var(--ease-standard);
    position: relative;
    line-height: 1.4;
}

.task-item:hover {
    background: var(--bg-hover);
}

/* Task cycle flash animations */
.task-item.flash-complete { animation: task-flash-complete 0.5s ease-out; }
.task-item.flash-progress { animation: task-flash-progress 0.5s ease-out; }
.task-item.flash-pending  { animation: task-flash-pending 0.5s ease-out; }

.task-status {
    font-family: var(--font-mono);
    font-size: 10px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
    font-weight: 600;
    transition: color 0.2s, text-shadow 0.2s;
}

.task-status.completed {
    color: var(--accent-green);
    text-shadow: 0 0 6px rgba(74, 222, 128, 0.3);
}

.task-status.in_progress {
    color: var(--accent-yellow);
    text-shadow: 0 0 6px rgba(251, 191, 36, 0.3);
}

.task-status.pending {
    color: var(--text-muted);
}

.task-status.blocked {
    color: var(--accent-red);
    text-shadow: 0 0 6px rgba(248, 113, 113, 0.3);
}

.task-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    transition: color 0.2s;
}

.task-title.completed {
    color: var(--text-dim);
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

/* Add buttons */
.add-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-top: 12px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 11px;
    cursor: pointer;
    text-align: center;
    transition: all 0.25s var(--ease-standard);
}

.add-btn:hover {
    border-color: var(--accent-blue);
    color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.05);
    box-shadow: 0 0 16px rgba(88, 166, 255, 0.06);
    transform: translateY(-1px);
}

.add-btn:active {
    transform: scale(0.98);
}

/* Inline add buttons (shown on hover within tree) */
.add-inline {
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0 4px;
    border-radius: 3px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}

.add-inline:hover {
    color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.1);
}

/* ── 9. Center Panel ──────────────────────────────────────────────── */
.center-panel {
    display: flex;
    flex-direction: column;
    background: var(--bg-deep);
    position: relative;
    z-index: 1;
}

.center-panel::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(34, 211, 238, 0.3), transparent);
    animation: scan-line 12s linear infinite;
    opacity: 0.2;
    pointer-events: none;
}

.sessions-area {
    flex: 2;
    background: var(--bg-primary);
    padding: 14px;
    min-height: 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.output-area {
    flex: 3;
    background: var(--bg-primary);
    padding: 14px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#sessions-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* ── 10. Session Cards ────────────────────────────────────────────── */
.session-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: border-color 0.25s var(--ease-standard),
                box-shadow 0.25s var(--ease-standard),
                transform 0.2s var(--ease-spring);
    position: relative;
    cursor: pointer;
    /* No entrance animation — sessions re-render on 5s poll */
}

.session-card:hover {
    border-color: rgba(88, 166, 255, 0.3);
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-1px);
}

.session-card.selected {
    border-color: var(--accent-blue);
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.15);
}

.session-card.selected::before {
    background: var(--accent-blue);
    box-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
}

/* Status left bar */
.session-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 1px;
    background: var(--border);
    transition: background 0.3s, box-shadow 0.3s;
}

.session-card.status-active::before {
    background: var(--status-active);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.session-card.status-idle::before {
    background: var(--status-idle);
}

.session-card.status-gone::before {
    background: var(--status-gone);
    opacity: 0.5;
}

/* Gone sessions are more subdued */
.session-card.status-gone {
    opacity: 0.55;
    transition: opacity 0.3s, border-color 0.25s, box-shadow 0.25s, transform 0.2s;
}
.session-card.status-gone:hover {
    opacity: 0.85;
}

.session-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.session-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}

.session-dot.active {
    background: var(--status-active);
    box-shadow: 0 0 6px var(--status-active), 0 0 2px var(--status-active);
    animation: dot-glow-green 2.5s ease-in-out infinite;
}

.session-dot.idle {
    background: var(--status-idle);
    box-shadow: 0 0 4px var(--status-idle);
    animation: dot-glow-yellow 2s ease-in-out infinite;
}

.session-dot.gone {
    background: var(--status-gone);
    box-shadow: 0 0 3px rgba(248, 113, 113, 0.3);
    animation: dot-glow-red 3s ease-in-out infinite;
}

.session-project {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
}

.session-slug {
    font-size: 10px;
    font-family: var(--font-mono);
    color: var(--text-dim);
    padding: 1px 6px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
}

.session-age {
    margin-left: auto;
    font-size: 11px;
    font-family: var(--font-mono);
    transition: color 0.3s;
}

.session-age.age-fresh   { color: var(--accent-green); }
.session-age.age-warm    { color: var(--accent-yellow); }
.session-age.age-stale   { color: var(--accent-red); }
.session-age.age-ancient { color: var(--text-muted); }

/* session-meta replaced by session-statusline — kept for backward compat */
.session-meta {
    font-size: 10px;
    color: var(--text-dim);
    display: flex;
    gap: 10px;
    margin-top: 4px;
    padding-left: 16px;
}

.session-meta-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.session-meta-label {
    color: var(--text-muted);
}

.session-meta-value {
    color: var(--text-secondary);
}

/* ── Session Statusline (Phase 3) ── */
.session-statusline {
    padding-left: 16px;
    margin-top: 4px;
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.6;
}

.statusline-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.statusline-label {
    color: var(--text-muted);
    min-width: 52px;
    flex-shrink: 0;
}

.statusline-value {
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-bar {
    font-size: 8px;
    letter-spacing: -0.5px;
    color: var(--accent-green);
    opacity: 0.7;
    line-height: 1;
    flex-shrink: 0;
}

.session-card.status-idle .activity-bar {
    color: var(--accent-yellow);
    opacity: 0.5;
}

.session-card.status-gone .activity-bar {
    color: var(--text-muted);
    opacity: 0.3;
}

.tool-dist {
    font-size: 9px;
}

.session-duration {
    font-size: 10px;
    margin-left: 4px;
}

.session-actions {
    display: flex;
    gap: 6px;
    margin-top: 8px;
    padding-left: 16px;
}

/* ── 11. Small Buttons ────────────────────────────────────────────── */
.btn-sm {
    font-size: 10px;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: all 0.2s var(--ease-spring);
}

.btn-sm:hover {
    border-color: rgba(88, 166, 255, 0.4);
    color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.08);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(88, 166, 255, 0.1);
}

.btn-sm:active {
    transform: scale(0.96);
    box-shadow: none;
}

.btn-sm.btn-view {
    border-color: rgba(88, 166, 255, 0.2);
}
.btn-sm.btn-view:hover {
    border-color: rgba(88, 166, 255, 0.5);
    color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.1);
}

.btn-sm.btn-send-to {
    border-color: rgba(74, 222, 128, 0.2);
}
.btn-sm.btn-send-to:hover {
    border-color: rgba(74, 222, 128, 0.5);
    color: var(--accent-green);
    background: rgba(74, 222, 128, 0.1);
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.1);
}

/* ── 12. Output Viewer ────────────────────────────────────────────── */
.output-viewer {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.7;
    color: var(--text-secondary);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.output-line {
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    transition: background 0.15s;
    position: relative;
}

.output-line:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* Timestamp — show on hover */
.output-time {
    color: var(--text-muted);
    font-size: 10px;
    opacity: 0.5;
    transition: opacity 0.2s;
    margin-right: 8px;
}

.output-line:hover .output-time { opacity: 1; }

.output-line .tool-name {
    color: var(--accent-blue);
    font-weight: 600;
    padding: 1px 6px;
    background: rgba(88, 166, 255, 0.08);
    border-radius: 3px;
    font-size: 10px;
}

.output-line .assistant-text {
    color: var(--text-primary);
}

.output-line .user-prompt-text {
    color: var(--accent-yellow);
}

/* Output line type indicators */
.output-line.output-tool::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--tool-color, var(--accent-blue));
    border-radius: 1px;
    opacity: 0.4;
}

.output-line.output-assistant::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--accent-green);
    border-radius: 1px;
    opacity: 0.3;
}

.output-line.output-user::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--accent-yellow);
    border-radius: 1px;
    opacity: 0.4;
}

/* ── 13. Empty States ─────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 32px 20px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.6;
    animation: fade-in 0.4s var(--ease-smooth);
}

.empty-state-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.4;
    display: block;
}

.empty-state-icon svg {
    width: 28px;
    height: 28px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
}

/* Project color on session project name */
.session-project[data-project="cogecko"] { color: var(--project-cogecko); }
.session-project[data-project="trading-framework"] { color: var(--project-trading); }
.session-project[data-project="autonomous-cc-framework"] { color: var(--project-acc); }

/* Project-color accent bar override via CSS custom property */
.session-card[style*="--card-accent"]::before {
    background: var(--card-accent, var(--border));
}
.session-card.status-active[style*="--card-accent"]::before {
    background: var(--card-accent, var(--status-active));
    box-shadow: 0 0 6px var(--card-accent, var(--status-active));
}

.empty-state-hint {
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* ── 14. Prompt Panel (Right) ─────────────────────────────────────── */
.prompt-panel {
    border-left: 1px solid var(--border);
    background: var(--bg-primary);
}

.target-select {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 5l3 3 3-3' fill='none' stroke='%2364748b' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.target-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}
.target-select:focus:not(:focus-visible) {
    outline: none;
}

.target-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* Generate Button */
.btn-generate {
    width: 100%;
    padding: 10px;
    background: rgba(88, 166, 255, 0.12);
    color: var(--accent-blue);
    border: 1px solid rgba(88, 166, 255, 0.25);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all 0.25s var(--ease-spring);
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.btn-generate:hover:not(:disabled) {
    background: rgba(88, 166, 255, 0.18);
    border-color: rgba(88, 166, 255, 0.4);
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-1px);
}

.btn-generate:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: none;
}

.btn-generate:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-generate.loading {
    color: transparent;
}

.btn-generate.loading::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent,
        rgba(88, 166, 255, 0.15),
        transparent
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    z-index: 1;
}

.btn-generate.loading::after {
    content: 'Generating...';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
    font-size: 12px;
    font-weight: 600;
    z-index: 2;
}

/* ── 15. Suggestion Cards ─────────────────────────────────────────── */
.suggestion-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.25s var(--ease-standard);
    animation: pop-in 0.3s var(--ease-spring) backwards;
    position: relative;
}

.suggestion-card:nth-child(1) { animation-delay: 0ms; }
.suggestion-card:nth-child(2) { animation-delay: 80ms; }
.suggestion-card:nth-child(3) { animation-delay: 160ms; }

.suggestion-card:hover {
    border-color: rgba(74, 222, 128, 0.3);
    background: rgba(74, 222, 128, 0.04);
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.06);
    transform: translateY(-1px);
}

.suggestion-card.selected {
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(74, 222, 128, 0.08);
    box-shadow: 0 0 16px rgba(74, 222, 128, 0.1);
}

/* Selected indicator bar */
.suggestion-card.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 2px;
    border-radius: 1px;
    background: var(--accent-green);
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.suggestion-prompt {
    font-size: 12px;
    color: var(--text-primary);
    line-height: 1.5;
    margin-bottom: 4px;
}

.suggestion-reason {
    font-size: 10px;
    color: var(--text-dim);
    line-height: 1.4;
}

.suggestion-index {
    font-size: 9px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--accent-green);
    padding: 0 4px;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 3px;
    margin-right: 6px;
    flex-shrink: 0;
}

/* ── 16. Textarea & Send ──────────────────────────────────────────── */
.prompt-textarea {
    width: 100%;
    min-height: 90px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 11px;
    resize: vertical;
    margin-top: 10px;
    line-height: 1.6;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.prompt-textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.08);
}
.prompt-textarea:focus:not(:focus-visible) {
    outline: none;
}

.prompt-textarea::placeholder {
    color: var(--text-muted);
    font-size: 11px;
}

/* Send Button */
.btn-send {
    width: 100%;
    padding: 10px;
    background: rgba(74, 222, 128, 0.12);
    color: var(--accent-green);
    border: 1px solid rgba(74, 222, 128, 0.25);
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    letter-spacing: 0.3px;
    transition: all 0.25s var(--ease-spring);
    position: relative;
}

.btn-send:hover:not(:disabled) {
    background: rgba(74, 222, 128, 0.18);
    border-color: rgba(74, 222, 128, 0.5);
    box-shadow: var(--shadow-glow-green);
    transform: translateY(-1px);
}

.btn-send:active:not(:disabled) {
    transform: scale(0.97);
    box-shadow: none;
}

.btn-send:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-send.launched {
    border-color: var(--accent-green);
    background: rgba(74, 222, 128, 0.2);
}

.prompt-hint {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 6px;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.prompt-hint .kbd {
    vertical-align: middle;
}

/* ── 17. History Section ──────────────────────────────────────────── */
.history-section {
    margin-top: 18px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.history-section .panel-header {
    position: static;
    margin: 0 0 8px 0;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    color: var(--text-dim);
    padding: 6px 8px;
    border-radius: var(--radius-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.history-item:hover {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.history-time {
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-right: 8px;
    font-size: 9px;
}

.history-source {
    font-size: 9px;
    padding: 0 4px;
    border-radius: 3px;
    margin-right: 4px;
}

.history-source.source-ai {
    background: rgba(192, 132, 252, 0.1);
    color: var(--accent-purple);
}

.history-source.source-ui {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-blue);
}

.history-source.source-manual {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-dim);
}

/* ── 18. Inline Forms ─────────────────────────────────────────────── */
.inline-form {
    background: rgba(17, 24, 32, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 10px;
    margin-top: 8px;
    animation: pop-in 0.2s var(--ease-spring);
    box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.1), 0 4px 16px rgba(0, 0, 0, 0.3);
}

.inline-form input,
.inline-form select {
    width: 100%;
    padding: 7px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 12px;
    margin-bottom: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.inline-form input:focus,
.inline-form select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.08);
}
.inline-form input:focus:not(:focus-visible),
.inline-form select:focus:not(:focus-visible) {
    outline: none;
}

.inline-form input::placeholder {
    color: var(--text-muted);
}

.inline-form .btn-row {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 4px;
}

.btn-sm.btn-cancel {
    border-color: rgba(248, 113, 113, 0.2);
    color: var(--text-dim);
}
.btn-sm.btn-cancel:hover {
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--accent-red);
    background: rgba(248, 113, 113, 0.06);
}

.btn-sm.btn-create {
    border-color: rgba(74, 222, 128, 0.3);
    color: var(--accent-green);
}
.btn-sm.btn-create:hover {
    border-color: rgba(74, 222, 128, 0.5);
    background: rgba(74, 222, 128, 0.1);
    box-shadow: 0 2px 8px rgba(74, 222, 128, 0.1);
}

/* ── 19. Toast Notifications ──────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: rgba(17, 24, 32, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 10px 16px;
    font-size: 12px;
    color: var(--text-primary);
    max-width: 340px;
    box-shadow: var(--shadow-elevated);
    animation: toast-in 0.3s var(--ease-smooth);
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.toast.toast-out { animation: toast-out 0.3s var(--ease-standard) forwards; }

/* Left accent bar */
.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.toast.toast-success::before { background: var(--accent-green); box-shadow: 0 0 8px rgba(74, 222, 128, 0.4); }
.toast.toast-error::before   { background: var(--accent-red); box-shadow: 0 0 8px rgba(248, 113, 113, 0.4); }
.toast.toast-info::before    { background: var(--accent-blue); box-shadow: 0 0 8px rgba(88, 166, 255, 0.4); }
.toast.toast-warning::before { background: var(--accent-yellow); box-shadow: 0 0 8px rgba(251, 191, 36, 0.4); }

.toast-icon {
    font-size: 14px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    line-height: 1.4;
}

/* ── 20. Loading States ───────────────────────────────────────────── */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.loading-dots::after {
    content: '';
    animation: loading-dots-anim 1.4s infinite;
}

@keyframes loading-dots-anim {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
    100% { content: ''; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-card) 25%,
        var(--bg-elevated) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

/* ── 21. Status Badges ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
}

.badge-active  { background: rgba(74, 222, 128, 0.12); color: var(--accent-green); border: 1px solid rgba(74, 222, 128, 0.25); }
.badge-idle    { background: rgba(251, 191, 36, 0.1);  color: var(--accent-yellow); border: 1px solid rgba(251, 191, 36, 0.2); }
.badge-gone    { background: rgba(248, 113, 113, 0.1); color: var(--accent-red); border: 1px solid rgba(248, 113, 113, 0.2); }
.badge-pending { background: rgba(148, 163, 184, 0.08); color: var(--text-dim); border: 1px solid rgba(148, 163, 184, 0.15); }
.badge-blue    { background: rgba(88, 166, 255, 0.1);  color: var(--accent-blue); border: 1px solid rgba(88, 166, 255, 0.2); }
.badge-purple  { background: rgba(192, 132, 252, 0.1); color: var(--accent-purple); border: 1px solid rgba(192, 132, 252, 0.2); }

/* ── 22. Keyboard Shortcuts Overlay ───────────────────────────────── */
.shortcuts-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 20, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.2s ease;
}

.shortcuts-overlay.visible { display: flex; }

.shortcuts-panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-width: 340px;
    box-shadow: var(--shadow-elevated);
    animation: pop-in 0.2s var(--ease-spring);
}

.shortcuts-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-align: center;
}

.shortcut-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 12px;
}

.shortcut-action { color: var(--text-secondary); }
.shortcut-keys { display: flex; gap: 4px; }

/* ── 23. Responsive ───────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .app {
        grid-template-columns: 230px 1fr 270px;
    }
}

@media (max-width: 900px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 48px auto auto auto;
    }
    .goals-panel, .prompt-panel {
        border: none;
        max-height: 40vh;
        border-bottom: 1px solid var(--border);
    }
    .center-panel {
        min-height: 40vh;
    }
    .header-keys, .header-version, .header-stats {
        display: none;
    }
}

/* ── 24. Utility Classes ──────────────────────────────────────────── */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.truncate {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mono { font-family: var(--font-mono); }
.dim  { color: var(--text-dim); }
.muted { color: var(--text-muted); }

/* ── 25. Focus-Visible (Keyboard Navigation) ────────────────────── */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

.task-item:focus-visible {
    outline-offset: -1px;
    background: var(--bg-hover);
}

.btn-sm:focus-visible,
.btn-generate:focus-visible,
.btn-send:focus-visible,
.add-btn:focus-visible {
    outline-offset: 1px;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.filter-pill:focus-visible {
    outline-offset: 0px;
}

.suggestion-card:focus-visible {
    outline-offset: -1px;
    border-color: rgba(88, 166, 255, 0.5);
}

/* ── 26. Progress Bars ───────────────────────────────────────────── */
.progress-bar-track {
    height: 3px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
    margin-bottom: 2px;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s var(--ease-smooth);
    min-width: 0;
}

.progress-bar-fill.progress-green {
    background: linear-gradient(90deg, var(--accent-green), rgba(74, 222, 128, 0.7));
    box-shadow: 0 0 6px rgba(74, 222, 128, 0.25);
}

.progress-bar-fill.progress-yellow {
    background: linear-gradient(90deg, var(--accent-yellow), rgba(251, 191, 36, 0.7));
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.2);
}

.progress-bar-fill.progress-blue {
    background: linear-gradient(90deg, var(--accent-blue), rgba(88, 166, 255, 0.7));
}

.progress-text {
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-left: auto;
    flex-shrink: 0;
    padding-left: 6px;
}

/* ── 27. Task Search ─────────────────────────────────────────────── */
.task-search {
    width: 100%;
    padding: 5px 10px 5px 28px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 11px;
    margin-bottom: 8px;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

.task-search:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.08);
}
.task-search:focus:not(:focus-visible) {
    outline: none;
}

.task-search::placeholder {
    color: var(--text-muted);
    font-size: 10px;
}

.task-search-wrap {
    position: relative;
}

.task-search-icon {
    position: absolute;
    left: 9px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ── 28. Filter pill count badge ─────────────────────────────────── */
.filter-count {
    font-size: 8px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-left: 2px;
    opacity: 0.7;
}

.filter-pill.active .filter-count {
    color: var(--accent-blue);
    opacity: 1;
}

/* ── 29. Confirm Dialog ──────────────────────────────────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 12, 20, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fade-in 0.15s ease;
}

.confirm-dialog {
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-lg);
    padding: 24px;
    min-width: 300px;
    max-width: 440px;
    box-shadow: var(--shadow-elevated);
    animation: pop-in 0.2s var(--ease-spring);
}

.confirm-message {
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.confirm-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-sm.btn-danger {
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--accent-red);
    background: rgba(248, 113, 113, 0.08);
}
.btn-sm.btn-danger:hover {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.15);
    box-shadow: 0 2px 8px rgba(248, 113, 113, 0.15);
}

/* ── 30. Context Menu ───────────────────────────────────────────── */
.context-menu {
    position: fixed;
    z-index: 3000;
    background: var(--bg-surface);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 4px 0;
    min-width: 160px;
    box-shadow: var(--shadow-elevated);
    animation: pop-in 0.12s var(--ease-spring);
}

.context-item {
    padding: 7px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.1s, color 0.1s;
}

.context-item:hover {
    background: rgba(88, 166, 255, 0.08);
    color: var(--text-primary);
}

.context-item.context-danger {
    color: var(--accent-red);
}
.context-item.context-danger:hover {
    background: rgba(248, 113, 113, 0.1);
}

.context-separator {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── 31. Inline Edit ────────────────────────────────────────────── */
.inline-edit-form {
    margin: 2px 0;
}

.inline-edit-input {
    width: 100%;
    padding: 4px 8px;
    background: var(--bg-card);
    border: 1px solid var(--accent-blue);
    border-radius: var(--radius-xs);
    color: var(--text-primary);
    font-size: 12px;
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.1);
}

.inline-edit-input:focus:not(:focus-visible) {
    outline: none;
}

/* ── 32. Node Edit/Delete Buttons ───────────────────────────────── */
.node-edit, .node-delete {
    font-size: 10px;
    cursor: pointer;
    padding: 0 3px;
    border-radius: 3px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
    opacity: 0;
}

.vision-node:hover .node-edit,
.vision-node:hover .node-delete,
.goal-node:hover > .goal-title .node-edit,
.goal-node:hover > .goal-title .node-delete,
.milestone-node:hover .node-edit,
.milestone-node:hover .node-delete {
    opacity: 1;
}

.node-edit {
    color: var(--text-muted);
}
.node-edit:hover {
    color: var(--accent-blue);
    background: rgba(88, 166, 255, 0.1);
}

.node-delete {
    color: var(--text-muted);
}
.node-delete:hover {
    color: var(--accent-red);
    background: rgba(248, 113, 113, 0.1);
}

/* ── 33. Output Actions ─────────────────────────────────────────── */
.output-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-bottom: 8px;
    position: sticky;
    top: 0;
    z-index: 1;
    padding: 4px 0;
    background: var(--bg-primary);
}

.btn-output-action {
    font-size: 9px;
    padding: 3px 10px;
}

.output-follow-active {
    border-color: rgba(74, 222, 128, 0.4) !important;
    color: var(--accent-green) !important;
    background: rgba(74, 222, 128, 0.08) !important;
}

/* Tool-color accent bar — consolidated into section 12 above */

/* ── 34. Collapse Button ─────────────────────────────────────────── */
.btn-collapse {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 2px;
    border-radius: 3px;
    transition: color 0.2s, transform 0.3s var(--ease-spring);
    display: flex;
    align-items: center;
}
.btn-collapse:hover {
    color: var(--text-secondary);
}
.btn-collapse.rotated {
    transform: rotate(-90deg);
}

.sessions-area.collapsed {
    flex: 0 0 42px !important;
    overflow: hidden;
}
.sessions-area.collapsed #sessions-list {
    display: none;
}

/* ── 35. Last Update Indicator ──────────────────────────────────── */
.last-update {
    font-size: 9px;
    margin-left: 4px;
}

/* ── 36. History Project Badge ──────────────────────────────────── */
.history-project-badge {
    font-size: 8px;
    font-weight: 600;
    font-family: var(--font-mono);
    margin-right: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.history-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-reuse {
    opacity: 0;
    transition: opacity 0.15s;
    color: var(--accent-blue);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 12px;
}

.history-item:hover .history-reuse {
    opacity: 1;
}

/* ── 37. Prompt Character Counter ───────────────────────────────── */
.prompt-char-count {
    display: block;
    text-align: right;
    font-size: 9px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    margin-top: 2px;
    transition: color 0.2s;
}

.prompt-char-count.char-warning {
    color: var(--accent-red);
    font-weight: 600;
}

/* ── 38. Connection Lost Banner ───────────────────────────────────── */
.connection-lost-banner {
    position: fixed;
    top: 48px;  /* below the header */
    left: 0;
    right: 0;
    background: rgba(248, 113, 113, 0.12);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(248, 113, 113, 0.3);
    color: var(--accent-red);
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    padding: 4px 12px;
    z-index: 100;
    animation: fade-in 0.3s ease;
}

/* ── 39. Empty parent hiding ─────────────────────────────────────── */
.vision-node.filter-empty,
.goal-node.filter-empty,
.milestone-node.filter-empty {
    display: none;
}

/* ── 40. Hierarchy Content — Descriptions, Badges, Annotations ── */

/* Vision/Goal/Milestone description text */
.vision-desc,
.goal-desc,
.milestone-desc {
    font-size: 10px;
    color: var(--text-dim);
    font-style: italic;
    padding: 1px 8px 2px 14px;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.goal-desc {
    padding-left: 22px;
}

.milestone-desc {
    padding-left: 28px;
    font-size: 9px;
}

/* Auto-created source badge (md) */
.badge-md {
    display: inline-block;
    font-size: 7px;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: rgba(100, 116, 139, 0.12);
    border: 1px solid rgba(100, 116, 139, 0.2);
    border-radius: 3px;
    padding: 0 3px;
    margin-left: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Milestone due date badge */
.milestone-due {
    font-size: 8px;
    font-family: var(--font-mono);
    color: var(--text-dim);
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.15);
    border-radius: 3px;
    padding: 0 4px;
    margin-left: 4px;
}

.milestone-due.overdue {
    color: var(--accent-red);
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.25);
}

/* Task annotation container (right-aligned) */
.task-annotation {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.task-item:hover .task-annotation {
    opacity: 1;
}

/* Task date badge (MM-DD) */
.task-date {
    font-size: 8px;
    font-family: var(--font-mono);
    color: var(--text-dim);
    white-space: nowrap;
}

/* Task commit hash badge */
.task-hash {
    font-size: 8px;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
    background: rgba(34, 211, 238, 0.08);
    border-radius: 3px;
    padding: 0 3px;
    white-space: nowrap;
}

/* Task detail text (truncated, shown on hover via title) */
.task-detail {
    font-size: 8px;
    color: var(--text-muted);
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ensure task-title takes remaining space */
.task-title {
    flex: 1;
    min-width: 0;
}

/* ── 41. Reduced Motion (Accessibility) ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
