/* v2 · de-clunked + animated · adds to styles.css */

/* ── lighter density ── */
.v2 .topbar { height: 44px; background: transparent; border-bottom: 1px solid oklch(0.28 0.01 240 / 0.4); }
.v2 .leftrail, .v2 .rightrail { background: transparent; border-color: oklch(0.28 0.01 240 / 0.4); }
.v2 .frame { background: oklch(0.135 0.005 240); }
.v2 .rail-section + .rail-section { margin-top: 4px; }
.v2 .rail-label { font-size: 10px; opacity: 0.75; padding: 2px 10px; }
.v2 .rail-item { padding: 5px 10px; font-size: 13px; }
.v2 .stream-row { padding: 8px 12px; }
.v2 .row { padding: 7px 12px; }
.v2 .mode-tabs { padding: 0 20px; background: transparent; }
.v2 .mode-tab { padding: 9px 12px; font-size: 12.5px; }
.v2 .h-eyebrow { display: none; } /* v2 cuts eyebrows everywhere except where explicit */
.v2 .h-eyebrow.keep { display: block; }
.v2 .composer-hero { padding: 56px 32px 18px; gap: 16px; }
.v2 .composer-greeting h1 { font-size: 24px; }
.v2 .composer { padding: 12px 14px; border-radius: 12px; }
.v2 .composer textarea { min-height: 44px; font-size: 14px; }
.v2 .q-card { padding: 11px 13px; gap: 3px; }
.v2 .q-card .val { font-size: 20px; }
.v2 .ws-card { padding: 14px; }
.v2 .section-h { padding: 10px 0 6px; }
.v2 .section-h h2 { font-size: 12px; opacity: 0.75; }

/* ── live ticker rail ── */
.live-rail {
  display: flex; flex-direction: column; height: 100%; overflow: hidden;
}
.live-rail .head {
  padding: 10px 14px 8px;
  min-height: 38px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border-soft);
}
.live-rail .head .title {
  font-size: 12.5px; font-weight: 500;
  color: var(--text-mid);
  display: flex; align-items: center; gap: 6px;
  flex: 1; min-width: 0;
}
.live-rail .head small {
  display: block; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
}
.live-rail .filters {
  padding: 4px 8px 8px;
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border-soft);
}
.live-rail .filters .chip { padding: 2px 7px; font-size: 11.5px; }

.live-list {
  flex: 1; overflow-y: auto;
  display: flex; flex-direction: column;
  padding: 4px 0;
}
.live-row {
  position: relative;
  padding: 10px 14px 10px 22px;
  border-bottom: 1px solid oklch(0.28 0.01 240 / 0.25);
  cursor: pointer;
  animation: rowin 360ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.live-row:hover { background: oklch(1 0 0 / 0.025); }
.live-row.expanded { background: oklch(1 0 0 / 0.04); padding-bottom: 4px; }
.live-row::before {
  content: ''; position: absolute;
  left: 10px; top: 14px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-faint);
}
.live-row.s-running::before  { background: var(--teal);   box-shadow: 0 0 0 4px oklch(0.78 0.11 195 / 0.16); animation: pulsedot 1.8s ease-in-out infinite; }
.live-row.s-blocked::before  { background: var(--rose); }
.live-row.s-needsrev::before { background: var(--amber); }
.live-row.s-approved::before { background: var(--green); }
.live-row.s-learning::before { background: var(--violet); }
.live-row.s-queued::before   { background: var(--text-dim); }

.live-row .top {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 12.5px;
}
.live-row .top b { font-weight: 500; color: var(--text); }
.live-row .top time {
  margin-left: auto; font-family: var(--mono);
  font-size: 10.5px; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.live-row .summary {
  font-size: 11.5px; color: var(--text-dim);
  margin-top: 3px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.live-row.expanded .summary { -webkit-line-clamp: unset; }

.live-row .scope {
  margin-top: 6px; display: flex; gap: 6px; align-items: center;
  font-size: 11px; color: var(--text-faint);
  font-family: var(--mono);
}
.live-row .scope .seg { color: var(--text-mid); }
.live-row .scope .sep { opacity: 0.5; }

.live-row .expand {
  margin-top: 8px;
  padding: 10px 0 4px;
  border-top: 1px dashed var(--border-soft);
  display: grid; grid-template-columns: 90px 1fr; gap: 6px 12px;
  font-size: 11.5px; color: var(--text-mid);
}
.live-row .expand dt { color: var(--text-faint); }
.live-row .expand dd { margin: 0; }
.live-row .expand code { font-family: var(--mono); font-size: 10.5px; }
.live-row .expand-actions {
  grid-column: 1 / -1;
  display: flex; gap: 6px; margin-top: 6px;
}
.live-row .expand-actions .btn.sm { padding: 3px 9px; font-size: 11.5px; }

@keyframes rowin {
  from { opacity: 0; transform: translateY(-6px); background: oklch(0.78 0.11 195 / 0.10); }
  60%  { opacity: 1; transform: translateY(0); }
  to   { opacity: 1; background: transparent; }
}
@keyframes pulsedot {
  0%, 100% { box-shadow: 0 0 0 4px oklch(0.78 0.11 195 / 0.18); }
  50%      { box-shadow: 0 0 0 7px oklch(0.78 0.11 195 / 0.04); }
}

/* ── rotating multi-status pill ── */
.rpill {
  display: inline-flex; align-items: center;
  height: 22px;
  padding: 0 9px 0 6px;
  border-radius: 999px;
  font-size: 11px; font-weight: 500;
  font-family: var(--mono); letter-spacing: 0.01em;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  overflow: hidden;
  position: relative;
  color: var(--text-mid);
  white-space: nowrap;
  cursor: default;
  transition: border-color 0.5s, background 0.5s, color 0.5s;
}
.rpill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  margin-right: 6px; flex-shrink: 0;
  transition: background 0.4s;
}
.rpill .track {
  display: inline-block; position: relative;
  height: 22px; line-height: 22px;
  perspective: 200px;
}
.rpill .lbl {
  display: inline-block;
  animation: flipLabel 0.55s cubic-bezier(0.32, 0.72, 0.4, 1) both;
}
@keyframes flipLabel {
  from { transform: translateY(110%) rotateX(-90deg); opacity: 0; }
  60%  { opacity: 1; }
  to   { transform: translateY(0) rotateX(0); opacity: 1; }
}
.rpill.teal   { background: oklch(0.78 0.11 195 / 0.10); border-color: oklch(0.78 0.11 195 / 0.32); color: var(--teal); }
.rpill.teal   .dot { background: var(--teal); }
.rpill.amber  { background: oklch(0.82 0.13 80 / 0.10);  border-color: oklch(0.82 0.13 80 / 0.32);  color: var(--amber); }
.rpill.amber  .dot { background: var(--amber); }
.rpill.green  { background: oklch(0.78 0.12 150 / 0.10); border-color: oklch(0.78 0.12 150 / 0.32); color: var(--green); }
.rpill.green  .dot { background: var(--green); }
.rpill.rose   { background: oklch(0.72 0.16 25 / 0.10);  border-color: oklch(0.72 0.16 25 / 0.32);  color: var(--rose); }
.rpill.rose   .dot { background: var(--rose); }
.rpill.violet { background: oklch(0.78 0.11 295 / 0.10); border-color: oklch(0.78 0.11 295 / 0.32); color: var(--violet); }
.rpill.violet .dot { background: var(--violet); }
.rpill.sky    { background: oklch(0.80 0.10 230 / 0.10); border-color: oklch(0.80 0.10 230 / 0.32); color: var(--sky); }
.rpill.sky    .dot { background: var(--sky); }
.rpill .pip {
  margin-left: 8px; padding-left: 8px;
  border-left: 1px solid currentColor;
  border-color: var(--border-soft);
  font-size: 9.5px; opacity: 0.6; color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ── hierarchy diagram ── */
.hierarchy {
  padding: 36px 40px;
  background: var(--bg);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 28px;
  font-family: var(--sans);
}
.hierarchy h1 {
  font-size: 22px; font-weight: 500; margin: 0;
  letter-spacing: -0.01em;
}
.hierarchy .lede {
  color: var(--text-mid); font-size: 13.5px; line-height: 1.55; max-width: 720px;
  margin-top: 4px;
}
.hier-canvas {
  display: grid;
  grid-template-columns: 200px 1fr 1fr 1fr;
  gap: 0 32px;
  align-items: start;
  position: relative;
  padding: 16px 0;
}
.hier-tier {
  grid-row: 1;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
}
.hier-tier .tier-name {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--teal); font-weight: 500;
}
.hier-tier h3 { margin: 0; font-size: 16px; font-weight: 500; }
.hier-tier .tier-def {
  font-size: 12.5px; color: var(--text-mid); line-height: 1.5;
}
.hier-tier .tier-keys {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 4px;
}
.hier-arrow {
  align-self: center;
  color: var(--text-faint);
  font-size: 22px;
  display: flex; align-items: center; justify-content: center;
  height: 100%;
}
.hier-children {
  margin-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.hier-child {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  font-size: 12px;
}
.hier-child .name { color: var(--text); flex: 1; min-width: 0; }
.hier-child .sub { color: var(--text-dim); font-size: 11px; }
.hier-child .glyph {
  width: 18px; height: 18px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 600; color: oklch(0.15 0 0);
}

.hier-rules {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.hier-rules .rule {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 12px 14px;
}
.hier-rules .rule h4 {
  margin: 0 0 4px; font-size: 12px; color: var(--teal); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.hier-rules .rule p { margin: 0; font-size: 12.5px; color: var(--text-mid); line-height: 1.5; }
.hier-rules .rule code { font-family: var(--mono); font-size: 11px; color: var(--text); }

/* ── lane selector inside project shell ── */
.lane-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 24px 10px;
  border-bottom: 1px solid var(--border-soft);
  overflow-x: auto;
}
.lane-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text-mid);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.lane-chip:hover { color: var(--text); }
.lane-chip.on {
  background: oklch(0.78 0.11 195 / 0.12);
  color: var(--teal);
  border-color: oklch(0.78 0.11 195 / 0.4);
}
.lane-chip .count {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
  background: var(--bg-soft); padding: 1px 5px; border-radius: 6px;
}
.lane-chip.on .count { color: var(--teal); background: oklch(0.78 0.11 195 / 0.18); }

/* ── empty-state guidance ── */
.empty {
  padding: 32px; text-align: center; color: var(--text-faint);
  font-size: 12.5px;
}

/* ── topbar action group (less clunky) ── */
.v2 .topbar .icon-btn { width: 26px; height: 26px; }
.v2 .topbar .search { width: 280px; padding: 4px 9px; }

/* ── numeric ticker ── */
.tick {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}

/* ────────── Agent activity strip ────────── */
.agent-strip {
  margin: 12px 24px 12px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  overflow: hidden;
  transition: all 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.agent-strip-head {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px;
  cursor: pointer;
  user-select: none;
  min-height: 36px;
}
.agent-strip-head:hover { background: oklch(1 0 0 / 0.02); }
.agent-strip-head .live-dot {
  width: 7px; height: 7px; flex-shrink: 0;
}
.agent-strip-head .msg {
  flex: 1; min-width: 0;
  font-size: 12.5px;
  color: var(--text-mid);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.agent-strip-head .msg .actor {
  color: var(--text-faint); font-family: var(--mono); font-size: 11px; margin-right: 6px;
}
.agent-strip-head .msg b { color: var(--text); font-weight: 500; }
.agent-strip-head .msg time {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); margin-left: 8px;
}
.agent-strip-head .chev {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 5px; color: var(--text-faint);
}
.agent-strip-head .chev:hover { background: var(--surface-2); color: var(--text); }
.agent-strip-head .chev .arrow { transition: transform 0.2s; }
.agent-strip.mode-expanded .agent-strip-head .chev .arrow,
.agent-strip.mode-full .agent-strip-head .chev .arrow { transform: rotate(180deg); }

.agent-strip .agent-recent {
  border-top: 1px solid var(--border-soft);
  padding: 8px 12px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
  animation: stripopen 220ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.agent-strip .agent-recent .line {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 8px;
  color: var(--text-mid); align-items: center;
}
.agent-strip .agent-recent .line time {
  font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
}
.agent-strip .agent-recent .line b { font-weight: 500; color: var(--text); }
.agent-strip .agent-recent .line em { font-style: normal; color: var(--text-dim); }

.agent-strip .agent-composer {
  border-top: 1px solid var(--border-soft);
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  animation: stripopen 220ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.agent-strip .agent-composer textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 8px 10px;
  font: inherit; font-size: 13px; color: var(--text);
  resize: vertical; min-height: 44px; outline: none;
  transition: border-color 0.15s;
}
.agent-strip .agent-composer textarea:focus { border-color: oklch(0.78 0.11 195 / 0.5); }
.agent-strip .agent-composer-foot {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-faint);
}
.agent-strip .agent-composer-foot .grow { flex: 1; }

@keyframes stripopen {
  from { opacity: 0; max-height: 0; }
  to   { opacity: 1; max-height: 500px; }
}

/* ── Full-chat layout: strip grows, NEEDS YOU compresses to right ── */
.user-shell-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}
.user-shell-grid.full-chat {
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr);
  gap: 14px;
  padding: 0 24px 20px;
}
.user-shell-grid.full-chat .agent-strip {
  margin: 12px 0;
  display: flex; flex-direction: column;
  min-height: 540px;
}
.user-shell-grid.full-chat .agent-strip .agent-recent {
  flex: 1; max-height: none;
  overflow-y: auto;
}
.user-shell-grid.full-chat .needs-you {
  margin: 12px 0 0;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  align-self: start;
}
.user-shell-grid.full-chat .needs-you-h {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-mid);
  text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500;
}
.user-shell-grid.full-chat .needs-you .row {
  padding: 8px 12px;
  grid-template-columns: auto 1fr;
  gap: 8px;
}
.user-shell-grid.full-chat .needs-you .row .right { display: none; }
.user-shell-grid.full-chat .needs-you .row .mid .ttl { font-size: 12.5px; }
.user-shell-grid.full-chat .needs-you .row .mid .sub { font-size: 11px; }

