/* ==========================================================================
   Pico Design System: "Signal Graphite"
   --------------------------------------------------------------------------
   · Inset canvas layout: sidebar + header sit on the frame, content floats
     in a rounded canvas panel.
   · Pixel typography (Geist Pixel) for headline numbers and view titles,
     Geist Mono for labels and data, Geist for UI copy.
   · One signal color (green) carries every positive state: dot-matrix
     telemetry, icon chips, active nav glow, budget bars, primary CTA.
   · Glass hero surfaces, dimmed numeric suffixes, glowing primary actions.
   · Light and dark themes are both designed, with tokens for each.
   ========================================================================== */

:root {
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-pixel: "Geist Pixel", "Geist Mono", ui-monospace, monospace;

  --sidebar-w: 248px;
  --sidebar-w-collapsed: 72px;
  --radius-canvas: 22px;
  --radius-card: 16px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* -------------------------------- Dark -------------------------------- */
[data-theme="dark"] {
  color-scheme: dark;

  --frame: #0f1310;
  --canvas: #131814;
  --card: #171d18;
  --card-2: #1c231d;
  --card-hover: #212922;
  --border: #222a23;
  --border-strong: #2e3930;
  --ink: #e9efea;
  --ink-2: #aeb9b0;
  --ink-muted: #7b887e;

  --accent: #3ddc84;
  --accent-2: #8af0b4;
  --accent-ink: #03140a;
  --accent-soft: rgba(61, 220, 132, 0.1);
  --accent-border: rgba(61, 220, 132, 0.3);
  --accent-glow: rgba(61, 220, 132, 0.5);
  --cta-top: #7ef0ae;
  --cta-bottom: #31cc75;

  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.1);
  --ok-border: rgba(74, 222, 128, 0.32);
  --warn: #f5b84a;
  --warn-soft: rgba(245, 184, 74, 0.1);
  --warn-border: rgba(245, 184, 74, 0.32);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.1);
  --danger-border: rgba(248, 113, 113, 0.34);
  --info: #7ea6ff;
  --info-soft: rgba(126, 166, 255, 0.1);
  --info-border: rgba(126, 166, 255, 0.34);

  --dot-off: #222b24;
  --dot-mid: #2f5a3f;

  --chart-accent: #3ddc84;
  --chart-line: #8af0b4;
  --chart-grid: #2a332c;
  --chart-label: #6f7c72;
  --chart-peer: #f5b84a;
  --chart-edge: #3a473c;

  --glass: rgba(23, 29, 24, 0.72);
  --hatch: rgba(255, 255, 255, 0.035);
  --code-bg: #0c100d;
  --code-ink: #cfdbd2;
  --scrim: rgba(4, 7, 5, 0.66);

  --shadow-card: inset 0 1px 0 rgba(255, 255, 255, 0.025), 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-canvas: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 0 0 1px rgba(0, 0, 0, 0.25);
  --shadow-pop: 0 30px 80px -20px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --canvas-glow: radial-gradient(900px 360px at 88% -12%, rgba(61, 220, 132, 0.07), transparent 70%);
}

