/* Global Graph main-content view (.gx-*) and spherical embedding graph tooltips (.graph-tip, .graph-zoomout).
   Uses CommandAGI's theme tokens (--bg-*, --border-*, --text-*, --brand, --ok, --warn, --danger, --paper) with
   calm two-column inset pill-nav layout, concentric hover rows, soft surfaces, and zero-overshoot transitions. */

/* Full-pane host inside a regular workspace pane (.detail-body.graph-page) */
.detail-body.graph-page {
  padding: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.graph-live-surface,
.gx-host {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Active state for the left-rail Graph view button: soft rounded pill surface, no single-side bar/border */
.rail .dock-tab.rail-graph {
  border-bottom: 0;
}
.rail .dock-tab.rail-graph.active::before,
.dock > .rail.drawer-strip .dock-tab.rail-graph.active::before {
  content: none;
  display: none;
}
.rail .dock-tab.rail-graph.active,
.dock > .rail.drawer-strip .dock-tab.rail-graph.active {
  border-bottom-color: transparent;
}
.rail .dock-tab.rail-graph.active .nav-glyph,
.dock > .rail.drawer-strip .dock-tab.rail-graph.active .nav-glyph {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: hsl(var(--brand) / .14);
  color: hsl(var(--brand));
}

.gx-shell {
  --gx-ease: cubic-bezier(.3, 0, .1, 1);
  --gx-r: 14px;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  background: hsl(var(--paper));
  color: hsl(var(--text-1));
  overflow: hidden;
}

/* Workbench LHS dock panel for Graph search, filters, pinned nodes and display */
.gx-dock-panel {
  --gx-ease: cubic-bezier(.3, 0, .1, 1);
  --gx-r: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 10px 16px;
  min-height: 0;
  color: hsl(var(--text-1));
}
.gx-dock-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.gx-dock-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border-1));
  border-radius: 999px;
  background: transparent;
  color: hsl(var(--text-2));
  font: 500 12px/1 var(--font-sans);
  transition: background .14s var(--gx-ease), color .14s var(--gx-ease), border-color .14s var(--gx-ease);
}
.gx-dock-tab:hover {
  background: hsl(var(--text-1) / .06);
  color: hsl(var(--text-1));
}
.gx-dock-tab[aria-selected="true"] {
  background: hsl(var(--brand) / .14);
  border-color: hsl(var(--brand) / .45);
  color: hsl(var(--text-1));
  font-weight: 600;
}
.gx-dock-tab[aria-selected="true"] > svg:first-child {
  color: hsl(var(--brand));
}
.gx-dock-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.gx-dock-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.gx-dock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.gx-dock-head .gx-sect {
  margin: 4px 0;
}
.gx-dock-stat {
  font-size: 11px;
  color: hsl(var(--text-3));
  padding: 2px 4px;
}
.gx-dock-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.gx-dock-group .gx-sect {
  margin: 6px 0 2px;
}
.gx-dock-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.gx-select-full {
  width: 100%;
}
.gx-line-compact {
  min-height: 38px;
  padding: 6px 8px;
  gap: 8px;
}
.gx-line-stack {
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  padding: 8px 10px;
  gap: 6px;
}
.gx-line-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.gx-range {
  width: 100%;
  margin: 0;
}

/* Pill search input */
.gx-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 6px 0 12px;
  border-radius: 999px;
  background: hsl(var(--bg-0));
  border: 1px solid hsl(var(--border-1));
  color: hsl(var(--text-3));
  flex: none;
}
.gx-search:focus-within {
  border-color: hsl(var(--border-2));
  color: hsl(var(--text-1));
}
.gx-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  padding: 0;
  background: transparent;
  font: 13px var(--font-sans);
  color: hsl(var(--text-1));
}
.gx-search input:focus { border: 0; }
.gx-search input::-webkit-search-cancel-button { display: none; }
.gx-search-clear {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  justify-content: center;
  color: hsl(var(--text-3));
}
.gx-search-clear:hover {
  background: hsl(var(--bg-2));
  color: hsl(var(--text-1));
}
.gx-search-hits {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 0 4px;
}
.gx-search-count {
  width: 100%;
  font: 500 10.5px var(--font-mono);
  color: hsl(var(--text-3));
  padding: 0 4px 2px;
}
.gx-hit-chip {
  height: 24px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-2));
  background: hsl(var(--bg-1));
  color: hsl(var(--text-1));
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gx-hit-chip:hover {
  border-color: hsl(var(--brand) / .65);
  background: hsl(var(--bg-2));
}