/* default (non-full) needs-you styling */
.needs-you-default { background: var(--surface); border: 1px solid var(--border-soft); border-radius: 10px; overflow: hidden; margin: 0 24px; }
.needs-you-default-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
}
.needs-you-default-head h2 {
  font-size: 12px; font-weight: 500; margin: 0;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-mid);
}

/* ────────── Left rail · live workspace indicators ────────── */
.rail-item .ws-status {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: auto;
}
.rail-item .ws-status .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 3px oklch(0.78 0.11 195 / 0.16);
  animation: pulsedot 2s ease-in-out infinite;
}
.rail-item .ws-status .attn {
  background: oklch(0.82 0.13 80 / 0.18);
  color: var(--amber);
  border: 1px solid oklch(0.82 0.13 80 / 0.32);
  font-size: 10px; padding: 0 5px;
  border-radius: 8px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  line-height: 14px; height: 15px;
}
.rail-item .ws-status .blocked {
  background: oklch(0.72 0.16 25 / 0.18);
  color: var(--rose);
  border: 1px solid oklch(0.72 0.16 25 / 0.32);
}
.rail-item .ws-mini {
  display: flex; align-items: center; gap: 7px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}
.rail-item .ws-mini > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-item .ws-mini .ws-meta {
  font-size: 10px; color: var(--text-faint);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

.leftrail .rail-item.active:not(.workspace-context),
.leftrail .rail-item[aria-current='page']:not(.workspace-context),
.leftrail .rail-item.rail-child.ws-project.is-active,
.leftrail .rail-item.rail-child.ws-project[aria-current] {
  background: oklch(0.32 0.06 235 / 0.90);
  color: var(--text);
  border-color: oklch(0.78 0.11 195 / 0.34);
  box-shadow:
    inset 3px 0 0 var(--teal),
    0 0 0 1px oklch(0.78 0.11 195 / 0.18);
}
.leftrail .rail-item.active:not(.workspace-context) svg,
.leftrail .rail-item[aria-current='page']:not(.workspace-context) svg,
.leftrail .rail-item.active:not(.workspace-context) .ws-mini > span:first-child,
.leftrail .rail-item[aria-current='page']:not(.workspace-context) .ws-mini > span:first-child {
  color: var(--text);
}
.leftrail .rail-item.workspace-context,
.leftrail .rail-item.workspace-context[aria-current='location'] {
  background: oklch(0.245 0.010 240 / 0.58);
  color: var(--text-mid);
  border-color: oklch(1 0 0 / 0.055);
  box-shadow: none;
}
.leftrail .rail-item.workspace-context:hover {
  background: oklch(0.27 0.012 240 / 0.62);
  color: var(--text);
}
.leftrail .rail-item.workspace-context .ws-mini > span:first-child {
  color: var(--text);
  font-weight: 500;
}
.leftrail .rail-item.rail-child.ws-project.is-active .p-name,
.leftrail .rail-item.rail-child.ws-project[aria-current] .p-name {
  color: var(--text);
  font-weight: 520;
}
.leftrail .rail-item.rail-child.ws-project.is-active .p-dot,
.leftrail .rail-item.rail-child.ws-project[aria-current] .p-dot {
  box-shadow: 0 0 0 3px oklch(0.78 0.11 195 / 0.18);
}
.leftrail .rail-item.active:not(.workspace-context):hover,
.leftrail .rail-item[aria-current='page']:not(.workspace-context):hover,
.leftrail .rail-item.rail-child.ws-project.is-active:hover,
.leftrail .rail-item.rail-child.ws-project[aria-current]:hover {
  background: oklch(0.34 0.055 235 / 0.86);
}

/* ────────── Left rail · three states ────────── */
.frame.left-collapsed-mode { --left-w: 44px; }
.frame.left-expanded-mode  { --left-w: 320px; }

/* Make the collapsed rail tight: items fill the full slim width */
.frame.left-collapsed-mode .leftrail {
  padding: 4px 2px;
  gap: 4px;
}
.frame.left-collapsed-mode .leftrail .rail-section { gap: 2px; }
.frame.left-collapsed-mode .leftrail .rail-size-toggle {
  width: 36px;
  margin: 0 auto 2px;
}
.frame.left-collapsed-mode .leftrail .rail-item {
  margin: 0;
  width: 40px;
  height: 32px;
  padding: 0;
  border-radius: 6px;
}
.frame.left-collapsed-mode .leftrail .ws-glyph-mini {
  width: 26px; height: 26px;
  font-size: 10px;
  border-radius: 5px;
}
.frame.left-collapsed-mode .leftrail .rail-item:hover {
  background: oklch(0.78 0.11 195 / 0.12);
  color: var(--teal);
  transform: scale(1.04);
}
.frame.left-collapsed-mode .leftrail .rail-item.active:not(.workspace-context),
.frame.left-collapsed-mode .leftrail .rail-item[aria-current='page']:not(.workspace-context) {
  background: oklch(0.32 0.06 235 / 0.90);
  color: var(--text);
  border-color: oklch(0.78 0.11 195 / 0.34);
  box-shadow:
    inset 3px 0 0 var(--teal),
    0 0 0 1px oklch(0.78 0.11 195 / 0.18);
}
.frame.left-collapsed-mode .leftrail .ws-glyph-mini {
  width: 24px; height: 24px;
  font-size: 10px;
  border-radius: 6px;
}

.leftrail .rail-size-toggle {
  display: inline-flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1px;
  font-size: 11px;
  margin: 0 8px 8px;
}
.leftrail .rail-size-toggle button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 22px;
  border-radius: 4px;
  color: var(--text-faint);
  background: transparent;
  border: none;
  cursor: pointer;
}
.leftrail .rail-size-toggle button.on {
  background: var(--surface-3); color: var(--text);
}
.leftrail .rail-size-toggle button:hover:not(.on) { color: var(--text); }

/* Collapsed-mode glyph-only rendering */
.frame.left-collapsed-mode .leftrail .rail-item span:not(.ws-glyph-mini):not(.ws-status):not(.ws-mini),
.frame.left-collapsed-mode .leftrail .rail-item .ws-mini,
.frame.left-collapsed-mode .leftrail .rail-label,
.frame.left-collapsed-mode .leftrail .rail-foot,
.frame.left-collapsed-mode .leftrail .rail-size-toggle button:nth-child(2) {
  display: none;
}
.frame.left-collapsed-mode .leftrail .rail-item {
  position: relative;
  justify-content: center;
  padding: 6px 4px;
}
.frame.left-collapsed-mode .leftrail .rail-item .ws-status {
  position: absolute;
  top: 2px; right: 2px;
  margin: 0;
}
.frame.left-collapsed-mode .leftrail .rail-item .ws-status .pulse,
.frame.left-collapsed-mode .leftrail .rail-item .ws-status .attn {
  font-size: 8px;
  line-height: 11px;
  padding: 0 3px;
  height: 11px;
  min-width: 11px;
  text-align: center;
}
.frame.left-collapsed-mode .leftrail .rail-item .ws-status .pulse { width: 5px; height: 5px; }

/* Workspace card with nested projects (expanded mode) */
.ws-card-rail {
  border-radius: 8px;
  margin: 0 4px 2px;
  background: transparent;
  transition: background 0.12s;
}
.ws-card-rail.is-active { background: oklch(0.78 0.11 195 / 0.05); }
.ws-card-rail:hover { background: oklch(1 0 0 / 0.02); }