/* -------------------------------- Light -------------------------------- */
[data-theme="light"] {
  color-scheme: light;

  --frame: #e8eee9;
  --canvas: #f3f6f3;
  --card: #ffffff;
  --card-2: #f4f7f4;
  --card-hover: #edf2ee;
  --border: #dce4dd;
  --border-strong: #c8d3ca;
  --ink: #0e1511;
  --ink-2: #3c4a40;
  --ink-muted: #66746a;

  --accent: #16a34a;
  --accent-2: #22c55e;
  --accent-ink: #ffffff;
  --accent-soft: rgba(22, 163, 74, 0.08);
  --accent-border: rgba(22, 163, 74, 0.28);
  --accent-glow: rgba(22, 163, 74, 0.32);
  --cta-top: #22b358;
  --cta-bottom: #12873d;

  --ok: #15803d;
  --ok-soft: rgba(21, 128, 61, 0.08);
  --ok-border: rgba(21, 128, 61, 0.3);
  --warn: #b45309;
  --warn-soft: rgba(217, 119, 6, 0.09);
  --warn-border: rgba(217, 119, 6, 0.32);
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, 0.07);
  --danger-border: rgba(220, 38, 38, 0.3);
  --info: #2563eb;
  --info-soft: rgba(37, 99, 235, 0.07);
  --info-border: rgba(37, 99, 235, 0.28);

  --dot-off: #e3eae4;
  --dot-mid: #a7dcb9;

  --chart-accent: #16a34a;
  --chart-line: #0f7a35;
  --chart-grid: #dfe6e0;
  --chart-label: #8a968d;
  --chart-peer: #d97706;
  --chart-edge: #c3cec5;

  --glass: rgba(255, 255, 255, 0.78);
  --hatch: rgba(14, 40, 22, 0.05);
  --code-bg: #f5f8f5;
  --code-ink: #1f2d23;
  --scrim: rgba(18, 28, 21, 0.36);

  --shadow-card: 0 1px 2px rgba(16, 32, 20, 0.05), 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --shadow-canvas: 0 1px 3px rgba(16, 32, 20, 0.05);
  --shadow-pop: 0 30px 70px -20px rgba(16, 32, 20, 0.3), 0 0 0 1px rgba(16, 32, 20, 0.05);
  --canvas-glow: radial-gradient(900px 360px at 88% -12%, rgba(34, 197, 94, 0.08), transparent 70%);
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--frame);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

::selection { background: var(--accent-soft); color: var(--ink); }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-track { background: transparent; }

code, pre, kbd, .mono, .mono-xs { font-family: var(--font-mono); }
.mono-xs { font-size: 11.5px; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.muted-sm { font-size: 12.5px; color: var(--ink-muted); margin: 0; }
.micro-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
}
.micro-muted { font-size: 11px; color: var(--ink-muted); }
.signal-text { color: var(--ok); }
.hidden { display: none !important; }

/* ==========================================================================
   Shell: frame + sidebar + inset canvas
   ========================================================================== */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition: grid-template-columns 0.28s var(--ease);
}

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

/* ------------------------------ Sidebar ------------------------------ */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 14px 12px 12px;
  background: var(--frame);
  overflow-x: hidden;
  overflow-y: auto;
  min-width: 0;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 38px;
  padding: 0 2px 0 6px;
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand-logo { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; }

.brand-wordmark {
  font-family: var(--font-pixel);
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--ink);
}

.spec-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}

.collapse-btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s, transform 0.28s var(--ease);
}
.collapse-btn:hover { color: var(--ink); background: var(--card); border-color: var(--border); }

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

.nav-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 18px 12px 6px;
  white-space: nowrap;
}

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

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.nav-item:hover { color: var(--ink); background: var(--card); }

.nav-item.active {
  color: var(--ink);
  background: var(--card);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-card);
}

/* Pixel scanline glow on the active item's right edge */
.nav-item.active::before {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 72px;
  z-index: -1;
  background: repeating-linear-gradient(90deg, var(--accent) 0 1px, transparent 1px 3px);
  opacity: 0.55;
  -webkit-mask-image: radial-gradient(closest-side at 100% 50%, #000 0%, transparent 100%);
  mask-image: radial-gradient(closest-side at 100% 50%, #000 0%, transparent 100%);
}
.nav-item.active::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 50%;
  width: 70px;
  height: 46px;
  z-index: -1;
  transform: translateY(-50%);
  background: radial-gradient(closest-side, var(--accent-glow), transparent);
  opacity: 0.45;
}

.nav-item svg { flex-shrink: 0; opacity: 0.8; transition: color 0.15s; }
.nav-item.active svg { color: var(--accent); opacity: 1; }

.nav-count {
  margin-left: auto;
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-muted);
  background: var(--card-2);
  border: 1px solid var(--border);
}
.nav-item.active .nav-count { color: var(--ink-2); }

.nav-dot {
  margin-left: auto;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: transparent;
}
.nav-dot.due { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }

.sidebar-footer { display: flex; flex-direction: column; gap: 10px; }

