/* ============================================================
   SBR COCKPIT — beta · COMPACT
   Direction: light, editorial, action-first, dense.
   Target: 15+ SBR rows visible in a 900px viewport.
   ============================================================ */

:root {
  --paper:    #f9f6ef;
  --paper-2:  #f1ece0;
  --paper-3:  #e8e1cf;
  --rule:     #dcd5c4;
  --rule-2:   #c8bfa9;
  --ink-1:    #2a2c25;
  --ink-2:    #4a4d42;
  --ink-3:    #7a7c6f;
  --ink-4:    #a8a999;
  --accent:    #a8513a;
  --accent-2:  #8b3c27;
  --accent-bg: #f3e2d6;
  --go:        #4d7a4f;
  --go-bg:     #e3ecd9;
  --warn:      #b88b1c;
  --warn-bg:   #f4ead0;
  --halt:      #9b3a3a;
  --halt-bg:   #f0d8d6;
  --st-cpo:    #a8513a;
  --st-app:    #4d7a4f;

  --f-serif:   "Fraunces", "Iowan Old Style", "Charter", Georgia, serif;
  --f-text:    "Inter Tight", system-ui, -apple-system, sans-serif;
  --f-mono:    "JetBrains Mono", "SF Mono", ui-monospace, Consolas, monospace;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { font-size: 13px; }
body {
  font-family: var(--f-text);
  font-feature-settings: "ss01", "tnum";
  background: var(--paper);
  color: var(--ink-1);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--accent-bg); color: var(--accent-2); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rule); border: 3px solid var(--paper); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ============================================================
   SHELL
   ============================================================ */
.app { display: grid; grid-template-rows: auto 1fr; min-height: 100vh; }

.brandbar {
  display: grid; grid-template-columns: auto 1fr auto;
  align-items: baseline; gap: 24px;
  padding: 10px 24px 9px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  position: sticky; top: 0; z-index: 50;
}
.wordmark {
  font-family: var(--f-serif);
  font-style: italic; font-weight: 600;
  font-size: 20px; color: var(--ink-1);
  letter-spacing: -0.012em; line-height: 1;
}
.wordmark .small {
  font-family: var(--f-text); font-style: normal; font-weight: 500;
  font-size: 10px; color: var(--ink-3); letter-spacing: 0.04em;
  text-transform: uppercase; margin-left: 8px;
}
.wordmark .beta {
  font-family: var(--f-mono); font-style: normal;
  font-size: 9px; font-weight: 700; letter-spacing: 0.14em;
  padding: 2px 5px; background: var(--accent-bg); color: var(--accent-2);
  border-radius: 2px; margin-left: 6px; vertical-align: 2px;
}
.brand-nav {
  display: flex; gap: 16px;
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase;
}
.brand-nav a {
  color: var(--ink-3); text-decoration: none;
  padding: 4px 2px;
}
.brand-nav a:hover, .brand-nav .active { color: var(--accent); }
.brand-meta {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3);
}
.brand-meta .clock { font-variant-numeric: tabular-nums; }
.pulse-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 10px;
  font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.12em;
  background: var(--go-bg); color: var(--go);
}
.pulse-pill .dot {
  width: 6px; height: 6px; background: var(--go);
  border-radius: 50%; animation: pulseDot 2.4s infinite ease-out;
}
.pulse-pill.mock { background: var(--accent-bg); color: var(--accent-2); }
.pulse-pill.mock .dot { background: var(--accent); animation-name: pulseDotAmber; }
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(77,122,79,.45); }
  70% { box-shadow: 0 0 0 6px rgba(77,122,79,0); }
}
@keyframes pulseDotAmber {
  0% { box-shadow: 0 0 0 0 rgba(168,81,58,.45); }
  70% { box-shadow: 0 0 0 6px rgba(168,81,58,0); }
}

.workspace {
  display: grid;
  grid-template-columns: 1fr 4px var(--col-side, 360px);
  min-height: 0;
}
.workspace.panels-hidden { grid-template-columns: 1fr; }
.workspace.panels-hidden .col-side,
.workspace.panels-hidden .grid-divider-v { display: none; }

