@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Orbitron:wght@400;500;600;700;800;900&family=Rajdhani:wght@400;500;600;700&family=Share+Tech+Mono&display=swap");

/* ═══════════════════════════════════════════════════════════════════════════
   CORTEX CONTROL CENTER — Jarvis-inspired Design System
   Color palette: Cyan (#00d4ff) on deep dark (#0a0e17)
   Typography: Orbitron (headlines), Rajdhani (UI), Share Tech Mono (data)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
  /* Core palette — Jarvis cyan on deep space */
  --bg: #0a0e17;
  --bg-deep: #060a12;
  --surface: #0f1520;
  --surface-2: #141c2b;
  --surface-3: #1a2435;
  --border: #557090;
  --border-subtle: #557090;
  --border-glow: rgba(0, 212, 255, 0.15);

  /* Text hierarchy */
  --text: #e8edf5;
  --text-2: #8899b0;
  --text-3: #7c8fa8;

  /* Accent — Jarvis cyan */
  --cyan: #00d4ff;
  --cyan-bright: #40e0ff;
  --cyan-dim: rgba(0, 212, 255, 0.08);
  --cyan-glow: rgba(0, 212, 255, 0.25);
  --cyan-glow-strong: rgba(0, 212, 255, 0.5);

  /* Agent colors */
  --agent-claude: #4a9eff;
  --agent-droid: #ff9800;
  --agent-gemini: #a855f7;

  /* Status */
  --green: #00e676;
  --green-dim: rgba(0, 230, 118, 0.08);
  --green-glow: rgba(0, 230, 118, 0.3);
  --yellow: #ffab00;
  --yellow-dim: rgba(255, 171, 0, 0.08);
  --red: #ff1744;
  --red-dim: rgba(255, 23, 68, 0.08);
  --blue: #448aff;

  /* Layout */
  --radius: 6px;
  --radius-lg: 10px;
  --sidebar-w: 240px;
  --sidebar-collapsed-w: 64px;
  --motion-base: 200ms;
  --motion-panel: 340ms;
  --motion-shell: 320ms;
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-transition: var(--motion-shell) var(--motion-ease);

  /* Typography */
  --font-display: "Orbitron", "Inter", sans-serif;
  --font-ui: "Rajdhani", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Share Tech Mono", "JetBrains Mono", "Cascadia Code", monospace;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
}

:root[data-cortex-contrast="high"] {
  --bg: #030711;
  --bg-deep: #01040a;
  --surface: #0b1420;
  --surface-2: #101c2b;
  --surface-3: #17263a;
  --border: #7aa4d4;
  --border-subtle: #6f98c5;
  --border-glow: rgba(70, 230, 255, 0.44);
  --text: #ffffff;
  --text-2: #d7e6f7;
  --text-3: #bfd5ec;
  --cyan: #46e6ff;
  --cyan-bright: #9af3ff;
  --cyan-dim: rgba(70, 230, 255, 0.16);
}

@media (prefers-contrast: more) {
  :root[data-cortex-contrast="standard"],
  :root:not([data-cortex-contrast]) {
    --bg: #030711;
    --bg-deep: #01040a;
    --surface: #0b1420;
    --surface-2: #101c2b;
    --surface-3: #17263a;
    --border: #7aa4d4;
    --border-subtle: #6f98c5;
    --border-glow: rgba(70, 230, 255, 0.44);
    --text: #ffffff;
    --text-2: #d7e6f7;
    --text-3: #bfd5ec;
    --cyan: #46e6ff;
    --cyan-bright: #9af3ff;
    --cyan-dim: rgba(70, 230, 255, 0.16);
  }
}

@media (forced-colors: active) {
  :root {
    color-scheme: light dark;
    --bg: Canvas;
    --bg-deep: Canvas;
    --surface: Canvas;
    --surface-2: Canvas;
    --surface-3: Canvas;
    --border: ButtonBorder;
    --border-subtle: ButtonBorder;
    --border-glow: transparent;
    --text: CanvasText;
    --text-2: CanvasText;
    --text-3: CanvasText;
    --cyan: LinkText;
    --cyan-bright: Highlight;
    --cyan-dim: transparent;
    --cyan-glow: transparent;
    --cyan-glow-strong: transparent;
  }

  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  .app,
  .app-shell,
  .sidebar,
  .main,
  .panel,
  .settings-section,
  .modal,
  .glass-card,
  .memory-card,
  .agent-card {
    background-image: none !important;
  }

  :is(
    button,
    a[href],
    input,
    select,
    textarea,
    [role="button"],
    [role="tab"],
    [role="switch"],
    [tabindex]:not([tabindex="-1"])
  ):focus-visible {
    outline: 2px solid Highlight;
    outline-offset: 3px;
    box-shadow: none;
  }

  button,
  input,
  select,
  textarea {
    border-color: ButtonBorder !important;
  }
}

/* ─── Reset ─────────────────────────────────────────────────────────────── */

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

html, body, #root {
  height: 100%;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ─── App Layout ────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  min-width: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 212, 255, 0.03) 0%, transparent 70%),
    radial-gradient(ellipse at 80% 20%, rgba(74, 158, 255, 0.02) 0%, transparent 60%),
    var(--bg);
  transition: grid-template-columns var(--sidebar-transition);
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */

.sidebar {
  background: var(--bg-deep);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 2px;
  position: relative;
  width: var(--sidebar-w);
  overflow: hidden;
  transition:
    width var(--sidebar-transition),
    padding var(--motion-base) var(--motion-ease),
    border-color var(--motion-base) ease;
}

/* Subtle vertical glow line on right edge */
.sidebar::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(
    180deg,
    transparent 0%,
    var(--cyan-glow) 30%,
    var(--cyan-glow) 70%,
    transparent 100%
  );
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

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

.logo span {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--cyan) 0%, var(--cyan-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 0 8px var(--cyan-glow));
}

/* ─── Status Pill ───────────────────────────────────────────────────────── */

.pill {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  padding: 3px 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.pill.online {
  background: var(--green-dim);
  color: var(--green);
  border: 1px solid rgba(0, 230, 118, 0.2);
}

.pill.online::before {
  background: var(--green);
  box-shadow: 0 0 8px var(--green-glow), 0 0 20px var(--green-glow);
  animation: pulse-dot 2s ease-in-out infinite;
}

.pill.offline {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 23, 68, 0.2);
}

.pill.offline::before {
  background: var(--red);
}

.pill.starting {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(255, 171, 0, 0.22);
}

.pill.starting::before {
  background: var(--yellow);
  box-shadow: 0 0 8px rgba(255, 171, 0, 0.35);
  animation: pulse-starting-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--green-glow); }
  50% { opacity: 0.6; box-shadow: 0 0 16px var(--green-glow); }
}

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

/* ─── Navigation ────────────────────────────────────────────────────────── */

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

:root[data-cortex-compact-navigation="on"] .sidebar-nav {
  gap: 1px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    background var(--motion-base) ease,
    color var(--motion-base) ease,
    border-color var(--motion-base) ease,
    box-shadow var(--motion-base) ease,
    transform var(--motion-base) var(--motion-ease);
  text-align: left;
  position: relative;
  letter-spacing: 0.02em;
}

:root[data-cortex-compact-navigation="on"] .nav-item {
  padding-top: 6px;
  padding-bottom: 6px;
}

.nav-item:hover {
  background: var(--surface);
  color: var(--text-2);
}

.nav-item.active {
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid var(--border-glow);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--cyan);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--cyan-glow-strong);
}

/* ─── Sidebar Footer ────────────────────────────────────────────────────── */

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: auto;
}

.daemon-restart-row {
  margin-bottom: 6px;
}

.daemon-controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}

.btn-ctrl {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 0;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition:
    background var(--motion-base) ease,
    border-color var(--motion-base) ease,
    color var(--motion-base) ease,
    box-shadow var(--motion-base) ease,
    transform var(--motion-base) var(--motion-ease);
  text-align: center;
  letter-spacing: 0.02em;
}

.btn-ctrl:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-ctrl.btn-primary {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 212, 255, 0.25));
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--cyan);
}

.btn-ctrl.btn-danger {
  background: var(--red-dim);
  border-color: rgba(255, 23, 68, 0.2);
  color: var(--red);
}

.btn-ctrl.btn-danger:hover {
  border-color: var(--red);
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.1);
}

.btn-ctrl.btn-restart {
  width: 100%;
  background: linear-gradient(135deg, rgba(63, 81, 181, 0.15), rgba(103, 58, 183, 0.2));
  border-color: rgba(103, 58, 183, 0.35);
  color: #d7c8ff;
}

.btn-ctrl.btn-restart:hover {
  border-color: #b18dff;
  color: #f4ecff;
}

.btn-restart-retry {
  width: 100%;
  margin-top: 6px;
}

.btn-sidebar-collapse {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 5px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition:
    color var(--motion-base) ease,
    border-color var(--motion-base) ease,
    background var(--motion-base) ease,
    transform var(--motion-base) var(--motion-ease);
  letter-spacing: 0.04em;
}

.btn-sidebar-collapse:hover {
  color: var(--cyan);
  border-color: var(--border);
  background: var(--surface-2);
}