.budget-widget {
  position: relative;
  padding: 12px 12px 11px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
}
.budget-widget::before {
  content: "";
  position: absolute;
  inset: 0 0 0 30%;
  background: repeating-linear-gradient(-45deg, var(--hatch) 0 1px, transparent 1px 6px);
  -webkit-mask-image: linear-gradient(to left, #000 10%, transparent);
  mask-image: linear-gradient(to left, #000 10%, transparent);
  pointer-events: none;
}
.budget-widget > * { position: relative; }

.budget-widget-head,
.budget-widget-foot { display: flex; align-items: center; justify-content: space-between; }

/* Column-major dot-matrix progress bar */
.dot-matrix-bar {
  display: grid;
  grid-template-rows: repeat(2, 5px);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
}
.dot-matrix-bar.wide { grid-template-rows: repeat(3, 6px); gap: 2.5px; }

.dm-cell {
  border-radius: 1.5px;
  background: var(--dot-off);
  transition: background 0.25s;
}
.dm-cell.on { background: var(--accent); }
.dm-cell.tip { background: var(--accent-2); box-shadow: 0 0 6px var(--accent-glow); }
.dm-cell.mid { background: var(--dot-mid); }
.dm-cell.warn { background: var(--warn); }

.router-card {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.router-card:hover { border-color: var(--border-strong); background: var(--card-hover); }

.router-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  font-family: var(--font-pixel);
  font-size: 13px;
  color: var(--ink);
  flex-shrink: 0;
}
.router-avatar.live { border-color: var(--accent-border); color: var(--accent); background: var(--accent-soft); }

.router-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.router-meta strong { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.router-meta span { font-size: 11px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.router-gear { color: var(--ink-muted); flex-shrink: 0; }

/* Collapsed sidebar */
.nav-collapsed .sidebar { padding-left: 10px; padding-right: 10px; }
.nav-collapsed .sidebar-brand { flex-direction: column; height: auto; gap: 10px; padding: 0; }
.nav-collapsed .brand-wordmark,
.nav-collapsed .spec-chip,
.nav-collapsed .nav-text,
.nav-collapsed .nav-count,
.nav-collapsed .budget-widget,
.nav-collapsed .router-meta,
.nav-collapsed .router-gear { display: none; }
.nav-collapsed .collapse-btn { transform: rotate(180deg); }
.nav-collapsed .nav-label { padding: 14px 0 6px; text-align: center; font-size: 0; }
.nav-collapsed .nav-label::before { content: "···"; font-size: 10px; letter-spacing: 0.1em; }
.nav-collapsed .nav-item { justify-content: center; padding: 0; }
.nav-collapsed .nav-dot { position: absolute; top: 7px; right: 9px; }
.nav-collapsed .router-card { justify-content: center; padding: 8px 0; }

/* ==========================================================================
   Main area, header, canvas
   ========================================================================== */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 14px 0 8px;
  flex-shrink: 0;
}

.header-left { display: flex; align-items: center; gap: 14px; min-width: 0; }

.view-title {
  margin: 0;
  font-family: var(--font-pixel);
  font-size: 21px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.view-sub {
  font-size: 12.5px;
  color: var(--ink-muted);
  padding-left: 14px;
  border-left: 1px solid var(--border-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
  height: 36px;
  padding: 0 8px 0 11px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-muted);
  box-shadow: var(--shadow-card);
  cursor: text;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.global-search:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 4px var(--accent-soft); }
.global-search input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}
.global-search input::placeholder { color: var(--ink-muted); }
.global-search input::-webkit-search-cancel-button { display: none; }

kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  min-width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--ink-muted);
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-2);
  box-shadow: var(--shadow-card);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.pill-btn:hover { border-color: var(--border-strong); color: var(--ink); }

.signal-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--ink-muted);
  flex-shrink: 0;
}
.signal-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.signal-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.signal-dot.pulse { background: var(--accent); animation: pulseDot 1s infinite; }

@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.icon-btn:hover { border-color: var(--border-strong); color: var(--ink); }

/* Segmented sun / moon theme switch */
.theme-switch {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  height: 36px;
  width: 72px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  isolation: isolate;
}
.theme-switch::before {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  border-radius: 7px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  z-index: -1;
  transition: transform 0.3s var(--ease);
}
[data-theme="dark"] .theme-switch::before { transform: translateX(100%); }
.theme-opt { display: grid; place-items: center; color: var(--ink-muted); transition: color 0.2s; }
[data-theme="light"] .opt-light,
[data-theme="dark"] .opt-dark { color: var(--accent); }

