/* ==========================================================================
   L-shell chrome — the unified rail + tab-bar + pane-host frame.

   Scope (step 1): structural shell only — the rail shell, the tab bar, and the
   pane frame.  Rail *content* (Cluster health, Workspaces tree, Manage groups)
   and pane *content* (chat turns, approval card, composer) are NOT here:
     - state glyphs reuse ui-base.css `.ui-glyph-*` (the canonical shape+colour
       vocabulary), not a private glyph class;
     - chat / approval / composer styling lives in chat.css + coordinator.css;
     - rail IA rows (.cluster/.nav/.grp) land alongside their markup in steps 2-3.

   Tokens are the real base.css names (mock drafted against `--elevated`/`--r`/
   `--accent-glow` which map to `--bg-elevated`/`--r-md`/`--accent-glow-strong`).
   ========================================================================== */

/* ===== The L: rail (|) + content (—) ===== */
.app {
  display: grid;
  grid-template-columns: 266px 1fr;
  height: 100vh;
  overflow: hidden;
}
/* Responsive: desktop-first.  Two rail modes beyond the default 266px column,
   both defined in the "Collapsed rail" / "Mobile drawer" sections at the end of
   this sheet:
     - DESKTOP COLLAPSE (user preference, `.app.rail-collapsed`): the rail
       shrinks to a 52px glyph-only strip — live state glyphs remain the
       navigation; text labels hide.
     - The deferred mobile off-canvas drawer (max-width media query). */

/* ===== Rail (the | of the L) ===== */
.rail {
  background: var(--panel);
  border-right: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.rail-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 14px 11px;
  border-bottom: 1px solid var(--hair);
}
.brand-mark {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), #b9762a);
  box-shadow: 0 0 10px var(--accent-glow-strong);
  flex: none;
}
.brand-name {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.2px;
  font-size: 14px;
}
.brand-sub {
  color: var(--ink-4);
  font-size: 11px;
  margin-left: -3px;
}
/* the brand is a real button (keyboard "home") styled to look like plain text */
.brand-home {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.brand-home:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
/* collapse toggle — far side of the brand row.  Desktop-only: the mobile
   drawer always presents the full rail, so the button hides there (see the
   responsive section at the end of this sheet). */
.rail-collapse {
  margin-left: auto;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  border-radius: var(--r-sm);
  color: var(--ink-4);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font-ui);
}
.rail-collapse:hover {
  background: var(--panel-2);
  color: var(--ink-2);
}
.rail-collapse:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.rail-scroll {
  flex: 1;
  overflow: auto;
  padding: 10px 8px 6px;
}
.sec-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ink-4);
  font-weight: 600;
  padding: 12px 8px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sec-label .count {
  margin-left: auto;
  color: var(--ink-4);
  font-weight: 500;
  letter-spacing: 0;
}

/* ===== Rail live sections (Cluster + Workspaces) — fed by Tier-1 (rail.js).
   State = shape + colour via ui-base.css .ui-glyph-*; rows are <button>s so
   they're keyboard-operable (button resets below). ===== */
.rail-section {
  margin-bottom: 2px;
}

/* cluster strip + node list */
.cluster {
  margin: 2px 4px 4px;
  padding: 9px 10px;
  background: var(--panel-2);
  border: 1px solid var(--hair);
  border-radius: var(--r-md);
}
.cluster-row {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}
.cpill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background: none;
  border: 0;
  padding: 0;
  font-family: var(--font-ui);
  cursor: pointer;
}
.cpill b {
  color: var(--ink-2);
  font-weight: 600;
}
.cpill:hover {
  color: var(--ink);
}
.cluster-nodes {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  gap: 1px;
}
/* The "Nodes · N" header is a collapse toggle (a <button>) — click to hide/show
   the node list (it re-renders on every Tier-1 snapshot, so the state persists in
   rail.js).  Button-reset to keep its label look. */
.nlabel {
  display: flex;
  align-items: center;
  width: 100%;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  font-weight: 600;
  margin-bottom: 4px;
  padding: 2px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-ui);
}
.nlabel:hover {
  color: var(--ink-2);
}
.nlabel-caret {
  display: inline-block;
  margin-right: 5px;
  font-size: 8px;
  color: var(--ink-4);
  transition: transform 0.12s;
}
.nlabel[aria-expanded="false"] .nlabel-caret {
  transform: rotate(-90deg);
}
.nlabel .drift {
  margin-left: auto;
  color: var(--yellow);
  letter-spacing: 0;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.node-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  border-radius: var(--r-sm);
  cursor: pointer;
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: var(--font-ui);
}
.node-row:hover {
  background: var(--panel);
}
.node-row .nn {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-2);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node-row .ver {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
}
.node-row .ver.drift {
  color: var(--yellow);
}
/* Light-theme AA: these ≤11px rail micro-labels are --ink-4 (~3.9-4.0:1 on the
   light --panel) — one step to --ink-3 (~6.5:1) for AA; dark --ink-4 already
   clears it so it keeps the dimmer hint.  Same escape hatch as .tab-menu-key /
   .conv-batch-tier.  (Drift versions keep their --yellow cue.) */
