/* ============================================================
   Agent Deck — Graph view. Clean, futuristic, data-driven.
   Dark by default; light supported. Nothing agent-specific.
   ============================================================ */
@import url('theme-tokens.css');   /* fonts + design tokens + base reset (box-sizing, button, focus, .mono) — kept separate so the palette is reusable without this fleet shell */

/* The fleet graph runs as a fixed, full-viewport app shell (no document scroll).
   These rules are deliberately NOT in theme-tokens.css — that is what lets a normal
   scrolling document borrow the tokens without inheriting the shell. */
html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ===================== SHELL ===================== */
.gx { display: grid; grid-template-rows: auto 1fr auto; height: 100vh; height: 100dvh; overflow: hidden; }
.gx-body { display: grid; grid-template-columns: 300px minmax(0,1fr) 332px; min-height: 0; min-width: 0; }

/* ===================== TOP BAR ===================== */
.gx-top { display: flex; align-items: center; gap: 14px; padding: 0 16px; height: 56px; border-bottom: 1px solid var(--border-soft); background: var(--panel); overflow: hidden; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.brand-mark svg { width: 16px; height: 16px; color: var(--accent); }
.brand b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.crumb { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-faint); }
.crumb .sep { opacity: 0.5; }
.crumb .mono { color: var(--text-dim); }

.top-search { position: relative; margin-left: 12px; width: 240px; flex: 0 1 240px; min-width: 0; }
.top-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--text-faint); }
.top-search input { width: 100%; height: 34px; padding: 0 12px 0 33px; border-radius: 8px; border: 1px solid var(--border-soft); background: var(--bg-2); color: var(--text); font: inherit; font-size: 13px; }
.top-search input::placeholder { color: var(--text-faint); }
.top-search input:focus { outline: none; border-color: var(--accent-line); }
/* ⌘K discoverability badge inside the top-search field */
.ts-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 10px; font-weight: 600; line-height: 1; letter-spacing: 0.03em; color: var(--text-faint); background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 5px; padding: 3px 5px; pointer-events: none; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; flex: none; }
.updated { font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.updated .rdot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.updated.pulse .rdot { animation: rpulse 2.4s ease-out; }
@keyframes rpulse { 0% { box-shadow: 0 0 0 0 var(--accent-line); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 6px transparent; } }
.updated.recon { color: var(--st-stale); } .updated.recon .rdot { background: var(--st-stale); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.icon-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border-soft); background: var(--bg-2); display: grid; place-items: center; color: var(--text-dim); }
.icon-btn:hover { color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 16px; height: 16px; }
.sysbadge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-dim); padding: 4px 9px; border: 1px solid var(--border-soft); border-radius: 999px; background: var(--bg-2); white-space: nowrap; }
.sysbadge .sb-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--st-running); flex: none; }
.sysbadge.warn .sb-dot { background: var(--st-stale); }
.sysbadge.crit .sb-dot { background: var(--st-error); }

