/* SmartDocs 9.0 components. Every value comes from tokens.css. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, .btn { touch-action: manipulation; }
.icon { flex: none; display: block; }
.mono { font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: 0.02em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: var(--space-4); top: -100px; z-index: 100; background: var(--surface); padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); box-shadow: var(--shadow-pop); }
.skip-link:focus { top: var(--space-3); }
main:focus { outline: none; }
main { overflow-x: clip; }

/* ------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: var(--space-5);
  padding: 0 var(--space-6);
  background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--agent); color: #fff;
  font-size: 10px; font-weight: var(--weight-bold); letter-spacing: 0.02em;
}
.brand-word { font-weight: var(--weight-bold); font-size: 15px; letter-spacing: -0.01em; }
.suite ul { display: flex; gap: 2px; }
.suite a {
  display: block; padding: 6px 11px; border-radius: var(--radius-pill);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-muted); text-decoration: none; white-space: nowrap;
}
.suite a:hover { color: var(--ink); background: var(--surface-hover); }
.suite a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-card); }

.askbar {
  position: relative; margin-left: auto; flex: 0 1 300px; min-width: 180px;
  display: flex; align-items: center; gap: var(--space-2);
  height: 36px; padding: 0 4px 0 12px;
  background: var(--surface); border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1px var(--line-strong), var(--shadow-card);
}
.askbar:focus-within { box-shadow: inset 0 0 0 1.5px var(--agent), 0 0 0 4px var(--agent-soft); }
.askbar-spark { color: var(--agent); }
.askbar input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-size: var(--text-sm); }
.askbar input::placeholder { color: var(--ink-faint); }
.ask-pop {
  position: absolute; top: calc(100% + 8px); right: 0; width: min(420px, 90vw);
  padding: var(--space-3) var(--space-4); background: var(--surface);
  border-radius: var(--radius-md); box-shadow: var(--shadow-pop); font-size: var(--text-sm);
}
.avatar-me {
  width: 32px; height: 32px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--page);
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
}

/* --------------------------------------------------------------- strip */
.strip {
  position: sticky; top: var(--topbar-h); z-index: 20;
  background: color-mix(in srgb, var(--page) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  box-shadow: inset 0 -1px 0 var(--line);
  overflow-x: auto; scrollbar-width: none;
}
.strip ul { display: flex; gap: var(--space-1); max-width: var(--content-max); margin: 0 auto; padding: 0 var(--space-6); }
.strip a {
  display: flex; align-items: center; gap: 7px;
  height: var(--strip-h); padding: 0 var(--space-3);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-muted); text-decoration: none; white-space: nowrap;
}
.strip a:hover { color: var(--ink); }
.strip a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--agent); }
.strip-count { font-size: var(--text-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.strip-count.is-accent { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--agent); color: #fff; font-weight: var(--weight-semibold); }

/* -------------------------------------------------------------- basics */
.page { max-width: var(--content-max); margin: 0 auto; padding: var(--space-8) var(--space-6) var(--space-12); }
.row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.page-head { margin-bottom: var(--space-6); }
.page-title { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); line-height: 1.15; }
.page-sub { margin-top: var(--space-1); color: var(--ink-muted); }

.eyebrow {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase;
  color: var(--agent); margin-bottom: var(--space-2);
}
.eyebrow-dot { width: 6px; height: 6px; border-radius: 2px; background: var(--agent); }

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card);
}
.card-head { padding: var(--space-5) var(--space-6) var(--space-4); }
.card-title { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.015em; }
.card-link { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--agent); text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.card-more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: var(--space-3); border-top: 1px solid var(--line);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--agent); text-decoration: none;
}
.card-more:hover { background: var(--surface-hover); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.ranked { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--ink-faint); }

.empty { padding: var(--space-10) var(--space-6); text-align: center; color: var(--ink-muted); background: var(--surface); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--line); }
.empty-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--ink); margin-bottom: 4px; }
.empty a { color: var(--agent); }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 16px;
  border: 0; border-radius: var(--radius-pill);
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line-strong), 0 1px 2px rgba(12, 13, 26, 0.06);
  font-size: var(--text-sm); font-weight: var(--weight-semibold);
  text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover { background: var(--surface-hover); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow-button); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--ink); }
.btn-danger { background: var(--risk); color: #fff; box-shadow: none; }
.btn-sm { height: 30px; padding: 0 12px; font-size: var(--text-xs); }
.btn-lg { height: 46px; padding: 0 22px; font-size: var(--text-md); }
.icon-btn {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-faint); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-hover); color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--risk-soft); color: var(--risk); }

/* --------------------------------------------- tones, chips, avatars */
.tone-ok    { --t: var(--ok);    --t-soft: var(--ok-soft); }
.tone-watch { --t: var(--watch); --t-soft: var(--watch-soft); }
.tone-risk  { --t: var(--risk);  --t-soft: var(--risk-soft); }
.tone-info  { --t: var(--info);  --t-soft: var(--info-soft); }
.tone-idle  { --t: var(--idle);  --t-soft: var(--idle-soft); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 22px; padding: 0 9px; border-radius: var(--radius-pill);
  background: var(--t-soft); color: var(--t);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap;
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--t); flex: none; box-shadow: 0 0 0 3px var(--t-soft); }

.av {
  width: var(--s); height: var(--s); flex: none;
  display: inline-grid; place-items: center; border-radius: 50%;
  font-size: calc(var(--s) * 0.36); font-weight: var(--weight-semibold); letter-spacing: 0.01em;
  color: var(--avc); background: var(--avs);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--avc) 18%, transparent);
}
.av-violet { --avc: var(--av-violet); --avs: var(--av-violet-soft); }
.av-teal   { --avc: var(--av-teal);   --avs: var(--av-teal-soft); }
.av-pink   { --avc: var(--av-pink);   --avs: var(--av-pink-soft); }
.av-amber  { --avc: var(--av-amber);  --avs: var(--av-amber-soft); }
.av-blue   { --avc: var(--av-blue);   --avs: var(--av-blue-soft); }
.av-green  { --avc: var(--av-green);  --avs: var(--av-green-soft); }
.av-orange { --avc: var(--av-orange); --avs: var(--av-orange-soft); }
.av-slate  { --avc: var(--av-slate);  --avs: var(--av-slate-soft); }
.av-sky    { --avc: var(--av-sky);    --avs: var(--av-sky-soft); }
.av-plum   { --avc: var(--av-plum);   --avs: var(--av-plum-soft); }
.av-me     { --avc: var(--page);      --avs: var(--ink); box-shadow: none; }

.live { display: inline-flex; gap: 3px; margin-right: 6px; vertical-align: middle; }
.live i { width: 5px; height: 5px; border-radius: 50%; background: var(--agent); opacity: 0.35; animation: live 1.2s infinite var(--ease); }
.live i:nth-child(2) { animation-delay: 0.15s; }
.live i:nth-child(3) { animation-delay: 0.3s; }
@keyframes live { 0%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.cites { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--space-3); }
.cite {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px; border-radius: var(--radius-pill);
  background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line);
  font-family: var(--font-mono); font-size: var(--text-2xs); color: var(--ink-muted);
}
.cite .icon { color: var(--agent); }
.cite-ok { color: var(--ok); }
.cite-ok::before { content: '·'; margin-right: 6px; color: var(--ink-faint); }

/* ------------------------------------------------------------ overview */
.hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr); gap: var(--space-10);
  align-items: center;
  padding: var(--space-2) 0 var(--space-8);
}
.hero::before {
  content: ''; position: absolute; inset: -80px -10vw auto -10vw; height: 420px; z-index: -1;
  background: radial-gradient(60% 70% at 30% 30%, var(--page-glow), transparent 70%);
  pointer-events: none;
}
.display { font-size: clamp(2rem, 3.6vw, 3rem); font-weight: var(--weight-semibold); letter-spacing: -0.035em; line-height: 1.04; max-width: 15ch; }
.display-muted { color: var(--ink-faint); }
.display em { font-family: var(--font-accent); font-style: italic; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-6); }

.worker {
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--agent-line), var(--shadow-raised);
  overflow: hidden;
}
.worker-head, .chat-head, .propose-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.worker-name, .chat-name, .propose-name { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.worker-tenant, .chat-tenant, .propose-tag { margin-left: auto; color: var(--ink-faint); }
.worker-body {
  padding: var(--space-5);
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 14px 14px;
}
.worker-task { font-weight: var(--weight-semibold); display: grid; }
.worker-sub { font-weight: var(--weight-regular); color: var(--ink-muted); font-size: var(--text-sm); }
.worker-steps { display: grid; gap: 10px; margin-top: var(--space-4); padding: var(--space-4); background: var(--surface); border-radius: var(--radius-md); box-shadow: inset 0 0 0 1px var(--line); }
.worker-steps li { display: flex; align-items: flex-start; gap: 10px; font-size: var(--text-sm); color: var(--ink-faint); }
.worker-steps li > span:last-child { display: grid; }
.worker-steps small { font-size: var(--text-xs); color: var(--ink-faint); }
.worker-steps .icon { margin-top: 3px; }
.worker-steps .is-done { color: var(--ink); }
.worker-steps .is-done .icon { color: var(--ok); }
.worker-steps .is-doing { color: var(--ink); font-weight: var(--weight-medium); }
.worker-steps .is-doing .live { margin: 7px 0 0; }
.worker-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: var(--text-xs); color: var(--ink-faint); }

.pipeline { margin-bottom: var(--space-6); }
.pipe { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); padding: 0 var(--space-4) var(--space-5); }
.pipe-node { position: relative; padding: var(--space-3) var(--space-3) 0; }
.pipe-node + .pipe-node::before {
  content: ''; position: absolute; left: -10px; top: 46px; width: 20px;
  border-top: 1.5px dashed var(--agent-line);
}
.pipe-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-muted); }
.pipe-value { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 2px; }
.pipe-sub { font-size: var(--text-xs); color: var(--ink-faint); min-height: 18px; }
.pipe-agent {
  display: inline-flex; align-items: center; gap: 6px; margin-top: var(--space-3);
  padding: 3px 10px 3px 3px; border-radius: var(--radius-pill);
  background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line);
  font-size: var(--text-xs); font-weight: var(--weight-medium); text-decoration: none; max-width: 100%;
}
.pipe-agent span:not(.av) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.pipe-agent:hover { box-shadow: inset 0 0 0 1px var(--agent-line); background: var(--agent-soft); }
.pipe-flag { color: var(--risk); }
.pipe-you { display: block; margin-top: var(--space-2); font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--agent); text-decoration: none; }
a.pipe-you:hover { text-decoration: underline; }
.pipe-you.is-none { color: var(--ink-faint); font-weight: var(--weight-regular); }

.split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr); gap: var(--space-6); align-items: start; }

/* Needs rows */
.nlist > li + li { border-top: 1px solid var(--line); }
.nrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-4); padding: var(--space-4) var(--space-6); align-items: start; }
.nrow-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.nrow-subject { font-weight: var(--weight-semibold); text-decoration: none; }
.nrow-subject:hover { text-decoration: underline; }
.nrow-ref { font-size: var(--text-xs); color: var(--ink-faint); }
.nrow-prop { margin-top: 4px; font-size: var(--text-sm); }
.nrow-agent { color: var(--agent); font-weight: var(--weight-semibold); }
.nrow-agent::after { content: ':'; }
.nrow-why { margin-top: 2px; font-size: var(--text-sm); color: var(--ink-muted); max-width: 78ch; }
.nrow-side { display: grid; justify-items: end; gap: var(--space-2); }
.nrow-wait { font-size: var(--text-xs); color: var(--ink-faint); white-space: nowrap; }
.nrow-actions { display: flex; gap: 6px; }

/* Team */
.team { padding: 0 var(--space-3) var(--space-3); }
.team-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-md); text-decoration: none; }
.team-row:hover { background: var(--surface-hover); }
.team-text { flex: 1; min-width: 0; display: grid; }
.team-name { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.team-now { font-size: var(--text-xs); color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.team-now.is-risk, .spec-now.is-risk, .agent-hero-now.is-risk { color: var(--risk); }
.team-needs { min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--agent); color: #fff; font-size: var(--text-xs); font-weight: var(--weight-semibold); }

/* -------------------------------------------------------------- queues */
.table-card { overflow: hidden; }
.table-tools { display: flex; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--line); }
.search {
  display: flex; align-items: center; gap: 8px; flex: 0 1 380px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-pill);
  background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-faint);
}
.search:focus-within { box-shadow: inset 0 0 0 1.5px var(--agent); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: var(--text-sm); color: var(--ink); }
.table-wrap { overflow-x: auto; }
.queue { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.queue th { text-align: left; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-faint); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.queue td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.queue tbody tr:last-child td { border-bottom: 0; }
.queue tbody tr:hover { background: var(--surface-hover); }
.q-n { color: var(--ink-faint); font-size: var(--text-xs); width: 32px; font-variant-numeric: tabular-nums; }
.q-sup { display: flex; align-items: center; gap: 10px; }
.sup-av { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); font-size: 10px; font-weight: var(--weight-semibold); color: var(--ink-muted); }
.q-name, .q-type { display: block; font-weight: var(--weight-medium); }
.q-id, .q-stage { display: block; font-size: var(--text-xs); color: var(--ink-faint); }
.q-agent { display: flex; align-items: flex-start; gap: 8px; min-width: 240px; }
.q-agent-name { display: block; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--agent); }
.q-reason { display: block; color: var(--ink-muted); }
.q-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.q-spend { display: block; font-weight: var(--weight-medium); }
.q-age { display: block; font-size: var(--text-xs); color: var(--ink-faint); }
.q-age.is-risk { color: var(--risk); font-weight: var(--weight-medium); }
.q-act { text-align: right; width: 1%; }