.mobile-menu, .mobile-close { display: none; }
.nav-scrim { display: none; }

/* Inset canvas panel */
.canvas {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0 12px 12px 0;
  border-radius: var(--radius-canvas);
  border: 1px solid var(--border);
  background: var(--canvas-glow), var(--canvas);
  box-shadow: var(--shadow-canvas);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.view {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  gap: 18px;
  flex-direction: column;
}
.view.active { display: flex; animation: viewIn 0.35s var(--ease); }
.view > * { flex-shrink: 0; }
.view > .workbench-layout { flex: 1; min-height: 0; flex-shrink: 1; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   KPI strip
   ========================================================================== */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

.kpi-cell {
  position: relative;
  padding: 20px 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.kpi-cell + .kpi-cell::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 1px;
  background: var(--border);
}

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

.kpi-icon,
.title-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-value {
  font-family: var(--font-pixel);
  font-size: 40px;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dim { color: var(--ink-muted); }

.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.delta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ok);
  white-space: nowrap;
}
.delta.warn { color: var(--warn); }
.delta.danger { color: var(--danger); }

/* ==========================================================================
   Glass command hero
   ========================================================================== */
.hero-command {
  position: relative;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background:
    radial-gradient(120% 160% at 0% 0%, var(--accent-soft), transparent 45%),
    var(--card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  isolation: isolate;
}
/* Dot-grid texture fading in from the right */
.hero-command::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--dot-off) 1.1px, transparent 1.4px);
  background-size: 12px 12px;
  -webkit-mask-image: linear-gradient(to left, #000, transparent 65%);
  mask-image: linear-gradient(to left, #000, transparent 65%);
}
/* Top hairline highlight */
.hero-command::after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-border), transparent);
}

.hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-2);
}

.live-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--accent);
  animation: ping 2s var(--ease) infinite;
}
@keyframes ping {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

.env-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.env-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 5px 13px 5px 5px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--glass);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.env-ic {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
}
.env-txt { display: flex; flex-direction: column; line-height: 1.2; }
.env-txt b { font-size: 12.5px; font-weight: 500; color: var(--ink); white-space: nowrap; }
.env-txt small { font-size: 10.5px; color: var(--ink-muted); }

.hero-command-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 6px 6px 6px 16px;
  border-radius: 14px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.hero-command-row:focus-within {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.hero-prompt-prefix {
  font-family: var(--font-pixel);
  font-size: 15px;
  color: var(--accent);
  user-select: none;
}

.hero-command-row input {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  outline: none;
}
.hero-command-row input::placeholder { color: var(--ink-muted); }

.hero-command-hints,
.scenario-strip,
.preset-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.hero-command-hints { margin-top: 12px; }

.ghost-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s;
}
.ghost-chip:hover {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--ink);
}
.ghost-chip:active { transform: translateY(1px); }
.chip-arrow { color: var(--accent); font-size: 11px; }

