/* HEGEL Dashboard — v2.0.0 (Stitch Redesign) */

@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

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

:root {
    --bg: #0f1117;
    --bg-deep: #111618;
    --panel: #1a1d27;
    --panel-border: #2a2d3a;
    --surface: #1a262d;
    --surface-darker: #141e24;
    --accent: #4fc3f7;
    --accent-dim: #1b3a4d;
    --accent-glow: rgba(79, 195, 247, 0.15);
    --text: #e2e4ea;
    --text-secondary: #8b8fa3;
    --text-muted: #555869;
    --text-subtle: #9cb0ba;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --amber: #fbbf24;
    --purple: #ce93d8;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ===== CUSTOM SCROLLBAR (Stitch) ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-darker); }
::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== SHARED COMPONENTS ===== */

/* KPI Card Bar */
.kpi-bar { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi-card {
    background: var(--panel); border: 1px solid var(--panel-border); border-radius: var(--radius);
    padding: 16px 20px; display: flex; flex-direction: column; gap: 4px;
}
.kpi-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 24px; font-weight: 700; color: var(--text); font-family: var(--mono); }
.kpi-change { font-size: 11px; font-family: var(--mono); font-weight: 500; }
.kpi-change.up { color: var(--success); }
.kpi-change.down { color: var(--danger); }
.kpi-icon { font-size: 20px; color: var(--accent); margin-bottom: 4px; }

/* Status Pills */
.status-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 20px; font-size: 10px;
    font-weight: 600; font-family: var(--mono); letter-spacing: 0.5px;
}
.status-pill.live { background: #162e16; color: var(--success); }
.status-pill.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: pulse-dot 2s infinite; }
.status-pill.off { background: #1a1a1a; color: var(--text-muted); }
.status-pill.empty { background: transparent; color: var(--text-muted); border: 1px dashed var(--panel-border); }
.status-pill.evolving { background: #2a1540; color: var(--purple); animation: pulse-dot 1.5s infinite; }
.status-pill.warmup { background: #161e3e; color: #7986cb; }
.status-pill.processing { background: var(--accent-dim); color: var(--accent); }

/* Tab Group */
.tab-group { display: flex; border-bottom: 1px solid var(--panel-border); margin-bottom: 20px; }
.tab-item {
    padding: 10px 20px; font-size: 13px; font-weight: 500; color: var(--text-muted);
    cursor: pointer; border-bottom: 2px solid transparent; transition: all 0.2s;
    background: none; border-top: none; border-left: none; border-right: none;
}
.tab-item:hover { color: var(--text-secondary); }
.tab-item.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-item .tab-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    font-size: 10px; font-weight: 700; background: var(--danger); color: white; margin-left: 6px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
    text-align: left; padding: 10px 14px; font-size: 11px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--panel-border); background: var(--surface-darker);
}
.data-table tbody td {
    padding: 10px 14px; border-bottom: 1px solid rgba(42, 45, 58, 0.5);
    color: var(--text-secondary); vertical-align: middle;
}
.data-table tbody tr:hover { background: rgba(79, 195, 247, 0.03); }
.data-table .mono { font-family: var(--mono); }

/* Layer Badge (table/inline) */
.layer-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 6px; font-size: 11px; font-weight: 600;
    font-family: var(--mono); background: var(--accent-dim); color: var(--accent);
}