.specs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--space-4); }
.spec { display: flex; flex-direction: column; gap: var(--space-3); padding: var(--space-5); background: var(--surface); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card); }
.spec:hover { box-shadow: inset 0 0 0 1px var(--agent-line), var(--shadow-raised); }
.spec-head { display: flex; gap: 12px; text-decoration: none; }
.spec-head > span:last-child { display: grid; gap: 2px; }
.spec-name { font-weight: var(--weight-semibold); }
.spec-line { font-size: var(--text-sm); color: var(--ink-muted); }
.spec-now { font-size: var(--text-xs); color: var(--ink-faint); padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-sunk); }
.spec-foot { margin-top: auto; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.spec-counts { font-size: var(--text-xs); color: var(--ink-faint); display: flex; gap: 4px; align-items: baseline; }
.spec-counts b { color: var(--ink); font-weight: var(--weight-semibold); margin-left: 6px; }
.spec-foot .btn { margin-left: auto; }

/* --------------------------------------------------------- agent page */
.back { display: inline-flex; align-items: center; gap: 4px; margin-bottom: var(--space-4); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.agent-hero {
  display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap;
  padding: var(--space-6); border-radius: var(--radius-xl);
  background:
    radial-gradient(50% 120% at 0% 0%, var(--page-glow), transparent 70%),
    var(--surface);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card);
}
.agent-hero-text { flex: 1; min-width: 260px; }
.agent-hero-line { margin-top: 4px; color: var(--ink-muted); font-size: var(--text-lg); }
.agent-hero-now { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--ink-muted); }
.agent-hero-side { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.mini-counts { display: flex; gap: var(--space-5); }
.mini-counts div { display: flex; flex-direction: column-reverse; }
.mini-counts dt { font-size: var(--text-xs); color: var(--ink-faint); }
.mini-counts dd { font-size: var(--text-xl); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; line-height: 1.1; }
.mini-counts dd.is-risk { color: var(--risk); }

.seg {
  display: inline-flex; gap: 2px; margin: var(--space-6) 0 var(--space-5);
  padding: 4px; border-radius: var(--radius-pill);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.seg a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 16px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ink-muted); text-decoration: none; white-space: nowrap; }
.seg a:hover { color: var(--ink); }
.seg a[aria-current="page"] { background: var(--agent); color: #fff; }
.seg-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--agent-soft); color: var(--agent); font-size: 11px; font-weight: var(--weight-semibold); }
.seg a[aria-current="page"] .seg-count { background: rgba(255, 255, 255, 0.24); color: #fff; }

.timeline { padding: var(--space-2) var(--space-6); }
.tl { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: var(--space-4); padding: var(--space-4) 0; }
.tl + .tl { border-top: 1px solid var(--line); }
.tl-what { font-weight: var(--weight-semibold); }
.tl-why { margin-top: 2px; font-size: var(--text-sm); color: var(--ink-muted); }
.tl-by { margin-top: 4px; font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--ok); }
.tl .cites { margin-top: var(--space-2); }
.tl-side { display: grid; justify-items: end; gap: var(--space-2); align-content: start; }
.tl-when { color: var(--ink-faint); white-space: nowrap; }
.undo-none { font-size: var(--text-xs); color: var(--ink-faint); white-space: nowrap; }
.undo-done { max-width: 240px; font-size: var(--text-xs); color: var(--info); text-align: right; }

.chat { max-width: 780px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--agent-line), var(--shadow-raised); overflow: hidden; }
.chat-thread {
  display: grid; gap: var(--space-4); padding: var(--space-6) var(--space-5); min-height: 240px;
  background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 14px 14px;
}
.msg p { max-width: 62ch; }
.msg-user { justify-self: end; padding: 10px 16px; border-radius: 14px; background: var(--agent-soft); font-weight: var(--weight-medium); }
.msg-agent { justify-self: start; display: grid; gap: var(--space-1); justify-items: start; padding: 14px 16px; border-radius: 14px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.msg-agent .btn { margin-top: var(--space-3); }
.msg-hint { color: var(--ink-faint); font-size: var(--text-sm); }
.chat-form { display: flex; align-items: center; gap: 6px; padding: 10px 10px 10px 18px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; height: 36px; border: 0; outline: none; background: transparent; }
.send { width: 36px; height: 36px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--primary-ink); cursor: pointer; }

.about { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--space-4); }
.about-block { padding: var(--space-5) var(--space-6); }
.about-block li { display: flex; gap: 10px; margin-top: var(--space-3); color: var(--ink-muted); }
.about-block .icon { margin-top: 4px; color: var(--agent); }

/* -------------------------------------------------------------- decide */
.rec-head { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.rec-av { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); font-weight: var(--weight-semibold); color: var(--ink-muted); }
.rec-title { flex: 1; min-width: 260px; }
.rec-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 6px; font-size: var(--text-sm); color: var(--ink-faint); }
.rec-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.stagepath {
  display: flex; align-items: center; gap: 0; margin: var(--space-6) 0;
  padding: 12px 16px; background: var(--surface); border-radius: var(--radius-pill);
  box-shadow: inset 0 0 0 1px var(--line); overflow-x: auto; scrollbar-width: none;
}
.stagepath li { display: flex; align-items: center; gap: 8px; flex: 1; min-width: max-content; font-size: var(--text-xs); color: var(--ink-faint); }
.stagepath li + li::before { content: ''; flex: 1; min-width: 16px; height: 0; border-top: 1.5px dashed var(--line-strong); margin: 0 10px; }
.sp-mark { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 11px; font-weight: var(--weight-semibold); }
.stagepath .is-done { color: var(--ink-muted); }
.stagepath .is-done .sp-mark { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.stagepath .is-current { color: var(--ink); font-weight: var(--weight-semibold); }
.stagepath .is-current .sp-mark { background: var(--agent); color: #fff; box-shadow: 0 0 0 4px var(--agent-soft); }
.stagepath .is-failed { color: var(--risk); font-weight: var(--weight-semibold); }
.stagepath .is-failed .sp-mark { background: var(--risk); color: #fff; box-shadow: 0 0 0 4px var(--risk-soft); }

.rec-grid { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--space-6); align-items: start; }
.rec-main { display: grid; gap: var(--space-4); }
.rec-rail { display: grid; gap: var(--space-4); position: sticky; top: calc(var(--topbar-h) + var(--strip-h) + var(--space-4)); }

.sec { padding: var(--space-5) var(--space-6) var(--space-6); }
.sec-title { display: flex; align-items: center; gap: 10px; font-size: var(--text-md); font-weight: var(--weight-semibold); margin-bottom: var(--space-4); }
.sec-n { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); font-size: 11px; color: var(--ink-muted); }
.sec-bad { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--risk); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-4) var(--space-5); }
.f { display: grid; gap: 4px; align-content: start; }
.f-label { display: flex; align-items: center; gap: 8px; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-muted); }
.f-label .chip { height: 18px; padding: 0 7px; font-size: 10.5px; }
.f-val { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--text-sm); }
.has-finding .f-val { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--risk) 45%, var(--line)); background: color-mix(in srgb, var(--risk-soft) 45%, var(--surface)); }
.f-finding { font-size: var(--text-xs); color: var(--risk); }

.compare { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.compare th, .compare td { text-align: left; padding: 10px 12px; border-top: 1px solid var(--line); }
.compare thead th { border-top: 0; padding-top: 0; font-size: var(--text-xs); color: var(--ink-faint); font-weight: var(--weight-medium); }
.compare tbody th { width: 160px; padding-left: 0; font-weight: var(--weight-regular); color: var(--ink-muted); }
.compare tr.is-flag td:last-child { color: var(--risk); font-weight: var(--weight-semibold); background: var(--risk-soft); }
.plan { display: flex; gap: 8px; margin-top: var(--space-4); padding: 12px 14px; border-radius: var(--radius-md); background: var(--agent-soft); font-size: var(--text-sm); }
.plan .icon { color: var(--agent); margin-top: 3px; }
.raw { margin: 0; padding: 12px 14px; border-radius: var(--radius-md); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); font-family: var(--font-mono); font-size: var(--text-xs); white-space: pre-wrap; word-break: break-word; }
.bundle li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 4px var(--space-4); padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.bundle li:first-child { border-top: 0; padding-top: 0; }
.bundle .mono { color: var(--ink-faint); padding-top: 3px; }
.b-type { display: grid; font-weight: var(--weight-medium); }
.b-type small { font-weight: var(--weight-regular); font-size: var(--text-xs); color: var(--ink-faint); }
.b-find { grid-column: 2; display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--ink-muted); flex-wrap: wrap; }
.call-meta { display: flex; align-items: center; gap: 8px; font-size: var(--text-sm); color: var(--ink-muted); margin-bottom: var(--space-4); }
.transcript { display: grid; gap: var(--space-3); }
.transcript li { max-width: 86%; padding: 10px 14px; border-radius: 14px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.transcript li.is-agent { justify-self: end; background: var(--agent-soft); box-shadow: none; }
.transcript .who { display: block; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-muted); margin-bottom: 2px; }

.propose { background: var(--surface); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1.5px var(--agent-line), var(--shadow-raised); overflow: hidden; }
.propose-tag { text-transform: uppercase; letter-spacing: var(--tracking-label); color: var(--agent); }
.propose-body { padding: var(--space-5); background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 14px 14px; }
.propose-text { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.015em; line-height: 1.25; }
.propose-why { margin-top: var(--space-2); color: var(--ink-muted); font-size: var(--text-sm); }
.confidence { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); font-size: var(--text-xs); color: var(--ink-muted); }
.meter { flex: 1; max-width: 160px; height: 6px; border-radius: var(--radius-pill); background: var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: inherit; background: var(--agent); }
.confidence strong { color: var(--ink); }
.msg-draft { margin-top: var(--space-4); border-radius: var(--radius-md); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.msg-draft summary { cursor: pointer; padding: 10px 14px; font-size: var(--text-sm); font-weight: var(--weight-semibold); list-style-position: inside; }
.msg-draft textarea { display: block; width: calc(100% - 20px); margin: 0 10px 10px; padding: 10px 12px; border: 0; border-radius: var(--radius-sm); background: var(--surface-sunk); font-size: var(--text-sm); line-height: 1.55; resize: vertical; }
.msg-draft textarea:not([readonly]) { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--agent); }
.approvals { margin-top: var(--space-4); font-size: var(--text-xs); color: var(--ink-muted); }
.propose-foot { padding: 10px 16px; border-top: 1px solid var(--line); }
.awaiting { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs); color: var(--ink-faint); }
.awaiting b { color: var(--ink); font-weight: var(--weight-semibold); }

.rail-card { padding: var(--space-4) var(--space-5); }
.rail-title { display: flex; align-items: baseline; gap: 8px; font-size: var(--text-md); font-weight: var(--weight-semibold); margin-bottom: var(--space-3); }
.rail-sum { margin-left: auto; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-faint); }
.checks li { display: flex; gap: var(--space-3); padding: 9px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.chk-text { flex: 1; display: grid; }
.chk-name { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.chk-note { font-size: var(--text-xs); color: var(--ink-muted); }
.chk-res { font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap; }
.chk-pass .chk-res { color: var(--ok); }
.chk-fail .chk-res { color: var(--risk); }
.chk-none .chk-res { color: var(--ink-faint); }
.chk-fail .chk-name::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--risk); margin-right: 8px; vertical-align: middle; }

/* ------------------------------------------------------- forms, layers */
.field { display: grid; gap: 6px; margin-bottom: var(--space-4); }
.field-label { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.field input, .field select, .field textarea {
  width: 100%; min-height: 40px; padding: 8px 12px;
  background: var(--surface); border: 0; border-radius: var(--radius-sm);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--agent), 0 0 0 4px var(--agent-soft); }
.field [aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--risk); }
.field-error { font-size: var(--text-sm); color: var(--risk); }
.field-group { margin: 0 0 var(--space-4); padding: var(--space-3) var(--space-4) 0; border: 0; border-radius: var(--radius-md); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.field-group legend { float: left; width: 100%; padding: 0 0 var(--space-3); font-family: var(--font-mono); font-size: var(--text-2xs); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--ink-faint); }