/* ==========================================================================
   Cards, buttons, status pills
   ========================================================================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.card-head.wrap { flex-wrap: wrap; }
.card-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 16px; }
.card-head-right .delta { font-size: 12.5px; }

.title-row { display: flex; align-items: flex-start; gap: 12px; min-width: 0; }
.title-row .title-icon { margin-top: 1px; }

.card-title {
  margin: 0 0 2px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.card-title.mono { font-family: var(--font-mono); font-weight: 500; font-size: 13.5px; }
.card-title .mono { font-size: 11.5px; font-weight: 400; margin-left: 6px; }

.card-eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink-2);
}

.card-big-num {
  font-family: var(--font-pixel);
  font-size: 36px;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-top: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 15px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.2s, filter 0.15s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; }

.btn-primary {
  background: linear-gradient(180deg, var(--cta-top), var(--cta-bottom));
  border-color: var(--accent-border);
  color: var(--accent-ink);
  font-weight: 600;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    0 6px 18px -6px var(--accent-glow);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05) saturate(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 8px 26px -6px var(--accent-glow);
}

.btn-subtle {
  background: var(--card);
  border-color: var(--border-strong);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}
.btn-subtle:hover:not(:disabled) { background: var(--card-hover); }

.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { color: var(--ink); background: var(--card-2); }

.btn-danger {
  background: linear-gradient(180deg, #f17c74, #dc4a40);
  border-color: var(--danger-border);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 18px -8px rgba(220, 74, 64, 0.7);
}
.btn-danger:hover { filter: brightness(1.05); }

.inline-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-weight: 500;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--accent-border);
  text-underline-offset: 3px;
}
.inline-link:hover { text-decoration-color: var(--accent); }

.status-pill-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 24px;
  padding: 0 11px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-pill-tag.ok { background: var(--ok-soft); border-color: var(--ok-border); color: var(--ok); }
.status-pill-tag.warn { background: var(--warn-soft); border-color: var(--warn-border); color: var(--warn); }
.status-pill-tag.info { background: var(--info-soft); border-color: var(--info-border); color: var(--info); }
.status-pill-tag.danger { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }
.status-pill-tag.neutral { background: var(--card-2); border-color: var(--border-strong); color: var(--ink-2); }
.status-pill-tag.wide { min-width: 116px; }
.status-pill-tag.info .pill-dot { animation: pulseDot 1s infinite; }
.pill-dot { width: 5px; height: 5px; border-radius: 1.5px; background: currentColor; }

/* ==========================================================================
   Telemetry row
   ========================================================================== */
.telemetry-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
}

.chart-stage,
.mesh-stage {
  position: relative;
  height: 236px;
  width: 100%;
}

.dot-chart,
.mesh-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }

.dot-chart text,
.mesh-svg text { font-family: var(--font-mono); }

.chart-tip {
  position: absolute;
  top: 0;
  left: 0;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-pop);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, calc(-100% - 12px));
  transition: opacity 0.12s;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--ink-muted);
  line-height: 1.35;
}
.chart-tip.show { opacity: 1; }
.chart-tip b { display: block; font-family: var(--font-pixel); font-weight: 400; font-size: 17px; color: var(--ink); }

.chart-guide { stroke: var(--chart-line); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.6; }

.mesh-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  max-width: 200px;
  padding: 8px 11px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-pop);
  display: flex;
  flex-direction: column;
  gap: 3px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.18s, transform 0.18s var(--ease);
}
.mesh-tooltip.show { opacity: 1; transform: none; }
.mesh-tooltip strong { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--ink); }
.mesh-tooltip span { font-size: 11px; color: var(--ink-muted); line-height: 1.35; }
#mesh-connector { pointer-events: none; }

.mesh-node { cursor: pointer; }
.mesh-node .halo { transition: opacity 0.2s, r 0.2s; }
.mesh-node:hover .halo { opacity: 0.32; }
.mesh-node.active .halo { animation: haloPulse 1.1s ease-in-out infinite; }
@keyframes haloPulse {
  0%, 100% { opacity: 0.18; }
  50% { opacity: 0.42; }
}
.mesh-edge.active { stroke: var(--chart-accent); stroke-dasharray: 3 5; animation: flow 0.7s linear infinite; opacity: 1; }
@keyframes flow { to { stroke-dashoffset: -16; } }

.chart-pulse { animation: chartPulse 2s var(--ease) infinite; transform-box: fill-box; transform-origin: center; }
@keyframes chartPulse {
  0% { transform: scale(0.6); opacity: 0.55; }
  100% { transform: scale(2.2); opacity: 0; }
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--ink-muted);
}
.chart-legend > span:last-child { margin-left: auto; }
.chart-legend span { display: inline-flex; align-items: center; gap: 7px; }