.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: rgba(0, 200, 150, 0.1);
  border: 1px solid rgba(0, 200, 150, 0.3);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--cyan);
}

.update-banner .btn-sm {
  flex-shrink: 0;
  font-size: 10px;
  padding: 2px 8px;
}

.sidebar-status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  margin-top: 8px;
  line-height: 1.4;
}

/* ─── Buttons ───────────────────────────────────────────────────────────── */

.btn-sm {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.02em;
}

.btn-sm:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.1);
}

.btn-primary {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.15), rgba(0, 212, 255, 0.25));
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--cyan);
}

.btn-primary:hover {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.2), rgba(0, 212, 255, 0.35));
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.15), inset 0 0 20px rgba(0, 212, 255, 0.05);
}

/* ─── Content Area ──────────────────────────────────────────────────────── */

.content {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 36px;
  transition: padding var(--motion-base) var(--motion-ease);
  scrollbar-gutter: stable;
}

.panel,
.card,
.item-list li,
.settings-section {
  min-width: 0;
  overflow-wrap: anywhere;
}

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

.panel-header h1 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 30px rgba(0, 212, 255, 0.15);
}

.panel-header .panel-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.03em;
  margin-left: 14px;
}

/* ─── Metrics (Overview hero) ───────────────────────────────────────────── */

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.metric:hover {
  border-color: var(--border-glow);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.05);
}

/* Subtle top-edge glow */
.metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan-glow), transparent);
}

.metric-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--cyan-bright);
  text-shadow: 0 0 20px var(--cyan-glow);
}

.metric-label {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ─── Cards ─────────────────────────────────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  position: relative;
}

.card.full {
  min-height: 200px;
}

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

.card-header h2 {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.badge {
  background: var(--cyan-dim);
  border: 1px solid rgba(0, 212, 255, 0.15);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  padding: 2px 8px;
  border-radius: 999px;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.task-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* ─── Toolbars ──────────────────────────────────────────────────────────── */

.feed-toolbar {
  display: grid;
  grid-template-columns: 120px 160px minmax(140px, 1fr) auto auto;
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
}

.feed-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feed-control span {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.feed-control select,
.feed-control input[type="text"] {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text);
  padding: 7px 10px;
  transition: border-color 0.2s;
}

.feed-control select:focus,
.feed-control input[type="text"]:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.1);
}

.feed-control-check {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding-bottom: 7px;
}

.feed-control-check input {
  accent-color: var(--cyan);
}

.feed-actions, .surface-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.surface-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
}

/* ─── Item Lists ────────────────────────────────────────────────────────── */

.item-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-list li {
  padding: 11px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  background: var(--bg);
  border: 1px solid transparent;
  transition: border-color 0.2s, background 0.2s;
}

.item-list li:hover {
  border-color: var(--border);
  background: var(--surface);
}

.item-list .empty {
  color: var(--text-3);
  font-style: italic;
  text-align: center;
  padding: 28px 14px;
  font-family: var(--font-body);
}

.item-name {
  font-weight: 600;
  color: var(--text);
}

.item-detail {
  color: var(--text-3);
  font-size: 12px;
  margin-top: 3px;
}

.item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

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

.mono-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ─── Feed Items ────────────────────────────────────────────────────────── */

.feed-kind {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  padding: 2px 8px;
  background: var(--cyan-dim);
  letter-spacing: 0.03em;
}

.feed-summary {
  margin-top: 5px;
  color: var(--text-2);
}

.feed-files {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ─── Tasks ─────────────────────────────────────────────────────────────── */

.task-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.priority {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
}

.priority-critical {
  background: var(--red-dim);
  color: var(--red);
  border: 1px solid rgba(255, 23, 68, 0.2);
}

.priority-high {
  background: rgba(255, 152, 0, 0.08);
  color: #ff9800;
  border: 1px solid rgba(255, 152, 0, 0.15);
}

.priority-medium {
  background: var(--yellow-dim);
  color: var(--yellow);
  border: 1px solid rgba(255, 171, 0, 0.15);
}

.priority-low {
  background: rgba(84, 101, 128, 0.08);
  color: var(--text-3);
  border: 1px solid rgba(84, 101, 128, 0.15);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-dot.pending {
  background: var(--yellow);
  box-shadow: 0 0 6px rgba(255, 171, 0, 0.4);
}

.status-dot.claimed {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan-glow);
  animation: pulse-dot-cyan 2s ease-in-out infinite;
}

.status-dot.completed {
  background: var(--green);
  box-shadow: 0 0 6px var(--green-glow);
}

.task-complete-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.08), rgba(255, 255, 255, 0.02));
  animation: panel-enter var(--motion-base) var(--motion-ease);
}

.task-complete-panel textarea {
  min-height: 88px;
}

@keyframes pulse-dot-cyan {
  0%, 100% { box-shadow: 0 0 6px var(--cyan-glow); }
  50% { box-shadow: 0 0 14px var(--cyan-glow-strong); }
}

/* ─── Code / Paths ──────────────────────────────────────────────────────── */

.lock-path {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
}

.lock-agent {
  color: var(--text-2);
  font-weight: 600;
}

.lock-expiry {
  margin-left: auto;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ─── Scrollbar ─────────────────────────────────────────────────────────── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--cyan-glow);
}

/* ─── Scan Line Overlay (subtle) ────────────────────────────────────────── */

.app::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 9999;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 212, 255, 0.008) 2px,
    rgba(0, 212, 255, 0.008) 4px
  );
}

/* ─── Selection Color ───────────────────────────────────────────────────── */

/* ─── Agent Indicators ──────────────────────────────────────────────────── */

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

.agent-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.agent-pulse {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  animation: pulse-text 2.5s ease-in-out infinite;
}

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

/* ─── Metric Accent Colors ──────────────────────────────────────────────── */

.metric {
  position: relative;
}

.metric-icon {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 20px;
  opacity: 0.12;
  color: var(--cyan);
}

.metric[data-accent="cyan"] .metric-value { color: var(--cyan-bright); text-shadow: 0 0 20px var(--cyan-glow); }
.metric[data-accent="cyan"] .metric-icon { color: var(--cyan); }
.metric[data-accent="cyan"]::before { background: linear-gradient(90deg, transparent, var(--cyan-glow), transparent); }

.metric[data-accent="blue"] .metric-value { color: #60a5fa; text-shadow: 0 0 20px rgba(96, 165, 250, 0.3); }
.metric[data-accent="blue"] .metric-icon { color: #60a5fa; }
.metric[data-accent="blue"]::before { background: linear-gradient(90deg, transparent, rgba(96, 165, 250, 0.25), transparent); }

.metric[data-accent="purple"] .metric-value { color: #c084fc; text-shadow: 0 0 20px rgba(192, 132, 252, 0.3); }
.metric[data-accent="purple"] .metric-icon { color: #c084fc; }
.metric[data-accent="purple"]::before { background: linear-gradient(90deg, transparent, rgba(192, 132, 252, 0.25), transparent); }

.metric[data-accent="green"] .metric-value { color: var(--green); text-shadow: 0 0 20px var(--green-glow); }
.metric[data-accent="green"] .metric-icon { color: var(--green); }
.metric[data-accent="green"]::before { background: linear-gradient(90deg, transparent, rgba(0, 230, 118, 0.25), transparent); }

.metric[data-accent="red"] .metric-value { color: var(--red); text-shadow: 0 0 20px rgba(255, 23, 68, 0.3); }
.metric[data-accent="red"] .metric-icon { color: var(--red); }
.metric[data-accent="red"]::before { background: linear-gradient(90deg, transparent, rgba(255, 23, 68, 0.25), transparent); }

/* ─── Memory Explorer ───────────────────────────────────────────────────── */

.memory-search {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.memory-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-deep);
  color: var(--text);
  padding: 10px 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.memory-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 212, 255, 0.1), inset 0 0 20px rgba(0, 212, 255, 0.03);
}

.memory-input::placeholder {
  color: var(--text-3);
}

.memory-stats {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 4px;
}

.memory-item {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.memory-item-action {
  cursor: pointer;
  outline-offset: 3px;
}

.memory-item-action:hover,
.memory-item-action:focus-visible {
  border-color: var(--border-glow) !important;
  box-shadow: 0 0 16px rgba(0, 212, 255, 0.05);
}

.memory-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.memory-method {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--cyan-dim);
  color: var(--cyan);
  border: 1px solid rgba(0, 212, 255, 0.15);
}

.memory-relevance {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: var(--cyan-bright);
  margin-left: auto;
}

.memory-source {
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  line-height: 1.5;
}

.memory-excerpt {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg-deep);
  border-radius: var(--radius);
  border-left: 2px solid var(--cyan);
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.6;
  font-family: var(--font-body);
  animation: fade-in 0.3s ease;
}

.memory-expand-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  margin-top: 4px;
  letter-spacing: 0.05em;
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── Message Bubbles ───────────────────────────────────────────────────── */

.item-list li:has(.feed-summary) {
  border-left: 2px solid var(--border);
  padding-left: 16px;
}

.item-list li:has(.feed-summary):hover {
  border-left-color: var(--cyan);
}

/* ─── Empty State Enhancement ───────────────────────────────────────────── */

.item-list .empty::before {
  content: "—";
  display: block;
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--border);
  margin-bottom: 8px;
}