[data-theme="light"] .sec-label,
[data-theme="light"] .nlabel,
[data-theme="light"] .node-row .ver:not(.drift),
[data-theme="light"] .grp-head .gcount {
  color: var(--ink-3);
}
.node-row .nws {
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  font-size: 11px;
  min-width: 42px;
  text-align: right;
}

/* workspaces — session nav tree */
.nav {
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav li {
  list-style: none;
}
.row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-2);
  position: relative;
  font-size: 13px;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  font-family: var(--font-ui);
}
.row:hover {
  background: var(--panel-2);
}
.row .glyph {
  width: 16px;
  text-align: center;
  color: var(--ink-4);
  font-size: 12px;
  flex: none;
}
.row .nm {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row .rcount {
  font-size: 10px;
  color: var(--ink-4);
  font-variant-numeric: tabular-nums;
}
.row .tag,
.kind-tag {
  font-size: 9px;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 9px;
  border: 1px solid var(--hair-2);
  color: var(--ink-4);
}
.row .tag.coord,
.kind-tag.coord {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--hair-2));
}
.row.open {
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
}
.row.open::before {
  content: "";
  position: absolute;
  left: -8px;
  top: 5px;
  bottom: 5px;
  width: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.row.open .nm {
  color: var(--ink);
}
.children {
  list-style: none;
  margin: 1px 0 3px 13px;
  padding-left: 14px;
  border-left: 1px solid var(--hair);
}

/* connection indicator — relocated #status-bar (was the header text bar).
   `disconnected` is toggled by app.js connectSSE on stream loss. */
.rail-conn {
  padding: 2px 10px;
  font-size: 10px;
  color: var(--ink-4);
  min-height: 0; /* quiet when connected — don't reserve a permanent status slot */
}
.rail-conn.disconnected {
  color: var(--warn);
}

/* rail footer — relocated header controls + user chip */
.rail-foot {
  border-top: 1px solid var(--hair);
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* relocated header controls.  Text buttons (admin / logout) keep a text shape;
   only glyph-only buttons (the ☾ theme toggle, future .ico-btn) collapse to a
   square — otherwise multi-char labels overflow a 28px box and overlap. */
.rail-foot .header-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hair);
  background: var(--panel-2);
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}
.rail-foot .header-btn:hover {
  border-color: var(--accent-dim);
  color: var(--ink);
}
.rail-foot #theme-toggle {
  width: 28px;
  padding: 0;
  font-size: 13px;
}
.ico-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: var(--r-sm);
  border: 1px solid var(--hair);
  background: var(--panel-2);
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
}
.ico-btn:hover {
  border-color: var(--accent-dim);
  color: var(--ink);
}
/* The user chip is a menu button (click → Log out); reset native button
   chrome so it reads as the rail's identity line, not a form control. */
.user-chip {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-3);
  font-size: 12px;
  padding: 4px 6px;
  margin-right: -6px;
  border: none;
  border-radius: var(--r-sm);
  background: none;
  font-family: inherit;
  cursor: pointer;
}
.user-chip:hover {
  background: var(--panel-2);
  color: var(--ink);
}
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--hair-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--ink-2);
}

/* ===== Content (the — of the L): tab bar + pane host ===== */
.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.tabbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--hair);
  background: var(--panel);
  position: relative;
  z-index: 20;
}
/* The tabs live in their own strip (the role=tablist element — the burger and
   the [+] tail sit OUTSIDE it in .tabbar, see shell.js buildShell).  On mobile
   the strip is the horizontal scroller, so those stay pinned. */