/* Grouped pill navigation */
.gx-navlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.gx-navitem {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  height: auto;
  padding: 6px 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: hsl(var(--text-2));
  font: 400 13.5px/1.3 var(--font-sans);
  text-align: left;
  transition: background .14s var(--gx-ease), color .14s var(--gx-ease);
}
.gx-navitem > svg:first-child {
  flex: none;
  color: hsl(var(--text-3));
}
.gx-navitem-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gx-navitem:hover {
  background: hsl(var(--text-1) / .06);
  color: hsl(var(--text-1));
}
.gx-navitem[aria-current="page"] {
  background: hsl(var(--text-1) / .1);
  color: hsl(var(--text-1));
  font-weight: 600;
}
.gx-navitem[aria-current="page"] > svg:first-child {
  color: hsl(var(--brand));
}
.gx-count {
  font: 500 11.5px/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: hsl(var(--text-3));
  padding: 2px 6px;
  border-radius: 999px;
  background: hsl(var(--text-1) / .06);
}
.gx-navrule {
  height: 8px;
  background: transparent;
  margin: 2px 0;
}

/* Main right pane + feathered translucent sticky header */
.gx-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.gx-bar {
  position: sticky;
  top: 0;
  z-index: 4;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 44px;
  padding: 0 16px;
  background: hsl(var(--paper) / .88);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.gx-bar-left, .gx-bar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.gx-bar-title {
  font: 600 15px/1.2 var(--font-sans);
  letter-spacing: -.015em;
  color: hsl(var(--text-1));
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.gx-pill {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-2));
  background: hsl(var(--bg-1));
  color: hsl(var(--text-2));
  font: 500 11px var(--font-mono);
}