/* Death Cause Pill */
.death-pill {
    display: inline-block; padding: 2px 8px; border-radius: 10px;
    font-size: 10px; font-weight: 600; font-family: var(--mono);
}
.death-pill.atp_crisis { background: #2e1616; color: var(--danger); }
.death-pill.succinate_depletion { background: #2a1c00; color: var(--warning); }
.death-pill.oaa_depletion { background: #2a1c00; color: #fb923c; }
.death-pill.survived { background: #162e16; color: var(--success); }
.death-pill.pair { background: #1e1040; color: var(--purple); }
.death-pill.none { background: #162e16; color: var(--success); }

/* Sidebar TOC */
.sidebar-toc {
    position: sticky; top: 0; width: 250px; flex-shrink: 0;
    padding: 20px; border-right: 1px solid var(--panel-border);
    background: var(--panel); height: 100vh; overflow-y: auto;
}
.toc-title { font-size: 10px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px; }
.toc-link {
    display: block; padding: 6px 12px; font-size: 13px; color: var(--text-secondary);
    text-decoration: none; border-radius: 6px; transition: all 0.15s; margin-bottom: 2px;
}
.toc-link:hover { color: var(--accent); background: var(--accent-dim); }
.toc-link.active { color: var(--accent); background: var(--accent-dim); font-weight: 500; }
.toc-section { margin-bottom: 20px; }

/* Callout Box */
.callout {
    padding: 14px 18px; border-radius: var(--radius-sm); margin: 16px 0;
    font-size: 13px; line-height: 1.6;
}
.callout.hegel { background: rgba(251, 191, 36, 0.08); border-left: 3px solid var(--amber); color: var(--text-secondary); }
.callout.info { background: var(--accent-dim); border-left: 3px solid var(--accent); color: var(--text-secondary); }
.callout.warn { background: rgba(239, 68, 68, 0.08); border-left: 3px solid var(--danger); color: var(--text-secondary); }
.callout-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.callout.hegel .callout-label { color: var(--amber); }
.callout.info .callout-label { color: var(--accent); }

/* Filter Pills */
.filter-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-pill {
    padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500;
    background: var(--surface-darker); color: var(--text-muted); border: 1px solid var(--panel-border);
    cursor: pointer; transition: all 0.2s;
}
.filter-pill:hover { border-color: var(--accent); color: var(--text-secondary); }
.filter-pill.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 12px; color: var(--text-muted); }
.page-buttons { display: flex; gap: 4px; }
.page-btn {
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    border-radius: 6px; background: var(--surface-darker); border: 1px solid var(--panel-border);
    color: var(--text-secondary); cursor: pointer; font-size: 12px; font-family: var(--mono); transition: all 0.2s;
}
.page-btn:hover { border-color: var(--accent); color: var(--accent); }
.page-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

/* Lab Grid Background */
.lab-grid {
    background-image: linear-gradient(var(--panel-border) 1px, transparent 1px), linear-gradient(90deg, var(--panel-border) 1px, transparent 1px);
    background-size: 40px 40px; background-position: -1px -1px;
}

/* Top Navigation (Stitch-style flat links) */
.nav-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; background: var(--panel); border-bottom: 1px solid var(--panel-border);
    height: 56px; position: sticky; top: 0; z-index: 100;
}
.nav-top-left { display: flex; align-items: center; gap: 16px; }
.nav-top-logo {
    font-size: 18px; font-weight: 700; color: var(--accent); font-family: var(--mono);
    letter-spacing: 2px; text-decoration: none;
}
.nav-top-sep { color: var(--text-muted); font-size: 14px; }
.nav-top-subtitle { color: var(--text-subtle); font-size: 13px; }
.nav-top-links { display: flex; align-items: center; gap: 0; }
.nav-top-link {
    padding: 16px 16px; font-size: 13px; font-weight: 500; color: var(--text-muted);
    text-decoration: none; border-bottom: 2px solid transparent; transition: all 0.2s;
}
.nav-top-link:hover { color: var(--text); }
.nav-top-link.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-top-right { display: flex; align-items: center; gap: 12px; }

/* Material Symbols helper */
.material-symbols-outlined { font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24; vertical-align: middle; }

/* Confirm Modal */
.confirm-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; backdrop-filter: blur(4px);
}
.confirm-overlay.hidden { display: none; }
.confirm-box {
    background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: var(--radius); padding: 24px; min-width: 320px;
}

/* Responsive KPI */
@media (max-width: 1200px) { .kpi-bar { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .kpi-bar { grid-template-columns: 1fr; } }

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

/* ===== HEADER ===== */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--panel-border);
}

.header-left {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 3px;
    font-family: var(--mono);
}

.subtitle {
    color: var(--text-muted);
    font-size: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all 0.2s;
}

.header-link:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

/* ===== HAMBURGER BUTTON ===== */

.nav-hamburger {
    background: none;
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    font-size: 20px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.nav-hamburger:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
}

/* ===== NAV PANEL (slide-down) ===== */

.nav-panel {
    display: none;
    background: #1a1d27;
    border-bottom: 1px solid #2a2d3a;
    position: relative;
    z-index: 50;
}

.nav-panel.open {
    display: block;
}

.nav-panel-inner {
    display: flex;
    gap: 40px;
    padding: 14px 24px;
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-group-label {
    font-size: 9px;
    font-weight: 600;
    color: #555869;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.nav-item {
    text-decoration: none;
    color: #c0c3cf;
    font-size: 13px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.15s;
}

.nav-item:hover {
    color: var(--accent);
    background: var(--accent-dim);
}

.nav-item.active {
    color: var(--accent);
    background: var(--accent-dim);
}

/* Accordion nav group toggle */
.nav-group-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 6px;
}
.nav-group-toggle::before {
    content: '\25BE';
    font-size: 10px;
    color: #555869;
    transition: transform 0.15s;
    display: inline-block;
    width: 10px;
}
.nav-group.collapsed .nav-group-toggle::before {
    transform: rotate(-90deg);
}
.nav-group.collapsed .nav-group-items {
    display: none;
}
.nav-group-items {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Slot links in nav panel */
.nav-slot {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.15s;
}

.nav-slot:hover {
    background: var(--accent-dim);
    color: var(--text);
}

.nav-slot-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.nav-slot-dot.slot-o { background: #4fc3f7; }
.nav-slot-dot.slot-t { background: #ce93d8; }

.nav-slot-name {
    font-family: var(--mono);
    font-size: 12px;
}

.nav-slot-status {
    margin-left: auto;
    font-family: var(--mono);
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.nav-slot-status.running {
    color: var(--success);
    background: #162e16;
}

.nav-slot-status.stopped {
    color: var(--text-muted);
    background: #1a1a1a;
}

.nav-slot-status.empty {
    color: var(--text-muted);
    background: transparent;
}

/* Legacy dropdown support for other pages */
.nav-dropdown { position: relative; }
.nav-dropdown-trigger { cursor: pointer; user-select: none; }
.nav-dropdown-menu {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
    min-width: 200px; background: var(--panel); border: 1px solid var(--panel-border);
    border-radius: 8px; padding: 6px 0; z-index: 1000; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; }
.nav-dropdown-section { padding: 6px 14px 4px; font-size: 10px; font-weight: 600; color: var(--text-muted); letter-spacing: 1px; text-transform: uppercase; }
.nav-dropdown-item { display: flex; align-items: center; gap: 8px; padding: 7px 14px; font-size: 12px; color: var(--text-secondary); text-decoration: none; transition: all 0.15s; }
.nav-dropdown-item:hover { background: var(--accent-dim); color: var(--accent); }
.nav-dropdown-divider { height: 1px; background: var(--panel-border); margin: 4px 0; }
.slot-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.slot-dot.slot-o { background: #4fc3f7; }
.slot-dot.slot-t { background: #ce93d8; }
.slot-port { margin-left: auto; font-family: var(--mono); font-size: 10px; color: var(--text-muted); }

/* ===== SLOT SELECTOR ===== */

.slot-selector {
    position: relative;
    display: inline-block;
}

.slot-selector-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: 20px;
    border: 1px solid var(--panel-border);
    background: #14161e;
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

.slot-selector-btn:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}

.slot-selector-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ce93d8;
    flex-shrink: 0;
}

.slot-selector-arrow {
    font-size: 8px;
    margin-left: 2px;
    opacity: 0.6;
}

.slot-selector-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 6px;
    min-width: 180px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 6px 0;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.slot-selector-title {
    padding: 6px 14px 4px;
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.slot-selector-divider {
    height: 1px;
    background: var(--panel-border);
    margin: 4px 0;
}

.slot-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.slot-option:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.version-pill {
    font-family: var(--mono);
    font-weight: 500;
    color: var(--accent);
}

.badge {
    background: #162e16;
    color: var(--success);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 1px;
}

.badge.preprod {
    background: #3d2000;
    color: var(--warning);
}

.status-dot {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-dot .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.alive { background: #162e16; color: var(--success); }
.status-dot.alive .dot { background: var(--success); animation: pulse-dot 2s infinite; }

.status-dot.dead { background: #2e1616; color: var(--danger); }
.status-dot.dead .dot { background: var(--danger); }

.status-dot.survived { background: #162e16; color: var(--success); }
.status-dot.survived .dot { background: var(--success); animation: glow-dot 1.5s infinite; }

.status-dot.spawning { background: #161e3e; color: #7986cb; }
.status-dot.spawning .dot { background: #7986cb; animation: pulse-dot 1s infinite; }

.status-dot.batch { background: var(--accent-dim); color: var(--accent); }
.status-dot.batch .dot { background: var(--accent); animation: pulse-dot 2s infinite; }

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes glow-dot {
    0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--success); }
    50% { opacity: 0.7; box-shadow: 0 0 12px var(--success); }
}

/* ===== MAIN GRID ===== */

main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== PANELS ===== */

.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.panel h2 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 14px;
}

.full-width {
    grid-column: 1 / -1;
}

/* ===== LAYER PROGRESS ===== */

.layer-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 16px;
}

.layer-step {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: #14161e;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    font-size: 11px;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.layer-step.active {
    background: #0f2e1a;
    border-color: var(--success);
    color: var(--success);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.15);
}

.layer-step.completed {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}

.layer-num {
    font-weight: 700;
    font-size: 15px;
    font-family: var(--mono);
}

.layer-label {
    font-size: 11px;
    font-weight: 500;
}

.layer-connector {
    width: 16px;
    height: 1px;
    background: var(--panel-border);
}

/* ===== NARRATIVE ===== */

.narrative {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text-secondary);
    padding: 14px 18px;
    background: #14161e;
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    margin-bottom: 14px;
    font-family: var(--mono);
    font-size: 12px;
}

/* ===== LAYER STATS ===== */

.layer-stats {
    display: flex;
    gap: 28px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.layer-stats strong {
    color: var(--accent);
    font-family: var(--mono);
    font-weight: 600;
}

/* ===== CONTROLS BAR ===== */

.controls-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid #1f222e;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.speed-control > label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.speed-buttons {
    display: flex;
}

.speed-btn {
    padding: 5px 14px;
    background: #14161e;
    color: var(--text-muted);
    border: 1px solid var(--panel-border);
    cursor: pointer;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.speed-btn:first-child { border-radius: 6px 0 0 6px; }
.speed-btn:last-child { border-radius: 0 6px 6px 0; }
.speed-btn:not(:last-child) { border-right: none; }

.speed-btn:hover {
    background: var(--accent-dim);
    color: var(--accent);
}

.speed-btn.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--accent);
}
/* Fix adjacent active borders */
.speed-btn.active + .speed-btn { border-left-color: var(--accent); }

.speed-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* ===== AUTOPILOT ===== */

.autopilot-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

.autopilot-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
}

.autopilot-toggle input { display: none; }

.toggle-slider {
    width: 36px;
    height: 20px;
    background: #2a2d3a;
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--text-muted);
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
}

.autopilot-toggle input:checked + .toggle-slider {
    background: #16432a;
}

.autopilot-toggle input:checked + .toggle-slider::after {
    background: var(--success);
    left: 18px;
}

.autopilot-phase {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    font-family: var(--mono);
}

.autopilot-phase.warmup {
    background: #161e3e;
    color: #7986cb;
}

.autopilot-phase.evolving {
    background: #2a1540;
    color: #ce93d8;
    animation: pulse-dot 1.5s infinite;
}

.autopilot-phase.running {
    background: #162e16;
    color: var(--success);
}

.autopilot-info {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--mono);
}

/* ===== EVO PROGRESS ===== */

.evo-progress-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 250px;
}

.evo-progress-label-inline {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.evo-progress-bar-inline {
    flex: 1;
    height: 16px;
}

.evo-progress-text-inline {
    font-size: 11px;
    color: var(--text-secondary);
    min-width: 180px;
    font-family: var(--mono);
    white-space: nowrap;
}

/* ===== PROGRESS BAR (shared) ===== */

.progress-bar {
    flex: 1;
    height: 20px;
    background: #14161e;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--panel-border);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--success));
    transition: width 0.5s ease;
    width: 0%;
    border-radius: 9px;
}

.evo-fill {
    background: linear-gradient(90deg, #ce93d8, #ab47bc);
}

/* ===== METABOLIC METERS ===== */

.meter-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meter label {
    width: 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--mono);
}

.bar {
    flex: 1;
    height: 20px;
    background: #14161e;
    border-radius: 8px;
    overflow: hidden;
}

.fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #81d4fa);
    transition: width 0.3s ease;
    border-radius: 8px;
}

.fill.catalyst {
    background: linear-gradient(90deg, #e65100, var(--warning));
}

.value {
    width: 52px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--mono);
    font-weight: 500;
}

/* ===== VIABILITY ===== */

.viability {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.viability label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

.viability-bar {
    flex: 1;
    height: 10px;
    background: #14161e;
    border-radius: 5px;
    overflow: hidden;
}

.viability-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger), var(--warning), var(--success));
    transition: width 0.3s ease;
    border-radius: 5px;
}