.tabstrip {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.tab {
  position: relative;
  flex: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding: 6px 11px;
  border-radius: var(--r-md);
  font-size: 12.5px;
  line-height: 1.2;
  color: var(--ink-3);
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  font-family: var(--font-ui);
  /* long workstream names ellipsize (.tab-title) instead of growing the tab */
  max-width: 240px;
}
.tab-title {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Tab glyph spacing — applies to BOTH the static decorative char (Dashboard /
   Admin, via .glyph) and the live state glyph (.ui-glyph-* on conversational
   tabs).  The static glyph is dim --ink-4; the live glyph keeps its own
   .ui-glyph-* state colour, so it is NOT given a colour here. */
.tab .tab-glyph {
  margin-right: 6px;
  font-size: 11px;
}
.tab .glyph {
  color: var(--ink-4);
}
.tab:hover {
  background: var(--panel-2);
}
.tab.active {
  background: var(--panel-2);
  border-color: var(--hair-2);
  color: var(--ink);
}
/* Active tab's STATIC glyph (Dashboard / Admin) brightens a touch; live state
   glyphs on conversational tabs keep their .ui-glyph-* state colour instead. */
.tab.active .glyph {
  color: var(--ink-2);
}
/* Tab-action caret — opens the pane's action dropdown (step 7).  A decorative
   span inside the tab <button> (a nested <button> is invalid markup); the menu
   it triggers is keyboard-reachable via ContextMenu / Shift+F10 on the focused
   tab.  Dim by default, brightening on tab hover / active / open. */
.tab-caret {
  margin-left: 6px;
  margin-right: -3px;
  padding: 2px 3px;
  color: var(--ink-4);
  font-size: 10px;
  line-height: 1;
  border-radius: var(--r-sm);
  transition:
    color 0.1s,
    background 0.1s;
}
.tab:hover .tab-caret,
.tab.active .tab-caret {
  color: var(--ink-2);
}
.tab-caret:hover,
.tab[aria-expanded="true"] .tab-caret {
  color: var(--ink);
}
.tab-caret:hover {
  background: var(--hair-2);
}
/* Split controls in the tab-bar tail (they replaced the redundant [+] — the
   permanent Dashboard tab IS the launcher).  One ◫ glyph for both directions;
   the down variant rotates the glyph span, not the button (a rotated button
   would rotate its focus ring too). */
.tb-split {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* --ink-3, not the chrome-ghost --ink-4: these are available CONTROLS and
     the [+] convention they replaced is gone — they must read as present. */
  color: var(--ink-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  border: none;
  background: none;
  font-family: var(--font-ui);
}
.tb-split:hover {
  background: var(--panel-2);
  color: var(--ink-2);
}
.tb-split:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.tb-split .tb-glyph {
  display: inline-block;
  /* greyscale AA — subpixel RGB rendering fringes these box-drawing glyphs
     with blue/amber bleed against the panel */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.tb-split--down .tb-glyph {
  transform: rotate(90deg);
}
.tabbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-4);
  /* hairline fence so the split cluster reads as one "layout" control group */
  border-left: 1px solid var(--hair);
  padding-left: 10px;
}
/* Drawer toggle + backdrop — desktop keeps the rail in the grid, so both are
   dormant here; the mobile block at the end of this sheet brings them up. */
.rail-burger {
  display: none;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  color: var(--ink-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  border: none;
  background: none;
  font-family: var(--font-ui);
  flex: none;
}
.rail-burger:hover {
  background: var(--panel-2);
  color: var(--ink);
}
.rail-burger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.rail-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 390;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
}

/* Tab-action dropdown — promoted to the shared shell sheet so the console and
   the standalone server both render it.  Recovers the retired `.ws-tab-dropdown`
   design (git 92ad5bd4) translated onto the DS token vocabulary (the old sheet
   used --bg-surface/--border/--fg-*; the shell speaks --panel/--hair/--ink-*). */
.tab-menu {
  position: fixed;
  z-index: 300;
  min-width: 184px;
  max-height: calc(
    100vh - 16px
  ); /* never taller than the viewport — scroll instead */
  overflow-y: auto;
  padding: 4px 0;
  /* --panel-2 (a step up from the page/tabbar --panel) reads as an elevated
     popup; the shadow + --hair-2 border carry the rest. */
  background: var(--panel-2);
  border: 1px solid var(--hair-2);
  border-radius: var(--r-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: tab-menu-in 0.1s ease-out;
}
[data-theme="light"] .tab-menu {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.tab-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 7px 14px;
  border: none;
  background: none;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.1s;
}
.tab-menu-item:hover,
.tab-menu-item:focus-visible {
  /* a visible delta from the --panel-2 surface on BOTH themes; reuses the rail
     .row.open accent wash so the highlight reads as one vocabulary. */
  background: color-mix(in srgb, var(--accent) 8%, var(--panel-2));
}
.tab-menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
/* Delete carries a RESTING danger cue (red-tinted label + key), not colour-on-
   hover-only — the brief's "never colour alone" rule.  ("Delete" is itself the
   non-colour cue; the tint is the at-a-glance scan affordance.) ~7:1 at rest. */
.tab-menu-item.destructive {
  color: color-mix(in srgb, var(--err) 80%, var(--ink-2));
}
.tab-menu-item.destructive .tab-menu-key {
  color: color-mix(in srgb, var(--err) 55%, var(--ink-4));
}
.tab-menu-item.destructive:hover,
.tab-menu-item.destructive:focus-visible {
  color: var(--err);
  background: color-mix(in oklab, var(--err) 14%, transparent);
}
.tab-menu-item.destructive:focus-visible {
  outline-color: var(--err);
}
.tab-menu-label {
  flex: 1;
}
.tab-menu-key {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}
/* light --ink-4 on the menu surface is ~4:1 (sub-AA for this 11px text) — one
   step up; dark --ink-4 already clears AA so it keeps the dimmer hint. */
[data-theme="light"] .tab-menu-key {
  color: var(--ink-3);
}
.tab-menu-sep {
  height: 1px;
  margin: 6px 0;
  /* The more-visible hairline PER THEME against the --panel-2 popup: --hair-2 is
     lighter (more visible) on dark, --hair is darker (more visible) on light. */
  background: var(--hair-2);
}
[data-theme="light"] .tab-menu-sep {
  background: var(--hair);
}
@keyframes tab-menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .tab-menu {
    animation: none;
  }
  .kind-btn,
  .kind-led {
    transition: none;
  }
}

/* pane host — ONE pane visible per tab by default; the split view below can
   show several at once (PaneManager toggles .panes--split). */
.panes {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  min-height: 0;
}
.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.pane[hidden] {
  display: none;
}

/* ===== Split view — visible panes become absolutely-positioned cells (inline
   % insets from PaneManager._applyLayout; % keeps window resizes free).  The
   panes stay DIRECT children of .panes and are never reparented, so a live
   stream's DOM, scroll state and media playback ride out every layout change.
   Only `section.pane` (the ShellPane host) is targeted — the interactive
   pane's INNER div also carries .pane (the 5b lesson) and must not match. ===== */
.panes--split {
  position: relative;
}
/* The pane is the containing block in BOTH modes: unpositioned, the per-pane
   ✕ chip's absolute would resolve to the VIEWPORT (offsetParent <body>) and
   only coincidentally land near the pane corner.  The split rule below wins
   on specificity while split. */
.panes > section.pane {
  position: relative;
}
.panes--split > section.pane {
  position: absolute;
  overflow: hidden;
}
/* the focused cell — only meaningful with 2+ cells.  A quiet inset ring PLUS
   a 2px top accent bar (the rail's .row.open::before vocabulary): the bar is
   the load-bearing cue — designer-measured, no thin tinted ring clears WCAG
   1.4.11's 3:1 on the light theme, and 38%-mix was ~invisible on dark.
   The ring lives on an ::after OVERLAY, not the section's own box-shadow: an
   inset shadow paints in the element's background layer, UNDER any opaque
   child touching the edge — the status bar / composer strip occluded it (the
   reported paint bug).  The overlay sits above pane content (a coordinator
   overlay label uses z:10) and stays click-transparent. */
.panes--split > section.pane.split-focused::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 1px
    color-mix(in srgb, var(--accent) 55%, var(--hair-2));
  z-index: 12;
  pointer-events: none;
}
/* light needs a hotter mix: 55% measured 2.60:1 there (sub-3:1); 75% clears.
   Dark stays 55% (3.75:1) — hotter reads as a heavy border on dark. */
[data-theme="light"] .panes--split > section.pane.split-focused::after {
  box-shadow: inset 0 0 0 1px
    color-mix(in srgb, var(--accent) 75%, var(--hair-2));
}
.panes--split > section.pane.split-focused::before {
  content: "";
  position: absolute;
  /* 1px in from the cell sides so the bar never butts a separator line into
     one doubled-accent stripe at the T-junction */
  inset: 0 1px auto 1px;
  height: 2px;
  background: var(--accent);
  z-index: 13; /* above the ring overlay — a clean bar, not bar-plus-ring-line */
  pointer-events: none;
}
/* per-pane dismiss chip (.cell-unsplit) — on every visible pane.  Split mode:
   "−" hides this cell (the TAB stays — closeCell), but an ephemeral pane (the
   preview) shows "✕" and closes outright; single-pane: "✕" closes the pane
   (withheld from the unclosable Dashboard).  The destructive "✕" modes wear
   .cell-unsplit--close.  Shell chrome floating over pane content: elevated panel +
   hairline so it reads as the shell's, not the conversation's; sits clear of
   the 2px focus bar and the cell corner. */
.cell-unsplit {
  position: absolute;
  top: 5px;
  right: 14px; /* clear of the message scroller's scrollbar gutter */
  z-index: 14;
  /* 28px: WCAG 2.5.8's 24px floor + a hair (22px under-shot it) */
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* --hair-2 measured ~1.3:1 against the chip bg — an invisible boundary;
     --ink-4 clears 3:1 in both themes */
  border: 1px solid var(--ink-4);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.85;
}
.cell-unsplit:hover {
  opacity: 1;
  color: var(--ink);
  border-color: var(--accent-dim);
}
/* the destructive mode (single-pane "Close pane" ✕) telegraphs BEFORE the
   click lands — split-mode muscle memory must not fire it blind */
.cell-unsplit--close:hover {
  color: var(--err);
  border-color: var(--err);
}
.cell-unsplit:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.cell-unsplit--close:focus-visible {
  outline-color: var(--err);
}
/* light resting glyph at .85 sat right at the 3:1 floor with --ink-3 — one
   ink step restores headroom (~4.5:1) without making the chip shout */
[data-theme="light"] .cell-unsplit {
  color: var(--ink-2);
}
/* separator — a 7px hit area straddling the cell boundary with a 1px visual
   line; drag (pointer capture) or arrow keys resize, see pane.js _wireHandle.
   Resting line is --ink-4, the lightest token clearing 3:1 in BOTH themes
   (--hair measured ~1.3:1 — an undiscoverable drag target); hover/drag goes
   SOLID accent and thickens (--accent-dim was a luminance DROP on hover). */
.split-handle {
  position: absolute;
  z-index: 5;
}
.split-handle--row {
  width: 7px;
  cursor: col-resize;
  transform: translateX(-50%);
}
.split-handle--col {
  height: 7px;
  cursor: row-resize;
  transform: translateY(-50%);
}
.split-handle::after {
  content: "";
  position: absolute;
  background: var(--ink-4);
}
.split-handle--row::after {
  left: 3px;
  top: 0;
  bottom: 0;
  width: 1px;
}
.split-handle--col::after {
  top: 3px;
  left: 0;
  right: 0;
  height: 1px;
}
.split-handle:hover::after,
.split-handle.dragging::after,
.split-handle:focus-visible::after {
  background: var(--accent);
}
.split-handle:focus-visible {
  outline: none;
}
.split-handle--row:hover::after,
.split-handle--row.dragging::after,
.split-handle--row:focus-visible::after {
  left: 2px;
  width: 3px;
}
.split-handle--col:hover::after,
.split-handle--col.dragging::after,
.split-handle--col:focus-visible::after {
  top: 2px;
  height: 3px;
}
/* a visible-but-unfocused pane's tab — the three tab states must each read:
   rest (bare) → shown (accent UNDERLINE — a shape, not a fill delta; rhymes
   with the focused cell's TOP bar) → active (panel fill).  Designer-measured:
   a border/fill-only delta between shown and active was ≤1.1:1. */
.tab.shown:not(.active) {
  border-color: var(--hair-2);
  color: var(--ink-2);
}
.tab.shown:not(.active)::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  /* 80%: 55% composited to 2.34:1 on the light --panel (sub-3:1 for a
     load-bearing state mark); 80% = ~3.7:1 light / ~5:1 dark */
  background: color-mix(in srgb, var(--accent) 80%, transparent);
}
.pane-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--hair);
  background: color-mix(in srgb, var(--panel) 60%, var(--bg));
}
.pane-head .nm {
  font-weight: 600;
  color: var(--ink);
  font-size: 13.5px;
}
.ptag {
  font-size: 9px;
  letter-spacing: 0.09em;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 9px;
  border: 1px solid var(--hair-2);
  color: var(--ink-4);
}
.ptag.coord {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--hair-2));
}
.ptag.int {
  color: var(--cyan);
  border-color: color-mix(in srgb, var(--cyan) 35%, var(--hair-2));
}