/* ─── Card Hover Glow ───────────────────────────────────────────────────── */

.card {
  transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
  border-color: rgba(0, 212, 255, 0.1);
}

/* ─── Selection Color ───────────────────────────────────────────────────── */

/* ─── Top Status Bar ────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  padding: 10px 0 18px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  max-height: 120px;
  overflow: hidden;
  transition:
    opacity 0.12s ease,
    border-color 0.12s ease;
}

.topbar-hidden {
  display: none;
  opacity: 0;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-bottom: 0;
  border-bottom-color: transparent;
  pointer-events: none;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
}

.topbar-path {
  color: var(--text-3);
}

.topbar-sep {
  color: var(--border);
}

.topbar-current {
  color: var(--cyan);
  font-weight: 400;
}

.topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: flex-end;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
}

.topbar-stat {
  color: var(--text-2);
  white-space: nowrap;
}

button.topbar-stat {
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
}

.topbar-label {
  color: var(--text-3);
  margin-right: 4px;
  font-size: 10px;
}

.topbar-status {
  font-weight: 400;
  letter-spacing: 0.05em;
}

.topbar-status.online {
  color: var(--green);
}

.topbar-status.warning {
  color: var(--yellow);
}

.topbar-status.offline {
  color: var(--red);
}

/* ─── System Status Strip ───────────────────────────────────────────────── */

.system-strip {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 4px;
  overflow: hidden;
}

.sys-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
}

button.sys-item {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.sys-item:hover {
  background: var(--surface-2);
}

.sys-item-disabled {
  opacity: 0.7;
  pointer-events: none;
}

.sys-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sys-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  letter-spacing: 0.03em;
}

.sys-ok {
  color: var(--green);
}

.sys-err {
  color: var(--red);
}

.sys-warn {
  color: var(--yellow);
}

/* ─── Message Bubbles ───────────────────────────────────────────────────── */

.msg-bubble {
  border-left: 2px solid var(--border) !important;
  padding-left: 16px !important;
  transition: border-color 0.2s;
}