.gx-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.gx-body.gx-body-space {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.gx-space-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 12px 16px 14px;
  gap: 12px;
}
.gx-space-host {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.gx-space-host .map {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.gx-space-host .graph-stage-compact {
  flex: 1;
  height: auto;
  min-height: 260px;
}

/* Slide-in inspector inside Space */
.gx-inspector {
  flex: 0 0 280px;
  max-width: 42%;
  border: 1px solid hsl(var(--border-1));
  border-radius: var(--gx-r);
  background: hsl(var(--bg-1));
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.gx-inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 8px 12px;
  background: hsl(var(--bg-2) / .45);
  font: 500 10.5px/1 var(--font-mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: hsl(var(--text-3));
}
.gx-inspector-close {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  justify-content: center;
}

/* Config sections & Exocortex concentric cards */
.gx-panel {
  padding: 20px 28px 36px;
  max-width: 760px;
}
.gx-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.gx-htext { min-width: 0; }
.gx-head h3 {
  font: 600 19px/1.25 var(--font-sans);
  letter-spacing: -.02em;
  text-transform: none;
  color: hsl(var(--text-1));
  margin: 0;
}
.gx-head p {
  margin: 4px 0 0;
  color: hsl(var(--text-3));
  font-size: 13px;
  line-height: 1.45;
}
.gx-sect {
  font: 600 11px/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: hsl(var(--text-3));
  margin: 22px 0 8px;
}
.gx-card {
  border: 1px solid hsl(var(--border-1));
  border-radius: var(--gx-r);
  background: hsl(var(--bg-1));
}
.gx-card-rows {
  --gx-inset: 6px;
  padding: var(--gx-inset);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gx-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gx-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 50px;
  padding: 8px 10px;
  border-radius: calc(var(--gx-r) - var(--gx-inset));
  transition: background .12s var(--gx-ease);
}
.gx-line:hover {
  background: hsl(var(--bg-2) / .65);
}
.gx-line-muted {
  min-height: 40px;
}
.gx-words {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.gx-name {
  font-size: 13.5px;
  font-weight: 500;
  color: hsl(var(--text-1));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gx-about {
  font-size: 12px;
  color: hsl(var(--text-3));
  line-height: 1.35;
}
.gx-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}
.gx-ctl-stack {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.gx-row-plate {
  width: 52px;
}

/* Verdict & inline status banners */
.gx-verdict {
  border: 1px solid hsl(var(--border-2));
  border-radius: var(--gx-r);
  padding: 12px 14px;
  margin-bottom: 14px;
  background: hsl(var(--bg-1));
}
.gx-verdict.pass {
  border-color: hsl(var(--ok) / .45);
  background: hsl(var(--ok) / .08);
}
.gx-verdict.fail {
  border-color: hsl(var(--warn) / .55);
  background: hsl(var(--warn) / .1);
}
.gx-verdict-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: hsl(var(--text-1));
}
.gx-verdict-body {
  margin: 4px 0 0 16px;
  font-size: 12.5px;
  color: hsl(var(--text-2));
  line-height: 1.4;
}
.gx-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid hsl(var(--border-1));
  font-size: 12.5px;
  color: hsl(var(--text-2));
}
.gx-banner.ok { border-color: hsl(var(--ok) / .4); background: hsl(var(--ok) / .07); }
.gx-banner.warn { border-color: hsl(var(--warn) / .5); background: hsl(var(--warn) / .09); }
.gx-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: hsl(var(--text-3));
}
.gx-dot.ok { background: hsl(var(--ok)); }
.gx-dot.warn { background: hsl(var(--warn)); }

/* Controls: pill buttons, segmented controls, switches, selects & inputs */
.gx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid hsl(var(--brand));
  background: hsl(var(--brand));
  color: hsl(var(--brand-fg));
  font: 500 12.5px/1 var(--font-sans);
  white-space: nowrap;
}
.gx-btn.ghost {
  background: hsl(var(--bg-0));
  color: hsl(var(--text-1));
  border-color: hsl(var(--border-2));
}
.gx-btn.ghost:hover {
  background: hsl(var(--bg-2));
}
.gx-btn.sm {
  height: 28px;
  padding: 0 11px;
  font-size: 12px;
}
.gx-iconbtn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: hsl(var(--text-2));
}
.gx-iconbtn:hover {
  background: hsl(var(--bg-2));
  color: hsl(var(--text-1));
}
.gx-seg {
  display: inline-flex;
  border: 1px solid hsl(var(--border-2));
  border-radius: 999px;
  padding: 2px;
  background: hsl(var(--bg-0));
}
.gx-seg button {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: hsl(var(--text-2));
  font-size: 12px;
}
.gx-seg button[aria-checked="true"] {
  background: hsl(var(--brand));
  color: hsl(var(--brand-fg));
  font-weight: 600;
}
.gx-toggle {
  position: relative;
  width: 34px;
  height: 20px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-2));
  background: hsl(var(--bg-3));
  transition: background .15s var(--gx-ease), border-color .15s var(--gx-ease);
}
.gx-toggle::after {
  content: "";
  position: absolute;
  left: 2px;
  top: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: hsl(var(--text-2));
  transition: transform .15s var(--gx-ease), background .15s var(--gx-ease);
}
.gx-toggle[aria-checked="true"] {
  background: hsl(var(--brand));
  border-color: hsl(var(--brand));
}
.gx-toggle[aria-checked="true"]::after {
  transform: translateX(14px);
  background: hsl(var(--brand-fg));
}
.gx-select, .gx-input, .gx-num {
  height: 30px;
  padding: 0 10px;
  border: 1px solid hsl(var(--border-2));
  border-radius: 9px;
  background: hsl(var(--bg-0));
  color: hsl(var(--text-1));
  font-size: 12px;
}
.gx-input-sm { width: 148px; }
.gx-num { width: 72px; text-align: right; font-variant-numeric: tabular-nums; }
.gx-val {
  min-width: 38px;
  text-align: right;
  font-size: 11.5px;
  color: hsl(var(--text-2));
  font-variant-numeric: tabular-nums;
}
.gx-override-form {
  flex-wrap: wrap;
  gap: 8px;
}
.gx-foot-actions {
  margin-top: 16px;
  display: flex;
  gap: 8px;
}
.gx-empty {
  border: 1px dashed hsl(var(--border-2));
  border-radius: var(--gx-r);
  padding: 28px 20px;
  text-align: center;
  display: grid;
  justify-items: center;
  gap: 12px;
  color: hsl(var(--text-3));
}