/* the pane body fills + scrolls; the step-1 dashboard pane hosts the legacy
   #main here unchanged, so it keeps its own internal layout. */
.pane-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.pane-body > #main,
.pane-body > #breadcrumb {
  flex: none;
}
.pane-body > #main {
  flex: 1 1 auto;
  min-height: 0;
}

/* Transient status line a conversational pane shows before its controller is
   built (e.g. an interactive pane resolving + opening its node-proxied session
   on first activate).  The error variant rides chat.css's .msg.error styling. */
.pane-status {
  padding: 16px;
  color: var(--fg-dim);
  font-size: 13px;
}
/* An errored resolve is click-to-retry (see shell.js showResolveError). */
.pane-status--retry {
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
/* Dead-session reconnect affordance (shell.js showDeadBanner) — a real <button>
   for keyboard/AT reach, restyled so native OS button chrome doesn't leak into
   the pane; reads as an error status line.  Sits above the (dead) conversation. */
.pane-dead-banner {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--hair);
  font: inherit;
  font-size: 13px;
  color: color-mix(in srgb, var(--err) 80%, var(--ink-2));
}
.pane-dead-banner:hover {
  color: var(--err);
  background: color-mix(in oklab, var(--err) 8%, transparent);
}
.pane-dead-banner:focus-visible {
  outline: 2px solid var(--err);
  outline-offset: -2px;
}