.swatch { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.swatch.accent { background: var(--accent); box-shadow: 0 0 6px var(--accent-glow); }
.swatch.amber { background: var(--warn); }

/* ==========================================================================
   Roster table
   ========================================================================== */
.table-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-wrap { width: 100%; overflow-x: auto; margin: -4px 0 -6px; }

.mini-search {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  width: 190px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink-muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mini-search:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 3px var(--accent-soft); }
.mini-search input { border: none; outline: none; background: transparent; min-width: 0; flex: 1; font-size: 12.5px; color: var(--ink); }
.mini-search input::-webkit-search-cancel-button { display: none; }

.roster-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.roster-table th {
  text-align: left;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.roster-table th.th-right,
.roster-table td.td-right { text-align: right; }

.roster-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.roster-table tbody tr:last-child td { border-bottom: none; }
.roster-table tbody tr { transition: background 0.12s; }
.roster-table tbody tr:hover td { background: var(--card-2); }
.roster-table tbody tr td:first-child { border-radius: 10px 0 0 10px; }
.roster-table tbody tr td:last-child { border-radius: 0 10px 10px 0; }
.roster-empty td { text-align: center; color: var(--ink-muted); padding: 22px; }

.agent-cell { display: flex; align-items: center; gap: 11px; }

.agent-avatar {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--font-pixel);
  font-size: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  box-shadow: 0 0 0 3px var(--card);
}
.agent-avatar::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.agent-avatar.peer { color: var(--warn); background: var(--warn-soft); border-color: var(--warn-border); }

.agent-cell strong { font-weight: 500; color: var(--ink); }
.agent-cell small { display: block; font-size: 10.5px; color: var(--ink-muted); }
.td-muted { color: var(--ink-2); }
.td-dim { color: var(--ink-muted); }

.readiness-cell { display: flex; align-items: center; gap: 10px; }
.readiness-cell .mono-xs { min-width: 34px; color: var(--ink-2); }

.mini-matrix {
  display: grid;
  grid-template-rows: repeat(3, 4px);
  grid-auto-flow: column;
  grid-auto-columns: 4px;
  gap: 1.5px;
}
.mini-matrix i { display: block; border-radius: 1px; background: var(--dot-off); }
.mini-matrix i.on { background: var(--accent); }
.mini-matrix i.mid { background: var(--dot-mid); }
.mini-matrix i.warn { background: var(--warn); }
.mini-matrix i.warn-mid { background: var(--warn-border); }

/* ==========================================================================
   Workbench
   ========================================================================== */
.workbench-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  max-width: 980px;
  width: 100%;
  margin: 0 auto;
}

.workbench-main { flex: 1; min-height: 0; padding: 0; gap: 0; overflow: hidden; }

.workbench-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.hop-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 7px 16px;
  background: var(--card-2);
  border-bottom: 1px solid var(--border);
  color: var(--ink-2);
}

.hop-nodes { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

.hop-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  animation: chipIn 0.25s var(--ease);
}
@keyframes chipIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 24px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background-image: radial-gradient(var(--dot-off) 1px, transparent 1.3px);
  background-size: 16px 16px;
  background-position: -8px -8px;
}

.msg {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: chipIn 0.3s var(--ease);
}
.msg-avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--font-pixel);
  font-size: 13px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
}
.msg-content {
  min-width: 0;
  flex: 1;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow-card);
}

.msg-user { flex-direction: row-reverse; }
.msg-user .msg-content {
  flex: 0 1 auto;
  max-width: 78%;
  background: var(--accent-soft);
  border-color: var(--accent-border);
  border-top-right-radius: 4px;
}
.msg-user .msg-avatar { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.msg-assistant .msg-content { border-top-left-radius: 4px; }
.msg-assistant .msg-avatar { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }

.msg-system .msg-content { background: var(--card-2); border-style: dashed; border-color: var(--border-strong); color: var(--ink-2); font-size: 13px; box-shadow: none; }

.msg-error .msg-content { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); box-shadow: none; }
.msg-error .msg-avatar { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }

.msg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 11.5px;
  color: var(--ink-muted);
}
.msg-head strong { font-family: var(--font-mono); font-weight: 500; color: var(--ink-2); }

.msg-body { font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.msg-body h3 { margin: 2px 0 8px; font-size: 14.5px; font-weight: 600; }
.msg-body p { margin: 0 0 8px; }
.msg-body p:last-child { margin-bottom: 0; }
.msg-body ul { margin: 4px 0 8px; padding-left: 18px; }
.msg-body li::marker { color: var(--accent); }
.msg-body code {
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--ink);
  padding: 1px 5px;
  border-radius: 5px;
  font-size: 12px;
}