/* Drag-resize dividers */
.grid-divider {
  background: transparent;
  transition: background .12s;
  user-select: none;
}
.grid-divider-v {
  width: 4px;
  cursor: col-resize;
  align-self: stretch;
}
.grid-divider-h {
  height: 4px;
  cursor: row-resize;
  flex-shrink: 0;
  margin: 0;
}
.grid-divider:hover { background: var(--rule-2); }
.grid-divider.dragging { background: var(--accent); }

.brand-btn {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--ink-3);
  padding: 2px 8px;
  border-radius: 3px;
  cursor: pointer;
  transition: all .12s;
}
.brand-btn:hover { border-color: var(--accent); color: var(--accent); }
.col-main {
  padding: 16px 24px 60px;
  min-width: 0;
  overflow-y: auto;
}
.col-side {
  border-left: 1px solid var(--rule);
  background: var(--paper-2);
  position: sticky; top: 42px;
  height: calc(100vh - 42px);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side-devices {
  flex-shrink: 0;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  height: var(--row-devices, 320px);
  max-height: 70vh;
  min-height: 80px;
  display: flex;
  flex-direction: column;
}
.side-devices #device-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.side-pulse {
  flex: 1;
  padding: 14px 18px 60px;
  overflow-y: auto;
  min-height: 0;
}

/* ============================================================
   ZONE HEADINGS
   ============================================================ */
.zone-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 14px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--rule);
}
.zone-head:first-child { margin-top: 0; }
.zone-head h2 {
  font-family: var(--f-serif); font-weight: 600; font-style: italic;
  font-size: 17px; letter-spacing: -0.012em;
  margin: 0; color: var(--ink-1);
}
.zone-head .zone-meta {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase;
}
.zone-head .zone-meta b { color: var(--ink-2); font-weight: 600; }

/* ============================================================
   FOCUS CARDS — denser
   ============================================================ */
.focus-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.focus-card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 10px 12px 10px 14px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s, box-shadow .15s;
}
.focus-card:hover { border-color: var(--rule-2); box-shadow: 0 1px 4px rgba(42,44,37,.05); }
.focus-card.urgent  { border-left: 3px solid var(--accent); }
.focus-card.ready   { border-left: 3px solid var(--go); }
.focus-card.waiting { border-left: 3px solid var(--warn); }
.focus-tag {
  font-family: var(--f-mono); font-size: 9px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--accent);
}
.focus-card.ready .focus-tag   { color: var(--go); }
.focus-card.waiting .focus-tag { color: var(--warn); }
.focus-title {
  font-family: var(--f-serif); font-size: 14.5px; font-weight: 600;
  line-height: 1.25; color: var(--ink-1); letter-spacing: -0.005em;
}
.focus-body { font-size: 11.5px; color: var(--ink-2); line-height: 1.4; }
.focus-body b { color: var(--ink-1); font-weight: 600; }
.focus-body code {
  font-family: var(--f-mono); font-size: 10.5px;
  background: var(--paper-3); padding: 1px 4px; border-radius: 3px;
  color: var(--ink-1);
}
.focus-cta { display: flex; gap: 6px; margin-top: 2px; }
.btn {
  font-family: var(--f-text); font-size: 11px; font-weight: 500;
  padding: 4px 10px; border: 1px solid var(--rule-2);
  background: var(--paper); color: var(--ink-1);
  cursor: pointer; border-radius: 3px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px;
  transition: all .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--paper); }
.btn.ghost { border-color: transparent; color: var(--ink-3); }
.btn.ghost:hover { color: var(--ink-2); background: var(--paper-3); }

/* ============================================================
   FILTERS — denser
   ============================================================ */
.journey-filters {
  display: flex; gap: 10px; align-items: center;
  margin-bottom: 6px; padding-bottom: 6px;
  border-bottom: 1px solid var(--rule);
  flex-wrap: wrap;
}
.journey-filters .group { display: flex; gap: 4px; align-items: center; }
.journey-filters .group-label {
  font-family: var(--f-mono); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3); margin-right: 3px;
}
.chip {
  font-family: var(--f-text); font-size: 11px; font-weight: 500;
  color: var(--ink-2); padding: 2px 8px;
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: 10px; cursor: pointer; transition: all .12s;
  white-space: nowrap;
}
.chip:hover { border-color: var(--rule-2); color: var(--ink-1); }
.chip[aria-pressed="true"] {
  background: var(--accent-bg); border-color: var(--accent); color: var(--accent-2);
}
.search {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 3px;
  padding: 2px 8px;
}
.search::before {
  content: ""; width: 9px; height: 9px;
  border: 1.5px solid var(--ink-3); border-radius: 50%;
}
.search input {
  border: 0; outline: 0; background: transparent;
  font-family: var(--f-text); font-size: 11px; color: var(--ink-1);
  width: 200px;
}
.search input::placeholder { color: var(--ink-4); }
.search kbd {
  font-family: var(--f-mono); font-size: 9px;
  color: var(--ink-3); padding: 1px 4px;
  background: var(--paper-3); border-radius: 2px;
}