.msg-bubble:hover {
  border-left-color: var(--cyan) !important;
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.msg-agent {
  font-weight: 700;
  font-size: 13px;
}

.msg-arrow {
  color: var(--text-3);
  font-size: 12px;
}

.msg-to {
  color: var(--text-2);
  font-weight: 600;
  font-size: 13px;
}

.msg-body {
  color: var(--text);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ─── Task Column Headers ───────────────────────────────────────────────── */

.task-columns .card:nth-child(1) .card-header h2 { color: var(--yellow); }
.task-columns .card:nth-child(2) .card-header h2 { color: var(--cyan); }
.task-columns .card:nth-child(3) .card-header h2 { color: var(--green); }

.task-columns .card:nth-child(1) { border-top: 2px solid rgba(255, 171, 0, 0.3); }
.task-columns .card:nth-child(2) { border-top: 2px solid rgba(0, 212, 255, 0.3); }
.task-columns .card:nth-child(3) { border-top: 2px solid rgba(0, 230, 118, 0.3); }

/* (duplicate feed-summary rules removed — already defined above) */

/* ─── Phase 3: Animations & Transitions ─────────────────────────────────── */

.panel-stage {
  min-height: 100%;
  position: relative;
  isolation: isolate;
}

.panel {
  transform-origin: top center;
  will-change: opacity, transform;
}

.panel-hidden {
  display: none;
}

.panel-stage[data-panel-direction="forward"] > .panel.active {
  animation: panel-slide-forward var(--motion-panel) var(--motion-ease) both;
}

.panel-stage[data-panel-direction="backward"] > .panel.active {
  animation: panel-slide-backward var(--motion-panel) var(--motion-ease) both;
}

.panel-stage[data-panel-direction] > .analytics-panel.active {
  animation-duration: var(--motion-panel);
}

.analytics-mode-panel {
  transform-origin: top center;
  animation: tab-panel-enter var(--motion-panel) var(--motion-ease) both;
  will-change: opacity, transform;
}

:root[data-cortex-reduced-motion="reduce"] .panel-stage[data-panel-direction] > .panel.active,
:root[data-cortex-effective-reduced-motion="reduce"] .panel-stage[data-panel-direction] > .panel.active,
:root[data-cortex-reduced-motion="reduce"] .panel-stage[data-panel-direction] > .analytics-panel.active,
:root[data-cortex-effective-reduced-motion="reduce"] .panel-stage[data-panel-direction] > .analytics-panel.active,
:root[data-cortex-reduced-motion="reduce"] .analytics-mode-panel,
:root[data-cortex-effective-reduced-motion="reduce"] .analytics-mode-panel,
:root[data-cortex-reduced-motion="reduce"] .metrics .metric,
:root[data-cortex-effective-reduced-motion="reduce"] .metrics .metric,
:root[data-cortex-reduced-motion="reduce"] .item-list li,
:root[data-cortex-effective-reduced-motion="reduce"] .item-list li,
:root[data-cortex-reduced-motion="reduce"] .activity-feed li,
:root[data-cortex-effective-reduced-motion="reduce"] .activity-feed li,
:root[data-cortex-effective-reduced-motion="reduce"] .coming-soon,
:root[data-cortex-reduced-motion="reduce"] .coming-soon {
  animation: none !important;
}

@keyframes panel-slide-forward {
  from {
    opacity: 0;
    transform: translate3d(18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes panel-slide-backward {
  from {
    opacity: 0;
    transform: translate3d(-18px, 0, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes tab-panel-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 8px, 0) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* Staggered metric card entrance */
.metrics .metric {
  animation: metric-enter 0.4s ease-out backwards;
}
.metrics .metric:nth-child(1) { animation-delay: 0ms; }
.metrics .metric:nth-child(2) { animation-delay: 60ms; }
.metrics .metric:nth-child(3) { animation-delay: 120ms; }
.metrics .metric:nth-child(4) { animation-delay: 180ms; }

@keyframes metric-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Staggered list item entrance */
.item-list li {
  animation: list-enter 0.2s ease-out backwards;
}
.item-list li:nth-child(1) { animation-delay: 0ms; }
.item-list li:nth-child(2) { animation-delay: 30ms; }
.item-list li:nth-child(3) { animation-delay: 60ms; }
.item-list li:nth-child(4) { animation-delay: 90ms; }
.item-list li:nth-child(5) { animation-delay: 120ms; }
.item-list li:nth-child(6) { animation-delay: 150ms; }
.item-list li:nth-child(7) { animation-delay: 180ms; }
.item-list li:nth-child(8) { animation-delay: 210ms; }
.item-list li:nth-child(n+9) { animation-delay: 240ms; }

@keyframes list-enter {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

/* Card stagger */
.overview-grid .card,
.task-columns .card {
  animation: card-enter 0.35s ease-out backwards;
}
.overview-grid .card:nth-child(1),
.task-columns .card:nth-child(1) { animation-delay: 50ms; }
.overview-grid .card:nth-child(2),
.task-columns .card:nth-child(2) { animation-delay: 120ms; }
.task-columns .card:nth-child(3) { animation-delay: 190ms; }

@keyframes card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Metric hover lift */
.metric {
  transition: border-color 0.3s, box-shadow 0.3s, transform 0.2s;
}

.metric:hover {
  transform: translateY(-2px);
  border-color: var(--border-glow);
  box-shadow: 0 4px 24px rgba(0, 212, 255, 0.06), 0 0 20px rgba(0, 212, 255, 0.04);
}

/* Nav item smooth transitions */
.nav-item {
  transform-origin: left center;
}

/* Button press effect */
.btn-sm:active {
  transform: scale(0.96);
}

.btn-primary:active {
  transform: scale(0.96);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.2), inset 0 0 30px rgba(0, 212, 255, 0.08);
}

/* Card items hover glow */
.item-list li {
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
}

.item-list li:hover:not(.empty) {
  transform: translateX(2px);
  box-shadow: -2px 0 12px rgba(0, 212, 255, 0.04);
}

/* System strip item hover */
.sys-item {
  transition: background 0.2s, transform 0.15s;
}

.sys-item:hover {
  transform: translateY(-1px);
}

/* Sparkline draw animation */
.sparkline polyline {
  stroke-dasharray: 1000;
  stroke-dashoffset: 1000;
  animation: draw-line 1.5s ease-out forwards;
}

.sparkline polygon {
  animation: fade-in 1s ease-out 0.5s backwards;
}

@keyframes draw-line {
  to { stroke-dashoffset: 0; }
}

/* Badge pulse on update */
.badge {
  transition: background 0.3s, transform 0.2s;
}

/* Memory search input glow pulse when focused */
.memory-input:focus {
  animation: input-glow 2s ease-in-out infinite;
}

@keyframes input-glow {
  0%, 100% { box-shadow: 0 0 12px rgba(0, 212, 255, 0.1), inset 0 0 12px rgba(0, 212, 255, 0.02); }
  50% { box-shadow: 0 0 20px rgba(0, 212, 255, 0.15), inset 0 0 20px rgba(0, 212, 255, 0.04); }
}

/* Online pill glow pulse (enhanced) */
.pill.online {
  animation: pill-glow 3s ease-in-out infinite;
}

@keyframes pill-glow {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 12px rgba(0, 230, 118, 0.15); }
}

/* Smooth scrollbar appearance */
.content {
  scroll-behavior: smooth;
}

/* Loading shimmer for empty metric values */
.metric-value:empty::after {
  content: "---";
  color: var(--text-3);
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Coming soon floating icon */
.coming-soon {
  animation: panel-enter 0.4s ease-out;
}

/* Feed left-border transition */
.item-list li:has(.feed-summary),
.msg-bubble {
  transition: border-left-color 0.2s ease;
}

/* ─── Keyboard Hint ─────────────────────────────────────────────────────── */

.nav-item::after {
  content: attr(data-key);
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  opacity: 0;
  transition: opacity 0.15s;
}

.sidebar:hover .nav-item::after {
  opacity: 0.5;
}

/* ─── Selection Color ───────────────────────────────────────────────────── */

/* ─── Sparkline Charts ──────────────────────────────────────────────────── */

.sparkline {
  display: block;
  width: 100%;
  margin: 8px 0;
}

.analytics-explainer {
  padding: 14px 18px;
  margin-bottom: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.7;
}

.analytics-inline-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.analytics-inline-control select {
  min-width: 84px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-family: var(--font-mono);
  font-size: 11px;
}

.analytics-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.sparkline-empty {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  padding: 20px 0;
  text-align: center;
}

.chart-legend {
  display: flex;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.chart-day {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.chart-day-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
}

.chart-day-value {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}

.operation-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.operation-bar-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.operation-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.operation-bar-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.operation-bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), rgba(0, 212, 255, 0.4));
}

.activity-heatmap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.activity-heatmap-row {
  display: grid;
  grid-template-columns: 30px 1fr;
  align-items: center;
  gap: 8px;
}

.activity-heatmap-day {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}

.activity-heatmap-cells {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  gap: 2px;
}

.activity-heatmap-cell {
  height: 12px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Analytics redesign */

.analytics-panel-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.analytics-loading-card {
  min-height: 240px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analytics-header-copy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 780px;
}

.analytics-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.analytics-header-copy h1 {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.08;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-shadow: 0 0 32px rgba(0, 212, 255, 0.08);
}

.analytics-header-copy p {
  max-width: 700px;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.7;
}

.analytics-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.analytics-toolbar .panel-subtitle {
  margin-left: 0;
}

.analytics-metrics-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.analytics-metric-legend {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.analytics-assumption-note {
  margin-bottom: 14px;
  padding: 8px 12px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 230, 118, 0.22);
  background: linear-gradient(180deg, rgba(0, 230, 118, 0.09), rgba(7, 13, 22, 0.88));
  color: rgba(176, 255, 211, 0.96);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.03em;
  line-height: 1.45;
}

.analytics-metric-legend-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 212, 255, 0.14);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(11, 19, 30, 0.9), rgba(8, 15, 24, 0.88));
}

.analytics-metric-legend-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(147, 220, 255, 0.92);
}

.analytics-metric-legend-value {
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
}

.analytics-metrics-grid .metric {
  min-height: 178px;
  display: grid;
  grid-template-rows: auto minmax(42px, auto) minmax(30px, auto) minmax(40px, auto);
  gap: 8px;
  padding: 20px 20px 18px;
  justify-items: center;
  align-content: start;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(18, 27, 41, 0.96), rgba(11, 17, 28, 0.96)),
    var(--surface);
}

.analytics-metrics-grid .metric-featured {
  background:
    radial-gradient(circle at top left, rgba(0, 212, 255, 0.14), transparent 50%),
    linear-gradient(180deg, rgba(17, 29, 44, 0.98), rgba(10, 17, 27, 0.98));
  border-color: rgba(0, 212, 255, 0.22);
}

.metric-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.analytics-metrics-grid .metric-value {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
}

.metric-footnote {
  margin-top: 0;
  min-height: 40px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  text-align: center;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.5;
}

.analytics-metrics-grid .metric-label {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.analytics-metrics-grid .metric-icon {
  opacity: 0;
  font-size: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

.analytics-explainer-rich {
  margin-bottom: 18px;
  padding: 18px 20px;
  background:
    linear-gradient(180deg, rgba(13, 22, 34, 0.98), rgba(10, 17, 27, 0.96)),
    var(--surface);
  border-color: rgba(0, 212, 255, 0.16);
  border-left: 1px solid rgba(0, 212, 255, 0.28);
}

.analytics-explainer-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.analytics-stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.analytics-stat-strip-tight {
  margin-top: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.analytics-stat-chip {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.02);
}

.analytics-stat-chip-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.analytics-stat-chip strong {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
  letter-spacing: 0.02em;
}

.analytics-stage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.analytics-card-span-2 {
  grid-column: span 2;
}

.analytics-hero-card,
.analytics-chart-card,
.analytics-heatmap-card,
.analytics-list-card,
.analytics-operations-card {
  background:
    linear-gradient(180deg, rgba(12, 18, 29, 0.98), rgba(9, 14, 22, 0.96)),
    var(--surface);
  border-color: rgba(38, 56, 84, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.015);
}

.analytics-hero-card {
  padding: 20px 20px 18px;
  overflow: hidden;
}

.analytics-chart-card {
  min-height: 100%;
}

.analytics-card-header-tight {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.analytics-card-header-tight h2 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}

.analytics-card-kicker {
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.chart-summary {
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 14px;
}

.analytics-inline-note {
  margin: 12px 0 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.6;
}

.analytics-secondary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.sparkline-tall {
  min-height: 120px;
}

.sparkline-grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.sparkline-line {
  filter: drop-shadow(0 0 12px rgba(0, 212, 255, 0.14));
}

.sparkline-area {
  opacity: 0.95;
}

.sparkline-end-dot {
  filter: drop-shadow(0 0 8px currentColor);
}

.projection-chart {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 4px;
}

.projection-grid-line {
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1;
}

.projection-grid-line-vertical {
  stroke-dasharray: 2 8;
}

.projection-band-wide {
  fill: url(#projectionBandWide);
}

.projection-band-core {
  fill: url(#projectionBandCore);
}

.projection-sample {
  fill: none;
  stroke: rgba(79, 124, 255, 0.18);
  stroke-width: 1.1;
  animation: projection-trace 1400ms ease-out both;
}

.projection-line {
  fill: none;
  stroke: #48e8b2;
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(72, 232, 178, 0.22));
}

.projection-end-halo {
  fill: rgba(72, 232, 178, 0.2);
}

.projection-end-dot {
  fill: #48e8b2;
}

.projection-annotation,
.projection-axis-label {
  font-family: var(--font-mono);
  font-size: 10px;
  fill: var(--text-2);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.projection-annotation-high {
  fill: #7aa6ff;
}

.projection-annotation-low {
  fill: #59d7ff;
}

@keyframes projection-trace {
  from {
    opacity: 0;
    transform: translateY(3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.analytics-heatmap-card {
  margin-top: 14px;
}

.heatmap-legend-scale {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.heatmap-legend-bar {
  width: 78px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(67, 234, 255, 0.18), rgba(58, 109, 255, 0.95));
}

.analytics-heatmap-card .activity-heatmap {
  gap: 8px;
}

.analytics-heatmap-card .activity-heatmap-row {
  grid-template-columns: 36px 1fr;
}

.analytics-heatmap-card .activity-heatmap-cell {
  height: 14px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.02);
}

.analytics-lists-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
  align-items: start;
}

.analytics-list-card {
  min-height: 100%;
}

.analytics-list {
  gap: 10px;
}

.analytics-list-card .item-list li {
  background: rgba(255, 255, 255, 0.015);
}

.analytics-panel .item-list li,
.analytics-panel .metric {
  animation: none;
}

.analytics-operations-card {
  margin-top: 14px;
}

.analytics-operations-card .operation-bars {
  gap: 12px;
}

.analytics-operations-card .operation-bar-row {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.018);
}

.analytics-operations-card .operation-bar-track {
  height: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.analytics-operations-card .operation-bar-fill {
  background: linear-gradient(90deg, #59d7ff 0%, #4f7cff 45%, #48e8b2 100%);
  box-shadow: 0 0 14px rgba(89, 215, 255, 0.2);
}

.editor-setup-panel {
  margin: 16px 0 18px;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 212, 255, 0.14);
  background:
    linear-gradient(180deg, rgba(12, 19, 31, 0.98), rgba(9, 14, 23, 0.96)),
    var(--surface);
}

.editor-setup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.editor-setup-header h2 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.editor-setup-kicker {
  display: inline-block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.editor-setup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.editor-setup-item {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.015);
}

.editor-setup-item.ok {
  border-color: rgba(72, 232, 178, 0.28);
}

.editor-setup-item.warn {
  border-color: rgba(255, 171, 0, 0.3);
}

.editor-setup-item.idle {
  border-color: rgba(90, 111, 138, 0.24);
}

.editor-setup-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.editor-setup-name,
.editor-setup-state {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.editor-setup-name {
  color: var(--text);
}

.editor-setup-state {
  color: var(--text-3);
}

.editor-setup-item p {
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.6;
}

.editor-setup-dialog {
  width: min(720px, 94vw);
  max-height: min(82vh, 860px);
  overflow: auto;
}

.editor-setup-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.editor-setup-choice-list {
  display: grid;
  gap: 12px;
}

.editor-setup-choice {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
}

.editor-setup-choice.ok {
  border-color: rgba(72, 232, 178, 0.24);
}

.editor-setup-choice.warn {
  border-color: rgba(255, 171, 0, 0.26);
}

.editor-setup-choice.idle {
  border-color: rgba(90, 111, 138, 0.22);
}

.editor-setup-choice.disabled {
  opacity: 0.72;
}

.editor-setup-choice input {
  margin-top: 2px;
}

.editor-setup-choice-body {
  min-width: 0;
}

.editor-setup-choice-body code {
  display: block;
  margin-bottom: 8px;
  color: var(--cyan);
  word-break: break-all;
}

.editor-setup-choice-body p {
  margin: 0;
}

.editor-setup-manual {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.editor-setup-manual p {
  margin: 0 0 10px;
  color: var(--text-2);
}

.editor-setup-manual pre {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1500px) {
  .analytics-metric-legend {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .analytics-metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-featured {
    grid-column: span 3;
  }

  .analytics-secondary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .analytics-metric-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .analytics-toolbar {
    justify-content: flex-start;
  }

  .analytics-stage-grid,
  .analytics-secondary-grid,
  .analytics-lists-grid {
    grid-template-columns: 1fr;
  }

  .analytics-card-span-2 {
    grid-column: auto;
  }

  .analytics-stat-strip,
  .analytics-stat-strip-tight {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .analytics-metric-legend {
    grid-template-columns: 1fr;
  }

  .analytics-header-copy h1 {
    font-size: 28px;
  }

  .analytics-metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-featured {
    grid-column: auto;
  }

  .analytics-stat-strip,
  .analytics-stat-strip-tight {
    grid-template-columns: 1fr;
  }
}

.about-lifecycle-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.about-lifecycle-table th,
.about-lifecycle-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  font-size: 12px;
}

.about-lifecycle-table th {
  font-family: var(--font-mono);
  color: var(--text-3);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.about-lifecycle-table tr:last-child td {
  border-bottom: none;
}

/* ─── Coming Soon ───────────────────────────────────────────────────────── */

.coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  text-align: center;
  gap: 16px;
}

.coming-icon {
  font-size: 64px;
  color: var(--cyan);
  opacity: 0.2;
  filter: drop-shadow(0 0 30px var(--cyan-glow));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.coming-soon h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--cyan);
  opacity: 0.6;
}

.coming-soon p {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text-3);
  max-width: 500px;
  line-height: 1.7;
}

/* ─── Selection Color ───────────────────────────────────────────────────── */

/* ─── Brain Visualizer ──────────────────────────────────────────────────── */

.brain-panel {
  padding: 0 !important;
  margin: -28px -36px;
  overflow: hidden;
}

.brain-panel .panel-header {
  display: none;
}

.brain-container {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(0, 212, 255, 0.035), transparent 30%),
    radial-gradient(circle at center, rgba(64, 224, 255, 0.07), transparent 42%),
    #040812;
}

.brain-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 16px;
  padding: 24px 20px;
  box-sizing: border-box;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 13px;
  text-align: center;
}

.brain-loading p {
  margin: 0;
  max-width: min(100%, 32rem);
  line-height: 1.6;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.brain-hud {
  position: absolute;
  top: 16px;
  left: 16px;
  display: flex;
  gap: 20px;
  z-index: 10;
  padding: 10px 16px;
  background: rgba(6, 10, 18, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
}

.brain-stat {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text);
}

.brain-stat-flow {
  color: var(--cyan-bright);
}

@media (max-width: 640px) {
  .brain-panel {
    margin: -20px -20px 0;
  }

  .brain-loading {
    min-height: 50vh;
    padding: 24px 16px;
  }
}

.brain-label {
  color: var(--text-3);
  font-size: 10px;
  margin-right: 5px;
  letter-spacing: 0.06em;
}

.brain-tooltip {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  padding: 14px 18px;
  background: rgba(6, 10, 18, 0.92);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(12px);
  max-width: 320px;
  animation: fade-in 0.15s ease-out;
}

.brain-tooltip-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.brain-tooltip-label {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 4px;
}

.brain-tooltip-agent {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}

.brain-fallback-container {
  padding: 24px;
  overflow-y: auto;
}

.brain-hud-fallback {
  position: relative;
  margin-bottom: 16px;
}

.brain-fallback-reason {
  margin-left: auto;
  color: var(--yellow);
  font-size: 11px;
}

.brain-node-fallback-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brain-node-fallback {
  max-width: 280px;
  padding: 8px 12px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brain-node-agent-color, var(--cyan));
}

.brain-node-fallback[aria-pressed="true"] {
  background: var(--cyan-dim);
  border-color: var(--border-glow);
  border-left-color: var(--brain-node-agent-color, var(--cyan-bright));
}

.brain-node-fallback-label {
  color: var(--text);
  font-weight: 600;
}

.brain-node-fallback-meta {
  color: var(--text-3);
  font-size: 11px;
}

.brain-detail-fixed {
  position: fixed;
}

.brain-tooltip-ctx {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  font-family: var(--font-body);
}

.brain-legend {
  position: absolute;
  right: 16px;
  bottom: 72px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 16px;
  z-index: 10;
  padding: 8px 14px;
  background: rgba(6, 10, 18, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  max-width: min(420px, calc(100% - 32px));
}

.brain-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
  text-transform: capitalize;
}

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

@media (max-width: 720px) {
  .brain-legend {
    left: 12px;
    right: 12px;
    bottom: 96px;
    justify-content: flex-start;
    gap: 8px 12px;
    padding: 8px 10px;
    max-width: none;
  }

  .brain-legend-item {
    font-size: 10px;
  }
}

/* ─── Brain Detail Panel ────────────────────────────────────────────────── */

.brain-detail {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 10;
  width: 340px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  padding: 20px;
  background: rgba(6, 10, 18, 0.94);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  animation: detail-enter 0.25s ease-out;
}

@keyframes detail-enter {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

.brain-detail-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.brain-detail-close:hover {
  color: var(--text);
  background: var(--surface-2);
}

.brain-detail-type {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.brain-detail-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.5;
  margin-bottom: 6px;
}

.brain-detail-agent {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.brain-detail-text {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.7;
  padding: 12px;
  background: var(--bg);
  border-radius: var(--radius);
  border-left: 2px solid var(--cyan);
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.brain-detail-ctx {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.5;
  margin-bottom: 10px;
}

.brain-detail-ctx-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.brain-detail-meta {
  display: flex;
  gap: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ─── Brain Toggle Button ───────────────────────────────────────────────── */

.brain-toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.04em;
}

.brain-toggle:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.brain-toggle.active {
  background: var(--cyan-dim);
  border-color: rgba(0, 212, 255, 0.3);
  color: var(--cyan);
}

/* 2026-04 UI rewrite overrides */

.sidebar-nav {
  flex: 0 0 auto;
}

.sidebar-utility {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-utility-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-utility-kicker,
.sidebar-utility-note-label,
.overview-summary-label,
.overview-stack-title,
.surface-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-utility-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-utility-pill.online {
  color: var(--green);
  border-color: rgba(0, 230, 118, 0.22);
  background: rgba(0, 230, 118, 0.08);
}

.sidebar-utility-pill.offline {
  color: var(--red);
  border-color: rgba(255, 23, 68, 0.22);
  background: rgba(255, 23, 68, 0.08);
}

.sidebar-utility-pill.starting {
  color: var(--yellow);
  border-color: rgba(255, 171, 0, 0.22);
  background: rgba(255, 171, 0, 0.08);
}

.sidebar-utility-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sidebar-utility-card,
.overview-summary-card,
.surface-stat-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.025);
}

.sidebar-utility-label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-utility-value,
.overview-summary-card strong,
.surface-stat-card strong {
  font-family: var(--font-display);
  font-size: 18px;
  color: var(--text);
}

.sidebar-utility-card.tone-cyan .sidebar-utility-value {
  color: var(--cyan);
}

.sidebar-utility-card.tone-green .sidebar-utility-value,
.sidebar-utility-card.tone-calm .sidebar-utility-value {
  color: var(--green);
}

.sidebar-utility-card.tone-warning .sidebar-utility-value {
  color: var(--yellow);
}

.sidebar-utility-card.tone-danger .sidebar-utility-value {
  color: var(--red);
}

.sidebar-utility-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(0, 212, 255, 0.08), rgba(255, 255, 255, 0.02));
  border: 1px solid rgba(0, 212, 255, 0.12);
}

.sidebar-utility-note strong {
  font-size: 15px;
  color: var(--text);
}

.sidebar-utility-note p {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.sidebar-utility-alert {
  color: var(--yellow) !important;
}

.sidebar-footer {
  margin-top: 0;
}

.overview-panel-header {
  align-items: flex-end;
}

.overview-panel-header .panel-subtitle {
  margin-left: 0;
  margin-top: 8px;
}

.overview-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.overview-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.overview-span-2 {
  grid-column: span 2;
}

.overview-hero-card {
  background:
    radial-gradient(circle at top left, rgba(0, 212, 255, 0.14), transparent 46%),
    linear-gradient(180deg, rgba(17, 26, 38, 0.98), rgba(10, 16, 27, 0.96));
}

.overview-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.overview-summary-card span:last-child {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}

.overview-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.overview-hero-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.overview-unit-strip {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.overview-unit-strip-title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-2);
  margin-right: 4px;
}

.overview-unit-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  background: rgba(8, 16, 29, 0.55);
}

.overview-unit-chip code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}

.overview-unit-chip span {
  font-size: 11px;
  color: var(--text-2);
}

.overview-metric-legend {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 212, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(8, 16, 29, 0.78);
}

.overview-metric-legend-title {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cyan);
  margin-bottom: 8px;
}

.overview-metric-legend p {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.overview-metric-legend ul {
  margin: 0;
  padding-left: 16px;
  display: grid;
  gap: 5px;
}

.overview-metric-legend li {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.45;
}

.overview-metric-legend code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
}

.overview-status-card .btn-sm {
  margin-top: 12px;
}

.overview-status-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.overview-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.overview-status-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.overview-status-row span {
  color: var(--text-2);
}

.overview-status-row strong {
  font-family: var(--font-display);
  color: var(--text);
}

.overview-dual-stack,
.memory-side-stack,
.work-side-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.compact-list {
  gap: 8px;
}

.compact-list li {
  padding: 10px 12px;
}

.surface-grid {
  display: grid;
  gap: 14px;
}

.agents-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr);
}

.agents-card-span-2 {
  grid-column: span 2;
}

.surface-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.95fr);
  gap: 14px;
  align-items: start;
}