.msg-footer {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--border-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.composer { padding: 12px 14px 14px; border-top: 1px solid var(--border); background: var(--card); }

.composer-box {
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  padding: 10px 10px 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer-box:focus-within { border-color: var(--accent-border); box-shadow: 0 0 0 4px var(--accent-soft); }

.composer textarea {
  width: 100%;
  padding: 2px 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  resize: none;
  outline: none;
}
.composer textarea::placeholder { color: var(--ink-muted); }

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}

/* ==========================================================================
   Memory, Skills, Peer Web, Receipts
   ========================================================================== */
.two-col-grid {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 18px;
  align-items: start;
}
.skills-split { grid-template-columns: 0.9fr 1.1fr; }
.stack-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--border);
  gap: 2px;
}
.seg-btn {
  height: 28px;
  padding: 0 12px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}
.seg-btn:hover { color: var(--ink); }
.seg-btn.active {
  background: var(--card);
  border-color: var(--border-strong);
  color: var(--accent);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.memory-meter-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.mono-editor {
  width: 100%;
  min-height: 300px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  resize: vertical;
  outline: none;
  tab-size: 2;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.mono-editor.tall { min-height: 380px; }
.mono-editor:focus { border-color: var(--accent-border); box-shadow: 0 0 0 4px var(--accent-soft); }

.action-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.input-row { display: flex; gap: 8px; }

.input-row input,
.form-grid input,
.form-grid select {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--card-2);
  color: var(--ink);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-row input::placeholder,
.form-grid input::placeholder { color: var(--ink-muted); }
.input-row input:focus,
.form-grid input:focus,
.form-grid select:focus { border-color: var(--accent-border); box-shadow: 0 0 0 4px var(--accent-soft); }

.fts-results,
.checkpoint-list,
.skills-list,
.check-list,
.receipt-list { display: flex; flex-direction: column; gap: 8px; }

.fts-hit,
.checkpoint-item,
.skill-card,
.check-row,
.receipt-item {
  position: relative;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card-2);
  transition: border-color 0.15s, background 0.15s;
}

.skill-card { cursor: pointer; overflow: hidden; }
.skill-card:hover { border-color: var(--border-strong); background: var(--card-hover); }
.skill-card.selected { border-color: var(--accent-border); background: var(--accent-soft); }
.skill-card.selected::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.skill-card-head,
.fts-hit-meta,
.receipt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.skill-card-head strong,
.fts-hit-meta strong { font-weight: 500; }

.skill-card p { margin: 6px 0 10px; font-size: 12.5px; color: var(--ink-muted); line-height: 1.5; }

.tag-row, .pill-row, .artifact-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--ink-2);
}

.artifact-chips a {
  font-family: var(--font-mono);
  font-size: 11.5px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.artifact-chips a:hover { border-color: var(--accent-border); color: var(--accent); }

.check-row { display: flex; align-items: flex-start; gap: 11px; font-size: 13px; }
.check-row strong { font-weight: 500; }
.check-mark {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  background: var(--card);
  border: 1px solid var(--border-strong);
  color: var(--ink-muted);
}
.check-mark.pass { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-border); }
.check-mark.fail { color: var(--danger); background: var(--danger-soft); border-color: var(--danger-border); }

.audit-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 2px 0; }
.audit-head strong { font-family: var(--font-mono); font-weight: 500; }

