:root {
  --bg: #0a0c12;
  --bg2: #12151f;
  --surface: rgba(26, 29, 39, 0.92);
  --surface2: #242836;
  --surface3: #2d3347;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef0f6;
  --muted: #8b94aa;
  --accent: #7b93ff;
  --accent-dim: rgba(123, 147, 255, 0.15);
  --accent2: #4fd1a5;
  --accent2-dim: rgba(79, 209, 165, 0.15);
  --warn: #ffb347;
  --warn-dim: rgba(255, 179, 71, 0.15);
  --danger: #ff6b7a;
  --danger-dim: rgba(255, 107, 122, 0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --glow: 0 0 40px rgba(123, 147, 255, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(123, 147, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(79, 209, 165, 0.06), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.layout { max-width: 1440px; margin: 0 auto; padding: 20px; }

/* ── Header ── */
.header {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow), var(--glow);
  backdrop-filter: blur(12px);
}

.info-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.guide-link {
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: none;
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid rgba(123, 147, 255, 0.3);
  border-radius: 999px;
}
.guide-link:hover { background: var(--accent-dim); }

.header-left { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }

.brand { display: flex; align-items: center; gap: 10px; }

.logo {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 8px var(--accent2);
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

.header-meta { display: flex; flex-direction: column; gap: 2px; }

.stage-badge {
  display: inline-block;
  width: fit-content;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(123, 147, 255, 0.25);
}

.subtitle { color: var(--muted); font-size: 0.82rem; }

.metric-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.metric-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 100px;
  transition: border-color 0.2s, transform 0.15s;
}

.metric-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.metric-card.warn { border-color: rgba(255, 179, 71, 0.3); background: var(--warn-dim); }
.metric-card.warn .metric-value { color: var(--warn); }

.metric-icon {
  font-size: 1rem;
  color: var(--accent);
  opacity: 0.7;
  width: 18px;
  text-align: center;
}

.metric-body { display: flex; flex-direction: column; }
.metric-value { font-size: 1rem; font-weight: 700; font-family: var(--mono); line-height: 1.2; }
.metric-label { font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

/* ── State strip ── */
.state-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
}

.state-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
}

.state-chip.accent { background: var(--accent2-dim); border-color: rgba(79, 209, 165, 0.3); }
.state-chip.accent .chip-val { color: var(--accent2); }

.chip-key { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.04em; }
.chip-val { font-family: var(--mono); font-weight: 600; font-size: 0.78rem; }

.state-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 180px;
  margin-left: auto;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: var(--bg2);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 3px;
  transition: width 0.6s ease;
}

.progress-label { font-family: var(--mono); font-size: 0.72rem; color: var(--muted); min-width: 32px; }

/* ── Layout ── */
.main {
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: 14px;
  align-items: start;
}

.main-left {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.sidebar { display: flex; flex-direction: column; gap: 0; position: sticky; top: 16px; }

/* ── Panels ── */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 0;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.panel-badge {
  font-size: 0.68rem;
  font-family: var(--mono);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.panel-badge.accent { background: var(--accent2-dim); color: var(--accent2); border-color: rgba(79, 209, 165, 0.3); }
.panel-badge.warn { background: var(--warn-dim); color: var(--warn); border-color: rgba(255, 179, 71, 0.3); }

/* ── Sidebar tabs ── */
.sidebar-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

.tab {
  flex: 1;
  padding: 8px 6px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.tab:hover { color: var(--text); background: var(--bg2); }
.tab.active { background: var(--accent-dim); color: var(--accent); }

.tab-panel { display: none; flex-direction: column; gap: 10px; }
.tab-panel.active { display: flex; }

.tab-panel .panel { margin-bottom: 0; }

/* ── Chat ── */
.chat-panel { display: flex; flex-direction: column; min-height: 38vh; }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 12px;
  min-height: 200px;
  max-height: 42vh;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 160px;
  text-align: center;
  color: var(--muted);
  gap: 6px;
}

.chat-empty.hidden { display: none; }
.chat-empty-icon { font-size: 2rem; opacity: 0.4; }
.chat-empty p { font-size: 0.95rem; color: var(--text); }
.chat-empty-hint { font-size: 0.78rem; max-width: 260px; }

.msg {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  max-width: 92%;
  animation: msg-in 0.25s ease;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg.user { margin-left: auto; flex-direction: row-reverse; }

.msg-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
}

.msg.vi .msg-avatar {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(123, 147, 255, 0.3);
}

.msg.user .msg-avatar {
  background: var(--surface3);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.msg-body { min-width: 0; }

.msg .bubble {
  display: inline-block;
  padding: 10px 14px;
  border-radius: 14px;
  text-align: left;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.user .bubble {
  background: linear-gradient(135deg, #5a72e8, var(--accent));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.msg.vi .bubble {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.msg .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-family: var(--mono);
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge.behavior { color: var(--accent); border-color: rgba(123, 147, 255, 0.25); background: var(--accent-dim); }
.badge.meta { color: var(--accent2); border-color: rgba(79, 209, 165, 0.25); background: var(--accent2-dim); }
.badge.region { color: var(--warn); border-color: rgba(255, 179, 71, 0.25); background: var(--warn-dim); }
.badge.motor { color: #c9a0ff; }
.badge.sleep { color: #7ec8e3; }
.badge.perception { color: #ffd166; }
.badge.consult { color: #e6a070; border-color: rgba(230, 160, 112, 0.35); background: rgba(230, 160, 112, 0.12); }

.chat-form { display: flex; gap: 8px; align-items: flex-end; }

.chat-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 48px;
  max-height: 120px;
  padding: 11px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  transition: border-color 0.15s;
}

.chat-form textarea:focus {
  outline: none;
  border-color: rgba(123, 147, 255, 0.5);
}

/* ── Buttons ── */
.btn-primary, .btn-secondary, .panel button, .chat-form button {
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  font-family: inherit;
  transition: filter 0.15s, transform 0.1s;
}

.btn-primary, .chat-form button, .panel button:not(.secondary):not(.btn-secondary):not(.tab):not(.ok):not(.no) {
  background: linear-gradient(135deg, #5a72e8, var(--accent));
  color: #fff;
}

.btn-primary:hover, .chat-form button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.chat-form button {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.chat-form kbd {
  font-size: 0.65rem;
  opacity: 0.7;
  font-family: var(--mono);
}

.btn-secondary, .panel button.secondary, .panel button.btn-secondary {
  background: var(--bg2);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover, .panel button.secondary:hover { background: var(--surface3); }

.full { width: 100%; margin-top: 8px; }

/* ── Forms ── */
.form-stack { display: flex; flex-direction: column; gap: 10px; }
.form-row-actions { display: flex; gap: 8px; margin-top: 8px; }
.form-row-actions .btn-secondary { flex: 1; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }

.form-divider {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.train-form { margin-top: 4px; }

.panel input, .panel textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.15s;
}

.panel input:focus, .panel textarea:focus {
  outline: none;
  border-color: rgba(123, 147, 255, 0.4);
}

.inline-form { display: flex; gap: 8px; margin-bottom: 4px; }
.inline-form input { flex: 1; margin-bottom: 0; }

/* ── File drops ── */
.file-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 16px 8px;
  background: var(--bg2);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}

.file-drop:hover { border-color: var(--accent); background: var(--accent-dim); color: var(--text); }
.file-drop-icon { font-size: 1.4rem; color: var(--accent); opacity: 0.8; }
.file-drop input { display: none; }

.sensory-status {
  font-size: 0.78rem;
  color: var(--muted);
  padding: 8px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-family: var(--mono);
}
.sensory-status.active {
  color: var(--accent2);
  border-color: rgba(79, 209, 165, 0.3);
  background: var(--accent2-dim);
}

.camera-preview-wrap {
  margin-bottom: 14px;
}
.camera-preview-wrap.hidden { display: none !important; }

.camera-preview {
  display: block;
  width: 100%;
  max-width: 640px;
  min-height: 240px;
  max-height: 360px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #000;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-preview-hint {
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: var(--mono);
}
.camera-preview-hint.hidden { display: none; }

.stream-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}
.stream-controls button.active {
  border-color: var(--accent2);
  color: var(--accent2);
  background: var(--accent2-dim);
}

/* ── Info cards (sleep/neural) ── */
.info-card {
  padding: 10px 12px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.info-card .info-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 2px;
}

.info-card .info-value {
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 600;
}

.info-card.highlight { border-color: rgba(79, 209, 165, 0.3); background: var(--accent2-dim); }
.info-card.highlight .info-value { color: var(--accent2); }

/* ── Checkpoints ── */
.checkpoint-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.panel-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0;
  text-transform: none;
  letter-spacing: 0;
}
.btn-link:hover { text-decoration: underline; }

.checkpoint-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.checkpoint-item {
  padding: 10px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.checkpoint-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.checkpoint-name {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text);
  word-break: break-all;
}

.checkpoint-step {
  font-size: 0.68rem;
  color: var(--accent);
  white-space: nowrap;
}

.checkpoint-note, .checkpoint-meta {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.checkpoint-item .btn-secondary { margin-top: 4px; }

/* ── Knowledge graph ── */
.graph-viz-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}

.graph-svg {
  width: 100%;
  height: auto;
  display: block;
}

.graph-edge {
  stroke: rgba(123, 147, 255, 0.35);
  stroke-width: 1;
}

.graph-label {
  font-size: 9px;
  fill: var(--muted);
  pointer-events: none;
}

.graph-node circle {
  cursor: pointer;
  transition: r 0.15s;
}
.graph-node:hover circle { r: 16; }

/* ── Web search & shell ── */
.search-results .search-item { padding: 10px 0; }
.search-title {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 4px;
}
.search-title:hover { text-decoration: underline; }
.search-snippet { font-size: 0.78rem; color: var(--text); margin-bottom: 2px; }
.search-url { font-size: 0.68rem; color: var(--muted); font-family: var(--mono); word-break: break-all; }

.field-hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin: 0 0 8px;
}
.warn-hint { color: #e6a070; }

.shell-form .inline-timeout {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.shell-form .inline-timeout input { width: 72px; }

.shell-output {
  margin-top: 10px;
  padding: 10px 12px;
  background: #0d1117;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--accent2);
  max-height: 200px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.shell-output.hidden { display: none; }
.shell-output.shell-error { color: #f07178; border-color: rgba(240, 113, 120, 0.3); }

/* ── Memory management ── */
.clear-targets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  margin-bottom: 10px;
}

.clear-check {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  color: var(--text);
  cursor: pointer;
}
.clear-check input { accent-color: var(--accent); }
.warn-check { color: #e6a070; }

.memory-items .item { padding: 8px 0; }
.memory-items .content { font-size: 0.78rem; }

.web-preview {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px;
  margin: 8px 0;
  max-height: 100px;
  overflow: auto;
  white-space: pre-wrap;
}

.approval-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.approval-actions .btn-secondary {
  font-size: 0.72rem;
  padding: 5px 8px;
}

.book-drop { margin-top: 4px; }
.book-ingest-status {
  font-size: 0.75rem;
  color: var(--accent2);
  font-family: var(--mono);
  min-height: 1.2em;
}

.neural-info { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; font-family: var(--mono); }

/* ── Lists ── */
.list { max-height: 220px; overflow-y: auto; }

.item {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.item:hover { border-color: var(--border-strong); }

.item .content {
  font-size: 0.88rem;
  margin: 6px 0;
  white-space: pre-wrap;
  max-height: 100px;
  overflow-y: auto;
  line-height: 1.45;
}

.item .meta { font-size: 0.72rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

.item .actions { display: flex; gap: 6px; margin-top: 8px; }

.item .actions button {
  flex: 1;
  padding: 6px;
  font-size: 0.85rem;
}

.btn-approve, .ok { background: var(--accent2) !important; color: #0a0c12 !important; }
.btn-reject, .no { background: var(--danger) !important; color: #fff !important; }

.episodes .episode {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.episodes .episode:last-child { border-bottom: none; }

.episode-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.episode-dot.dialogue { background: var(--accent); }
.episode-dot.vision { background: #ffd166; }
.episode-dot.audio { background: #c9a0ff; }
.episode-dot.response { background: var(--accent2); }
.episode-dot.default { background: var(--muted); }

.episode-body { flex: 1; min-width: 0; }
.episode-type { font-weight: 600; color: var(--text); text-transform: capitalize; }
.episode-time { font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }

.empty {
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  text-align: center;
  padding: 20px 12px;
}

/* ── Brain viz ── */
.brain-panel { margin-bottom: 0; }

.brain-viz-wrap {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 12px;
  align-items: start;
}

.brain-svg {
  width: 100%;
  height: auto;
  min-height: 280px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.brain-edge {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-opacity: var(--edge-alpha, 0.2);
}

.brain-edge-active {
  stroke: var(--accent2);
  stroke-width: 2;
  stroke-dasharray: 6 4;
  animation: brain-flow 1.2s linear infinite;
}

@keyframes brain-flow { to { stroke-dashoffset: -20; } }

.brain-label { fill: var(--muted); font-size: 9px; font-family: var(--font); }
.brain-pct { fill: var(--text); font-size: 10px; font-weight: 600; font-family: var(--mono); }
.brain-sleep { fill: var(--accent2); font-size: 11px; opacity: 0.8; }

.brain-node-dominant circle:first-child {
  stroke: var(--accent2);
  stroke-width: 3;
}

.brain-metrics { font-size: 0.75rem; }

.brain-metric-block { margin-bottom: 12px; }

.brain-metric-block h3 {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.brain-bar-row {
  display: grid;
  grid-template-columns: 72px 1fr 28px;
  gap: 4px;
  align-items: center;
  margin-bottom: 5px;
}

.brain-bar-label { color: var(--muted); font-size: 0.68rem; }

.brain-bar-track {
  height: 7px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.brain-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.brain-bar-fill.lateral { background: linear-gradient(90deg, #3db892, var(--accent2)); }
.brain-bar-fill.attention { background: linear-gradient(90deg, #5a72e8, var(--accent)); }

.brain-bar-val { font-family: var(--mono); font-size: 0.65rem; color: var(--text); text-align: right; }
.brain-bar-empty { color: var(--muted); font-size: 0.8rem; }

.neural-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.neural-mini-grid div {
  padding: 6px 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.neural-mini-grid span { font-size: 0.62rem; color: var(--muted); text-transform: uppercase; }
.neural-mini-grid strong { font-family: var(--mono); font-size: 0.78rem; }

.brain-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.legend-tag {
  font-size: 0.68rem;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--muted);
}

.legend-tag.active { color: var(--accent2); border-color: rgba(79, 209, 165, 0.3); background: var(--accent2-dim); }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .metric-grid { width: 100%; }
  .header { flex-direction: column; align-items: stretch; }
  .state-progress { margin-left: 0; width: 100%; }
}

@media (max-width: 900px) {
  .main { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .brain-viz-wrap { grid-template-columns: 1fr; }
  .metric-card { flex: 1; min-width: calc(50% - 4px); }
  .chat-log { max-height: 35vh; }
}

@media (max-width: 520px) {
  .layout { padding: 12px; }
  .metric-card { min-width: calc(50% - 4px); }
  .state-chip { font-size: 0.72rem; }
  .file-grid { grid-template-columns: 1fr; }
}
