/* ═══════════════════════════════════════════════════════════════════════════
    NEXUS AI ASSISTANT - Flat Neon + Glassmorphic Theme
    Sharp edges, neon glows, glass layers, depth parallax
    ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* Deep dark backgrounds with blue tint */
    --hive-bg-void: #030508;
    --hive-bg-deep: #080c14;
    --hive-bg-surface: #0d1420;
    --hive-bg-elevated: #141d2d;
    --hive-bg-hover: #1a2538;

    /* Glassmorphic overlays */
    --glass-bg: rgba(20, 29, 45, 0.7);
    --glass-bg-solid: rgba(13, 20, 32, 0.95);
    --glass-bg-frost: rgba(20, 29, 45, 0.5);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-bright: rgba(255, 255, 255, 0.14);
    --glass-blur: 24px;

    /* Accent colors - cyan/teal primary */
    --hive-accent: #00e5cc;
    --hive-accent-bright: #00ffdf;
    --hive-accent-glow: rgba(0, 229, 204, 0.4);
    --hive-accent-dim: rgba(0, 229, 204, 0.15);
    --hive-accent-subtle: rgba(0, 229, 204, 0.08);

    /* Secondary accent - purple */
    --hive-secondary: #8b5cf6;
    --hive-secondary-dim: rgba(139, 92, 246, 0.15);

    /* Persona colors */
    --persona-orchestrator: #fbbf24;
    --persona-coder: #22d3ee;
    --persona-critic: #f472b6;
    --persona-planner: #a78bfa;
    --persona-debugger: #ef4444;
    --persona-researcher: #34d399;

    /* Event type colors */
    --event-thought: #818cf8;
    --event-action: #fbbf24;
    --event-observation: #34d399;
    --event-reflection: #60a5fa;
    --event-escalation: #ef4444;
    --event-memory: #f472b6;
    --event-persona: #00e5cc;

    /* Status colors */
    --status-success: #22c55e;
    --status-warning: #f59e0b;
    --status-error: #ef4444;
    --status-info: #3b82f6;

    /* Text colors */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-tertiary: #64748b;
    --text-muted: #475569;

    /* Spacing */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;

    /* Border radius - SHARP */
    --radius-sm: 2px;
    --radius-md: 2px;
    --radius-lg: 3px;
    --radius-xl: 4px;
    --radius-full: 2px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    /* Transitions */
    --transition-fast: 0.1s ease;
    --transition-normal: 0.2s ease;
    --transition-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Layout */
    --header-height: 56px;
    --input-height: 72px;
    --sidebar-width: 260px;
    --preview-width: 400px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Depth layers (parallax shadows with neon tint) */
    --depth-1: 0 1px 2px rgba(0,0,0,0.5), 0 0 1px rgba(0,229,204,0.08);
    --depth-2: 0 2px 8px rgba(0,0,0,0.6), 0 0 1px rgba(0,229,204,0.12);
    --depth-3: 0 4px 20px rgba(0,0,0,0.7), 0 0 2px rgba(0,229,204,0.1);
    --neon-glow: 0 0 8px var(--hive-accent-glow), 0 0 2px var(--hive-accent);
    --neon-glow-soft: 0 0 12px rgba(0,229,204,0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════
    SVG ICON SYSTEM
    ═══════════════════════════════════════════════════════════════════════════ */

.icon {
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: square;
    stroke-linejoin: miter;
    vertical-align: -0.125em;
    flex-shrink: 0;
    display: inline-block;
}

.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 24px; height: 24px; }
.icon-xl { width: 48px; height: 48px; }

/* ═══════════════════════════════════════════════════════════════════════════
    RESET
    ═══════════════════════════════════════════════════════════════════════════ */

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--hive-bg-void);
    -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════════
    BACKGROUND EFFECTS - Parallax depth grid
    ═══════════════════════════════════════════════════════════════════════════ */

.bg-effects {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
    perspective: 800px;
}