/* ===== Dashboard session launcher — kind toggle (coordinator | interactive).
   A console-dashboard control; lives here because the L-shell loads shell.css.

   The active option wears its KIND, not a neutral highlight: amber for
   coordinator, cyan for interactive — the same vocabulary as the pane-head
   .ptag chips and the rail's session rows, so "which kind am I starting"
   reads at a glance.  Tints are 15% (sub-0.10 washes out at chip size) and
   colour is never alone: the kind LED + label weight carry the state too. */
.launcher-kinds {
  display: inline-flex;
  gap: 2px;
  margin-bottom: 10px;
  padding: 3px;
  border: 1px solid var(--hair-2);
  border-radius: var(--r-sm);
  background: var(--bg); /* recessed track — the .seg precedent */
}
.kind-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 14px;
  border: 0;
  background: none;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-ui);
  /* r-sm, matching the shared :focus-visible rule below — a literal here
     would make the corner radius pop on keyboard focus */
  border-radius: var(--r-sm);
  cursor: pointer;
  transition:
    background 0.12s,
    color 0.12s;
}
.kind-btn:hover {
  color: var(--ink);
}
.kind-led {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ink-4);
  opacity: 0.35;
  flex-shrink: 0;
  transition:
    background 0.12s,
    opacity 0.12s,
    box-shadow 0.12s;
}
.kind-btn.active {
  font-weight: 600;
}
.kind-btn--coord.active {
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  color: var(--accent);
}
.kind-btn--coord.active .kind-led {
  background: var(--accent);
  opacity: 1;
  box-shadow: 0 0 6px var(--accent-glow-strong);
}
.kind-btn--int.active {
  background: color-mix(in srgb, var(--cyan) 15%, transparent);
  color: var(--cyan);
}
.kind-btn--int.active .kind-led {
  background: var(--cyan);
  opacity: 1;
  box-shadow: 0 0 6px var(--cyan-glow);
}
/* kind tag in the saved-sessions table — shares the rail chip base
   (.row .tag above); only no-wrap + the INT colour differ. */