.ws-card-rail .ws-card-head {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 10px;
  border-radius: 7px;
  user-select: none;
}
.ws-card-rail .ws-glyph-mini {
  width: 28px; height: 28px;
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 600;
  color: oklch(0.15 0 0);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.ws-card-rail .ws-glyph-mini.mbp    { background: linear-gradient(135deg, var(--teal), var(--teal-2)); }
.ws-card-rail .ws-glyph-mini.xlooop { background: linear-gradient(135deg, var(--amber), var(--rose)); }
.ws-card-rail .ws-glyph-mini.xcp    { background: linear-gradient(135deg, var(--violet), var(--sky)); }
.ws-card-rail .ws-glyph-mini.fin    { background: linear-gradient(135deg, var(--green), var(--teal)); }
.ws-card-rail .ws-glyph-mini.con    { background: linear-gradient(135deg, var(--amber), var(--sky)); }

.ws-card-rail .ws-card-body {
  display: flex; flex-direction: column; gap: 2px;
  min-width: 0;
  cursor: pointer;
}
.ws-card-rail .ws-card-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ws-card-rail.is-active .ws-card-name { color: var(--text); }
.ws-card-rail .ws-card-meta {
  display: flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  color: var(--text-faint);
  font-family: var(--mono);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.ws-card-rail .ws-card-meta .dotsep { opacity: 0.5; }

.ws-card-rail .ws-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: 0;
}
.ws-card-rail .ws-status .attn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 14px;
  min-width: 14px;
  padding: 0 4px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--amber);
  background: oklch(0.82 0.13 80 / 0.10);
  border: 1px solid oklch(0.82 0.13 80 / 0.22);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ws-card-rail .ws-status .attn.blocked {
  color: var(--rose);
  background: oklch(0.72 0.16 25 / 0.10);
  border-color: oklch(0.72 0.16 25 / 0.22);
}
.ws-card-rail .ws-status .pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 2px oklch(0.78 0.11 195 / 0.18);
  cursor: pointer;
}

.ws-card-rail .ws-fold-btn {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, transform 0.18s;
}
.ws-card-rail .ws-fold-btn:hover { background: var(--surface-2); color: var(--text); }
.ws-card-rail .ws-fold-btn.open svg { transform: rotate(90deg); }
.ws-card-rail .ws-fold-btn svg { transition: transform 0.18s; }

.ws-card-rail .ws-projects {
  display: flex; flex-direction: column; gap: 1px;
  padding: 2px 8px 8px 46px;
  animation: stripopen 200ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.ws-card-rail .ws-project {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 5px;
  color: var(--text-mid);
  font-size: 12px;
  cursor: pointer;
  min-height: 24px;
}
.ws-card-rail .ws-project:hover { background: oklch(1 0 0 / 0.035); color: var(--text); }
.ws-card-rail .ws-project.is-active { background: oklch(0.78 0.11 195 / 0.10); color: var(--teal); }
.ws-card-rail .ws-project .p-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ws-card-rail .ws-project .p-dot {
  width: 6px; height: 6px; border-radius: 50%;
  flex-shrink: 0;
  background: var(--text-faint);
}
.ws-card-rail .ws-project .p-dot.running { background: var(--teal); box-shadow: 0 0 0 2px oklch(0.78 0.11 195 / 0.16); }
.ws-card-rail .ws-project .p-dot.blocked { background: var(--rose); }
.ws-card-rail .ws-project .p-dot.attn    { background: var(--amber); }
.ws-card-rail .ws-project .p-dot.good    { background: var(--green); }
.ws-card-rail .ws-project .p-attn {
  font-family: var(--mono); font-size: 9.5px;
  color: var(--text-faint);
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface-2);
}
.ws-card-rail .ws-project .p-attn.warn { color: var(--amber); background: oklch(0.82 0.13 80 / 0.10); }
.ws-card-rail .ws-project .p-attn.bad  { color: var(--rose);  background: oklch(0.72 0.16 25 / 0.10); }

/* ────────── Status badge as clickable shortcut ────────── */
.rail-item .ws-status .attn,
.rail-item .ws-status .blocked,
.rail-item .ws-status .pulse {
  cursor: pointer;
  transition: transform 0.12s;
}
.rail-item .ws-status .attn:hover,
.rail-item .ws-status .blocked:hover,
.rail-item .ws-status .pulse:hover {
  transform: scale(1.15);
}

/* ────────── Forwarded badge on rows ────────── */
.fwd-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 1px 7px 1px 5px;
  border-radius: 999px;
  font-size: 10px; font-family: var(--mono);
  background: oklch(0.78 0.11 295 / 0.10);
  color: var(--violet);
  border: 1px solid oklch(0.78 0.11 295 / 0.25);
  margin-left: 4px;
  cursor: pointer;
}
.fwd-badge:hover { background: oklch(0.78 0.11 295 / 0.18); }
.fwd-badge .arrow-ico { opacity: 0.8; }

/* ────────── Mode selector on composer ────────── */
.composer-mode {
  display: inline-flex; align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1px;
  font-size: 11px;
  gap: 0;
}
.composer-mode button {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-mid);
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
}
.composer-mode button.on {
  background: var(--surface-3);
  color: var(--text);
}
.composer-mode button .ico { opacity: 0.7; }
.composer-mode button.on .ico { opacity: 1; }

/* ────────── Flow demo · step indicator + viewport ────────── */
.flow-steps {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 14px;
}
.flow-step {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  border-radius: 7px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
}
.flow-step:hover { opacity: 0.85; background: oklch(1 0 0 / 0.02); }
.flow-step.done  { opacity: 0.7; }
.flow-step.on    { opacity: 1; background: oklch(0.78 0.11 195 / 0.10); }
.flow-step .flow-num {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 50%;
  color: var(--text-mid);
  flex-shrink: 0;
}
.flow-step.on   .flow-num { background: var(--teal); color: oklch(0.18 0.02 200); border-color: var(--teal); }
.flow-step.done .flow-num { background: var(--green); color: oklch(0.15 0.04 150); border-color: var(--green); }
.flow-step .flow-label { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.flow-step .flow-label b  { font-size: 12px; font-weight: 500; color: var(--text); }
.flow-step .flow-label em { font-size: 10.5px; font-style: normal; color: var(--text-faint); }

.flow-viewport {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 22px 26px;
  min-height: 460px;
  animation: fadein 360ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.flow-card {
  display: flex; flex-direction: column; gap: 14px;
}
.flow-eyebrow {
  font-size: 10.5px; font-family: var(--mono);
  color: var(--teal); text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 500;
}
.flow-card h3 {
  margin: 0; font-size: 16px; font-weight: 500;
  color: var(--text); letter-spacing: -0.01em;
}
.flow-translate {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 18px; align-items: stretch;
}
.flow-translate-side {
  display: flex; flex-direction: column; gap: 8px;
}
.flow-arrow {
  display: flex; align-items: center; justify-content: center;
  color: var(--teal);
}
.flow-mono-box {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.flow-mono-box.mono { font-family: var(--mono); font-size: 11.5px; }
.flow-mono-box code { font-family: var(--mono); white-space: pre; }

.caret {
  display: inline-block;
  width: 2px; height: 14px;
  background: var(--teal);
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 0.9s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* ────────── Layout toggle · hover-discovery hint ────────── */
.layout-discover {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  margin-right: 6px;
  border-radius: 999px;
  background: oklch(0.78 0.11 195 / 0.06);
  border: 1px solid oklch(0.78 0.11 195 / 0.18);
  color: var(--text-faint);
  font-size: 11px;
  animation: discoverbreathe 3.6s ease-in-out infinite;
  transition: opacity 0.4s, transform 0.4s;
  pointer-events: none;
}
.layout-discover.seen {
  opacity: 0;
  transform: translateX(6px) scale(0.95);
  pointer-events: none;
}
@keyframes discoverbreathe {
  0%, 100% { box-shadow: 0 0 0 0 oklch(0.78 0.11 195 / 0.0); }
  50%      { box-shadow: 0 0 0 4px oklch(0.78 0.11 195 / 0.06); }
}

/* ────────── Full-chat takeover ──────────
   When the agent strip is in 'full' mode AND layout is side-by-side, the chat
   becomes the dominant surface. The right rail dims to "slim" by default,
   carries the preset filter chips, and can be dismissed entirely.
   A 32px ribbon stays on the right edge to re-open.
*/
.frame.chat-takeover { --right-w: 280px; }
.frame.chat-takeover.rail-dismissed { --right-w: 32px; }

.frame.chat-takeover .agent-strip {
  background: var(--surface);
  border: 1px solid var(--border-soft);
}
.frame.chat-takeover .agent-strip-head {
  padding: 9px 14px;
}
.frame.chat-takeover .agent-recent {
  max-height: 200px;
}
.frame.chat-takeover .agent-composer textarea {
  min-height: 120px;
  font-size: 14px;
}
.frame.chat-takeover .needs-you {
  display: none; /* needs-you is collapsed into the dimmed rail or hidden */
}
.frame.chat-takeover .user-shell-grid.full-chat {
  grid-template-columns: 1fr;
  padding: 0 24px 20px;
}

.frame.chat-takeover.rail-dismissed .rightrail {
  display: none;
}
.frame.chat-takeover .rail-reopen {
  position: absolute;
  top: 60px; right: 6px;
  width: 22px; height: 56px;
  display: none;
  align-items: center; justify-content: center;
  background: oklch(0.20 0.008 240 / 0.85);
  border: 1px solid var(--border-soft);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--text-mid);
  cursor: pointer;
  z-index: 12;
  backdrop-filter: blur(8px);
}
.frame.chat-takeover.rail-dismissed .rail-reopen { display: flex; }
.frame.chat-takeover .rail-reopen:hover { color: var(--text); background: oklch(0.235 0.008 240 / 0.95); }

/* Slim-rail mode of the right rail when chat is taken over */
.frame.chat-takeover .rightrail {
  background: transparent;
  border-left: 1px solid var(--border-soft);
}
.frame.chat-takeover .rightrail .live-rail .head {
  padding: 8px 10px 6px;
}
.frame.chat-takeover .rightrail .live-rail .head .title { font-size: 12px; }
.frame.chat-takeover .rightrail .live-rail .head small { font-size: 10px; }
.frame.chat-takeover .rightrail .live-rail .filters {
  padding: 4px 6px 6px;
  gap: 3px;
}
.frame.chat-takeover .rightrail .live-rail .filters .chip {
  padding: 1px 6px;
  font-size: 10.5px;
}
.frame.chat-takeover .rightrail .live-row {
  padding: 6px 10px 6px 18px;
}
.frame.chat-takeover .rightrail .live-row::before { left: 6px; top: 10px; }
.frame.chat-takeover .rightrail .live-row .top { font-size: 11.5px; }
.frame.chat-takeover .rightrail .live-row .summary { -webkit-line-clamp: 1; font-size: 11px; }
.frame.chat-takeover .rightrail .live-row .scope   { font-size: 10px; }

/* chat-takeover trigger button styling — make the full-screen button discoverable */
.agent-strip-head .chat-fullscreen {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: var(--text-faint);
  background: transparent;
  border: none;
  cursor: pointer;
  margin-right: 2px;
}
.agent-strip-head .chat-fullscreen:hover { background: var(--surface-2); color: var(--text); }
.agent-strip-head .chat-fullscreen.on { background: oklch(0.78 0.11 195 / 0.12); color: var(--teal); }

/* rail dismiss button */
.rail-dismiss {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: var(--text-faint);
  background: transparent;
  border: none;
  cursor: pointer;
}
.rail-dismiss:hover { background: var(--surface-2); color: var(--text); }

/* ────────── Slidable rails ────────── */
/* Round 12 R12.23 (2026-05-20) · removed --left-w / --right-w defaults +
   the grid-template-columns transition. The defaults overrode operator
   inline-style writes; the transition interpolated the grid template
   over 280ms which made drag-resize values appear to "stick" because
   each store change triggered a new animation that didn't fully reach
   the target before the next React render kicked in. Without transition,
   inline-style writes apply instantly and the drag responds 1:1 to
   mouse movement. */
.frame {
  --rail-transition: 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
body.left-collapsed   .frame:not(.solo):not(.no-rail) { --left-w:  0px; grid-template-columns: 0     1fr var(--right-w); }
body.right-collapsed  .frame:not(.solo)               { --right-w: 0px; grid-template-columns: var(--left-w) 1fr 0; }
body.left-collapsed.right-collapsed .frame:not(.solo) { grid-template-columns: 0 1fr 0; }
.frame.no-rail.r-r-locked { /* no right rail to collapse */ }

.leftrail, .rightrail {
  transition: opacity 200ms ease, transform 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
  /* Stage 92 (2026-05-19) · CR1 fix · was `overflow: hidden` shorthand
     which clobbered the long-form overflow-y:auto set in styles.css. Use
     split axes so the rails CAN scroll vertically when content exceeds
     the grid cell height (28+ items at <1200px viewports) while still
     clipping horizontal translateX(±12px) animations on collapse. */
  overflow-x: hidden;
  overflow-y: auto;
}
body.left-collapsed .leftrail   { opacity: 0; pointer-events: none; transform: translateX(-12px); padding: 0; border: 0; }
body.right-collapsed .rightrail { opacity: 0; pointer-events: none; transform: translateX(12px);  padding: 0; border: 0; }

/* tab/chevron to re-open a collapsed rail */
.rail-handle {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  width: 22px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0.205 0.007 240 / 0.85);
  border: 1px solid oklch(0.30 0.01 240 / 0.4);
  color: var(--text-mid);
  cursor: pointer;
  z-index: 10;
  transition: background 0.15s, color 0.15s;
  backdrop-filter: blur(8px);
}
.rail-handle:hover { background: oklch(0.235 0.008 240 / 0.95); color: var(--text); }
.rail-handle.left  { left:  0;   border-left: none;  border-radius: 0 8px 8px 0; }
.rail-handle.right { right: 0;   border-right: none; border-radius: 8px 0 0 8px; }
.rail-handle .arrow {
  transition: transform 0.2s ease;
}
.rail-handle.is-collapsed .arrow { transform: rotate(180deg); }

/* ────────── Density modes ────────── */
body.density-compact .row              { padding: 5px 12px; }
body.density-compact .stream-row,
body.density-compact .live-row         { padding: 7px 12px; }
body.density-compact .leftrail .rail-item { padding: 4px 10px; font-size: 12.5px; }
body.density-compact .composer         { padding: 10px 12px; }
body.density-compact .composer textarea{ min-height: 36px; }
body.density-compact .topbar           { height: 38px; }
body.density-compact .lin-row          { padding: 8px 16px; }

body.density-comfy .row                { padding: 11px 14px; }
body.density-comfy .stream-row,
body.density-comfy .live-row           { padding: 13px 16px; }
body.density-comfy .leftrail .rail-item { padding: 8px 12px; font-size: 13.5px; }
body.density-comfy .composer           { padding: 16px 18px; }
body.density-comfy .composer textarea  { min-height: 60px; }
body.density-comfy .topbar             { height: 52px; }

/* ────────── Hide visibility chips (debug option) ────────── */
body.hide-visibility .pill.green:not(.action-btn):not(.rpill) {
  /* keep approved status pills, only hide visibility variant; we tag those separately */
}
body.hide-visibility .visibility-chip { display: none !important; }

/* ────────── Pause rotating pills ────────── */
body.pause-pills .rpill .lbl { animation: none !important; }

/* ────────── Attachment chips ────────── */
.attach-row {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 6px;
}
.attach-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 7px;
  height: 22px;
  font-size: 11px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--mono);
  max-width: 240px;
}
.attach-chip .ico { color: var(--text-faint); flex-shrink: 0; }
.attach-chip.file   .ico { color: var(--teal); }
.attach-chip.url    .ico { color: var(--sky); }
.attach-chip.evidence .ico { color: var(--violet); }
.attach-chip .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.attach-chip .size { color: var(--text-faint); font-size: 10px; margin-left: 4px; }
.attach-chip .x {
  width: 16px; height: 16px; border-radius: 3px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-faint); cursor: pointer;
}
.attach-chip .x:hover { background: oklch(0 0 0 / 0.2); color: var(--text); }