/* ===================== LEFT PANEL ===================== */
.gx-left { border-right: 1px solid var(--border-soft); background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.side-card { padding: 13px 14px; border-bottom: 1px solid var(--border-soft); flex: none; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.panel-h b { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; }
.panel-h .sub { font-size: 11px; color: var(--text-faint); }

/* donut (compact in sidebar) */
.donut-wrap { display: flex; gap: 14px; align-items: center; }
.donut { position: relative; width: 92px; height: 92px; flex: none; }
.donut svg { width: 100%; height: 100%; display: block; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center b { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1; }
.donut-center span { font-size: 9px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em; }
.legend { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.legend-item { display: flex; align-items: center; gap: 8px; padding: 4px 7px; border-radius: 6px; cursor: pointer; font-size: 12px; transition: background .14s; width: 100%; }
.legend-item:hover { background: var(--bg-2); }
.legend-item.active { background: color-mix(in oklch, var(--lc) var(--tint), var(--panel)); }
.legend-item .ld { width: 8px; height: 8px; border-radius: 50%; background: var(--lc); flex: none; }
.legend-item .ln { flex: 1; color: var(--text-dim); text-transform: capitalize; }
.legend-item .lc { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* needs-attention panel */
.attn { display: flex; flex-direction: column; gap: 6px; }
.attn-ok { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--st-running); padding: 2px; }
.attn-ok svg { width: 15px; height: 15px; }
.attn-row { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; width: 100%; background: color-mix(in oklch, var(--st) 12%, var(--panel)); border: 1px solid color-mix(in oklch, var(--st) 34%, transparent); cursor: pointer; transition: background .14s; }
.attn-row:hover { background: color-mix(in oklch, var(--st) 20%, var(--panel)); }
.attn-row .d { width: 9px; height: 9px; border-radius: 50%; background: var(--st); flex: none; box-shadow: 0 0 7px var(--st); }
.attn-row .ar-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.attn-row .ar-nm { font-size: 12.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-row .ar-rs { font-size: 10.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn-row .ar-st { font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: color-mix(in oklch, var(--st) 70%, var(--text)); flex: none; }

/* Self-healing panel — recent automated repair attempts */
.heal { display: flex; flex-direction: column; gap: 6px; }
.heal-empty { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-dim); padding: 2px; }
.heal-empty svg { width: 15px; height: 15px; color: var(--st-running); flex: none; }
.heal-empty.off svg { color: var(--st-stale); }
.heal-row { display: flex; align-items: flex-start; gap: 9px; padding: 8px 9px; border-radius: 9px; width: 100%; text-align: left; background: color-mix(in oklch, var(--oc) 10%, var(--panel)); border: 1px solid color-mix(in oklch, var(--oc) 30%, transparent); cursor: pointer; transition: background .14s; }
.heal-row[disabled] { cursor: default; }
.heal-row:not([disabled]):hover { background: color-mix(in oklch, var(--oc) 18%, var(--panel)); }
.heal-row .hic { flex: none; margin-top: 1px; color: var(--oc); }
.heal-row .hic svg { width: 15px; height: 15px; display: block; }
.heal-row .hmain { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.heal-row .hnm { display: flex; align-items: baseline; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text); }
.heal-row .hnm .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heal-row .hbadge { font-size: 9px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--oc); flex: none; }
.heal-row .ht { margin-left: auto; font-size: 9.5px; color: var(--text-faint); flex: none; }
.heal-row .hrs { font-size: 10.5px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.heal-row.active { animation: healpulse 1.8s ease-in-out infinite; }
@keyframes healpulse { 0%,100% { border-color: color-mix(in oklch, var(--oc) 28%, transparent); } 50% { border-color: color-mix(in oklch, var(--oc) 72%, transparent); } }
/* self-healing block in the detail panel */
.rp-heal { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; border-top: 1px solid var(--border-soft); }
.rp-heal:first-child { border-top: none; }
.rp-heal .hic { flex: none; color: var(--oc); margin-top: 1px; } .rp-heal .hic svg { width: 14px; height: 14px; display: block; }
.rp-heal b { color: var(--oc); text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; }
.rp-heal .rp-heal-act { margin-top: 3px; font-size: 10.5px; color: var(--text-faint); font-family: var(--mono, ui-monospace, monospace); }

/* entity detail: what it's FOR (purpose) + what it's DOING now (live activity) + scanner brain */
.rp-purpose .rp-reason { color: var(--text); }
.rp-reason.dim { color: var(--text-faint); font-size: 11.5px; margin-top: 4px; }
.rp-now h4 { display: flex; align-items: center; gap: 7px; }
.rp-now .nowdot { width: 8px; height: 8px; border-radius: 50%; background: var(--st-idle); flex: none; }
.rp-now.working .nowdot { background: var(--st-running); animation: nowpulse 1.8s ease-out infinite; }
@keyframes nowpulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--st-running) 55%, transparent); } 70%,100% { box-shadow: 0 0 0 8px transparent; } }
.rp-now .now-age { color: var(--text-faint); font-size: 11px; }
.rp-warn.err svg { color: var(--st-error); }
.rp-brain h4 svg, .rp-purpose .rp-eyebrow svg { width: 13px; height: 13px; }
.ev-strip { width: 100%; max-width: 260px; display: block; }
.ev-strip rect { opacity: 0.85; } .ev-strip rect:hover { opacity: 1; }

/* upcoming runs rail (compact) */
.runrail { display: flex; flex-direction: column; gap: 9px; }
.runrow { display: flex; align-items: center; gap: 10px; cursor: pointer; width: 100%; }
.runrow .rn { width: 96px; flex: none; font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runrow:hover .rn { color: var(--text); }
.runrow .track { flex: 1; height: 6px; border-radius: 999px; background: var(--bg-2); position: relative; overflow: hidden; }
.runrow .fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.runrow.soon .fill { background: var(--st-stale); }
.runrow.over .track { background: color-mix(in oklch, var(--st-error) 26%, var(--bg-2)); }
.runrow .cd { width: 64px; flex: none; text-align: right; font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--text-dim); }
.runrow.over .cd { color: var(--st-error); }
.runrail .empty { font-size: 12px; color: var(--text-faint); text-align: center; padding: 12px; }

/* entities list */
.lp-head { padding: 12px 14px 8px; flex: none; }
.lp-title { font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-faint); display: flex; justify-content: space-between; align-items: center; }
.lp-title .n { font-family: 'JetBrains Mono', monospace; color: var(--text-dim); }
.lp-list { padding: 0 8px 10px; flex: 1 0 auto; }
.lp-cat { font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); padding: 10px 8px 4px; opacity: 0.75; }
.lp-item { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--text-dim); transition: background .13s, color .13s; width: 100%; }
.lp-item:hover { background: var(--bg-2); color: var(--text); }
.lp-item.sel { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.lp-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.lp-item .dot.ring { background: transparent; box-shadow: inset 0 0 0 2px var(--dc); }
.lp-item .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-item .tag { font-size: 9px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); padding: 2px 6px; border-radius: 5px; background: var(--bg-2); border: 1px solid var(--border-soft); }
.lp-item .lp-dev { font-size: 9px; font-weight: 600; letter-spacing: 0.03em; color: var(--accent); padding: 2px 6px; border-radius: 5px; background: var(--accent-soft); border: 1px solid var(--accent-line); flex: none; }