.kind-tag {
  white-space: nowrap;
}
.kind-tag.int {
  color: var(--cyan);
  border-color: color-mix(in srgb, var(--cyan) 35%, var(--hair-2));
}

/* Inset focus ring for the rail's interactive rows + the kind toggle — the
   global :focus-visible (base.css) uses outline-offset:2px, which clips against
   the 266px rail edge; inset it like .dash-row:focus-visible (base.css). */
.cpill:focus-visible,
.node-row:focus-visible,
.row:focus-visible,
.grp-head:focus-visible,
.kind-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  border-radius: var(--r-sm);
}

/* ===== Rail Manage section — the admin IA as collapsible discovery groups
   (rail.js mountManage).  Reuses the mock's .grp / .grp-head / .grp-items
   vocabulary; heads + rows are <button>s so they're keyboard-operable, and
   collapse state rides the chevron + aria-expanded (no colour-only cue). ===== */
.grp {
  margin-top: 1px;
}
/* The Manage section's collapsed-strip stand-in (rail.js mountManage): one ⚙
   row that opens the Admin pane.  Hidden while the rail is expanded — the
   collapsed-rail block at the end of this sheet flips it on. */
.manage-glyph {
  display: none;
}
.grp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 9px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--ink-3);
  font-size: 13px;
  width: 100%;
  background: none;
  border: 0;
  text-align: left;
  font-family: var(--font-ui);
}
.grp-head:hover {
  background: var(--panel-2);
}
.grp-head .chev {
  width: 12px;
  color: var(--ink-4);
  font-size: 10px;
  flex: none;
}
.grp-head .gname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.grp-head .gcount {
  margin-left: auto;
  color: var(--ink-4);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.grp:not(.open) .grp-items {
  display: none;
}
.grp-items {
  padding-left: 20px;
}
.grp-items .row {
  color: var(--ink-3);
  font-size: 12.5px;
  padding: 5px 9px;
}
/* the current admin tab — a subtle single marker (the rail mirrors which tab
   the Admin pane is showing; distinct from the amber `.open` of live sessions) */
.grp-items .row.active {
  color: var(--ink);
  background: var(--panel-2);
  /* --ink-4 reads in BOTH themes (the --hair-2 marker nearly vanished on the
     light --panel-2); still clearly not the amber `.open` of a live session. */
  box-shadow: inset 2px 0 0 var(--ink-4);
}

/* Manage-row attention badge (rail.js `setRowBadge` / `badge`) — a small count
   chip pinned to the row tail (and to a COLLAPSED group's head, so a hidden row
   never hides the signal).  DS warn vocabulary: the ⚠ glyph PLUS the tinted
   chip carry the meaning (never colour alone), so it reads at chip size and
   flips themes by construction (the --warn family is defined per theme). */
.rail-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto; /* push to the row/head tail past the flex-1 label */
  padding: 0 5px;
  border-radius: var(--r-sm);
  background: var(--warn-tint);
  border: 1px solid var(--warn-tint-border);
  color: var(--warn);
  font-size: 10px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  flex: none;
}
/* The group head already auto-spaces with its own gap, and its --warn count
   should not fight the dim --ink-4 tab count beside it. */