/* attach toolbar — paperclip / link / evidence triggers */
.attach-toolbar {
  display: inline-flex; align-items: center; gap: 2px;
}
.attach-trigger {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: var(--text-faint);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
}
.attach-trigger:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-soft); }
.attach-trigger.active { background: var(--surface-3); color: var(--text); border-color: var(--border); }

/* URL input that drops down from the paperclip menu */
.attach-url-input {
  display: flex; gap: 4px;
  margin-top: 6px;
  animation: stripopen 200ms ease both;
}
.attach-url-input input {
  flex: 1;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 4px 8px;
  font: inherit; font-size: 12px; color: var(--text);
  outline: none;
}
.attach-url-input input:focus { border-color: oklch(0.78 0.11 195 / 0.5); }

/* Evidence picker (mini list) */
.attach-evidence-list {
  margin-top: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  max-height: 180px; overflow-y: auto;
  animation: stripopen 200ms ease both;
}
.attach-evidence-list .evd-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px; color: var(--text-mid);
  border-bottom: 1px solid var(--border-soft);
}
.attach-evidence-list .evd-item:hover { background: var(--surface); color: var(--text); }
.attach-evidence-list .evd-item:last-child { border-bottom: none; }
.attach-evidence-list .evd-item .sha { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); margin-left: auto; }

/* ────────── Forward / share popover ────────── */
.fwd-anchor { position: relative; display: inline-flex; }
.fwd-popover {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  z-index: 30;
  width: 280px;
  background: oklch(0.20 0.008 240 / 0.96);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px oklch(0 0 0 / 0.4);
  overflow: hidden;
  animation: fwdopen 200ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes fwdopen {
  from { opacity: 0; transform: translateY(4px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.fwd-head {
  padding: 8px 12px;
  font-size: 10.5px; font-family: var(--mono);
  color: var(--text-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 6px;
}
.fwd-options { padding: 4px; display: flex; flex-direction: column; }
.fwd-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px;
  border-radius: 5px;
  font-size: 12.5px; color: var(--text-mid);
  cursor: pointer;
  background: transparent;
  border: none;
  text-align: left;
  width: 100%;
}
.fwd-opt:hover { background: var(--surface-2); color: var(--text); }
.fwd-opt .ico { color: var(--text-faint); flex-shrink: 0; }
.fwd-opt .label { flex: 1; min-width: 0; }
.fwd-opt .hint { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }

.fwd-assign {
  border-top: 1px solid var(--border-soft);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.fwd-assign input {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  padding: 5px 8px;
  font: inherit; font-size: 12px; color: var(--text);
  outline: none;
}
.fwd-assign input:focus { border-color: oklch(0.78 0.11 195 / 0.5); }
.fwd-assign-people { display: flex; flex-direction: column; gap: 2px; max-height: 140px; overflow-y: auto; }
.fwd-person {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 6px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.fwd-person:hover { background: var(--surface-2); }
.fwd-person .meta { color: var(--text-faint); font-size: 10.5px; margin-left: auto; }

.fwd-confirm {
  padding: 8px 10px;
  border-top: 1px solid var(--border-soft);
  background: oklch(0.78 0.11 195 / 0.06);
  font-size: 11.5px; color: var(--text-mid);
  display: flex; align-items: center; gap: 8px;
}
.fwd-confirm b { color: var(--text); font-weight: 500; }

/* assignment badge on rows */
.assigned-to {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  color: var(--text-mid);
  padding: 1px 6px 1px 4px;
  border-radius: 999px;
  background: oklch(0.78 0.11 295 / 0.10);
  border: 1px solid oklch(0.78 0.11 295 / 0.25);
}

/* ────────── Right rail size modes ────────── */
/* compact (default) lives in the grid column at --right-w */
.frame.rail-expanded { --right-w: 560px; }
.frame.rail-full     { --right-w: min(640px, 46vw); }
.frame.rail-full .rightrail {
  position: relative;
  inset: auto;
  z-index: 1;
  border-left: 1px solid var(--border-soft);
  background: var(--bg);
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: none !important;
  padding: 0;
  animation: railfull 320ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes railfull {
  from { opacity: 0; transform: scale(0.98); }
  to   { opacity: 1; transform: scale(1); }
}

/* head controls */
.rail-controls {
  display: inline-flex; align-items: center; gap: 2px;
  margin-left: auto;
}

/* tabs + scope toggle row */
.rail-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 4px 8px 6px;
  border-bottom: 1px solid var(--border-soft);
  background: oklch(0.18 0.008 240 / 0.5);
}
.rail-tab {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 5px;
  font-size: 11px; color: var(--text-mid);
  background: transparent; border: none; cursor: pointer;
}
.rail-tab:hover { color: var(--text); background: oklch(1 0 0 / 0.04); }
.rail-tab.on { background: var(--surface-3); color: var(--teal); }
.rail-scope-toggle {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  font-size: 10px; font-family: var(--mono);
  background: oklch(0.78 0.11 195 / 0.10);
  color: var(--teal);
  border: 1px solid oklch(0.78 0.11 195 / 0.25);
  border-radius: 999px;
  cursor: pointer;
  max-width: 110px;
  overflow: hidden;
}
.rail-scope-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-scope-toggle:hover { background: oklch(0.78 0.11 195 / 0.18); }

/* mini chat panel in the rail */
.rail-chat-panel { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.rail-chat-scroll {
  flex: 1; overflow-y: auto;
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 10px;
}
.rail-chat-msg { display: flex; flex-direction: column; gap: 3px; }
.rail-chat-msg.mine { align-items: flex-end; }
.rail-chat-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 10.5px; color: var(--text-faint);
}
.rail-chat-meta b { color: var(--text-mid); font-weight: 500; font-size: 11px; }
.rail-chat-meta time { color: var(--text-faint); font-family: var(--mono); }
.rail-chat-body {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px; line-height: 1.45;
  color: var(--text);
  max-width: 92%;
}
.rail-chat-msg.mine .rail-chat-body {
  background: oklch(0.78 0.11 195 / 0.10);
  border-color: oklch(0.78 0.11 195 / 0.25);
}
.rail-chat-composer {
  border-top: 1px solid var(--border-soft);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.rail-chat-composer textarea {
  width: 100%; min-height: 44px;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit; font-size: 12px; color: var(--text);
  resize: vertical; outline: none;
}
.rail-chat-composer textarea:focus { border-color: oklch(0.78 0.11 195 / 0.4); }
.rail-chat-actions {
  display: flex; align-items: center; gap: 4px;
}
.rail-mini-btn {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; color: var(--text-faint);
  background: transparent; border: none; cursor: pointer;
}
.rail-mini-btn:hover { color: var(--text); background: var(--surface-2); }
.rail-ctrl {
  width: 24px; height: 24px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 5px;
  color: var(--text-faint);
  cursor: pointer;
  background: transparent;
  border: 1px solid transparent;
}
.rail-ctrl:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-soft); }
.rail-ctrl.on    { background: var(--surface-3); color: var(--teal); border-color: oklch(0.78 0.11 195 / 0.3); }

/* full-mode split layout: list on the left, detail on the right */
.rail-full-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: 100%;
  min-height: 0;
}
.rail-full-list {
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
  min-height: 0;
}
.rail-full-detail {
  display: flex; flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 32px;
}
.rail-full-detail .empty-detail {
  text-align: center; color: var(--text-faint); font-size: 13px;
  margin: auto;
}
.rail-detail-card {
  display: flex; flex-direction: column; gap: 12px;
  max-width: 720px;
}
.rail-detail-card h2 {
  margin: 0; font-size: 18px; font-weight: 500;
  letter-spacing: -0.01em;
}
.rail-detail-card .meta-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 24px;
  font-size: 12px;
}
.rail-detail-card .meta-grid dt {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); margin: 0;
}
.rail-detail-card .meta-grid dd { margin: 1px 0 0; color: var(--text); }
.rail-detail-card .meta-grid dd code { font-family: var(--mono); font-size: 11px; color: var(--text-mid); }
.rail-detail-card .card-section {
  border-top: 1px solid var(--border-soft);
  padding-top: 12px;
  display: flex; flex-direction: column; gap: 10px;
}
.rail-detail-card .card-section h4 {
  margin: 0; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); font-weight: 500;
}

/* breadcrumb-style header above the detail card */
.rail-detail-crumbs {
  display: flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-family: var(--mono);
  color: var(--text-faint); margin-bottom: 4px;
}
.rail-detail-crumbs b { color: var(--text-mid); font-weight: 500; }

/* selected state on the list when in full mode */
.live-row.is-selected {
  background: oklch(0.78 0.11 195 / 0.06);
  box-shadow: inset 2px 0 0 var(--teal);
}

/* expanded mode: rail wider, rows show more meta */
.frame.rail-expanded .live-row .summary { -webkit-line-clamp: 4; }
.frame.rail-expanded .live-row .scope   { font-size: 11.5px; }
.frame.rail-expanded .live-row          { padding-right: 16px; padding-left: 26px; }

/* pin indicator chip */
.rail-pin {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--teal);
  padding: 1px 6px;
  border-radius: 999px;
  background: oklch(0.78 0.11 195 / 0.10);
  border: 1px solid oklch(0.78 0.11 195 / 0.25);
}