/* ============================================================
   JOURNEY ROW — COMPACT single-line
   Target row height: 32-36px including border.
   ============================================================ */
.journey-list {
  border-top: 1px solid var(--rule);
}
.journey {
  display: grid;
  grid-template-columns:
    [stages]   84px
    [id]       38px
    [title]    minmax(180px, 1fr)
    [scores]   150px
    [brd]      290px
    [whowhen]  160px
    [actions]  220px
    [avatars]  64px;
  align-items: center;
  gap: 12px;
  padding: 6px 10px 6px 12px;
  border-bottom: 1px solid var(--rule);
  font-size: 12px;
  transition: background .12s;
  min-height: 34px;
  position: relative;
}
.journey:hover { background: rgba(168, 81, 58, .03); }
.journey:last-child { border-bottom: 0; }
.journey.child { background: rgba(42, 44, 37, .015); }
.journey.child .stages { position: relative; padding-left: 14px; }
.journey.child .stages::before {
  content: ""; position: absolute; left: 4px; top: 50%;
  width: 8px; height: 1px; background: var(--rule-2);
}
@keyframes flashRow {
  0% { background: var(--accent-bg); }
  100% { background: transparent; }
}
.journey.flash { animation: flashRow 1s ease-out; }

/* Stage strip — inline, 6 tiny ticks */
.stages {
  display: inline-flex; align-items: center; gap: 2px;
}
.stage-tick {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--paper);
  border: 1.5px solid var(--rule);
  flex-shrink: 0;
  cursor: pointer;
  transition: transform .12s;
}
.stage-tick.done {
  background: var(--ink-2); border-color: var(--ink-2);
}
.stage-tick.wip {
  width: 12px; height: 12px;
  background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.stage-tick.terminal-parked   { background: var(--ink-4); border-color: var(--ink-4); }
.stage-tick.terminal-rejected { background: var(--halt); border-color: var(--halt); }

/* SBR id */
.journey-id {
  font-family: var(--f-mono); font-size: 11px; font-weight: 600;
  color: var(--accent); letter-spacing: 0.02em;
  cursor: pointer; white-space: nowrap;
}
.journey-id:hover { color: var(--accent-2); text-decoration: underline; }

.parent-toggle {
  display: inline-block; width: 10px;
  font-family: var(--f-mono); font-size: 10px;
  color: var(--ink-3);
  cursor: pointer; transition: transform .15s;
  margin-right: 2px;
}
.parent-toggle.open { transform: rotate(90deg); color: var(--accent); }

/* Title */
.journey-title {
  font-family: var(--f-text); font-weight: 500; font-size: 13px;
  color: var(--ink-1); letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.journey-title:hover { color: var(--accent); }
.journey-title .parent-tag {
  font-family: var(--f-mono); font-size: 9.5px;
  color: var(--ink-4); margin-left: 6px;
  font-weight: 400; letter-spacing: 0.02em;
  opacity: 0.7;
}

/* Score + BRD strip */
.scores {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono); font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.score {
  display: inline-flex; align-items: center; gap: 4px;
  text-decoration: none; padding: 1px 0;
}
.score .lbl {
  font-size: 8.5px; letter-spacing: 0.12em;
  color: var(--ink-3); text-transform: uppercase;
}
.score .val {
  font-weight: 600; min-width: 26px; text-align: center;
  padding: 1px 5px; border-radius: 8px;
}
.score.linkable { cursor: pointer; }
.score.linkable:hover .val { box-shadow: 0 0 0 1.5px var(--accent); }
.score .val.g  { background: var(--go-bg);   color: var(--go); }
.score .val.a  { background: var(--warn-bg); color: var(--warn); }
.score .val.r  { background: var(--halt-bg); color: var(--halt); }
.score .val.dim{ background: var(--paper-3); color: var(--ink-3); }

/* BRD strip — show actual scores per domain */
.brd-strip {
  display: inline-flex; align-items: center;
  font-family: var(--f-mono); font-size: 10px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.brd-strip .brd-lbl {
  padding: 2px 6px;
  background: var(--paper-3);
  color: var(--ink-3);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-right: 1px solid var(--rule);
}
.brd-cell {
  min-width: 32px;
  padding: 2px 4px;
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  text-decoration: none;
  border-right: 1px solid var(--rule);
  position: relative;
  cursor: default;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
}
/* Small dim initial (C / F / O / B / E / S / D) prefixing each cell's value. */
.brd-cell .brd-dom-init {
  font-size: 8.5px;
  letter-spacing: 0.04em;
  font-weight: 600;
  color: var(--ink-4);
  opacity: 0.85;
}
.brd-cell .brd-cell-val { line-height: 1; }
/* On coloured tiers, dim the initial slightly less so it stays legible. */
.brd-cell.g .brd-dom-init  { color: var(--go);   opacity: 0.65; }
.brd-cell.a .brd-dom-init  { color: var(--warn); opacity: 0.65; }
.brd-cell.r .brd-dom-init  { color: var(--halt); opacity: 0.65; }
.brd-cell:last-child { border-right: 0; }
.brd-cell.linkable { cursor: pointer; }
.brd-cell.linkable:hover { background: var(--accent-bg); color: var(--accent-2); }
.brd-cell.g  { background: var(--go-bg);   color: var(--go); }
.brd-cell.a  { background: var(--warn-bg); color: var(--warn); }
.brd-cell.r  { background: var(--halt-bg); color: var(--halt); }
.brd-cell.dim{ background: var(--paper);   color: var(--ink-4); }
.brd-cell.missing { background: var(--paper); color: var(--ink-4); }
.brd-cell::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px); left: 50%;
  transform: translateX(-50%);
  background: var(--ink-1); color: var(--paper);
  font-family: var(--f-mono); font-size: 10px;
  padding: 3px 7px; border-radius: 3px;
  white-space: nowrap; z-index: 10;
  opacity: 0; pointer-events: none;
  transition: opacity .12s;
}
.brd-cell:hover::after { opacity: 1; }

/* Contributor + when */
.who-when {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--ink-3); white-space: nowrap;
}
.who-when .who { color: var(--ink-2); }
.who-when .when { color: var(--ink-3); }