.bg-grid {
    position: absolute;
    inset: -20%;
    background-image:
        linear-gradient(rgba(0, 229, 204, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 204, 0.04) 1px, transparent 1px);
    background-size: 60px 60px;
    mask-image: radial-gradient(ellipse 80% 50% at 50% 0%, black 0%, transparent 70%);
    opacity: 0.6;
    transform: rotateX(2deg) translateZ(-20px);
    transform-origin: center top;
}

.bg-glow {
    position: absolute;
    filter: blur(120px);
    opacity: 0.15;
    animation: glowPulse 8s ease-in-out infinite;
}

.bg-glow-1 {
    width: 600px;
    height: 600px;
    top: -200px;
    left: -100px;
    background: var(--hive-accent);
}

.bg-glow-2 {
    width: 400px;
    height: 400px;
    bottom: -100px;
    right: -50px;
    background: var(--hive-secondary);
    animation-delay: -4s;
}

.bg-glow-3 {
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--persona-coder);
    opacity: 0.08;
    animation-delay: -2s;
}

@keyframes glowPulse {
    0%,
    100% {
        opacity: 0.12;
        transform: scale(1);
    }
    50% {
        opacity: 0.2;
        transform: scale(1.1);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
    APP LAYOUT
    ═══════════════════════════════════════════════════════════════════════════ */

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
    HEADER - Solid surface with neon accent line
    ═══════════════════════════════════════════════════════════════════════════ */

.header {
    height: var(--header-height);
    background: var(--hive-bg-surface);
    border-bottom: 1px solid var(--hive-accent-dim);
    display: flex;
    align-items: center;
    padding: 0 var(--space-4);
    gap: var(--space-4);
    flex-shrink: 0;
    z-index: 100;
    box-shadow: var(--depth-2);
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.logo-mark {
    width: 36px;
    height: 36px;
    background: var(--hive-accent);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: var(--hive-bg-void);
    box-shadow: var(--neon-glow);
}

.logo-mark .icon {
    stroke: var(--hive-bg-void);
    width: 20px;
    height: 20px;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--hive-accent);
    text-shadow: var(--neon-glow-soft);
}

.header-status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 12px;
    color: var(--text-secondary);
}

.header-metrics {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.header-metrics .metric-label {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 10px;
    color: var(--text-tertiary);
}

.header-metrics .metric-status.ok { color: var(--status-success); }
.header-metrics .metric-status.error { color: var(--status-error); }
.header-metrics .metric-status.pending { color: var(--status-warning); }

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all var(--transition-normal);
}

.status-dot.active {
    background: var(--hive-accent);
    box-shadow: 0 0 10px var(--hive-accent-glow);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.header-spacer { flex: 1; }

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ═══════════════════════════════════════════════════════════════════════════
    BUTTONS - Sharp, flat, neon hover
    ═══════════════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: 36px;
    padding: 0 var(--space-4);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:hover {
    background: var(--hive-bg-hover);
    border-color: var(--glass-border-bright);
    box-shadow: var(--depth-1);
}

.btn.primary {
    background: var(--hive-accent);
    border: none;
    color: var(--hive-bg-void);
    font-weight: 600;
    box-shadow: var(--neon-glow);
}

.btn.primary:hover {
    box-shadow: 0 0 16px var(--hive-accent-glow), 0 0 4px var(--hive-accent);
}

.btn.ghost {
    background: transparent;
    border-color: transparent;
}

.btn.ghost:hover {
    background: var(--hive-accent-subtle);
    color: var(--hive-accent);
}

.btn.sm {
    height: 28px;
    padding: 0 var(--space-3);
    font-size: 12px;
}

.btn.icon-only {
    width: 36px;
    padding: 0;
}

.btn.icon-only.sm {
    width: 28px;
}

/* ═══════════════════════════════════════════════════════════════════════════
    MAIN LAYOUT
    ═══════════════════════════════════════════════════════════════════════════ */

.main {
    flex: 1;
    display: flex;
    overflow: hidden;
    min-height: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
    FILE BROWSER SIDEBAR - Depth layer
    ═══════════════════════════════════════════════════════════════════════════ */

.sidebar {
    width: var(--sidebar-width);
    background: var(--glass-bg-solid);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: all var(--transition-slow);
    box-shadow: var(--depth-2);
    z-index: 10;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);
}

.file-tree {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    border-left: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 13px;
    color: var(--text-secondary);
}

.file-item:hover {
    background: var(--hive-accent-subtle);
    border-left-color: var(--hive-accent);
    color: var(--text-primary);
}

.file-item.selected {
    background: var(--hive-accent-dim);
    border-left-color: var(--hive-accent);
    color: var(--hive-accent);
}

.file-item.folder {
    font-weight: 500;
}

.file-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-icon .icon {
    width: 16px;
    height: 16px;
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item-nested {
    padding-left: calc(var(--space-3) + 20px);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    text-align: center;
    color: var(--text-tertiary);
}

.empty-state-icon {
    margin-bottom: var(--space-4);
    opacity: 0.4;
    color: var(--hive-accent);
}

.empty-state-icon .icon {
    width: 48px;
    height: 48px;
}

.empty-state-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: 13px;
    margin-bottom: var(--space-4);
}

/* ═══════════════════════════════════════════════════════════════════════════
    TRACE PANEL (CENTER) - Glass surface
    ═══════════════════════════════════════════════════════════════════════════ */

.hive-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

.hive-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    background: var(--glass-bg-frost);
    backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    border-bottom: 1px solid var(--glass-border);
}

.hive-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 14px;
    font-weight: 600;
}