/* ────────── Filter preset chips ────────── */
.preset-chips {
  display: flex; flex-wrap: wrap; gap: 4px;
  align-items: center;
}
.preset-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--text-mid);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.preset-chip:hover { color: var(--text); background: var(--surface-2); }
.preset-chip.on {
  background: oklch(0.78 0.11 195 / 0.12);
  color: var(--teal);
  border-color: oklch(0.78 0.11 195 / 0.4);
}
.preset-chip .count {
  font-family: var(--mono); font-size: 10px; color: var(--text-faint);
  background: var(--bg-soft);
  padding: 1px 5px; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
.preset-chip.on .count { color: var(--teal); background: oklch(0.78 0.11 195 / 0.18); }

/* ────────── Inline events board (events-bottom layout) ────────── */
.inline-events {
  margin: 12px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow: hidden;
  display: flex; flex-direction: column;
  min-height: 480px;
}
.inline-events-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-soft);
}
.inline-events-header .preset-chips { flex: 1; min-width: 0; }
.inline-search {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 4px 9px;
  font: inherit; font-size: 12px;
  width: 200px;
  color: var(--text); outline: none;
}
.inline-search:focus { border-color: oklch(0.78 0.11 195 / 0.5); }

/* Round 11 R11.2 (2026-05-20) · RecentSearches dropdown positioning.
   Wrap is inline-block so it stays in the flex header row alongside the
   preset chips + view-mode toggle without forcing a new row. The dropdown
   inside floats absolute below the input; z-index 50 keeps it above the
   events list scroll container but below modal surfaces. */
.inline-search-wrap {
  position: relative;
  display: inline-block;
}
.inline-search-wrap .x-recent-searches {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 50;
  box-shadow: 0 8px 24px oklch(0 0 0 / 0.32);
  min-width: 200px;
  margin-top: 0;
}

/* Round 12 R12.3 (2026-05-20) · LearnedChips Tier-2 suggestions.
   Renders inline next to the preset chip strip (visually distinct from
   presets: italic-mono query font, different border tone). Mode category
   like presets — clicking re-applies the suggested query. Suggestions
   surface only after the operator has used the same query ≥ minUsageCount
   times (default 2), so a new scope sees no chips until usage accumulates. */
.inline-learned-chips-slot {
  display: inline-flex;
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
}
.x-learned-chips {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 8px;
  border-left: 1px solid var(--border-soft);
  margin-left: 4px;
}
.x-learned-chips-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-family: var(--mono);
}
.x-learned-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px dashed var(--border-soft);
  background: transparent;
  color: var(--text-mid);
  font-size: 10.5px;
  cursor: pointer;
}
.x-learned-chip:hover {
  color: var(--text);
  border-color: oklch(0.78 0.11 195 / 0.45);
  background: oklch(0.78 0.11 195 / 0.08);
}
.x-learned-chip.on {
  border-style: solid;
  border-color: oklch(0.78 0.11 195 / 0.6);
  background: oklch(0.78 0.11 195 / 0.14);
  color: var(--text);
}
.x-learned-chip-query {
  font-family: var(--mono);
  font-style: italic;
  font-size: 10.5px;
}
.x-learned-chip-count {
  font-size: 9px;
  color: var(--text-faint);
  font-family: var(--mono);
  background: oklch(0.245 0.010 240 / 0.55);
  padding: 0 4px;
  border-radius: 999px;
  min-width: 14px;
  text-align: center;
}
.x-learned-chips-dismiss {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  line-height: 1;
}
.x-learned-chips-dismiss:hover { color: var(--rose); }

/* Round 12 R12.2 (2026-05-20) · SavedFilterSet primitives.
   The generic primitives remain available for non-chat surfaces, but the
   chat inline events board no longer renders the redundant saved-set strip. */
.x-saved-filter-set-save {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-mid);
  font-size: 10.5px;
  cursor: pointer;
  margin-left: 6px;
}
.x-saved-filter-set-save:hover {
  color: var(--text);
  border-color: oklch(0.78 0.11 60 / 0.45);
  background: oklch(0.78 0.11 60 / 0.08);
}
.x-saved-filter-set-list {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.x-saved-filter-set-head { display: inline-flex; align-items: center; gap: 6px; }
.x-saved-filter-set-label {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  font-family: var(--mono);
}
.x-saved-filter-set-items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}
.x-saved-filter-set-items > li {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  padding: 1px 3px 1px 8px;
}
.x-saved-filter-set-apply {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: none;
  color: var(--text-mid);
  font-size: 10.5px;
  cursor: pointer;
  padding: 1px 2px;
}
.x-saved-filter-set-apply:hover { color: var(--text); }
.x-saved-filter-set-query-hint { color: var(--text-faint); font-family: var(--mono); }
.x-saved-filter-set-remove {
  background: transparent;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 0 4px;
  font-size: 11px;
  line-height: 1;
  border-radius: 999px;
}
.x-saved-filter-set-remove:hover { color: var(--rose); }

.inline-events-body {
  display: grid;
  grid-template-columns: minmax(380px, 0.7fr) minmax(0, 1fr);
  flex: 1; min-height: 0;
}
.inline-list {
  border-right: 1px solid var(--border-soft);
  overflow-y: auto;
  min-height: 0;
  max-height: 540px;
}
.inline-detail {
  overflow-y: auto;
  padding: 18px 22px;
  min-height: 0;
  max-height: 540px;
}

.inline-row {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
  position: relative;
}
.inline-row:hover { background: oklch(1 0 0 / 0.02); }
.inline-row.is-selected {
  background: oklch(0.78 0.11 195 / 0.05);
  box-shadow: inset 2px 0 0 var(--teal);
}
.inline-row .row-mark { padding-top: 4px; }
.inline-row .row-top {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px;
}
.inline-row .row-top b { font-weight: 500; color: var(--text); }
.inline-row .row-top time {
  margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint);
}
.inline-row .row-summary {
  font-size: 11.5px; color: var(--text-dim);
  margin-top: 2px; line-height: 1.45;
  /* Round 7 Wave W2 (2026-05-20) · collapsed-row summary clamped to ONE line
     per the directive ('one concise summary line'). Operators scan ≥10 rows
     in <10s — multi-line summaries break that. Expanded detail view shows
     the full body. Prior clamp was 2 lines. */
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
  /* R21.UJ-FIX-blocking-batch · FJ1-IEB-1 (2026-05-22) · per
     USER_JOURNEYS_SSOT.md § J1 affordance behavior: collapsed-row
     summary MUST be one-liner-density. Belt-and-suspenders bound
     when -webkit-line-clamp falls back unreliably (non-WebKit/Blink
     engines, or when the parent's display strips -webkit-box). The
     max-height pins to one line-height equivalent (1.45em) plus a 1px
     anti-aliasing pad. word-break prevents wide tokens (URLs, IDs)
     from forcing horizontal layout shift in the row grid. */
  max-height: calc(1.45em + 1px);
  word-break: break-word;
}
.inline-row.is-selected .row-summary {
  /* Selected row reveals full body for J2 expanded-state context. */
  -webkit-line-clamp: 4;
}