#viability-value {
    font-size: 12px;
    color: var(--text-secondary);
    width: 44px;
    text-align: right;
    font-family: var(--mono);
    font-weight: 500;
}

/* ===== MOTOR OUTPUT ===== */

.motor-values {
    display: flex;
    gap: 20px;
}

.motor-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex: 1;
    padding: 12px;
    background: #14161e;
    border-radius: 8px;
}

.motor-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.motor-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--mono);
}

/* ===== VOICE OUTPUT ===== */

.voice-bars {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.voice-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.voice-label {
    width: 24px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    font-family: var(--mono);
}

.voice-bar-container {
    flex: 1;
    height: 16px;
    background: #14161e;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
}

.voice-bar-neg {
    height: 100%;
    background: linear-gradient(270deg, #ef4444, #b91c1c);
    border-radius: 8px 0 0 8px;
    width: 0%;
    margin-left: auto;
    transition: width 0.3s ease;
}

.voice-bar-pos {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 0 8px 8px 0;
    width: 0%;
    transition: width 0.3s ease;
}

.voice-val {
    width: 52px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    font-family: var(--mono);
    font-weight: 500;
}

.voice-summary {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--mono);
    letter-spacing: 0.3px;
}

/* ===== SYSTEM INFO ===== */

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 10px 12px;
    background: #14161e;
    border-radius: 8px;
}