/* Action chips */
.row-actions {
  display: inline-flex; align-items: center; gap: 4px;
}
.row-actions .row-btn {
  font-family: var(--f-mono); font-size: 9.5px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 2px 7px; border: 1px solid var(--rule);
  background: var(--paper); color: var(--ink-3);
  text-decoration: none; border-radius: 3px;
  transition: all .1s;
  white-space: nowrap;
}
.row-actions .row-btn:hover {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-bg);
}
.row-actions .row-btn.has-feedback {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-bg);
}
.row-actions .row-btn .count {
  margin-left: 3px; font-weight: 700;
  color: inherit;
}

/* Avatars */
.avatars { display: inline-flex; align-items: center; }
.av {
  width: 18px; height: 18px;
  background: var(--paper-3);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 8.5px; font-weight: 600;
  color: var(--ink-1);
  border: 1.5px solid var(--paper);
  border-radius: 50%;
  margin-left: -5px;
  letter-spacing: 0.02em;
  overflow: hidden;
}
.av:first-child { margin-left: 0; }
.av img { width: 100%; height: 100%; object-fit: cover; }
.av.a1 { background: #f3e2d6; color: #8b3c27; }
.av.a2 { background: #e3ecd9; color: #4d7a4f; }
.av.a3 { background: #e6dfee; color: #5f4d8b; }
.av.a4 { background: #d7e7ec; color: #2f5d6b; }
.av.a5 { background: #f0d8d6; color: #7d2b2b; }

/* ============================================================
   PULSE FEED — denser
   ============================================================ */
.pulse-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 8px; padding-bottom: 5px;
  border-bottom: 1px solid var(--rule);
}
.pulse-head h2 {
  font-family: var(--f-serif); font-style: italic; font-weight: 600;
  font-size: 15px; margin: 0; color: var(--ink-1);
  letter-spacing: -0.012em;
}
.pulse-head .live {
  font-family: var(--f-mono); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--go); display: inline-flex; align-items: center; gap: 5px;
}
.pulse-head .live .dot {
  width: 6px; height: 6px; background: var(--go);
  border-radius: 50%; animation: pulseDot 2.4s infinite ease-out;
}
.pulse-event {
  display: grid;
  grid-template-columns: 12px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
  padding: 7px 4px; border-bottom: 1px solid var(--rule);
  cursor: pointer; transition: background .12s;
}
.pulse-event:hover { background: var(--paper); }
.pulse-event:last-child { border-bottom: 0; }
.pulse-icon { color: var(--ink-3); font-size: 11px; line-height: 1.4; grid-row: 1 / span 2; }
.pulse-icon.comment { color: var(--accent); }
.pulse-icon.advance { color: var(--go); }
.pulse-icon.push    { color: var(--ink-2); }
.pulse-icon.score   { color: var(--warn); }
.pulse-body {
  font-size: 12px; color: var(--ink-1); line-height: 1.35;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2;
  overflow: hidden;
}
.pulse-body .actor  { font-weight: 600; color: var(--ink-1); }
.pulse-body .target { font-family: var(--f-mono); font-size: 10.5px; color: var(--accent); }
.pulse-meta {
  font-family: var(--f-mono); font-size: 9.5px;
  color: var(--ink-3); letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  grid-column: 2;
}
.pulse-meta .at { margin-right: 6px; }
.pulse-meta .who { color: var(--ink-3); }
.pulse-flash { animation: pulseFlash 1s ease-out; }
@keyframes pulseFlash {
  0% { background: var(--accent-bg); }
  100% { background: transparent; }
}

/* G8 — wrapper around each device row + (when expanded) its commits panel. */
.device-item { border-bottom: 1px solid var(--rule); }
.device-item:last-child { border-bottom: 0; }
.device-item.is-open { background: var(--paper); }

.device-row {
  display: grid; grid-template-columns: 10px 1fr auto 10px;
  gap: 7px; align-items: center;
  width: 100%;
  padding: 5px 0;
  font-family: var(--f-mono); font-size: 10.5px;
  background: transparent; border: 0;
  text-align: left; cursor: pointer;
  color: inherit;
}
.device-row:hover { background: var(--paper); }
.device-row:focus-visible { outline: 1px dotted var(--accent); outline-offset: -1px; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.dot.live    { background: var(--go); }
.dot.idle    { background: var(--warn); }
.dot.stale   { background: var(--halt); opacity: .65; }
.dot.offline { background: var(--ink-4); }
.device-name { color: var(--ink-1); font-size: 10.5px; }
.device-name .at { color: var(--ink-3); }
.device-when { color: var(--ink-3); font-size: 10px; font-variant-numeric: tabular-nums; }
.device-caret {
  color: var(--ink-3); font-size: 9px; line-height: 1;
  transition: transform 0.15s ease;
  display: inline-block;
  transform: rotate(0deg);
}
.device-item.is-open .device-caret { transform: rotate(90deg); }

/* G8 — expanded commits dropdown */
.device-commits {
  margin: 2px 0 8px 12px;
  padding: 4px 0 6px;
  border-left: 1px solid var(--rule);
  padding-left: 8px;
  max-height: 240px;
  overflow-y: auto;
}
.dc-section-head {
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 0 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.dc-7d-toggle {
  background: transparent; border: 0;
  color: var(--ink-3);
  cursor: pointer;
  padding: 5px 0 3px;
  margin-top: 2px;
  border-top: 1px dashed var(--rule);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  width: 100%;
  text-align: left;
}
.dc-7d-toggle:hover { color: var(--ink-1); }
.dc-7d-toggle:focus-visible { outline: 1px dotted var(--accent); outline-offset: 1px; }
.dc-caret {
  display: inline-block;
  font-size: 9px;
  transition: transform 0.15s ease;
  transform: rotate(0deg);
}
.dc-7d-toggle[aria-expanded="true"] .dc-caret { transform: rotate(90deg); }

.dc-list {
  list-style: none;
  margin: 0; padding: 0;
}
.dc-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 2px 0;
}
.dc-time {
  font-family: var(--f-mono); font-size: 11px;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.dc-subject {
  font-family: var(--f-text); font-size: 11px;
  color: var(--ink-1);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dc-empty {
  font-family: var(--f-text); font-size: 11px;
  color: var(--ink-4);
  font-style: italic;
  padding: 3px 0 5px;
}

/* ============================================================
   SORT DROPDOWN (G10) — chip + menu in .journey-filters
   ============================================================ */
.sort-wrap { position: relative; display: inline-block; }
.sort-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.sort-caret {
  font-size: 9px;
  color: var(--ink-3);
}
.sort-chip[aria-pressed="true"] .sort-caret { color: var(--accent-2); }
.sort-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 60;
  min-width: 180px;
  background: var(--paper-2);
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  box-shadow: 0 4px 10px rgba(42, 44, 37, .15);
  padding: 3px 0;
}
.sort-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 5px 12px;
  font-family: var(--f-text);
  font-size: 11px;
  color: var(--ink-1);
  cursor: pointer;
  transition: background .1s, color .1s;
}
.sort-menu-item:hover { background: var(--paper-3); color: var(--accent); }
.sort-menu-item.active { color: var(--accent); font-weight: 600; }

/* ============================================================
   CONNECTION BANNERS (G7) — stale / offline
   Compact single-line summary; click to expand details drawer.
   ============================================================ */
.conn-banner {
  font-family: var(--f-text);
  font-size: 11px;
  padding: 0;
  border-bottom: 1px solid var(--rule);
}
.conn-banner-warn {
  background: var(--warn-bg);
  border-left: 3px solid var(--warn);
  color: var(--warn);
}
.conn-banner-halt {
  background: var(--halt-bg);
  border-left: 3px solid var(--halt);
  color: var(--halt);
  font-weight: 500;
}
.conn-banner-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 3px 14px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  line-height: 1.4;
}
button.conn-banner-summary { cursor: pointer; }
button.conn-banner-summary:hover { background: rgba(0, 0, 0, .04); }
button.conn-banner-summary:focus-visible { outline: 1px dotted currentColor; outline-offset: -2px; }
.conn-banner-icon { font-weight: 600; }
.conn-banner-toggle { margin-left: auto; opacity: .75; font-size: 10px; letter-spacing: .02em; }
.conn-banner-summary[aria-expanded="false"] .conn-banner-chevron::before { content: "▾"; }
.conn-banner-summary[aria-expanded="true"]  .conn-banner-chevron::before { content: "▴"; }
.conn-banner-details {
  padding: 8px 14px 10px 14px;
  border-top: 1px dashed var(--rule);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--type-1);
  background: rgba(255, 255, 255, .35);
}
.conn-banner-details dl { display: grid; grid-template-columns: 110px 1fr; gap: 2px 12px; margin: 0; }
.conn-banner-details dt { font-weight: 600; color: inherit; }
.conn-banner-details dd { margin: 0; }
.conn-banner-details code { font-family: var(--f-mono, monospace); font-size: 10.5px; padding: 0 3px; background: rgba(0, 0, 0, .05); border-radius: 2px; }

/* ============================================================
   STAGE CHECKLIST TOOLTIP (G4)
   ============================================================ */
.stage-tip {
  position: fixed; z-index: 70;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: 4px;
  box-shadow: 0 3px 10px rgba(42, 44, 37, .18);
  padding: 8px 10px;
  pointer-events: none;
}
.stage-tip-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 7px;
  align-items: center;
  padding: 2px 0;
  font-size: 11px;
  color: var(--ink-1);
}
.stage-tip-row.dimmed .stage-tip-label,
.stage-tip-row.dimmed .stage-tip-when { color: var(--ink-4); }
.stage-tip-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--paper); border: 1.5px solid var(--rule-2);
}
.stage-tip-dot.done { background: var(--ink-2); border-color: var(--ink-2); }
.stage-tip-dot.wip  { background: var(--accent); border-color: var(--accent); }
.stage-tip-label {
  font-family: var(--f-text);
  font-size: 11px;
  color: var(--ink-1);
  white-space: nowrap;
}
.stage-tip-when {
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   STAGE POPOVER (G3) — anchored to .stages strip
   ============================================================ */
.stage-popover {
  position: fixed; z-index: 80;
  min-width: 180px;
  background: var(--paper);
  border: 1px solid var(--rule-2);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(42, 44, 37, .18);
  padding: 4px 0;
  font-family: var(--f-text);
}
.stage-popover-head {
  font-family: var(--f-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  color: var(--ink-3);
  padding: 4px 12px 6px;
  border-bottom: 1px solid var(--rule);
  text-transform: uppercase;
}
.stage-popover-sep {
  font-family: var(--f-mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-4);
  padding: 6px 12px 2px;
  margin-top: 2px;
  border-top: 1px solid var(--rule);
}
.stage-popover-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 5px 12px;
  font-family: var(--f-text);
  font-size: 11.5px;
  color: var(--ink-1);
  cursor: pointer;
  transition: background .1s, color .1s;
}
.stage-popover-item:hover { background: var(--paper-2); color: var(--accent); }
.stage-popover-item.forward  { color: var(--go); }
.stage-popover-item.backward { color: var(--warn); }

/* ============================================================
   BUILD QUEUE — pm-bot ToDos in the side rail
   ============================================================ */
.side-build {
  flex-shrink: 0;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper-2);
  max-height: 220px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.side-build #build-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.side-build .pulse-head .live { color: var(--ink-3); }
.build-empty {
  font-family: var(--f-text);
  font-size: 10.5px;
  font-style: italic;
  color: var(--ink-3);
  padding: 6px 0;
}
.build-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 6px;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 11px;
}
.build-row:last-child { border-bottom: 0; }
.build-id {
  font-family: var(--f-mono);
  font-size: 9px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
}
.build-prio {
  font-family: var(--f-mono);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: 8px;
  background: var(--paper-3);
  color: var(--ink-2);
}
.build-prio-P0 { background: var(--halt-bg); color: var(--halt); }
.build-prio-P1 { background: var(--warn-bg); color: var(--warn); }
.build-prio-P2 { background: var(--paper-3); color: var(--ink-3); }
.build-title {
  font-family: var(--f-text);
  font-size: 11px;
  color: var(--ink-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================
   SOURCE-DOC DRAWER (G5) — in-page slide-over
   ============================================================ */
.src-drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(42, 44, 37, 0.40);
  z-index: 9000;
  opacity: 0;
  transition: opacity 200ms ease-out;
  display: none;
}
.src-drawer-backdrop.open { opacity: 1; }

.src-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 60vw;
  max-width: 100vw;
  background: var(--paper);
  box-shadow: 0 8px 32px rgba(42, 44, 37, 0.18);
  z-index: 9001;
  display: none;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 200ms ease-out;
}
.src-drawer.open { transform: translateX(0); }