/* Round 7 Wave W4 (2026-05-20) · aggregated-row visual treatment.
   Aggregated rows carry calmer styling than individual events (operator
   shouldn't feel pressure to act on a count). The count badge sits next
   to the title; the state dot is muted so aggregates don't compete
   visually with active blockers. */
.inline-row.is-aggregated {
  background: oklch(0.20 0.005 240 / 0.40);
}
.inline-row.is-aggregated .row-mark .status-dot {
  background: var(--text-faint);
  box-shadow: 0 0 0 3px oklch(0.420 0.005 240 / 0.20);
}
.inline-row.is-aggregated .agg-count {
  font-size: 10.5px;
  color: var(--text);
  padding: 1px 7px;
  border-radius: 999px;
  background: oklch(0.255 0.020 195 / 0.45);
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

/* Round 8 R8.5 (2026-05-20) · cross-workspace escalation badge.
   Small red pill on inactive workspace nav rows when other workspaces
   have rows matching XcpAttentionRules.needsAttention. F3 — operator
   sees cross-workspace blockers at a glance without leaving J1/J3
   scope. data-category="status" — read-only. */
.ws-cross-escalation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 6px;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: oklch(0.72 0.16 25 / 0.85);
  color: oklch(0.13 0.005 240);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 0.02em;
}

/* Round 10 R10.6 (2026-05-20) · inspector progressive disclosure.
   <details> wrapper hides receipt history + agent context pack until
   operator clicks 'Show details'. Calm summary styling matches the
   inspector eyebrow weight; expanded content uses default section
   styling so nothing else changes. */
.pos-inspector-details {
  margin-top: 8px;
}
.pos-inspector-details > summary {
  cursor: pointer;
  list-style: none;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  color: var(--text-mid);
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
.pos-inspector-details > summary::-webkit-details-marker { display: none; }
.pos-inspector-details > summary::before {
  content: '›';
  display: inline-block;
  transition: transform 120ms ease;
  font-size: 14px;
  line-height: 1;
}
.pos-inspector-details[open] > summary::before {
  transform: rotate(90deg);
}
.pos-inspector-details > summary:hover {
  color: var(--text);
  border-color: var(--teal);
}
.pos-inspector-details[open] > summary {
  background: oklch(0.255 0.020 195 / 0.20);
  color: var(--text);
}

/* Round 9 R9.6 (2026-05-20) · journey-scope indicator strip.
   Sits above the inline-events-header when XcpJourneyScope reports a
   non-J1 scope. Pure information surface — data-category="status",
   role="status". No filter logic; operators see at a glance whether
   the stream is global or scoped. */
.inline-scope-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: oklch(0.255 0.020 195 / 0.18);
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-mid);
}
.inline-scope-indicator .scope-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);
  font-size: 10px;
}
.inline-scope-indicator .scope-value {
  color: var(--text);
}

/* Round 7 Wave W6 (2026-05-20) · J2 'Why this matters' surface.
   Appears in the expanded event detail card when XcpAttentionRules
   matches the selected row. Calm-but-distinct background; not a
   button itself (data-category="status"), but contains a recommended
   action button derived from the top-weight rule. */
.j2-why-matters {
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: oklch(0.255 0.020 195 / 0.30);
  border: 1px solid oklch(0.78 0.11 195 / 0.25);
}
.j2-why-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.j2-why-copy {
  min-width: 0;
}
.j2-why-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal);
  font-family: var(--mono);
  margin-bottom: 4px;
}
.j2-why-reason {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 0;
  min-width: 0;
}
.j2-recommended-action {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-top: 0;
}
.j2-rec-label {
  display: none !important;
}
@media (max-width: 720px) {
  .j2-why-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* Round 7 Wave W5 (2026-05-20) · Clear-all-filters button.
   Appears next to the search input when ANY filter is active (preset !=
   'all' OR search != ''). Action-category visual language (rose tint for
   destructive-ish action). One click clears both preset + search. */
.clear-filters-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid oklch(0.45 0.10 25 / 0.40);
  background: oklch(0.72 0.16 25 / 0.10);
  color: oklch(0.85 0.10 25);
  font-size: 11px;
  cursor: pointer;
  margin-left: 6px;
  white-space: nowrap;
}
.clear-filters-btn:hover {
  background: oklch(0.72 0.16 25 / 0.20);
}

/* Round 7 Wave W4 · view-mode toggle (Live tail ↔ Aggregated).
   Lives in the inline-events-header next to the search input. Uses the
   .x-mode utility class semantics (mode toggle, not action button). */
.view-mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 6px;
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-mid);
  font-size: 11px;
  cursor: pointer;
  margin-left: 6px;
  white-space: nowrap;
}
.view-mode-toggle:hover { color: var(--text); }
.view-mode-toggle.on {
  background: oklch(0.255 0.020 195 / 0.45);
  color: var(--text);
  border-color: var(--teal);
}
/* Round 8 R8.2 · auto-engage tag inside view-mode toggle. Marks the
   state as derived from the threshold rule rather than operator click. */
.view-mode-toggle .auto-tag {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  padding: 1px 5px;
  border-radius: 999px;
  background: oklch(0.255 0.010 240 / 0.55);
  font-family: var(--mono);
  margin-left: 2px;
}

.inline-row.s-running   .row-mark .status-dot { background: var(--teal);   box-shadow: 0 0 0 3px oklch(0.78 0.11 195 / 0.16); }
.inline-row.s-blocked   .row-mark .status-dot { background: var(--rose); }
.inline-row.s-needsrev  .row-mark .status-dot { background: var(--amber); }
.inline-row.s-approved  .row-mark .status-dot { background: var(--green); }
.inline-row.s-learning  .row-mark .status-dot { background: var(--violet); }
.inline-row.s-queued    .row-mark .status-dot { background: var(--text-dim); }

/* ────────── Layout toggle (chat-top vs side) ────────── */
.layout-toggle {
  display: inline-flex; align-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 1px;
  font-size: 11px;
}
.layout-toggle button {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--text-mid);
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
}
.layout-toggle button.on {
  background: var(--surface-3); color: var(--text);
}
.layout-toggle button:hover:not(.on) { color: var(--text); }

/* ────────── Contextual composer (inline on any event/row/packet) ────────── */
.ctx-composer {
  margin-top: 8px;
  background: oklch(0.78 0.11 195 / 0.04);
  border: 1px solid oklch(0.78 0.11 195 / 0.25);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 8px;
  animation: ctxopen 220ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes ctxopen {
  from { opacity: 0; transform: translateY(-4px); max-height: 0; }
  to   { opacity: 1; transform: translateY(0);    max-height: 400px; }
}
.ctx-context {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  font-size: 10.5px; color: var(--text-faint);
  font-family: var(--mono);
}
.ctx-context .ctx-arrow {
  display: inline-flex; align-items: center; gap: 4px;
  color: var(--teal);
}
.ctx-context code {
  font-family: var(--mono); font-size: 10.5px;
  background: var(--bg-soft);
  padding: 1px 5px; border-radius: 4px;
  color: var(--text-mid);
}
.ctx-textarea {
  width: 100%;
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 12.5px; line-height: 1.45;
  color: var(--text);
  resize: vertical;
  min-height: 48px;
  outline: none;
  transition: border-color 0.15s;
}
.ctx-textarea:focus { border-color: oklch(0.78 0.11 195 / 0.5); }
.ctx-textarea::placeholder { color: var(--text-faint); }
.ctx-foot {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-faint);
}
.ctx-foot .grow { flex: 1; }
.ctx-foot .pill { font-size: 10px; }
.ctx-send {
  height: 24px; padding: 0 9px;
  border-radius: 5px;
  background: var(--teal);
  color: oklch(0.18 0.02 200);
  font-size: 11.5px; font-weight: 500;
  border: none;
  display: inline-flex; align-items: center; gap: 4px;
  cursor: pointer;
}
.ctx-send:disabled { background: var(--surface-3); color: var(--text-faint); cursor: not-allowed; }
.ctx-send.secondary {
  background: transparent; color: var(--text-mid);
  border: 1px solid var(--border-soft);
}
.ctx-send.secondary:hover { background: var(--surface); color: var(--text); }

/* ── Action strip (standard actions on every major item) ── */
.action-strip {
  display: flex; align-items: center; gap: 4px;
  margin-top: 6px;
  flex-wrap: wrap;
}
.action-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  font-size: 11.5px; color: var(--text-mid);
  background: transparent;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  cursor: pointer;
}
.action-btn:hover { background: var(--surface-2); color: var(--text); }
.action-btn.primary {
  background: var(--surface-2); color: var(--text);
}
.action-btn.approve:hover { color: var(--green); border-color: oklch(0.78 0.12 150 / 0.4); }
.action-btn.block:hover   { color: var(--rose);  border-color: oklch(0.72 0.16 25 / 0.4); }
.action-btn.replay:hover  { color: var(--teal);  border-color: oklch(0.78 0.11 195 / 0.4); }
.action-btn .icon { opacity: 0.7; }
.action-strip .sep {
  width: 1px; height: 14px; background: var(--border-soft); margin: 0 2px;
}

/* ── Parent reference badge (new event linked back to source) ── */
.parent-ref {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-family: var(--mono);
  color: var(--teal);
  padding: 1px 6px;
  border-radius: 4px;
  background: oklch(0.78 0.11 195 / 0.10);
  border: 1px solid oklch(0.78 0.11 195 / 0.22);
  margin-right: 6px;
}
.parent-ref::before {
  content: '↳'; opacity: 0.7;
}

/* ── reply count chip on parent rows ── */
.reply-count {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px;
  color: var(--text-mid);
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}

/* ── lineage row with comments (full-width) ── */
.lineage-v2 .lin-row {
  grid-template-columns: 24px 110px 1fr 200px;
}
.lineage-v2 .lin-expand {
  padding: 14px 18px 14px 54px;
  background: oklch(1 0 0 / 0.025);
  border-bottom: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 12px;
}
.lineage-v2 .lin-meta {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 18px;
  font-size: 12px;
}
.lineage-v2 .lin-meta dt {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); margin: 0;
}
.lineage-v2 .lin-meta dd { margin: 1px 0 0; color: var(--text); }
.lineage-v2 .lin-meta dd code { font-family: var(--mono); font-size: 11px; color: var(--text-mid); }

/* ── thread (replies) under an event ── */
.thread {
  margin-top: 4px;
  border-left: 2px solid var(--border-soft);
  padding-left: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.thread-item {
  font-size: 12px; color: var(--text-mid);
  display: flex; flex-direction: column; gap: 3px;
}
.thread-item .t-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
}
.thread-item .t-head b { color: var(--text); font-weight: 500; }
.thread-item .t-head time { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); }
.thread-item .t-body {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12.5px; line-height: 1.45;
  color: var(--text);
}
.thread-item.is-system .t-body {
  background: oklch(0.78 0.11 195 / 0.06);
  border-color: oklch(0.78 0.11 195 / 0.25);
}