.info-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.info-val {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    font-family: var(--mono);
}

/* ===== CANVAS ===== */

canvas {
    width: 100%;
    background: #14161e;
    border-radius: 8px;
}

/* ===== TOOLTIPS ===== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #222538;
    color: var(--text);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    font-size: 12px;
    font-weight: 400;
    white-space: normal;
    width: max-content;
    max-width: 300px;
    line-height: 1.5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}

[data-tooltip]:hover::after {
    opacity: 1;
}

.panel h2[data-tooltip] {
    border-bottom: none;
}

/* ===== RUN HISTORY ===== */

.run-history-list {
    max-height: 220px;
    overflow-y: auto;
    font-size: 12px;
}

.run-entry {
    padding: 6px 10px;
    border-left: 3px solid var(--panel-border);
    margin-bottom: 3px;
    display: flex;
    gap: 10px;
    align-items: center;
    border-radius: 0 6px 6px 0;
    background: #14161e;
}

.run-survived { border-left-color: var(--success); }
.run-died { border-left-color: var(--danger); }
.run-num { color: var(--text-muted); font-weight: 600; min-width: 30px; font-family: var(--mono); }
.run-result { color: var(--text-secondary); flex: 1; }
.run-seed { color: var(--text-muted); font-size: 10px; font-family: var(--mono); }
.run-history-empty { color: var(--text-muted); font-style: italic; padding: 10px; }