.layer { position: fixed; inset: 0; z-index: 50; }
.scrim { position: absolute; inset: 0; background: var(--overlay); backdrop-filter: blur(2px); }
.dialog { position: absolute; left: 50%; top: 18vh; transform: translateX(-50%); width: min(480px, calc(100% - 32px)); padding: var(--space-6); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); }
.dialog-title { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.015em; margin-bottom: var(--space-2); }
.dialog-body { color: var(--ink-muted); margin-bottom: var(--space-4); }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-2); }
.drawer { position: absolute; top: 8px; right: 8px; bottom: 8px; width: min(480px, calc(100% - 16px)); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); animation: drawer-in var(--dur) var(--ease); }
.drawer-head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-5) var(--space-6); border-bottom: 1px solid var(--line); }
.drawer-title { flex: 1; font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.015em; }
.drawer-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-5) var(--space-6); }
.drawer-foot { display: flex; justify-content: flex-end; gap: var(--space-2); padding: var(--space-4) var(--space-6); border-top: 1px solid var(--line); }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.toasts { position: fixed; left: 50%; bottom: var(--space-6); transform: translateX(-50%); z-index: 60; display: grid; gap: var(--space-2); justify-items: center; }
.toast { display: flex; align-items: center; gap: var(--space-2); padding: 12px 18px; background: var(--ink); color: var(--page); border-radius: var(--radius-pill); box-shadow: var(--shadow-pop); font-size: var(--text-sm); font-weight: var(--weight-medium); animation: toast-in var(--dur) var(--ease); transition: opacity var(--dur) var(--ease); }
.toast .icon { color: var(--ok); }
.toast.out { opacity: 0; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ----------------------------------------------------------- dashboard */
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; margin-bottom: var(--space-6); }
.dash-date { margin-top: 6px; color: var(--ink-faint); }
.dash-actions { display: flex; gap: var(--space-2); }
.btn-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--agent); color: #fff; font-size: var(--text-xs); }
.block { margin-bottom: var(--space-6); }
.block-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: -0.01em; margin: 0 0 var(--space-3); }
.card-note { font-size: var(--text-xs); color: var(--ink-faint); }
.card-title.sm { font-size: var(--text-md); }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); }
.kpi {
  display: grid; gap: 2px; height: 100%;
  padding: var(--space-4) var(--space-4) var(--space-3);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--line), var(--shadow-card);
  text-decoration: none;
  transition: box-shadow var(--dur-fast) var(--ease);
}
.kpi:hover { box-shadow: inset 0 0 0 1px var(--agent-line), var(--shadow-raised); }
.kpi-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-muted); }
.kpi-value { font-size: var(--text-3xl); font-weight: var(--weight-semibold); letter-spacing: -0.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-value.is-risk { color: var(--risk); }
.kpi-sub { font-size: var(--text-xs); color: var(--ink-faint); margin-bottom: var(--space-3); }
.owner { display: inline-flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-muted); font-weight: var(--weight-medium); min-width: 0; }
.kpi .owner { padding-top: var(--space-3); border-top: 1px solid var(--line); flex-wrap: wrap; }
.owner-flag { margin-left: auto; font-weight: var(--weight-semibold); color: var(--agent); }
.owner-flag.is-risk { color: var(--risk); }

.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); }
.chart-card { display: flex; flex-direction: column; }
.chart-foot { margin-top: auto; padding: var(--space-3) var(--space-6); border-top: 1px solid var(--line); }

.cols { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-4); align-items: end; height: 230px; padding: var(--space-2) var(--space-6) var(--space-4); }
.col { position: relative; display: grid; grid-template-rows: 1fr auto; height: 100%; outline: none; }
.col-plot { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; border-bottom: 1px solid var(--line-strong); }
.col-val { font-size: var(--text-xs); font-weight: var(--weight-semibold); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.col-bar { width: min(44px, 70%); border-radius: 4px 4px 0 0; background: var(--agent); transition: background var(--dur-fast) var(--ease); }
.col-lab { text-align: center; font-size: var(--text-xs); color: var(--ink-faint); padding-top: 6px; }
.col:hover .col-bar, .col:focus-visible .col-bar { background: var(--agent-strong); }
.col:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 6px; }
.tip {
  position: absolute; left: 50%; bottom: calc(100% - 20px); transform: translate(-50%, -4px);
  display: grid; padding: 6px 10px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--page); font-size: var(--text-xs); white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity var(--dur-fast) var(--ease);
}
.tip b { font-weight: var(--weight-semibold); }
.col:hover .tip, .col:focus-visible .tip { opacity: 1; }

.hbars { display: grid; gap: var(--space-3); padding: var(--space-1) var(--space-6) var(--space-5); }
.hbar { display: grid; gap: 6px; outline: none; border-radius: 6px; }
.hbar:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
.hbar-top { display: flex; justify-content: space-between; gap: var(--space-3); font-size: var(--text-sm); }
.hbar-top b { font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; display: inline-flex; gap: 8px; align-items: baseline; }
.drop { font-style: normal; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--risk); }
.hbar-track { height: 10px; border-radius: var(--radius-pill); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.hbar-fill { display: block; height: 100%; border-radius: var(--radius-pill); background: var(--agent); transition: background var(--dur-fast) var(--ease); }
.hbar:hover .hbar-fill, .hbar:focus-visible .hbar-fill { background: var(--agent-strong); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); padding: 0 var(--space-6) var(--space-6); }
.stat { display: grid; gap: 2px; padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.stat-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-muted); }
.stat-value { font-size: var(--text-lg); font-weight: var(--weight-semibold); color: var(--t); }
.stat-sub { font-size: var(--text-xs); color: var(--ink-faint); margin-bottom: var(--space-2); }

/* ---------------------------------------------------------- responsive */
@media (max-width: 1240px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .split-even { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: minmax(0, 1fr); padding: 0 var(--space-4) var(--space-4); }
  .cols, .hbars { padding-left: var(--space-4); padding-right: var(--space-4); }
  .cols { gap: var(--space-2); }
  .dash-actions { width: 100%; }
}
@media (max-width: 1340px) {
  .suite a { padding: 6px 8px; }
}
@media (max-width: 1180px) {
  .pipe { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: var(--space-4); }
  .pipe-node:nth-child(5)::before { display: none; }
}
@media (max-width: 1100px) {
  .suite { display: none; }
  .hero { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .rec-grid { grid-template-columns: minmax(0, 1fr); }
  .rec-rail { position: static; order: -1; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 var(--space-4); gap: var(--space-3); }
  .brand-word { display: none; }
  .askbar { min-width: 0; flex: 1; }
  .strip ul { padding: 0 var(--space-3); }
  .page { padding: var(--space-5) var(--space-4) var(--space-12); }
  .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 var(--space-2) var(--space-4); }
  .pipe-node::before { display: none; }
  .nrow { grid-template-columns: auto minmax(0, 1fr); padding: var(--space-4); }
  .nrow-side { grid-column: 1 / -1; justify-items: start; }
  .card-head { padding: var(--space-4); }
  .tl { grid-template-columns: auto minmax(0, 1fr); }
  .tl-side { grid-column: 2; justify-items: start; }
  .rec-actions { width: 100%; }
  .stagepath { border-radius: var(--radius-md); }
  .compare tbody th { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- shell
   After ClickUp: the top bar sits on the grey frame; below it, the dark
   rail and the workspace card (sidebar and canvas) float with a 6px
   gutter. Only the canvas scrolls. */
body { background: var(--app); font-size: var(--text-sm); }
.app { height: 100vh; display: grid; grid-template-rows: var(--topbar-h) minmax(0, 1fr); }
.frame { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); gap: var(--gutter); padding: 0 var(--gutter) var(--gutter); min-height: 0; }

.topbar { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2) 0 var(--gutter); }
.menu-btn { display: none; }
.workspace-btn {
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 4px;
  border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer; color: var(--ink);
  width: calc(var(--rail-w) + var(--sidebar-w) - 6px); max-width: 40vw;
}
.workspace-btn:hover { background: var(--surface-hover); }
.ws-tile { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--agent); color: #fff; font-size: 10px; font-weight: var(--weight-bold); flex: none; }
.ws-name { font-weight: var(--weight-semibold); font-size: var(--text-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-btn .icon { color: var(--ink-faint); margin-left: auto; }
.askbar {
  position: relative; flex: 0 1 420px; margin: 0 auto 0 0;
  display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 6px 0 12px;
  background: var(--surface); border-radius: var(--radius-pill); color: var(--ink-faint);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.27), 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: box-shadow 0.3s cubic-bezier(0.6, 0, 0.05, 0.95);
}
.askbar:hover { box-shadow: 0 0 1px rgba(0, 0, 0, 0.27), 0 1px 3px rgba(0, 0, 0, 0.1); }
.askbar:focus-within { box-shadow: 0 0 0 1.5px var(--agent), 0 0 0 4px var(--agent-soft); }
.askbar input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: transparent; font-size: var(--text-sm); color: var(--ink); }
.askbar input::placeholder { color: var(--ink-faint); }
.kbd { font-family: var(--font-sans); font-size: var(--text-2xs); color: var(--ink-faint); padding: 1px 6px; border-radius: 5px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.ask-pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; padding: var(--space-3) var(--space-4); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); font-size: var(--text-sm); color: var(--ink); z-index: 40; }
.top-right { display: flex; align-items: center; gap: var(--space-2); }
.has-count { position: relative; }
.count-dot { position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--radius-pill); display: grid; place-items: center; background: #e93d82; color: #fff; font-size: 10px; font-weight: var(--weight-semibold); }
.avatar-me { width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--agent); color: #fff; font-size: 11px; font-weight: var(--weight-bold); }

.rail { background: var(--rail); border-radius: var(--radius-sm); padding: var(--space-2) 0; overflow-y: auto; scrollbar-width: none; box-shadow: inset 0 0 0 1px var(--rail-line), var(--shadow-panel); }
.rail ul { display: grid; gap: 4px; justify-items: center; }
.rail a {
  display: grid; justify-items: center; gap: 3px; width: 54px; padding: 7px 0 6px; border-radius: var(--radius-sm);
  color: var(--rail-ink); text-decoration: none; font-size: 10px; font-weight: var(--weight-semibold);
}
.rail a .icon { width: 32px; height: 26px; padding: 4px 7px; border-radius: 7px; }
.rail a:hover { color: var(--rail-ink-strong); }
.rail a:hover .icon { background: var(--rail-hover); }
.rail a[aria-current="page"] { color: var(--rail-current-ink); }
.rail a[aria-current="page"] .icon { background: var(--rail-current); color: var(--rail-current-ink); }

.workspace { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 0; background: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-panel); overflow: hidden; }
.sidebar { background: var(--surface-sunk); border-right: 1px solid var(--line); padding: var(--space-3) var(--space-2) var(--space-6); overflow-y: auto; scrollbar-width: thin; }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 8px 10px; }
.side-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
.side-label { padding: 14px 8px 4px; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-muted); }
.side-list { display: grid; gap: 1px; }
.side-list a {
  display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 8px; border-radius: var(--radius-sm);
  font-size: var(--text-md); color: var(--ink-muted); text-decoration: none;
}
.side-list a:hover { background: var(--surface-hover); color: var(--ink); }
.side-list a[aria-current="page"] { background: var(--agent-soft); color: var(--agent-strong); font-weight: var(--weight-medium); }
.side-list a.is-agents .icon { color: var(--agent); }
.side-dot { width: 15px; display: grid; place-items: center; flex: none; }
.side-dot::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.side-list a[aria-current="page"] .side-dot::before { background: var(--agent); }
.side-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-count { font-size: var(--text-xs); color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.side-count.is-accent { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--agent); color: #fff; font-weight: var(--weight-semibold); }

main.canvas { overflow-y: auto; overflow-x: hidden; min-height: 0; background: var(--page); }
.cv { max-width: var(--content-max); margin: 0 auto; padding: var(--space-5) var(--space-6) var(--space-10); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-content: start; }
.cv > .back { justify-self: start; margin-bottom: calc(var(--space-2) * -1); }

/* ------------------------------------------------------- canvas pieces */
.cv-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
.crumb { font-size: var(--text-xs); color: var(--ink-faint); margin-bottom: 2px; }
.cv-title { font-size: var(--text-2xl); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-tight); line-height: 1.2; }
.cv-sub { font-size: var(--text-xs); color: var(--ink-faint); margin-top: 2px; }
.cv-actions { display: flex; gap: var(--space-2); }

.btn { height: 28px; padding: 0 10px; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: var(--weight-medium); gap: 6px; box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-muted); }
.btn:hover { background: var(--surface-sunk); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: none; }
.btn-primary:hover { background: var(--primary-hover); color: var(--primary-ink); box-shadow: none; }
.btn-ghost { box-shadow: none; }
.btn-sm { height: 24px; padding: 0 8px; font-size: var(--text-xs); border-radius: 6px; }
.btn-xs { height: 24px; padding: 0 8px; font-size: var(--text-xs); border-radius: 6px; gap: 4px; }
.btn-lg { height: 32px; padding: 0 14px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--space-3); }
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi { display: grid; gap: 2px; height: 100%; padding: var(--space-3) var(--space-4); background: var(--surface); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; transition: background var(--dur-fast) var(--ease); }
.kpi:hover { background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line-strong); }
.kpi-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-muted); }
.kpi-value { font-size: var(--text-3xl); font-weight: var(--weight-semibold); letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.kpi-value.is-risk { color: var(--risk); }
.kpi-value.is-watch { color: var(--watch); }
.kpi-sub { font-size: var(--text-xs); color: var(--ink-faint); margin: 0; }

.sec-h { display: flex; align-items: center; gap: 6px; font-size: var(--text-md); font-weight: var(--weight-semibold); }
.sec-h .icon { color: var(--agent); }
.sec-note { font-size: var(--text-xs); color: var(--ink-faint); }
.sec-link { margin-left: auto; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--agent-strong); text-decoration: none; }
.sec-link:hover { text-decoration: underline; }