.work-task-columns {
  height: 100%;
}

.work-feed-toolbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.memory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
  gap: 14px;
  align-items: start;
}

.memory-conflicts-section {
  margin-top: 18px;
}

.panel-header-inline {
  margin-bottom: 14px;
}

.panel-header-inline h2 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analytics-health-card {
  display: flex;
  flex-direction: column;
}

.analytics-quality-strip {
  margin-top: auto;
}

.projection-baseline {
  stroke: rgba(72, 232, 178, 0.28);
  stroke-width: 1.2;
}

.projection-summary-panel {
  fill: rgba(7, 13, 24, 0.82);
  stroke: rgba(79, 124, 255, 0.28);
  stroke-width: 1;
}

.brain-panel {
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.08), transparent 36%),
    radial-gradient(circle at 78% 14%, rgba(79, 124, 255, 0.08), transparent 32%),
    #060a12;
}

.brain-container::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at center, rgba(255, 255, 255, 0.02), transparent 48%),
    repeating-radial-gradient(circle at center, rgba(0, 212, 255, 0.04) 0, rgba(0, 212, 255, 0.04) 1px, transparent 1px, transparent 48px);
  opacity: 0.7;
}

.brain-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    linear-gradient(rgba(64, 224, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(64, 224, 255, 0.035) 1px, transparent 1px);
  background-size: 86px 86px;
  -webkit-mask-image: radial-gradient(circle at center, #000 0 46%, transparent 72%);
  mask-image: radial-gradient(circle at center, #000 0 46%, transparent 72%);
  opacity: 0.34;
}

.brain-orbital-ring {
  position: absolute;
  pointer-events: none;
  z-index: 2;
}

.brain-orbital-ring {
  left: 50%;
  top: 50%;
  width: min(76vw, 860px);
  aspect-ratio: 1;
  border: 1px solid rgba(64, 224, 255, 0.2);
  border-radius: 50%;
  box-shadow:
    inset 0 0 24px rgba(64, 224, 255, 0.08),
    0 0 26px rgba(64, 224, 255, 0.06);
  transform: translate(-50%, -50%) rotateX(64deg) rotateZ(8deg);
  opacity: 0.58;
}

.brain-orbital-ring-b {
  width: min(58vw, 640px);
  border-color: rgba(255, 171, 0, 0.16);
  transform: translate(-50%, -50%) rotateX(68deg) rotateZ(-18deg);
}

.brain-hud {
  border-color: rgba(0, 212, 255, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 18px 44px rgba(0, 0, 0, 0.24);
}

.brain-hud-primary {
  top: 18px;
  left: 18px;
  right: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 420px;
  min-height: 112px;
  padding: 14px 18px 18px;
}

.brain-hud-secondary {
  top: 140px;
  left: 18px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
}

.brain-hud-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brain-mode {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--cyan);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.brain-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.brain-hud-copy p {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.5;
}

.brain-hud-secondary .brain-toggle {
  margin-left: auto;
}

.brain-tooltip,
.brain-detail {
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

.brain-flow-panel {
  margin: 14px 0 12px;
  padding: 12px;
  border: 1px solid rgba(64, 224, 255, 0.18);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(64, 224, 255, 0.06), rgba(4, 8, 18, 0.52)),
    rgba(6, 10, 18, 0.72);
}

.brain-flow-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

.brain-flow-head strong {
  color: var(--cyan-bright);
  font-weight: 600;
  text-align: right;
}

.brain-flow-list {
  display: grid;
  gap: 7px;
}

.brain-flow-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid rgba(85, 112, 144, 0.28);
  border-radius: 5px;
  background: rgba(6, 10, 18, 0.72);
}

.brain-flow-direction,
.brain-flow-type,
.brain-flow-node {
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 10px;
}

.brain-flow-direction {
  color: var(--yellow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.brain-flow-direction.outbound {
  color: var(--cyan-bright);
}

.brain-flow-node {
  overflow: hidden;
  color: var(--text-2);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brain-flow-type {
  color: var(--text-3);
  text-align: right;
  text-transform: uppercase;
}

.brain-flow-empty {
  margin: 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}

.settings-panel {
  max-width: 1220px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.settings-section {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--cyan-dim), transparent 46%),
    var(--surface);
}

.settings-section-wide {
  grid-column: 1 / -1;
}

.settings-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.settings-section-head h2 {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.settings-section-head svg {
  color: var(--cyan);
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 42px;
}

.settings-row span {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-row strong,
.settings-status-grid strong {
  min-width: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  word-break: break-word;
}

.settings-row small {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.35;
}

.settings-row select {
  min-width: 150px;
  max-width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 10px;
}

.settings-row input[type="checkbox"] {
  width: 24px;
  height: 24px;
  min-width: 24px;
  min-height: 24px;
  accent-color: var(--cyan);
}

.settings-panel :is(button, input, select, a):focus-visible {
  outline: 2px solid var(--cyan-bright);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--cyan-dim);
}

.settings-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.settings-status-grid > div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  background: var(--bg-deep);
}

.settings-label {
  display: block;
  margin-bottom: 4px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.settings-budget-pill {
  margin-left: auto;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
}

.settings-budget-pill.enforced {
  color: var(--green);
  border-color: var(--green);
  background: var(--green-dim);
}

.settings-budget-pill.invalid {
  color: var(--red);
  border-color: var(--red);
  background: var(--red-dim);
}

.settings-budget-pill.disabled {
  color: var(--yellow);
  border-color: var(--yellow);
  background: var(--yellow-dim);
}

.settings-budget-pill.unlimited {
  color: var(--text-2);
  border-color: var(--border);
  background: var(--surface-2);
}

.settings-error {
  padding: 9px 11px;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  background: var(--red-dim);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 12px;
}

.settings-budget-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
}

.settings-budget-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  table-layout: fixed;
}

.settings-budget-table th,
.settings-budget-table td {
  padding: 9px 11px;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: left;
  word-break: break-word;
  border-top: 1px solid var(--border-subtle);
}

.settings-budget-table thead th {
  color: var(--text);
  background: var(--cyan-dim);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.settings-budget-table thead tr:first-child th {
  border-top: none;
}

.settings-budget-editor {
  display: grid;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.settings-budget-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-budget-defaults {
  flex: 1;
}

.settings-budget-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.settings-budget-edit-grid {
  display: grid;
  gap: 8px;
}

.settings-budget-edit-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) minmax(120px, 1fr) minmax(120px, 1fr);
  align-items: end;
  gap: 10px;
  margin: 0;
  padding: 10px 0 0;
  border: 0;
  border-top: 1px solid var(--border-subtle);
}

.settings-budget-edit-row:first-child {
  border-top: none;
}

.settings-budget-edit-row legend {
  padding: 0 0 6px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
}

.settings-budget-enable,
.settings-budget-input {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.settings-budget-enable {
  flex-direction: row;
  align-items: center;
  min-height: 36px;
}

.settings-budget-enable input {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  accent-color: var(--cyan);
}

.settings-budget-enable span,
.settings-budget-input span,
.settings-budget-note {
  color: var(--text-3);
  font-size: 11px;
  line-height: 1.35;
}

.settings-budget-input input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 10px;
}

.settings-budget-input input:disabled {
  color: var(--text-3);
  border-color: var(--border-subtle);
  opacity: 0.72;
}

.settings-budget-note {
  margin: 0;
}

.settings-shortcut-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.settings-shortcut-grid span {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

kbd {
  min-width: 22px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-deep);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
}

.sidebar.collapsed .sidebar-utility {
  gap: 10px;
}

.sidebar.collapsed .sidebar-utility-header,
.sidebar.collapsed .sidebar-utility-note p,
.sidebar.collapsed .sidebar-utility-note strong,
.sidebar.collapsed .sidebar-utility-note-label,
.sidebar.collapsed .sidebar-utility-label {
  display: none;
}

.sidebar.collapsed .sidebar-utility-grid {
  grid-template-columns: 1fr;
}

.sidebar.collapsed .sidebar-utility-card {
  align-items: center;
  padding: 10px 6px;
}

.sidebar.collapsed .sidebar-utility-value {
  font-size: 14px;
}

.sidebar.collapsed .sidebar-utility-note {
  padding: 8px 6px;
  align-items: center;
}

@media (max-width: 1440px) {
  .overview-metrics,
  .surface-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .overview-dashboard-grid,
  .agents-grid,
  .work-grid,
  .memory-layout {
    grid-template-columns: 1fr;
  }

  .overview-span-2,
  .agents-card-span-2 {
    grid-column: auto;
  }
}

@media (max-width: 920px) {
  .overview-metrics,
  .overview-summary-grid,
  .surface-stat-grid,
  .work-feed-toolbar,
  .settings-grid,
  .settings-status-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    max-height: 180px;
    padding: 8px 0 14px;
  }

  .topbar-right {
    width: 100%;
    gap: 10px 12px;
    justify-content: flex-start;
  }

  .topbar-connection {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .content {
    padding: 20px 14px;
  }

  .panel-header,
  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .panel-header .panel-subtitle {
    display: block;
    margin-left: 0;
    margin-top: 6px;
    max-width: 100%;
  }

  .surface-toolbar,
  .feed-toolbar,
  .work-feed-toolbar {
    grid-template-columns: minmax(0, 1fr);
  }

  .surface-actions,
  .feed-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .work-operator-toolbar .surface-inline-hint {
    width: 100%;
  }

  .surface-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-section {
    padding: 14px;
  }

  .settings-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .settings-row select {
    width: 100%;
  }

  .settings-budget-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .settings-budget-actions {
    justify-content: flex-start;
  }

  .settings-budget-edit-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .settings-shortcut-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-budget-table-wrap {
    overflow-x: visible;
  }

  .settings-budget-table {
    min-width: 0;
  }

  .settings-budget-table thead {
    display: none;
  }

  .settings-budget-table tr {
    display: block;
    border-top: 1px solid var(--border-subtle);
  }

  .settings-budget-table tbody tr:first-child {
    border-top: none;
  }

  .settings-budget-table th,
  .settings-budget-table td {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
    padding: 7px 10px;
    border-top: none;
  }

  .settings-budget-table [data-label]::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .task-top,
  .item-meta {
    flex-wrap: wrap;
  }
}

/* ─── Collapsible Sidebar ───────────────────────────────────────────────── */

.sidebar {
  overflow: hidden;
  position: relative;
}

.btn-danger {
  background: var(--red-dim);
  border-color: rgba(255, 23, 68, 0.2);
  color: var(--red);
}

.btn-danger:hover {
  background: rgba(255, 23, 68, 0.15);
  border-color: var(--red);
  color: var(--red);
  box-shadow: 0 0 12px rgba(255, 23, 68, 0.1);
}

.btn-collapse {
  width: 100%;
  text-align: center;
  color: var(--text-3);
  font-size: 11px;
}

.btn-collapse:hover {
  color: var(--cyan);
}

.app.sidebar-collapsed {
  grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr);
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
  padding: 18px 8px;
}

.sidebar.collapsed .sidebar-header {
  justify-content: center;
  padding: 0 0 16px;
}

.sidebar.collapsed .logo span,
.sidebar.collapsed .pill,
.sidebar.collapsed .sidebar-status,
.sidebar.collapsed .daemon-controls {
  display: none;
}

.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 9px 0;
  font-size: 0;
}

.sidebar.collapsed .nav-item span {
  font-size: 16px !important;
  opacity: 0.7 !important;
}

.sidebar.collapsed .nav-item::after {
  display: none;
}

.sidebar.collapsed .nav-item.active span {
  opacity: 1 !important;
}

.sidebar.collapsed .nav-item.active::before {
  left: -6px;
}

.sidebar.collapsed .sidebar-footer .daemon-controls-grid,
.sidebar.collapsed .sidebar-footer .daemon-restart-row,
.sidebar.collapsed .sidebar-footer .btn-restart-retry,
.sidebar.collapsed .sidebar-footer .sidebar-status,
.sidebar.collapsed .sidebar-footer .update-banner {
  display: none;
}

.sidebar.collapsed .btn-sidebar-collapse {
  font-size: 14px;
  padding: 8px 0;
}

.sidebar.collapsed .sidebar-collapse-btn {
  right: -1px;
  top: 20px;
}

@media (max-width: 480px) {
  .app,
  .app.sidebar-collapsed {
    grid-template-columns: var(--sidebar-collapsed-w) minmax(0, 1fr);
  }

  .sidebar {
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .content {
    padding: 16px 10px;
  }

  .topbar {
    gap: 8px;
    max-height: none;
    overflow: visible;
  }

  .topbar-right {
    gap: 8px;
  }

  .topbar-stat {
    white-space: normal;
  }

  .panel-header h1,
  .analytics-header-copy h1 {
    font-size: 20px;
    line-height: 1.2;
  }

  .metric {
    padding: 14px;
  }

  .metric-value {
    font-size: 24px;
  }

  .overview-metrics,
  .overview-dashboard-grid,
  .overview-summary-grid,
  .surface-stat-grid,
  .task-columns,
  .work-grid,
  .work-feed-toolbar,
  .memory-layout,
  .agents-grid,
  .analytics-metrics-grid,
  .analytics-metric-legend,
  .analytics-stage-grid,
  .analytics-secondary-grid,
  .analytics-lists-grid,
  .analytics-stat-strip,
  .analytics-stat-strip-tight,
  .settings-grid,
  .settings-status-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .overview-span-2,
  .agents-card-span-2,
  .analytics-card-span-2,
  .metric-featured {
    grid-column: auto;
  }

  .overview-hero-actions,
  .overview-hero-meta,
  .surface-actions,
  .feed-actions,
  .analytics-toolbar,
  .analytics-view-toggle,
  .permission-actions {
    align-items: stretch;
    justify-content: flex-start;
  }

  .analytics-toolbar,
  .analytics-view-toggle {
    display: flex;
    flex-direction: column;
    width: 100%;
  }

  .analytics-view-toggle .btn-sm,
  .surface-actions .btn-sm,
  .feed-actions .btn-sm,
  .permission-actions .btn-sm {
    width: 100%;
  }

  .settings-shortcut-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-budget-table th,
  .settings-budget-table td {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .brain-panel {
    margin: -16px -10px 0;
  }

  .brain-hud,
  .brain-hud-primary,
  .brain-hud-secondary {
    left: 10px;
    right: 10px;
    max-width: none;
  }

  .brain-hud-secondary {
    top: 154px;
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .brain-hud-secondary .brain-toggle {
    margin-left: 0;
    width: 100%;
  }

  .brain-detail,
  .brain-tooltip {
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
  }

  .brain-legend {
    left: 10px;
    right: 10px;
  }
}

/* ─── Connection Dialog ────────────────────────────────────────────────── */

.topbar-connection {
  cursor: pointer;
  border-radius: var(--radius);
  padding: 2px 6px;
  transition: background 0.15s;
  color: var(--text-2);
}

.topbar-connection:hover {
  background: var(--bg-3);
}

.connection-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.15s ease-out;
}

.connection-dialog {
  background: var(--bg-2);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  width: 380px;
  max-width: 90vw;
}

.connection-dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

@media (prefers-reduced-motion: reduce) {
  :root:not([data-cortex-reduced-motion="full"]) .app,
  :root:not([data-cortex-reduced-motion="full"]) .sidebar,
  :root:not([data-cortex-reduced-motion="full"]) .content,
  :root:not([data-cortex-reduced-motion="full"]) .topbar,
  :root:not([data-cortex-reduced-motion="full"]) .nav-item,
  :root:not([data-cortex-reduced-motion="full"]) .btn-ctrl,
  :root:not([data-cortex-reduced-motion="full"]) .btn-sidebar-collapse,
  :root:not([data-cortex-reduced-motion="full"]) .task-complete-panel,
  :root:not([data-cortex-reduced-motion="full"]) .panel-stage[data-panel-direction] > .panel.active,
  :root:not([data-cortex-reduced-motion="full"]) .analytics-mode-panel,
  :root:not([data-cortex-reduced-motion="full"]) .coming-soon {
    animation: none !important;
    transition: none !important;
  }

  :root:not([data-cortex-reduced-motion="full"]) .content {
    scroll-behavior: auto;
  }

  :root:not([data-cortex-reduced-motion="full"]) *,
  :root:not([data-cortex-reduced-motion="full"]) *::before,
  :root:not([data-cortex-reduced-motion="full"]) *::after {
    scroll-behavior: auto !important;
    transition-duration: 0ms !important;
    transition-delay: 0ms !important;
    animation-duration: 0ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
  }
}

:root[data-cortex-reduced-motion="reduce"] *,
:root[data-cortex-effective-reduced-motion="reduce"] *,
:root[data-cortex-reduced-motion="reduce"] *::before,
:root[data-cortex-effective-reduced-motion="reduce"] *::before,
:root[data-cortex-effective-reduced-motion="reduce"] *::after,
:root[data-cortex-reduced-motion="reduce"] *::after {
  scroll-behavior: auto !important;
  transition-duration: 0ms !important;
  transition-delay: 0ms !important;
  animation-duration: 0ms !important;
  animation-delay: 0ms !important;
  animation-iteration-count: 1 !important;
}

.connection-dialog h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}

.connection-dialog-close {
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--text-2);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  line-height: 1;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.connection-dialog-close:hover {
  color: var(--text);
  border-color: var(--cyan);
  background: rgba(0, 255, 255, 0.08);
}

.connection-subtitle {
  font-size: 12px;
  color: var(--text-3);
  margin: 0 0 20px 0;
}

.connection-field {
  display: block;
  margin-bottom: 14px;
}

.connection-field span {
  display: block;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.connection-field input {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.connection-field input:focus {
  border-color: var(--cyan);
}

.connection-field input::placeholder {
  color: var(--text-3);
}

.connection-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─── MCP Setup Button ─────────────────────────────────────────────────── */

.sys-item-action {
  cursor: pointer;
  transition: background 0.15s;
  border-radius: var(--radius);
  padding: 4px 8px;
}

.sys-item-action:disabled {
  cursor: not-allowed;
}

.sys-item-action:hover {
  background: var(--bg-3);
}

/* ─── Conflict Resolution Panel ────────────────────────────────────────── */

.conflict-pair {
  margin-bottom: 20px;
  padding: 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.conflict-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.conflict-topline-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.conflict-cards {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: stretch;
}

.conflict-card {
  padding: 14px 16px !important;
}

.conflict-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.conflict-id {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.conflict-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.conflict-class-contradicts {
  color: var(--red);
  border-color: rgba(255, 23, 68, 0.36);
  background: rgba(255, 23, 68, 0.08);
}

.conflict-class-refines {
  color: var(--yellow);
  border-color: rgba(255, 171, 0, 0.34);
  background: rgba(255, 171, 0, 0.08);
}

.conflict-class-agrees {
  color: var(--green);
  border-color: rgba(0, 230, 118, 0.34);
  background: rgba(0, 230, 118, 0.08);
}

.conflict-class-unrelated {
  color: var(--text-2);
  border-color: rgba(136, 153, 176, 0.25);
  background: rgba(136, 153, 176, 0.08);
}

.conflict-class-unspecified {
  color: var(--text-3);
  border-color: rgba(84, 101, 128, 0.28);
  background: rgba(84, 101, 128, 0.08);
}

.conflict-status-open,
.conflict-status-pending {
  color: var(--cyan);
  border-color: rgba(0, 212, 255, 0.35);
  background: rgba(0, 212, 255, 0.08);
}

.conflict-status-resolved {
  color: var(--green);
  border-color: rgba(0, 230, 118, 0.35);
  background: rgba(0, 230, 118, 0.08);
}

.conflict-status-archived {
  color: var(--text-3);
  border-color: rgba(84, 101, 128, 0.28);
  background: rgba(84, 101, 128, 0.08);
}

.conflict-timestamps {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
}

.conflict-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 8px 0;
  white-space: pre-wrap;
}

.conflict-context {
  font-size: 12px;
  color: var(--text-3);
  margin: 0 0 8px 0;
  padding: 8px 10px;
  background: var(--bg-1);
  border-radius: var(--radius);
  border-left: 2px solid var(--border-glow);
}

.conflict-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.conflict-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 13px;
  color: var(--cyan);
  letter-spacing: 0.08em;
  min-width: 36px;
}

.conflict-resolution-summary {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid rgba(0, 212, 255, 0.12);
  border-radius: var(--radius);
  background: rgba(0, 212, 255, 0.05);
}

.conflict-resolution-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  font-size: 12px;
  color: var(--text-2);
}

.conflict-resolution-notes {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.4;
}

.conflict-trust-highlight {
  color: var(--cyan-bright);
}

.conflict-actions {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.conflict-manual-controls {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
}

.conflict-manual-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  margin-right: 4px;
}

.conflict-control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 150px;
}

.conflict-control-group span {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.conflict-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 10px;
}

.conflict-select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.12);
}