/* ===== EVENT LOG ===== */

.event-log {
    max-height: 220px;
    overflow-y: auto;
    font-size: 12px;
    font-family: var(--mono);
}

.event-entry {
    padding: 4px 10px;
    border-left: 2px solid var(--panel-border);
    margin-bottom: 2px;
    display: flex;
    gap: 8px;
    border-radius: 0 4px 4px 0;
}

.event-icon {
    color: var(--text-muted);
    font-weight: 700;
    min-width: 20px;
}

.event-spawn { border-left-color: var(--accent); }
.event-spawn .event-icon { color: var(--accent); }
.event-death { border-left-color: var(--danger); }
.event-death .event-icon { color: var(--danger); }
.event-survived { border-left-color: var(--success); }
.event-survived .event-icon { color: var(--success); }
.event-perturbation { border-left-color: var(--warning); }
.event-perturbation .event-icon { color: var(--warning); }
.event-layer_advance { border-left-color: #e040fb; }
.event-layer_advance .event-icon { color: #e040fb; }
.event-msg { color: var(--text-secondary); }
.event-empty { color: var(--text-muted); font-style: italic; padding: 10px; }

/* ===== CHART PANELS ===== */

.chart-panel canvas {
    background: transparent;
    max-height: 300px;
}

/* ===== CHANGELOG MODAL ===== */

.changelog-modal-content {
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
}

.changelog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.changelog-text {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    font-family: var(--mono);
}

/* ===== FOOTER ===== */

footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid #1f222e;
    display: flex;
    justify-content: center;
    gap: 24px;
}

.footer-version {
    color: var(--accent);
    font-weight: 600;
    font-family: var(--mono);
}

/* ===== TERMINAL ===== */

.terminal-toggle-btn {
    padding: 5px 14px;
    background: #14161e;
    color: var(--accent);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.terminal-toggle-btn:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.codex-btn {
    padding: 5px 14px;
    background: #1a0e2e;
    color: #ce93d8;
    border: 1px solid #3a2060;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

.codex-btn:hover {
    background: #2a1540;
    border-color: #ce93d8;
    color: #e1bee7;
}

.terminal-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 50%;
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--panel-border);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.terminal-sidebar.hidden { display: none; }

.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 18px;
    background: var(--panel);
    border-bottom: 1px solid var(--panel-border);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
}

.terminal-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    font-family: var(--mono);
    border-radius: 4px;
    transition: all 0.2s;
}