.agents-bar { display: flex; align-items: center; gap: var(--space-4); padding: 8px 8px 8px 14px; border-radius: var(--radius-lg); background: var(--agent-soft); box-shadow: inset 0 0 0 1px var(--agent-line); }
.agents-bar-head { display: flex; align-items: center; gap: 8px; flex: none; }
.agents-bar-head .sec-link { display: none; }
.agent-chips { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.agent-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 4px; border-radius: var(--radius-pill); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; white-space: nowrap; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink); }
.agent-chip:hover { box-shadow: inset 0 0 0 1px var(--agent-line); }
.agent-chip.is-more { padding: 0 10px; color: var(--agent-strong); }
.agent-chip-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--agent); color: #fff; font-size: 10px; font-weight: var(--weight-semibold); }
.agent-chip-badge.is-risk { background: var(--risk-soft); color: var(--risk); }
.agent-chip .state-dot { width: 6px; height: 6px; box-shadow: none; }

.cv-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--space-4); align-items: start; }
.cv-split.even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { background: var(--surface); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-more { display: block; padding: 10px 16px; border-top: 1px solid var(--line); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--agent-strong); text-decoration: none; }
.panel-more:hover { background: var(--surface-sunk); }
.quiet { padding: var(--space-6) var(--space-4); color: var(--ink-faint); text-align: center; }

.needs-compact li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.needs-compact li:first-child { border-top: 0; }
.needs-compact li:hover { background: var(--surface-sunk); }
.nc-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.nc-subject { font-weight: var(--weight-semibold); font-size: var(--text-sm); color: var(--ink); text-decoration: none; }
a.nc-subject:hover { text-decoration: underline; }
.nc-mod { font-size: var(--text-2xs); color: var(--ink-faint); }
.nc-prop { font-size: var(--text-xs); color: var(--ink-muted); margin-top: 2px; }
.needs-compact .chip { height: 20px; font-size: 11px; padding: 0 7px; }

.chart-panel .cols { height: 210px; padding: var(--space-4) var(--space-5); }
.hbars { padding: var(--space-4) var(--space-5); }
.stats { padding: var(--space-4) var(--space-5); }

.toolbar { display: flex; gap: 6px; margin-left: auto; }
.tchip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); font-size: var(--text-xs); font-weight: var(--weight-medium); cursor: pointer; }
.tchip:hover { background: var(--surface-sunk); }
.tchip.is-on { background: var(--agent-soft); border-color: var(--agent-line); color: var(--agent-strong); }

.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tbl th { text-align: left; height: 32px; padding: 0 16px; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-faint); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { height: 38px; padding: 6px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--surface-sunk); }
.tbl .name { font-weight: var(--weight-medium); color: var(--ink); }
.tbl .name a { color: inherit; text-decoration: none; }
.tbl .name a:hover { text-decoration: underline; }
.tbl .sub { display: block; font-size: var(--text-2xs); font-weight: var(--weight-regular); color: var(--ink-faint); }
.tbl .muted, .muted { color: var(--ink-muted); }
.tbl .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl .chip { height: 20px; font-size: 11px; padding: 0 7px; }
.tbl .group-row th { height: 34px; background: var(--surface-sunk); color: var(--ink); font-weight: var(--weight-semibold); font-size: var(--text-xs); }
.who { display: inline-flex; align-items: center; gap: 8px; }

/* Pages from the first design, fitted to the canvas */
.page-head { margin-bottom: 0; }
.page-title { font-size: var(--text-2xl); }
.card { border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--line); }
.agent-hero { border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.agent-hero .av { --s: 48px !important; }
.agent-hero-line { font-size: var(--text-sm); }
.seg { margin: 0; }
.seg a { height: 28px; padding: 0 12px; font-size: var(--text-xs); }
.rec-rail { top: var(--space-4); }
.rec-av { width: 40px; height: 40px; border-radius: 10px; }
.stagepath { margin: 0; border-radius: var(--radius-lg); }
.propose { box-shadow: inset 0 0 0 1px var(--agent-line); }
.propose-text { font-size: var(--text-lg); }
.nrow { padding: 12px 16px; }
.empty { box-shadow: inset 0 0 0 1px var(--line); border-radius: var(--radius-lg); }
.toast { border-radius: var(--radius-sm); }
.dialog, .drawer { border-radius: var(--radius-lg); }

/* ---------------------------------------------------------- shell sizes */
@media (max-width: 1240px) {
  .kpis, .kpis-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .cv-split, .cv-split.even { grid-template-columns: minmax(0, 1fr); }
  .rec-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  :root { --rail-w: 0px; }
  .app { height: auto; min-height: 100vh; }
  .frame { grid-template-columns: minmax(0, 1fr); }
  .rail { position: sticky; top: 0; z-index: 25; overflow-x: auto; padding: 4px; }
  .rail ul { display: flex; justify-items: start; }
  .rail a { width: 60px; }
  .workspace { grid-template-columns: minmax(0, 1fr); overflow: visible; }
  .sidebar { display: none; }
  body.nav-open .sidebar { display: block; position: fixed; inset: var(--topbar-h) auto 0 0; width: min(300px, 86vw); z-index: 45; box-shadow: var(--shadow-pop); border-radius: 0 var(--radius-lg) var(--radius-lg) 0; }
  .menu-btn { display: grid; }
  .workspace-btn { width: auto; max-width: 50vw; }
  main.canvas { overflow: visible; }
  .agents-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .agent-chips { flex-wrap: nowrap; }
  .kbd, .tenant { display: none; }
}
@media (max-width: 640px) {
  .kpis, .kpis-4, .kpis-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cv { padding: var(--space-4) var(--space-3) var(--space-8); }
  .ws-name { display: none; }
  .toolbar { display: none; }
  .needs-compact li { grid-template-columns: auto minmax(0, 1fr); }
  .needs-compact li > .btn { grid-column: 2; justify-self: start; }
}

.topbar { position: static; height: auto; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }

/* Keep visually hidden labels inside their scrolling rows, and let only
   the canvas scroll on wide screens. */
.agent-chips, .agent-chip, .toolbar, .table-wrap { position: relative; }
@media (min-width: 901px) {
  html, body { overflow: hidden; }
}
.side-head { flex-wrap: wrap; }
.side-head .btn { width: 100%; justify-content: flex-start; height: 28px; font-size: var(--text-sm); }
.sidebar { overflow-x: hidden; }

/* ====================================================== shell, round 3 */
.brand { display: flex; align-items: center; flex: none; padding: 0 6px; height: 30px; border-radius: var(--radius-sm); }
.brand img { height: 22px; width: auto; display: block; }
.brand:hover { background: var(--surface-hover); }
.side-toggle { width: 30px; height: 30px; border-radius: var(--radius-sm); color: var(--ink-muted); }
.side-toggle:hover { background: var(--surface-hover); color: var(--ink); }
.workspace-btn { display: none; }

.quick { display: flex; align-items: center; gap: 6px; flex: none; margin-left: var(--space-3); }
.quick-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px;
  border: 0; border-radius: var(--radius-pill); background: var(--surface); color: var(--ink-muted);
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.27), 0 1px 2px rgba(0, 0, 0, 0.05);
  font-size: var(--text-xs); font-weight: var(--weight-medium); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}
.quick-chip:hover { color: var(--ink); box-shadow: 0 0 1px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.08); transform: translateY(-1px); }
.quick-chip .icon { color: var(--agent); }
.quick-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); display: grid; place-items: center; background: var(--agent-soft); color: var(--agent-strong); font-size: 10.5px; font-weight: var(--weight-semibold); }
.askbar { flex: 1 1 300px; max-width: 380px; margin: 0 auto; }

.top-right { gap: 2px; }
.util { position: relative; }
.util-btn { width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--ink-muted); position: relative; }
.util-btn:hover, .util-btn[aria-expanded="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 1px rgba(0, 0, 0, 0.27); }
.btn-create { height: 30px; margin-right: 6px; }
button.avatar-me { border: 0; cursor: pointer; margin-left: 6px; }
button.avatar-me:hover { box-shadow: 0 0 0 3px var(--agent-soft); }
.count-dot { top: 1px; right: 0; }

.menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 60; min-width: 280px; padding: 6px; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); transform-origin: top left; animation: menu-in 120ms var(--ease); }
.menu-right { left: auto; right: 0; transform-origin: top right; }
.menu a { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-size: var(--text-sm); }
.menu a:hover, .menu a:focus-visible { background: var(--surface-sunk); outline: none; }
.menu a .icon { color: var(--ink-muted); }
.menu-text { flex: 1; display: grid; }
.menu-text small { font-size: var(--text-xs); color: var(--ink-faint); }
.menu-head { padding: 6px 8px 4px; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-faint); }
.menu-sep { height: 1px; margin: 6px 0; background: var(--line); }
.menu-count { font-size: var(--text-xs); color: var(--ink-faint); }
@keyframes menu-in { from { opacity: 0.4; transform: scale(0.96); } to { opacity: 1; transform: none; } }