.hive-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all var(--transition-normal);
}

.hive-indicator.active {
    background: var(--hive-accent);
    box-shadow: 0 0 12px var(--hive-accent-glow);
    animation: hivePulse 1.5s ease-in-out infinite;
}

@keyframes hivePulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 12px var(--hive-accent-glow);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 20px var(--hive-accent-glow);
    }
}

.hive-stats {
    display: flex;
    gap: var(--space-4);
    margin-left: auto;
}

.hive-stat {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 12px;
    color: var(--text-tertiary);
}

.hive-stat-value {
    font-weight: 600;
    color: var(--hive-accent);
    font-family: var(--font-mono);
    text-shadow: var(--neon-glow-soft);
}

.hive-content {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.hive-stream {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-right: 1px solid var(--glass-border);
}

.hive-stream-scroll {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.hive-stream-scroll::-webkit-scrollbar { width: 6px; }
.hive-stream-scroll::-webkit-scrollbar-track { background: transparent; }
.hive-stream-scroll::-webkit-scrollbar-thumb {
    background: var(--hive-accent-dim);
    border-radius: var(--radius-sm);
}

/* Trace Entries - Sharp cards with neon left border */
.trace-entry {
    background: var(--glass-bg-frost);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    border-left: 3px solid var(--glass-border);
    box-shadow: var(--depth-1);
    animation: traceSlideIn 0.2s ease-out;
}

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

.trace-entry.thought { border-left-color: var(--event-thought); }
.trace-entry.action { border-left-color: var(--event-action); }
.trace-entry.observation { border-left-color: var(--event-observation); }
.trace-entry.reflection { border-left-color: var(--event-reflection); }
.trace-entry.escalation {
    border-left-color: var(--event-escalation);
    background: rgba(239, 68, 68, 0.06);
}
.trace-entry.memory { border-left-color: var(--event-memory); }
.trace-entry.persona { border-left-color: var(--event-persona); }

.trace-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.trace-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.trace-type .icon {
    width: 12px;
    height: 12px;
}

.trace-entry.thought .trace-type { background: rgba(129, 140, 248, 0.15); color: var(--event-thought); }
.trace-entry.action .trace-type { background: rgba(251, 191, 36, 0.15); color: var(--event-action); }
.trace-entry.observation .trace-type { background: rgba(52, 211, 153, 0.15); color: var(--event-observation); }
.trace-entry.reflection .trace-type { background: rgba(96, 165, 250, 0.15); color: var(--event-reflection); }
.trace-entry.escalation .trace-type { background: rgba(239, 68, 68, 0.15); color: var(--event-escalation); }
.trace-entry.memory .trace-type { background: rgba(244, 114, 182, 0.15); color: var(--event-memory); }
.trace-entry.persona .trace-type { background: var(--hive-accent-dim); color: var(--hive-accent); }

.trace-persona {
    font-size: 11px;
    color: var(--text-tertiary);
    background: var(--hive-bg-surface);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.trace-step {
    font-size: 11px;
    color: var(--text-muted);
    margin-left: auto;
    font-family: var(--font-mono);
}

.trace-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 100px;
    overflow: hidden;
    cursor: pointer;
    transition: max-height var(--transition-slow);
}

.trace-content.expanded { max-height: none; }

.trace-content pre {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--hive-bg-deep);
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
    overflow-x: auto;
    margin-top: var(--space-2);
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.media-item {
    background: rgba(15, 23, 42, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 8px;
}

.media-item img,
.media-item video {
    width: 100%;
    height: auto;
    border-radius: var(--radius-sm);
    display: block;
}

.media-caption {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* JSON Syntax Highlighting */
.json-string { color: #a5d6a7; }
.json-number { color: #ffcc80; }
.json-bool { color: #ce93d8; }
.json-null { color: #90a4ae; font-style: italic; }
.json-key { color: #81d4fa; }
.json-bracket { color: #78909c; }
.json-collapsed { color: var(--text-muted); font-style: italic; font-size: 11px; }
.json-more { color: var(--text-muted); font-style: italic; font-size: 11px; }
.json-success { color: var(--status-success); font-weight: 600; }
.json-error { color: var(--status-error); font-weight: 600; }

.json-clickable {
    cursor: pointer;
    border-bottom: 1px dashed var(--text-muted);
    transition: all var(--transition-fast);
}

.json-clickable:hover {
    color: var(--hive-accent);
    border-bottom-color: var(--hive-accent);
}

/* Active Tasks Section */
.active-tasks-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.active-task-card {
    background: var(--hive-bg-elevated);
    border: 1px solid var(--hive-accent-dim);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    border-left: 3px solid var(--hive-accent);
    animation: taskPulse 2s ease-in-out infinite;
}

@keyframes taskPulse {
    0%, 100% { border-left-color: var(--hive-accent); }
    50% { border-left-color: var(--hive-secondary); }
}

.active-task-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.active-task-icon {
    color: var(--hive-accent);
    animation: spin 2s linear infinite;
    display: flex;
    align-items: center;
}

.active-task-icon .icon {
    width: 16px;
    height: 16px;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.active-task-title {
    flex: 1;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.active-task-stop {
    width: 20px;
    height: 20px;
    display: grid;
    place-items: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.active-task-stop:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--status-error);
}

.active-task-stop .icon {
    width: 12px;
    height: 12px;
}

.active-task-goal {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.no-active-tasks {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-4);
}

.json-object,
.json-array {
    display: inline;
    font-family: var(--font-mono);
    font-size: 12px;
}

.trace-content .json-object {
    display: block;
    padding-left: var(--space-3);
    border-left: 2px solid var(--glass-border);
    margin: var(--space-1) 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
    SIDEBAR (PERSONAS & STATS) - Glass panels
    ═══════════════════════════════════════════════════════════════════════════ */

.hive-sidebar {
    width: 280px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    flex-shrink: 0;
}

.hive-section {
    border-bottom: 1px solid var(--glass-border);
}

.hive-section-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: var(--hive-bg-surface);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hive-section-header .icon {
    width: 14px;
    height: 14px;
    opacity: 0.7;
}

.hive-section-content {
    padding: var(--space-3);
}

.section-tabs {
    margin-left: auto;
    display: flex;
    gap: 6px;
}

.tab-btn {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-tertiary);
    font-size: 9px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn.active {
    background: var(--hive-accent-dim);
    color: var(--hive-accent);
    border-color: var(--hive-accent-dim);
}

.skills-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.skill-card {
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.skill-draft-card {
    background: var(--hive-accent-subtle);
    border: 1px solid var(--hive-accent-dim);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skill-draft-actions {
    display: flex;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.skill-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    background: var(--hive-accent-dim);
    color: var(--hive-accent);
    border: 1px solid var(--hive-accent-subtle);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.skill-title { font-size: 12px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.skill-desc { font-size: 11px; color: var(--text-tertiary); margin-bottom: 6px; }
.skill-meta { font-size: 10px; color: var(--text-muted); }

.status-card {
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    font-size: 11px;
    color: var(--text-tertiary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--hive-accent-dim);
    color: var(--hive-accent);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.mobile-status-card {
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    flex-direction: column;
    gap: 8px;
    display: none;
}

.mobile-persona {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.mobile-persona span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Persona Cards - Sharp with neon active state */
.personas-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.persona-card {
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    transition: all var(--transition-fast);
}

.persona-card.active {
    border-color: var(--hive-accent);
    box-shadow: 0 0 1px var(--hive-accent), var(--neon-glow-soft);
}

.persona-header {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.persona-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--hive-accent);
}

.persona-icon .icon {
    width: 18px;
    height: 18px;
}

.persona-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.persona-status {
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.persona-goal {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: var(--space-2);
}

.persona-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: var(--space-2);
}

.persona-skill {
    font-size: 9px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    background: var(--hive-accent-dim);
    color: var(--hive-accent);
    border: 1px solid var(--hive-accent-subtle);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.persona-progress {
    height: 3px;
    background: var(--hive-bg-surface);
    border-radius: 1px;
    overflow: hidden;
}

.persona-progress-bar {
    height: 100%;
    background: var(--hive-accent);
    transition: width var(--transition-normal);
}

.persona-progress.indeterminate .persona-progress-bar {
    width: 100%;
    background: var(--hive-accent);
    animation: indeterminate 1.6s ease-in-out infinite;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.trace-empty {
    color: var(--text-muted);
    font-style: italic;
}

.active-task-status-line {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
}

.active-task-meta {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

.active-task-meta .meta-item { display: block; }
.active-task-still { color: var(--hive-accent); font-weight: 600; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
}

.stat-card {
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    text-align: center;
}

.stat-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: var(--space-1);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--hive-accent);
    font-family: var(--font-mono);
    text-shadow: 0 0 8px var(--hive-accent-glow);
}

/* Insights */
.insights-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.insight-card {
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
}

.insight-pattern {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.insight-sequence {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-tertiary);
    margin-bottom: var(--space-2);
}

.insight-meta {
    display: flex;
    gap: var(--space-3);
    font-size: 10px;
    color: var(--text-muted);
}

.insight-rate {
    color: var(--status-success);
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════
    PREVIEW PANEL - Deep depth layer
    ═══════════════════════════════════════════════════════════════════════════ */

.preview-panel {
    width: 0;
    background: var(--glass-bg-solid);
    backdrop-filter: blur(var(--glass-blur));
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width var(--transition-slow);
    overflow: hidden;
    box-shadow: var(--depth-3);
}

.preview-panel.open {
    width: var(--preview-width);
}

body.preview-maximized .sidebar,
body.preview-maximized .hive-panel {
    display: none;
}

body.preview-maximized .preview-panel {
    position: fixed;
    inset: var(--header-height) 0 calc(var(--input-height) + var(--safe-bottom)) 0;
    width: 100% !important;
    z-index: 200;
    border-left: none;
}

.preview-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--glass-border);
    background: var(--hive-bg-surface);
}

.preview-title {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-content {
    flex: 1;
    overflow: auto;
}

.preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.preview-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100%;
    padding: var(--space-4);
    background: white;
}

.preview-media img,
.preview-media object {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.preview-code {
    padding: var(--space-4);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Markdown Preview */
.preview-markdown {
    padding: var(--space-4);
    color: var(--text-primary);
    line-height: 1.7;
    overflow-y: auto;
}

.preview-markdown h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 var(--space-4);
    padding-bottom: var(--space-2);
    border-bottom: 1px solid var(--hive-accent-dim);
    color: var(--hive-accent);
}

.preview-markdown h2 {
    font-size: 20px;
    font-weight: 600;
    margin: var(--space-4) 0 var(--space-3);
    color: var(--text-primary);
}

.preview-markdown h3 {
    font-size: 16px;
    font-weight: 600;
    margin: var(--space-3) 0 var(--space-2);
    color: var(--text-secondary);
}

.preview-markdown p { margin: 0 0 var(--space-3); }

.preview-markdown ul,
.preview-markdown ol {
    margin: 0 0 var(--space-3);
    padding-left: var(--space-5);
}

.preview-markdown li { margin: var(--space-1) 0; }

.preview-markdown a {
    color: var(--hive-accent);
    text-decoration: none;
}

.preview-markdown a:hover { text-decoration: underline; }

.preview-markdown code.md-inline-code {
    background: var(--hive-bg-elevated);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--event-action);
}

.preview-markdown pre.md-code-block {
    background: var(--hive-bg-deep);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-3);
    margin: var(--space-3) 0;
    overflow-x: auto;
}

.preview-markdown pre.md-code-block code {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
}

.preview-markdown hr {
    border: none;
    border-top: 1px solid var(--glass-border);
    margin: var(--space-4) 0;
}

.preview-markdown strong { font-weight: 600; color: var(--text-primary); }
.preview-markdown em { font-style: italic; color: var(--text-secondary); }

/* ═══════════════════════════════════════════════════════════════════════════
    INPUT BAR - Flat neon focus
    ═══════════════════════════════════════════════════════════════════════════ */

.input-bar {
    background: var(--hive-bg-surface);
    border-top: 1px solid var(--glass-border);
    padding: var(--space-4);
    padding-bottom: calc(var(--space-4) + var(--safe-bottom));
    box-shadow: 0 -2px 8px rgba(0,0,0,0.4);
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: var(--space-3);
    max-width: 1200px;
    margin: 0 auto;
}

.input-box {
    flex: 1;
    display: flex;
    align-items: flex-end;
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-fast);
}

.input-box:focus-within {
    border-color: var(--hive-accent);
    box-shadow: var(--neon-glow);
}

.input-textarea {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: transparent;
    border: none;
    outline: none;
    resize: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    min-height: 108px;
    max-height: 250px;
    line-height: 1.5;
}

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

.input-actions {
    display: flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-2);
    border-left: 1px solid var(--glass-border);
}

.input-action {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-tertiary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.input-action:hover {
    background: var(--hive-accent-subtle);
    color: var(--hive-accent);
}

.input-action.active {
    background: var(--hive-accent-dim);
    color: var(--hive-accent);
}

.input-action .icon {
    width: 18px;
    height: 18px;
}

.send-btn {
    height: 44px;
    padding: 0 var(--space-5);
    background: var(--hive-accent);
    border: none;
    border-radius: var(--radius-lg);
    color: var(--hive-bg-void);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: all var(--transition-fast);
    box-shadow: var(--neon-glow);
}

.send-btn .icon {
    stroke: var(--hive-bg-void);
    width: 18px;
    height: 18px;
}

.send-btn:hover {
    box-shadow: 0 0 16px var(--hive-accent-glow), 0 0 4px var(--hive-accent);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.mode-toggle {
    height: 44px;
    padding: 0 var(--space-3);
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    color: var(--text-tertiary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    transition: all var(--transition-fast);
}

.mode-toggle.active {
    background: var(--hive-accent-subtle);
    color: var(--hive-accent);
    border-color: var(--hive-accent);
    box-shadow: var(--neon-glow);
}

/* ═══════════════════════════════════════════════════════════════════════════
    VOICE INDICATOR
    ═══════════════════════════════════════════════════════════════════════════ */

.voice-indicator {
    position: fixed;
    bottom: calc(var(--input-height) + var(--space-4) + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    display: none;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    background: var(--hive-bg-surface);
    border: 1px solid var(--hive-accent);
    border-radius: var(--radius-lg);
    box-shadow: var(--neon-glow), var(--depth-3);
    z-index: 200;
}

.voice-indicator.visible {
    display: flex;
    animation: voiceSlideUp 0.3s ease-out;
}

@keyframes voiceSlideUp {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.voice-waves {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.voice-wave {
    width: 3px;
    height: 12px;
    background: var(--hive-accent);
    border-radius: 1px;
    animation: voiceWave 0.5s ease-in-out infinite;
}

.voice-wave:nth-child(2) { animation-delay: 0.1s; }
.voice-wave:nth-child(3) { animation-delay: 0.2s; }
.voice-wave:nth-child(4) { animation-delay: 0.3s; }
.voice-wave:nth-child(5) { animation-delay: 0.4s; }

@keyframes voiceWave {
    0%, 100% { height: 8px; }
    50% { height: 20px; }
}

.voice-status {
    font-size: 13px;
    font-weight: 500;
    color: var(--hive-accent);
    text-shadow: var(--neon-glow-soft);
}

/* ═══════════════════════════════════════════════════════════════════════════
    MODALS - Sharp with depth
    ═══════════════════════════════════════════════════════════════════════════ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(3, 5, 8, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: 100%;
    max-width: 480px;
    background: var(--hive-bg-surface);
    border: 1px solid var(--glass-border-bright);
    border-radius: var(--radius-xl);
    box-shadow: var(--depth-3), 0 0 40px rgba(0,0,0,0.5);
    transform: translateY(10px);
    transition: transform var(--transition-slow);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--glass-border);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
}

.modal-body {
    padding: var(--space-5);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--glass-border);
}

.form-group { margin-bottom: var(--space-4); }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-3);
    background: var(--hive-bg-elevated);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    border-color: var(--hive-accent);
    box-shadow: var(--neon-glow);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* ═══════════════════════════════════════════════════════════════════════════
    TOASTS - Sharp with status border
    ═══════════════════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    top: calc(var(--header-height) + var(--space-4));
    right: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    z-index: 1001;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--hive-bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    box-shadow: var(--depth-2);
    animation: toastSlideIn 0.3s ease-out;
}

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

.toast.success { border-left: 3px solid var(--status-success); }
.toast.error { border-left: 3px solid var(--status-error); }
.toast.warning { border-left: 3px solid var(--status-warning); }
.toast.info { border-left: 3px solid var(--status-info); }

.toast-icon {
    display: flex;
    align-items: center;
}

.toast-icon .icon {
    width: 18px;
    height: 18px;
}

.toast-message {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-1);
    display: flex;
    align-items: center;
}

.toast-close .icon {
    width: 14px;
    height: 14px;
}

/* ═══════════════════════════════════════════════════════════════════════════
    RESPONSIVE
    ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 1200px) {
    .hive-sidebar { width: 240px; }
    .preview-panel.open { width: 350px; }
}

@media (max-width: 900px) {
    .hive-sidebar { display: none; }
    .mobile-status-card { display: flex; }
    .status-row { display: none; }
    .input-actions { flex-direction: column; gap: var(--space-6); }
    .preview-panel {
        position: absolute;
        right: 0;
        top: 55px;
        bottom: 145px;
        z-index: 50;
    }
    .preview-panel.open { width: 100%; }
    .hide-on-mobile { display: none; }
}

@media (max-width: 600px) {
    .header-status { display: none; }
    .hive-stats { display: none; }
}

.hidden, .memory { display: none !important; }
