:root {
  --glass-bg: rgba(11, 18, 32, 0.62);
  --glass-blur: 14px;
  --glass-border: rgba(34, 211, 238, 0.15);
  --panel-radius: 14px;
  --panel-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --term-w: 480px;
  --term-h: 42vh;
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #070b14;
  color: #e2e8f0;
  overflow: hidden;
  height: 100vh;
}

#login-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7, 11, 20, 0.95);
  display: flex; align-items: center; justify-content: center;
}
#login-overlay.hidden { display: none; }

.login-box {
  background: #0f172a; border: 1px solid #334155; border-radius: 16px;
  padding: 2rem; width: min(360px, 92vw); text-align: center;
}
.login-box h1 { font-size: 1.4rem; margin-bottom: 0.25rem; color: #22d3ee; }
.login-sub { color: #94a3b8; font-size: 0.85rem; margin-bottom: 1rem; }
.login-box input {
  width: 100%; margin: 0.5rem 0; padding: 10px 12px;
  border-radius: 8px; border: 1px solid #475569; background: #020617; color: #f8fafc;
}
.login-box button {
  width: 100%; margin-top: 1rem; padding: 12px;
  background: linear-gradient(135deg, #0891b2, #6366f1);
  border: none; border-radius: 8px; color: white; font-weight: 700; cursor: pointer;
}
.login-err { color: #f87171; font-size: 0.8rem; margin-top: 0.75rem; display: none; }

#app { position: relative; width: 100vw; height: 100vh; overflow: hidden; }

#stage { position: fixed; inset: 0; }

#graph-layer {
  position: fixed; inset: 0; z-index: 0;
}
#graph { width: 100%; height: 100%; }
#graph-layer.graph-passive { pointer-events: none; }

.graph-loader {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; background: rgba(7, 11, 20, 0.7); color: #94a3b8; font-size: 0.85rem;
}
.graph-loader.hidden { display: none; }
.spinner {
  width: 36px; height: 36px; border: 3px solid #1e293b;
  border-top-color: #22d3ee; border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.activity-legend {
  position: absolute; bottom: 12px; left: 12px; z-index: 5;
  display: flex; gap: 12px; font-size: 0.68rem; color: #94a3b8;
  background: var(--glass-bg); backdrop-filter: blur(8px);
  padding: 6px 10px; border-radius: 8px; border: 1px solid var(--glass-border);
  pointer-events: none;
}
.leg-edit { color: #22d3ee; }
.leg-ctx { color: #fbbf24; }

.stats-hud {
  position: absolute; bottom: 12px; right: 12px; z-index: 5;
  font-size: 0.68rem; color: #64748b;
  background: var(--glass-bg); backdrop-filter: blur(8px);
  padding: 4px 8px; border-radius: 6px; pointer-events: none;
}
.stats-hud.hidden,
.activity-legend.hidden { display: none !important; }

#hud-layer {
  position: fixed; inset: 0; z-index: 10;
  pointer-events: none;
}

.hud-dock {
  position: fixed; left: 10px; top: 50%; transform: translateY(-50%);
  z-index: 60; display: flex; flex-direction: column; gap: 8px;
  pointer-events: auto;
}
.dock-btn {
  width: 52px; height: 52px; border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  color: #22d3ee; font-size: 0.72rem; font-weight: 700;
  cursor: pointer; box-shadow: var(--panel-shadow);
  transition: transform 0.15s, background 0.15s;
}
.dock-btn:hover {
  transform: scale(1.06);
  background: rgba(22, 78, 99, 0.75);
  color: #a5f3fc;
}
.dock-btn.active {
  box-shadow: 0 0 0 2px #22d3ee;
  background: rgba(22, 78, 99, 0.85);
}

.hud-panel {
  pointer-events: auto;
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--panel-radius);
  box-shadow: var(--panel-shadow);
  transition: opacity 0.2s, transform 0.2s;
}

.hud-top {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: min(96%, 1100px);
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 8px 14px; z-index: 20;
}
.hud-top.collapsed {
  width: auto; padding: 8px 12px;
  transform: translateX(-50%);
}
.hud-top.collapsed > *:not(.brand):not(.panel-collapse) { display: none; }

.brand { font-weight: 800; color: #22d3ee; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 5px 12px; border-radius: 999px; border: 1px solid #334155;
  background: rgba(2, 6, 23, 0.6); cursor: pointer; font-size: 0.78rem;
}
.tab.active { background: #164e63; border-color: #22d3ee; color: #a5f3fc; }

select, #search, #vault-q {
  padding: 5px 8px; border-radius: 8px; border: 1px solid #475569;
  background: rgba(2, 6, 23, 0.7); color: #f1f5f9; font-size: 0.78rem;
}
#search { min-width: 100px; flex: 1; max-width: 160px; }
.stats-inline { font-size: 0.68rem; color: #94a3b8; margin-left: auto; }

.badge {
  font-size: 0.65rem; padding: 2px 8px; border-radius: 999px;
  background: #334155; color: #cbd5e1;
}
.badge.primary { background: #7c3aed; color: #ede9fe; }
.badge.online { background: #166534; color: #bbf7d0; }
.badge.offline { background: #7f1d1d; color: #fecaca; }

.btn-sm {
  padding: 4px 10px; border-radius: 6px; border: 1px solid #475569;
  background: rgba(30, 41, 59, 0.8); color: #e2e8f0; cursor: pointer; font-size: 0.75rem;
}
.btn-sm:hover { background: #334155; }

.panel-collapse {
  margin-left: auto; padding: 2px 8px; border-radius: 6px;
  border: 1px solid #475569; background: transparent; color: #94a3b8;
  cursor: pointer; font-size: 0.85rem; line-height: 1;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid rgba(30, 41, 59, 0.6);
}
.panel-head h2 { font-size: 0.85rem; color: #fbbf24; }
.panel-body { overflow: auto; }

.hud-ceo {
  position: absolute; left: 12px; top: 64px; width: 300px; max-height: 38vh;
  display: flex; flex-direction: column;
}
.hud-ceo.collapsed {
  width: 52px; height: 52px; overflow: hidden;
  top: 64px; left: 72px;
}
.hud-ceo.collapsed .panel-body,
.hud-ceo.collapsed .panel-head h2 { display: none; }
.hud-ceo.collapsed .panel-head { border: none; padding: 0; justify-content: center; }
.hud-ceo.collapsed .panel-collapse {
  margin: 0; width: 100%; height: 100%; border: none;
  font-size: 0.7rem; color: #fbbf24;
}
.hud-ceo.collapsed .panel-collapse::before { content: "CEO"; }

.ceo-brief {
  padding: 8px 12px; font-size: 0.72rem; color: #94a3b8;
  max-height: 120px; overflow: auto; line-height: 1.45;
}
.vault-search { display: flex; gap: 6px; padding: 6px 12px; }
#vault-q { flex: 1; }
.vault-hits { list-style: none; max-height: 80px; overflow: auto; padding: 0 12px 8px; }
.vault-hits li {
  font-size: 0.72rem; padding: 4px 0; cursor: pointer; color: #a78bfa;
  border-bottom: 1px solid rgba(30, 41, 59, 0.5);
}
.vault-hits li:hover { color: #e9d5ff; }
.vault-links { padding: 4px 12px 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.link-btn {
  font-size: 0.68rem; padding: 3px 8px; border-radius: 6px;
  border: 1px solid #475569; background: rgba(2, 6, 23, 0.6); color: #94a3b8; cursor: pointer;
}

.hud-right {
  position: absolute; right: 12px; top: 64px; bottom: 12px;
  width: var(--inspector-w, 360px);
  min-width: 280px; max-width: 55vw;
  display: flex; flex-direction: column; max-height: calc(100vh - 76px);
}
.hud-right.collapsed {
  width: 52px !important; min-width: 0; max-width: none;
  height: 52px; overflow: hidden;
  top: 64px; right: 12px; bottom: auto;
}
.hud-right.collapsed .inspector-resize-handle { display: none; }
.hud-right.collapsed .panel-body,
.hud-right.collapsed .panel-head h2 { display: none; }
.hud-right.collapsed .panel-head { border: none; padding: 0; justify-content: center; }
.hud-right.collapsed .panel-collapse {
  margin: 0; width: 100%; height: 100%; border: none;
  font-size: 1rem; color: #a78bfa;
}
.hud-right.collapsed .panel-collapse::before { content: "◈"; }

.inspector-resize-handle {
  position: absolute; left: 0; top: 0; bottom: 0; width: 6px;
  cursor: ew-resize; z-index: 3;
  background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.25));
}
.inspector-resize-handle:hover { background: linear-gradient(90deg, transparent, rgba(167, 139, 250, 0.5)); }

.inspector-tabs {
  display: flex; gap: 4px; padding: 6px 8px 0; flex-shrink: 0;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
}
.inspector-tab {
  flex: 1; padding: 6px 8px; border: none; border-radius: 6px 6px 0 0;
  background: transparent; color: #94a3b8; font-size: 0.72rem; cursor: pointer;
}
.inspector-tab.active {
  background: rgba(99, 102, 241, 0.2); color: #c4b5fd; font-weight: 600;
}
.inspector-tab-panel {
  flex: 1; display: flex; flex-direction: column; min-height: 0; overflow: hidden;
}
.inspector-tab-panel.hidden { display: none !important; }

.inspector-body {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
  max-height: calc(100vh - 120px); position: relative;
}
#node-detail {
  padding: 10px 12px; font-size: 0.78rem; color: #cbd5e1;
  overflow: auto; flex: 1; min-height: 0;
  white-space: pre-wrap; line-height: 1.5;
}

#jarvis { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* legacy chat classes — unused */

.benchmark-panel {
  border-top: 1px solid rgba(30, 41, 59, 0.5);
  padding: 8px 12px; font-size: 0.68rem; max-height: 140px; overflow: auto;
  margin-top: 8px;
}
.benchmark-toggle { margin-top: 8px; width: 100%; text-align: left; }
.mission-empty-hint {
  padding: 12px; font-size: 0.75rem; color: #64748b; text-align: center;
}
.session-auth-hint {
  font-size: 0.72rem; color: #fbbf24; margin-left: 10px;
  display: inline-flex; align-items: center; gap: 6px;
}
.session-auth-hint.hidden { display: none; }
.mission-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
  padding: 8px 0 10px; margin-bottom: 4px;
  position: sticky; top: 0; z-index: 2;
  background: rgba(15, 23, 42, 0.92);
}
.mission-actions .btn-primary,
.mission-actions .btn-secondary {
  padding: 8px 16px; border-radius: 8px; font-size: 0.8rem; font-weight: 600;
  cursor: pointer; border: 1px solid #334155;
}
.mission-actions .btn-primary {
  background: #0e639c; color: #fff; border-color: #1177bb;
}
.mission-actions .btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.mission-actions .btn-primary.mission-ready {
  border-color: #4ec9b0; box-shadow: 0 0 0 1px rgba(78, 201, 176, 0.35);
}
.mission-actions .btn-secondary { background: #1e293b; color: #94a3b8; }
.mission-actions .btn-secondary.autopilot-on {
  border-color: #4ec9b0; color: #4ec9b0;
}
.workspace-panel {
  border: 1px solid rgba(51, 65, 85, 0.8);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 6px 0 8px;
  background: rgba(15, 23, 42, 0.55);
  color: #cbd5e1;
  font-size: 0.72rem;
}
.workspace-panel .workspace-title {
  display: flex; justify-content: space-between; gap: 8px; font-weight: 700; color: #e2e8f0;
}
.workspace-panel .workspace-meta {
  margin-top: 4px; color: #94a3b8; word-break: break-all;
}
.workspace-panel .workspace-artifacts {
  display: flex; flex-direction: column; gap: 3px; margin-top: 6px;
}
.workspace-panel .workspace-artifact {
  display: flex; justify-content: space-between; gap: 8px;
  border-top: 1px solid rgba(51, 65, 85, 0.55);
  padding-top: 3px;
}
.workspace-panel .workspace-status-apply_ready { color: #4ec9b0; }
.workspace-panel .workspace-status-failed { color: #ef4444; }
.attach-preview {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border-bottom: 1px solid #2a2a2a;
}
.attach-preview img, .chat-attach-thumb {
  max-height: 64px; max-width: 120px; border-radius: 6px;
}
.hidden { display: none !important; }
.mission-table-wrap { overflow: auto; max-height: 40vh; margin-top: 6px; }
.mission-table thead th { position: sticky; top: 0; background: #0f172a; z-index: 1; }
.mission-table .col-out-empty { display: none; }
.chat-turn-divider { border-top: 1px solid rgba(51, 65, 85, 0.5); margin: 10px 0; }
#jarvis-mission:disabled { opacity: 0.5; cursor: not-allowed; }
#jarvis-mission.mission-ready,
.cursor-btn-run.mission-ready { box-shadow: 0 0 0 1px rgba(78, 201, 176, 0.35); }
.benchmark-panel table { width: 100%; border-collapse: collapse; }
.benchmark-panel td, .benchmark-panel th {
  padding: 2px 4px; text-align: left; border-bottom: 1px solid rgba(30, 41, 59, 0.4);
}

.terminal-float {
  position: fixed;
  left: var(--term-left, 12px);
  top: var(--term-top, auto);
  bottom: var(--term-bottom, 12px);
  width: var(--term-w, 480px);
  height: var(--term-h, 42vh);
  min-width: 420px; min-height: 300px;
  max-width: 90vw; max-height: 80vh;
  z-index: 30;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.terminal-float.collapsed {
  width: 52px !important; height: 52px !important; min-width: 0; min-height: 0;
  overflow: hidden; left: 72px !important;
}
.terminal-float.collapsed .term-body,
.terminal-float.collapsed .term-resize-handle,
.terminal-float.collapsed .term-actions { display: none; }
.terminal-float.collapsed .term-drag-handle {
  padding: 0; cursor: pointer; justify-content: center;
  border: none; height: 100%; font-size: 1.2rem;
}
.terminal-float.collapsed .term-drag-handle span { display: none; }
.terminal-float.collapsed .term-drag-handle::before { content: "⌨"; color: #22d3ee; }

.terminal-float.terminal-focused {
  z-index: 55;
  box-shadow: 0 0 0 2px #22d3ee, var(--panel-shadow);
}

.term-drag-handle {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px; font-size: 0.78rem; color: #22d3ee;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  cursor: grab; user-select: none; flex-shrink: 0;
}
.term-drag-handle:active { cursor: grabbing; }
.term-actions { display: flex; gap: 4px; align-items: center; }

.term-body { flex: 1; min-height: 0; position: relative; }
#terminal-frame {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border: none; background: #000;
}

.term-resize-handle {
  position: absolute; right: 0; bottom: 0;
  width: 18px; height: 18px; cursor: nwse-resize; z-index: 2;
  background: linear-gradient(135deg, transparent 50%, rgba(34, 211, 238, 0.4) 50%);
}

.hud-fab {
  display: none; position: fixed; bottom: 72px; right: 16px; z-index: 40;
  width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid var(--glass-border); background: var(--glass-bg);
  backdrop-filter: blur(12px); color: #22d3ee; font-size: 1.2rem; cursor: pointer;
  pointer-events: auto;
}

.toast {
  position: fixed; bottom: 48px; left: 50%; transform: translateX(-50%);
  z-index: 100; padding: 8px 16px; border-radius: 8px;
  background: rgba(15, 23, 42, 0.9); border: 1px solid #475569;
  font-size: 0.8rem; color: #e2e8f0;
}
.toast.hidden { display: none; }

.mobile-nav { display: none; }
.desktop-only { display: inline-flex; }
.mobile-only { display: none; }
.graph-lite-placeholder {
  padding: 24px 16px;
  color: #94a3b8;
  font-size: 0.85rem;
  text-align: center;
}
.jarvis-brain-select {
  background: #1e1e1e;
  border: 1px solid #3c3c3c;
  color: #ccc;
  border-radius: 6px;
  font-size: 11px;
  padding: 4px 6px;
  max-width: 120px;
}
.jarvis-brain-seg {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.brain-seg-btn {
  min-height: 44px;
  min-width: 44px;
  padding: 6px 8px;
  border: 1px solid #3c3c3c;
  background: #1e1e1e;
  color: #aaa;
  border-radius: 6px;
  font-size: 10px;
  cursor: pointer;
}
.brain-seg-btn.active {
  border-color: #4ec9b0;
  color: #4ec9b0;
}
.cursor-chip-model.brain-thinking {
  color: #22d3ee;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35);
}
.brain-migration-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  padding: 8px 10px;
  font-size: 11px;
  color: #c8e6ff;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  border-radius: 6px;
}
.brain-migration-banner.hidden { display: none !important; }
.brain-config-panel { padding: 4px 0; }
.brain-config-hint { font-size: 11px; color: #858585; margin: 0 0 8px; }
.brain-field-label { display: block; font-size: 10px; color: #9cdcfe; margin: 8px 0 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.brain-field {
  width: 100%;
  min-height: 72px;
  font-size: 12px;
  font-family: inherit;
  background: #1e1e1e;
  color: #d4d4d4;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  resize: vertical;
}
.brain-config-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.brain-config-status { font-size: 11px; color: #858585; margin-top: 6px; min-height: 1em; }
.cursor-error-card .error-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.mobile-lite-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #858585;
  min-height: 44px;
}
body.mobile-lite .cursor-agent-row.status-running .cursor-agent-grid,
body.mobile-lite .cursor-agent-row.status-polling .cursor-agent-grid,
body.mobile-lite .cursor-todo-item.todo-polling .cursor-todo-mark,
body.mobile-lite .cursor-live-dot {
  animation: none !important;
}
body.mobile-lite .mobile-nav,
body.mobile-lite .hud-fab {
  backdrop-filter: none;
  background: rgba(15, 23, 42, 0.95);
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .hud-panel { transition: none; }
  .cursor-agent-row.status-running .cursor-agent-grid,
  .cursor-live-dot { animation: none !important; }
}

@media (max-width: 768px) {
  html, body, #stage {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .desktop-only { display: none !important; }
  .mobile-only { display: inline-flex !important; }
  .jarvis-brain-seg.mobile-only { display: flex !important; }
  .hud-dock { display: none; }
  .hud-top { width: 96%; top: 6px; padding: 6px 10px; }
  .stats-inline { display: none; }
  .hud-ceo, .hud-right, .terminal-float {
    display: none;
  }
  #stage[data-mobile-tab="ceo"] .hud-ceo,
  #stage[data-mobile-tab="inspector"] .hud-right,
  #stage[data-mobile-tab="usage"] .hud-right,
  #stage[data-mobile-tab="terminal"] .terminal-float,
  #stage[data-mobile-tab="graph"] #graph-layer {
    display: flex;
  }
  #stage[data-mobile-tab="ceo"] .hud-ceo {
    top: auto; bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 8px; right: 8px; width: auto;
    max-height: min(45dvh, 45vh);
  }
  #stage[data-mobile-tab="inspector"] .hud-right {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0;
    width: 100vw;
    min-width: 0;
    max-width: none;
    max-height: none;
    height: auto;
    border-radius: 0;
    z-index: 60;
  }
  #stage[data-mobile-tab="inspector"] .inspector-body {
    max-height: none;
    min-height: 0;
    overflow: hidden;
  }
  #stage[data-mobile-tab="terminal"] .terminal-float {
    left: 0 !important; right: 0 !important;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px)) !important;
    top: env(safe-area-inset-top, 0px) !important;
    width: 100vw !important;
    height: auto !important;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    border-radius: 0;
    z-index: 65;
  }
  #stage[data-mobile-tab="terminal"] .terminal-float .term-body {
    flex: 1;
    min-height: 0;
  }
  #stage[data-mobile-tab="terminal"] .terminal-float .terminal-pool-pre {
    height: 100%;
    max-height: none;
    overflow: auto;
  }
  #stage[data-mobile-tab="graph"] #graph-layer {
    display: block;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  .hud-fab { display: block; }
  .mobile-nav {
    display: flex; justify-content: space-around;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--glass-bg);
    backdrop-filter: blur(12px); border-top: 1px solid var(--glass-border);
    pointer-events: auto;
  }
  .mobile-nav button {
    flex: 1; padding: 10px 4px; border: none; background: transparent;
    color: #94a3b8; font-size: 0.75rem; cursor: pointer;
    min-height: 44px;
  }
  .mobile-nav button.active { color: #22d3ee; font-weight: 700; }
  .activity-legend { bottom: calc(56px + env(safe-area-inset-bottom, 0px)); }
  .cursor-composer textarea,
  .cursor-agent-detail-input { font-size: 16px; }
}

@media (max-width: 480px) {
  .brain-seg-btn { font-size: 9px; padding: 6px 6px; }
  .cursor-composer-bar { flex-wrap: wrap; }
}

@media (max-width: 360px) {
  .mobile-nav button { font-size: 0.65rem; }
  .jarvis-brain-seg { width: 100%; }
}

/* JARVIS mission orchestrator */
.jarvis-toolbar {
  display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap;
}
#autopilot-btn.autopilot-off {
  background: transparent; color: #858585;
}
#autopilot-btn.autopilot-on {
  background: rgba(78, 201, 176, 0.12); color: #4ec9b0; border-color: #4ec9b0;
  animation: none;
}
@keyframes pulse-ap {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(34, 211, 238, 0); }
}
.mission-panel { margin: 10px 0; font-size: 0.8rem; }
.mission-panel h4 { color: #22d3ee; margin-bottom: 6px; }
.mission-table { width: 100%; border-collapse: collapse; font-size: 0.75rem; }
.mission-table th, .mission-table td {
  border: 1px solid #334155; padding: 4px 6px; text-align: left;
}
.mission-table .sev-CRITICAL { color: #f87171; }
.mission-table .sev-HIGH { color: #fb923c; }
.mission-trace {
  max-height: 120px; overflow: auto; font-size: 0.7rem;
  background: #0f172a; padding: 6px; border-radius: 6px; margin-top: 6px;
}
.mission-agent-chips { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 4px; }
.mission-agent-chip { font-size: 0.7rem; }
.mission-table .task-active { background: rgba(34, 211, 238, 0.08); }
.mission-table .link-agent {
  background: none; border: none; color: #22d3ee; cursor: pointer;
  font-size: inherit; padding: 0; text-decoration: underline;
}
.mission-table .task-out { font-size: 0.65rem; color: #94a3b8; max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
.mission-banner {
  font-size: 0.75rem; padding: 4px 8px; border-radius: 6px; margin: 6px 0;
  background: #1e293b; color: #94a3b8;
}
.mission-banner.banner-planned { color: #fbbf24; border: 1px solid #854d0e; }
.mission-banner.banner-running { color: #22d3ee; border: 1px solid #0891b2; }
.mission-banner.banner-done { color: #4ade80; border: 1px solid #166534; }

.session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid #1e293b;
  flex-wrap: wrap;
}
.session-bar label {
  font-size: 11px;
  color: #64748b;
  white-space: nowrap;
}
#session-select {
  flex: 1;
  min-width: 120px;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 12px;
}
.session-stop-btn {
  color: #fca5a5;
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, 0.18);
}
.session-stop-btn:hover:not(:disabled) {
  color: #fecaca;
  border-color: #ef4444;
}
.session-stop-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.session-status-badge {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #334155;
  color: #94a3b8;
  white-space: nowrap;
}
.session-status-badge.status-running {
  color: #22d3ee;
  border-color: #0891b2;
  background: rgba(8, 145, 178, 0.12);
}
.git-env-panel {
  margin: 0;
  padding: 8px;
  border-bottom: 1px solid #1e293b;
  background: #1e1e1e;
  max-height: 34vh;
  overflow: hidden;
}
.git-env-panel.compact {
  max-height: 118px;
}
.git-env-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.git-env-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}
.git-env-title {
  font-size: 12px;
  color: #cccccc;
  font-weight: 650;
}
.git-env-body {
  font-size: 11px;
  color: #858585;
  max-height: calc(34vh - 42px);
  overflow: auto;
  padding-right: 2px;
}
.git-env-panel.compact .git-env-body {
  max-height: 68px;
}
.git-env-loading,
.git-env-error,
.git-env-mini {
  padding: 4px 0;
  color: #94a3b8;
}
.git-env-error { color: #f87171; }
.git-env-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.git-env-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #333;
  border-radius: 6px;
  background: #252526;
}
.git-env-row strong {
  color: #d4d4d4;
  font-weight: 600;
}
.git-env-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.git-env-changes .add { color: #22c55e; }
.git-env-changes .del { color: #ef4444; margin-left: 5px; }
.git-env-files {
  margin-top: 6px;
  display: grid;
  gap: 3px;
}
.git-env-file {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  color: #94a3b8;
}
.git-env-file code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #cbd5e1;
}
.git-env-file .add { color: #22c55e; }
.git-env-file .del { color: #ef4444; margin-left: 4px; }
.git-env-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.git-env-panel.compact .git-env-actions button:not([data-git-action="review"]):not([data-git-action="run-check"]) {
  display: none;
}
.git-env-auth.ok { color: #4ec9b0; }
.git-env-auth.warn { color: #fbbf24; }
.git-env-auth.err { color: #f48771; }
.git-env-auth-link {
  background: none;
  border: none;
  padding: 0;
  margin-left: 6px;
  color: #4fc1ff;
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.git-env-auth-link:hover { color: #9cdcfe; }
.git-env-auth-pending {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: #fbbf24;
}
.git-env-auth-pending code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.95em;
  letter-spacing: 0.08em;
  padding: 2px 6px;
  border-radius: 4px;
  background: #2d2d2d;
  border: 1px solid #555;
  color: #fff;
}
.git-env-sources,
.git-env-tasks {
  margin-top: 6px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.git-env-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid #333;
  background: #1e1e1e;
  color: #aaa;
  max-width: 100%;
}
.git-env-chip.ok { border-color: rgba(78, 201, 176, 0.45); color: #4ec9b0; }
.git-env-chip.warn { border-color: rgba(251, 191, 36, 0.45); color: #fbbf24; }
.git-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(2, 6, 23, 0.72);
}
.git-modal-card {
  width: min(760px, 96vw);
  max-height: min(720px, 90vh);
  display: flex;
  flex-direction: column;
  border: 1px solid #334155;
  border-radius: 10px;
  background: #1e1e1e;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}
.git-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #333;
}
.git-modal-body {
  padding: 12px;
  overflow: auto;
  font-size: 12px;
  color: #cccccc;
}
.git-modal-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  color: #aaa;
}
.git-file-list {
  max-height: 220px;
  overflow: auto;
  border: 1px solid #333;
  border-radius: 8px;
  margin: 8px 0;
}
.git-file-row {
  display: grid;
  grid-template-columns: 24px 54px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid #2a2a2a;
}
.git-file-row:last-child { border-bottom: none; }
.git-file-path {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}
.git-file-stat .add { color: #22c55e; }
.git-file-stat .del { color: #ef4444; margin-left: 4px; }
.git-modal-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}
.git-modal-form input,
.git-modal-form textarea {
  width: 100%;
  border: 1px solid #3c3c3c;
  border-radius: 6px;
  background: #111827;
  color: #f8fafc;
  padding: 7px 9px;
  font-size: 12px;
}
.git-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.git-modal-note {
  color: #fbbf24;
  font-size: 11px;
}
.session-terminal-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  width: 100%;
}
.session-term-tab {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid #334155;
  background: #0f172a;
  color: #94a3b8;
  cursor: pointer;
}
.session-term-tab.active {
  color: #22d3ee;
  border-color: #0891b2;
  background: rgba(8, 145, 178, 0.15);
}
.session-terminal-panel {
  position: fixed;
  display: flex;
  flex-direction: column;
  border: 1px solid #334155;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.96);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.session-terminal-panel .term-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.session-status-badge.status-idle {
  color: #fbbf24;
  border-color: #854d0e;
}
.session-status-badge.status-done {
  color: #4ade80;
  border-color: #166534;
}
.session-status-badge.status-failed {
  color: #f87171;
  border-color: #991b1b;
}
.session-status-badge.status-stopped {
  color: #fca5a5;
  border-color: #7f1d1d;
  background: rgba(127, 29, 29, 0.12);
}

.terminal-tab-bar {
  display: flex;
  gap: 4px;
  padding: 4px 6px;
  background: #0f172a;
  border-bottom: 1px solid #334155;
  flex-wrap: wrap;
}
.terminal-tab-btn {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #94a3b8;
  cursor: pointer;
}
.terminal-tab-btn.active {
  color: #22d3ee;
  border-color: #0891b2;
  background: rgba(8, 145, 178, 0.15);
}
.terminal-pool-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  background: #0d1117;
}
.terminal-pool-pre {
  margin: 0;
  padding: 8px;
  font-size: 11px;
  color: #94a3b8;
  white-space: pre-wrap;
  word-break: break-word;
}
.mission-panel-hint { font-size: 0.65rem; color: #64748b; font-weight: normal; }
.chat-line strong { margin-right: 4px; }
.chat-ceo strong { color: #f8fafc; }
.chat-jarvis strong { color: #a78bfa; }
.chat-cursor strong { color: #22d3ee; }
.chat-hermes strong { color: #4ade80; }
.chat-antigravity strong { color: #fb923c; }
.mission-cli-toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 6px 0; font-size: 0.72rem;
}
.mission-cli-toolbar label { color: #94a3b8; }
.mission-cli-inventory {
  margin: 8px 0;
  border: 1px solid rgba(34, 211, 238, 0.18);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.55);
  overflow: hidden;
}
.mission-cli-inventory-head,
.mission-cli-row {
  display: grid;
  grid-template-columns: minmax(86px, 1fr) minmax(72px, 0.8fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.mission-cli-inventory-head {
  color: #94a3b8;
  font-size: 0.7rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.mission-cli-row {
  border-top: 1px solid rgba(148, 163, 184, 0.08);
  font-size: 0.72rem;
}
.mission-cli-row:first-of-type { border-top: 0; }
.mission-cli-name { color: #e2e8f0; font-weight: 600; }
.mission-cli-meta {
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mission-cli-status {
  color: #22c55e;
  font-size: 0.68rem;
}
.mission-cli-status.missing,
.mission-cli-status.failed { color: #f87171; }
.mission-cli-status.idle { color: #94a3b8; }
.mission-cli-actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.mission-cli-stop {
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}
.self-upgrade-panel {
  margin: 8px 0;
  padding: 10px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.72);
}
.self-upgrade-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.self-upgrade-sub {
  color: #94a3b8;
  font-size: 0.7rem;
  margin-top: 2px;
}
.self-upgrade-intent {
  width: 100%;
  margin-top: 8px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 8px;
  background: rgba(2, 6, 23, 0.72);
  color: #e2e8f0;
  padding: 8px;
  resize: vertical;
}
.self-upgrade-actions,
.self-upgrade-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.self-upgrade-option {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 140px;
}
.self-upgrade-option.recommended {
  border-color: rgba(34, 211, 238, 0.5);
}
.self-upgrade-option span {
  color: #94a3b8;
  font-size: 0.68rem;
}
.self-upgrade-timeline,
.self-upgrade-gates {
  margin-top: 8px;
  display: grid;
  gap: 4px;
}
.self-upgrade-timeline-row,
.self-upgrade-gate {
  display: grid;
  grid-template-columns: minmax(84px, 0.8fr) minmax(120px, 2fr);
  gap: 8px;
  padding: 5px 6px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.65);
  color: #cbd5e1;
  font-size: 0.68rem;
}
.self-upgrade-timeline-row small,
.self-upgrade-gate small {
  color: #94a3b8;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.self-upgrade-gate.passed { border-left: 2px solid #22c55e; }
.self-upgrade-gate.failed { border-left: 2px solid #f87171; }
.self-upgrade-gate.running { border-left: 2px solid #22d3ee; }
.task-agent-select {
  font-size: 0.7rem; background: #0f172a; color: #e2e8f0;
  border: 1px solid #334155; border-radius: 4px; max-width: 100px;
}
.chat-gemini strong { color: #f472b6; }
.chat-codex strong { color: #a3e635; }
.chat-claude strong { color: #fbbf24; }
.chat-opencode strong { color: #38bdf8; }
.chat-qwen strong { color: #c084fc; }
.chat-error { color: #f87171; }
.jarvis-error { color: #f87171; }
.activity-legend .leg-jarvis { color: #a78bfa; font-size: 0.65rem; }
.hidden { display: none !important; }
.jarvis-plan-btn {
  margin-top: 6px;
  background: linear-gradient(135deg, #0891b2, #6366f1);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.75rem;
  cursor: pointer;
}
.jarvis-plan-btn:hover { opacity: 0.9; }
#jarvis-mission.mission-ready {
  box-shadow: 0 0 0 2px #22d3ee;
  animation: pulse-ap 2s infinite;
}
.cursor-agent-detail-transport {
  margin: 6px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cli-transport {
  border: 1px solid rgba(34, 211, 238, 0.22);
  border-radius: 6px;
  padding: 6px;
  background: rgba(15, 23, 42, 0.55);
}
.cli-transport-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  font-size: 0.72rem;
  color: #94a3b8;
}
.cli-transport-row span { color: #22d3ee; }
.cli-transport-row.needs-human span { color: #fbbf24; }
.cli-transport-reply {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.session-cli-hint {
  font-size: 0.72rem;
  color: #64748b;
  margin: 0 12px 8px;
}
.session-cli-label {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: 6px;
}
.session-cli-slots {
  font-size: 0.75rem;
  max-width: 110px;
}
.session-usage-strip {
  margin: 8px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.25);
  background: rgba(15, 23, 42, 0.6);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.78rem;
}
.session-usage-strip:hover { border-color: rgba(56, 189, 248, 0.5); }
.usage-strip-label { color: #94a3b8; }
#session-usage-strip-text { color: #38bdf8; font-weight: 600; }

.usage-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 4px 2px 12px;
  font-size: 0.78rem;
}
.usage-head h3 { margin: 0; font-size: 0.95rem; color: #e2e8f0; }
.usage-footnote { margin: 4px 0 0; color: #64748b; font-size: 0.68rem; line-height: 1.35; }
.usage-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.usage-range-presets { display: flex; flex-wrap: wrap; gap: 4px; }
.usage-range-btn.active {
  border-color: #38bdf8;
  color: #38bdf8;
}
.usage-ended-banner {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #bae6fd;
}
.usage-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.usage-card {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: rgba(15, 23, 42, 0.55);
}
.usage-card-label { display: block; color: #94a3b8; font-size: 0.68rem; }
.usage-card-value { display: block; color: #f8fafc; font-size: 0.95rem; font-weight: 600; margin-top: 2px; }
.usage-chart-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#usage-chart {
  width: 100%;
  max-width: 100%;
  height: 80px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.45);
}
.usage-group-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.usage-table-wrap {
  overflow: auto;
  max-height: 42vh;
  border: 1px solid #334155;
  border-radius: 8px;
}
.usage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.72rem;
}
.usage-table th,
.usage-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #1e293b;
  text-align: left;
  white-space: nowrap;
}
.usage-table th { color: #94a3b8; position: sticky; top: 0; background: #0f172a; }
.usage-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: #94a3b8;
}

@media (max-width: 768px) {
  #stage[data-mobile-tab="usage"] .hud-right {
    position: fixed;
    top: env(safe-area-inset-top, 0px);
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    left: 0; right: 0;
    width: 100vw;
    min-width: 0;
    max-width: none;
    max-height: none;
    height: auto;
    border-radius: 0;
    z-index: 60;
    display: flex;
  }
  #stage[data-mobile-tab="usage"] .inspector-body {
    max-height: none;
    min-height: 0;
    overflow: hidden;
  }
  .usage-cards { grid-template-columns: 1fr 1fr; }
}
.cli-transport-reply button {
  border: 1px solid #334155;
  background: #111827;
  color: #e2e8f0;
  border-radius: 5px;
  padding: 4px 8px;
  font-size: 0.72rem;
  cursor: pointer;
}
.cli-transport-reply button:hover {
  border-color: #22d3ee;
  color: #67e8f9;
}
.cursor-agent-detail-live-terminal {
  margin: 6px 12px;
  max-height: 160px;
  overflow: auto;
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 6px;
  padding: 8px;
  background: #05070b;
  color: #a7f3d0;
  font-size: 0.72rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