.terminal-close-btn:hover {
    color: var(--danger);
    background: #2e1616;
}

#terminal-container {
    flex: 1;
    padding: 4px;
    overflow: hidden;
}

/* ===== MODAL ===== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(4px);
}

.modal.hidden { display: none; }

.modal-content {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: 32px;
    min-width: 300px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.modal-content h3 {
    color: var(--accent);
    margin-bottom: 20px;
    font-size: 16px;
    font-weight: 600;
}

.modal-content input {
    width: 100%;
    padding: 10px 14px;
    background: #14161e;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--mono);
    font-size: 14px;
    margin-bottom: 16px;
    outline: none;
    transition: border-color 0.2s;
}

.modal-content input:focus {
    border-color: var(--accent);
}

.modal-content button {
    width: 100%;
    padding: 10px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font);
    font-weight: 600;
    font-size: 13px;
    transition: background 0.2s;
}

.modal-content button:hover {
    background: #81d4fa;
}

.error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 12px;
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }

    .full-width {
        grid-column: 1;
    }

    header {
        flex-direction: column;
        gap: 12px;
    }

    .header-right {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-panel-inner {
        flex-direction: column;
        gap: 16px;
    }

    .terminal-sidebar {
        width: 100%;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .speed-control,
    .autopilot-control,
    .evo-progress-inline {
        justify-content: center;
    }

    .motor-values {
        flex-direction: column;
    }

    .layer-progress {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ===== ACTIVITY SIDEBAR ===== */

.activity-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 340px;
    background: var(--panel);
    border-right: 1px solid var(--panel-border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease;
}

.activity-sidebar.collapsed {
    transform: translateX(-300px);
}

.activity-sidebar.collapsed .activity-toggle-btn {
    transform: rotate(180deg);
}

/* Sidebar tabs */
.sidebar-tabs {
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--panel-border);
    flex-shrink: 0;
}

.sidebar-tab {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.sidebar-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.sidebar-tab:hover:not(.active) {
    color: var(--text-secondary);
}

/* Sidebar panel visibility */
.sidebar-panel { display: none; }
.sidebar-panel.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow-y: auto;
}

.activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--panel-border);
    font-weight: 600;
    font-size: 13px;
    color: var(--accent);
    flex-shrink: 0;
}

.activity-toggle-btn {
    background: none;
    border: 1px solid var(--panel-border);
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    transition: all 0.15s;
}

.activity-toggle-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.activity-feed {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    font-family: var(--mono);
    font-size: 11px;
    line-height: 1.5;
}

.activity-entry {
    padding: 3px 6px;
    margin-bottom: 1px;
    border-radius: 3px;
    word-break: break-word;
}