/* ---------- Spherical graph canvas layers, tooltips & floating zoom-out pill (graph-view.js) ---------- */
.graph-gl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.graph-sphere-canvas {
  position: relative;
  z-index: 1;
  cursor: grab;
}
.graph-sphere-canvas:active {
  cursor: grabbing;
}
.graph-tip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  width: min(280px, calc(100% - 24px));
  max-height: min(300px, 65%);
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 14px;
  background: hsl(var(--bg-1) / .96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border: 1px solid hsl(var(--border-2));
  box-shadow: var(--shadow-float);
  pointer-events: auto;
  display: grid;
  gap: 6px;
  will-change: transform;
}
.graph-tip[data-pinned="true"] {
  border-color: hsl(var(--brand) / .75);
}
.graph-tip[data-pinned="true"] [data-graph-tip-pin],
.graph-tip [data-graph-tip-zoom][aria-pressed="true"] {
  color: hsl(var(--brand));
}
.graph-tip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.graph-tip-plate {
  width: 38px !important;
  flex: none;
}
.graph-tip-words {
  flex: 1;
  min-width: 0;
}
.graph-tip-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: none;
}
.graph-tip-btn {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  justify-content: center;
  color: hsl(var(--text-3));
}
.graph-tip-btn:hover {
  background: hsl(var(--bg-2));
  color: hsl(var(--text-1));
}
html .graph-tip-btn[aria-pressed="true"] {
  border-radius: 999px;
  box-shadow: none;
  color: hsl(var(--brand));
}
.graph-tip-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: hsl(var(--text-3));
}
.graph-tip-addr {
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: hsl(var(--text-4));
}
.graph-tip-neighbors {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.graph-tip-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  max-width: 100%;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-1));
  background: hsl(var(--bg-2) / .65);
  color: hsl(var(--text-2));
  font-size: 11px;
}
.graph-tip-chip:hover {
  border-color: hsl(var(--brand) / .55);
  color: hsl(var(--text-1));
}
.graph-tip-next {
  justify-self: start;
  height: 22px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: hsl(var(--brand));
  font-size: 11.5px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.graph-zoomout {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 10px;
  transform: translateX(-50%);
  height: 28px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-2));
  background: hsl(var(--bg-1) / .94);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-float);
  color: hsl(var(--text-1));
  font-size: 12px;
}
.graph-depth-toggle, .graph-unpin-all {
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid hsl(var(--border-2));
  background: hsl(var(--bg-1));
  color: hsl(var(--text-2));
  font-size: 11px;
}
html .graph-depth-toggle[aria-pressed="true"] {
  border-radius: 999px;
  box-shadow: none;
  border-color: hsl(var(--brand) / .7);
  color: hsl(var(--text-1));
}
.graph-pin-badge {
  font: 500 10.5px var(--font-mono);
  color: hsl(var(--brand));
  padding: 0 4px;
}

/* Responsive phone / narrow layout */
@media (max-width: 760px) {
  .gx-inspector { position: absolute; inset: auto 10px 10px 10px; max-width: none; max-height: 45%; z-index: 10; }
}

@media (prefers-reduced-motion: reduce) {
  .gx-dock-tab, .gx-line, .gx-toggle, .gx-toggle::after {
    transition: none;
  }
}