.document-draft-editor {
  width: 100%;
  min-height: 420px;
  resize: vertical;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.55;
}

.doc-frame-preview { flex: 1; min-height: 360px; margin-top: 8px; display: grid; gap: 10px; }
.doc-chip-row,
.doc-action-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.doc-action-note { font-size: 11.5px; margin-left: auto; }
.document-frame-thumbnail { width: 100%; height: 100%; padding: 10px; display: grid; align-content: center; gap: 7px; overflow: hidden; text-align: left; background: oklch(0.97 0.005 240); color: oklch(0.22 0.006 240); border-radius: 4px; }
.document-frame-thumbnail b { font-size: 11px; line-height: 1.25; }
.document-frame-thumbnail span { font-size: 8.5px; overflow-wrap: anywhere; color: oklch(0.42 0.008 240); }
.document-frame-thumbnail em { font-size: 9px; color: oklch(0.38 0.02 240); font-style: normal; }
.doc-projection-panel { min-height: 330px; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--bg); padding: 12px; display: grid; gap: 10px; }
.doc-projection-title { margin: 0; color: var(--text); font-size: 15px; }
.doc-projection-path { color: var(--text-faint); font-size: 11px; overflow-wrap: anywhere; }
.doc-frame-readonly { margin: 0; max-height: 250px; overflow: auto; white-space: pre-wrap; font-family: var(--mono); font-size: 11.5px; line-height: 1.55; color: var(--text-mid); }
.document-review-drawer { padding: 12px; display: grid; gap: 12px; cursor: default; border: 1px solid var(--border-soft); border-radius: 8px; background: var(--surface); }
.doc-drawer-head, .doc-inline-head { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.doc-inline-head { align-items: center; }
.doc-drawer-title { flex: 1; min-width: 0; }
.doc-drawer-name { display: block; color: var(--text); font-size: 15px; }
.doc-drawer-path { color: var(--text-faint); font-size: 11px; overflow-wrap: anywhere; }
.doc-pill-row { display: flex; gap: 6px; flex-wrap: wrap; }
.document-inline-workbench { border: 1px solid var(--border-soft); border-radius: 8px; background: var(--bg); padding: 12px; display: grid; gap: 8px; }
.doc-drawer-viewer { max-height: 420px; background: var(--surface); border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px; }
.doc-frame-note { margin: 0; color: var(--text-mid); font-size: 12.5px; line-height: 1.45; }
.doc-mode-bar { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.doc-version-note { font-size: 11.5px; }
.doc-anchor-map { border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px; color: var(--text-mid); font-size: 12px; display: grid; gap: 6px; }
.doc-anchor-row { display: flex; gap: 8px; align-items: baseline; }
.doc-anchor-line { color: var(--text-faint); min-width: 44px; }
.doc-anchor-label { color: var(--text); }

.project-board-launcher-route {
  display: grid;
  gap: 12px;
  align-content: start;
  min-height: 0;
}
.project-board-launcher-strip {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 0 2px;
}
.project-board-launcher-title {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.project-board-launcher-title b {
  color: var(--text);
  font-size: 15px;
  font-weight: 650;
}
.project-board-launcher-title span {
  color: var(--text-mid);
  font-size: 12.5px;
}
.project-board-launcher-proof {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 52%;
}
.project-workspace-preview {
  padding: 14px;
  overflow: visible !important;
  display: grid;
  gap: 12px;
  align-content: start;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: var(--surface);
}
.project-workspace-preview-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}
.project-workspace-preview-actions {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.project-workspace-preview-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: color-mix(in oklab, var(--teal) 8%, var(--surface));
  color: var(--text-mid);
  font-size: 12.5px;
  line-height: 1.45;
}
.project-workspace-preview-note b { color: var(--text); font-weight: 600; }
.project-workspace-preview-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.project-workspace-preview-list {
  display: grid;
  gap: 8px;
}
.project-workspace-preview-card {
  min-height: 0;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px !important;
}
.project-workspace-preview-card-main {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.project-workspace-preview-card-main b {
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-workspace-preview-card-main > span {
  color: var(--text-mid);
  font-size: 11.5px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-workspace-preview-card-meta,
.project-workspace-preview-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.project-workspace-preview-card-meta .mono {
  color: var(--text-faint);
  font-size: 10px;
}
.project-workspace-preview-card-actions {
  justify-content: flex-end;
  max-width: 330px;
}
/* Project Operating Space · true viewport board/workbench route */
.project-operating-space {
  position: relative;
  width: 100%;
  min-height: 100vh;
  height: 100vh;
  z-index: 0;
  isolation: isolate;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg, #0a0d12);
  color: var(--text, #e8eef7);
  font-family: var(--font, 'Geist', system-ui, sans-serif);
  /* Stage 96 (2026-05-19) · C1 fix · was `overflow: hidden`, which
     clipped the .pos-command-menu-pop popover at the project space
     boundary regardless of z-index. The inner .pos-canvas grid cell
     already has its own `overflow: auto`, so removing this lets the
     command-menu popover escape the project space and overlay the
     canvas as designed. Children of .project-operating-space that
     need viewport bounding still have their own overflow rules. */
  overflow: visible;
}
.pos-commandbar {
  position: relative;
  z-index: 40;
  isolation: isolate;
  height: 58px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--surface) 82%, var(--bg));
  /* Stage 96 (2026-05-19) · C1 fix · was `overflow-x: auto; overflow-y:
     visible`. Per CSS spec, when one axis is non-visible, the other axis's
     `visible` becomes `auto` too — that clipped the .pos-command-menu-pop
     popover at the commandbar's bottom edge. Switching to fully visible
     here trades horizontal scroll-on-overflow for popover escape;
     acceptable because the commandbar's content (Back / mode
     chip / compact layout select / 2 menus / Project setup) fits cleanly at
     the supported viewport widths (≥1024px desktop). Below that, controls
     wrap inside the commandbar. */
  overflow: visible;
  flex-wrap: nowrap;
}
.pos-commandbar > * { flex: 0 0 auto; }
.pos-commandbar-left,
.pos-commandbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.pos-commandbar-actions {
  position: relative;
  z-index: 41;
  margin-left: auto;
}
/* Stage 96 (2026-05-19) · C1 fix · lift command-menu to its own stacking
   context above the .pos-document-panel paint layer. */
.pos-command-menu { position: relative; z-index: 10020; }
.pos-command-menu[open] { z-index: 10021; }
.pos-command-menu > summary {
  list-style: none;
  cursor: pointer;
}
.pos-command-menu > summary::-webkit-details-marker { display: none; }
.pos-command-menu-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 10022;
  min-width: 176px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: color-mix(in oklab, var(--surface) 96%, var(--bg));
  box-shadow: 0 16px 44px rgba(0,0,0,.36);
}
.pos-command-menu-pop.wide { min-width: 270px; }
.pos-title { min-width: 170px; flex: 0 0 210px; display: grid; gap: 1px; }
.pos-title b { font-size: 14px; font-weight: 600; color: var(--text); }
.pos-title .mono { color: var(--text-faint); font-size: 10.5px; }
.pos-title b,
.pos-title .mono,
.pos-title .h-eyebrow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos-layout-picker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 0;
  color: var(--text-faint);
  font: 11px var(--mono);
  white-space: nowrap;
}
.pos-layout-select {
  min-width: 136px;
  height: 30px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: color-mix(in oklab, var(--surface-2) 86%, var(--teal) 14%);
  color: var(--text);
  font: 12px var(--font);
}
.pos-mode-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--teal);
  font: 11px var(--mono);
  white-space: nowrap;
}
.pos-canvas {
  position: relative;
  z-index: 1;
  min-height: 0;
  padding: 12px;
  display: grid;
  gap: 12px;
  overflow: auto;
  background:
    linear-gradient(color-mix(in oklab, var(--border-soft) 55%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in oklab, var(--border-soft) 55%, transparent) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
}
.pos-layout-one_up { grid-template-columns: minmax(0, 1fr); }
.pos-layout-two_up { grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); }
.pos-layout-four_up { grid-template-columns: repeat(2, minmax(320px, 1fr)); grid-auto-rows: minmax(500px, auto); }
.pos-layout-reference_stack { grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr); grid-auto-rows: minmax(220px, auto); }
.pos-layout-freeform { grid-template-columns: repeat(12, minmax(72px, 1fr)); grid-auto-rows: minmax(110px, auto); align-items: stretch; }
.pos-layout-freeform .pos-panel:nth-child(1) { grid-column: 1 / span 7; grid-row: span 4; }
.pos-layout-freeform .pos-panel:nth-child(2) { grid-column: 8 / span 5; grid-row: span 3; }
.pos-layout-freeform .pos-panel:nth-child(3) { grid-column: 1 / span 4; grid-row: span 2; }
.pos-layout-freeform .pos-panel:nth-child(4) { grid-column: 5 / span 4; grid-row: span 2; }
.pos-layout-freeform .pos-panel:nth-child(5) { grid-column: 9 / span 4; grid-row: span 2; }
.pos-panel {
  min-width: 0;
  min-height: 380px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: color-mix(in oklab, var(--surface) 92%, var(--bg));
  overflow: hidden;
  box-shadow: 0 10px 34px rgba(0,0,0,.22);
}
.pos-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--surface) 88%, var(--bg));
}
.pos-panel-head b { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
.pos-panel-head .mono { display: block; margin-top: 3px; color: var(--text-faint); font-size: 10.5px; }
.pos-source-status {
  display: inline-flex;
  align-items: center;
  max-width: min(680px, 100%);
  margin-top: 6px;
  padding: 3px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  color: var(--text-mid);
  font-size: 10.5px;
  line-height: 1.25;
}
.pos-source-status.green { color: var(--teal); border-color: color-mix(in oklab, var(--teal) 42%, var(--border-soft)); }
.pos-source-status.amber { color: var(--amber); border-color: color-mix(in oklab, var(--amber) 42%, var(--border-soft)); }
.pos-source-status.rose { color: var(--rose); border-color: color-mix(in oklab, var(--rose) 42%, var(--border-soft)); }
.pos-panel-actions { display: inline-flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.pos-panel-select { max-width: 180px; height: 28px; border-radius: 7px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--text); font-size: 11.5px; padding: 0 7px; }
.pos-layout-name { display: inline-flex; align-items: center; gap: 5px; color: var(--text-faint); font-size: 10.5px; white-space: nowrap; }
.pos-layout-name input {
  width: 140px;
  height: 28px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 11.5px;
  padding: 0 7px;
}
.pos-document-body { min-height: 180px; overflow: hidden; display: grid; }
.pos-document-viewer,
.pos-document-editor {
  margin: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  resize: none;
  padding: 14px;
  overflow: auto;
  background: var(--bg);
  color: var(--text-mid);
  font: 12px/1.58 var(--mono);
  white-space: pre-wrap;
}
.pos-document-editor {
  outline: none;
  color: var(--text);
  background: color-mix(in oklab, var(--bg) 92%, var(--surface));
}
.pos-document-editor:focus { box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--teal) 70%, transparent); }
.pos-writeback-proposal {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border-top: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--amber) 8%, var(--surface));
}
.pos-writeback-proposal b { color: var(--text); font-size: 12.5px; }
.pos-diff-preview {
  max-height: 150px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text-mid);
  font: 11px/1.45 var(--mono);
  white-space: pre-wrap;
}
.pos-document-footer,
.pos-statusbar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-top: 1px solid var(--border-soft);
  background: color-mix(in oklab, var(--surface) 70%, var(--bg));
}
.pos-document-footer .faint,
.pos-statusbar { color: var(--text-faint); font-size: 11px; }
.pos-evidence-ledger-chip {
  display: inline-flex;
  align-items: center;
  max-width: 260px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pos-evidence-ledger-chip[data-status="latest_committed_evidence_ledger_active"] { color: var(--good); }
.pos-evidence-ledger-chip[data-status="latest_committed_evidence_ledger_missing"],
.pos-evidence-ledger-chip[data-status="latest_committed_evidence_ledger_incomplete"] { color: var(--warn); }
.pos-version-history {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding-top: 2px;
}
.pos-version-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text-mid);
  font-size: 10.5px;
  padding: 2px 8px;
  white-space: nowrap;
}
.pos-version-row.on { border-color: color-mix(in oklab, var(--teal) 65%, var(--border-soft)); color: var(--teal); }
.pos-list { min-height: 0; overflow: auto; display: grid; align-content: start; gap: 8px; padding: 10px; }
.pos-list-row,
.pos-static-row {
  display: grid;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 9px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: var(--bg);
  color: var(--text-mid);
  font: inherit;
}
.pos-list-row { cursor: pointer; }
.pos-list-row:hover,
.pos-list-row:focus-visible { border-color: color-mix(in oklab, var(--teal) 60%, var(--border-soft)); }
.pos-list-row b,
.pos-static-row b { color: var(--text); font-size: 12.5px; }
.pos-list-row span,
.pos-static-row span { color: var(--text-faint); font: 10.5px var(--mono); }
.pos-board-panel { min-height: 0; }
.pos-board-card-grid {
  min-height: 0;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding: 10px;
}
.pos-board-card {
  min-width: 0;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: color-mix(in oklab, var(--surface) 86%, var(--bg));
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
}
.pos-board-card-head,
.pos-board-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.pos-board-card-head { justify-content: space-between; }
.pos-board-card b {
  color: var(--text);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.25;
}
.pos-board-card p {
  margin: 0;
  color: var(--text-mid);
  font-size: 12px;
  line-height: 1.45;
}
.pos-board-card-actions { margin-top: 2px; }
.pos-empty {
  display: grid;
  place-content: center;
  gap: 6px;
  min-height: 220px;
  padding: 20px;
  text-align: center;
  color: var(--text-mid);
}
.pos-inspector {
  position: fixed;
  top: 68px;
  right: 14px;
  bottom: 38px;
  width: min(420px, calc(100vw - 28px));
  z-index: 10002;
  display: grid;
  grid-template-rows: auto auto auto 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: color-mix(in oklab, var(--surface) 96%, var(--bg));
  box-shadow: 0 24px 70px rgba(0,0,0,.42);
  overflow: auto;
}
.pos-inspector header { display: flex; justify-content: space-between; gap: 10px; }
.pos-inspector b { color: var(--text); }
.pos-inspector p { margin: 5px 0 0; color: var(--text-mid); font-size: 12px; line-height: 1.45; }
.pos-anchor-row { display: grid; grid-template-columns: 42px 1fr auto; gap: 8px; align-items: center; padding: 4px 0; color: var(--text-mid); font-size: 11.5px; }
.pos-inspector-actions { display: flex; gap: 6px; flex-wrap: wrap; align-content: start; }
@media (max-width: 860px) {
  .pos-commandbar { align-items: flex-start; align-content: flex-start; flex-wrap: wrap; height: auto; min-height: 92px; padding-inline: 8px; overflow: visible; }
  .pos-commandbar-left { order: 0; }
  .pos-commandbar-actions { order: 2; margin-left: 0; }
  .pos-title { order: 3; min-width: 108px; flex-basis: calc(100% - 16px); }
  .pos-title .mono { display: none; }
  .pos-layout-picker { order: 1; margin-left: 0; }
  .pos-layout-name,
  .pos-layout-name input,
  .pos-panel-select { max-width: 170px; width: auto; flex: 0 0 auto; }
  .pos-canvas,
  .pos-layout-two_up,
  .pos-layout-four_up,
  .pos-layout-reference_stack,
  .pos-layout-freeform { grid-template-columns: minmax(0, 1fr); }
  .pos-panel { min-height: 460px; }
}