/* ===================== CENTER (graph is the hero) ===================== */
.gx-center { min-width: 0; min-height: 0; overflow: hidden; padding: 14px 16px; display: grid; grid-template-rows: auto 1fr; gap: 14px; }
.ov-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 1320px) { .ov-kpis { grid-template-columns: repeat(2, 1fr); } }
.kpi { display: flex; flex-direction: column; gap: 7px; padding: 11px 14px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--panel); cursor: pointer; transition: border-color .15s, box-shadow .15s; width: 100%; }
.kpi:hover { border-color: var(--border); }
.kpi.active { border-color: var(--accent-line); box-shadow: inset 0 0 0 1px var(--accent-line); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--text-dim); }
.kpi-val { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 0.95; font-variant-numeric: tabular-nums; }
.kpi-val.attn { color: var(--st-error); } .kpi-val.ok { color: var(--st-running); }
.kpi .d { width: 9px; height: 9px; border-radius: 50%; }
.kpi .d.ring { background: transparent; box-shadow: inset 0 0 0 2px var(--dc); }

.panel { border: 1px solid var(--border-soft); border-radius: 14px; background: var(--panel); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.graph-panel { padding: 14px 16px 14px; min-height: 0; }
.graph-panel > .panel-h { margin-bottom: 12px; }
.graph-host { position: relative; flex: 1; min-height: 0; border-radius: 11px; overflow: hidden; border: 1px solid var(--border-soft); background: radial-gradient(130% 130% at 50% 0%, var(--bg-2), var(--bg) 70%); }
.graph-host::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 120px 10px color-mix(in oklch, var(--bg) 70%, transparent); border-radius: 11px; }
#graph { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; position: relative;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px); background-size: 26px 26px;
  background-position: var(--px, 0px) var(--py, 0px); }
#graph.grabbing { cursor: grabbing; }

/* edges */
.edge { stroke: var(--edge); stroke-width: 1.2; fill: none; vector-effect: non-scaling-stroke; transition: stroke .25s, opacity .2s, stroke-width .2s; }
.edge[data-sev="running"] { stroke: color-mix(in oklch, var(--st-running) 34%, var(--edge)); }
.edge[data-sev="stale"]   { stroke: color-mix(in oklch, var(--st-stale) 60%, transparent); stroke-width: 1.6; }
.edge[data-sev="error"]   { stroke: color-mix(in oklch, var(--st-error) 72%, transparent); stroke-width: 2; }
.edge.active { stroke: var(--accent-line); stroke-dasharray: 4 6; animation: flow 1s linear infinite; }
.edge.err { stroke: color-mix(in oklch, var(--st-error) 55%, transparent); }
.edge.dep { stroke: var(--accent-2); stroke-dasharray: 2 5; opacity: 0.75; }
@keyframes flow { to { stroke-dashoffset: -10; } }
svg.dim .edge { opacity: 0.10; }
svg.dim .edge.hl { opacity: 1; }
svg.dim .node { opacity: 0.20; }
svg.dim .node.hl { opacity: 1; }
svg.focus .node { transition: opacity .3s; }
svg.focus .node:not(.hl), svg.focus .edge:not(.hl) { opacity: 0; pointer-events: none; }

.particle { fill: var(--accent); filter: drop-shadow(0 0 3px var(--accent)); pointer-events: none; }

/* nodes */
.node { cursor: pointer; }
.node circle.body, .node rect.body { stroke: var(--node-stroke); stroke-width: 2; transition: stroke-width .15s; }
.node.sel circle.body, .node.sel rect.body { stroke: var(--accent); stroke-width: 2.5; }
/* Selecting/focusing a node shows its own accent ring (.sel / hover), not the global
   focus-visible bounding box. Keyboard focus still gets the ring so it stays accessible. */