.src-drawer-topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  flex: 0 0 auto;
}
.src-drawer-sbr {
  font-family: var(--f-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-1);
  padding: 3px 7px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.src-drawer-tab {
  font-family: var(--f-text);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.src-drawer-spacer { flex: 1 1 auto; }
.src-drawer-popout,
.src-drawer-close {
  font-family: var(--f-text);
  font-size: 13px;
  color: var(--ink-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1;
}
.src-drawer-popout:hover,
.src-drawer-close:hover,
.src-drawer-popout:focus-visible,
.src-drawer-close:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}
.src-drawer-close { font-size: 15px; }

.src-drawer-body {
  flex: 1 1 auto;
  display: flex;
  background: var(--paper);
  overflow: hidden;
}
.src-drawer-iframe {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--paper);
}

@media (max-width: 900px) {
  .src-drawer { width: 100vw; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .col-side { position: static; height: auto; border-left: 0; border-top: 1px solid var(--rule); }
  .col-main { padding: 14px 16px 40px; }
}
@media (max-width: 720px) {
  .journey {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    gap: 4px 10px;
  }
  .journey .stages, .journey .journey-id { grid-row: 1; }
  .journey .journey-title { grid-row: 1; grid-column: 2; }
  .journey .scores, .journey .brd-strip, .journey .who-when,
  .journey .row-actions, .journey .avatars { grid-row: 2; }
}