.activity-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

.activity-time {
    color: var(--text-muted);
    margin-right: 4px;
}

.activity-tag {
    font-weight: 600;
    margin-right: 4px;
}

.activity-tag-SIM { color: var(--accent); }
.activity-tag-HEBBIAN { color: #a78bfa; }
.activity-tag-AUTOPILOT { color: var(--warning); }
.activity-tag-EVOLUTION { color: #e040fb; }
.activity-tag-CHECKPOINT { color: var(--text-muted); }
.activity-tag-STARTUP { color: var(--success); }
.activity-tag-SPEED { color: var(--text-secondary); }
.activity-tag-WEB { color: var(--text-secondary); }

.activity-msg { color: var(--text-secondary); }

/* ===== NOTES TAB ===== */

.notes-feed {
    padding: 16px;
    font-size: 12px;
    line-height: 1.5;
}

.notes-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
}

.notes-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 16px;
    font-family: var(--mono);
}

.notes-summary {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: #14161e;
    border-radius: 6px;
    border-left: 3px solid var(--accent);
}

.notes-section {
    margin-bottom: 16px;
}

.notes-section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.notes-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notes-list li {
    padding: 4px 0 4px 12px;
    color: var(--text-secondary);
    border-left: 2px solid var(--panel-border);
    margin-bottom: 4px;
    font-size: 11px;
    line-height: 1.5;
}

.notes-list.changes li { border-left-color: var(--accent); }
.notes-list.expectations li { border-left-color: var(--warning); }
.notes-list.questions li { border-left-color: #ce93d8; }

.notes-empty {
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
    text-align: center;
    line-height: 1.8;
}

.notes-empty code {
    font-family: var(--mono);
    background: #14161e;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

/* Push main content when sidebar is open */
body.activity-open header,
body.activity-open .nav-panel,
body.activity-open main,
body.activity-open footer {
    margin-left: 340px;
}

body.activity-open .activity-sidebar.collapsed ~ header,
body.activity-open .activity-sidebar.collapsed ~ .nav-panel,
body.activity-open .activity-sidebar.collapsed ~ main,
body.activity-open .activity-sidebar.collapsed ~ footer {
    margin-left: 40px;
}

/* ===== INLINE LEGENDS ===== */

.inline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.timeline-legend {
    margin-top: 0;
    margin-bottom: 6px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
    flex-shrink: 0;
}

.pcn-summary {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
}

/* ===== NAV SLOT POWER CONTROLS ===== */

.nav-slot-row {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-slot-row .nav-slot {
    flex: 1;
}

.slot-power-btn {
    background: none;
    border: 1px solid #2a2d3a;
    border-radius: 4px;
    color: #555;
    font-size: 14px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.slot-power-btn:hover {
    border-color: #4fc3f7;
    color: #4fc3f7;
}

.slot-power-btn.live {
    color: #22c55e;
    border-color: #22c55e40;
}

.slot-power-btn.live:hover {
    color: #ef4444;
    border-color: #ef444480;
}

.slot-power-btn.starting {
    color: #f59e0b;
    border-color: #f59e0b40;
    cursor: wait;
}

/* ===== SLOT CONFIRM DIALOG ===== */

.slot-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.slot-confirm-overlay.hidden {
    display: none;
}

.slot-confirm-box {
    background: #1a1d27;
    border: 1px solid #2a2d3a;
    border-radius: 8px;
    padding: 24px;
    min-width: 320px;
    max-width: 400px;
}

.slot-confirm-title {
    font-size: 16px;
    font-weight: 600;
    color: #e2e4ea;
    margin-bottom: 8px;
}

.slot-confirm-msg {
    font-size: 13px;
    color: #8b8fa3;
    margin-bottom: 20px;
    line-height: 1.5;
}

.slot-confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-slot-cancel {
    background: #2a2d3a;
    border: none;
    color: #8b8fa3;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}

.btn-slot-cancel:hover {
    background: #353845;
    color: #e2e4ea;
}

.btn-slot-ok {
    background: #ef4444;
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.btn-slot-ok:hover {
    background: #dc2626;
}

.btn-slot-ok.start {
    background: #22c55e;
}

.btn-slot-ok.start:hover {
    background: #16a34a;
}