/* Sidebar: one click to collapse, with a smooth width change */
.workspace { transition: grid-template-columns 260ms cubic-bezier(0.2, 0.7, 0.2, 1); }
body.side-collapsed .workspace { grid-template-columns: 0 minmax(0, 1fr); }
.sidebar { transition: opacity 180ms var(--ease), padding 260ms var(--ease); }
body.side-collapsed .sidebar { opacity: 0; padding-left: 0; padding-right: 0; pointer-events: none; border-right-color: transparent; }
.side-head { position: relative; }
.side-collapse { position: absolute; top: 0; right: 4px; width: 26px; height: 26px; border-radius: 6px; color: var(--ink-faint); opacity: 0; transition: opacity var(--dur-fast) var(--ease); }
.sidebar:hover .side-collapse, .side-collapse:focus-visible { opacity: 1; }
.side-collapse:hover { background: var(--surface-hover); color: var(--ink); }
.side-title { padding-right: 32px; }
.side-list a { transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.sidebar.is-entering .side-list li, .sidebar.is-entering .side-label, .sidebar.is-entering .side-head { animation: rise 260ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.sidebar.is-entering .side-list li:nth-child(2) { animation-delay: 20ms; }
.sidebar.is-entering .side-list li:nth-child(3) { animation-delay: 40ms; }
.sidebar.is-entering .side-list li:nth-child(4) { animation-delay: 60ms; }
.sidebar.is-entering .side-list li:nth-child(5) { animation-delay: 80ms; }
.sidebar.is-entering .side-list li:nth-child(n+6) { animation-delay: 100ms; }

/* ==================================================== page transitions */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.cv > * { animation: rise 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.cv > *:nth-child(2) { animation-delay: 40ms; }
.cv > *:nth-child(3) { animation-delay: 80ms; }
.cv > *:nth-child(4) { animation-delay: 120ms; }
.cv > *:nth-child(5) { animation-delay: 160ms; }
.cv > *:nth-child(n+6) { animation-delay: 200ms; }
.kpis > li { animation: rise 320ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.kpis > li:nth-child(2) { animation-delay: 60ms; } .kpis > li:nth-child(3) { animation-delay: 90ms; }
.kpis > li:nth-child(4) { animation-delay: 120ms; } .kpis > li:nth-child(5) { animation-delay: 150ms; } .kpis > li:nth-child(6) { animation-delay: 180ms; }
.col-bar { transform-origin: bottom; animation: grow 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both 160ms; }
.cols .col:nth-child(2) .col-bar { animation-delay: 200ms; } .cols .col:nth-child(3) .col-bar { animation-delay: 240ms; }
.cols .col:nth-child(4) .col-bar { animation-delay: 280ms; } .cols .col:nth-child(5) .col-bar { animation-delay: 320ms; } .cols .col:nth-child(6) .col-bar { animation-delay: 360ms; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.hbar-fill { transform-origin: left; animation: grow-x 600ms cubic-bezier(0.2, 0.7, 0.2, 1) both 200ms; }
@keyframes grow-x { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.kpi { transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur) var(--ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 1px var(--line-strong), 0 6px 16px rgba(15, 23, 42, 0.06); background: var(--surface); }
.agent-chip { transition: box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.agent-chip:hover { transform: translateY(-1px); }

/* ================================================ rail icon animations
   Each module's icon moves in its own way when hovered, and plays once
   when the module opens. */
.rail a .icon { transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease); transform-box: fill-box; }
.rail a:active .icon { transform: scale(0.92); }
.rail a .icon * { transform-box: fill-box; transform-origin: center; }
@keyframes rail-home { 0%, 100% { transform: translateY(0); } 35% { transform: translateY(-3px); } 65% { transform: translateY(1px); } }
@keyframes rail-gavel { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-24deg); } 55% { transform: rotate(8deg); } 75% { transform: rotate(-4deg); } }
@keyframes rail-contract { 0%, 100% { transform: rotate(0) scale(1); } 40% { transform: rotate(-8deg) scale(1.06); } 70% { transform: rotate(4deg); } }
@keyframes rail-cart { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(4px); } 55% { transform: translateX(-2px); } 75% { transform: translateX(1px); } }
@keyframes rail-receipt { 0% { transform: translateY(0); clip-path: inset(0 0 0 0); } 40% { transform: translateY(-4px); clip-path: inset(0 0 30% 0); } 100% { transform: translateY(0); clip-path: inset(0 0 0 0); } }
@keyframes rail-vendors { 0%, 100% { transform: scale(1); } 40% { transform: scale(1.18); } 70% { transform: scale(0.96); } }
@keyframes rail-slide-a { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-4px); } }
@keyframes rail-slide-b { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes rail-gear { from { transform: rotate(0); } to { transform: rotate(120deg); } }
.rail a[data-mod="home"]:hover svg, .rail a[data-mod="home"].is-arriving svg { animation: rail-home 520ms var(--ease); }
.rail a[data-mod="solicitations"]:hover svg, .rail a[data-mod="solicitations"].is-arriving svg { animation: rail-gavel 620ms var(--ease); transform-origin: 70% 70%; }
.rail a[data-mod="contracts"]:hover svg, .rail a[data-mod="contracts"].is-arriving svg { animation: rail-contract 560ms var(--ease); }
.rail a[data-mod="procurement"]:hover svg, .rail a[data-mod="procurement"].is-arriving svg { animation: rail-cart 560ms var(--ease); }
.rail a[data-mod="invoices"]:hover svg, .rail a[data-mod="invoices"].is-arriving svg { animation: rail-receipt 620ms var(--ease); }
.rail a[data-mod="vendors"]:hover svg, .rail a[data-mod="vendors"].is-arriving svg { animation: rail-vendors 520ms var(--ease); }
.rail a[data-mod="business-admin"]:hover circle:nth-of-type(1), .rail a[data-mod="business-admin"].is-arriving circle:nth-of-type(1) { animation: rail-slide-a 600ms var(--ease); }
.rail a[data-mod="business-admin"]:hover circle:nth-of-type(2), .rail a[data-mod="business-admin"].is-arriving circle:nth-of-type(2) { animation: rail-slide-b 600ms var(--ease); }
.rail a[data-mod="business-admin"]:hover circle:nth-of-type(3), .rail a[data-mod="business-admin"].is-arriving circle:nth-of-type(3) { animation: rail-slide-a 600ms var(--ease) 80ms; }
.rail a[data-mod="admin"]:hover svg, .rail a[data-mod="admin"].is-arriving svg { animation: rail-gear 700ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.rail a::before { content: ''; position: absolute; left: 0; width: 3px; height: 0; border-radius: 0 3px 3px 0; background: var(--rail-current-ink); transition: height var(--dur) var(--ease); }
.rail a { position: relative; }
.rail a[aria-current="page"]::before { height: 22px; top: 9px; }

/* ===================================================== agents gallery */
.ag-hero {
  position: relative; overflow: hidden;
  display: grid; gap: var(--space-4); padding: var(--space-6) var(--space-6) var(--space-5);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(60% 120% at 100% 0%, rgba(107, 78, 255, 0.14), transparent 60%),
    radial-gradient(50% 100% at 0% 100%, rgba(17, 86, 178, 0.08), transparent 60%),
    var(--surface-sunk);
  box-shadow: inset 0 0 0 1px var(--line);
}
.ag-hero::after { content: ''; position: absolute; inset: 0; background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 14px 14px; mask-image: linear-gradient(90deg, transparent 30%, #000); pointer-events: none; }
.ag-hero > * { position: relative; z-index: 1; }
.ag-title { font-size: 1.75rem; font-weight: var(--weight-semibold); letter-spacing: -0.03em; line-height: 1.1; }
.ag-sub { margin-top: 4px; color: var(--ink-muted); }
.ag-sub b { color: var(--agent-strong); font-weight: var(--weight-semibold); }
.ag-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.tchip-n { margin-left: 4px; font-size: 10.5px; color: var(--ink-faint); }
.tchip.is-on .tchip-n { color: var(--agent-strong); }

.ag-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--space-5); align-items: start; }
.ag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: var(--space-3); }
.ag-card { animation: rise 360ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.ag-card:nth-child(2) { animation-delay: 30ms; } .ag-card:nth-child(3) { animation-delay: 60ms; } .ag-card:nth-child(4) { animation-delay: 90ms; }
.ag-card:nth-child(5) { animation-delay: 120ms; } .ag-card:nth-child(6) { animation-delay: 150ms; } .ag-card:nth-child(n+7) { animation-delay: 180ms; }
.ag-pick {
  width: 100%; height: 100%; display: grid; gap: 6px; align-content: start; text-align: left;
  padding: var(--space-4); border: 0; border-radius: var(--radius-lg); cursor: pointer;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.ag-pick:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px var(--agent-line), 0 12px 24px -8px rgba(52, 36, 140, 0.18); }
.ag-card.is-on .ag-pick { box-shadow: inset 0 0 0 1.5px var(--agent), 0 12px 24px -8px rgba(52, 36, 140, 0.22); background: linear-gradient(180deg, var(--agent-soft), var(--surface) 70%); }
.ag-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.ag-top .av { box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px color-mix(in srgb, var(--avc) 25%, transparent); }
.ag-badge { height: 20px; padding: 0 8px; border-radius: var(--radius-pill); display: inline-grid; place-items: center; background: var(--agent); color: #fff; font-size: 10.5px; font-weight: var(--weight-semibold); }
.ag-badge.is-risk { background: var(--risk-soft); color: var(--risk); }
.ag-live { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ok); font-weight: var(--weight-medium); }
.ag-live .dot { background: var(--ok); animation: pulse 1.8s infinite var(--ease); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(24, 121, 78, 0.35); } 50% { box-shadow: 0 0 0 4px rgba(24, 121, 78, 0); } }
.ag-name { font-weight: var(--weight-semibold); font-size: var(--text-md); color: var(--ink); }
.ag-does { font-size: var(--text-xs); color: var(--ink-muted); line-height: 1.45; }
.ag-cat { margin-top: auto; padding-top: 6px; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-faint); }

.spot { position: sticky; top: 0; border-radius: var(--radius-xl); background: var(--surface); box-shadow: inset 0 0 0 1px var(--agent-line), 0 20px 40px -20px rgba(52, 36, 140, 0.25); overflow: hidden; }
.spot.is-swapping .spot-inner { animation: spot-in 320ms cubic-bezier(0.2, 0.7, 0.2, 1); }
@keyframes spot-in { from { opacity: 0; transform: translateX(10px); } to { opacity: 1; transform: none; } }
.spot-inner { display: grid; gap: var(--space-4); padding: var(--space-5); }
.spot-head { display: flex; gap: var(--space-4); align-items: flex-start; }
.spot-av { position: relative; flex: none; }
.spot-av::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 1.5px dashed var(--agent-line); animation: orbit 12s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.spot-cat { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--agent-strong); }
.spot-name { font-size: var(--text-xl); font-weight: var(--weight-semibold); letter-spacing: -0.02em; margin-top: 2px; }
.spot-does { margin-top: 4px; color: var(--ink-muted); font-size: var(--text-sm); }
.spot-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: var(--text-xs); color: var(--ink-muted); }
.spot-fact b { color: var(--ink); font-weight: var(--weight-semibold); }
.spot-stance { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--radius-pill); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.spot-stance .icon { color: var(--ok); }
.spot-work { border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.sw-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.sw-tag { margin-left: auto; color: var(--ink-faint); font-weight: var(--weight-regular); }
.sw-body { display: grid; gap: 10px; padding: 14px; background-image: radial-gradient(var(--dots) 1px, transparent 1px); background-size: 14px 14px; }
.sw-ask { justify-self: end; max-width: 90%; padding: 8px 12px; border-radius: 12px 12px 4px 12px; background: var(--agent-soft); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink); animation: rise 300ms both 120ms; }
.sw-answer { justify-self: start; max-width: 95%; padding: 10px 12px; border-radius: 12px 12px 12px 4px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--text-sm); animation: rise 300ms both 260ms; }
.sw-answer .cites { margin-top: 8px; }
.sw-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); font-size: var(--text-xs); color: var(--ink-faint); }
.spot-label { font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-faint); margin-bottom: 6px; }
.spot-reads ul { display: flex; flex-wrap: wrap; gap: 6px; }
.spot-reads li { padding: 3px 9px; border-radius: var(--radius-pill); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--text-xs); color: var(--ink-muted); }
.spot-actions { display: flex; gap: 8px; }