.grp-head .rail-badge {
  margin-left: 6px;
}
.rail-badge .rail-badge-glyph {
  font-weight: 700;
}
.rail-badge b {
  font-weight: 600;
}

/* ===== Project groups in the Workspaces tree (rail.js renderWorkspaces) —
   collapsible buckets that nest a project's sessions under a header.  Reuse the
   Manage `.grp-head` header look (chevron + name + count) for one collapsible
   vocabulary, but the body holds full session `.row`s, so it gets its OWN items
   wrapper rather than `.grp-items` (whose `.row` restyle dims the Manage tabs).
   Sessions with no resolvable project stay at the top level; these groups follow
   them, so a deployment not using projects sees the unchanged flat tree. ===== */
.proj-grp {
  /* A hairline + breathing room separates each project bucket (and the first
     bucket from the unattached top-level list above it). */
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid var(--hair);
}
.proj-grp:not(.open) .proj-grp-items {
  display: none;
}
.proj-grp-items {
  /* a slight inset reads the sessions as belonging to the project head above,
     without the deeper indent (+ left rule) the coord-children list carries */
  padding-left: 8px;
}
/* Lift the project header to its rows' brightness — the Manage `.grp-head` it
   borrows is tuned for equally-dim Manage rows, so over full-brightness session
   rows the default --ink-3 recedes behind its own content.  The ▣ mark stays in
   ink (--ink-4), NOT amber: the rail's only amber is the `.row.open` active-tab
   accent, which the grouping must not compete with. */
.proj-grp .grp-head .gname {
  color: var(--ink-2);
  font-weight: 500;
}
.proj-grp .grp-head .gmark {
  flex: none;
  color: var(--ink-4);
  font-size: 11px;
}

/* ===== Admin pane — adopts #view-admin (the 18 tabpanels).  The in-pane
   sidebar is retired (the rail's Manage groups navigate), so #view-admin fills
   the pane body and the content host renders full-width. ===== */
.pane-body > #view-admin {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  /* inset off the tab-bar hairline + rail edge; .admin-content keeps its right pad */
  padding: 16px 0 0 16px;
}

/* ==========================================================================
   Collapsed rail (desktop) — `.app.rail-collapsed` shrinks the | of the L to a
   52px glyph-only strip.  The glyphs ARE the navigation: live session state
   glyphs (the same Tier-1-fed .ui-glyph-* the expanded rows carry), ◇ home,
   stacked cluster glyph+count pills, one ⚙ for Manage.  Hover names come from
   the title attrs rail.js always sets.  Desktop-only: below the drawer
   breakpoint the rail overlays at full width, so the preference lies dormant.

   769 = the drawer's 768 breakpoint + 1 — a matched pair (CSS @media cannot
   read a shared token).  Change BOTH together or a 1px band gets neither
   (or both) layouts.
   ========================================================================== */