.node:focus { outline: none; }
.node:focus-visible circle.body, .node:focus-visible rect.body { stroke: var(--accent); stroke-width: 2.5; }
.node.running circle.body, .node.error circle.body { filter: url(#bloom); }
.node:hover circle.body, .node:hover rect.body { stroke: var(--accent); }
.node circle.glow { fill: none; opacity: 0; }
.node.running circle.glow { opacity: 0.9; animation: nbeat 2.8s ease-out infinite; }
@keyframes nbeat { 0% { opacity: 0.5; r: var(--r0); } 70% { opacity: 0; r: var(--r1); } 100% { opacity: 0; } }
.node.error circle.body, .node.error rect.body { animation: eflash 1.5s ease-in-out infinite; }
@keyframes eflash { 50% { stroke: var(--st-error); } }

/* ── Pulse Core: running persistent-loop agents look like they're WORKING ── */
.node .actring, .node .worker, .node .cdring { opacity: 0; }
.node.running.persistent .actring {
  opacity: calc(0.45 + 0.5 * var(--live, 1));         /* freshness drives brightness; floor 0.45 so it out-ranks idle */
  fill: none; stroke-width: 1.8; stroke-dasharray: 4 5;
  transform-box: fill-box; transform-origin: center;
  animation: actspin 7s linear infinite;
}
.node.running.persistent .worker { opacity: calc(0.45 + 0.55 * var(--live, 1)); }
/* the spark ORBITS the node centre — translate is inside the keyframe so it sweeps a full ring,
   not spinning in place (fill-box origin would otherwise pin to the displaced spark). */
.node.running.persistent .wspark {
  transform-box: fill-box; transform-origin: center;
  animation: orbit var(--orbit-dur, 7s) linear infinite;
  filter: drop-shadow(0 0 4px var(--st-running));
}
.node.running.persistent circle.glow { animation: nbeat 1.8s ease-out infinite; }   /* faster halo → running out-ranks idle */
/* live "working" treatment: a REAL task is in flight (an agent's active-work signal), distinct
   from the ambient process-up halo so working-vs-idle is obvious. Additive, overrides nothing. */
@keyframes workpulse { 0%,100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.3; } }
.node.working circle.body { stroke: var(--st-running); stroke-width: 3px; animation: workpulse 1s ease-in-out infinite; }
.node.working:hover circle.body { stroke-width: 3px; }   /* keep the working width on hover (no 3→2.5 jump) */
.node.working circle.glow { opacity: 1; animation: nbeat 1s ease-out infinite; }
/* soft "last scan failed" treatment (scan_failed feed): a dashed amber outline — clearly
   "needs a look" but distinct from green working + red error, and it does NOT change health status. */
.node.scanfail circle.body { stroke: var(--st-warn, #d9a441); stroke-width: 2.5px; stroke-dasharray: 3 2.5; }
/* agents reported from another device: a dashed ring = "remote"; faded when that device is
   asleep (status 'offline') so they never look falsely alive. */
.node.remote circle.body { stroke-dasharray: 2 2; }
.node.offline { opacity: 0.5; }
@keyframes actspin { to { transform: rotate(360deg); } }
@keyframes orbit { from { transform: rotate(0deg) translateX(var(--orbit-r, 21px)); } to { transform: rotate(360deg) translateX(var(--orbit-r, 21px)); } }
/* light theme: thin green strokes wash out on white — darken + drop the dark-tuned glow */
html[data-theme="light"] .node.running.persistent .actring { stroke: color-mix(in oklch, var(--st-running) 80%, black 14%); opacity: calc(0.62 + 0.38 * var(--live, 1)); }
html[data-theme="light"] .node.running.persistent .wspark { fill: color-mix(in oklch, var(--st-running) 80%, black 14%); filter: none; }
html[data-theme="light"] { --st-idle: oklch(0.55 0.07 245); }   /* countdown ring legible on white */

/* ── Self-healing: an agent the system is actively repairing gets a fast cyan "repair scan" ring,
      shown even when the node is stale/error (not running). The ring sweeps quicker than the
      green work-ring so "being fixed" reads differently from "working". ── */
.node.healing .actring {
  opacity: 0.92; fill: none; stroke: var(--st-heal); stroke-width: 2; stroke-dasharray: 3 4;
  transform-box: fill-box; transform-origin: center; animation: actspin 3s linear infinite;
}
.node.healing circle.glow { fill: var(--st-heal); animation: nbeat 1.4s ease-out infinite; }
.node.healing circle.body, .node.healing rect.body { stroke: var(--st-heal) !important; stroke-width: 1.6; }

/* scheduled idle agents quietly charge a countdown ring toward next_run_at (the parked counterpart) */
.node .cdring { fill: none; stroke: var(--st-idle); stroke-width: 1.6; transform-box: fill-box; transform-origin: center; transform: rotate(-90deg); transition: stroke-dashoffset .9s linear, opacity .3s; }
.node.error .cdring, .node.running .cdring { opacity: 0 !important; }

/* ambient idle breathe — nothing reads frozen */
@keyframes breathe { 0%,100% { transform: scale(1); } 50% { transform: scale(1.028); } }
.node.agent:not(.running):not(.error) circle.body, .node.host circle.body { transform-box: fill-box; transform-origin: center; animation: breathe 6.5s ease-in-out infinite; }
.node.host circle.body { animation-duration: 8s; }

/* living chrome: console + running KPI dot breathe; imminent runs shimmer */
@keyframes chrome-breathe { 0%,100% { opacity: 1; box-shadow: 0 0 7px var(--st-running); } 50% { opacity: .5; box-shadow: 0 0 3px var(--st-running); } }
.cs-head .live { animation: chrome-breathe 3.4s ease-in-out infinite; }
@keyframes runsheen { to { background-position: 200% 0; } }
.runrow.soon .fill { background: linear-gradient(90deg, var(--st-stale), color-mix(in oklch, var(--st-stale) 45%, #fff) 50%, var(--st-stale)); background-size: 200% 100%; animation: runsheen 2.2s linear infinite; }

/* one slow, seamless grid drift so the canvas breathes (parallax still composes on top) */
@keyframes griddrift { to { background-position: calc(var(--px, 0px) + 26px) calc(var(--py, 0px) + 26px); } }
#graph { animation: griddrift 60s linear infinite; }
.node text { font-family: 'Space Grotesk', sans-serif; fill: var(--text-dim); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round; pointer-events: none;
  font-size: calc(var(--fs, 11px) / clamp(0.7, var(--zoom, 1), 2.2)); }
.node.agent text { fill: var(--text); font-weight: 600; }
.node.sel text, .node:hover text { fill: var(--text); }
.node.minor text { opacity: 0; transition: opacity .18s; }
svg.zoomed .node.minor text, svg.show-all .node.minor text { opacity: 1; }
/* The #labels-btn (.show-all) is the single master toggle for the one label set:
   on by default, hides every node label when off. A selected/hovered node still
   shows its name so inspection stays usable with labels toggled off. */
svg:not(.show-all) .node text { opacity: 0; transition: opacity .18s; }
svg:not(.show-all) .node.sel text, svg:not(.show-all) .node:hover text { opacity: 1; }

/* graph chrome */
.g-tools { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 6px; }
.g-tools button { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border-soft); background: color-mix(in oklch, var(--panel) 78%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); display: grid; place-items: center; color: var(--text-dim); }
.g-tools button:hover { color: var(--text); border-color: var(--border); }
.g-tools button.on { color: var(--accent); border-color: var(--accent-line); }
.g-tools button svg { width: 15px; height: 15px; }
.g-legend { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 6px 12px; padding: 9px 12px; border-radius: 9px; border: 1px solid var(--border-soft); background: color-mix(in oklch, var(--panel) 80%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); max-width: 380px; }
.g-legend .li { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); }
.g-legend .li .d { width: 9px; height: 9px; border-radius: 50%; }
.g-legend .li .sq { width: 9px; height: 9px; border-radius: 2px; }
.g-legend .li .dep { width: 14px; height: 0; border-top: 2px dashed var(--accent-2); }
.g-banner { position: absolute; top: 12px; left: 12px; right: 56px; display: none; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 9px; background: color-mix(in oklch, var(--st-error) var(--tint), var(--panel)); border: 1px solid color-mix(in oklch, var(--st-error) 45%, transparent); font-size: 12.5px; }
.g-banner.show { display: flex; }
.g-banner svg { width: 16px; height: 16px; color: var(--st-error); flex: none; }
.g-loading { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-faint); font-size: 13px; background: var(--bg); }
.g-loading.show { display: flex; }
.g-loading .spin { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--border); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* mode switcher */
.panel-h .ph-left { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.panel-h .ph-left b { white-space: nowrap; }
.g-modes { display: inline-flex; gap: 4px; padding: 3px; border-radius: 9px; border: 1px solid var(--border-soft); background: var(--bg-2); flex: none; }
.gm-btn { padding: 4px 12px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: var(--text-dim); letter-spacing: 0.02em; transition: background .14s, color .14s; }
.gm-btn:hover:not(:disabled) { color: var(--text); }
.gm-btn.on { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.gm-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* 3D layer (Three.js canvas) */
#graph3d { position: absolute; inset: 0; display: none; }
#graph3d canvas { display: block; }
.graph-host[data-mode="force3d"] #g-minimap,
.graph-host[data-mode="force3d"] #g-chip { display: none; }
/* labels-btn + pins-btn now work in 3D too (overlay tags + drag-to-pin), so they stay visible. */
/* 3D node tags — HTML overlay projected over the canvas; graph-modes.js positions each div. */
.g3d-labels { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.g3d-label { position: absolute; top: 0; left: 0; white-space: nowrap; font: 600 11px 'Space Grotesk', sans-serif; color: var(--text-dim); text-shadow: 0 0 3px var(--bg), 0 0 3px var(--bg), 0 0 4px var(--bg); will-change: transform; transition: opacity .2s; }
.g3d-label.agent { color: var(--text); }
.g3d-label.dim { opacity: 0.16; }
.g3d-label.pinned::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); margin-right: 5px; vertical-align: middle; }

/* ===================== RIGHT PANEL ===================== */
.gx-right { border-left: 1px solid var(--border-soft); background: var(--panel); display: flex; flex-direction: column; min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.rp-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 50px 24px; color: var(--text-faint); height: 100%; }
.rp-empty svg { width: 38px; height: 38px; opacity: 0.5; }
.rp-empty b { color: var(--text-dim); font-size: 14px; font-weight: 600; }
.rp-empty span { font-size: 12.5px; line-height: 1.45; }

.rp-head { padding: 18px 18px 16px; border-bottom: 1px solid var(--border-soft); }
.rp-eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 8px; }
.rp-eyebrow svg { width: 12px; height: 12px; }
.rp-name { font-size: 18px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.rp-label { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-faint); margin-top: 5px; word-break: break-all; }
.rp-badge { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 5px 11px 5px 9px; border-radius: 7px; font-size: 12px; font-weight: 600; text-transform: capitalize; color: color-mix(in oklch, var(--st) 75%, var(--text)); background: color-mix(in oklch, var(--st) var(--tint), var(--panel)); border: 1px solid color-mix(in oklch, var(--st) 40%, transparent); }
.rp-badge .d { width: 8px; height: 8px; border-radius: 50%; background: var(--st); }

.rp-body { padding: 16px 18px 26px; display: flex; flex-direction: column; gap: 20px; }
.rp-sec h4 { margin: 0 0 9px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.rp-reason { font-size: 13px; line-height: 1.5; color: var(--text-dim); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv dt { color: var(--text-faint); white-space: nowrap; }
.kv dd { margin: 0; text-align: right; color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.rp-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.rp-metric { padding: 9px 11px; border: 1px solid var(--border-soft); border-radius: 9px; background: var(--bg-2); }
.rp-metric .mk { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.03em; }
.rp-metric .mv { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 3px; }
.rp-metric .mv.t { color: var(--st-running); } .rp-metric .mv.f { color: var(--st-error); }
.rp-metric .mv .u { font-size: 11px; color: var(--text-faint); margin-left: 2px; }
.rp-metric .mv svg { width: 16px; height: 16px; }
.rp-warn { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; line-height: 1.4; color: var(--text-dim); padding: 8px 10px; border-radius: 8px; background: color-mix(in oklch, var(--st-stale) 12%, var(--panel)); border: 1px solid color-mix(in oklch, var(--st-stale) 30%, transparent); margin-bottom: 6px; }
.rp-warn svg { width: 13px; height: 13px; color: var(--st-stale); flex: none; margin-top: 1px; }
.rp-files { display: flex; flex-direction: column; gap: 5px; }
.rp-file { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-dim); font-family: 'JetBrains Mono', monospace; }
.rp-file svg { width: 13px; height: 13px; color: var(--text-faint); flex: none; }
.neighbors { display: flex; flex-direction: column; gap: 5px; }
.nb { display: flex; align-items: center; gap: 9px; padding: 7px 9px; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: var(--text-dim); width: 100%; }
.nb:hover { background: var(--bg-2); color: var(--text); }
.nb .d { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.nb .d.sq { border-radius: 2px; }
.nb .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb .ty { font-size: 10px; color: var(--text-faint); text-transform: uppercase; }
.rp-links { display: flex; flex-wrap: wrap; gap: 8px; }
.rp-lnk { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; font-size: 12px; font-weight: 500; padding: 7px 11px; border-radius: 8px; border: 1px solid var(--border-soft); color: var(--text-dim); background: var(--bg-2); }
.rp-lnk:hover { color: var(--text); border-color: var(--border); }
.rp-lnk svg { width: 13px; height: 13px; }
.rp-lnk.dashboard { background: var(--accent); color: oklch(0.16 0.02 var(--acc-h)); border-color: transparent; font-weight: 600; }

/* ===================== CONSOLE ===================== */
.gx-console { border-top: 1px solid var(--border-soft); background: var(--panel); height: 132px; display: flex; flex-direction: column; }
.cs-head { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border-soft); font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.cs-head .live { width: 7px; height: 7px; border-radius: 50%; background: var(--st-running); box-shadow: 0 0 7px var(--st-running); }
.cs-body { flex: 1; overflow-y: auto; padding: 6px 16px 10px; font-family: 'JetBrains Mono', monospace; font-size: 11.5px; line-height: 1.7; scrollbar-width: thin; }
.cs-line { display: flex; gap: 10px; align-items: baseline; border-radius: 5px; padding: 0 4px; cursor: default; }
.cs-line[data-id] { cursor: pointer; }
.cs-line[data-id]:hover { background: var(--bg-2); }
.cs-line .t { color: var(--text-faint); }
.cs-line .bg { font-weight: 600; font-size: 9.5px; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; flex: none; }
.cs-line .ms { color: var(--text-dim); }
.cs-line .ms b { color: var(--text); font-weight: 500; }

/* sparklines (metric history) */
.spark { width: 100%; height: 18px; margin-top: 5px; display: block; overflow: visible; }
.spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.spark.down polyline { stroke: var(--st-stale); }

/* pinned-node marker */
.node.pinned circle.body, .node.pinned rect.body { stroke: var(--accent-2); stroke-dasharray: 2.5 2; }

/* minimap navigator */
.g-minimap { position: absolute; right: 12px; bottom: 12px; width: 140px; height: 96px; border-radius: 9px; border: 1px solid var(--border-soft); background: color-mix(in oklch, var(--panel) 82%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); overflow: hidden; cursor: pointer; }
.g-minimap svg { width: 100%; height: 100%; display: block; }
.mm-view { position: absolute; border: 1.5px solid var(--accent); background: color-mix(in oklch, var(--accent) 12%, transparent); border-radius: 2px; pointer-events: none; }
@media (max-width: 1200px) { .g-minimap { display: none; } }

/* hover quick-action chip */
.g-chip { position: absolute; transform: translate(-50%, -100%); display: none; gap: 4px; padding: 4px; border-radius: 9px; border: 1px solid var(--border-soft); background: color-mix(in oklch, var(--panel) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: 0 6px 18px rgba(0,0,0,0.32); z-index: 6; }
.g-chip.show { display: flex; }
.g-chip a { display: inline-flex; align-items: center; gap: 5px; padding: 5px 9px; border-radius: 6px; text-decoration: none; font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.g-chip a:hover { background: var(--bg-2); color: var(--text); }
.g-chip a svg { width: 13px; height: 13px; }

/* ===================== COMMAND PALETTE (Cmd/Ctrl+K) ===================== */
.cmdk-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh; background: color-mix(in oklch, var(--bg) 58%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: cmdk-fade .12s ease-out; }
.cmdk-backdrop[hidden] { display: none; }
@keyframes cmdk-fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk-modal { width: min(560px, calc(100vw - 32px)); max-height: 64vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 24px 64px -12px rgba(0,0,0,0.55), 0 0 0 1px var(--border-soft); overflow: hidden; animation: cmdk-pop .14s cubic-bezier(.2,.8,.3,1); }
@keyframes cmdk-pop { from { opacity: 0; transform: translateY(-8px) scale(.985); } to { opacity: 1; transform: none; } }
.cmdk-search { position: relative; display: flex; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--border-soft); }
.cmdk-search svg { width: 17px; height: 17px; color: var(--text-faint); flex: none; }
.cmdk-search input { flex: 1; min-width: 0; margin-left: 12px; height: 26px; border: none; background: none; color: var(--text); font: inherit; font-size: 15px; outline: none; }
.cmdk-search input::placeholder { color: var(--text-faint); }
.cmdk-results { flex: 1; min-height: 0; overflow-y: auto; padding: 6px; scrollbar-width: thin; }
.cmdk-empty { padding: 26px 16px; text-align: center; font-size: 13px; color: var(--text-faint); }
.cmdk-row { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 11px; border-radius: 9px; cursor: pointer; transition: background .1s; }
.cmdk-row:hover { background: var(--bg-2); }
.cmdk-row.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.cmdk-row .d { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--st); box-shadow: 0 0 7px color-mix(in oklch, var(--st) 60%, transparent); }
.cmdk-row .d.ring { background: transparent; box-shadow: inset 0 0 0 2px var(--st); }
.cmdk-row .cm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cmdk-row .cm-nm { font-size: 13.5px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-row .cm-sub { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmdk-row .cm-kind { flex: none; font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-faint); padding: 3px 7px; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--border-soft); }
.cmdk-foot { display: flex; align-items: center; gap: 16px; padding: 9px 14px; border-top: 1px solid var(--border-soft); background: var(--bg-2); font-size: 11px; color: var(--text-faint); }
.cmdk-foot span { display: inline-flex; align-items: center; gap: 5px; }
.cmdk-foot kbd, .ts-kbd { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.cmdk-foot kbd { font-size: 10px; min-width: 16px; text-align: center; color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--border-soft); border-radius: 4px; padding: 2px 4px; line-height: 1; }

/* ===================== OFFCANVAS NAV ===================== */
.oc-burger { display: none; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border-soft); background: var(--bg-2); color: var(--text-dim); font: inherit; font-size: 12px; cursor: pointer; }
@media (max-width: 860px) { .oc-burger { display: inline-flex; } }   /* show only once the inline nav links collapse */
.oc-burger:hover { color: var(--text); border-color: var(--border); }
.oc-burger svg { width: 16px; height: 16px; }
.oc-backdrop { position: fixed; inset: 0; z-index: 60; background: color-mix(in oklch, var(--bg) 60%, transparent); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .22s ease; }
.oc-backdrop.open { opacity: 1; pointer-events: auto; }
.oc-drawer { position: fixed; top: 0; right: 0; z-index: 61; height: 100dvh; width: min(20rem, 86vw); background: var(--panel); border-left: 1px solid var(--border-soft); display: flex; flex-direction: column; transform: translateX(100%); visibility: hidden; transition: transform .26s cubic-bezier(.4,0,.2,1), visibility 0s linear .26s; box-shadow: -18px 0 48px rgba(0,0,0,0.5); }
.oc-drawer.open { transform: none; visibility: visible; transition: transform .26s cubic-bezier(.4,0,.2,1), visibility 0s; }
.oc-drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 14px 15px; border-bottom: 1px solid var(--border-soft); }
.oc-drawer__t { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-faint); }
.oc-close { background: none; border: none; color: var(--text-faint); font-size: 22px; line-height: 1; cursor: pointer; padding: 0 2px; }
.oc-close:hover { color: var(--text); }
/* phone-only "tools" tray inside the drawer: the live header controls (updated · accent
   colours · cpu/mem/temp · theme) are relocated here by graph-app.js below 768px. */
.oc-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 13px 15px; border-bottom: 1px solid var(--border-soft); }
.oc-tools:empty { display: none; }
.oc-tools .updated { font-size: 12.5px; }
.oc-tools .sysbadge { align-self: flex-start; }
.oc-tools .accent-picker { display: flex; gap: 8px; }
.oc-tools .accent-picker button { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border-soft); cursor: pointer; padding: 0; }
.oc-tools #theme-btn { flex: none; }
.oc-nav { display: flex; flex-direction: column; padding: 8px; gap: 2px; overflow-y: auto; flex: 1; }
.oc-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); padding: 11px 12px; border-radius: 8px; font-size: 14px; }
.oc-link:hover { background: var(--bg-2); }
.oc-link[aria-current="page"] { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.oc-link__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); flex: none; }
.oc-link[aria-current="page"] .oc-link__dot { background: var(--accent); }
.oc-link__sub { margin-left: auto; font-size: 10.5px; color: var(--text-faint); font-family: 'JetBrains Mono', ui-monospace, monospace; }
.oc-drawer__foot { padding: 11px; border-top: 1px solid var(--border-soft); display: flex; gap: 8px; flex-wrap: wrap; }
.oc-rc { display: inline-flex; align-items: center; gap: 5px; text-decoration: none; color: var(--text-dim); background: var(--bg-2); border: 1px solid var(--border-soft); border-radius: 7px; padding: 6px 10px; font-size: 12px; }
.oc-rc:hover { color: var(--text); border-color: var(--border); }
@media (prefers-reduced-motion: reduce) { .oc-backdrop, .oc-drawer { transition: none; } }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 1240px) { .crumb { display: none; } }
@media (max-width: 1080px) { .top-search { display: none; } }
@media (max-width: 980px) {
  .gx-body { grid-template-columns: minmax(0,1fr) 312px; }
  /* hide the left panel only while it's docked in the grid; JS relocates the live element into the
     nav drawer below 980px, where this descendant selector does NOT match, so it stays visible there. */
  .gx-body > .gx-left { display: none; }
}
/* Below ~860px the status + nav cluster (.top-right) no longer fits beside the
   brand, and .gx-top's overflow:hidden was clipping the header nav links off the
   right edge — unreachable on phones. Let the header wrap instead. */