@media (max-width: 1100px) {
  .ag-layout { grid-template-columns: minmax(0, 1fr); }
  .spot { position: static; order: -1; }
  .quick { display: none; }
}
@media (max-width: 900px) {
  .btn-create { display: none; }
  .util-btn[aria-controls="m-help"], .util-btn[aria-controls="m-today"] { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cv > *, .kpis > li, .ag-card, .col-bar, .hbar-fill, .spot-av::after, .ag-live .dot, .sw-ask, .sw-answer { animation: none !important; }
  .workspace { transition: none; }
}

/* ====================================================== shell, round 4
   Calm header, long glowing search, sidebar control in the rail, and
   icon motion strong enough to see. Later rules here replace the earlier
   rounds above. */

/* ---- Top bar ---- */
.topbar { gap: var(--space-4); padding: 0 var(--space-3) 0 var(--space-2); }
.menu-btn { display: none; }
.brand { width: calc(var(--rail-w) + var(--sidebar-w) - var(--space-2)); padding: 0 8px; justify-content: flex-start; }
body.side-collapsed .brand { width: auto; }
.brand img { height: 22px; }
.quick, .side-toggle, .workspace-btn { display: none !important; }

.askbar {
  flex: 1 1 640px; max-width: 680px; margin: 0 auto 0 0; height: 34px;
  padding: 0 8px 0 12px; border-radius: var(--radius-pill); background: var(--surface);
  box-shadow:
    0 0 0 1px rgba(107, 78, 255, 0.22),
    0 2px 10px rgba(107, 78, 255, 0.12),
    0 0 28px rgba(17, 86, 178, 0.06);
  transition: box-shadow 300ms cubic-bezier(0.6, 0, 0.05, 0.95);
}
.askbar::before {
  content: ''; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(90deg, rgba(17, 86, 178, 0.55), rgba(107, 78, 255, 0.75), rgba(17, 86, 178, 0.55));
  background-size: 200% 100%;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: 0.55; animation: sheen 6s linear infinite;
}
@keyframes sheen { from { background-position: 0% 0; } to { background-position: 200% 0; } }
.askbar:hover { box-shadow: 0 0 0 1px rgba(107, 78, 255, 0.32), 0 4px 16px rgba(107, 78, 255, 0.18), 0 0 32px rgba(17, 86, 178, 0.08); }
.askbar:focus-within { box-shadow: 0 0 0 1.5px var(--agent), 0 0 0 5px rgba(107, 78, 255, 0.12), 0 6px 22px rgba(107, 78, 255, 0.22); }
.askbar:focus-within::before { opacity: 1; }
.ask-spark { color: var(--agent); display: grid; place-items: center; }
.askbar input { font-size: var(--text-sm); }
.askbar input::placeholder { color: var(--ink-faint); }

.top-right { gap: 4px; margin-left: auto; }
.btn-soft { background: var(--agent-soft); color: var(--agent-strong); box-shadow: inset 0 0 0 1px var(--agent-line); }
.btn-soft:hover { background: #e6e1ff; color: var(--agent-strong); box-shadow: inset 0 0 0 1px #c9c0ff; }
.btn-create { height: 32px; margin-right: 8px; padding: 0 12px; }
.util-btn { width: 34px; height: 34px; display: grid; place-items: center; text-decoration: none; }
.count-dot { top: 2px; right: 1px; }
.menu-icon { width: 28px; height: 28px; flex: none; border-radius: 7px; display: grid; place-items: center; background: var(--surface-sunk); color: var(--ink-muted); }
.menu a.is-risk .menu-icon { background: var(--risk-soft); color: var(--risk); }
.menu a .menu-icon .icon { color: inherit; }
.menu-wide { min-width: 330px; }

/* ---- Rail: tile and glyph are separate, so the glyph can move ---- */
.rail { display: flex; flex-direction: column; justify-content: space-between; }
.rail ul { gap: 2px; }
.rail a, .rail-side {
  position: relative; display: grid; justify-items: center; gap: 3px; width: 56px; padding: 6px 0;
  border: 0; background: transparent; border-radius: var(--radius-sm); cursor: pointer;
  color: var(--rail-ink); text-decoration: none; font: inherit;
}
.rail-side { margin: 0 auto 2px; }
.rail-tile { width: 36px; height: 30px; border-radius: 9px; display: grid; place-items: center; transition: background var(--dur) var(--ease), color var(--dur) var(--ease), transform 160ms var(--ease); }
.rail a .icon, .rail-side .icon { width: 18px; height: 18px; padding: 0; background: none !important; border-radius: 0; overflow: visible; }
.rail-label { font-size: 10px; font-weight: var(--weight-semibold); letter-spacing: 0.01em; }
.rail a:hover, .rail-side:hover { color: var(--rail-ink-strong); }
.rail a:hover .rail-tile, .rail-side:hover .rail-tile { background: var(--rail-hover); }
.rail a[aria-current="page"] { color: var(--rail-current-ink); }
.rail a[aria-current="page"] .rail-tile { background: var(--rail-current); color: var(--rail-current-ink); }
.rail a:active .rail-tile, .rail-side:active .rail-tile { transform: scale(0.9); }
.rail a::before { top: 10px; }
.rail a[aria-current="page"]::before { height: 22px; top: 10px; }
.rail-side .rail-label { color: var(--ink-faint); }

/* Clearly visible movements: the glyph moves inside its tile. */
.rail .icon, .rail .icon * { transform-box: fill-box; transform-origin: center; }
@keyframes rail-home { 0%, 100% { transform: translateY(0) scale(1); } 30% { transform: translateY(-5px) scale(1.08); } 55% { transform: translateY(1px) scale(0.96); } 75% { transform: translateY(-2px); } }
@keyframes rail-gavel { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-38deg); } 50% { transform: rotate(14deg); } 70% { transform: rotate(-6deg); } }
@keyframes rail-contract { 0% { transform: perspective(60px) rotateY(0); } 50% { transform: perspective(60px) rotateY(180deg); } 100% { transform: perspective(60px) rotateY(360deg); } }
@keyframes rail-cart { 0%, 100% { transform: translateX(0) rotate(0); } 25% { transform: translateX(6px) rotate(-6deg); } 50% { transform: translateX(-3px) rotate(3deg); } 75% { transform: translateX(2px); } }
@keyframes rail-receipt { 0% { transform: translateY(0); clip-path: inset(0); } 35% { transform: translateY(-7px); clip-path: inset(0 0 45% 0); } 70% { transform: translateY(2px); clip-path: inset(0); } 100% { transform: translateY(0); } }
@keyframes rail-vendors { 0%, 100% { transform: scale(1); } 35% { transform: scale(1.3) rotate(-4deg); } 65% { transform: scale(0.92) rotate(2deg); } }
@keyframes rail-slide-a { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-6px); } }
@keyframes rail-slide-b { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(6px); } }
@keyframes rail-gear { from { transform: rotate(0); } to { transform: rotate(180deg); } }
@keyframes rail-panel { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(0.75); } }
.rail a[data-mod="home"]:hover .icon, .rail a[data-mod="home"].is-arriving .icon { animation: rail-home 620ms var(--ease); }
.rail a[data-mod="solicitations"]:hover .icon, .rail a[data-mod="solicitations"].is-arriving .icon { animation: rail-gavel 700ms var(--ease); transform-origin: 75% 75%; }
.rail a[data-mod="contracts"]:hover .icon, .rail a[data-mod="contracts"].is-arriving .icon { animation: rail-contract 700ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.rail a[data-mod="procurement"]:hover .icon, .rail a[data-mod="procurement"].is-arriving .icon { animation: rail-cart 650ms var(--ease); }
.rail a[data-mod="invoices"]:hover .icon, .rail a[data-mod="invoices"].is-arriving .icon { animation: rail-receipt 700ms var(--ease); }
.rail a[data-mod="vendors"]:hover .icon, .rail a[data-mod="vendors"].is-arriving .icon { animation: rail-vendors 620ms var(--ease); }
.rail a[data-mod="business-admin"]:hover .icon circle:nth-of-type(1), .rail a[data-mod="business-admin"].is-arriving .icon circle:nth-of-type(1) { animation: rail-slide-a 700ms var(--ease); }
.rail a[data-mod="business-admin"]:hover .icon circle:nth-of-type(2), .rail a[data-mod="business-admin"].is-arriving .icon circle:nth-of-type(2) { animation: rail-slide-b 700ms var(--ease); }
.rail a[data-mod="business-admin"]:hover .icon circle:nth-of-type(3), .rail a[data-mod="business-admin"].is-arriving .icon circle:nth-of-type(3) { animation: rail-slide-a 700ms var(--ease) 90ms; }
.rail a[data-mod="admin"]:hover .icon, .rail a[data-mod="admin"].is-arriving .icon { animation: rail-gear 800ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.rail-side:hover .icon { animation: rail-panel 500ms var(--ease); }

/* ---- Sidebar ---- */
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px 8px; flex-wrap: nowrap; }
.side-title { padding-right: 0; }
.side-collapse { position: static; opacity: 1; width: 26px; height: 26px; color: var(--ink-faint); }
.side-collapse:hover { color: var(--ink); background: var(--surface-hover); }
.side-create { width: calc(100% - 8px); margin: 0 4px 8px; justify-content: flex-start; height: 30px; }
.side-head .btn { width: auto; }
body.side-collapsed .sidebar { visibility: hidden; transition: opacity 180ms var(--ease), visibility 0s linear 260ms; }
body:not(.side-collapsed) .sidebar { visibility: visible; }

/* ---- Phones ---- */
@media (max-width: 900px) {
  .menu-btn { display: grid; }
  .brand { width: auto; }
  .rail { flex-direction: row; }
  .rail-side { display: none; }
  .btn-create { padding: 0 10px; }
  body.nav-open .sidebar { visibility: visible; opacity: 1; pointer-events: auto; }
}
@media (max-width: 640px) {
  .btn-create { font-size: 0; gap: 0; width: 32px; padding: 0; justify-content: center; }
  .kbd { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .askbar::before { animation: none; }
}

/* Older Vendors pages, matched to the shared page header and agent band */
.cv > .page-head { padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); align-items: flex-end; }
.cv > .page-head .page-sub { font-size: var(--text-xs); color: var(--ink-faint); }
.agent-hero {
  background:
    radial-gradient(60% 140% at 100% 0%, rgba(107, 78, 255, 0.14), transparent 60%),
    radial-gradient(50% 120% at 0% 100%, rgba(17, 86, 178, 0.07), transparent 60%),
    var(--surface-sunk);
  border-radius: var(--radius-xl);
}
.agent-hero .av { box-shadow: 0 0 0 4px var(--surface), 0 0 0 5px var(--agent-line); }

/* ====================================================== shell, round 5
   The top bar is white; the rail, sidebar and canvas below it are as
   in round 4 (product owner, 17 November 2026). */
:root { --sheet-line: #e3e5ea; }
.topbar { background: var(--surface); box-shadow: 0 1px 0 var(--line); position: relative; z-index: 30; }
.frame { padding-top: var(--gutter); }

/* ---- The AI switch: every agent on, or the same process done by people ---- */
.ai-switch {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 10px; margin-right: 6px;
  border: 0; border-radius: var(--radius-pill); background: var(--surface); cursor: pointer;
  box-shadow: 0 0 0 1px var(--sheet-line); color: var(--ink-muted);
  font: inherit; font-size: var(--text-xs); font-weight: var(--weight-semibold); white-space: nowrap;
}
.ai-switch:hover { color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
.ai-switch .icon { color: var(--agent); }
.ai-track { position: relative; width: 30px; height: 18px; border-radius: 999px; background: var(--agent); transition: background 200ms var(--ease); }
.ai-thumb { position: absolute; top: 2px; left: 14px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: left 200ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.ai-switch[aria-checked="false"] .ai-track { background: var(--line-strong); }
.ai-switch[aria-checked="false"] .ai-thumb { left: 2px; }
.ai-switch[aria-checked="false"] .icon { color: var(--ink-faint); }
.ai-switch:focus-visible { outline: 2px solid var(--agent); outline-offset: 2px; }

/* With AI off, agent pieces leave and the manual pieces take their place. */
html[data-ai="off"] [data-ai-only] { display: none !important; }
html:not([data-ai="off"]) [data-manual-only] { display: none !important; }
html[data-ai="off"] .askbar { box-shadow: 0 0 0 1px var(--sheet-line), 0 1px 2px rgba(16, 24, 40, 0.04); }
html[data-ai="off"] .askbar::before { display: none; }
html[data-ai="off"] .ask-spark { color: var(--ink-faint); }

@media (max-width: 900px) {
  .frame { padding-top: 0; }
  .ai-label { display: none; }
}
.task-mark { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; background: var(--surface-sunk); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line); }

/* ======================================================== process (flow.js) */
.flow-panel .panel-head { flex-wrap: wrap; }
.fl-scroll { overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: thin; }
.fl-grid { display: grid; grid-template-columns: 68px repeat(var(--n), minmax(104px, 1fr)); gap: 6px; min-width: calc(68px + var(--n) * 110px); }
.fl-lane-h { display: flex; align-items: flex-start; gap: 5px; padding: 10px 4px 0 0; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-muted); }
.fl-lane-h.is-agent { color: var(--agent-strong); }
.fl-lane-h .icon { flex: none; margin-top: 1px; }
.fl-stage {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 6px;
  padding: 8px 10px; border-radius: 10px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink); text-decoration: none; transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.fl-stage:hover { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong), 0 2px 6px rgba(16, 24, 40, 0.06); }
.fl-stage + .fl-stage::before { content: ""; position: absolute; left: -7px; top: 50%; width: 8px; border-top: 1.5px solid var(--line-strong); }
.fl-n { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; font-weight: var(--weight-semibold); background: var(--surface); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line-strong); }
.fl-name { font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1.25; }
.fl-count { font-size: var(--text-sm); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.fl-stage.tone-risk .fl-count { color: var(--risk); }
.fl-stage.tone-watch .fl-count { color: var(--watch); }
.fl-cell { display: grid; align-content: start; gap: 6px; padding: 9px 10px; border-radius: 10px; font-size: var(--text-xs); line-height: 1.4; }
.fl-cell.is-agent { background: var(--agent-soft); box-shadow: inset 0 0 0 1px var(--agent-line); }
.fl-cell.is-people { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.fl-agents { display: grid; gap: 4px; }
.fl-agents a { display: flex; align-items: center; gap: 6px; color: var(--agent-strong); font-weight: var(--weight-semibold); text-decoration: none; }
.fl-agents a:hover span:last-child { text-decoration: underline; }
.fl-does { color: var(--ink-muted); margin: 0; }
.fl-none { color: var(--ink-faint); margin: 0; }
.fl-role { font-weight: var(--weight-semibold); color: var(--ink); margin: 0; }
.fl-gate { justify-self: start; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: var(--radius-pill); background: var(--rail-current); color: var(--rail-current-ink); font-size: 10.5px; font-weight: var(--weight-semibold); }
.seg-mini { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); margin-left: auto; }
.seg-mini a { padding: 3px 10px; border-radius: 6px; font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--ink-muted); text-decoration: none; }
.seg-mini a[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(16, 24, 40, 0.06); }

/* One record's stages; each stage is a link */
.stepper { display: flex; gap: 4px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: thin; }
.stepper li { flex: 1 1 0; min-width: 118px; position: relative; }
.stepper a, .st-static { display: flex; gap: 8px; align-items: flex-start; padding: 8px 8px 8px 6px; border-radius: 10px; text-decoration: none; color: var(--ink-faint); height: 100%; }
.stepper a:hover { background: var(--surface-sunk); }
.stepper .is-sel > a, .stepper .is-sel > .st-static { background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line-strong); }
.st-mark { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: var(--weight-semibold); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.st-text { display: grid; gap: 2px; min-width: 0; }
.st-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); line-height: 1.3; }
.st-who { display: flex; align-items: center; gap: 4px; font-size: 10.5px; line-height: 1.3; color: var(--ink-faint); }
.stepper .is-done .st-label { color: var(--ink-muted); }
.stepper .is-done .st-mark { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.stepper .is-current .st-label { color: var(--ink); }
.stepper .is-current .st-mark { background: var(--rail-current-ink); color: #fff; box-shadow: 0 0 0 4px var(--rail-current); }
.stepper .is-failed .st-label { color: var(--risk); }
.stepper .is-failed .st-mark { background: var(--risk); color: #fff; box-shadow: 0 0 0 4px var(--risk-soft); }

/* A stage's work: what the agents did (AI on) or the tasks (AI off) */
.stage-card { display: grid; gap: var(--space-3); padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.stage-top { display: flex; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; }
.stage-top h2 { font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
.stage-now { font-size: var(--text-sm); color: var(--ink-muted); margin-top: 2px; }
.stage-top > .chip { margin-left: auto; }
.work-cards { display: grid; gap: 8px; }
.work-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; padding: 12px; border-radius: 10px; background: var(--agent-soft); box-shadow: inset 0 0 0 1px var(--agent-line); }
.wc-name { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--agent-strong); }
.wc-text { font-size: var(--text-sm); color: var(--ink); margin: 2px 0 6px; }
.wc-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.wc-foot .cites { margin: 0 auto 0 0; }
.tasks { display: grid; gap: 2px; }
.task { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: var(--text-sm); cursor: pointer; }
.task:hover { background: var(--surface-sunk); }
.task input { width: 16px; height: 16px; accent-color: var(--rail-current-ink); flex: none; }
.task input:checked + span { color: var(--ink); }
.lane-tag { display: inline-flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-muted); }
.lane-tag.is-agent { color: var(--agent-strong); }
.decision-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.decision-bar .who { font-size: var(--text-xs); color: var(--ink-muted); margin-right: auto; }
.decision-bar .who b { color: var(--ink); font-weight: var(--weight-semibold); }
.preview-lanes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.preview-lanes .fl-cell { padding: 12px; font-size: var(--text-sm); }
html[data-ai="off"] .preview-lanes { grid-template-columns: 1fr; }
.facts { display: grid; gap: 8px; font-size: var(--text-sm); }
.facts div { display: flex; justify-content: space-between; gap: 12px; }
.facts dt { color: var(--ink-faint); }
.facts dd { text-align: right; font-weight: var(--weight-medium); }
.hist { display: grid; gap: 10px; }
.hist li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; font-size: var(--text-xs); }
.hist .h-what { color: var(--ink); }
.hist .h-when { color: var(--ink-faint); display: block; }
.hist .sys { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); color: var(--ink-muted); }
.type-tag { display: inline-grid; place-items: center; min-width: 34px; height: 20px; padding: 0 6px; border-radius: 6px; font-size: 10.5px; font-weight: var(--weight-bold); background: var(--rail-current); color: var(--rail-current-ink); margin-right: 6px; vertical-align: 1px; }
.segline { display: flex; gap: 2px; margin-top: 5px; width: 120px; }
.segline i { flex: 1; height: 4px; border-radius: 2px; background: var(--line); }
.segline i.on { background: var(--rail-current-ink); }
.segline i.risk { background: var(--risk); }
.figs { display: flex; gap: 6px; flex-wrap: wrap; }
.fig { display: grid; gap: 1px; min-width: 96px; padding: 8px 12px; border-radius: 10px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); text-decoration: none; color: var(--ink); }
.fig b { font-size: var(--text-lg); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.fig span { font-size: var(--text-xs); color: var(--ink-muted); }
.fig[aria-current="true"] { box-shadow: inset 0 0 0 1.5px var(--rail-current-ink); background: var(--rail-current); }
.fig:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.tbl td .sub2 { display: block; font-size: var(--text-xs); color: var(--ink-faint); }
.next-who { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); color: var(--ink-muted); }
.search-hits { display: grid; gap: 2px; margin: -4px -8px; }
.search-hits a { display: grid; padding: 6px 8px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.search-hits a:hover { background: var(--surface-sunk); }
.search-hits small { color: var(--ink-faint); font-size: var(--text-xs); }
.ws-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-4); align-items: start; }
.ws-rail { display: grid; gap: var(--space-3); }
.ws-rail .panel { padding: var(--space-4); }
.rail-h { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-bottom: 10px; }
.manual-card { display: grid; gap: 10px; padding: var(--space-4); border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--rail-current-ink); }
@media (max-width: 1100px) { .preview-lanes, .ws-grid { grid-template-columns: minmax(0, 1fr); } }
.fl-stage { grid-template-columns: auto minmax(0, 1fr); align-items: start; row-gap: 2px; }
.fl-stage .fl-count { grid-column: 2; font-size: var(--text-md); }
.fl-stage .fl-n { margin-top: 1px; }