@media (min-width: 769px) {
  .app.rail-collapsed {
    grid-template-columns: 52px 1fr;
  }
  /* brand stacks: mark (home) on top, the expand toggle under it */
  .app.rail-collapsed .rail-brand {
    flex-direction: column;
    gap: 10px;
    padding: 13px 0 11px;
  }
  .app.rail-collapsed .brand-name,
  .app.rail-collapsed .brand-sub {
    display: none;
  }
  .app.rail-collapsed .brand-home {
    justify-content: center;
  }
  .app.rail-collapsed .rail-collapse {
    margin-left: 0;
  }
  .app.rail-collapsed .rail-scroll {
    padding: 10px 5px 6px;
    scrollbar-width: thin;
  }
  /* section labels become hairline separators (uppercase text won't fit) */
  .app.rail-collapsed .sec-label {
    height: 0;
    padding: 0;
    margin: 8px 6px;
    border-top: 1px solid var(--hair);
    overflow: hidden;
    font-size: 0;
  }
  /* …except the first, which would double the brand row's border-bottom
     (the conn slot sits between them whether or not #status-bar relocated) */
  .app.rail-collapsed .rail-conn + .sec-label,
  .app.rail-collapsed .rail-conn-slot + .sec-label {
    border-top: 0;
    margin: 0;
  }
  /* connection indicator: glyph-only — the message text collapses away but
     stays in the DOM for AT; expanding the rail reveals it */
  .app.rail-collapsed .rail-conn {
    font-size: 0;
    padding: 0;
    text-align: center;
  }
  .app.rail-collapsed .rail-conn.disconnected::before {
    content: "⚠";
    font-size: 12px;
    color: var(--warn);
  }
  /* cluster card: pills stack as glyph + count; the node list needs text */
  .app.rail-collapsed .cluster {
    padding: 7px 4px;
  }
  .app.rail-collapsed .cluster-row {
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .app.rail-collapsed .cpill-label {
    display: none;
  }
  .app.rail-collapsed .cluster-nodes {
    display: none;
  }
  /* session rows: the live state glyph is the whole row */
  .app.rail-collapsed .row {
    justify-content: center;
    gap: 0;
    padding: 7px 0;
  }
  .app.rail-collapsed .row .nm,
  .app.rail-collapsed .row .rcount,
  .app.rail-collapsed .row .tag {
    display: none;
  }
  .app.rail-collapsed .row.open::before {
    left: 1px;
  }
  /* children flatten to peer glyphs — the hierarchy needs text to read, and
     reachability beats hierarchy in a glyph strip (titles disambiguate) */
  .app.rail-collapsed .children {
    margin: 0;
    padding: 0;
    border-left: 0;
  }
  /* Manage: the ⚙ stand-in replaces the text-only discovery groups */
  .app.rail-collapsed .grp {
    display: none;
  }
  .app.rail-collapsed .manage-glyph {
    display: flex;
  }
  /* Project groups: drop the text header in the glyph strip (it needs text to
     read) and force the project's sessions visible — the header that would
     expand a collapsed group is hidden, so the sessions must not be trapped. */
  .app.rail-collapsed .proj-grp .grp-head {
    display: none;
  }
  .app.rail-collapsed .proj-grp-items {
    padding-left: 0;
  }
  .app.rail-collapsed .proj-grp:not(.open) .proj-grp-items {
    display: block;
  }
  /* footer stacks: theme toggle above the avatar-only user chip */
  .app.rail-collapsed .rail-foot {
    flex-direction: column;
    gap: 6px;
    padding: 9px 6px;
  }
  .app.rail-collapsed .user-chip {
    margin: 0;
    padding: 3px;
  }
  .app.rail-collapsed .user-name {
    display: none;
  }
}

/* ==========================================================================
   Mobile drawer — below the breakpoint the rail leaves the grid and overlays
   off-canvas at FULL width (the desktop collapse preference lies dormant: a
   52px strip makes no sense when the rail floats over the content anyway).
   ☰ in the tab bar opens it; scrim tap / Escape / opening a pane close it.
   The closed drawer is visibility:hidden so its buttons drop out of the Tab
   order and the a11y tree — not merely translated off-screen.

   768 pairs with the collapse block's min-width: 769px above — change BOTH
   together (see the note there).
   ========================================================================== */
@media (max-width: 768px) {
  .app,
  .app.rail-collapsed {
    grid-template-columns: 1fr;
  }
  .rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(286px, 84vw);
    z-index: 400;
    transform: translateX(-100%);
    visibility: hidden;
    /* visibility flips AFTER the slide-out finishes (delay = duration) */
    transition:
      transform 0.2s ease,
      visibility 0s linear 0.2s;
  }
  .app.rail-open .rail {
    transform: none;
    visibility: visible;
    transition: transform 0.2s ease;
    box-shadow: 0 0 32px rgba(0, 0, 0, 0.45);
  }
  /* the desktop collapse toggle hides — the drawer is always the full rail */
  .rail-collapse {
    display: none;
  }
  .rail-burger {
    display: inline-flex;
  }
  .app.rail-open .rail-scrim {
    display: block;
  }
  /* the tab strip scrolls horizontally (burger + [+] stay pinned); tabs
     tighten so 2-3 stay legible */
  .tabbar {
    padding: 8px 8px;
  }
  .tabstrip {
    overflow-x: auto;
    scrollbar-width: thin;
  }
  .tab {
    max-width: 48vw;
  }
  /* splits are a desktop affordance (a phone viewport is below the cell
     minimums before the first divider lands) — and with the buttons gone the
     tail's group fence has nothing to fence */
  .tb-split {
    display: none;
  }
  .tabbar-right {
    border-left: 0;
    padding-left: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .rail {
    transition: none;
  }
}