.permission-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.permission-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.permission-actions {
  display: flex;
  gap: 10px;
}

.permission-list .item-detail {
  font-family: var(--font-mono);
  font-size: 11px;
}

.permission-item-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .conflict-cards {
    grid-template-columns: 1fr;
  }

  .conflict-vs {
    min-height: 18px;
  }

  .conflict-topline {
    flex-direction: column;
  }

  .conflict-timestamps {
    justify-content: flex-start;
  }

  .conflict-resolution-grid {
    grid-template-columns: 1fr;
  }

  .permission-form-row {
    grid-template-columns: 1fr;
  }
}

/* ─── Selection Color ───────────────────────────────────────────────────── */

/* Keyboard Focus Baseline */

:is(
  button,
  a[href],
  input,
  select,
  textarea,
  [role="button"],
  [role="tab"],
  [role="switch"],
  [tabindex]:not([tabindex="-1"])
):focus-visible {
  outline: 2px solid var(--cyan-bright);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px var(--cyan-dim);
}

::selection {
  background: rgba(0, 212, 255, 0.3);
  color: var(--text);
}

/* ── Brain v2 HUD ─────────────────────────────────────────────────── */
.brain-v2-container {
  cursor: grab;
}
.brain-v2-container:active {
  cursor: grabbing;
}
.brain-v2-hud-strip {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 16px;
  padding: 6px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #cdeeff;
  background: rgba(7, 14, 26, 0.6);
  border: 1px solid rgba(64, 224, 255, 0.18);
  border-radius: 4px;
  letter-spacing: 0.06em;
  pointer-events: none;
  z-index: 4;
}
.brain-v2-hud-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.brain-v2-hud-label {
  color: rgba(64, 224, 255, 0.6);
  font-size: 9px;
  letter-spacing: 0.12em;
}
.brain-v2-ticker {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: rgba(64, 224, 255, 0.85);
  pointer-events: none;
  z-index: 4;
  max-width: 360px;
}
.brain-v2-ticker-line {
  padding: 2px 8px;
  background: rgba(7, 14, 26, 0.55);
  border-left: 1px solid rgba(64, 224, 255, 0.45);
  letter-spacing: 0.08em;
  opacity: 0.95;
  transform: translateY(0);
  transition: opacity 0.6s ease;
}
.brain-v2-tooltip {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 12px;
  background: rgba(7, 14, 26, 0.85);
  border: 1px solid rgba(64, 224, 255, 0.35);
  border-radius: 4px;
  font-size: 12px;
  color: #e2f8ff;
  pointer-events: none;
  max-width: 280px;
  z-index: 5;
}
.brain-v2-tooltip-tier {
  font-size: 9px;
  color: rgba(64, 224, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 4px;
}
.brain-v2-tooltip-label {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brain-v2-tooltip-meta {
  margin-top: 4px;
  font-size: 10px;
  color: rgba(64, 224, 255, 0.65);
}
.brain-v2-detail {
  position: absolute;
  top: 50%;
  right: 28px;
  transform: translateY(-50%);
  width: 360px;
  max-height: calc(100% - 80px);
  overflow-y: auto;
  padding: 18px 20px 16px;
  background: rgba(8, 16, 28, 0.94);
  border: 1px solid rgba(64, 224, 255, 0.55);
  border-radius: 6px;
  color: #f1faff;
  z-index: 6;
  box-shadow: 0 0 24px rgba(64, 224, 255, 0.12);
  font-family: inherit;
}
.brain-v2-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.brain-v2-detail-tier {
  font-size: 10px;
  color: rgba(64, 224, 255, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.22em;
}
.brain-v2-detail-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: rgba(180, 220, 255, 0.55);
}
.brain-v2-detail-label {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.35;
  color: #ffffff;
}
.brain-v2-detail-grid {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.brain-v2-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: rgba(200, 235, 255, 0.85);
  padding: 4px 0;
  border-bottom: 1px solid rgba(64, 224, 255, 0.08);
}
.brain-v2-detail-row:last-child { border-bottom: none; }
.brain-v2-detail-key {
  font-size: 10px;
  color: rgba(64, 224, 255, 0.7);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brain-v2-detail-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.brain-v2-detail-footer {
  margin-top: 12px;
  font-size: 10px;
  color: rgba(140, 180, 220, 0.55);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.brain-v2-error {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 6px 10px;
  background: rgba(80, 0, 0, 0.6);
  border: 1px solid rgba(255, 130, 130, 0.5);
  border-radius: 4px;
  color: #ffd2d2;
  font-size: 11px;
  z-index: 6;
}