/* ====================================================== shell, round 6
   No grey gaps: the white top bar, the white rail and the workspace meet
   edge to edge, divided by hairlines only (product owner, 17 November 2026). */
.frame { padding: 0; gap: 0; }
.topbar { box-shadow: 0 1px 0 var(--line); }
.rail { border-radius: 0; box-shadow: 1px 0 0 var(--line); background: var(--rail); padding-top: var(--space-2); }
.workspace { border-radius: 0; box-shadow: none; }
.sidebar { border-right: 1px solid var(--line); }
main.canvas { border-radius: 0; box-shadow: none; }

/* Page header: tighter */
.cv { padding-top: var(--space-3); gap: var(--space-3); }
.cv-head { padding-bottom: var(--space-2); align-items: center; }
.crumb { margin-bottom: 0; line-height: 1.3; }
.cv-title { line-height: 1.15; }
.cv > .back { margin-bottom: -4px; }

/* ---- Process as a chevron track ---- */
.trk { display: grid; gap: 10px; }
.trk-row { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; }
.trk-row li { display: grid; gap: 6px; min-width: 0; }
.chev {
  position: relative; display: grid; align-content: center; gap: 1px; height: 54px; width: 100%;
  padding: 0 14px 0 22px; border: 0; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
  background: var(--surface-sunk);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%, 12px 50%);
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.trk-row li:first-child .chev { padding-left: 12px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 0 100%); border-radius: 8px 0 0 8px; }
.trk-row li:last-child .chev { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 12px 50%); border-radius: 0 8px 8px 0; padding-right: 10px; }
.chev:hover { background: #eef1f5; }
.chev[aria-pressed="true"] { background: var(--rail-current); color: var(--rail-current-ink); }
.chev:focus-visible { outline: 2px solid var(--rail-current-ink); outline-offset: -2px; }
.chev-name { font-size: 11.5px; font-weight: var(--weight-semibold); line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chev-count { font-size: var(--text-md); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; line-height: 1.2; }
.chev.tone-risk .chev-count { color: var(--risk); }
.chev-who { display: flex; align-items: center; gap: 4px; min-height: 18px; padding-left: 12px; min-width: 0; }
.chev-avs { display: flex; }
.chev-avs .av + .av { margin-left: -5px; box-shadow: 0 0 0 2px var(--surface); }
.chev-role { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.chev-gate { width: 16px; height: 16px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--rail-current); color: var(--rail-current-ink); }
.trk-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 12px; border-radius: 10px; background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
html[data-ai="off"] .trk-detail { grid-template-columns: minmax(0, 1fr) auto; }
.trk-detail[hidden] { display: none; }
.td-col { display: grid; gap: 4px; align-content: start; font-size: var(--text-sm); }
.td-h { display: flex; align-items: center; gap: 5px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-muted); }
.td-col.is-agent .td-h { color: var(--agent-strong); }
.td-names { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.td-names a { display: inline-flex; align-items: center; gap: 6px; color: var(--agent-strong); font-weight: var(--weight-semibold); text-decoration: none; }
.td-names a:hover { text-decoration: underline; }
.td-text { color: var(--ink-muted); }
.td-end { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
@media (max-width: 1100px) {
  .trk-row { grid-template-columns: repeat(var(--n), minmax(96px, 1fr)); overflow-x: auto; }
  .trk-detail, html[data-ai="off"] .trk-detail { grid-template-columns: minmax(0, 1fr); }
  .td-end { flex-direction: row; align-items: center; }
}

/* ====================================================== shell, round 7
   After PublicBuyer (product owner, 17 November 2026):
   - the rail runs the full height, with the SmartDocs badge at the top
     and Help and Hide at the bottom;
   - the search stays in the middle of the header at every width;
   - a soft wash in our own colors sits behind the header and the top of
     the page. Every module keeps its sidebar. */
.app {
  display: grid; height: 100vh;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  grid-template-rows: 52px minmax(0, 1fr);
  background:
    radial-gradient(680px 240px at 22% -70px, var(--glow-1), transparent 72%),
    radial-gradient(620px 220px at 78% -60px, var(--glow-2), transparent 72%),
    var(--page);
}
.frame { display: contents; }
.rail { grid-column: 1; grid-row: 1 / span 2; justify-content: flex-start; padding: 0 0 var(--space-2); }
.topbar { grid-column: 2; grid-row: 1; background: transparent; }
.workspace { grid-column: 2; grid-row: 2; min-height: 0; }
main.canvas { background: transparent; }

.rail a.rail-badge {
  flex: none; display: grid; place-items: center; height: 52px; width: 100%; margin-bottom: 4px; text-decoration: none;
}
.rail a.rail-badge span {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--agent), var(--rail-current-ink)); color: #fff;
  font-size: 11.5px; font-weight: var(--weight-bold); letter-spacing: 0.02em;
  box-shadow: 0 2px 6px rgba(17, 86, 178, 0.25);
  transition: transform 160ms var(--ease);
}
.rail a.rail-badge:hover span { transform: scale(1.06); }
.rail-badge:focus-visible { outline: none; }
.rail-badge:focus-visible span { outline: 2px solid var(--rail-current-ink); outline-offset: 2px; }
.rail a.rail-badge::before { display: none; }
.rail-foot { margin-top: auto; display: grid; gap: 2px; justify-items: center; padding-top: var(--space-2); }
.rail-foot .rail-side { margin: 0; }
.rail-help:hover .icon { animation: none; }

.topbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 620px) minmax(0, 1fr); align-items: center; padding: 0 var(--space-3) 0 var(--space-3); }
.brand { width: auto; justify-self: start; }
body.side-collapsed .brand { width: auto; }
.askbar { justify-self: center; width: 100%; max-width: 620px; margin: 0; flex: none; }
.top-right { justify-self: end; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr); height: auto; min-height: 100vh; }
  .topbar { grid-column: 1; grid-row: 1; display: flex; padding: 8px var(--space-3); }
  .rail { grid-column: 1; grid-row: 2; padding: 4px; }
  .workspace { grid-column: 1; grid-row: 3; }
  .rail a.rail-badge, .rail-foot { display: none; }
  .rail { flex-direction: row; overflow-x: auto; overflow-y: hidden; }
  .askbar { flex: 1 1 auto; width: auto; }
}
@media (max-width: 640px) {
  .topbar { gap: 6px; padding: 8px; }
  .brand { padding: 0 2px; }
  .brand img { height: 16px; }
  .askbar { min-width: 34px; padding: 0 8px; }
  .askbar input { min-width: 0; }
  .ai-switch { padding: 0 4px; margin-right: 0; }
  .ai-switch > .icon { display: none; }
  .top-right { gap: 0; flex: none; }
  .btn-create { margin-right: 2px; }
  .util-btn { width: 30px; }
}

/* ====================================================== round 8
   For the review with Ravi (product owner, 18 November 2026). */