@media (max-width: 860px) {
  .gx-top { height: auto; min-height: 52px; flex-wrap: wrap; overflow: visible; padding: 8px 14px 9px; row-gap: 8px; }
  .top-right { margin-left: 0; flex: 1 1 100%; flex-wrap: wrap; gap: 8px 10px; }
  /* the inline text nav moves into the offcanvas drawer here.
     !important is needed to beat the elements' inline style="display:inline-flex". */
  .top-right a.icon-btn { display: none !important; }
  /* iOS zooms the page when a focused input's font is < 16px and never zooms back, mis-sizing the SVG */
  .top-search input, .cmdk-search input, input { font-size: 16px; }
}
/* Phone: header is exactly brand (logo) on the left + the menu button on the right.
   graph-app.js relocates the live controls (updated · colours · cpu/mem/temp · theme)
   into the drawer's .oc-tools tray, so the header is a clean single row again. */
@media (max-width: 768px) {
  .gx-top { height: 56px; min-height: 56px; flex-wrap: nowrap; overflow: hidden; padding: 0 14px; row-gap: 0; padding-top: env(safe-area-inset-top); }
  .top-right { margin-left: auto; flex: 0 0 auto; flex-wrap: nowrap; gap: 8px; }
}
@media (max-width: 680px) {
  .gx-body { grid-template-columns: minmax(0,1fr); }
  /* Detail becomes a bottom SHEET (was display:none, which left node-taps showing nothing). #detail
     stays in the DOM so renderDetail() keeps working; JS toggles .sheet-open on selection. */
  .gx-right {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto;
    max-height: 80dvh; z-index: 55; overflow-y: auto; -webkit-overflow-scrolling: touch;
    border-left: none; border-top: 1px solid var(--border-soft); border-radius: 16px 16px 0 0;
    box-shadow: 0 -18px 48px rgba(0,0,0,.5);
    transform: translateY(100%); transition: transform .26s cubic-bezier(.4,0,.2,1);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .gx-right.sheet-open { transform: none; }
  .gx-console { height: auto; max-height: 24dvh; }
  .g-legend { display: none; }          /* the squeezed phone graph needs the canvas; colors are in the detail sheet */
  .g-tools { top: 10px; right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .edge.active { stroke-dasharray: none; }
  /* bloom is a filter, not animation, so the static glow survives */
}
/* iPhone safe areas (needs viewport-fit=cover in the meta) so chrome clears the notch + home indicator */
.gx-top { padding-top: env(safe-area-inset-top); }
.gx-console { padding-bottom: env(safe-area-inset-bottom); }
/* Touch devices: the deck's controls were sub-44px (zoom tools 32px, mode pills ~24px) — too small for
   a thumb. Bump only on coarse pointers so the dense desktop UI (fine pointer) is untouched. */
@media (pointer: coarse) {
  .g-tools button { width: 44px; height: 44px; }
  .g-tools button svg { width: 18px; height: 18px; }
  .gm-btn { padding: 9px 14px; }
  .icon-btn, .oc-burger { min-height: 40px; }
}