.code-box {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  color: var(--code-ink);
  font-size: 12px;
  line-height: 1.6;
  overflow: auto;
  max-height: 260px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Receipts render as a hash-chain timeline */
.receipt-list { gap: 10px; padding-left: 4px; }
.receipt-item { margin-left: 22px; }
.receipt-item::before {
  content: "";
  position: absolute;
  left: -24px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 2.5px;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.receipt-item::after {
  content: "";
  position: absolute;
  left: -20px;
  top: 30px;
  bottom: -18px;
  width: 1px;
  background: repeating-linear-gradient(to bottom, var(--border-strong) 0 3px, transparent 3px 6px);
}
.receipt-item:last-child::after { display: none; }
.receipt-hash { color: var(--accent); font-weight: 500; }
.receipt-payload {
  margin: 8px 0 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: auto;
}

.empty-state {
  display: block;
  padding: 22px 18px;
  line-height: 1.6;
  border-radius: 12px;
  border: 1px dashed var(--border-strong);
  text-align: center;
  color: var(--ink-muted);
  font-size: 12.5px;
}
.empty-state strong { color: var(--ink-2); font-weight: 500; }

/* ==========================================================================
   Modals
   ========================================================================== */
.modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 540px;
  width: calc(100% - 28px);
  color: var(--ink);
}
.modal[open] { animation: modalIn 0.28s var(--ease); }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.modal::backdrop {
  background: var(--scrim);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.modal-card::before {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.6;
}

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.modal-head h2 { margin: 0; font-family: var(--font-pixel); font-size: 18px; font-weight: 400; }
.modal-head .icon-btn { width: 32px; height: 32px; }

.modal code { font-size: 11.5px; padding: 1px 5px; border-radius: 5px; background: var(--card-2); border: 1px solid var(--border); }

.form-grid { display: flex; flex-direction: column; gap: 12px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.form-grid em { font-style: normal; font-weight: 400; }

.note-box {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--card-2);
  border: 1px solid var(--border-strong);
  color: var(--ink-2);
  font-size: 12px;
}
.note-box.err { background: var(--danger-soft); border-color: var(--danger-border); color: var(--danger); }

.consent-dl {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--card-2);
  border: 1px solid var(--border);
  display: grid;
  gap: 6px;
}
.consent-dl dt {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-muted);
}
.consent-dl dd { margin: 0 0 6px; }

.consent-quote {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 2px solid var(--warn);
}

.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.checkbox-row input { accent-color: var(--accent); width: 15px; height: 15px; }

.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; flex-wrap: wrap; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1240px) {
  .global-search { width: 220px; }
  .view-sub { display: none; }
}

@media (max-width: 1120px) {
  .kpi-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-cell:nth-child(3)::before { display: none; }
  .kpi-cell:nth-child(n + 3) { border-top: 1px solid var(--border); }
  .telemetry-grid, .two-col-grid, .skills-split { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell,
  .nav-collapsed .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 272px;
    z-index: 40;
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease);
    box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: translateX(0); }
  .nav-scrim { position: fixed; inset: 0; z-index: 39; background: var(--scrim); display: block; opacity: 0; pointer-events: none; transition: opacity 0.2s; }
  .sidebar.open + .nav-scrim { opacity: 1; pointer-events: auto; }
  .collapse-btn { display: none; }
  .mobile-menu, .mobile-close { display: grid; }

  /* Never apply collapsed styles to the mobile drawer */
  .nav-collapsed .sidebar-brand { flex-direction: row; height: 38px; }
  .nav-collapsed .brand-wordmark, .nav-collapsed .spec-chip, .nav-collapsed .nav-text, .nav-collapsed .router-meta, .nav-collapsed .router-gear { display: initial; }
  .nav-collapsed .nav-count { display: grid; }
  .nav-collapsed .budget-widget { display: flex; }
  .nav-collapsed .router-meta { display: flex; }
  .nav-collapsed .nav-item { justify-content: flex-start; padding: 0 12px; }
  .nav-collapsed .nav-label { font-size: 10px; text-align: left; padding: 18px 12px 6px; }
  .nav-collapsed .nav-label::before { content: none; }
  .nav-collapsed .router-card { justify-content: flex-start; padding: 9px 10px; }

  .header { padding: 0 12px; }
  .canvas { margin: 0; border-radius: 18px 18px 0 0; border-bottom: none; }
  .view { padding: 16px; }
  .global-search { display: none; }
  .hero-top { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 560px) {
  .kpi-cell { padding: 14px 14px 13px; gap: 10px; }
  .kpi-icon { width: 26px; height: 26px; border-radius: 8px; }
  .kpi-label { font-size: 11.5px; }
  .kpi-value { font-size: 30px; }
  .kpi-foot { flex-direction: column; align-items: flex-start; gap: 2px; font-size: 11.5px; }
  .card-big-num { font-size: 30px; }
  .env-chip:nth-child(3) { display: none; }
  .pill-btn #peer-policy-label { display: none; }
  .hero-command-row { flex-wrap: wrap; padding: 8px; }
  .hero-command-row .btn { width: 100%; }
  .chart-legend > span:last-child { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