/* ---- One record's stages: slim chevrons, after 8.2's segmented path ---- */
.rtrack { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 2px; }
.rtrack li { min-width: 0; }
.rtrack li > a, .rt-static { display: grid; gap: 5px; min-width: 0; color: inherit; text-decoration: none; }
.rt-chev {
  position: relative; display: flex; align-items: center; gap: 6px; height: 30px; min-width: 0;
  padding: 0 14px 0 20px; background: var(--surface-sunk); color: var(--ink-faint);
  font-size: 11.5px; font-weight: var(--weight-semibold);
  clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%, 9px 50%);
  transition: background var(--dur-fast) var(--ease);
}
.rtrack li:first-child .rt-chev { padding-left: 10px; border-radius: 7px 0 0 7px; clip-path: polygon(0 0, calc(100% - 9px) 0, 100% 50%, calc(100% - 9px) 100%, 0 100%); }
.rtrack li:last-child .rt-chev { border-radius: 0 7px 7px 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 9px 50%); }
.rt-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rt-n { flex: none; font-size: 10.5px; font-variant-numeric: tabular-nums; opacity: 0.8; }
.rt-chev .icon { flex: none; }
.rt-who { display: flex; align-items: center; gap: 4px; min-width: 0; height: 16px; padding-left: 10px; font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }
.rt-who span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rtrack .is-done .rt-chev { background: var(--ok-soft); color: var(--ok); }
.rtrack .is-failed .rt-chev { background: var(--risk-soft); color: var(--risk); }
.rtrack .is-current .rt-chev {
  color: var(--rail-current-ink);
  background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.7) 50%, transparent 65%) var(--rail-current);
  background-size: 260% 100%; background-repeat: no-repeat;
  animation: rt-sheen 4.2s ease-in-out infinite;
}
.rtrack .is-current .rt-who { color: var(--ink-muted); }
@keyframes rt-sheen { 0% { background-position: 130% 0; } 55%, 100% { background-position: -30% 0; } }
.rt-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--rail-current-ink); animation: rt-dot 2.4s ease-in-out infinite; }
@keyframes rt-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.rtrack a:hover .rt-chev { filter: brightness(0.97); }
.rtrack .is-sel .rt-chev { background: #e4e8ee; color: var(--ink); }
.rtrack .is-sel .rt-label { text-decoration: underline; text-underline-offset: 3px; }
.rtrack a:focus-visible { outline: none; }
.rtrack a:focus-visible .rt-chev { box-shadow: inset 0 0 0 2px var(--rail-current-ink); }
@media (prefers-reduced-motion: reduce) { .rtrack .is-current .rt-chev, .rt-dot { animation: none; } }

/* ---- Cited checks wrap cleanly inside the proposal ---- */
.cite { height: auto; min-height: 24px; padding: 4px 10px; line-height: 1.35; white-space: normal; align-items: flex-start; font-family: var(--font-sans); font-size: var(--text-xs); border-radius: 8px; }
.cite .icon { margin-top: 2px; flex: none; }
.cite-ok { white-space: nowrap; }
.propose .cites { display: grid; gap: 4px; justify-items: start; }

/* ---- Request page: less empty space ---- */
.cv.decide { gap: var(--space-3); }
.cv.decide .rec-head { gap: var(--space-3); }
.cv.decide .rec-meta { margin-top: 2px; }
.cv.decide .rec-grid { gap: var(--space-4); grid-template-columns: minmax(0, 1fr) 380px; }
.cv.decide .rec-main, .cv.decide .rec-rail { gap: var(--space-3); }
.cv.decide .sec { padding: var(--space-4) var(--space-5); }
.cv.decide .sec-title { margin-bottom: var(--space-3); }
.cv.decide .compare th, .cv.decide .compare td { padding-top: 8px; padding-bottom: 8px; }
.cv.decide .propose-body { padding: var(--space-4); }
.cv.decide .propose-why { margin-top: 6px; }
.cv.decide .rail-card { padding: var(--space-3) var(--space-4); }
.cv.decide .rail-title { margin-bottom: var(--space-2); }
.cv.decide .transcript { gap: 8px; }

/* ---- Overview process track: lighter, with the detail pointing up ---- */
.flow-panel .panel-head { padding-bottom: 2px; }
.trk { gap: 0; padding-top: 6px; }
.trk-row { gap: 3px; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); }
.chev { height: 48px; gap: 2px; padding: 0 14px 0 22px; background: #f3f5f8; }
.chev:hover { background: #e9edf3; }
.chev-name { font-size: 11px; font-weight: var(--weight-medium); color: var(--ink-muted); -webkit-line-clamp: 1; white-space: nowrap; display: block; text-overflow: ellipsis; }
.chev-count { font-size: 17px; letter-spacing: -0.01em; }
.chev[aria-pressed="true"] { background: linear-gradient(120deg, #1156b2, #2f6fd0); color: #fff; }
.chev[aria-pressed="true"] .chev-name { color: rgba(255, 255, 255, 0.85); }
.chev[aria-pressed="true"].tone-risk .chev-count { color: #fff; }
.chev-who { padding: 6px 0 0 12px; }
.trk-detail { position: relative; margin-top: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line), 0 1px 2px rgba(16, 24, 40, 0.04); }
.trk-detail::before {
  content: ""; position: absolute; top: -6px; width: 10px; height: 10px; background: var(--surface);
  left: calc((var(--sel) + 0.5) * 100% / var(--n) - 5px);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg);
  transition: left 220ms cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---- Sideways rows: arrows and fading edges for mouse users ---- */
.hs { position: relative; flex: 1; min-width: 0; display: flex; }
.hs .agent-chips { flex: 1; scroll-behavior: smooth; }
.hs-btn {
  position: absolute; top: 50%; z-index: 2; width: 26px; height: 26px; margin-top: -13px; border: 0; border-radius: 50%;
  display: none; place-items: center; cursor: pointer; background: var(--surface); color: var(--ink);
  box-shadow: 0 0 0 1px var(--line), 0 2px 6px rgba(16, 24, 40, 0.12);
}
.hs-btn:hover { background: var(--surface-sunk); }
.hs-btn.is-prev { left: -2px; }
.hs-btn.is-next { right: -2px; }
.hs.can-prev .hs-btn.is-prev, .hs.can-next .hs-btn.is-next { display: grid; }
.hs.can-prev .agent-chips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 40px); mask-image: linear-gradient(90deg, transparent 0, #000 40px); }
.hs.can-next .agent-chips { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent 100%); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent 100%); }
.hs.can-prev.can-next .agent-chips { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 40px, #000 calc(100% - 48px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 40px, #000 calc(100% - 48px), transparent 100%); }

@media (max-width: 1100px) {
  .rtrack { grid-template-columns: repeat(var(--n), minmax(112px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
  .trk-row { grid-template-columns: repeat(var(--n), minmax(104px, 1fr)); overflow-x: auto; }
  .cv.decide .rec-grid { grid-template-columns: minmax(0, 1fr); }
}
.rt-chev { height: 34px; font-size: 11px; }
.rt-label { white-space: normal; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.chev { height: 52px; padding: 0 12px 0 20px; }
.trk-row li:first-child .chev { padding-left: 12px; }
.chev-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.15; }
.chev-count { font-size: 16px; }

/* ---- Request page: balanced columns (18 November 2026) ---- */
.back-inline { margin: 0; width: 30px; height: 30px; justify-content: center; border-radius: 8px; flex: none; color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line); }
.back-inline:hover { background: var(--surface-sunk); }
.cv.decide .rec-head { gap: 10px; }
.form-card { padding-top: 4px; padding-bottom: 4px; }
.form-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.form-row:first-child { border-top: 0; }
.fr-title { display: flex; align-items: flex-start; gap: 8px; font-size: var(--text-sm); font-weight: var(--weight-semibold); padding-top: 1px; }
.fr-title > span:last-child { display: grid; gap: 6px; }
.fr-title .sec-bad { margin-left: 0; }
.form-row .fgrid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.cv.decide .f-val { padding: 7px 10px; overflow-wrap: anywhere; }
.checks-card .checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 28px; }
.checks-card .checks li:nth-child(2) { border-top: 0; }
.cv.decide .rec-rail { top: 12px; }
@media (max-width: 1100px) {
  .form-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .checks-card .checks { grid-template-columns: minmax(0, 1fr); }
  .checks-card .checks li:nth-child(2) { border-top: 1px solid var(--line); }
}
.form-row { grid-template-columns: 128px minmax(0, 1fr); }
.form-row .fgrid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); }

/* ---- Request page: checks on the right, information in the middle ---- */
.form-row .fgrid { grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); }
.facts-card .facts { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.facts-card .facts div { display: grid; gap: 2px; justify-content: start; }
.facts-card .facts dt { font-size: var(--text-xs); }
.facts-card .facts dd { text-align: left; }
.rec-rail .checks li { padding: 7px 0; gap: 10px; }
.rec-rail .chk-pass .chk-note { display: none; }
.rec-rail .chk-name { font-size: 13px; }
@media (max-width: 1100px) { .facts-card .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ====================================================== wizard (core/wizard.js) */
.wiz { padding-bottom: 0; }
.wiz-grid { display: grid; grid-template-columns: 200px minmax(0, 1fr) 320px; gap: var(--space-4); align-items: start; }
.wiz-grid.no-assist { grid-template-columns: 200px minmax(0, 1fr); }
.wiz-steps { display: grid; gap: 2px; position: sticky; top: 12px; }
.wiz-steps li > a, .wiz-steps li > span { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--ink-faint); font-size: var(--text-sm); text-decoration: none; }
.wiz-steps li > a:hover { background: var(--surface-sunk); color: var(--ink); }
.ws-mark { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: var(--weight-semibold); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.wiz-steps .is-done > a { color: var(--ink-muted); }
.wiz-steps .is-done .ws-mark { background: var(--ok-soft); color: var(--ok); box-shadow: none; }
.wiz-steps .is-current > span { background: var(--rail-current); color: var(--rail-current-ink); font-weight: var(--weight-semibold); }
.wiz-steps .is-current .ws-mark { background: var(--rail-current-ink); color: #fff; box-shadow: none; }
.wiz-body { display: grid; gap: var(--space-3); padding: var(--space-5); border-radius: var(--radius-lg); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.wz-title { font-size: var(--text-lg); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
.wz-sub { font-size: var(--text-sm); color: var(--ink-muted); margin-top: -6px; }
.wz-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.wz-field { display: grid; gap: 5px; align-content: start; min-width: 0; }
.wz-field.is-full { grid-column: 1 / -1; }
.wz-field .field-label { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--ink-muted); }
.wz-field .req { color: var(--risk); margin-left: -3px; }
.wz-field input:not([type="radio"]):not([type="checkbox"]), .wz-field select, .wz-field textarea {
  width: 100%; min-height: 34px; padding: 7px 10px; border: 0; border-radius: 8px; font: inherit; font-size: var(--text-sm); color: var(--ink);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
}
.wz-field textarea { resize: vertical; line-height: 1.45; }
.wz-field input:focus, .wz-field select:focus, .wz-field textarea:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--rail-current-ink), 0 0 0 3px var(--rail-current); }
.wz-field [aria-invalid="true"] { box-shadow: inset 0 0 0 1.5px var(--risk) !important; }
.wz-hint { font-size: var(--text-xs); color: var(--ink-faint); }
.wz-from { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; background: var(--agent-soft); color: var(--agent-strong); font-size: 10.5px; font-weight: var(--weight-semibold); }
.wz-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.wz-card { position: relative; display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; cursor: pointer; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.wz-card input { position: absolute; opacity: 0; pointer-events: none; }
.wz-card-t { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.wz-card-s { font-size: var(--text-xs); color: var(--ink-muted); }
.wz-card:has(input:checked) { background: var(--rail-current); box-shadow: inset 0 0 0 1.5px var(--rail-current-ink); }
.wz-card:has(input:focus-visible) { outline: 2px solid var(--rail-current-ink); outline-offset: 2px; }
.wz-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; }
.wz-error { color: var(--risk); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.wiz-assist { display: grid; gap: 8px; position: sticky; top: 12px; }
.wiz-assist .lane-tag { margin-bottom: 2px; }
.wz-help .btn { margin-top: 6px; }
.wz-help .cites { margin: 0 0 2px; }
.wiz-foot {
  position: sticky; bottom: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: var(--space-2) calc(var(--space-6) * -1) 0; padding: 12px var(--space-6);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 -1px 0 var(--line);
}
.wiz-count { font-size: var(--text-xs); color: var(--ink-faint); }
.wz-meter { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--surface-sunk); }
.wz-meter span { flex: 1; display: grid; place-items: center; }
.wz-method { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.wz-method div { padding: 10px 12px; border-radius: 10px; font-size: var(--text-xs); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line); }
.wz-method div b { display: block; font-size: var(--text-sm); color: var(--ink); }
.wz-method .is-on { background: var(--rail-current); box-shadow: inset 0 0 0 1.5px var(--rail-current-ink); color: var(--rail-current-ink); }
.wz-review { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 24px; font-size: var(--text-sm); }
.wz-review div { display: grid; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.wz-review dt { font-size: var(--text-xs); color: var(--ink-faint); }
.wz-review dd { font-weight: var(--weight-medium); }
.wz-review .is-full { grid-column: 1 / -1; }
.start-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.start-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 16px; border-radius: 12px; text-align: left; cursor: pointer; border: 0; font: inherit; color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); }
.start-card:hover { box-shadow: inset 0 0 0 1.5px var(--rail-current-ink); background: var(--surface-sunk); }
.start-card .sc-ico { grid-row: span 2; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--rail-current); color: var(--rail-current-ink); }
.start-card.is-agent .sc-ico { background: var(--agent-soft); color: var(--agent-strong); }
.start-card b { font-size: var(--text-md); }
.start-card span { font-size: var(--text-sm); color: var(--ink-muted); }
@media (max-width: 1240px) { .wiz-grid { grid-template-columns: 180px minmax(0, 1fr); } .wiz-assist { grid-column: 2; position: static; } }
@media (max-width: 900px) {
  .wiz-grid, .wiz-grid.no-assist { grid-template-columns: minmax(0, 1fr); }
  .wiz-steps { display: flex; overflow-x: auto; position: static; }
  .wiz-steps .ws-label { white-space: nowrap; }
  .wiz-assist { grid-column: auto; }
  .wz-form, .wz-review, .start-grid, .wz-checks { grid-template-columns: minmax(0, 1fr); }
  .wiz-foot { margin: 0 calc(var(--space-3) * -1); padding: 12px var(--space-3); }
}
main.no-anim .cv > *, main.no-anim .cv * { animation: none !important; }
main.no-anim .rtrack .is-current .rt-chev { animation: rt-sheen 4.2s ease-in-out infinite !important; }
main.no-anim .rt-dot { animation: rt-dot 2.4s ease-in-out infinite !important; }
.panel.pad { padding: 14px 16px; }
.panel > .checks { padding: 2px 16px 8px; }
.panel.pad > .checks { padding: 0; }
.wz-drops { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.wz-drop { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 14px; border-radius: 10px; cursor: pointer; background: var(--surface-sunk); box-shadow: inset 0 0 0 1.5px var(--line-strong); transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.wz-drop { background-image: none; outline: 1.5px dashed transparent; }
.wz-drop:not(.has-file) { box-shadow: none; outline: 1.5px dashed var(--line-strong); outline-offset: -1.5px; }
.wz-drop:hover, .wz-drop:focus-within { background: var(--rail-current); outline-color: var(--rail-current-ink); }
.wz-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.wz-drop .wd-ico { grid-row: span 2; width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); color: var(--ink-muted); box-shadow: inset 0 0 0 1px var(--line); }
.wd-t { font-size: var(--text-sm); font-weight: var(--weight-semibold); }
.wd-t .req { color: var(--risk); margin-left: 2px; }
.wd-s { font-size: var(--text-xs); color: var(--ink-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wz-drop.has-file { background: var(--ok-soft); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ok) 45%, transparent); }
.wz-drop.has-file .wd-ico { background: var(--ok); color: #fff; box-shadow: none; }
.wz-drop.has-file .wd-s { color: var(--ok); font-weight: var(--weight-medium); }
.wz-attached { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: var(--text-sm); background: var(--surface-sunk); box-shadow: inset 0 0 0 1px var(--line); }
.wz-attached .icon { color: var(--ok); }
.wz-attached.is-missing .icon { color: var(--risk); }
.demo-btn { border: 1px dashed var(--line-strong); }
.demo-tag { margin-left: 6px; padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 600; background: var(--surface-sunk); color: var(--ink-faint); box-shadow: inset 0 0 0 1px var(--line); }

/* ---- Search and pick (core/wizard.js) ---- */
.wz-combo { position: relative; display: grid; gap: 8px; }
.wz-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.wz-chips:empty { display: none; }
.wz-chip { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 3px 4px 3px 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: var(--weight-medium); background: var(--rail-current); color: var(--rail-current-ink); }
.wz-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wz-chip button { width: 20px; height: 20px; flex: none; border: 0; border-radius: 50%; display: grid; place-items: center; background: transparent; color: inherit; cursor: pointer; }
.wz-chip button:hover { background: rgba(17, 86, 178, 0.14); }
.wz-chip button:focus-visible { outline: 2px solid var(--rail-current-ink); outline-offset: 1px; }
.wz-combo-box { position: relative; display: flex; align-items: center; }
.wz-combo-box .icon { position: absolute; left: 10px; color: var(--ink-faint); pointer-events: none; }
.wz-field .wz-combo-box input { padding-left: 32px; }
.wz-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 20; margin-top: 4px; max-height: 264px; overflow-y: auto; padding: 4px; border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-pop); }
.wz-list [role="option"] { padding: 8px 10px; border-radius: 7px; font-size: var(--text-sm); cursor: pointer; }
.wz-list [role="option"]:hover, .wz-list .is-active { background: var(--rail-current); color: var(--rail-current-ink); }
.wz-none { padding: 8px 10px; font-size: var(--text-sm); color: var(--ink-faint); }