@media (max-width: 760px) {
  .ops-cockpit-ribbon { grid-template-columns: 1fr; }
  .ops-demo-spine-steps { grid-template-columns: 1fr; }
}

/* Round 7 Wave W8 (2026-05-20) · narrow viewport rail behavior.
   Per directive Step 8: 'Right panel should remain scrollable · On
   narrow widths, use collapse/drawer/stacked behaviour where
   appropriate · Left nav and right rail must not crush the centre into
   unusability.'

   Strategy (lightweight, no JS state machine):
   - <= 1280px: rightrail shrinks 360 → 300px
   - <= 1024px: leftrail shrinks 220 → 56px (auto-slim); rightrail
     drops to 280px
   - <= 860px:  rightrail hides entirely (stacks below main); leftrail
     stays slim at 44px (matches Wave 5d slim-rail toggle width)
   - Right Operations panel (.inline-events) remains scrollable in
     stacked mode via overflow-y on body container
   - Documented limitation: full mobile drawer pattern with hamburger
     toggle deferred to a dedicated mobile wave; current behavior
     reverts to stacked single-column for the demo's hard breakpoints
     without floating UI that could cover primary content. */

/* Round 12 R12.19 (2026-05-20) · viewport-locked grid templates removed.
   Operator-driven XcpRailWidth (R12.17) + width-driven .x-rail-slim
   (R12.19) provide the same auto-narrow-at-narrow-viewport behavior
   without overriding the operator's drag-set width. The hardcoded
   `grid-template-columns: 220px 1fr 300px` (at <=1280px) and `56px 1fr
   280px` (at <=1024px) were the same class of bug as R12.18's 761-1100
   media query: they ignored --left-w / --right-w and shrunk the rails
   to a viewport-specific default regardless of operator choice. Both
   removed. The auto-slim label-hide at <=1024px is also redundant —
   .x-rail-slim handles label-hide based on actual rail width. */
@media (max-width: 1280px) {
  /* intentionally empty — see R12.19 note above */
}
@media (max-width: 1024px) {
  /* intentionally empty — see R12.19 note above */
}
@media (max-width: 860px) {
  .frame {
    /* Round 12 R12.24 · bottombar row removed (operator). */
    grid-template-columns: 44px 1fr;
    grid-template-rows: 44px 1fr auto;
    grid-template-areas:
      "topbar topbar"
      "leftrail main"
      "leftrail rightrail";
  }
  .frame .rightrail {
    /* Stacks below main; respects natural content height. */
    max-height: 50vh;
    overflow-y: auto;
    border-top: 1px solid var(--border-soft);
  }
  /* Inline events body needs explicit height when stacked. */
  .inline-events-body {
    max-height: 70vh;
    overflow-y: auto;
  }
}

/* Round 8 R8.8 (2026-05-20) · mobile portrait refinement (<=480px).
   At phone portrait widths the stacked rightrail (max-height 50vh) eats
   too much real estate. Hide the rightrail entirely and let the centre
   reclaim the screen.

   Documented limitation: operator must rotate to landscape or use a
   wider device to access the right Operations panel. Full hamburger
   drawer pattern with JS state machine deferred to a dedicated mobile
   wave (Round 9+); current CSS-only refinement is the lowest-risk
   bridge that keeps the demo usable on phone screens for J1/J2/J3
   centre-column work. */
@media (max-width: 480px) {
  .frame {
    /* Round 12 R12.24 · bottombar row removed (operator). */
    grid-template-columns: 44px 1fr;
    grid-template-rows: 44px 1fr;
    grid-template-areas:
      "topbar topbar"
      "leftrail main";
  }
  .frame .rightrail {
    /* Hidden on phone portrait by default; the Operations drawer toggle
       in bottombar flips body.mobile-drawer-open → reveals rightrail as
       a slide-up overlay (Round 9 R9.7). */
    display: none;
  }
  /* Round 9 R9.7 · mobile drawer overlay rule. When body has the
     `mobile-drawer-open` class (driven by React state in DesignFrame),
     rightrail overlays the centre column as a slide-up panel. Drawer
     close via Esc, X button in topbar, or click on the toggle. */
  body.mobile-drawer-open .frame .rightrail {
    display: block;
    position: fixed;
    bottom: 32px;        /* leave room for bottombar */
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 70vh;
    overflow-y: auto;
    background: var(--bg);
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 32px oklch(0 0 0 / 0.4);
    animation: drawer-slide-up 180ms ease-out;
  }
  @keyframes drawer-slide-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  /* Reclaim height for the centre column. */
  .inline-events-body {
    max-height: none;
  }
  /* Reduce topbar padding so crumbs + back-button fit at narrow widths. */
  .frame .topbar {
    padding: 0 8px;
    gap: 6px;
  }
  /* Touch-target sizing for the inline-events preset chips. */
  .preset-chip {
    min-height: 28px;
  }
  /* Phone-portrait: clear-filters button drops the visual weight slightly. */
  .clear-filters-btn,
  .view-mode-toggle {
    padding: 2px 7px;
    font-size: 10.5px;
  }
  /* Round 9 R9.7 · mobile drawer toggle visible on bottombar at <=480px. */
  .mobile-drawer-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--teal);
    color: oklch(0.13 0.005 240);
    border: none;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 500;
    cursor: pointer;
    z-index: 60;
  }
  .mobile-drawer-toggle:hover { background: oklch(0.85 0.11 195); }
  body.mobile-drawer-open .frame .bottombar {
    z-index: 60; /* lift bottombar above drawer */
  }
}

/* Mobile drawer toggle hidden by default at wider widths.
   The button JSX always renders in bottombar; visibility is controlled
   by media query so the React tree stays consistent across breakpoints. */
.mobile-drawer-toggle { display: none; }
@media (max-width: 480px) {
  .mobile-drawer-toggle { display: inline-flex; }
}
