/* ============================================================
   MODARA — Workspace app shell
   Builds on tokens.css + flow.css (shared atoms reused).
   A persistent, role-adaptive application — not a funnel.
   ============================================================ */

/* Every Icon component has the `ic` class. Keep an unconstrained SVG from
   falling back to the browser's 300x150 replaced-element size when a new
   surface has not yet supplied a more specific icon rule. Component-level
   selectors below intentionally override this baseline. */
.ic { width: 1em; height: 1em; display: block; flex: none; }

/* ---------- app frame ---------- */
.app { display: flex; flex-direction: column; height: 100%; min-height: 0; }

.app-tbar {
  height: 46px; flex: none;
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; padding: 0 var(--sp-4);
  background: var(--titlebar); border-bottom: 1px solid var(--border-soft);
  user-select: none;
}
.app-tbar .left { display: flex; align-items: center; gap: var(--sp-4); }
.app-tbar .brand { display: flex; align-items: center; gap: var(--sp-3); justify-self: center; }
.app-tbar .brand .mark { width: 6px; height: 6px; border-radius: 999px; background: var(--plum); flex: none; align-self: center; }
.app-tbar .brand .word { font-family: var(--font-display); font-weight: 500; font-size: 14px; letter-spacing: -0.01em; color: var(--heading); }
.app-tbar .right { justify-self: end; display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }

/* account / role chip */
.acct {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 4px 6px 4px 4px; border-radius: var(--r-pill);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.acct:hover { border-color: var(--border-strong); background: var(--surface-2); }
.acct .av { width: 26px; height: 26px; border-radius: 999px; background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 12px; flex: none; }
.acct .at { display: flex; flex-direction: column; line-height: 1.15; padding-right: 4px; }
.acct .an { font-size: 12.5px; font-weight: 600; color: var(--heading); white-space: nowrap; }
.acct .ar { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); white-space: nowrap; }

.role-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11.5px; font-weight: 500; color: var(--plum-700);
  padding: 5px 11px; border-radius: var(--r-pill);
  background: var(--plum-50); border: 1px solid var(--plum-200);
}
.role-pill .ic { width: 13px; height: 13px; }

.iconbtn { width: 30px; height: 30px; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; position: relative; }
.iconbtn:hover { background: var(--surface-2); color: var(--heading); }
.iconbtn .ic { width: 17px; height: 17px; }
.iconbtn .ndot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 999px; background: var(--alert); border: 1.5px solid var(--titlebar); }

/* ---------- body: nav + main ---------- */
.app-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 220px 1fr; }
.app-body[data-nav="compact"] { grid-template-columns: 64px 1fr; }

.nav {
  border-right: 1px solid var(--border-soft); background: var(--surface);
  display: flex; flex-direction: column; padding: var(--sp-5) var(--sp-4); gap: 2px; min-height: 0;
}
.nav-sec { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: var(--sp-5) var(--sp-3) var(--sp-2); }
.nav-item {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 9px var(--sp-4); border-radius: var(--r-md);
  font-size: 13.5px; font-weight: 500; color: var(--muted);
  background: none; border: none; cursor: pointer; text-align: left; width: 100%;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.nav-item:hover { background: var(--surface-2); color: var(--heading); }
.nav-item[data-on="1"] { background: var(--plum-50); color: var(--plum-700); }
.nav-item .ic { width: 18px; height: 18px; flex: none; }
.nav-item[data-on="1"] .ic { color: var(--plum); }
.nav-item .nlabel { flex: 1; }
.nav-item .ncount { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.nav-item .ndot { width: 7px; height: 7px; border-radius: 999px; flex: none; }
.app-body[data-nav="compact"] .nlabel, .app-body[data-nav="compact"] .ncount, .app-body[data-nav="compact"] .nav-sec { display: none; }
.app-body[data-nav="compact"] .nav-item { justify-content: center; padding: 9px; }

.nav-spacer { flex: 1; }
.nav-foot { border-top: 1px solid var(--border-soft); padding-top: var(--sp-4); margin-top: var(--sp-4); display: flex; flex-direction: column; gap: 2px; }

/* effort + credits (shown for analyst/scientist) */
.effort { padding: var(--sp-4) var(--sp-3); }
.effort .e-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.effort .e-lab { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.effort .e-val { font-size: 11.5px; font-weight: 600; color: var(--plum-700); }
.effort-track { display: flex; gap: 3px; }
.effort-seg { flex: 1; height: 5px; border-radius: 999px; background: var(--surface-3); cursor: pointer; transition: background var(--dur-fast) var(--ease); }
.effort-seg[data-on="1"] { background: var(--plum); }
.credits { display: flex; align-items: center; gap: 7px; padding: var(--sp-4) var(--sp-3) 0; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.credits .ic { width: 13px; height: 13px; color: var(--faint); flex: none; }
.credits .cbar { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.credits .cbar i { display: block; height: 100%; background: var(--plum-300); }
.credits .cpct { flex: none; min-width: 2.6em; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- main column ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; position: relative; container-type: inline-size; }
.crumbbar { flex: none; height: 44px; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: 0 var(--sp-7); border-bottom: 1px solid var(--border-soft); background: var(--paper); }
.crumb { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; color: var(--muted); }
.crumb .sep { color: var(--border-strong); }
.crumb b { color: var(--heading); font-weight: 600; }
.crumb-actions { display: flex; align-items: center; gap: var(--sp-3); }

.main-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; position: relative; }
.main-scroll::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--border-soft) 1px, transparent 1.4px); background-size: 30px 30px; opacity: 0.45; pointer-events: none; }
.view-pad { position: relative; padding: var(--sp-8) var(--sp-9) var(--sp-12); max-width: 1180px; margin: 0 auto; }

/* ---------- workspace canvas (spatial home) ---------- */
.ws-head2 { margin-bottom: var(--sp-7); }
.ws-head2 .title { font-family: var(--font-display); font-weight: 500; font-size: clamp(22px, 2.8vw, 30px); letter-spacing: -0.018em; color: var(--ink); margin: var(--sp-3) 0 0; text-wrap: balance; }
.ws-head2 .sub2 { font-size: var(--fs-body); color: var(--muted); line-height: var(--lh-snug); margin: var(--sp-4) 0 0; max-width: 46em; }
.ws-hd-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; margin-top: var(--sp-3); }
.ws-hd-row .title { margin: 0; }

.data-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.03em;
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.data-pill .dp-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.data-pill .dp-spin { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid currentColor; border-right-color: transparent; animation: dp-spin 0.9s linear infinite; }
.data-pill.pending, .data-pill.deriving { background: var(--plum-50); border-color: var(--plum-200); color: var(--plum-700); }
.data-pill.ok { background: var(--ok-surface); border-color: var(--ok-border); color: var(--ok-text); }
.data-pill.ok .dp-spin, .data-pill.ok .dp-dot { background: currentColor; }
.data-pill.warn { background: var(--warn-surface); border-color: var(--warn-border); color: var(--warn-text); }
.data-pill.empty { background: var(--surface); border-color: var(--border); color: var(--faint); }
@keyframes dp-spin { to { transform: rotate(360deg); } }

/* proactive-colleague alert banner */
.alert-banner {
  display: flex; align-items: flex-start; gap: var(--sp-5);
  padding: var(--sp-5) var(--sp-6); border-radius: var(--r-lg);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-xs);
  margin-bottom: var(--sp-7);
}
.alert-banner.warn { border-color: var(--warn-border); background: var(--warn-surface); }
.alert-banner.info { border-color: var(--info-border); background: var(--info-surface); }
.alert-banner .ab-ico { width: 36px; height: 36px; border-radius: var(--r-md); flex: none; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-soft); }
.alert-banner.warn .ab-ico { color: var(--warn-text); border-color: var(--warn-border); }
.alert-banner.info .ab-ico { color: var(--info-text); border-color: var(--info-border); }
.alert-banner .ab-ico .ic { width: 19px; height: 19px; }
.alert-banner .ab-body { flex: 1; min-width: 0; }
.alert-banner .ab-kicker { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.alert-banner .ab-title { font-size: var(--fs-body-lg); font-weight: 600; color: var(--heading); }
.alert-banner .ab-text { font-size: var(--fs-small); color: var(--muted); line-height: var(--lh-snug); margin-top: 3px; max-width: 60em; }
.alert-banner .ab-act { flex: none; align-self: center; }

/* lanes */
.lanes { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); align-items: start; }
.lane { min-width: 0; }
.lane-head { display: flex; align-items: baseline; gap: var(--sp-3); padding: 0 2px var(--sp-4); border-bottom: 1px solid var(--border-soft); margin-bottom: var(--sp-5); }
.lane-head .ln { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--heading); }
.lane-head .lh { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }
.lane-col { display: flex; flex-direction: column; gap: var(--sp-4); min-height: 60px; }
.lane-empty { border: 1.5px dashed var(--border); border-radius: var(--r-md); padding: var(--sp-5); font-size: var(--fs-small); color: var(--faint); text-align: center; background: var(--surface-2); }

/* object card */
.obj {
  text-align: left; font: inherit; cursor: pointer; width: 100%;
  display: flex; flex-direction: column; gap: var(--sp-4);
  padding: var(--sp-5); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--border-soft); box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  animation: obj-in 0.5s var(--ease-out) both;
}
@keyframes obj-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.obj:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.obj .o-top { display: flex; align-items: flex-start; gap: var(--sp-3); }
.obj .o-ico { width: 32px; height: 32px; border-radius: var(--r-md); flex: none; display: grid; place-items: center; background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); }
.obj .o-ico .ic { width: 17px; height: 17px; }
.obj .o-title { font-family: var(--font-display); font-weight: 500; font-size: 14.5px; letter-spacing: -0.005em; color: var(--ink); line-height: 1.25; flex: 1; }
.obj.mono .o-title { font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; letter-spacing: 0; }
.obj .o-metric { display: flex; align-items: baseline; gap: var(--sp-3); }
.obj .o-num { font-family: var(--font-display); font-size: 23px; font-weight: 500; color: var(--ink); line-height: 1; }
.obj.mono .o-num { font-family: var(--font-mono); font-size: 18px; }
.obj .o-mlab { font-size: var(--fs-small); color: var(--muted); }
.obj .o-sub { font-size: 11.5px; color: var(--muted); line-height: var(--lh-snug); }
.obj.mono .o-sub { font-family: var(--font-mono); font-size: 10px; }
.obj .o-foot { display: flex; align-items: center; gap: var(--sp-3); }

/* status dots & pills */
.st { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 500; padding: 3px 9px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted); }
.st .d { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.st.live { color: var(--ok-text); background: var(--ok-surface); border-color: var(--ok-border); }
.st.live .d { background: var(--ok); animation: pulse 1.8s var(--ease) infinite; }
.st.building, .st.training, .st.running { color: var(--plum-700); background: var(--plum-50); border-color: var(--plum-200); }
.st.building .d, .st.training .d, .st.running .d { background: var(--plum); animation: pulse-plum 1.4s var(--ease) infinite; }
.st.drifting { color: var(--warn-text); background: var(--warn-surface); border-color: var(--warn-border); }
.st.drifting .d { background: var(--warn); }
.st.paused { color: var(--warn-text); background: var(--warn-surface); border-color: var(--warn-border); }
.st.paused .d { background: var(--warn); }
.st.error, .st.failed, .st.blocked { color: var(--alert-text); background: var(--alert-surface); border-color: var(--alert-border); }
.st.error .d, .st.failed .d, .st.blocked .d { background: var(--alert); }
.st.draft, .st.bound, .st.connected, .st.champion, .st.baseline { color: var(--muted); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 var(--ok-surface); } 70% { box-shadow: 0 0 0 5px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes pulse-plum { 0% { box-shadow: 0 0 0 0 var(--plum-100); } 70% { box-shadow: 0 0 0 5px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* empty / conversational home (maturity = new) */
.ws-empty { display: grid; place-items: center; min-height: min(60vh, 460px); }
.ws-empty-inner { width: min(620px, 100%); text-align: left; }
.ws-empty-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.02em; color: var(--ink); line-height: 1.08; margin: var(--sp-4) 0 0; text-wrap: balance; }
.ws-empty-sub { font-size: var(--fs-body-lg); color: var(--muted); line-height: var(--lh-body); margin: var(--sp-5) 0 0; max-width: 34em; }
.ws-empty-acts { display: flex; gap: var(--sp-4); margin-top: var(--sp-7); flex-wrap: wrap; }

/* dock (the tool you act through) — persistent */
.dock2 { flex: none; padding: var(--sp-5) var(--sp-7) var(--sp-6); border-top: 1px solid var(--border-soft); background: var(--paper); }
.dock2-bar { display: flex; align-items: center; gap: var(--sp-4); padding: 7px 7px 7px var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-sm); max-width: 920px; margin: 0 auto; transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.dock2-bar:focus-within { border-color: var(--plum-300); box-shadow: var(--ring), var(--shadow-sm); }
.dock2-bar .sp { color: var(--plum); flex: none; }
.dock2-bar input { flex: 1; border: none; background: transparent; outline: none; font: inherit; font-size: var(--fs-body); color: var(--heading); }
.dock2-bar.mono input { font-family: var(--font-mono); font-size: 12.5px; }
.dock2-bar input::placeholder { color: var(--faint); }
.dock2-bar .send { flex: none; width: 36px; height: 36px; border-radius: var(--r-md); background: var(--plum); color: var(--plum-on); border: none; cursor: pointer; display: grid; place-items: center; }
.dock2-bar .send:hover { background: var(--plum-600); }
.dock2-chips { display: flex; gap: var(--sp-3); justify-content: center; margin-top: var(--sp-4); flex-wrap: wrap; }
.dchip { font-size: 11.5px; color: var(--muted); padding: 5px 12px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface); cursor: pointer; }
.dchip.mono { font-family: var(--font-mono); font-size: 10.5px; }
.dchip:hover { border-color: var(--plum-200); color: var(--plum-700); background: var(--plum-50); }

/* ---------- LAB (data scientist signature) ---------- */
.lab-grid { display: grid; grid-template-columns: 1fr 280px; gap: var(--sp-7); align-items: start; }
.board { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs); }
.board-head { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-soft); }
.board-head h4 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--heading); }
.run { display: grid; grid-template-columns: 28px 1fr auto auto; gap: var(--sp-5); align-items: center; padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-soft); }
.run:last-child { border-bottom: none; }
.run.best { background: var(--plum-50); }
.run .rk { font-family: var(--font-mono); font-size: 12px; color: var(--faint); }
.run .rname { font-family: var(--font-mono); font-size: 12.5px; color: var(--heading); font-weight: 500; }
.run .rnote { font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.run .rauc { font-family: var(--font-mono); font-size: 15px; color: var(--ink); }
.run .rdelta { font-family: var(--font-mono); font-size: 11px; }
.run .rdelta.pos { color: var(--ok-text); } .run .rdelta.neg { color: var(--muted); }
.lab-side { display: flex; flex-direction: column; gap: var(--sp-5); }
.queue-item { display: flex; align-items: center; gap: var(--sp-3); font-family: var(--font-mono); font-size: 11.5px; color: var(--heading); padding: var(--sp-4) 0; border-bottom: 1px solid var(--border-soft); }
.queue-item .qd { width: 7px; height: 7px; border-radius: 999px; background: var(--plum-300); flex: none; }

/* ---------- REPORTS (analyst signature) ---------- */
.rep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: var(--sp-6); }
.rep { display: flex; flex-direction: column; gap: var(--sp-4); padding: var(--sp-6); background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.rep .r-top { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); }
.rep .r-ic { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.rep .r-title { font-family: var(--font-display); font-weight: 500; font-size: 16px; letter-spacing: -0.01em; color: var(--ink); line-height: 1.2; }
.rep .r-when { font-family: var(--font-mono); font-size: 10px; color: var(--faint); margin-top: 4px; }
.rep .r-lines { display: flex; flex-direction: column; gap: var(--sp-3); }
.rep .r-line { display: flex; gap: var(--sp-3); font-size: 12.5px; color: var(--text); line-height: var(--lh-snug); }
.rep .r-line .bullet { color: var(--plum); flex: none; }
.rep .r-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border-soft); padding-top: var(--sp-4); margin-top: auto; }
.rep .r-charts { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

/* ---------- WATCHING (SMB signature) ---------- */
.watch-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.watch { display: flex; align-items: center; gap: var(--sp-5); padding: var(--sp-6); background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.watch .w-state { width: 40px; height: 40px; border-radius: var(--r-md); display: grid; place-items: center; flex: none; }
.watch .w-state.ok { background: var(--ok-surface); color: var(--ok-text); }
.watch .w-state.alert { background: var(--alert-surface); color: var(--alert-text); }
.watch .w-body { flex: 1; min-width: 0; }
.watch .w-title { font-size: var(--fs-body-lg); font-weight: 600; color: var(--heading); }
.watch .w-note { font-size: var(--fs-small); color: var(--muted); margin-top: 3px; }
.watch .w-cadence { font-family: var(--font-mono); font-size: 10px; color: var(--faint); flex: none; }
.autonomy { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5) var(--sp-6); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-lg); margin-bottom: var(--sp-6); }
.autonomy .a-lab { font-size: var(--fs-small); color: var(--muted); }
.seg3 { display: flex; padding: 3px; background: var(--surface-3); border-radius: var(--r-md); gap: 2px; }
.seg3 button { font: inherit; font-size: 12px; font-weight: 500; padding: 5px 12px; border: none; border-radius: var(--r-sm); background: transparent; color: var(--muted); cursor: pointer; }
.seg3 button[data-on="1"] { background: var(--surface); color: var(--plum-700); box-shadow: var(--shadow-xs); }

/* ---------- ONBOARDING / PROFILING ---------- */
.onb { height: 100%; overflow-y: auto; padding: clamp(24px, 5vh, 60px) var(--sp-8); position: relative; }
.onb-inner { width: min(760px, 100%); margin: 0 auto; }
.onb .eyebrow { margin-bottom: var(--sp-4); }
.onb-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(26px, 3.6vw, 38px); letter-spacing: -0.02em; color: var(--ink); line-height: 1.1; margin: 0; text-wrap: balance; }
.onb-sub { font-size: var(--fs-body-lg); color: var(--muted); line-height: var(--lh-body); margin: var(--sp-5) 0 0; max-width: 34em; }
.persona-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); margin-top: var(--sp-8); }
.persona {
  text-align: left; font: inherit; cursor: pointer;
  display: flex; flex-direction: column; gap: var(--sp-3);
  padding: var(--sp-6); border-radius: var(--r-lg);
  border: 1.5px solid var(--border); background: var(--surface);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.persona:hover { border-color: var(--plum-300); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.persona[data-sel="1"] { border-color: var(--plum); box-shadow: var(--ring); }
.persona .p-ic { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; }
.persona .p-label { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--ink); letter-spacing: -0.01em; }
.persona .p-blurb { font-size: 12px; color: var(--muted); line-height: var(--lh-snug); }
.onb-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); margin-top: var(--sp-8); }
.onb-note { font-size: var(--fs-small); color: var(--muted); display: flex; align-items: center; gap: 7px; }
.onb-note .ic { width: 15px; height: 15px; color: var(--faint); }

/* ---------- SETTINGS ---------- */
.set-wrap { max-width: 720px; }
.set-block { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); padding: var(--sp-6) var(--sp-7); margin-bottom: var(--sp-6); }
.set-block h4 { margin: 0 0 var(--sp-2); font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--heading); }
.set-block .desc { font-size: var(--fs-small); color: var(--muted); margin: 0 0 var(--sp-5); line-height: var(--lh-snug); }
.set-roles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-3); }
.set-role { font: inherit; text-align: left; cursor: pointer; padding: var(--sp-4) var(--sp-5); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; font-weight: 500; color: var(--heading); }
.set-role:hover { border-color: var(--border-strong); }
.set-role[data-on="1"] { border-color: var(--plum); background: var(--plum-50); color: var(--plum-700); }
.set-role .ic { width: 16px; height: 16px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-4) 0; border-bottom: 1px solid var(--border-soft); }
.set-row:last-child { border-bottom: none; }
.set-row .sr-t { font-size: 13.5px; font-weight: 500; color: var(--heading); }
.set-row .sr-d { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* ---------- SETTINGS · AI engine ---------- */
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.tier { border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: var(--sp-5); background: var(--surface-2); display: flex; flex-direction: column; gap: var(--sp-4); }
.tier-head { display: flex; gap: var(--sp-3); align-items: flex-start; }
.tier-ic { width: 32px; height: 32px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; }
.tier-ic .ic { width: 17px; height: 17px; }
.tier-ic.fast { background: var(--warn-surface); color: var(--warn-text); }
.tier-ic.reason { background: var(--plum-50); color: var(--plum); border: 1px solid var(--plum-200); }
.tier-name { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.tier-desc { font-size: 11.5px; color: var(--muted); line-height: var(--lh-snug); margin-top: 3px; }
.tier-pick { position: relative; margin-top: auto; }
.tier-btn { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); width: 100%; font: inherit; font-size: 12.5px; color: var(--heading); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 9px var(--sp-4); cursor: pointer; }
.tier-btn:hover { border-color: var(--border-strong); }
.tier-cur { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tier-menu { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 51; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in 0.16s var(--ease-out); max-height: 320px; overflow-y: auto; }
.tier-grp + .tier-grp { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--border-soft); }
.tier-grp-lbl { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); padding: var(--sp-2) var(--sp-3); }
.tier-opt { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 7px var(--sp-3); border-radius: var(--r-sm); border: none; background: none; cursor: pointer; text-align: left; font: inherit; }
.tier-opt:hover { background: var(--surface-2); }
.tier-opt[data-on="1"] { background: var(--plum-50); }
.to-name { flex: 1; font-size: 12.5px; color: var(--heading); }
.to-tier { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.03em; text-transform: uppercase; padding: 2px 6px; border-radius: var(--r-xs); flex: none; }
.to-tier.fast { color: var(--warn-text); background: var(--warn-surface); }
.to-tier.reasoning { color: var(--plum-700); background: var(--plum-50); }
.tier-empty { font-size: 12px; color: var(--muted); padding: var(--sp-3); }
.to-think { font-family: var(--font-mono); font-size: 8.5px; color: var(--plum-700); flex: none; }
.to-think.unsure { color: var(--faint); font-style: italic; }
.tier-custom { padding: 4px var(--sp-3) 2px; }
.tier-custom-in { width: 100%; padding: 6px 8px; font: inherit; font-size: 11.5px; color: var(--heading); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-sm); outline: none; }
.tier-custom-in:focus { border-color: var(--plum); background: var(--surface); }
.tier-custom-in::placeholder { color: var(--faint); font-size: 11px; }

/* per-tier params */
.tier-params { display: flex; flex-direction: column; gap: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border-soft); }
.tp-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); }
.tp-lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.tp-sub { opacity: 0.6; text-transform: none; }
.tp-na { font-size: 11px; color: var(--faint); font-style: italic; }
.tp-sub-hint { font-family: var(--font-mono); font-size: 8.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.04em; cursor: help; }
.seg3.sm { padding: 2px; }
.seg3.sm button { padding: 3px 9px; font-size: 11px; }
.tp-slider { display: flex; align-items: center; gap: var(--sp-3); }
.tp-slider input[type="range"] { width: 96px; accent-color: var(--plum); }
.tp-val { font-size: 11px; color: var(--heading); min-width: 22px; text-align: right; }

.tier-foot { display: flex; align-items: flex-start; gap: 7px; font-size: 11.5px; color: var(--muted); line-height: var(--lh-snug); margin: var(--sp-4) 0 var(--sp-6); }
.tier-foot .ic { color: var(--plum); flex: none; margin-top: 1px; }
.tier-foot b { color: var(--heading); font-weight: 600; }

.prov-head { display: flex; align-items: center; justify-content: space-between; padding-bottom: var(--sp-3); border-bottom: 1px solid var(--border-soft); margin-bottom: var(--sp-4); }
.prov-h-t { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--heading); }

/* add-provider dropdown */
.addprov { position: relative; }
.addprov-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 500; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-md); padding: 6px 11px; cursor: pointer; }
.addprov-btn:hover { background: var(--plum-100); }
.addprov-btn:disabled { opacity: 0.5; cursor: default; color: var(--muted); background: var(--surface-2); border-color: var(--border-soft); }
.addprov-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 51; width: 280px; max-height: 360px; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in 0.16s var(--ease-out); display: flex; flex-direction: column; overflow: hidden; }
.addprov-menu .addprov-search { flex: none; }
.addprov-menu .addprov-opt.detect { flex: none; }
.addprov-menu .addprov-sep { flex: none; }
.addprov-menu-list { overflow-y: auto; overscroll-behavior: contain; margin: 0 calc(var(--sp-3) * -1); padding: 0 var(--sp-3); }
.addprov-menu-list::-webkit-scrollbar { width: 8px; }
.addprov-menu-list::-webkit-scrollbar-track { background: transparent; }
.addprov-menu-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
.addprov-menu-list::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
.addprov-opt { display: flex; align-items: flex-start; gap: var(--sp-3); width: 100%; padding: 8px var(--sp-3); border-radius: var(--r-md); border: none; background: none; cursor: pointer; text-align: left; font: inherit; }
.addprov-opt:hover { background: var(--surface-2); }
.addprov-opt.detect { background: var(--plum-50); margin-bottom: 4px; border: 1px solid var(--plum-200); }
.addprov-opt.detect .ap-name { color: var(--plum-700); font-weight: 600; }
.addprov-opt.detect:hover { background: var(--plum-100); }
.addprov-search { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 6px; background: var(--surface-2); }
.addprov-search input { flex: 1; border: none; outline: none; background: none; font: inherit; font-size: 12px; color: var(--heading); }
.addprov-sep { height: 1px; background: var(--border-soft); margin: 6px 0; }
.addprov-empty { font-size: 11.5px; color: var(--muted); padding: 8px; text-align: center; }
.ap-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ap-name { font-size: 12.5px; font-weight: 600; color: var(--heading); }
.ap-note { font-size: 11px; color: var(--muted); line-height: var(--lh-snug); }

.provs { display: flex; flex-direction: column; gap: var(--sp-3); }
.prov { border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.prov[data-on="1"] { border-color: var(--plum-200); }
.prov-main { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-5); }
.prov-ic { width: 34px; height: 34px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-soft); display: grid; place-items: center; flex: none; }
.prov-glyph { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--plum); }
.prov-glyph.sm { font-size: 12px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: var(--r-xs); background: var(--surface-2); border: 1px solid var(--border-soft); flex: none; }
.prov-meta { flex: 1; min-width: 0; }
.prov-top { display: flex; align-items: center; gap: var(--sp-3); }
.prov-name { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.prov-badge { font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-xs); padding: 1px 6px; }
.prov-on { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--ok-text); }
.prov-on.warn { color: var(--warn-text); }
.prov-on.warn .d { background: var(--warn); }
.prov-on .d { width: 6px; height: 6px; border-radius: 999px; background: var(--ok); }
.prov-test { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; margin-top: 5px; line-height: var(--lh-snug); }
.prov-test.ok { color: var(--ok-text); }
.prov-test.err { color: var(--warn-text); }
.prov-test .ic { flex: none; }
.prov-actions { display: flex; gap: 6px; }
.prov-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: var(--lh-snug); }
.prov-actions { flex: none; }
.prov-managed { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.prov-btn { font: inherit; font-size: 12px; font-weight: 500; color: var(--plum-on); background: var(--plum); border: 1px solid var(--plum); border-radius: var(--r-md); padding: 6px 14px; cursor: pointer; }
.prov-btn:hover { background: var(--plum-600); }
.prov-btn.ghost { color: var(--muted); background: var(--surface); border-color: var(--border); }
.prov-btn.ghost:hover { border-color: var(--border-strong); color: var(--heading); }
.prov-btn.sm { padding: 5px 11px; font-size: 11.5px; }
.prov-form { border: 1px solid var(--plum-200); border-radius: var(--r-md); background: var(--surface-2); padding: var(--sp-5); display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.pf-title { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; font-weight: 600; color: var(--heading); margin-bottom: var(--sp-2); }
.pf-field { display: flex; flex-direction: column; gap: 4px; }
.pf-field span { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.pf-field input { font: inherit; font-family: var(--font-mono); font-size: 12px; padding: 8px var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--heading); outline: none; }
.pf-field input:focus { border-color: var(--plum-300); box-shadow: var(--ring); }
.pf-hint { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.pf-actions { display: flex; justify-content: flex-end; gap: var(--sp-3); }
.pf-note { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); }
.pf-note .ic { color: var(--ok-text); }

/* local-detect results — rendered inside a .prov-form */
.detect-results { border-style: dashed; }
.detect-busy .pf-title { color: var(--plum-700); }
.detect-busy .ic { color: var(--plum); animation: spin 1.2s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.detect-row { display: grid; grid-template-columns: 1fr auto; gap: 6px var(--sp-4); padding: var(--sp-3) 0; border-bottom: 1px solid var(--border-soft); align-items: center; }
.detect-row:last-child { border-bottom: none; }
.detect-name { font-size: 12.5px; font-weight: 600; color: var(--heading); }
.detect-url { grid-column: 1 / 2; font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.detect-models { grid-column: 1 / 2; display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.detect-row .prov-btn { grid-column: 2; grid-row: 1 / 4; align-self: center; }
.detect-tag { font-family: var(--font-mono); font-size: 10px; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-xs); padding: 2px 6px; }
.detect-tag.more, .detect-tag.none { color: var(--muted); background: var(--surface-2); border-color: var(--border-soft); }
.detect-empty { font-size: 12px; color: var(--muted); padding: var(--sp-3) 0; line-height: var(--lh-snug); }

/* save/disconnect/test toast */
.prov-toast { display: inline-flex; align-items: center; gap: 6px; margin-top: var(--sp-4); padding: 6px 12px; font-size: 11.5px; border-radius: var(--r-pill); animation: fadev 0.3s var(--ease-out) both, fadev-out 0.4s var(--ease-out) 2.4s both; }
.prov-toast.ok { color: var(--ok-text); background: var(--ok-surface); border: 1px solid var(--ok-border); }
.prov-toast.err { color: var(--warn-text); background: var(--warn-surface); border: 1px solid var(--warn-border); }
@keyframes fadev-out { to { opacity: 0; transform: translateY(-2px); } }
@container (max-width: 620px) { .tiers { grid-template-columns: 1fr; } }
@media (max-width: 620px) { .tiers { grid-template-columns: 1fr; } }

/* ---------- generic placeholder view ---------- */
.placeholder { padding: var(--sp-10) 0; }
.ph-card { max-width: 520px; padding: var(--sp-8); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); }
.ph-ic { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; margin-bottom: var(--sp-5); }
.ph-card h3 { font-family: var(--font-display); font-weight: 500; font-size: 21px; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 var(--sp-3); }
.ph-card p { font-size: var(--fs-body); color: var(--muted); line-height: var(--lh-snug); margin: 0; }

.fade { animation: fadev 0.4s var(--ease-out) both; }
.mark-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--plum); display: inline-block; }

/* ============================================================
   MODEL DETAIL — rooms
   ============================================================ */
.md { padding: var(--sp-7) var(--sp-9) var(--sp-12); max-width: 1180px; margin: 0 auto; }
.md-head { position: relative; }
.md-title-row { display: flex; align-items: flex-start; gap: var(--sp-5); margin-top: var(--sp-3); }
.md-ico { width: 44px; height: 44px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.md-name { font-family: var(--font-display); font-weight: 500; font-size: clamp(22px, 2.6vw, 28px); letter-spacing: -0.018em; color: var(--ink); margin: 0; line-height: 1.12; }
.md-name.mono { font-family: var(--font-mono); font-size: 19px; letter-spacing: 0; }
.md-meta { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-3); flex-wrap: wrap; }
.md-sub { font-size: var(--fs-small); color: var(--muted); }

.rooms { display: flex; gap: 2px; margin-top: var(--sp-6); border-bottom: 1px solid var(--border-soft); }
.room-tab { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 500; color: var(--muted); background: none; border: none; cursor: pointer; padding: 10px var(--sp-5); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.room-tab:hover { color: var(--heading); }
.room-tab[data-on="1"] { color: var(--plum-700); border-bottom-color: var(--plum); }
.room-tab .ic { width: 15px; height: 15px; }
.room-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--ok); }

.md-body { margin-top: var(--sp-7); }
.room-lede { font-size: var(--fs-body-lg); line-height: var(--lh-body); color: var(--muted); max-width: 46em; margin: 0 0 var(--sp-8); text-wrap: pretty; }

.du-sec { margin-bottom: var(--sp-8); }
.du-h { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-3); }
.du-n { font-family: var(--font-mono); font-size: 11px; color: var(--plum); }
.du-h h3 { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--heading); margin: 0; }
.du-hint { font-family: var(--font-mono); font-size: 10px; color: var(--faint); margin-left: auto; }
.du-edit { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 500; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-pill); padding: 5px 11px; cursor: pointer; }
.du-edit:hover { background: var(--plum-100); }
.du-editnote { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-small); color: var(--muted); margin-top: var(--sp-4); padding: var(--sp-4) var(--sp-5); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-md); line-height: var(--lh-snug); }
.du-editnote .ic { color: var(--plum); flex: none; margin-top: 1px; }
.du-editnote b { color: var(--heading); font-weight: 600; }

/* join graph */
.join { display: flex; flex-direction: column; gap: 0; margin-top: var(--sp-4); max-width: 560px; }
.src { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface); }
.src-ic { width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); display: grid; place-items: center; flex: none; }
.src-ic .ic { width: 17px; height: 17px; }
.src-name { font-family: var(--font-mono); font-size: 13px; font-weight: 500; color: var(--heading); }
.src-note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.src-rows { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--faint); }
.join-link { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0 var(--sp-3) 16px; }
.jl-line { width: 18px; height: 1px; background: var(--border-strong); }
.jl-lbl { font-family: var(--font-mono); font-size: 10px; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-pill); padding: 2px 9px; }

/* columns table */
.cols { margin-top: var(--sp-4); border: 1px solid var(--border-soft); border-radius: var(--r-lg); overflow: hidden; }
.col-row { display: grid; grid-template-columns: 1.2fr 3fr auto; gap: var(--sp-4); align-items: center; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.col-row:last-child { border-bottom: none; }
.col-head { background: var(--surface-2); font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.col-row.is-leak { background: var(--warn-surface); }
.col-name { font-family: var(--font-mono); font-size: 12px; color: var(--heading); font-weight: 500; }
.col-plain { font-size: 12.5px; color: var(--text); line-height: 1.35; }
.col-plain.file-cell { cursor: pointer; padding: 4px 6px; margin: -4px -6px; border-radius: 6px; transition: background var(--dur-fast) var(--ease); }
.col-plain.file-cell:hover { background: color-mix(in oklch, var(--plum) 8%, var(--surface)); }
.col-plain.file-cell:focus-visible { outline: none; background: color-mix(in oklch, var(--plum) 8%, var(--surface)); box-shadow: var(--ring); }
.file-cell-title { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.file-cell-chevron { width: 12px; height: 12px; opacity: 0.5; flex: none; }
.col-note { display: block; font-style: normal; font-size: 10.5px; color: var(--muted); margin-top: 2px; }
.col-row.is-leak .col-note { color: var(--warn-text); }

/* tags */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 500; padding: 3px 8px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.tag.plum { background: var(--plum-50); border-color: var(--plum-200); color: var(--plum-700); }
.tag.ok { background: var(--ok-surface); border-color: var(--ok-border); color: var(--ok-text); }
.tag.info { background: var(--info-surface); border-color: var(--info-border); color: var(--info-text); }
.tag.warn { background: var(--warn-surface); border-color: var(--warn-border); color: var(--warn-text); }
.tag.danger { background: var(--alert-surface); border-color: var(--alert-border); color: var(--alert-text); }
.tag.neutral { background: var(--surface-2); }

/* sparkline */
.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; width: 50px; }
.spark span { width: 4px; border-radius: 1px; background: var(--plum-300); }

/* quality */
.quality { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-4); }
.qrow { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-5); border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface); }
.qrow .q-ic { width: 26px; height: 26px; border-radius: 999px; display: grid; place-items: center; flex: none; }
.qrow .q-ic .ic { width: 15px; height: 15px; }
.qrow.ok .q-ic { background: var(--ok-surface); color: var(--ok-text); }
.qrow.watch .q-ic { background: var(--warn-surface); color: var(--warn-text); }
.qrow.leak { border-color: var(--warn-border); background: var(--warn-surface); }
.qrow.leak .q-ic { background: var(--surface); color: var(--warn-text); border: 1px solid var(--warn-border); }
.q-text { font-size: 13px; color: var(--text); line-height: var(--lh-snug); padding-top: 4px; }
.qrow.leak .q-text { color: var(--warn-text); }

/* as-of */
.asof-card { display: flex; align-items: flex-start; gap: var(--sp-5); margin-top: var(--sp-4); padding: var(--sp-6); border-radius: var(--r-lg); border: 1px solid var(--plum-200); background: var(--plum-50); }
.asof-ic { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.asof-text { font-size: var(--fs-body); color: var(--plum-700); line-height: var(--lh-body); margin: 0; max-width: 52em; }

/* other rooms — honest placeholder */
.room-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-4); padding: var(--sp-10) var(--sp-6); max-width: 460px; margin: 0 auto; }
.re-ic { width: 48px; height: 48px; border-radius: var(--r-lg); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; }
.room-empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 21px; color: var(--ink); margin: 0; }
.room-empty p { font-size: var(--fs-body); color: var(--muted); line-height: var(--lh-snug); margin: 0; }
.room-empty b { color: var(--heading); font-weight: 600; }

@container (max-width: 680px) {
  .col-row { grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
  .col-head { display: none; }
  .col-row > span:nth-child(2) { grid-column: 1 / -1; order: 3; }
  .col-row > span:nth-child(4) { display: none; }
}

/* ---------- TRUST room ---------- */
.tverdicts { display: flex; flex-direction: column; gap: var(--sp-4); }
.tverdict { display: flex; align-items: flex-start; gap: var(--sp-5); padding: var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.tv-ic { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--ok-surface); border: 1px solid var(--ok-border); color: var(--ok-text); display: grid; place-items: center; flex: none; }
.tv-ic .ic { width: 19px; height: 19px; }
.tv-title { display: flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--heading); }
.tv-check { width: 14px; height: 14px; color: var(--ok); }
.tv-plain { font-size: 13px; color: var(--muted); line-height: var(--lh-body); margin-top: var(--sp-3); max-width: 56em; text-wrap: pretty; }
.cal-lede { font-size: var(--fs-small); color: var(--muted); margin: var(--sp-3) 0 var(--sp-5); }
.cal { display: flex; flex-direction: column; gap: var(--sp-3); max-width: 620px; }
.cal-row { display: grid; grid-template-columns: 86px 1fr 120px; gap: var(--sp-4); align-items: center; }
.cal-band { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.cal-track { position: relative; height: 10px; border-radius: 999px; background: var(--surface-3); overflow: visible; }
.cal-fill { position: absolute; left: 0; top: 0; height: 100%; border-radius: 999px; background: var(--plum); }
.cal-ideal { position: absolute; top: -3px; width: 2px; height: 16px; background: var(--ink); opacity: 0.35; border-radius: 2px; }
.cal-actual { font-size: 11.5px; color: var(--heading); }

/* ---------- PERFORMANCE room ---------- */
.perf-presets { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }
.ppreset { text-align: left; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5); border-radius: var(--r-lg); border: 1.5px solid var(--border); background: var(--surface); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.ppreset:hover { border-color: var(--plum-300); }
.ppreset[data-sel="1"] { border-color: var(--plum); box-shadow: var(--ring); background: var(--plum-50); }
.pp-label { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; font-weight: 600; color: var(--heading); }
.pp-flagged { font-family: var(--font-display); font-weight: 500; font-size: 26px; color: var(--ink); }
.pp-flagged small { font-family: var(--font-sans); font-size: 12px; color: var(--muted); font-weight: 400; }
.perf-readout { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-6); margin-top: var(--sp-6); align-items: center; padding: var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface-2); }
.dots { display: flex; gap: 5px; }
.d10 { width: 18px; height: 18px; border-radius: 5px; background: var(--surface-3); border: 1px solid var(--border-soft); }
.d10.on { background: var(--plum); border-color: var(--plum); }
.pr-cap { font-size: 13px; color: var(--heading); margin-top: var(--sp-4); line-height: var(--lh-snug); }
.pr-cap b { color: var(--plum-700); }
.pr-split { display: flex; gap: var(--sp-7); border-left: 1px solid var(--border); padding-left: var(--sp-6); }
.pr-stat { display: flex; flex-direction: column; gap: 4px; }
.prs-num { font-family: var(--font-display); font-weight: 500; font-size: 28px; color: var(--ink); line-height: 1; }
.prs-lab { font-size: 11px; color: var(--muted); }
.pp-note { font-size: 13px; color: var(--muted); line-height: var(--lh-snug); margin: var(--sp-5) 0 0; }
.segs { display: flex; flex-direction: column; gap: var(--sp-4); }
.segrow { display: grid; grid-template-columns: 200px 1fr 92px; gap: var(--sp-4); align-items: center; }
.seg-name { font-size: 13px; color: var(--heading); }
.seg-bar { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.seg-bar i { display: block; height: 100%; border-radius: 999px; background: var(--plum); }
.seg-bar i.watch { background: var(--warn); }
.seg-score { font-family: var(--font-mono); font-size: 12px; color: var(--heading); }
.seg-score em { font-style: normal; font-size: 10px; color: var(--warn-text); }
.seg-score.watch { color: var(--warn-text); }
@container (max-width: 680px) { .perf-presets { grid-template-columns: 1fr; } .perf-readout { grid-template-columns: 1fr; } .pr-split { border-left: none; padding-left: 0; } .segrow { grid-template-columns: 1fr 80px; } .segrow .seg-bar { grid-column: 1 / -1; order: 3; } }

/* ---------- MONITOR room ---------- */
.mon-status { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.mon-meta { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.mon-hist { padding: var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); }
.histbars { display: flex; align-items: flex-end; gap: var(--sp-4); height: 96px; }
.hbar { flex: 1; background: var(--plum-200); border-radius: 4px 4px 0 0; position: relative; min-height: 6px; display: flex; justify-content: center; }
.hbar:last-child { background: var(--plum); }
.hbar em { position: absolute; top: -16px; font-family: var(--font-mono); font-size: 9.5px; font-style: normal; color: var(--faint); }
.hist-base { font-size: 11.5px; color: var(--muted); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border-soft); }
.drift { display: flex; flex-direction: column; gap: var(--sp-3); }
.drow { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface); }
.drow.drifting { border-color: var(--warn-border); background: var(--warn-surface); }
.dr-ic { width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center; flex: none; background: var(--ok-surface); color: var(--ok-text); }
.drow.drifting .dr-ic { background: var(--surface); color: var(--warn-text); border: 1px solid var(--warn-border); }
.dr-ic .ic { width: 15px; height: 15px; }
.dr-body { flex: 1; min-width: 0; }
.dr-name { font-size: 13px; font-weight: 600; color: var(--heading); }
.dr-plain { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: var(--lh-snug); }
.drow.drifting .dr-plain { color: var(--warn-text); }
.dr-psi { font-family: var(--font-mono); font-size: 11px; color: var(--faint); flex: none; }
.dr-psi.drifting { color: var(--warn-text); font-weight: 600; }
.triggers { display: flex; flex-direction: column; gap: var(--sp-3); }
.trow { display: flex; align-items: center; gap: var(--sp-4); font-size: 13px; color: var(--text); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface-2); }
.trow .ic { color: var(--plum); flex: none; }

/* ---------- editable structure ("Correct this") ---------- */
.struct.editing { border-color: var(--plum-200); box-shadow: var(--ring); }
.nv-edit { font: inherit; font-size: var(--fs-body); font-weight: 600; color: var(--plum-700); background: var(--surface); border: 1px solid var(--plum-300); border-radius: var(--r-sm); padding: 4px 8px; cursor: pointer; outline: none; max-width: 200px; }
.nv-edit:focus { box-shadow: var(--ring); }
.du-rebuild { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-4); padding: var(--sp-4) var(--sp-5); border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); }
.dr-spin { width: 16px; height: 16px; border: 2px solid var(--plum-200); border-top-color: var(--plum); border-radius: 999px; animation: spin 0.7s linear infinite; flex: none; }
.drb-text { font-size: 13px; color: var(--plum-700); line-height: var(--lh-snug); flex: 1; }
.drb-text b { font-weight: 600; }
.drb-undo { font: inherit; font-size: 12px; font-weight: 500; color: var(--plum-700); background: var(--surface); border: 1px solid var(--plum-200); border-radius: var(--r-pill); padding: 5px 12px; cursor: pointer; flex: none; }
.drb-undo:hover { background: var(--plum-100); }

/* ============================================================
   ASK FLOW
   ============================================================ */
.ask { padding: var(--sp-7) var(--sp-9) var(--sp-12); max-width: 860px; margin: 0 auto; }
.ask-head { margin-bottom: var(--sp-7); }
.ask-q { display: flex; align-items: flex-start; gap: var(--sp-4); margin-top: var(--sp-4); }
.ask-q-ic { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.ask-q-text { font-family: var(--font-display); font-weight: 500; font-size: clamp(22px, 3vw, 30px); letter-spacing: -0.018em; color: var(--ink); line-height: 1.12; text-wrap: balance; }

.ask-reads { margin-bottom: var(--sp-7); }
.reads { display: flex; flex-direction: column; gap: 0; margin-top: var(--sp-4); }
.read2 { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) 0; font-size: 13.5px; color: var(--heading); opacity: 0; animation: read-in 0.4s var(--ease-out) forwards; }
.read2 .r2-check { width: 18px; height: 18px; color: var(--ok); flex: none; }

.ask-plan { border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--surface); box-shadow: var(--shadow-sm); padding: var(--sp-7); }
.ap-head { display: flex; align-items: center; gap: var(--sp-4); flex-wrap: wrap; }
.ap-head h3 { font-family: var(--font-display); font-weight: 500; font-size: 20px; letter-spacing: -0.01em; color: var(--ink); margin: 0; }
.ap-asof { margin-top: var(--sp-6); }
.ap-label { font-size: 13px; font-weight: 600; color: var(--heading); margin-bottom: var(--sp-4); }
.ap-choices { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.ap-choice { display: flex; align-items: flex-start; gap: var(--sp-4); text-align: left; font: inherit; cursor: pointer; padding: var(--sp-5); border-radius: var(--r-md); border: 1.5px solid var(--border); background: var(--surface); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.ap-choice:hover { border-color: var(--plum-300); }
.ap-choice[data-sel="1"] { border-color: var(--plum); background: var(--plum-50); }
.apc-radio { width: 18px; height: 18px; border-radius: 999px; border: 2px solid var(--border-strong); flex: none; margin-top: 1px; position: relative; }
.ap-choice[data-sel="1"] .apc-radio { border-color: var(--plum); }
.ap-choice[data-sel="1"] .apc-radio::after { content: ""; position: absolute; inset: 3px; border-radius: 999px; background: var(--plum); }
.apc-title { display: flex; align-items: center; gap: var(--sp-3); font-size: 13.5px; font-weight: 600; color: var(--heading); }
.apc-desc { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: var(--lh-snug); }
.ap-steps { list-style: none; margin: var(--sp-6) 0 0; padding: var(--sp-6) 0 0; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: var(--sp-4); counter-reset: none; }
.ap-steps li { display: flex; align-items: center; gap: var(--sp-4); font-size: 13.5px; color: var(--text); }
.aps-n { width: 22px; height: 22px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); font-family: var(--font-mono); font-size: 11px; display: grid; place-items: center; flex: none; }
.ap-foot { display: flex; align-items: center; gap: var(--sp-5); margin-top: var(--sp-7); flex-wrap: wrap; }
.ap-note { font-size: var(--fs-small); color: var(--muted); }
.bd-num { font-family: var(--font-mono); font-size: 12px; }

.done-trust { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); margin: var(--sp-6) 0 0; }
.done-trust .ic { color: var(--plum); flex: none; }
.done-card { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-7); padding: var(--sp-5) var(--sp-6); border: 1px solid var(--plum-200); border-radius: var(--r-lg); background: var(--plum-50); }
.done-card .o-ico { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.dc-title { font-size: 14px; font-weight: 600; color: var(--heading); }
.dc-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.ask-actions { display: flex; flex-wrap: wrap; gap: var(--sp-4); margin-top: var(--sp-8); padding-top: var(--sp-7); border-top: 1px solid var(--border-soft); }
@container (max-width: 680px) { .ap-choices { grid-template-columns: 1fr; } }

/* ============================================================
   LANDING
   ============================================================ */
.land { height: 100%; display: flex; flex-direction: column; overflow-y: auto; scroll-behavior: smooth; background:
  radial-gradient(900px 560px at 88% 4%, color-mix(in oklch, var(--plum-100) 72%, transparent) 0%, transparent 68%),
  radial-gradient(700px 460px at -8% 24%, color-mix(in oklch, var(--info-surface) 58%, transparent) 0%, transparent 72%),
  var(--paper); }
.land main { display: block; }
.land-bar { flex: none; height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(var(--sp-6), 5vw, var(--sp-14)); border-bottom: 1px solid color-mix(in oklch, var(--border-soft) 72%, transparent); background: color-mix(in oklch, var(--paper) 86%, transparent); backdrop-filter: blur(14px); position: sticky; top: 0; z-index: 8; }
.land-brand { display: inline-flex; align-items: center; gap: var(--sp-3); }
.land-brand { text-decoration: none; }
.land-brand .mark { width: 9px; height: 9px; border-radius: 3px; background: linear-gradient(145deg, var(--plum-300), var(--plum-600)); box-shadow: 0 0 0 5px var(--plum-50); flex: none; align-self: center; transform: rotate(18deg); }
.land-brand .word { font-family: var(--font-display); font-weight: 650; font-size: 15px; letter-spacing: 0.09em; color: var(--heading); }
.land-nav { display: flex; align-items: center; gap: var(--sp-6); }
.land-nav .land-link, .land-login { white-space: nowrap; }
.land-link { font-size: 12.5px; font-weight: 500; color: var(--muted); text-decoration: none; }
.land-link:hover { color: var(--heading); }
.land-login { font: inherit; font-size: 13px; font-weight: 500; color: var(--heading); background: none; border: none; cursor: pointer; padding: 8px 4px; }
.land-login:hover { color: var(--plum); }
@media (max-width: 720px) { .land-link { display: none; } }

.land-hero { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr); gap: clamp(44px, 7vw, 100px); align-items: center; min-height: min(760px, calc(100vh - 68px)); padding: clamp(72px, 10vh, 120px) clamp(var(--sp-6), 7vw, 110px); max-width: 1340px; margin: 0 auto; width: 100%; }
.land-copy { max-width: 690px; }
.land-title { font-family: var(--font-display); font-weight: 580; font-size: clamp(43px, 5.6vw, 76px); line-height: 0.99; letter-spacing: -0.048em; color: var(--ink); margin: var(--sp-6) 0 0; text-wrap: balance; }
.land-sub { font-size: clamp(15.5px, 1.45vw, 18px); line-height: 1.68; color: var(--muted); max-width: 39em; margin: var(--sp-7) 0 0; }
.land-acts { display: flex; gap: var(--sp-4); margin-top: var(--sp-8); flex-wrap: wrap; }
.land-trust { display: flex; flex-wrap: wrap; gap: var(--sp-6); margin-top: var(--sp-9); padding-top: var(--sp-6); border-top: 1px solid var(--border-soft); }
.lt-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; color: var(--muted); }
.lt-item .ic { width: 15px; height: 15px; color: var(--plum); }

.land-peek { display: grid; place-items: center; }
.land-model-card { width: min(470px, 100%); border: 1px solid var(--border); border-radius: 18px; background: color-mix(in oklch, var(--surface) 94%, var(--plum-50)); box-shadow: 0 28px 80px oklch(0.31 0.06 290 / 0.16), inset 0 1px 0 color-mix(in oklch, white 80%, transparent); padding: var(--sp-7); position: relative; }
.land-model-card::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none; background: linear-gradient(145deg, color-mix(in oklch, var(--plum-200) 50%, transparent), transparent 36%); opacity: .7; }
.lmc-head { display: flex; align-items: center; justify-content: space-between; position: relative; }
.lmc-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.lmc-status { display: inline-flex; align-items: center; gap: 7px; font-size: 10px; font-weight: 600; color: var(--ok-text); text-transform: uppercase; letter-spacing: .06em; }
.lmc-status span { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px var(--ok-surface); }
.lmc-question { position: relative; font-family: var(--font-display); font-size: 22px; font-weight: 560; line-height: 1.25; letter-spacing: -.02em; color: var(--heading); margin: var(--sp-7) 0; max-width: 18em; }
.lmc-flow { display: flex; flex-direction: column; position: relative; border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden; background: var(--surface); }
.lmc-step { display: grid; grid-template-columns: 28px 1fr 18px; align-items: center; gap: var(--sp-4); padding: 14px 15px; border-bottom: 1px solid var(--border-soft); }
.lmc-step:last-child { border-bottom: 0; }
.lmc-step > b { font-family: var(--font-mono); font-size: 10px; color: var(--plum); }
.lmc-step > span { display: flex; flex-direction: column; gap: 2px; }
.lmc-step strong { font-size: 12.5px; color: var(--heading); }
.lmc-step small { font-size: 10.5px; color: var(--muted); }
.lmc-step > .ic { width: 15px; height: 15px; color: var(--ok-text); }
.lmc-answer { display: flex; flex-direction: column; gap: 3px; margin-top: var(--sp-5); padding: var(--sp-5); border-radius: 11px; background: var(--plum-50); border: 1px solid var(--plum-100); position: relative; }
.lmc-answer > span { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--plum-700); }
.lmc-answer strong { font-size: 13.5px; color: var(--heading); }
.lmc-answer small { font-size: 10.5px; line-height: 1.45; color: var(--muted); }

.land-section { max-width: 1240px; margin: 0 auto; padding: 110px clamp(var(--sp-6), 6vw, 80px); scroll-margin-top: 68px; }
.land-section-head { max-width: 760px; }
.land-section h2, .land-trust-panel h2 { font-family: var(--font-display); font-size: clamp(30px, 3.6vw, 48px); line-height: 1.08; letter-spacing: -.035em; color: var(--ink); margin: var(--sp-5) 0 0; text-wrap: balance; }
.land-section-head > p { font-size: 16px; line-height: 1.65; color: var(--muted); margin: var(--sp-5) 0 0; }
.land-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); margin-top: var(--sp-9); }
.land-grid article { min-height: 250px; padding: var(--sp-7); border: 1px solid var(--border-soft); border-radius: 15px; background: color-mix(in oklch, var(--surface) 88%, transparent); box-shadow: var(--shadow-sm); position: relative; }
.land-grid article > span { font-family: var(--font-mono); font-size: 10px; color: var(--faint); letter-spacing: .08em; }
.land-grid article > .ic { display: block; width: 23px; height: 23px; color: var(--plum); margin-top: var(--sp-8); }
.land-grid h3 { font-family: var(--font-display); font-size: 18px; color: var(--heading); margin: var(--sp-5) 0 0; }
.land-grid p { font-size: 13px; line-height: 1.6; color: var(--muted); margin: var(--sp-4) 0 0; }

.land-audience { max-width: 1120px; margin: 0 auto 110px; padding: 0 clamp(var(--sp-6), 5vw, 60px); scroll-margin-top: 86px; }
.land-audience-head { max-width: 760px; }
.land-audience h2 { font-family: var(--font-display); font-size: clamp(30px, 3.6vw, 48px); line-height: 1.08; letter-spacing: -.035em; color: var(--ink); margin: var(--sp-5) 0 0; text-wrap: balance; }
.land-audience-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); margin-top: var(--sp-8); }
.land-audience-grid article { padding: clamp(26px, 4vw, 42px); border: 1px solid var(--border-soft); border-radius: 17px; background: color-mix(in oklch, var(--surface) 90%, transparent); box-shadow: var(--shadow-sm); }
.land-audience-grid article > span { font-family: var(--font-mono); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--plum-700); }
.land-audience-grid h3 { font-family: var(--font-display); font-size: 21px; line-height: 1.25; color: var(--heading); margin: var(--sp-5) 0 0; }
.land-audience-grid p { font-size: 13px; line-height: 1.65; color: var(--muted); margin: var(--sp-4) 0 0; }

.land-trust-panel { max-width: 1120px; margin: 0 auto 110px; padding: clamp(32px, 5vw, 60px); display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(40px, 7vw, 90px); align-items: start; border: 1px solid var(--plum-100); border-radius: 20px; background: linear-gradient(145deg, var(--plum-50), color-mix(in oklch, var(--surface) 92%, var(--info-surface))); scroll-margin-top: 86px; }
.land-trust-panel h2 { font-size: clamp(28px, 3.2vw, 42px); }
.land-trust-list { display: flex; flex-direction: column; }
.land-trust-list p { display: grid; grid-template-columns: 24px 1fr; gap: var(--sp-4); padding: var(--sp-5) 0; margin: 0; border-bottom: 1px solid color-mix(in oklch, var(--plum-200) 60%, transparent); }
.land-trust-list p:last-child { border-bottom: 0; }
.land-trust-list .ic { width: 18px; height: 18px; color: var(--plum); margin-top: 2px; }
.land-trust-list span { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.land-trust-list strong { font-size: 13.5px; color: var(--heading); }

@media (max-width: 900px) {
  .land-hero { grid-template-columns: 1fr; min-height: auto; }
  .land-copy { max-width: 760px; }
  .land-peek { justify-items: start; }
  .land-model-card { width: min(560px, 100%); }
  .land-grid { grid-template-columns: 1fr; }
  .land-grid article { min-height: 0; }
  .land-audience-grid { grid-template-columns: 1fr; }
  .land-trust-panel { grid-template-columns: 1fr; margin-inline: var(--sp-6); }
}
@media (max-width: 560px) {
  .land-bar { padding-inline: var(--sp-5); }
  .land-nav { gap: var(--sp-4); }
  .land-nav .btn { display: none; }
  .land-hero { padding: 58px var(--sp-6) 76px; }
  .land-title { font-size: 42px; }
  .land-trust { gap: var(--sp-4); }
  .land-section { padding: 80px var(--sp-6); }
  .land-trust-panel { margin-bottom: 80px; }
}

/* ============================================================
   AUTH
   ============================================================ */
.auth { height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: safe center; gap: var(--sp-5); padding: var(--sp-9) var(--sp-8); position: relative; background:
  radial-gradient(110% 70% at 50% -10%, var(--plum-50) 0%, transparent 55%), var(--paper); }
.auth-back { position: absolute; top: var(--sp-6); left: var(--sp-6); display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 13px; color: var(--muted); background: none; border: none; cursor: pointer; }
.auth-back:hover { color: var(--plum); }
.auth-back .ic { width: 14px; height: 14px; }
.auth-card { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); padding: var(--sp-8) var(--sp-8) var(--sp-7); }
.auth-mark { display: inline-flex; align-items: center; gap: var(--sp-3); padding: 9px 16px 9px 14px; border-radius: var(--r-pill); background: var(--plum); color: var(--plum-on); margin: 0 auto var(--sp-5); }
.auth-mark .mark { width: 7px; height: 7px; border-radius: 999px; background: var(--plum-on); flex: none; align-self: center; }
.auth-mark .word { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.auth-title { font-family: var(--font-display); font-weight: 500; font-size: 24px; letter-spacing: -0.015em; color: var(--ink); text-align: center; margin: 0; }
.auth-sub { font-size: var(--fs-small); color: var(--muted); text-align: center; margin: var(--sp-3) 0 var(--sp-6); }
.sso { display: flex; flex-direction: column; gap: var(--sp-3); }
.sso-btn { display: flex; align-items: center; justify-content: center; gap: var(--sp-3); white-space: nowrap; font: inherit; font-size: 13.5px; font-weight: 500; color: var(--heading); padding: 10px var(--sp-5); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.sso-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.sso-btn .ic { width: 16px; height: 16px; color: var(--muted); }
.sso-ic { width: 16px; height: 16px; display: grid; place-items: center; font-weight: 700; font-size: 13px; border-radius: 3px; }
.sso-ic[data-g="google"] { color: #4285F4; }
.sso-ic[data-g="ms"] { color: #00A4EF; }
.auth-or { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-6) 0; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.auth-or span { font-size: 11px; color: var(--faint); }
.auth-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-lbl { font-size: 11.5px; font-weight: 500; color: var(--heading); }
.field input { font: inherit; font-size: 14px; color: var(--heading); padding: 10px var(--sp-4); border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); outline: none; transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.field input:focus { border-color: var(--plum-300); box-shadow: var(--ring); }
.field input::placeholder { color: var(--faint); }
.auth-forgot { font-size: 11.5px; color: var(--plum-700); text-decoration: none; align-self: flex-end; margin-top: -2px; }
.auth-forgot:hover { text-decoration: underline; }
.auth-switch { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: var(--sp-6); }
.auth-switch button { font: inherit; font-size: 12.5px; font-weight: 600; color: var(--plum-700); background: none; border: none; cursor: pointer; padding: 0; }
.auth-switch button:hover { text-decoration: underline; }
.auth-legal { font-size: 10.5px; color: var(--faint); text-align: center; max-width: 320px; line-height: 1.5; margin: 0; }

.mark-dot-unused { display: none; }

/* ---------- onboarding titlebar ---------- */
.onb-tbar { height: 46px; flex: none; display: grid; place-items: center; background: var(--titlebar); border-bottom: 1px solid var(--border-soft); }
.onb-tbar .word { font-family: var(--font-display); font-weight: 500; font-size: 14px; letter-spacing: -0.01em; color: var(--heading); display: inline-flex; align-items: center; gap: 8px; }
.onb-tbar .mark { width: 6px; height: 6px; border-radius: 999px; background: var(--plum); flex: none; align-self: center; }

/* ---------- onboarding: depth step ---------- */
.depth-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); margin-top: var(--sp-8); }
.depth-card { text-align: left; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-6); border-radius: var(--r-lg); border: 1.5px solid var(--border); background: var(--surface); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.depth-card:hover { border-color: var(--plum-300); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.depth-card[data-sel="1"] { border-color: var(--plum); box-shadow: var(--ring); }
.dc-bars { display: flex; align-items: flex-end; gap: 3px; height: 20px; }
.dc-bars span { width: 7px; border-radius: 2px; background: var(--surface-3); }
.dc-bars span:nth-child(1) { height: 8px; } .dc-bars span:nth-child(2) { height: 14px; } .dc-bars span:nth-child(3) { height: 20px; }
.dc-bars span[data-on="1"] { background: var(--plum); }
.dc-label { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--ink); display: flex; align-items: center; gap: var(--sp-3); }
.dc-rec { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); padding: 2px 6px; border-radius: var(--r-pill); }
.dc-blurb { font-size: 12px; color: var(--muted); line-height: var(--lh-snug); }

/* ---------- project switcher ---------- */
.proj { position: relative; }
.proj-btn { display: flex; align-items: center; gap: var(--sp-3); padding: 5px 10px 5px 6px; border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface); cursor: pointer; max-width: 240px; }
.proj-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.proj-ic { width: 24px; height: 24px; border-radius: var(--r-sm); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.proj-ic .ic { width: 14px; height: 14px; }
.proj-ic.sm { width: 22px; height: 22px; }
.proj-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.proj-name { font-size: 12.5px; font-weight: 600; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-sub { font-family: var(--font-mono); font-size: 9px; color: var(--faint); white-space: nowrap; }
.proj-chev { width: 13px; height: 13px; color: var(--faint); flex: none; }
.proj-scrim { position: fixed; inset: 0; z-index: 50; }
.proj-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 51; width: 264px; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in 0.16s var(--ease-out); }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
.proj-menu-lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.proj-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 8px; border-radius: var(--r-md); border: none; background: none; cursor: pointer; text-align: left; font: inherit; }
.proj-item:hover { background: var(--surface-2); }
.proj-item[data-on="1"] { background: var(--plum-50); }
.proj-item.newp { color: var(--muted); font-size: 12.5px; font-weight: 500; border-top: 1px solid var(--border-soft); margin-top: var(--sp-2); padding-top: var(--sp-4); border-radius: 0; }

/* ---------- command-palette button + overlay ---------- */
.cmdk-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 11px; font-weight: 500; color: var(--muted); padding: 6px 10px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-family: var(--font-mono); }
.cmdk-btn:hover { border-color: var(--border-strong); color: var(--heading); background: var(--surface-2); }
.cmdk-scrim { position: fixed; inset: 0; z-index: 80; background: oklch(0.2 0.01 60 / 0.28); display: grid; place-items: start center; padding-top: 14vh; animation: fadev 0.15s var(--ease-out); }
.cmdk { width: min(580px, 92vw); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); overflow: hidden; animation: pop-in 0.18s var(--ease-out); }
.cmdk-input { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-soft); }
.cmdk-input input { flex: 1; border: none; outline: none; background: none; font: inherit; font-size: var(--fs-body-lg); color: var(--heading); }
.cmdk-input input::placeholder { color: var(--faint); }
.cmdk-esc { font-family: var(--font-mono); font-size: 10px; color: var(--faint); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 2px 6px; }
.cmdk-body { max-height: 50vh; overflow-y: auto; padding: var(--sp-3); }
.cmdk-empty { padding: var(--sp-6); font-size: var(--fs-small); color: var(--muted); }
.cmdk-sec { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); padding: var(--sp-4) var(--sp-3) var(--sp-2); }
.cmdk-item { display: flex; align-items: center; gap: var(--sp-4); width: 100%; padding: 9px var(--sp-3); border-radius: var(--r-md); border: none; background: none; cursor: pointer; text-align: left; font: inherit; color: var(--heading); }
.cmdk-item:hover { background: var(--plum-50); }
.cmdk-item .ic { width: 16px; height: 16px; color: var(--muted); flex: none; }
.cmdk-item:hover .ic { color: var(--plum); }
.cmdk-label { flex: 1; font-size: 13.5px; }
.cmdk-hint { font-size: 11px; color: var(--faint); }

/* ---------- background tasks tray ---------- */
.tasks { position: relative; }
.tasks-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 51; width: 300px; padding: var(--sp-5); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in 0.16s var(--ease-out); }
.tasks-head { display: flex; align-items: center; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--heading); margin-bottom: var(--sp-4); }
.task { padding: var(--sp-4) 0; border-top: 1px solid var(--border-soft); }
.task.task-link { display: block; width: 100%; text-align: left; background: transparent; border: 0; border-top: 1px solid var(--border-soft); cursor: pointer; padding: var(--sp-4) calc(var(--sp-3) - 2px); margin: 0 calc(-1 * (var(--sp-3) - 2px)); border-radius: 8px; transition: background 0.12s ease; font: inherit; color: inherit; }
.task.task-link:hover { background: color-mix(in oklch, var(--surface) 70%, var(--plum) 6%); }
.task.task-link:focus-visible { outline: 2px solid var(--plum); outline-offset: -2px; }
.task-top { display: flex; align-items: baseline; justify-content: space-between; }
.task-title { font-size: 12.5px; font-weight: 500; color: var(--heading); }
.task-pct { font-family: var(--font-mono); font-size: 10px; color: var(--plum-700); }
.task-note { font-size: 11px; color: var(--muted); margin: 2px 0 7px; }
.task-bar { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.task-bar i { display: block; height: 100%; background: var(--plum); border-radius: 999px; }
/* indeterminate: builds report stages, not a percentage — so the bar slides rather than fills */
.task-bar.indet { position: relative; }
.task-bar.indet i { position: absolute; left: 0; width: 40%; animation: task-indet 1.2s ease-in-out infinite; }
@keyframes task-indet { 0% { left: -42%; } 100% { left: 100%; } }
.tasks-empty { font-size: 12px; color: var(--muted); line-height: var(--lh-snug); padding: var(--sp-1) 0 var(--sp-2); }
.tasks-foot { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--faint); margin-top: var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--border-soft); }

/* ---------- dock plan hint ---------- */
.dock-hint { font-size: 10.5px; color: var(--faint); white-space: nowrap; padding-right: var(--sp-3); }
@media (max-width: 760px) { .dock-hint { display: none; } }

/* ---------- models metric, library, settings swatches ---------- */
.model-metric { font-family: var(--font-display); font-weight: 500; font-size: 19px; color: var(--ink); letter-spacing: -0.01em; }
.lib-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.lib { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-6); background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.lib-top { display: flex; align-items: center; justify-content: space-between; }
.lib-ic { width: 32px; height: 32px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; }
.lib-ic .ic { width: 17px; height: 17px; }
.lib-kind { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.lib-title { font-family: var(--font-display); font-weight: 500; font-size: 15px; color: var(--ink); letter-spacing: -0.005em; }
.lib-note { font-size: 12px; color: var(--muted); line-height: var(--lh-snug); flex: 1; }
.lib-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--border-soft); padding-top: var(--sp-4); }
.lib-used { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.set-swatches { display: flex; gap: var(--sp-3); }
.set-swatches .sw { width: 28px; height: 28px; border-radius: var(--r-md); border: 2px solid var(--border); cursor: pointer; }
.set-swatches .sw[data-on="1"] { border-color: var(--ink); box-shadow: var(--ring); }
@keyframes fadev { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 880px) {
  .lab-grid { grid-template-columns: 1fr; }
}
@container (max-width: 760px) {
  .lanes { grid-template-columns: 1fr 1fr; }
  .rep-grid { grid-template-columns: 1fr 1fr; }
}
@container (max-width: 480px) {
  .lanes, .rep-grid, .lib-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .lanes { grid-template-columns: 1fr; }
  .persona-grid, .set-roles, .depth-grid, .lib-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   NEW IA — top bar (home button + user menu), rail, home,
   chat, model tabs, deployment
   ============================================================ */

/* ---- top bar: home button + breadcrumb ---- */
.home-btn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--heading); padding: 6px 12px 6px 9px; border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.home-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.home-btn[data-on="1"] { background: var(--plum-50); border-color: var(--plum-200); color: var(--plum-700); }
.home-btn .ic { width: 16px; height: 16px; }
.crumb-sep { color: var(--border-strong); font-size: 14px; }
.crumb-here { font-size: 12.5px; font-weight: 600; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }

/* ---- user menu ---- */
.menu-scrim { position: fixed; inset: 0; z-index: 50; }
.usermenu { position: relative; }
.acct .acct-chev { width: 13px; height: 13px; color: var(--faint); flex: none; }
.acct-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 51; width: 250px; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in 0.16s var(--ease-out); }
.am-id { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-3); }
.am-av { width: 34px; height: 34px; border-radius: 999px; background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 14px; flex: none; }
.am-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.am-name { font-size: 13px; font-weight: 600; color: var(--heading); }
.am-mail { font-family: var(--font-mono); font-size: 10px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.am-sep { height: 1px; background: var(--border-soft); margin: var(--sp-2) 0; }
.am-item { display: flex; align-items: center; gap: var(--sp-4); width: 100%; padding: 9px var(--sp-3); border-radius: var(--r-md); border: none; background: none; cursor: pointer; text-align: left; font: inherit; font-size: 13px; color: var(--heading); }
.am-item:hover { background: var(--surface-2); }
.am-item .ic { width: 16px; height: 16px; color: var(--muted); flex: none; }
.am-item.danger { color: var(--alert-text); }
.am-item.danger:hover { background: var(--alert-surface); }
.am-item.danger .ic { color: var(--alert-text); }

/* solo main (home / settings — no rail) */
.main.solo { flex: 1; min-height: 0; }

/* ============================================================
   HOME — folders of projects
   ============================================================ */
.home { height: 100%; overflow-y: auto; position: relative; }
.home-inner { max-width: 1120px; margin: 0 auto; padding: var(--sp-9) var(--sp-9) var(--sp-12); }
.home-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-6); margin-bottom: var(--sp-9); }
.home-title { font-family: var(--font-display); font-weight: 500; font-size: clamp(24px, 3vw, 32px); letter-spacing: -0.02em; color: var(--ink); margin: var(--sp-3) 0 0; }
.home-sub { font-size: var(--fs-body-lg); color: var(--muted); line-height: var(--lh-snug); margin: var(--sp-4) 0 0; max-width: 42em; }
.new-proj { flex: none; display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 500; color: var(--plum-on); background: var(--plum); border: none; border-radius: var(--r-md); padding: 9px 15px; cursor: pointer; }
.new-proj:hover { background: var(--plum-600); }
.new-proj .ic { width: 15px; height: 15px; }

.folder { margin-bottom: var(--sp-9); }
.folder-head { display: flex; align-items: center; gap: var(--sp-4); padding-bottom: var(--sp-4); margin-bottom: var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.folder-ic { width: 30px; height: 30px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); display: grid; place-items: center; flex: none; }
.folder-ic .ic { width: 16px; height: 16px; }
.folder-meta { flex: 1; min-width: 0; }
.folder-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--heading); }
.folder-note { font-size: 11.5px; color: var(--muted); margin-left: var(--sp-3); }
.folder-count { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.pcard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--sp-5); }

.pcard { text-align: left; font: inherit; cursor: pointer; display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-6); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border-soft); box-shadow: var(--shadow-xs); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease); }
.pcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pc-top { display: flex; align-items: center; justify-content: space-between; }
/* Monogram square — replaces the old kind-icon. Background color comes from
   an inline style (m.accent.bg) derived in _deriveModelForProject, so each
   project gets its own identity without forcing the user to pick. */
.pc-mono { width: 34px; height: 34px; border-radius: var(--r-md); color: var(--plum-on); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; flex: none; }
.pcard.mono .pc-mono { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0; }
.pc-name { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; color: var(--ink); margin-top: var(--sp-2); }
.pcard.mono .pc-name { font-family: var(--font-mono); font-size: 13px; font-weight: 500; letter-spacing: 0; }
.pc-sub { font-size: 11.5px; color: var(--muted); min-height: 1.4em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-sub-empty { color: var(--faint); font-style: italic; }
.pcard.add { align-items: center; justify-content: center; gap: var(--sp-3); border: 1.5px dashed var(--border); background: var(--surface-2); box-shadow: none; color: var(--muted); min-height: 150px; }
.pcard.add:hover { border-color: var(--plum-300); color: var(--plum-700); transform: none; box-shadow: none; }
.pcard.add .add-ic { width: 30px; height: 30px; border-radius: 999px; border: 1px solid var(--border); display: grid; place-items: center; }
.pcard.add .add-lbl { font-size: 12.5px; font-weight: 500; }

/* ============================================================
   HOME — collaboration layer (menus, cards, modals, share)
   ============================================================ */
.home-actions { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.new-grp { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 500; color: var(--heading); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 8px 14px; cursor: pointer; }
.new-grp:hover { border-color: var(--border-strong); background: var(--surface-2); }
.new-grp .ic { width: 15px; height: 15px; color: var(--muted); }

/* project card becomes a positioned div (was a button) */
.pcard { position: relative; }
.pcard.menu-open { z-index: 2; }
.pc-top-right { display: flex; align-items: center; gap: var(--sp-3); }
/* corner status dot — quiet pill-free signal. Mirrors `.st` color tokens. */
.pc-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--faint); flex: none; }
.pc-dot.live { background: var(--ok); box-shadow: 0 0 0 2.5px var(--ok-surface); animation: pulse 1.8s var(--ease) infinite; }
.pc-dot.building, .pc-dot.training, .pc-dot.running { background: var(--plum); box-shadow: 0 0 0 2.5px var(--plum-50); animation: pulse 1.4s var(--ease) infinite; }
.pc-dot.drifting, .pc-dot.paused { background: var(--warn); box-shadow: 0 0 0 2.5px var(--warn-surface); }
.pc-dot.error, .pc-dot.failed, .pc-dot.blocked { background: var(--alert); box-shadow: 0 0 0 2.5px var(--alert-surface); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
@keyframes pulse-plum { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: auto; padding-top: var(--sp-4); }
.pc-when { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); min-width: 0; }
.pc-when .ic { color: var(--faint); }
.pc-scored { color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-nudge { color: var(--plum-700); white-space: nowrap; cursor: pointer; font-weight: 500; }
.pc-nudge:hover { text-decoration: underline; }
.pc-just-you { font-family: var(--font-mono); font-size: 10.5px; color: var(--faint); }
.pc-avstack { display: flex; align-items: center; }
.pc-av { width: 22px; height: 22px; border-radius: 999px; border: 1.5px solid var(--surface); margin-left: -7px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 10px; color: var(--plum-on); flex: none; }
.pc-av:first-child { margin-left: 0; }
.pc-av.more { background: var(--surface-2); color: var(--muted); border-color: var(--surface); font-family: var(--font-mono); font-weight: 500; }
.folder-shared { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 600; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-pill); padding: 3px 9px; }
.folder-shared .ic { width: 12px; height: 12px; }
.folder-head .kebab-wrap { margin-left: var(--sp-2); }

/* kebab button + popover menu */
.kebab-wrap { position: relative; display: inline-flex; }
.kebab { width: 26px; height: 26px; display: grid; place-items: center; border-radius: var(--r-md); border: 1px solid transparent; background: none; color: var(--faint); cursor: pointer; opacity: 0; transition: opacity .12s, background .12s, color .12s; }
.pcard:hover .kebab, .folder-head:hover .kebab, .kebab.on { opacity: 1; }
.kebab:hover, .kebab.on { background: var(--surface-2); border-color: var(--border); color: var(--heading); }
.kebab .ic { width: 16px; height: 16px; }
.cmenu-scrim { position: fixed; inset: 0; z-index: 60; }
.cmenu { position: absolute; top: calc(100% + 6px); z-index: 61; min-width: 200px; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in .12s ease; }
.cmenu.right { right: 0; } .cmenu.left { left: 0; }
.cmenu-item { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 8px var(--sp-3); border-radius: var(--r-md); border: none; background: none; cursor: pointer; text-align: left; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--heading); }
.cmenu-item:hover { background: var(--surface-2); }
.cmenu-item .ic { width: 15px; height: 15px; color: var(--muted); flex: none; }
.cmenu-item.danger { color: var(--danger, oklch(0.55 0.15 25)); }
.cmenu-item.danger .ic { color: currentColor; }
.cmenu-item.danger:hover { background: oklch(0.95 0.03 25); }
.cmenu-sep { height: 1px; background: var(--border-soft); margin: var(--sp-3) 0; }

/* ---------- modal shell ---------- */
.mdl-scrim { position: fixed; inset: 0; z-index: 80; background: oklch(0.30 0.02 60 / 0.34); backdrop-filter: blur(2px); display: grid; place-items: center; padding: var(--sp-6); animation: fade-in .14s ease; }
@keyframes fade-in { from { opacity: 0; } }
.mdl { width: 480px; max-width: 100%; max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); overflow: hidden; animation: mdl-in .16s cubic-bezier(.2,.8,.3,1); }
.mdl.wide { width: 560px; }
@keyframes mdl-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.mdl-head { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-6) var(--sp-6) var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.mdl-ico { width: 34px; height: 34px; flex: none; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; }
.mdl-ico .ic { width: 18px; height: 18px; }
.mdl-htext { flex: 1; min-width: 0; }
.mdl-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; color: var(--ink); margin: 2px 0 0; }
.mdl-sub { font-size: 12.5px; color: var(--muted); margin: var(--sp-2) 0 0; line-height: var(--lh-snug); }
.mdl-x { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--muted); cursor: pointer; }
.mdl-x .ic { width: 15px; height: 15px; }
.mdl-x:hover { background: var(--surface-2); color: var(--heading); }
.mdl-body { padding: var(--sp-6); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-5); }
.mdl-foot { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); padding: var(--sp-5) var(--sp-6); border-top: 1px solid var(--border-soft); background: var(--surface-2); }
.mdl-foot .mbtn.link { margin-right: auto; }

/* buttons inside modals */
.mbtn { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 13px; font-weight: 500; padding: 9px 16px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--heading); cursor: pointer; }
.mbtn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.mbtn.sm { padding: 8px 13px; font-size: 12.5px; }
.mbtn .ic { width: 15px; height: 15px; }
.mbtn.primary { background: var(--plum); border-color: var(--plum); color: var(--plum-on); }
.mbtn.primary:hover { background: var(--plum-600); border-color: var(--plum-600); }
.mbtn.primary:disabled { opacity: 0.45; cursor: default; background: var(--plum); border-color: var(--plum); }
.mbtn.ghost { border-color: transparent; background: none; color: var(--muted); }
.mbtn.ghost:hover { background: var(--surface-2); color: var(--heading); }
.mbtn.danger { background: oklch(0.55 0.16 25); border-color: oklch(0.55 0.16 25); color: #fff; }
.mbtn.danger:hover { background: oklch(0.49 0.16 25); border-color: oklch(0.49 0.16 25); }

/* ---------- form fields ---------- */
.fld { display: flex; flex-direction: column; gap: var(--sp-3); }
.fld-lbl { font-size: 12px; font-weight: 600; color: var(--heading); display: flex; align-items: baseline; gap: var(--sp-3); }
.fld-hint { font-size: 11px; font-weight: 400; color: var(--faint); }
.inp { font: inherit; font-size: 13.5px; color: var(--ink); padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); width: 100%; }
.inp::placeholder { color: var(--faint); }
.inp:focus { outline: none; border-color: var(--plum-300); box-shadow: var(--ring); }
.inp.sel { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; cursor: pointer; }

/* model-kind picker */
.kind-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.kind-opt { text-align: left; display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; }
.kind-opt:hover { border-color: var(--border-strong); background: var(--surface-2); }
.kind-opt.on { border-color: var(--plum); background: var(--plum-50); box-shadow: var(--ring); }
.kind-ic { width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--plum); display: grid; place-items: center; }
.kind-opt.on .kind-ic { background: var(--surface); border-color: var(--plum-200); }
.kind-ic .ic { width: 16px; height: 16px; }
.kind-t { font-weight: 600; font-size: 13px; color: var(--heading); }
.kind-b { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* confirm / delete */
.confirm-body { font-size: 13.5px; color: var(--heading); line-height: var(--lh-snug); margin: 0; }
.del-choice { display: flex; flex-direction: column; gap: var(--sp-3); }
.del-opt { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.del-opt b { color: var(--heading); font-weight: 600; }
.del-opt.on { border-color: var(--plum-300); background: var(--plum-50); }
.del-opt input { margin-top: 2px; accent-color: var(--plum); }

/* ---------- share dialog ---------- */
.invite { position: relative; display: flex; gap: var(--sp-3); }
.invite-inp { flex: 1; display: flex; align-items: center; gap: var(--sp-3); padding: 4px 6px 4px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); }
.invite-inp:focus-within { border-color: var(--plum-300); box-shadow: var(--ring); }
.invite-inp > .ic { width: 16px; height: 16px; color: var(--muted); flex: none; }
.inp.bare { border: none; padding: 8px 0; flex: 1; box-shadow: none; }
.inp.bare:focus { box-shadow: none; }
.role-sel { appearance: none; font: inherit; font-size: 12px; font-weight: 500; color: var(--heading); border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; padding: 5px 22px 5px 9px; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.role-sel:hover { background-color: var(--surface-2); border-color: var(--border); }
.role-sel.small { flex: none; border-left: 1px solid var(--border-soft); border-radius: 0; }
.sug { position: absolute; top: calc(100% + 6px); left: 0; right: 92px; z-index: 5; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-pop); padding: var(--sp-2); }
.sug-row { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 7px var(--sp-3); border: none; background: none; border-radius: var(--r-sm); cursor: pointer; font: inherit; text-align: left; }
.sug-row:hover { background: var(--surface-2); }
.sug-name { font-size: 12.5px; font-weight: 500; color: var(--heading); }
.sug-mail { font-size: 11px; color: var(--faint); margin-left: auto; }
.share-sec-lbl { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); }
.people { display: flex; flex-direction: column; gap: 2px; margin-top: calc(-1 * var(--sp-3)); }
.prow { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) 0; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: var(--r-pill); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum-700); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 13px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.prow-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prow-name { font-size: 13px; font-weight: 600; color: var(--heading); display: flex; align-items: center; gap: var(--sp-3); }
.you-tag { font-family: var(--font-mono); font-size: 9px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-pill); padding: 1px 6px; }
.prow-mail { font-size: 11.5px; color: var(--faint); }
.role-fixed { font-size: 12px; font-weight: 500; color: var(--muted); padding-right: 9px; }
.gen-access { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface-2); margin-top: calc(-1 * var(--sp-3)); }
.gen-ic { width: 32px; height: 32px; flex: none; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--border); color: var(--muted); display: grid; place-items: center; }
.gen-ic .ic { width: 16px; height: 16px; }
.gen-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gen-sel { appearance: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--heading); border: none; background: transparent; cursor: pointer; padding: 0 20px 0 0; align-self: flex-start; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='11' height='11' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right center; }
.gen-note { font-size: 11.5px; color: var(--muted); }

/* ============================================================
   PROJECT RAIL — chat + tabs
   ============================================================ */
.rail { border-right: 1px solid var(--border-soft); background: var(--surface); display: flex; flex-direction: column; padding: var(--sp-4) var(--sp-4) var(--sp-5); gap: 2px; min-height: 0; overflow-y: auto; }

.rail-chat { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface-2); cursor: pointer; text-align: left; font: inherit; margin-bottom: var(--sp-3); transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.rail-chat:hover { border-color: var(--plum-200); }
.rail-chat[data-on="1"] { background: var(--plum-50); border-color: var(--plum-300); box-shadow: var(--ring); }
.rc-ic { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--plum); color: var(--plum-on); display: grid; place-items: center; flex: none; }
.rc-ic .ic { width: 16px; height: 16px; }
.rc-body { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.rc-title { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.rc-sub { font-size: 10px; color: var(--muted); font-family: var(--font-mono); }
.rc-sub { font-family: var(--font-mono); }
.rail-chat .rc-sub { font-family: var(--font-mono); font-size: 9.5px; color: var(--muted); margin-top: 2px; }

.rail-sec { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); padding: var(--sp-4) var(--sp-3) var(--sp-2); }
.rail-tabs { display: flex; flex-direction: column; gap: 2px; }
.rail-tab { display: flex; align-items: center; gap: var(--sp-4); padding: 9px var(--sp-4); border-radius: var(--r-md); font-size: 13.5px; font-weight: 500; color: var(--muted); background: none; border: none; cursor: pointer; text-align: left; width: 100%; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.rail-tab:hover { background: var(--surface-2); color: var(--heading); }
.rail-tab[data-on="1"] { background: var(--plum-50); color: var(--plum-700); }
.rail-tab .ic { width: 18px; height: 18px; flex: none; }
.rail-tab[data-on="1"] .ic { color: var(--plum); }
.rt-lbl { flex: 1; }

/* ---- build controls (effort ramp + Deep Solve) — pinned to the bottom of the rail. Its top
   rule is full-bleed (bled past the rail's horizontal padding to the column edges) so it reads
   as ONE continuous line with the chat composer's top border, straight across the whole app.
   No card, no "BUILD" label — the controls sit directly in the rail section. ---- */
.rail-build { margin: auto calc(-1 * var(--sp-4)) 0; padding: 0 var(--sp-4); border-top: 1px solid var(--border-soft); }

/* effort — label row + Auto chip + graduated dot ramp */
.eff { padding: 10px var(--sp-4) 8px; }
.eff-lbl { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); margin-bottom: 8px; }
.eff-name { font-size: 11.5px; font-weight: 600; color: var(--heading); }
.eff-val { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: var(--plum-700); }
.eff-val[data-auto="1"] { color: var(--faint); font-size: 9.5px; letter-spacing: 0.06em; text-transform: uppercase; }

.eff-ramp { display: flex; align-items: center; gap: var(--sp-3); }
.eff-auto { font: inherit; font-family: var(--font-mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px 9px; cursor: pointer; flex: none; transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.eff-auto:hover { border-color: var(--border-strong); color: var(--heading); }
.eff-auto[data-on="1"] { background: var(--plum); border-color: var(--plum); color: var(--plum-on); }

.eff-dots { display: flex; align-items: center; flex: 1; }
.eff-dot { flex: 1; display: grid; place-items: center; padding: 6px 0; border: none; background: none; cursor: pointer; }
.eff-dot > i { display: block; border-radius: 999px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); transition: background var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.eff-dot[data-lvl="1"] > i { width: 6px; height: 6px; }
.eff-dot[data-lvl="2"] > i { width: 8px; height: 8px; }
.eff-dot[data-lvl="3"] > i { width: 10px; height: 10px; }
.eff-dot[data-lvl="4"] > i { width: 12px; height: 12px; }
.eff-dot[data-on="1"] > i { background: var(--plum); box-shadow: inset 0 0 0 1px var(--plum); }
.eff-dots[data-auto="1"] .eff-dot > i { background: var(--plum-50); box-shadow: inset 0 0 0 1px var(--plum-200); }
.eff-dot:hover > i { transform: scale(1.18); }

/* Deep Solve — compact single-row toggle with a "?" popover (positioned relative to the row so
   the popover stays inside the rail, which clips overflow) */
.fsw { position: relative; display: flex; align-items: center; gap: var(--sp-3); padding: 7px var(--sp-4) 7px; border-radius: var(--r-md); transition: background var(--dur-fast) var(--ease); }
.fsw:hover { background: color-mix(in oklch, var(--plum) 4%, var(--surface-2)); }
.fsw-ic { width: 22px; height: 22px; border-radius: var(--r-sm); display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--muted); transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.fsw-ic .ic { width: 13px; height: 13px; }
.fsw[data-on="1"] .fsw-ic { background: var(--plum); color: var(--plum-on); }
.fsw-name { font-size: 12.5px; font-weight: 600; color: var(--heading); white-space: nowrap; cursor: pointer; }
.fsw-sp { flex: 1; }
.fsw .toggle { flex: none; }
.fsw[data-on="1"] .toggle { background: var(--plum); border-color: var(--plum); }
.fsw[data-on="1"] .toggle i { transform: translateX(14px); }

/* chat-mode segmented control (Agent / Quick) — sits under Deep Solve in the build rail */
.chatmode { display: flex; align-items: center; gap: var(--sp-3); padding: 4px var(--sp-4) 8px; }
.cm-lbl { font-size: 12.5px; font-weight: 600; color: var(--heading); white-space: nowrap; }
.cm-sp { flex: 1; }
.cm-seg { flex: none; display: inline-flex; padding: 2px; border-radius: var(--r-pill); background: var(--surface-3); }
.cm-opt { border: none; background: transparent; font-size: 11px; font-weight: 600; color: var(--muted); padding: 3px 10px; border-radius: var(--r-pill); cursor: pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.cm-opt:hover { color: var(--heading); }
.cm-opt.on { background: var(--plum); color: var(--plum-on); }

/* the "?" affordance + its hover/focus popover */
.infotip { flex: none; display: inline-grid; place-items: center; cursor: help; outline: none; }
.infotip-q { width: 14px; height: 14px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--faint); font-family: var(--font-mono); font-size: 9px; font-weight: 700; line-height: 1; display: grid; place-items: center; transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.infotip:hover .infotip-q, .infotip:focus-visible .infotip-q { border-color: var(--plum); color: var(--plum); }
.infotip-pop { position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: calc(100% + 8px); padding: 9px 11px; background: var(--ink); color: var(--paper); font-family: var(--font-sans); font-size: 11px; font-weight: 400; line-height: 1.45; letter-spacing: 0; text-transform: none; text-align: left; border-radius: var(--r-md); box-shadow: var(--shadow-pop); opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); z-index: 60; pointer-events: none; }
.infotip:hover .infotip-pop, .infotip:focus-visible .infotip-pop { opacity: 1; visibility: visible; transform: translateY(0); }
.infotip-pop::after { content: ""; position: absolute; top: 100%; left: 108px; border: 5px solid transparent; border-top-color: var(--ink); }

/* ============================================================
   CHAT thread (single column) + rail conversation list
   ============================================================ */
.chat-frame { height: 100%; min-height: 0; display: flex; position: relative; overflow: hidden; }
.chat { height: 100%; flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; min-height: 0; }

/* Claude-Code-style panel bar: title left · history + new chat right */
.chat-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-3) var(--sp-6); border-bottom: 1px solid var(--border-soft); background: var(--paper); }
.cb-title { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--heading); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-actions { display: flex; align-items: center; gap: var(--sp-3); flex: none; }
.cb-btn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 500; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 6px 10px; cursor: pointer; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.cb-btn:hover { border-color: var(--border-strong); color: var(--heading); background: var(--surface-2); }
.cb-btn.primary { color: var(--plum-on); background: var(--plum); border-color: var(--plum); }
.cb-btn.primary:hover { background: var(--plum-600); }
.hist { position: relative; }
.hist-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 51; width: 292px; padding: var(--sp-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); animation: pop-in 0.16s var(--ease-out); }
.hist-menu-lbl { font-family: var(--font-display); font-size: 12px; font-weight: 600; color: var(--muted); padding: var(--sp-3) var(--sp-3) var(--sp-2); }
.hist-item { display: flex; align-items: flex-start; gap: var(--sp-3); width: 100%; padding: 8px var(--sp-3); border-radius: var(--r-md); border: none; background: none; cursor: pointer; text-align: left; font: inherit; }
.hist-item:hover { background: var(--surface-2); }
.hist-item[data-on="1"] { background: var(--plum-50); }
.hi-ic { width: 14px; height: 14px; color: var(--faint); flex: none; }
.hist-item[data-on="1"] .hi-ic { color: var(--plum); }
.hi-ic { margin-top: 2px; }
.hi-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hi-title { font-size: 12.5px; font-weight: 500; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist-item[data-on="1"] .hi-title { color: var(--plum-700); }
.hi-prev { font-size: 11px; color: var(--muted); line-height: var(--lh-snug); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-when { font-family: var(--font-mono); font-size: 9.5px; color: var(--faint); }

.chat-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.chat-inner { max-width: 780px; margin: 0 auto; padding: var(--sp-6) var(--sp-8) var(--sp-6); }
.chat-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-3); padding: var(--sp-12) var(--sp-6); margin: auto 0; }
.chat-empty .ce-ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; margin-bottom: var(--sp-3); background: linear-gradient(140deg, var(--plum-400), var(--plum-700)); color: white; box-shadow: 0 4px 14px color-mix(in oklch, var(--plum) 30%, transparent), inset 0 1px 0 color-mix(in oklch, white 22%, transparent); }
.chat-empty .ce-ic .ic { width: 26px; height: 26px; }
.chat-empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 22px; letter-spacing: -0.015em; color: var(--ink); margin: 0; }
.chat-empty p { font-size: 13.5px; color: var(--muted); line-height: var(--lh-snug); margin: 0; max-width: 36em; }
/* ---- empty-chat starters: one-tap examples of what MODARA can answer ---- */
.ce-suggest { width: 100%; max-width: 760px; margin-top: var(--sp-6); display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--sp-5); text-align: left; }
.ce-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.ce-group-t { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; color: var(--muted); padding-left: 2px; margin-bottom: 2px; }
.ce-chip { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left; padding: 9px 11px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; cursor: pointer; color: var(--heading); font-size: 13px; line-height: 1.3; box-shadow: var(--shadow-xs); transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); }
.ce-chip:hover { border-color: var(--plum); background: var(--surface-2); transform: translateY(-1px); }
.ce-chip-ic { flex: none; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--plum); background: color-mix(in oklch, var(--plum) 12%, transparent); }
.ce-chip-ic .ic { width: 15px; height: 15px; }
/* a distinct accent per starter group — the chips read as a menu of capabilities, not one wall */
.ce-group:nth-child(3n+2) .ce-chip-ic { color: var(--info); background: color-mix(in oklch, var(--info) 12%, transparent); }
.ce-group:nth-child(3n+3) .ce-chip-ic { color: var(--warn); background: color-mix(in oklch, var(--warn) 14%, transparent); }
.ce-chip-q { flex: 1; min-width: 0; }
/* ---- Chat empty-state: "upload your data first" call-to-action ---- */
.ce-upload-btn { margin-top: var(--sp-5); display: inline-flex; align-items: center; gap: var(--sp-2); padding: 10px 18px; border: 0; border-radius: 10px; cursor: pointer; font-size: 13.5px; font-weight: 500; color: white; background: linear-gradient(140deg, var(--plum-400), var(--plum-700)); box-shadow: 0 4px 14px color-mix(in oklch, var(--plum) 28%, transparent), inset 0 1px 0 color-mix(in oklch, white 20%, transparent); transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.ce-upload-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px color-mix(in oklch, var(--plum) 34%, transparent), inset 0 1px 0 color-mix(in oklch, white 20%, transparent); }
.ce-upload-btn .ic { width: 16px; height: 16px; }
.chat-empty .ce-loading { color: var(--muted); font-style: italic; }
/* Project-side details are optional, durable context — never a second voice in the transcript. */
.project-drawer { flex: 0 0 304px; display: flex; flex-direction: column; overflow-y: auto; border-left: 1px solid var(--border-soft); background: var(--surface); padding: var(--sp-5); box-shadow: -10px 0 28px color-mix(in oklch, var(--ink) 4%, transparent); }
.project-drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--sp-4); padding-bottom: var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.project-drawer-kicker { display: block; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.project-drawer h2 { margin: 4px 0 0; font-family: var(--font-display); font-size: 18px; font-weight: 500; line-height: 1.15; color: var(--heading); overflow-wrap: anywhere; }
.project-drawer-close { flex: none; width: 28px; height: 28px; border: 1px solid var(--border-soft); border-radius: var(--r-sm); background: transparent; color: var(--muted); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; }
.project-drawer-close:hover { background: var(--surface-2); color: var(--heading); border-color: var(--border-strong); }
.project-drawer-empty { margin: var(--sp-5) 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.project-drawer-section { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-5) 0; border-bottom: 1px solid var(--border-soft); }
.project-drawer-section:last-child { border-bottom: 0; }
.project-drawer-section h3 { margin: 0; color: var(--faint); font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.project-detail { display: grid; grid-template-columns: 1fr auto; gap: 3px var(--sp-3); }
.project-detail > span { font-size: 11px; color: var(--muted); }
.project-detail strong { grid-column: 1 / -1; color: var(--heading); font-size: 12.5px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.project-detail em { grid-column: 1 / -1; color: var(--warn-text); font-size: 10.5px; font-style: normal; }
.project-context-gaps { margin-top: 10px; color: var(--muted); font-size: 11px; }
.project-context-gaps > span { display: block; margin-bottom: 4px; }
.project-context-gaps ul { margin: 0; padding-left: 17px; line-height: 1.5; }
.project-drawer-note { display: block; margin-top: 10px; color: var(--muted); line-height: 1.4; }
.project-need, .project-source { display: flex; align-items: center; gap: var(--sp-3); width: 100%; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--heading); cursor: pointer; font: inherit; text-align: left; padding: 7px 6px; margin: 0 -6px; }
.project-need:hover, .project-source:hover { background: var(--surface-2); }
.project-need > span, .project-source > span { flex: 1; min-width: 0; font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.project-need > .ic, .project-source > .ic { width: 14px; height: 14px; flex: none; color: var(--plum); }
.project-source { text-decoration: none; }
.project-source > .ic:first-child { color: var(--muted); }
.project-activity { display: flex; flex-direction: column; gap: 8px; margin: 0; padding: 0; list-style: none; }
.project-activity li { position: relative; padding-left: 13px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.project-activity li::before { content: ""; position: absolute; top: .5em; left: 0; width: 5px; height: 5px; border-radius: 50%; background: var(--plum); }
.project-recommendation { background: var(--ok-surface); margin: var(--sp-5) calc(-1 * var(--sp-2)) 0; padding: var(--sp-4); border: 1px solid var(--ok-border); border-radius: var(--r-md); }
.project-recommendation p { margin: 0; color: var(--heading); font-size: 12.5px; line-height: 1.5; }
.project-recommendation small { color: var(--muted); font-size: 10.5px; line-height: 1.4; }

@container (max-width: 880px) {
  .project-drawer { position: absolute; inset: 0 0 0 auto; z-index: 20; width: min(340px, 100%); flex-basis: auto; box-shadow: var(--shadow-pop); }
}
/* ---- Chat empty-state: "reading your data" wait + "ready" confirmation ---- */
.chat-empty .ce-ic.reading { background: linear-gradient(140deg, var(--plum-400), var(--plum-700)); animation: cePulse 1.7s var(--ease-out) infinite; }
@keyframes cePulse {
  0%, 100% { box-shadow: 0 4px 14px color-mix(in oklch, var(--plum) 30%, transparent), 0 0 0 0 color-mix(in oklch, var(--plum) 34%, transparent), inset 0 1px 0 color-mix(in oklch, white 22%, transparent); }
  55%      { box-shadow: 0 4px 14px color-mix(in oklch, var(--plum) 30%, transparent), 0 0 0 9px transparent, inset 0 1px 0 color-mix(in oklch, white 22%, transparent); }
}
.chat-empty .ce-ic.ready { background: linear-gradient(140deg, color-mix(in oklch, var(--ok-text) 78%, white), var(--ok-text)); box-shadow: 0 4px 14px color-mix(in oklch, var(--ok-text) 26%, transparent), inset 0 1px 0 color-mix(in oklch, white 24%, transparent); animation: fadev 0.3s var(--ease-out) both; }
.ce-reading-status { display: inline-flex; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); font-size: 12.5px; color: var(--muted); }
/* ---- Models tab: the project's models list ---- */
.model-list { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-5); }
.model-row { border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; transition: border-color var(--dur-fast) var(--ease); }
.model-row.active { border-color: var(--plum); box-shadow: 0 0 0 1px color-mix(in oklch, var(--plum) 40%, transparent), var(--shadow-xs); }
.mr-head { display: flex; align-items: center; gap: var(--sp-3); padding: 12px 14px; cursor: pointer; }
.mr-head:hover { background: var(--surface-2); }
.mr-caret { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 6px; }
.mr-caret:hover { background: color-mix(in oklch, var(--plum) 12%, transparent); color: var(--plum); }
.mr-name { flex: 1; min-width: 0; font-weight: 500; color: var(--heading); font-size: 14px; display: flex; align-items: center; gap: var(--sp-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mr-badge { flex: none; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--plum); background: color-mix(in oklch, var(--plum) 14%, transparent); padding: 2px 7px; border-radius: 999px; }
.mr-metric { flex: none; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--ink); min-width: 44px; text-align: right; }
.mr-pr { flex: none; display: inline-flex; align-items: center; gap: 5px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--heading); font-size: 12px; cursor: pointer; }
.mr-pr:hover { border-color: var(--plum); color: var(--plum); }
.mr-detail { padding: 4px 16px 16px 40px; border-top: 1px solid var(--border); }
/* ---- Report tab: the real composed markdown document ---- */
.report-doc { color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: var(--sp-6); max-width: 880px; box-shadow: var(--shadow-xs); font-family: var(--font-body, "Inter", system-ui, sans-serif); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.report-doc > :first-child { margin-top: 0; }
.report-doc > :last-child { margin-bottom: 0; }
.report-doc h1, .report-doc h2, .report-doc h3, .report-doc h4, .report-doc h5, .report-doc h6 { font-family: var(--font-display, "Inter", system-ui, sans-serif); font-weight: 600; letter-spacing: -0.01em; color: var(--ink); margin: 1.6em 0 0.5em; line-height: 1.25; }
.report-doc h1 { font-size: 24px; margin-top: 0; }
.report-doc h2 { font-size: 19px; border-bottom: 1px solid var(--border-soft); padding-bottom: 6px; }
.report-doc h3 { font-size: 16px; }
.report-doc h4, .report-doc h5, .report-doc h6 { font-size: 14px; }
.report-doc p { margin: 0 0 0.9em; }
.report-doc strong { font-weight: 600; color: var(--ink); }
.report-doc em { font-style: italic; }
.report-doc code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 0.88em; background: color-mix(in oklch, var(--surface-2, var(--bg-2, var(--border))) 70%, transparent); border: 1px solid var(--border-soft); border-radius: 4px; padding: 1px 5px; }
.report-doc pre.md-codeblock { background: var(--bg-2, var(--surface-2, var(--surface))); border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px; overflow-x: auto; margin: 0 0 1em; }
.report-doc pre.md-codeblock code { background: transparent; border: none; padding: 0; font-size: 12.5px; line-height: 1.55; }
.report-doc ul, .report-doc ol { margin: 0 0 0.9em; padding-left: 1.4em; }
.report-doc li { margin-bottom: 0.25em; }
.report-doc li > p { margin-bottom: 0.4em; }
.report-doc blockquote { margin: 0 0 0.9em; padding: 6px 14px; border-left: 3px solid var(--plum, var(--accent, currentColor)); background: color-mix(in oklch, var(--surface-2, var(--bg-2, var(--surface))) 60%, transparent); border-radius: 0 6px 6px 0; color: var(--muted); }
.report-doc blockquote p:last-child { margin-bottom: 0; }
.report-doc hr { border: none; border-top: 1px solid var(--border-soft); margin: 1.6em 0; }
.report-doc a { color: var(--plum, var(--accent, currentColor)); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.report-doc a:hover { text-decoration-thickness: 2px; }
.md-table-wrap { overflow-x: auto; margin: 0 0 1em; border: 1px solid var(--border); border-radius: 8px; }
.report-doc table.md-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report-doc table.md-table th, .report-doc table.md-table td { padding: 7px 10px; text-align: left; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.report-doc table.md-table thead th { background: color-mix(in oklch, var(--surface-2, var(--bg-2, var(--surface))) 75%, transparent); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--border); }
.report-doc table.md-table tbody tr:last-child td { border-bottom: none; }
.report-doc table.md-table tbody tr:hover { background: color-mix(in oklch, var(--surface-2, var(--bg-2, var(--surface))) 40%, transparent); }
.report-editor { width: 100%; max-width: 880px; min-height: 60vh; resize: vertical; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; line-height: 1.6; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: var(--sp-5); box-shadow: var(--shadow-xs); outline: none; transition: border-color 120ms ease, box-shadow 120ms ease; tab-size: 2; }
.report-editor:focus { border-color: var(--plum, var(--accent, currentColor)); box-shadow: 0 0 0 3px color-mix(in oklch, var(--plum, var(--accent, currentColor)) 18%, transparent); }
.report-doc-empty { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); text-align: center; color: var(--muted); padding: var(--sp-8) var(--sp-6); max-width: 460px; margin: var(--sp-6) auto; }
.report-doc-empty p { font-size: 13.5px; line-height: var(--lh-snug); margin: 0; }
/* ---- Live-run: honest generic build-progress stepper ---- */
.run-steps { margin-top: var(--sp-6); display: flex; flex-direction: column; max-width: 640px; }
.run-step { display: flex; gap: var(--sp-3); padding: var(--sp-4) 0; }
.run-step + .run-step { border-top: 1px solid color-mix(in oklch, var(--border-soft) 70%, transparent); }
.rstep-dot { flex: none; width: 22px; height: 22px; border-radius: 999px; display: grid; place-items: center; border: 1.5px solid var(--border); color: var(--plum); margin-top: 1px; }
.run-step.done .rstep-dot { background: color-mix(in oklch, var(--plum) 14%, transparent); border-color: transparent; }
.run-step.active .rstep-dot { border-color: var(--plum); }
.run-step.todo .rstep-dot { opacity: 0.45; }
.rstep-body { flex: 1; min-width: 0; }
.rstep-label { font-size: 14px; font-weight: 500; color: var(--heading); }
.run-step.todo .rstep-label { color: var(--muted); font-weight: 400; }
.rstep-line { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
/* ---- charts: SVG/CSS, CSP-safe (Visualisations tab + chat ChartCard) ---- */
.viz-ask { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap; }
.viz-ask input { flex: 1; min-width: 220px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 13.5px; }
.viz-ask input:focus { outline: none; border-color: var(--plum); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--sp-4); }
.chart-card { border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: var(--sp-4); box-shadow: var(--shadow-xs); min-width: 0; }
.ai-answer + .chart-card, .thread .chart-card { margin-top: var(--sp-3); max-width: 520px; }
.chart-head { display: flex; align-items: center; gap: var(--sp-2); font-size: 12.5px; font-weight: 600; color: var(--heading); margin-bottom: var(--sp-3); }
.chart-head .ic { color: var(--plum); }
.ch-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chart-act { flex: none; width: 26px; height: 26px; border-radius: 999px; border: none; background: transparent; color: var(--faint); cursor: pointer; display: grid; place-items: center; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.chart-act:hover { background: var(--surface-2); color: var(--plum); }
.chart-act:disabled { color: var(--ok-text); cursor: default; background: transparent; }
.chart-note { font-size: 11.5px; color: var(--muted); margin-top: var(--sp-2); line-height: var(--lh-snug); }
.chart-code { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 10.5px; color: var(--muted); margin-top: 6px; white-space: pre-wrap; word-break: break-all; opacity: 0.85; }
.chart-rows { display: flex; flex-direction: column; gap: 6px; }
.chart-row { display: grid; grid-template-columns: minmax(56px, 34%) 1fr auto; align-items: center; gap: var(--sp-3); }
.chart-rlabel { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; color: var(--heading); }
.chart-rbar { height: 10px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.chart-rbar i { display: block; height: 100%; background: var(--plum); border-radius: 999px; }
.chart-row.hi .chart-rbar i { background: linear-gradient(90deg, var(--plum-400), var(--plum-700)); }
.chart-rval { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11px; color: var(--muted); }
.chart-wrap { width: 100%; }
.chart-wrap.sq { max-width: 240px; margin: 0 auto; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-bar { fill: var(--plum); }
.chart-line { stroke: var(--plum); stroke-width: 2; fill: none; }
.chart-dot { fill: var(--plum); }
.chart-dot.dim { fill: color-mix(in oklch, var(--plum) 50%, transparent); }
.chart-diag { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-axis { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: 10.5px; color: var(--muted); margin-top: 4px; }
/* grouped / pivot bars: a legend of series + evenly-spaced group labels under each cluster */
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px var(--sp-4); margin-bottom: 6px; }
.cl-item { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--body); }
.cl-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.chart-axis.grouped { justify-content: flex-start; gap: 0; }
.chart-axis.grouped span { flex: 1 1 0; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }

/* ---- print-grade figure chrome (title / subtitle / axis / source / generated footer) ----
   Token-driven so the SVG export bakes the same colors — see
   docs/open-issues/professional_visualisations.md. */
.chart-figure { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.chart-figure .fig-svg { width: 100%; height: auto; display: block; }
.chart-figure .fig-svg text { font-family: var(--font-sans); }
.chart-figure .fig-title { font-family: var(--font-display); font-size: 16px; font-weight: 600; color: var(--fig-title); line-height: 1.25; letter-spacing: -0.005em; margin: 0; }
.chart-figure .fig-subtitle { font-family: var(--font-sans); font-size: 12px; color: var(--fig-subtitle); margin: 0; line-height: 1.4; }
.chart-figure .fig-axis { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: 11px; color: var(--fig-axis); margin-top: 4px; }
.chart-figure .fig-axis .fa-ax { font-weight: 700; color: var(--muted); margin-right: 2px; }
.chart-figure .fig-axis.grouped { justify-content: flex-start; gap: 0; }
.chart-figure .fig-axis.grouped span { flex: 1 1 0; min-width: 0; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.chart-figure .fig-source { font-size: 10.5px; color: var(--fig-foot); letter-spacing: var(--ls-label); text-transform: uppercase; margin-top: var(--sp-3); border-top: 1px solid var(--fig-rule); padding-top: 6px; display: flex; justify-content: space-between; gap: var(--sp-3); }
.chart-figure .fig-source .src-right { color: var(--faint); font-family: var(--font-mono); text-transform: none; letter-spacing: 0; }
.chart-figure .fig-note { font-size: 11.5px; color: var(--fig-note); line-height: var(--lh-snug); margin-top: 6px; font-style: italic; }
/* legend chips inside the figure SVG */
.chart-figure .fig-legend { display: flex; flex-wrap: wrap; gap: 6px var(--sp-4); margin: 4px 0; }
.chart-figure .fig-legend .cl-item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--body); }
.chart-figure .fig-legend .cl-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
/* ---- click-to-enlarge: the tile body is a zoom target, the lightbox is a fixed overlay ---- */
.chart-clickzone { cursor: zoom-in; border-radius: var(--r-sm); }
.chart-clickzone:focus-visible { outline: 2px solid var(--plum); outline-offset: 2px; }
.chart-lightbox { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  padding: clamp(16px, 4vw, 48px); background: color-mix(in srgb, var(--ink) 62%, transparent);
  backdrop-filter: blur(3px); animation: fadein var(--dur-fast) var(--ease); }
.chart-lightbox-card { position: relative; width: min(1100px, 94vw); max-height: 92vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg, 0 24px 64px rgba(0,0,0,.35)); padding: var(--sp-5) var(--sp-6) var(--sp-6); }
.chart-lightbox-bar { position: sticky; top: 0; display: flex; justify-content: flex-end; gap: 2px; margin-bottom: var(--sp-2); }
.chart-lightbox-close:hover { color: var(--err-text, #b4442f); }
.chart-lightbox-body { width: 100%; }
.chart-lightbox-body .chart-svg { width: 100%; height: auto; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
/* ---- suggested-chart menu — problem-appropriate prompts drawn on click ---- */
.viz-suggest { margin-top: var(--sp-4); }
.viz-suggest-lab { display: block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); margin-bottom: var(--sp-2); }
.viz-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.viz-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px 12px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.viz-chip .ic { color: var(--faint); }
.viz-chip:hover { border-color: var(--plum-200); color: var(--plum-700); background: var(--plum-50); }
.viz-chip:hover .ic { color: var(--plum); }
.viz-chip:disabled { opacity: 0.5; cursor: default; }
/* the "Download" menu anchor — appears next to the existing pin/remove buttons.
   It's a button that toggles a small popup with PNG / SVG rows. */
.chart-export { position: relative; }
.chart-export-menu { position: absolute; top: 32px; right: 0; z-index: 30; min-width: 132px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 1px; }
.chart-export-menu button { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: none; background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.chart-export-menu button:hover { background: var(--surface-2); color: var(--plum); }
/* ---- Slice 2: in-UI editable labels (title / subtitle / note) ----
   Sits under the card head. Inputs are token-driven (paper surface, plum
   focus ring, --heading ink) — they look like part of the card, not a
   separate form. The pencil icon turns into a check + tinted when the
   panel is open. */
.chart-card.editing { border-color: var(--plum-300); }
.chart-card .chart-act.on { background: color-mix(in oklch, var(--plum) 18%, transparent); color: var(--plum); }
.chart-edit-panel { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 var(--sp-3); padding: 10px 12px 12px; background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-md); }
.chart-edit-row { display: flex; flex-direction: column; gap: 4px; }
.chart-edit-label { font-size: 10.5px; color: var(--muted); letter-spacing: var(--ls-label); text-transform: uppercase; font-weight: var(--fw-semi); }
.chart-edit-input { width: 100%; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font: inherit; font-size: 13px; line-height: 1.4; transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease); }
.chart-edit-input:focus { outline: none; border-color: var(--plum); box-shadow: var(--ring); }
.chart-edit-input.multi { resize: vertical; min-height: 44px; font-family: var(--font-sans); }
.chart-edit-input.err { border-color: var(--alert); box-shadow: 0 0 0 3px color-mix(in oklch, var(--alert) 18%, transparent); }
.chart-edit-hint { font-size: 11px; color: var(--muted); padding: 0 2px; }
.chart-edit-hint.err { color: var(--alert-text); }
.chart-edit-actions { display: flex; gap: 6px; justify-content: flex-end; padding-top: 4px; }
.chart-edit-reset, .chart-edit-save { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: var(--r-sm); font: inherit; font-size: 12px; cursor: pointer; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.chart-edit-reset { background: transparent; border: 1px solid var(--border); color: var(--muted); }
.chart-edit-reset:hover { background: var(--surface); color: var(--heading); border-color: var(--border-strong); }
.chart-edit-save { background: var(--plum); border: 1px solid var(--plum); color: var(--plum-on); }
.chart-edit-save:hover { background: var(--plum-600); border-color: var(--plum-600); }
/* ---- Slice 3: per-card palette toggle (Default / Mono / Cividis) ----
   Mini 3-dot indicator on the chart head; click opens a popover with the
   three ramps. Tokens are baked inline by `_seriesColors` so the live
   chart and the export share the chosen palette. */
.chart-palette { position: relative; display: inline-flex; align-items: center; }
.chart-palette-dots { display: inline-flex; gap: 2px; vertical-align: middle; line-height: 1; }
.chart-palette-dots i { display: inline-block; width: 6px; height: 6px; border-radius: 999px; border: 1px solid color-mix(in oklch, var(--ink) 18%, transparent); }
.chart-palette-dots.small i { width: 8px; height: 8px; border-radius: 2px; border: none; }
.chart-palette-pop { position: absolute; top: 32px; right: 0; z-index: 30; min-width: 156px; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--shadow-md); display: flex; flex-direction: column; gap: 1px; }
.chart-palette-row { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: none; background: transparent; color: var(--ink); font: inherit; font-size: 12.5px; border-radius: var(--r-sm); cursor: pointer; text-align: left; }
.chart-palette-row:hover { background: var(--surface-2); color: var(--plum); }
.chart-palette-row.active { background: color-mix(in oklch, var(--plum) 14%, transparent); color: var(--plum); font-weight: var(--fw-semi); }
.chart-palette-name { white-space: nowrap; }

/* ---- transcript: flat log, no bubbles (Codex / Claude-Code feel) ---- */
/* Chat thread — modern chatbot rhythm: tight within one speaker's cluster, a clear breath on the
   speaker switch. User turn = a flat soft-plum chip (no border, no shadow — it reads as a voice,
   not a form field). Assistant turn = plain text on paper, led by the Modara name alone — no
   avatar (Claude.ai / Linear convention). Fill uses color-mix onto --surface so it holds up in
   dark mode. */
.thread { display: flex; flex-direction: column; gap: var(--sp-4); padding-bottom: var(--sp-4); }
.turn { padding: 0; }
.turn.switch { margin-top: var(--sp-6); }          /* extra room whenever the speaker changes */
.turn.you { display: flex; justify-content: flex-end; }
.you-bubble { max-width: 100%; background: color-mix(in oklch, var(--plum) 15%, var(--surface)); border: none; color: var(--ink); font-size: 14.5px; line-height: 1.55; padding: 9px 14px; border-radius: 16px 16px 5px 16px; text-wrap: pretty; white-space: pre-wrap; word-break: break-word; box-shadow: none; }
.ai-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.ai-name { font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em; color: var(--plum); }
.ai-answer { font-size: 15px; line-height: 1.7; color: var(--text); text-wrap: pretty; white-space: pre-wrap; }
.chat-inline-artifacts { margin-top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); max-width: 620px; }
.chat-inline-artifacts .chart-card { margin-top: 0; max-width: 100%; }

/* ── the quiet strip under the ONE build-finish message: compact scoreline + links to the tabs
   that hold each detail. Deliberately understated — the prose is the message; this is the payoff
   glance + the way out to the evidence (conversational-chat rework, 2026-07-14). ── */
.finish-extras { margin-top: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-3); }
.finish-score { display: flex; align-items: baseline; gap: var(--sp-3); font-size: 13px; color: var(--muted); }
.finish-score b { font-size: 22px; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; }
.finish-score .fs-base { font-size: 12px; color: var(--faint); }
.finish-links { display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-2); font-size: 12.5px; }
.finish-links .fl-lead { color: var(--faint); margin-right: 2px; }
.finish-link { display: inline-flex; align-items: center; gap: 3px; font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface);
  color: var(--plum, var(--heading)); cursor: pointer; }
.finish-link:hover { border-color: var(--plum, var(--border)); background: var(--surface-2); }
.finish-link svg { opacity: 0.6; }
.finish-evidence { display: flex; flex-direction: column; gap: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--border-soft); }
.finish-evidence-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }
.finish-evidence-title { font-size: 12.5px; font-weight: 600; color: var(--heading); }
.finish-evidence-note { font-size: 11.5px; color: var(--faint); }
.finish-evidence-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.finish-evidence-charts .chart-card { min-width: 0; }
@container (max-width: 700px) { .finish-evidence-charts { grid-template-columns: 1fr; } }
.ai-thinking { display: flex; align-items: center; gap: var(--sp-3); font-size: 14px; line-height: 1.7; }
.ai-dots { display: inline-flex; gap: 5px; }
.ai-dots i { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--plum); animation: dot-bounce 1.25s var(--ease) infinite; }
.ai-dots i:nth-child(2) { animation-delay: 0.16s; }
.ai-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes dot-bounce { 0%, 65%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-5px); opacity: 1; } }

/* ---- live agentic turn: the streamed step trail + cards + written answer ---- */
.agent-turn { display: flex; flex-direction: column; gap: var(--sp-3); }
.at-plan { font-size: 12px; color: var(--muted); font-style: italic; }
.at-trail { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2) 0; }
.at-step { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; color: var(--muted); line-height: 1.5; }
.at-step.done { color: var(--body); }
.at-step.done .at-label { color: var(--body); }
.at-step.skip .at-label { color: var(--faint); text-decoration: line-through; }
.at-ic { flex: none; width: 16px; height: 16px; display: grid; place-items: center; color: var(--plum); }
.at-step.skip .at-ic { color: var(--faint); }
.at-label { font-weight: 500; }
.at-note { font-size: 11.5px; color: var(--faint); }
.at-spin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--plum-200); border-top-color: var(--plum); animation: at-spin 0.7s linear infinite; }
@keyframes at-spin { to { transform: rotate(360deg); } }
.at-answer { margin-top: var(--sp-2); }
.at-cursor { display: inline-block; width: 7px; height: 1.05em; margin-left: 1px; vertical-align: text-bottom; background: var(--plum); border-radius: 1px; animation: at-blink 1s steps(2) infinite; }
@keyframes at-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
.at-working { padding: var(--sp-2) 0; }
@media (prefers-reduced-motion: reduce) { .at-spin { animation: none; } }

/* Structured investigation choices remain part of the conversation, but carry a real action
   identity so a click advances the active Case instead of producing an inert menu. */
.conversation-options { display: flex; flex-direction: column; gap: 6px; margin-top: var(--sp-2); max-width: 620px; }
.conversation-option { display: flex; align-items: center; gap: var(--sp-3); width: 100%; padding: 10px 12px;
  border: 1px solid var(--border-soft); border-radius: var(--r-md, 10px); background: var(--surface-2);
  color: var(--body); font: inherit; text-align: left; cursor: pointer; }
.conversation-option:hover { border-color: var(--plum); background: var(--surface-3); }
.conversation-option-num { display: grid; place-items: center; flex: none; width: 22px; height: 22px;
  border-radius: 50%; background: color-mix(in oklch, var(--plum) 13%, var(--surface)); color: var(--plum);
  font-size: 12px; font-weight: 700; }
.conversation-option-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.conversation-option-copy strong { font-size: 13px; font-weight: 600; }
.conversation-option-copy small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.conversation-option > svg { flex: none; color: var(--plum); opacity: 0.7; }

/* ---- compact Codex-style work session: scratch analysis collapses after completion ---- */
.work-session { border: 1px solid var(--border-soft); border-radius: var(--r-md, 10px); background: var(--surface-2); overflow: hidden; }
.work-session-toggle { width: 100%; display: flex; align-items: center; gap: var(--sp-2); padding: 9px var(--sp-3);
  border: 0; background: transparent; color: var(--body); cursor: pointer; text-align: left; font: inherit; }
.work-session-toggle:hover { background: var(--surface-3); }
.ws-toggle-ic { display: grid; place-items: center; color: var(--plum); flex: none; }
.ws-toggle-title { font-size: 12.5px; font-weight: 600; }
.ws-toggle-meta { color: var(--faint); font-size: 11.5px; margin-left: auto; }
.ws-toggle-arrow { color: var(--muted); width: 13px; text-align: center; }
.work-session-body { border-top: 1px solid var(--border-soft); padding: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-3); }
.work-session-steps { display: flex; flex-direction: column; gap: 4px; }
.work-session-step { display: flex; align-items: baseline; gap: var(--sp-2); color: var(--muted); font-size: 12px; line-height: 1.45; }
.work-session-step.succeeded { color: var(--body); }
.ws-step-dot { color: var(--plum); flex: none; width: 13px; text-align: center; }
.ws-step-summary { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-session-note { color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.work-turn { opacity: 0.96; }

/* ── Admin Debug mode: the per-turn trace panel (routing · tool runs · every LLM call) ── */
.set-admin-tag { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--plum); background: var(--plum-50); border: 1px solid var(--plum-border);
  border-radius: 4px; padding: 1px 5px; margin-left: var(--sp-3); vertical-align: middle; }
.dbg { margin-top: var(--sp-3); border-top: 1px dashed var(--border-soft); padding-top: var(--sp-2); }
.dbg-tw { display: inline-block; width: 12px; color: var(--faint); font-size: 10px; }
.dbg-toggle { display: flex; align-items: center; gap: var(--sp-2); width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: var(--sp-2) 0;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.dbg-toggle:hover { color: var(--body); }
.dbg-body { display: flex; flex-direction: column; gap: 3px; margin-top: var(--sp-2); }
.dbg-ev { border: 1px solid var(--border-soft); border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.dbg-ev-head { display: flex; align-items: center; gap: var(--sp-3); width: 100%; text-align: left;
  background: none; border: none; cursor: pointer; padding: 6px var(--sp-3); font-size: 12px; color: var(--body); }
.dbg-ev-head:hover { background: var(--surface-3); }
.dbg-kind { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--plum); background: var(--plum-50); border-radius: 4px; padding: 1px 5px; flex: none; }
.dbg-sum { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; }
.dbg-ms { font-family: var(--font-mono); font-size: 10px; color: var(--faint); flex: none; }
.dbg-llm .dbg-kind { color: var(--plum-700); }
.dbg-stage .dbg-kind { color: var(--muted); background: var(--surface-3); }
.dbg-note .dbg-kind { color: var(--faint); background: var(--surface-3); }
.dbg-ev-body { padding: var(--sp-2) var(--sp-3) var(--sp-3); border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: var(--sp-3); }
.dbg-field-l { font-family: var(--font-mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin-bottom: 2px; }
.dbg-pre { font-family: var(--font-mono); font-size: 11px; line-height: 1.5; color: var(--body);
  background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: 5px;
  padding: var(--sp-3); margin: 0; white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow: auto; }

/* ---- per-turn timestamps (honest, real times) + calendar-day dividers ---- */
.you-col { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; max-width: 76%; min-width: 0; }
.turn-time { font-family: var(--font-mono); font-size: 10px; color: var(--faint); flex: none; }
.ai-head .turn-time { margin-left: auto; }
.you-time { opacity: 0; padding-right: 4px; transition: opacity var(--dur-fast) var(--ease); }
.turn.you:hover .you-time { opacity: 1; }
.day-divider { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-6) 0 var(--sp-3); }
.day-divider:first-child { margin-top: 0; }
.day-divider::before, .day-divider::after { content: ""; height: 1px; flex: 1; background: var(--border-soft); }
.day-divider span { font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--faint); white-space: nowrap; }

/* ---- live build stream (streamed SSE stages appearing in-thread as they happen) ---- */
.build-stream { margin: var(--sp-4) 0 0 calc(26px + var(--sp-3)); padding: var(--sp-5) var(--sp-6); border: 1px solid var(--plum-200); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--plum-50), color-mix(in oklch, var(--plum-50) 40%, var(--surface))); box-shadow: var(--shadow-xs); max-width: 520px; }
.build-stream.err { border-color: var(--warn-border); background: var(--warn-surface); }
.bs-head { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; font-weight: 600; color: var(--heading); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.bs-head .bs-title { flex: none; }
.bs-head .ai-dots i { width: 5px; height: 5px; }
.bs-eta { margin-left: auto; font-family: var(--font-mono); font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0.01em; white-space: nowrap; }
.bs-steps { display: flex; flex-direction: column; }
.bs-step { display: flex; gap: var(--sp-3); padding: 7px 0; align-items: flex-start; }
.bs-step + .bs-step { border-top: 1px solid color-mix(in oklch, var(--border-soft) 70%, transparent); }
.bs-dot { flex: none; width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; margin-top: 1px; color: var(--plum); }
.bs-step.done .bs-dot { background: color-mix(in oklch, var(--plum) 16%, transparent); }
.bs-dot .ic { width: 12px; height: 12px; }
.bs-pip { width: 8px; height: 8px; border-radius: 999px; background: var(--plum); animation: pulse-plum 1.4s var(--ease) infinite; }
.bs-step.err .bs-pip { background: var(--warn-text); animation: none; }
.bs-body { display: flex; flex-direction: column; min-width: 0; }
.bs-title { font-size: 13px; font-weight: 500; color: var(--heading); }
.bs-step.done .bs-title { color: var(--muted); font-weight: 400; }
.bs-line { font-size: 11.5px; color: var(--muted); margin-top: 2px; line-height: var(--lh-snug); }
.bs-error { margin-top: var(--sp-3); font-size: 12.5px; color: var(--warn-text); }

/* ---- ResultCard framing: a collapse affordance layered on the card's own chrome (no 2nd border) ---- */
.rframe { position: relative; }
.rframe-collapse { position: absolute; top: 21px; right: 12px; z-index: 2; width: 22px; height: 22px; display: grid; place-items: center; border: none; border-radius: 6px; background: transparent; color: var(--faint); cursor: pointer; opacity: 0; transition: opacity var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.rframe.open:hover .rframe-collapse, .rframe-collapse:focus-visible { opacity: 1; }
.rframe-collapse:hover { background: color-mix(in oklch, var(--plum) 12%, transparent); color: var(--plum); }
.rframe-collapse .ic { width: 14px; height: 14px; }
.rframe-stub { display: inline-flex; align-items: center; gap: var(--sp-3); margin: var(--sp-4) 0 0 calc(26px + var(--sp-3)); padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); cursor: pointer; font: inherit; color: var(--heading); transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.rframe-stub:hover { border-color: var(--plum-300); background: var(--surface-2); }
.rframe-ic { flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--plum); background: color-mix(in oklch, var(--plum) 12%, transparent); }
.rframe-ic .ic { width: 14px; height: 14px; }
.rframe-stub-t { font-size: 13px; font-weight: 600; }
.rframe-show { font-size: 11px; color: var(--muted); margin-left: var(--sp-2); }
.rframe-caret { width: 14px; height: 14px; color: var(--muted); }

.shimmer { background: linear-gradient(100deg, var(--muted) 20%, var(--plum) 45%, var(--muted) 70%); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 1.5s linear infinite; font-weight: 500; }
@keyframes shimmer { to { background-position: -200% center; } }
.ai-card { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-5) 0 0 calc(26px + var(--sp-3)); padding: var(--sp-4) var(--sp-5); border-radius: var(--r-lg); background: linear-gradient(180deg, var(--plum-50), color-mix(in oklch, var(--plum-50) 40%, var(--surface))); border: 1px solid var(--plum-200); box-shadow: var(--shadow-xs); }
.ai-card-ic { width: 38px; height: 38px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.ai-card-ic .ic { width: 19px; height: 19px; }
.cmc-title { font-size: 14px; font-weight: 600; color: var(--heading); }
.cmc-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.chat-dock { flex: none; padding: var(--sp-5) var(--sp-8) var(--sp-6); border-top: 1px solid var(--border-soft); background: var(--paper); }
/* in-place edit affordance — a banner above the composer while a past message is being edited */
.composer-editing { max-width: 780px; margin: 0 auto var(--sp-2); display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12px; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-border);
  border-radius: 10px; padding: 6px var(--sp-4); }
.composer-editing kbd { font-family: var(--font-mono); font-size: 10px; background: var(--surface); border: 1px solid var(--plum-border);
  border-radius: 4px; padding: 0 4px; }
.composer-editing .ce-x { margin-left: auto; border: none; background: none; cursor: pointer; color: var(--plum-700);
  font-size: 16px; line-height: 1; padding: 0 2px; }
.composer-editing .ce-x:hover { color: var(--plum); }
.composer.editing { border-color: var(--plum-300); }
.turn.you.editing .you-bubble { outline: 2px dashed var(--plum-300); outline-offset: 2px; opacity: 0.7; }
.composer { position: relative; max-width: 780px; margin: 0 auto; display: flex; align-items: flex-end; gap: var(--sp-3); padding: 6px 6px 6px var(--sp-5); border: 1px solid var(--border); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-sm); transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.composer:focus-within { border-color: var(--plum-300); box-shadow: var(--ring), 0 4px 16px color-mix(in oklch, var(--plum) 12%, transparent); }
.composer input, .composer textarea { flex: 1; border: none; background: transparent; outline: none; font: inherit; font-size: 14.5px; color: var(--heading); padding: 8px 0; }
.composer textarea { resize: none; line-height: 1.45; max-height: 148px; min-height: 21px; overflow-y: auto; margin-bottom: 4px; }
.composer input::placeholder, .composer textarea::placeholder { color: var(--faint); }
/* inactive send reads "ready, type to enable" (faint plum-ready outline), NOT "disabled" (grey fill) */
.composer-send { flex: none; width: 38px; height: 38px; border-radius: 999px; border: 1px solid var(--border-strong); cursor: pointer; display: grid; place-items: center; background: transparent; color: var(--muted); transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur-fast) var(--ease); }
.composer-send .ic { width: 18px; height: 18px; }
.composer-send[data-active="1"] { background: var(--plum); color: var(--plum-on); border-color: var(--plum); }
.composer-send[data-active="1"]:hover { background: var(--plum-600); transform: translateY(-1px); }
/* stop button (shown while a response is generating) — a filled square inside the send slot */
.composer-send.stop { background: var(--heading); border-color: var(--heading); color: var(--surface); }
.composer-send.stop:hover { transform: translateY(-1px); opacity: 0.9; }
.stop-sq { width: 12px; height: 12px; border-radius: 3px; background: currentColor; }
/* dictation mic */
.composer-mic { flex: none; width: 34px; height: 34px; border-radius: 999px; border: none; background: transparent; color: var(--muted); cursor: pointer; display: grid; place-items: center; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.composer-mic:hover { background: var(--surface-2); color: var(--heading); }
.composer-mic.on { color: var(--alert, #c0392b); background: color-mix(in oklch, var(--alert, red) 12%, transparent); animation: mic-pulse 1.3s var(--ease) infinite; }
@keyframes mic-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--alert, red) 30%, transparent); } 50% { box-shadow: 0 0 0 5px transparent; } }
.composer.listening { border-color: color-mix(in oklch, var(--alert, red) 45%, var(--border)); }
/* edit-and-resend affordance on your own messages (hover to reveal) */
.you-row { display: flex; align-items: center; gap: var(--sp-3); min-width: 0; }
.you-edit { flex: none; width: 24px; height: 24px; border-radius: 999px; border: none; background: transparent; color: var(--faint); cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.you-edit:hover { color: var(--heading); background: var(--surface-2); }
.turn.you:hover .you-edit { opacity: 1; }
.turn.sys { display: flex; justify-content: center; margin: var(--sp-3) 0; }
.sys-chip { display: inline-flex; align-items: center; gap: var(--sp-2); padding: 6px 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); font-size: 12px; line-height: 1.2; max-width: min(560px, 90%); text-align: center; }
.sys-chip.pending { background: var(--plum-50); border-color: var(--plum-200); color: var(--heading); }
/* A settled system note (e.g. "your data's ready") reads as clean default body text —
   matching the empty-state hero paragraph — not the pending "working…" pill. */
.sys-chip:not(.pending) { display: block; background: transparent; border: 0; border-radius: 0; padding: 2px 0; font-size: 13.5px; line-height: var(--lh-snug); max-width: 40em; }
.chat-dock-hint { max-width: 780px; margin: 0 auto; display: flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: 6px 0 2px; font-size: 11.5px; color: var(--muted); }
.chat-dock-hint.reading { color: var(--heading); }
.chat-hint { text-align: center; font-size: 10.5px; color: var(--faint); margin-top: var(--sp-4); }
.chat-hint kbd { font-family: var(--font-mono); font-size: 9.5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 1px 5px; color: var(--muted); }
.composer.locked { opacity: 0.6; cursor: not-allowed; }
.composer.locked:focus-within { border-color: var(--border); box-shadow: var(--shadow-sm); }
.composer-send[disabled] { cursor: not-allowed; opacity: 0.5; }
.composer-mic[disabled] { cursor: not-allowed; opacity: 0.4; }

/* ============================================================
   MODEL tab — spec + dividers + mono title
   ============================================================ */
.title.mono-title { font-family: var(--font-mono); font-size: clamp(18px, 2.2vw, 24px); letter-spacing: 0; }
.model-spec { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); margin-bottom: var(--sp-8); }
.ms-cell { display: flex; flex-direction: column; gap: 5px; padding: var(--sp-5); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface); }
.ms-k { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.ms-v { font-size: 14px; font-weight: 600; color: var(--heading); }
.ms-v.mono { font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.tab-divider { display: flex; align-items: center; gap: var(--sp-4); margin: var(--sp-9) 0 var(--sp-7); }
.tab-divider::before, .tab-divider::after { content: ""; height: 1px; background: var(--border-soft); flex: 1; }
.tab-divider span { font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--heading); }
@container (max-width: 680px) { .model-spec { grid-template-columns: 1fr 1fr; } }

/* ---- attach data strip (Data tab) ---- */
.attach { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap; padding: var(--sp-5) var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); margin-bottom: var(--sp-6); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.attach.empty { border-style: dashed; border-color: var(--border); background: var(--surface-2); }
.attach.has-data { box-shadow: var(--shadow-sm); }
.attach-l { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.attach-ic { width: 42px; height: 42px; border-radius: var(--r-md); background: var(--ok-surface); color: var(--ok-text); display: grid; place-items: center; flex: none; }
.attach.has-data .attach-ic { background: var(--plum-50); color: var(--plum); }
.attach-t { font-size: 14px; font-weight: 600; color: var(--heading); letter-spacing: -0.005em; }
.attach-s { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 3px; line-height: var(--lh-snug); max-width: 56em; }
.attach-r { display: flex; gap: var(--sp-3); flex: none; }

/* upload staging: "is this all your data?" confirm box + profiling status */
.data-confirm { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap;
  padding: var(--sp-4) var(--sp-5); margin-top: var(--sp-3); border: 1px solid var(--plum); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--plum) 7%, var(--surface)); }
.dc-body { display: flex; align-items: center; gap: var(--sp-4); min-width: 0; }
.dc-ic { width: 34px; height: 34px; border-radius: var(--r-md); background: color-mix(in srgb, var(--plum) 16%, transparent); color: var(--plum); display: grid; place-items: center; flex: none; }
.dc-t { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.dc-s { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: var(--lh-snug); }
.dc-actions { display: flex; gap: var(--sp-3); flex: none; flex-wrap: wrap; }
.data-profile { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface-2); }
.data-storage-note { display: flex; align-items: center; gap: 7px; margin-top: var(--sp-3); color: var(--muted); font-size: 11.5px; line-height: var(--lh-snug); }
.data-storage-note .ic { color: var(--plum); flex: none; }
.data-storage-note b { color: var(--heading); font-weight: 600; }
.data-profile.ds-ready { color: var(--ok-text); border-color: var(--ok-border); background: var(--ok-surface); }
.data-profile.ds-error, .data-profile.ds-stale { color: var(--warn-text); border-color: var(--warn-border); background: var(--warn-surface); }
.data-profile .dp-sub { color: var(--faint); }
.dp-btn { font-family: var(--font-mono); font-size: 10.5px; padding: 3px 10px; border-radius: var(--r-pill); border: 1px solid currentColor; background: transparent; color: inherit; cursor: pointer; }
.dp-btn:hover { background: color-mix(in srgb, currentColor 12%, transparent); }
.dp-btn-ghost { opacity: .7; }
.data-clarify { border: 1px solid var(--plum-200); border-radius: var(--r-lg); background: var(--surface); padding: var(--sp-3) var(--sp-4); }
.data-clarify-unresolved { border-color: var(--warn-border); background: var(--warn-surface); }
.data-clarify .dc-head { display: flex; align-items: center; gap: var(--sp-2); font-size: 12px; font-weight: 650; color: var(--heading); margin-bottom: var(--sp-2); }
.data-clarify .dc-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; padding: var(--sp-2) 0; border-top: 1px solid var(--border-soft); }
.data-clarify .dc-q { font-size: 12.5px; color: var(--body); }
.data-clarify .dc-actions { display: flex; gap: var(--sp-2); flex-shrink: 0; }
.dc-safe { margin: 0 0 var(--sp-2); max-width: 78em; font-size: 12px; line-height: 1.5; color: var(--warn-text); }
.dc-choice-actions { align-items: stretch; }
.dc-choice { display: flex; flex-direction: column; gap: 2px; min-width: 190px; padding: 7px 10px; border: 1px solid var(--border-soft);
  border-radius: var(--r-md); background: var(--surface); color: var(--heading); text-align: left; cursor: pointer; }
.dc-choice:hover { border-color: var(--border); background: var(--surface-2); }
.dc-choice strong { font: inherit; font-size: 11.5px; font-weight: 650; }
.dc-choice small { font: inherit; font-size: 10.5px; line-height: 1.35; color: var(--muted); }
.dc-choice-later { color: var(--warn-text); }

/* ============================================================
   FEATURES
   ============================================================ */
.feat-list { display: flex; flex-direction: column; gap: var(--sp-3); }
.feat { display: grid; grid-template-columns: 1.8fr 180px; gap: var(--sp-5); align-items: center; padding: var(--sp-4) var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface); }
.feat-main { min-width: 0; display: flex; align-items: baseline; gap: var(--sp-3); }
.feat-rank { flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--muted); min-width: 16px; }
.feat-name { font-size: 13px; font-weight: 500; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feat-foot { margin-top: var(--sp-4); font-size: 11.5px; color: var(--muted); line-height: var(--lh-normal); }
.feat-plain { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: var(--lh-snug); }
.dirchip { font-size: 10.5px; font-weight: 500; padding: 3px 9px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.dirchip.up { color: var(--warn-text); background: var(--warn-surface); border-color: var(--warn-border); }
.dirchip.down { color: var(--ok-text); background: var(--ok-surface); border-color: var(--ok-border); }
.feat-imp { display: flex; align-items: center; gap: var(--sp-3); }
.feat-pct { font-family: var(--font-mono); font-size: 11px; color: var(--heading); min-width: 32px; text-align: right; }
.mbar { flex: 1; height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; min-width: 40px; }
.mbar i { display: block; height: 100%; border-radius: 999px; background: var(--plum); }
.mbar i.t-high { background: var(--alert); } .mbar i.t-med { background: var(--warn); } .mbar i.t-low { background: var(--ok); }
.feat.held { grid-template-columns: 1fr auto; opacity: 0.85; }
.feat-held { margin-top: var(--sp-6); display: flex; flex-direction: column; gap: var(--sp-3); }
.fh-head { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--warn-text); margin-bottom: var(--sp-2); }
@container (max-width: 680px) { .feat { grid-template-columns: 1fr; } .feat-imp { grid-column: 1 / -1; } }

/* ---- grouped features (accordion) + per-feature detail ---- */
.feat-groups { display: flex; flex-direction: column; gap: var(--sp-4); }
.feat-group { border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.feat-group-head { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); cursor: pointer; user-select: none; }
.feat-group-head:hover { background: var(--surface-2); }
.feat-group-title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.feat-group-name { font-size: 13px; font-weight: 600; color: var(--heading); }
.feat-group-blurb { font-size: 11.5px; color: var(--muted); line-height: var(--lh-snug); }
.feat-group-meta { margin-left: auto; flex: none; font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; padding-left: var(--sp-4); }
.feat-list.in-group { gap: 0; border-top: 1px solid var(--border-soft); }
.feat-list.in-group .feat { border: none; border-bottom: 1px solid var(--border-soft); border-radius: 0; }
.feat-list.in-group .feat:last-child { border-bottom: none; }
.feat-chev { flex: none; color: var(--faint); transform: rotate(-90deg); transition: transform 0.15s ease; }
.feat-chev.down { transform: rotate(0deg); }
.feat.clickable .feat-main { cursor: pointer; }
.feat.clickable .feat-main:hover .feat-name { color: var(--plum); }
.feat.open { background: var(--surface-2); }
.feat-detail { grid-column: 1 / -1; display: flex; flex-direction: column; gap: var(--sp-3); border-top: 1px dashed var(--border-soft); margin-top: var(--sp-2); padding-top: var(--sp-3); }
.feat-desc { font-size: 12.5px; color: var(--ink); line-height: var(--lh-normal); }
.feat-how-lab { display: block; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); margin-bottom: 3px; }
.feat-recipe { margin: 0; padding: var(--sp-3) var(--sp-4); font-family: var(--font-mono); font-size: 11px; line-height: var(--lh-normal); color: var(--ink); background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: var(--r-md); white-space: pre-wrap; word-break: break-word; }
.feat-tech { font-size: 11px; color: var(--faint); }
.feat-tech code { font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

/* ---- report edit note ---- */
.rep-edit { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; color: var(--muted); line-height: var(--lh-snug); padding: var(--sp-4); margin-top: var(--sp-2); border-top: 1px solid var(--border-soft); }

/* ============================================================
   PREDICTIONS table (used in Model tab peek)
   ============================================================ */
.pred-summary { display: flex; align-items: center; gap: var(--sp-6); padding: var(--sp-5) var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface-2); margin-bottom: var(--sp-6); }
.ps-stat { display: flex; flex-direction: column; gap: 3px; }
.ps-num { font-family: var(--font-display); font-weight: 500; font-size: 24px; color: var(--ink); line-height: 1; }
.ps-lab { font-size: 11px; color: var(--muted); }
.ps-div { width: 1px; height: 34px; background: var(--border); }
.ps-actions { margin-left: auto; }
.pred-table { border: 1px solid var(--border-soft); border-radius: var(--r-lg); overflow: hidden; }
.pred-row { display: grid; grid-template-columns: 1.4fr 1.3fr 2fr 0.9fr 0.9fr; gap: var(--sp-4); align-items: center; padding: var(--sp-4) var(--sp-6); border-bottom: 1px solid var(--border-soft); font-size: 12.5px; }
.pred-row.three { grid-template-columns: 1.4fr 1.3fr 2fr; }
.pred-table.compact .pred-row.head { grid-template-columns: 1.4fr 1.3fr 2fr; }
.pred-row:last-child { border-bottom: none; }
.pred-row.head { background: var(--surface-2); font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.pr-name { font-weight: 600; color: var(--heading); }
.pr-score { display: flex; align-items: center; gap: var(--sp-3); }
.pr-score em { font-style: normal; font-family: var(--font-mono); font-size: 11px; color: var(--heading); min-width: 32px; }
.pr-why { color: var(--muted); }
.pr-last, .pr-val { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
@container (max-width: 680px) { .pred-row, .pred-row.three, .pred-table.compact .pred-row.head { grid-template-columns: 1.2fr 1fr; } .pr-why, .pr-last, .pr-val { display: none; } }

/* ============================================================
   VISUALISATIONS — plot grid
   ============================================================ */
.plot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.plot { border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); overflow: hidden; }
.plot-head { display: flex; align-items: baseline; justify-content: space-between; padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border-soft); }
.plot-head h4 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--heading); }
.plot-sub { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.plot-body { padding: var(--sp-6); }
.plot-feats, .plot-drift { display: flex; flex-direction: column; gap: var(--sp-4); }
.pf-row, .pd-row { display: grid; grid-template-columns: 150px 1fr 40px; gap: var(--sp-3); align-items: center; }
.pf-name, .pd-name { font-family: var(--font-mono); font-size: 11px; color: var(--heading); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-pct, .pd-psi { font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-align: right; }
.pd-psi.drifting { color: var(--warn-text); font-weight: 600; }
.plot .histbars { height: 120px; }
@container (max-width: 760px) { .plot-grid { grid-template-columns: 1fr; } }

/* ============================================================
   DEPLOYMENT
   ============================================================ */
.dep-status { display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; padding: var(--sp-5) var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); margin-bottom: var(--sp-8); }
.dep-env { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.de-k { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.de-v { font-size: 12.5px; font-weight: 600; color: var(--heading); margin-right: var(--sp-4); }
.de-v.mono { font-family: var(--font-mono); font-size: 11px; font-weight: 500; }
.dep-channels { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); margin-top: var(--sp-4); }
.depch { display: flex; align-items: center; gap: var(--sp-4); text-align: left; font: inherit; cursor: pointer; padding: var(--sp-5); border-radius: var(--r-md); border: 1.5px solid var(--border); background: var(--surface); transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.depch[data-on="1"] { border-color: var(--plum-200); background: var(--plum-50); }
.depch-ic { width: 34px; height: 34px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); display: grid; place-items: center; flex: none; }
.depch[data-on="1"] .depch-ic { background: var(--surface); border-color: var(--plum-200); color: var(--plum); }
.depch-body { flex: 1; min-width: 0; }
.depch-name { font-size: 13px; font-weight: 600; color: var(--heading); }
.depch-note { font-size: 11px; color: var(--muted); margin-top: 2px; line-height: var(--lh-snug); }
.toggle { width: 34px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border); flex: none; position: relative; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.toggle i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-xs); transition: transform var(--dur) var(--ease); }
.toggle.on { background: var(--plum); border-color: var(--plum); }
.toggle.on i { transform: translateX(14px); }
@container (max-width: 680px) { .dep-channels { grid-template-columns: 1fr; } }

/* ---- settings account row ---- */
.set-account { display: flex; align-items: center; gap: var(--sp-4); }
.sa-av { width: 44px; height: 44px; border-radius: 999px; background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 18px; flex: none; }
.sa-name { font-size: 14px; font-weight: 600; color: var(--heading); }
.sa-mail { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.sa-plan { margin-left: auto; font-size: 11.5px; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-pill); padding: 4px 11px; }

/* ============================================================
   ACCOUNT AREA — sub-nav · Billing & plan · Privacy
   ============================================================ */
.set-wrap.wide { max-width: 860px; }
/* sub-nav shared by Settings / Billing / Privacy */
.acct-nav { display: inline-flex; gap: 2px; padding: 3px; margin-bottom: var(--sp-6); background: var(--surface-3); border-radius: var(--r-md); }
.acct-navi { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--muted); padding: 7px 14px; border: none; border-radius: var(--r-sm); background: transparent; cursor: pointer; transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.acct-navi .ic { width: 15px; height: 15px; }
.acct-navi:hover { color: var(--heading); }
.acct-navi[data-on="1"] { background: var(--surface); color: var(--plum-700); box-shadow: var(--shadow-xs); }
.acct-navi[data-on="1"] .ic { color: var(--plum); }
/* links out of the Settings page into the dedicated account views */
.set-links { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-5); }
.set-link { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13px; font-weight: 500; color: var(--heading); padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease); }
.set-link:hover { border-color: var(--plum-300); background: var(--surface-2); }
.set-link .ic { width: 15px; height: 15px; color: var(--plum); }
.set-link .sl-go { color: var(--faint); width: 14px; height: 14px; }

/* ---- Billing: current plan hero ---- */
.bill-flash { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; color: var(--ok-text); background: var(--ok-surface); border: 1px solid var(--ok-border); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: var(--sp-5); }
.bill-flash .ic { width: 16px; height: 16px; flex: none; }
.plan-now { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-6); flex-wrap: wrap; padding: var(--sp-6) var(--sp-7); border-radius: var(--r-lg); margin-bottom: var(--sp-6); color: var(--plum-on); background: linear-gradient(135deg, var(--plum-600), var(--plum-400)); box-shadow: 0 8px 24px color-mix(in oklch, var(--plum) 26%, transparent), inset 0 1px 0 color-mix(in oklch, white 18%, transparent); }
.pn-badge { display: inline-block; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; padding: 3px 9px; border-radius: var(--r-pill); background: color-mix(in oklch, white 22%, transparent); }
.pn-name { font-family: var(--font-display); font-weight: 600; font-size: 26px; margin-top: var(--sp-3); line-height: 1.1; }
.pn-sub { font-size: 12.5px; opacity: 0.85; margin-top: 4px; }
.pn-r { text-align: right; }
.pn-price { font-family: var(--font-display); font-weight: 600; font-size: 24px; }
.pn-price span { font-size: 13px; font-weight: 400; opacity: 0.8; }
.pn-renew { font-size: 11.5px; opacity: 0.82; margin-top: 3px; }

/* ---- Billing: usage this cycle ---- */
.use-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: var(--sp-4); }
.use-cell { padding: var(--sp-4) var(--sp-5); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface-2); }
.use-n { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--heading); line-height: 1; }
.use-l { font-size: 11px; color: var(--muted); margin-top: 6px; }
.use-note { font-size: 11px; color: var(--faint); margin: var(--sp-4) 0 0; line-height: var(--lh-snug); }

/* ---- Billing: plan chooser ---- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--sp-4); }
.plan-card { position: relative; display: flex; flex-direction: column; padding: var(--sp-5) var(--sp-5) var(--sp-6); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface); }
.plan-card.cur { border-color: var(--plum); box-shadow: 0 0 0 1px color-mix(in oklch, var(--plum) 40%, transparent); }
.plan-card.pending { border-color: var(--plum-300); background: var(--plum-50); }
.plan-tag { position: absolute; top: -9px; left: var(--sp-5); font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--plum-on); background: var(--plum); padding: 3px 8px; border-radius: var(--r-pill); }
.plan-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--heading); }
.plan-price { font-size: 20px; font-weight: 600; color: var(--heading); margin-top: 4px; }
.plan-price span { font-size: 11.5px; font-weight: 400; color: var(--muted); }
.plan-feats { list-style: none; margin: var(--sp-4) 0 var(--sp-5); padding: 0; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.plan-feats li { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--text); line-height: var(--lh-snug); }
.plan-feats .ic { width: 13px; height: 13px; color: var(--ok-text); flex: none; margin-top: 2px; }
.plan-cta { width: 100%; justify-content: center; }
.plan-cta:disabled { opacity: 0.55; cursor: default; }
.plan-confirm { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap; margin-top: var(--sp-5); padding: var(--sp-4) var(--sp-5); border: 1px solid var(--plum-200); border-radius: var(--r-md); background: var(--plum-50); font-size: 12.5px; color: var(--text); }
.pc-actions { display: flex; gap: var(--sp-3); flex: none; }

/* ---- Billing: payment + invoices ---- */
.pay-row { display: flex; align-items: center; gap: var(--sp-4); }
.pay-ic { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.pay-ic .ic { width: 20px; height: 20px; }
.pay-t { font-size: 13.5px; font-weight: 600; color: var(--heading); }
.pay-s { font-family: var(--font-mono); font-size: 11px; color: var(--muted); margin-top: 2px; }
.pay-note { margin-left: auto; font-size: 11.5px; color: var(--muted); font-style: italic; }
.pay-row .btn { margin-left: auto; }
.inv-list { display: flex; flex-direction: column; }
.inv-row { display: grid; grid-template-columns: minmax(90px, 1fr) minmax(90px, 1fr) auto auto auto; gap: var(--sp-4); align-items: center; padding: var(--sp-4) 0; border-bottom: 1px solid var(--border-soft); font-size: 12.5px; }
.inv-row:last-child { border-bottom: none; }
.inv-date { color: var(--heading); font-weight: 500; }
.inv-id { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.inv-amt { font-family: var(--font-mono); font-size: 12px; color: var(--heading); text-align: right; }
.inv-st { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; text-transform: capitalize; color: var(--ok-text); }
.inv-st .d { width: 6px; height: 6px; border-radius: 999px; background: var(--ok-text); }
.inv-dl { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface); color: var(--muted); cursor: pointer; transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.inv-dl:hover { border-color: var(--plum); color: var(--plum); }
.inv-dl .ic { width: 15px; height: 15px; }

/* ---- Privacy: assurances · controls · switch · region · danger ---- */
.priv-assure { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.priv-assure li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.priv-assure .ic { width: 15px; height: 15px; color: var(--ok-text); flex: none; }
.priv-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); padding: var(--sp-4) 0; border-bottom: 1px solid var(--border-soft); }
.priv-row:last-child { border-bottom: none; }
.priv-txt { min-width: 0; }
.priv-t { font-size: 13.5px; font-weight: 500; color: var(--heading); }
.priv-d { font-size: 11.5px; color: var(--muted); margin-top: 3px; line-height: var(--lh-snug); max-width: 44em; }
.pv-switch { flex: none; width: 42px; height: 24px; border-radius: 999px; border: none; padding: 0; cursor: pointer; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--border); transition: background var(--dur-fast) var(--ease); }
.pv-switch.on { background: var(--plum); box-shadow: none; }
.pv-knob { display: block; width: 18px; height: 18px; margin: 3px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform var(--dur-fast) var(--ease); }
.pv-switch.on .pv-knob { transform: translateX(18px); }
.priv-region { display: flex; align-items: center; gap: var(--sp-4); }
.pr-ic { width: 40px; height: 40px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.pr-ic .ic { width: 20px; height: 20px; }
.danger-zone { border-color: var(--alert-border); }
.danger-zone h4 { color: var(--alert-text); }
.del-confirm { display: flex; flex-direction: column; gap: var(--sp-4); align-items: flex-start; }
.del-input { font: inherit; font-size: 13px; color: var(--heading); padding: 8px 11px; border: 1px solid var(--alert-border); border-radius: var(--r-md); background: var(--surface); width: 100%; max-width: 320px; }
.del-input:focus { outline: none; border-color: var(--alert); box-shadow: 0 0 0 3px var(--alert-surface); }

/* ---- beliefs (kept for reuse) ---- */
.belief-list { display: flex; flex-direction: column; gap: var(--sp-4); }
.belief { display: flex; gap: var(--sp-5); padding: var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-xs); }
.belief-ic { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--plum-50); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.belief-body { flex: 1; min-width: 0; }
.belief-top { display: flex; align-items: center; gap: var(--sp-3); }
.belief-title { font-family: var(--font-display); font-weight: 600; font-size: 14.5px; color: var(--heading); }
.belief-kind { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border-soft); border-radius: var(--r-pill); padding: 2px 8px; }
.belief-note { font-size: 12.5px; color: var(--muted); line-height: var(--lh-snug); margin-top: var(--sp-3); }
.belief-foot { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-4); }
.belief-strength { font-family: var(--font-mono); font-size: 10px; color: var(--plum-700); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: var(--r-pill); padding: 2px 9px; }
.belief-src { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }
.inject { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 13px; font-weight: 500; color: var(--plum-700); background: var(--plum-50); border: 1px dashed var(--plum-300); border-radius: var(--r-md); padding: 11px var(--sp-6); cursor: pointer; margin-top: var(--sp-6); }
.inject:hover { background: var(--plum-100); }

/* ---- auth signed-out banner ---- */
.auth-signedout { display: flex; align-items: center; gap: 7px; justify-content: center; font-size: 12px; color: var(--ok-text); background: var(--ok-surface); border: 1px solid var(--ok-border); border-radius: var(--r-md); padding: 7px 12px; margin-bottom: var(--sp-5); }

/* ============================================================
   LIVE RUN tab
   ============================================================ */
.run-status { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; padding: var(--sp-5) var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); margin-bottom: var(--sp-5); }
.run-live { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ok-text); font-weight: 600; }
.run-pulse { width: 8px; height: 8px; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: runpulse 1.8s var(--ease) infinite; flex: none; }
.run-pulse.sm { width: 6px; height: 6px; }
@keyframes runpulse { 0% { box-shadow: 0 0 0 0 color-mix(in oklch, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.rs-cells { display: flex; gap: var(--sp-6); flex-wrap: wrap; margin-left: auto; }
.rs-cell { display: flex; flex-direction: column; gap: 3px; }
.rs-k { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.05em; text-transform: uppercase; color: var(--faint); }
.rs-v { font-size: 13px; font-weight: 600; color: var(--heading); }
.rs-v.mono { font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; }

.run-best { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5) var(--sp-6); border: 1px solid var(--plum-200); border-left: 3px solid var(--plum); border-radius: var(--r-lg); background: var(--plum-50); margin-bottom: var(--sp-7); }
.rb-ic { width: 36px; height: 36px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--plum-200); color: var(--plum); display: grid; place-items: center; flex: none; }
.rb-body { flex: 1; min-width: 0; }
.rb-top { display: flex; align-items: baseline; gap: var(--sp-3); }
.rb-name { font-size: 14px; font-weight: 600; color: var(--plum-700); }
.rb-name.mono { font-family: var(--font-mono); font-size: 12.5px; }
.rb-delta { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--ok-text); }
.rb-note { font-size: 12px; color: var(--muted); margin-top: 2px; }

.run-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-5); align-items: start; }
.run-col { border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.run-side { display: flex; flex-direction: column; gap: var(--sp-5); }
.run-h { display: flex; align-items: baseline; justify-content: space-between; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); background: var(--surface-2); }
.run-h h3 { margin: 0; font-family: var(--font-display); font-weight: 600; font-size: 13px; color: var(--heading); }
.run-hint { font-family: var(--font-mono); font-size: 10px; color: var(--faint); }

.trials { display: flex; flex-direction: column; }
.trial { display: grid; grid-template-columns: auto 1fr auto auto; gap: var(--sp-4); align-items: center; padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.trial:last-child { border-bottom: none; }
.trial.rejected { opacity: 0.6; }
.tl-kic { width: 30px; height: 30px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--muted); display: grid; place-items: center; flex: none; }
.tl-kic .ic { width: 15px; height: 15px; }
.trial.running .tl-kic { background: var(--plum-50); border-color: var(--plum-200); color: var(--plum); }
.tl-main { min-width: 0; }
.tl-what { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--heading); }
.tl-note { font-size: 11px; color: var(--muted); margin-top: 2px; }
.tl-metric { font-family: var(--font-mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.tl-metric[data-good="1"] { color: var(--ok-text); }
.tl-metric[data-good="0"] { color: var(--alert-text); }
.tag.run { color: var(--plum-700); background: var(--plum-50); border-color: var(--plum-200); display: inline-flex; align-items: center; gap: 5px; }

.rq { display: flex; flex-direction: column; }
.rq-row { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.rq-who { font-family: var(--font-mono); font-size: 9px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; padding: 2px 6px; border-radius: var(--r-xs); flex: none; margin-top: 1px; }
.rq-who.operator { color: var(--heading); background: var(--surface-3); }
.rq-who.modara { color: var(--plum-on); background: var(--plum); }
.rq-text { flex: 1; min-width: 0; font-size: 12px; color: var(--text); line-height: var(--lh-snug); }
.rq-state { font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--faint); flex: none; margin-top: 2px; }
.rq-state.running { color: var(--plum-700); }
.rq-state.suggested { color: var(--warn-text); }
.rq-add { display: flex; align-items: center; gap: 6px; padding: var(--sp-4) var(--sp-5); font-size: 12px; color: var(--muted); cursor: pointer; }
.rq-add:hover { color: var(--plum-700); background: var(--surface-2); }

.run-log { font-family: var(--font-mono); font-size: 11px; line-height: 1.7; padding: var(--sp-4) var(--sp-5); max-height: 260px; overflow-y: auto; background: var(--ink); color: color-mix(in oklch, var(--paper) 82%, transparent); }
.log-line { display: flex; gap: var(--sp-4); }
.log-t { color: color-mix(in oklch, var(--plum-300) 90%, white); flex: none; min-width: 66px; }
.log-x { color: color-mix(in oklch, var(--paper) 78%, transparent); }
.log-line.cursor .log-x { color: color-mix(in oklch, var(--paper) 55%, transparent); }
.log-caret { display: inline-block; width: 7px; height: 13px; background: var(--plum-300); margin-left: 4px; vertical-align: text-bottom; animation: blink 1.1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }
@container (max-width: 760px) { .run-grid { grid-template-columns: 1fr; } }

@media (max-width: 640px) {
  .app-body { grid-template-columns: 76px 1fr; }
  .rail .rc-body, .rail .rt-lbl, .rail-sec, .rail-chats { display: none; }
  .rail-tab, .rail-chat { justify-content: center; }
  .home-btn span { display: none; }
}

/* ── Framing / Leakage / Decision chat cards (the 90% surfaces) ─────────────────────── */
.spec-card, .leak-card, .dec-card { margin: var(--sp-5) 0 0 calc(26px + var(--sp-3)); padding: var(--sp-5) var(--sp-6); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--plum-200); box-shadow: var(--shadow-xs); overflow: hidden; }
/* every result card's head reads as a proper card-header strip (full-bleed, tinted, ruled) so the
   card is a distinct titled object, not prose. right padding reserves room for the collapse control. */
.spec-head, .leak-head, .dec-head, .drv-head, .desc-head { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; font-weight: 650; color: var(--heading); margin: calc(-1 * var(--sp-5)) calc(-1 * var(--sp-6)) var(--sp-5); padding: var(--sp-3) calc(var(--sp-6) + 18px) var(--sp-3) var(--sp-6); background: color-mix(in oklch, var(--plum) 6%, var(--surface-2)); border-bottom: 1px solid var(--border-soft); }
.spec-prov { margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 500; }
.spec-summary { margin-top: var(--sp-3); font-size: 13px; color: var(--body); }
.spec-warning { display: flex; align-items: flex-start; gap: var(--sp-2); margin-top: var(--sp-3); padding: 9px 12px; border-radius: 9px; font-size: 12.5px; line-height: 1.5; color: var(--warn-text); background: var(--warn-surface); border: 1px solid var(--warn-border); }
.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4); margin-top: var(--sp-4); }
.spec-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.spec-field select, .spec-field input { font: inherit; font-size: 13px; color: var(--heading); padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--paper); }
.spec-ro { font-size: 12.5px; color: var(--heading); padding: 6px 0; }
.spec-pop { margin-top: var(--sp-3); font-size: 12px; color: var(--body); }
.spec-excl { margin-top: var(--sp-4); }
.spec-excl-lbl { font-size: 11px; color: var(--muted); }
.spec-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.spec-chip { font-size: 11.5px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); background: var(--paper); color: var(--body); cursor: pointer; }
.spec-chip.on, .spec-chip.leak { background: color-mix(in oklch, var(--alert) 8%, var(--paper)); border-color: color-mix(in oklch, var(--alert) 35%, var(--border)); color: var(--alert-text); text-decoration: line-through; }
.spec-chip.leak { cursor: default; }
.spec-err { margin-top: var(--sp-3); font-size: 12px; color: var(--alert-text); }
.spec-foot { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-5); }
.spec-note { font-size: 11px; color: var(--muted); }
.spec-running { font-size: 12.5px; color: var(--body); }

/* ── Understanding briefing (the chat-first framing surface: a plain-English read of the problem
      with the load-bearing decisions called out; the typed form collapses under "advanced"). ── */
.su { margin: var(--sp-4) 0 var(--sp-3); }
.su-lead { font-size: 12.5px; line-height: 1.5; color: var(--muted); margin-bottom: var(--sp-4); }
.su-lead b { color: var(--heading); font-weight: 650; }
.su-list { display: grid; gap: var(--sp-4); }
.su-row { display: grid; grid-template-columns: 28px 1fr; gap: var(--sp-3); align-items: start; }
.su-ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px;
         background: color-mix(in oklch, var(--plum) 9%, var(--surface-2));
         border: 1px solid color-mix(in oklch, var(--plum) 16%, var(--border-soft));
         color: var(--plum); }
.su-ic .ic { width: 14px; height: 14px; }
.su-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
          color: var(--muted); margin-bottom: 1px; }
.su-val { font-size: 13px; line-height: 1.45; color: var(--heading); }
.su-hint { font-size: 11.5px; line-height: 1.4; color: var(--muted); font-style: italic; margin-top: 2px; }
.su-change { margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--border-soft);
             font-size: 12px; line-height: 1.5; color: var(--muted); }
.su-hist { display: flex; gap: var(--sp-3); margin-top: var(--sp-4); padding: 10px 12px;
           border-radius: 10px; font-size: 12.5px; line-height: 1.5; color: var(--info-text);
           background: var(--info-surface); border: 1px solid var(--info-border); }
.su-hist .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; color: var(--info); }
.su-hist b { color: var(--info-text); font-weight: 650; }
.su-adv { display: inline-flex; align-items: center; gap: 4px; background: none; border: none;
          padding: 2px 0 var(--sp-3); margin: 0; cursor: pointer; font: inherit; font-size: 11.5px;
          color: var(--muted); }
.su-adv:hover { color: var(--body); }
/* Forecast explainability — the election table is the trust surface (no rows to attribute). */
.fc-elect { display: flex; flex-direction: column; gap: 7px; margin-top: var(--sp-3); }
.fc-row { display: grid; grid-template-columns: minmax(150px, 1.1fr) 2fr auto; align-items: center;
          gap: var(--sp-3); font-size: 12.5px; }
.fc-row.win .fc-name { font-weight: 600; color: var(--body); }
.fc-name { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.fc-tag { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; border-radius: 999px;
          padding: 1px 7px; background: var(--plum); color: #fff; }
.fc-tag.floor { background: var(--surface-2, rgba(127,127,127,.14)); color: var(--muted);
                border: 1px solid var(--border); }
.fc-bar { display: block; height: 8px; border-radius: 999px;
          background: var(--surface-2, rgba(127,127,127,.10)); overflow: hidden; }
.fc-bar > i { display: block; height: 100%; border-radius: 999px; background: var(--muted); }
.fc-row.win .fc-bar > i { background: var(--plum); }
.fc-val { font-variant-numeric: tabular-nums; color: var(--body); font-size: 12px; }
.fc-facts { display: flex; flex-direction: column; gap: 6px; margin-top: var(--sp-2); }
.fc-facts > div { display: flex; gap: var(--sp-3); font-size: 12.5px; }
.fc-k { min-width: 92px; color: var(--muted); }
.fc-v { color: var(--body); }
.fc-notes { margin: var(--sp-2) 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.6;
            color: var(--muted); }
.fc-notes li { margin-bottom: 4px; }

/* Model type (forecast vs predict) — surfaced on the frame card when the data has a time axis. */
.spec-mtype { margin-top: var(--sp-3); padding: 10px 12px; border-radius: 10px;
              background: var(--surface-2, rgba(127,127,127,.06)); border: 1px solid var(--border); }
.spec-mtype-row { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.spec-mtype-lbl { font-size: 12px; font-weight: 600; color: var(--body); }
.spec-mtype-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px;
                  overflow: hidden; background: var(--surface); }
.spec-mtype-seg .mt-opt { background: none; border: none; padding: 4px 12px; cursor: pointer;
                          font: inherit; font-size: 12px; color: var(--muted); }
.spec-mtype-seg .mt-opt.on { background: var(--plum); color: #fff; }
.spec-mtype-note { margin-top: 7px; font-size: 12px; line-height: 1.5; color: var(--muted); }
.leak-badge { margin-left: auto; font-size: 11px; color: var(--plum); background: var(--plum-50); border: 1px solid var(--plum-200); border-radius: 999px; padding: 2px 9px; }
.leak-none { margin-top: var(--sp-3); font-size: 12.5px; color: var(--body); }
.leak-foundry { margin-top: var(--sp-3); font-size: 11.5px; color: var(--muted); }
.leak-group { margin-top: var(--sp-4); }
.leak-group:first-of-type { margin-top: var(--sp-3); }
.leak-label { display: block; font-size: 10.5px; font-weight: 650; letter-spacing: .02em; text-transform: uppercase; color: var(--muted); margin-bottom: var(--sp-2); }
.leak-label-danger { color: var(--danger, #b4232a); }
.dec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-4); margin-top: var(--sp-4); }
.dec-stat { display: flex; flex-direction: column; gap: 2px; }
.dec-stat b { font-size: 17px; color: var(--heading); }
.dec-stat span { font-size: 11px; color: var(--muted); }
.dec-note { margin-top: var(--sp-4); font-size: 12px; color: var(--body); }
.dec-caveat { margin-top: var(--sp-2); font-size: 11px; color: var(--muted); font-style: italic; }

/* ---- build results card (cross-validation vs held-out test) ---- */
/* NB: no overflow:hidden here (unlike the other cards) so the Term popovers aren't clipped. */
.res-card { margin: var(--sp-5) 0 0 calc(26px + var(--sp-3)); padding: var(--sp-5) var(--sp-6) var(--sp-5); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--plum-200); box-shadow: var(--shadow-xs); }
.res-head { display: flex; align-items: center; gap: var(--sp-3); font-size: 13px; font-weight: 650; color: var(--heading); }
.res-head > .ic { color: var(--ok); flex: none; }
.res-sub { margin-left: auto; font-size: 11.5px; font-weight: 400; color: var(--muted); }
.res-sub b { color: var(--heading); font-weight: 600; }
.res-scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-4); margin-top: var(--sp-5); }
.res-col { padding: var(--sp-4); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface-2); }
.res-col-h { font-size: 12px; font-weight: 600; color: var(--heading); }
.res-col-cap { font-size: 10.5px; color: var(--muted); line-height: 1.35; margin: 2px 0 var(--sp-3); }
.res-metric { font-size: 13px; color: var(--body); display: flex; align-items: baseline; gap: 5px; }
.res-metric b { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--plum-700); }
.res-metric.sub b { font-size: 13px; color: var(--muted); font-weight: 500; }
.res-metric.sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.res-tune { margin-top: var(--sp-3); font-size: 11px; line-height: 1.45; color: var(--muted); }
.res-agree { display: flex; align-items: center; gap: 6px; margin-top: var(--sp-4); padding: 7px 11px; border-radius: var(--r-md); font-size: 12px; font-weight: 500; }
.res-agree .ic { flex: none; }
.res-agree.ok { color: var(--ok-text); background: var(--ok-surface); border: 1px solid var(--ok-border); }
.res-agree.warn { color: var(--warn-text); background: var(--warn-surface); border: 1px solid var(--warn-border); }
.res-foot { margin-top: var(--sp-4); font-size: 11px; color: var(--muted); }

/* ---- glossary term: dotted underline + hover/focus popover (plain-language definition) ---- */
.term { position: relative; border-bottom: 1px dotted var(--plum-300); cursor: help; outline: none; white-space: nowrap; }
.term:hover, .term:focus-visible { border-bottom-color: var(--plum); color: var(--plum-700); }
.term-pop { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); width: 240px; max-width: 62vw; padding: 9px 11px; background: var(--ink); color: var(--paper); font-family: var(--font-sans); font-size: 11px; font-weight: 400; line-height: 1.5; white-space: normal; text-align: left; border-radius: var(--r-md); box-shadow: var(--shadow-pop); opacity: 0; visibility: hidden; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); z-index: 70; pointer-events: none; }
.term:hover .term-pop, .term:focus-visible .term-pop { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.term-pop::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }

/* results card, flush variant — used on the model page (no chat-avatar indent) */
.res-card.flush { margin: 0; }

/* model-page: compact meta line under the results card */
.model-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3); margin-top: var(--sp-4); font-size: 12px; color: var(--muted); line-height: 1.5; }
.model-meta b { color: var(--heading); font-weight: 600; }
.mm-dot { width: 3px; height: 3px; border-radius: 999px; background: var(--border-strong); flex: none; }

/* model-page: "How it was built" numbered steps (replaces the reused feature rows) */
.build-steps { list-style: none; margin: var(--sp-3) 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.build-step { display: flex; align-items: flex-start; gap: var(--sp-3); padding: var(--sp-3); border-radius: var(--r-md); }
.build-step:hover { background: var(--surface-2); }
.bstep-n { flex: none; width: 20px; height: 20px; border-radius: 999px; background: var(--plum-50); color: var(--plum-700); border: 1px solid var(--plum-200); font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; display: grid; place-items: center; margin-top: 1px; }
.bstep-body { min-width: 0; }
.bstep-title { font-size: 12.5px; font-weight: 600; color: var(--heading); }
.bstep-blurb { font-size: 11.5px; color: var(--muted); line-height: 1.4; margin-top: 1px; }

/* model-page: plain-English "what the model actually is" + the honest Deep Solve badge */
.model-what { margin-top: var(--sp-3); font-size: 12.5px; color: var(--body); line-height: var(--lh-normal); max-width: 62ch; }
.mm-badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); cursor: help; white-space: nowrap; }
.mm-badge.on { color: var(--plum-700); background: var(--plum-50); border-color: var(--plum-200); }
.mm-badge.off { color: var(--muted); background: var(--surface-2); }

/* model-page: THE report — MODARA's own derivation story, section by section */
.report-story { display: flex; flex-direction: column; gap: var(--sp-5); }
.rstory-sec { display: grid; grid-template-columns: 132px 1fr; gap: var(--sp-5); align-items: start; }
.rstory-label { font-family: var(--font-display); font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--plum-700); padding-top: 1px; }
.rstory-body { font-size: 13px; color: var(--body); line-height: var(--lh-relaxed); max-width: 66ch; }
@container (max-width: 680px) { .rstory-sec { grid-template-columns: 1fr; gap: var(--sp-1); } }

/* model-page: how MODARA read each column */
/* ── Model scorecard card (accuracy / precision / recall / F1 …) ── */
.met-card { display: flex; flex-direction: column; gap: var(--sp-4); }
.met-tiles { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.met-tile { flex: 1 1 90px; min-width: 84px; padding: var(--sp-4); border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface); display: flex; flex-direction: column; gap: 2px; }
.met-tile.lead { background: var(--plum-50, var(--surface-2)); border-color: var(--plum-200, var(--border-soft)); }
.met-tile b { font-size: 22px; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.1; }
.met-tile span { font-size: 11.5px; color: var(--muted); display: flex; align-items: baseline; gap: 4px; }
.met-tile span i { font-size: 9.5px; font-style: normal; text-transform: uppercase; letter-spacing: 0.03em; color: var(--faint); }
.met-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.met-fact { font-size: 12px; padding: 4px 9px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted); }
.met-fact b { color: var(--heading); }
.met-fact i { font-style: italic; color: var(--faint); font-size: 11px; }
.met-cm { }
.met-cm-h { font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.met-cm-grid { display: grid; grid-template-columns: auto 1fr 1fr; gap: 4px; max-width: 380px; }
.met-cm-lab { font-size: 11px; color: var(--muted); display: flex; align-items: center; padding: 0 6px; }
.met-cm-cell { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; border-radius: var(--r-md); font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--heading); }
.met-cm-cell i { font-size: 9.5px; font-weight: 500; font-style: normal; text-transform: uppercase; letter-spacing: 0.02em; color: var(--muted); margin-top: 1px; }
.met-cm-cell.ok { background: var(--ok-surface); }
.met-cm-cell.bad { background: var(--warn-surface); }
.met-table { display: flex; flex-direction: column; }
.met-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 60px; gap: 8px; padding: 5px 8px; font-size: 12.5px; border-top: 1px solid var(--border-soft); }
.met-row:first-child { border-top: none; }
.met-row.head { color: var(--muted); font-size: 11px; }
.met-foot { font-size: 11.5px; color: var(--muted); line-height: 1.5; }

/* ── Error review card ("Where it goes wrong") ── */
.err-card { display: flex; flex-direction: column; gap: var(--sp-4); }
.err-lead { font-size: 13.5px; color: var(--body); }
.err-lead b { color: var(--heading); }
.err-block { display: flex; flex-direction: column; gap: 3px; }
.err-h { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.err-row { display: grid; grid-template-columns: 40px 1fr 92px; align-items: center; gap: var(--sp-3); font-size: 12.5px; }
.err-cls { font-family: var(--font-mono); font-weight: 600; color: var(--heading); }
.err-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.err-bar i { display: block; height: 100%; background: var(--warn-text, #a15c00); border-radius: 999px; }
.err-num { text-align: right; color: var(--muted); font-size: 11px; }
.err-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.err-fact { font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted); }
.err-fact b { color: var(--heading); }
.err-sig { font-size: 12.5px; color: var(--body); }
.err-sig b { color: var(--heading); font-weight: 600; }
.err-foot { font-size: 11px; color: var(--faint); font-style: italic; }

.coltreat { display: flex; flex-direction: column; gap: 2px; }
.ct-row { display: grid; grid-template-columns: minmax(120px, 1.1fr) 96px 2fr; gap: var(--sp-4); align-items: baseline; padding: var(--sp-3) var(--sp-3); border-radius: var(--r-md); }
.ct-row:hover { background: var(--surface-2); }
.ct-name { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-role { font-size: 10.5px; font-weight: 600; text-align: center; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.ct-role.r-predicting { color: var(--plum-700); background: var(--plum-50); border-color: var(--plum-200); }
.ct-role.r-held-out { color: var(--warn-text); background: var(--warn-surface); border-color: var(--warn-border); }
.ct-role.r-time-order, .ct-role.r-identifier { color: var(--ok-text); background: var(--ok-surface); border-color: var(--ok-border); }
.ct-role.r-engineered { color: var(--info-text); background: var(--info-surface); border-color: var(--info-border); }
.ct-note { font-size: 12px; color: var(--muted); line-height: var(--lh-snug); }
@container (max-width: 680px) { .ct-row { grid-template-columns: 1fr auto; } .ct-note { grid-column: 1 / -1; } }

/* ── Put to work (deployment tab) — light rows that match the rest of the system;
   deliberately NOT the Monitor page's heavy 40px status-colour icon boxes. ─────────── */
.ptw-row { display: flex; align-items: center; gap: var(--sp-5); padding: var(--sp-5) var(--sp-6); border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); }
.ptw-row + .ptw-row { margin-top: var(--sp-3); }
.ptw-ic { flex: none; width: 30px; height: 30px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.ptw-ic svg { width: 15px; height: 15px; }
.ptw-body { flex: 1; min-width: 0; }
.ptw-title { font-size: 13px; font-weight: 600; color: var(--heading); }
.ptw-note { font-size: 11.5px; color: var(--muted); line-height: var(--lh-snug); margin-top: 2px; }
.ptw-tag { flex: none; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.ptw-tag.on { color: var(--plum-700); background: var(--plum-50); border-color: var(--plum-200); }
.ptw-card { border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface-2); padding: var(--sp-6); }
.ptw-card .panel-title { margin-bottom: var(--sp-3); }
.ptw-card + .ptw-row, .ptw-row + .ptw-card, .ptw-card + .ptw-card { margin-top: var(--sp-3); }
.ptw-foot { font-size: 11.5px; color: var(--muted); line-height: var(--lh-normal); margin-top: var(--sp-4); }

/* ── Analyst cards: descriptive / drivers / what-if / report ─────────────────────────── */
.desc-card, .drv-card { margin: var(--sp-5) 0 0 calc(26px + var(--sp-3)); padding: var(--sp-5) var(--sp-6); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); overflow: hidden; }
.desc-code { font-family: var(--mono, ui-monospace, monospace); font-size: 12px; background: var(--paper); border: 1px solid var(--border-soft); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); overflow-x: auto; color: var(--body); white-space: pre-wrap; }
.desc-scalar { font-size: 22px; font-weight: 700; color: var(--heading); margin-top: var(--sp-3); }
.desc-tablewrap { overflow-x: auto; margin-top: var(--sp-3); }
.desc-table { border-collapse: collapse; font-size: 12.5px; width: 100%; }
.desc-table th { text-align: left; font-size: 11px; color: var(--muted); padding: 4px 12px 4px 0; border-bottom: 1px solid var(--border); }
.desc-table td { padding: 4px 12px 4px 0; border-bottom: 1px solid var(--border-soft); color: var(--body); }
.desc-note { margin-top: var(--sp-3); font-size: 11px; color: var(--muted); font-style: italic; }
.drv-list { margin-top: var(--sp-4); display: flex; flex-direction: column; gap: 8px; }
.drv-row { display: grid; grid-template-columns: minmax(120px, 1.4fr) 1fr auto auto; gap: var(--sp-4); align-items: center; }
.drv-name { font-size: 12px; color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drv-dir { font-size: 11.5px; font-weight: 600; }
.drv-dir.up { color: var(--alert-text); }
.drv-dir.down { color: var(--ok-text); }
.drv-rates { font-size: 11px; color: var(--muted); }

/* ── Triage card ─────────────────────────────────────────────────────────────────────── */
.triage-list { margin-top: var(--sp-4); display: flex; flex-direction: column; gap: 6px; }
.triage-row { display: grid; grid-template-columns: auto minmax(60px, auto) 1fr; gap: var(--sp-4); align-items: baseline; font-size: 12px; }
.triage-kind { font-size: 10.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.triage-kind.fix { background: var(--ok-surface); color: var(--ok-text); border: 1px solid var(--ok-border); }
.triage-kind.info { background: var(--plum-50); color: var(--plum); border: 1px solid var(--plum-200); }
.triage-where { color: var(--muted); font-size: 11px; white-space: nowrap; }
.triage-detail { color: var(--body); }

/* ── File viewer (Data tab → click a file row) ─────────────────────────────────────── */
.fv-scrim { position: fixed; inset: 0; z-index: 80; background: oklch(0.30 0.02 60 / 0.34); backdrop-filter: blur(2px); display: grid; place-items: center; padding: var(--sp-6); animation: fade-in .14s ease; }
.fv-modal { width: min(1080px, 100%); height: min(720px, 86vh); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); overflow: hidden; animation: mdl-in .16s cubic-bezier(.2,.8,.3,1); }
.fv-head { display: flex; align-items: flex-start; gap: var(--sp-4); padding: var(--sp-5) var(--sp-6) var(--sp-4); border-bottom: 1px solid var(--border-soft); }
.fv-head > div:first-child { flex: 1; min-width: 0; }
.fv-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; letter-spacing: -0.01em; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-meta { font-size: 12px; color: var(--muted); margin-top: 4px; font-family: var(--font-mono); }
.fv-body { flex: 1; min-height: 0; overflow: auto; padding: 0; background: var(--paper); }
.fv-table-wrap { overflow-x: auto; }
.fv-table { width: 100%; border-collapse: collapse; font-size: 12.5px; font-family: var(--font-mono); }
.fv-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--heading); font-family: var(--font-display); font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.fv-table tbody td { padding: 8px 14px; border-bottom: 1px solid var(--border-soft); color: var(--text); white-space: nowrap; max-width: 360px; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.fv-table tbody tr:nth-child(even) td { background: color-mix(in oklch, var(--surface) 60%, transparent); }
.fv-table tbody tr:hover td { background: color-mix(in oklch, var(--plum) 6%, var(--surface)); }
.fv-na { color: var(--faint); font-style: italic; }
.fv-empty { padding: var(--sp-9); text-align: center; color: var(--muted); font-size: 13px; }
.fv-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); padding: var(--sp-4) var(--sp-6); border-top: 1px solid var(--border-soft); background: var(--surface-2); flex-wrap: wrap; }
.fv-pager { display: flex; align-items: center; gap: var(--sp-3); }
.fv-range { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); }
.fv-pagesz { display: inline-flex; align-items: center; gap: var(--sp-3); font-size: 12px; color: var(--muted); }
.fv-pagesz .inp.sel { padding: 4px 8px; font-size: 12px; }

/* ============================================================
   POLISH LAYER — previously-unstyled states, feedback & focus
   (loading screens, banners, toasts, ⌘K keyboard nav,
   drag-drop veil, scrollbars, focus rings)
   ============================================================ */

/* ---- spinner + boot/loading states (were unstyled text) ---- */
.spin { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--plum); border-radius: 999px; animation: spin 0.7s linear infinite; flex: none; }
.auth-loading { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--sp-5); color: var(--muted); font-size: var(--fs-body); animation: fadev 0.4s var(--ease-out) both; }
.auth-loading .spin { width: 26px; height: 26px; border-width: 2.5px; }
.home-loading { display: flex; align-items: center; justify-content: center; gap: var(--sp-4); padding: var(--sp-12) 0; color: var(--muted); font-size: var(--fs-body); }

/* ---- Home empty state (first-run) ---- */
.home-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--sp-4); padding: var(--sp-12) var(--sp-8); margin: var(--sp-8) auto 0; max-width: 460px; border: 1.5px dashed var(--border); border-radius: var(--r-xl); background: var(--surface); }
.home-empty h3 { font-family: var(--font-display); font-weight: 500; font-size: 22px; letter-spacing: -0.015em; color: var(--ink); margin: 0; }
.home-empty p { font-size: var(--fs-body); color: var(--muted); line-height: var(--lh-snug); margin: 0; max-width: 30em; }

/* ---- inline banners (error / success) ---- */
.home-banner-warn, .home-banner-ok { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; line-height: var(--lh-snug); border-radius: var(--r-md); padding: 10px 14px; margin-bottom: var(--sp-5); animation: fadev 0.25s var(--ease-out) both; }
.home-banner-warn { color: var(--alert-text); background: var(--alert-surface); border: 1px solid var(--alert-border); }
.home-banner-ok { color: var(--ok-text); background: var(--ok-surface); border: 1px solid var(--ok-border); }
.home-banner-warn .ic, .home-banner-ok .ic { flex: none; }
.home-banner-warn span, .home-banner-ok span { flex: 1; min-width: 0; }
.home-banner-warn button { flex: none; font: inherit; font-size: 11.5px; font-weight: 600; color: inherit; background: transparent; border: 1px solid currentColor; border-radius: var(--r-pill); padding: 3px 12px; cursor: pointer; }
.home-banner-warn button:hover { background: color-mix(in oklch, currentColor 10%, transparent); }

/* Calm, non-alarming notice for a transient LOAD failure on a tab (couldn't reach a sub-resource).
   Deliberately NOT the red alert banner: a not-yet-built or momentarily-unreachable model is not an
   error the user caused, so it reads as a muted "try again" rather than a red failure. Red stays for
   genuine user-action failures (save, upload, create). */
.tab-load-note { display: flex; align-items: center; gap: var(--sp-3); font-size: 12.5px; line-height: var(--lh-snug); color: var(--warn-text); background: var(--warn-surface); border: 1px solid var(--warn-border); border-radius: var(--r-md); padding: 10px 14px; margin-top: var(--sp-4); animation: fadev 0.25s var(--ease-out) both; }
.tab-load-note .ic { flex: none; opacity: 0.8; }
.tab-load-note span { flex: 1; min-width: 0; }

/* ---- auth error ---- */
.auth-error { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--alert-text); background: var(--alert-surface); border: 1px solid var(--alert-border); border-radius: var(--r-md); padding: 9px 12px; animation: fadev 0.2s var(--ease-out) both; }

/* ---- toasts (replace window.alert) ---- */
.toasts { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: min(480px, 90vw); padding: 11px 18px; border-radius: var(--r-lg); background: var(--ink); color: var(--paper); font-family: var(--font-sans); font-size: 13px; line-height: 1.45; box-shadow: var(--shadow-pop); animation: toast-in 0.28s var(--ease-out) both; }
.toast svg { width: 16px; height: 16px; flex: none; stroke: currentColor; }
.toast.ok svg { color: oklch(0.78 0.13 150); }
.toast.err svg { color: oklch(0.75 0.14 30); }
.toast.out { animation: toast-out 0.22s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px) scale(0.98); } }

/* ---- ⌘K: keyboard selection + footer hints ---- */
.cmdk-item[data-sel="1"] { background: var(--plum-50); }
.cmdk-item[data-sel="1"] .ic { color: var(--plum); }
.cmdk-item[data-sel="1"] .cmdk-label { color: var(--plum-700); }
.cmdk-empty { display: block; width: 100%; text-align: left; border: none; background: none; cursor: pointer; border-radius: var(--r-md); font: inherit; }
.cmdk-empty:hover, .cmdk-empty[data-sel="1"] { background: var(--plum-50); color: var(--plum-700); }
.cmdk-foot { display: flex; align-items: center; gap: var(--sp-5); padding: 7px var(--sp-5); border-top: 1px solid var(--border-soft); background: var(--surface-2); font-size: 10.5px; color: var(--faint); }
.cmdk-foot kbd { font-family: var(--font-mono); font-size: 9.5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xs); padding: 1px 5px; color: var(--muted); margin-right: 4px; }

/* ---- Data tab: drag-and-drop veil ---- */
.drop-veil { position: absolute; inset: var(--sp-4); z-index: 6; border: 2px dashed var(--plum-300); border-radius: var(--r-xl); background: color-mix(in oklch, var(--plum-50) 82%, transparent); display: grid; place-items: center; pointer-events: none; animation: fadev 0.15s var(--ease-out) both; }
.drop-veil-inner { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); color: var(--plum-700); }
.drop-veil-inner .ic { width: 30px; height: 30px; }
.drop-veil-inner b { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.drop-veil-inner span { font-size: 12px; color: var(--plum-700); opacity: 0.8; }

/* ---- kebab menus must be reachable on touch (no hover) ---- */
@media (hover: none) { .kebab { opacity: 1; } }

/* ---- keyboard focus ring (visible only for keyboard users) ---- */
:where(button, [role="button"], a, [tabindex]):focus-visible { outline: 2px solid var(--plum-300); outline-offset: 2px; }

/* ---- quiet, crafted scrollbars ---- */
html { scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border: 3.5px solid transparent; background-clip: padding-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); background-clip: padding-box; }

/* ============================================================
   LEGAL & POLICY  ·  Terms / Privacy / Attributions overlay
   + honest Privacy-page data-flow map + landing footer
   (tokens are theme-aware, so light/dark come for free)
   ============================================================ */

/* ---- overlay shell ---- */
.legal-scrim { position: fixed; inset: 0; z-index: 200; background: oklch(0.18 0.01 60 / 0.42);
  display: grid; place-items: start center; padding: max(4vh, 24px) 16px; overflow-y: auto;
  animation: fadev 0.15s var(--ease-out); }
.legal-modal { width: min(880px, 96vw); max-height: 92vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop); overflow: hidden; animation: pop-in 0.18s var(--ease-out); }

.legal-top { display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-6); border-bottom: 1px solid var(--border-soft); flex: none; }
.legal-brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-display);
  font-weight: 600; font-size: 15px; color: var(--heading); letter-spacing: -0.01em; }
.legal-brand .word { text-transform: lowercase; }
.legal-x { display: grid; place-items: center; width: 30px; height: 30px; border: none; background: transparent;
  color: var(--muted); border-radius: var(--r-sm); cursor: pointer; }
.legal-x:hover { background: var(--surface-2); color: var(--heading); }

.legal-tabs { display: flex; gap: 2px; padding: 0 var(--sp-6); border-bottom: 1px solid var(--border-soft); flex: none; }
.legal-tab { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: var(--fs-small);
  font-weight: 500; color: var(--muted); background: transparent; border: none; cursor: pointer;
  padding: var(--sp-4) var(--sp-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.legal-tab .ic { width: 15px; height: 15px; }
.legal-tab:hover { color: var(--heading); }
.legal-tab[data-on="1"] { color: var(--plum-700); border-bottom-color: var(--plum); }

.legal-body { overflow-y: auto; padding: var(--sp-6) clamp(var(--sp-6), 6vw, var(--sp-10)) var(--sp-9);
  max-width: 760px; margin: 0 auto; width: 100%; }

.legal-draft { display: flex; align-items: center; gap: 8px; font-size: var(--fs-small); font-weight: 500;
  color: var(--warn-text); background: var(--warn-surface); border: 1px solid var(--ok-border);
  border-color: color-mix(in oklch, var(--warn-text) 30%, transparent);
  border-radius: var(--r-md); padding: 9px 12px; margin-bottom: var(--sp-6); }
.legal-draft .ic { flex: none; color: var(--warn-text); }

.legal-head h1 { font-family: var(--font-display); font-weight: 600; font-size: clamp(22px, 3vw, 28px);
  letter-spacing: -0.02em; color: var(--ink); margin: 0; }
.legal-tagline { font-size: var(--fs-body); color: var(--muted); margin: var(--sp-3) 0 0; line-height: var(--lh-snug); }
.legal-meta { font-size: var(--fs-micro); color: var(--faint); margin: var(--sp-3) 0 0; font-family: var(--font-mono); }

.legal-sec { margin-top: var(--sp-7); }
.legal-sec h3 { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--heading);
  margin: 0 0 var(--sp-3); letter-spacing: -0.01em; }
.lg-p { font-size: 13.5px; line-height: 1.62; color: var(--text); margin: 0 0 var(--sp-3); }
.lg-p:last-child { margin-bottom: 0; }
.lg-sub { font-size: 13px; font-weight: 600; color: var(--heading); margin: var(--sp-4) 0 var(--sp-2); }
.lg-ul { margin: 0 0 var(--sp-3); padding-left: 1.15em; display: flex; flex-direction: column; gap: 6px; }
.lg-ul li { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.lg-note { display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; line-height: 1.55;
  color: var(--text); background: var(--plum-50); border: 1px solid var(--plum-100);
  border-radius: var(--r-md); padding: 10px 13px; margin: var(--sp-3) 0; }
.lg-note .ic { flex: none; color: var(--plum); margin-top: 1px; }

.lg-table-wrap { overflow-x: auto; margin: var(--sp-2) 0 var(--sp-4); border: 1px solid var(--border-soft); border-radius: var(--r-md); }
.lg-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 460px; }
.lg-table th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--fs-micro);
  text-transform: uppercase; letter-spacing: 0.04em; padding: 9px 12px; border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2); }
.lg-table td { padding: 9px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text); vertical-align: top; }
.lg-table tr:last-child td { border-bottom: none; }
.lg-td-name { font-weight: 600; color: var(--heading); white-space: nowrap; }
.lg-td-role { color: var(--muted); }
.lg-lic { font-family: var(--font-mono); font-size: 11px; color: var(--plum-700); background: var(--plum-50);
  border: 1px solid var(--plum-100); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }

.legal-foot { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-8);
  padding-top: var(--sp-5); border-top: 1px solid var(--border-soft); }
.legal-foot-link { display: inline-flex; align-items: center; gap: 5px; font: inherit; font-size: var(--fs-small);
  font-weight: 500; color: var(--plum-700); background: transparent; border: none; cursor: pointer; padding: 4px 0; }
.legal-foot-link:hover { text-decoration: underline; }

/* inline text button inside the auth "By continuing…" line */
.legal-inline { font: inherit; color: var(--plum-700); background: transparent; border: none; padding: 0;
  cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.legal-inline:hover { color: var(--plum); }

/* ---- landing / auth footer ---- */
.land-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-5); flex-wrap: wrap;
  margin-top: auto; padding: var(--sp-6) clamp(var(--sp-6), 6vw, var(--sp-10)); border-top: 1px solid var(--border-soft); }
.lf-brand { display: inline-flex; align-items: center; gap: 7px; font-family: var(--font-display); font-weight: 600;
  font-size: 13.5px; color: var(--muted); letter-spacing: .06em; }
.lf-links { display: flex; gap: var(--sp-4); }
.lf-links button, .lf-links a { font: inherit; font-size: var(--fs-small); color: var(--muted); background: transparent;
  border: none; cursor: pointer; padding: 2px 0; }
.lf-links a { text-decoration: none; }
.lf-links button:hover, .lf-links a:hover { color: var(--heading); }
.lf-copy { font-size: var(--fs-micro); color: var(--faint); font-family: var(--font-mono); }

/* ---- Privacy page: "what leaves your workspace" flow ---- */
.priv-flow { display: flex; flex-direction: column; gap: var(--sp-2); }
.pf-row { display: flex; gap: var(--sp-4); align-items: flex-start; padding: var(--sp-4); border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-soft); }
.pf-ic { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; flex: none; }
.pf-ic .ic { width: 17px; height: 17px; }
.pf-ic.ai { background: var(--plum-50); color: var(--plum); border: 1px solid var(--plum-100); }
.pf-ic.web { background: var(--warn-surface); color: var(--warn-text); border: 1px solid color-mix(in oklch, var(--warn-text) 22%, transparent); }
.pf-ic.stay { background: var(--ok-surface); color: var(--ok-text); border: 1px solid var(--ok-border); }
.pf-txt { min-width: 0; }
.pf-t { font-size: 13.5px; font-weight: 600; color: var(--heading); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pf-d { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: var(--lh-snug); }
.pf-tag { font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--muted); background: var(--surface-3); border: 1px solid var(--border-soft); border-radius: 5px; padding: 1px 6px; }
.pf-tag.ok { color: var(--ok-text); background: var(--ok-surface); border-color: var(--ok-border); }

/* ---- Privacy page: policy links row ---- */
.priv-links { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-top: var(--sp-2); }
.priv-link { display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: var(--fs-small);
  font-weight: 500; color: var(--muted); background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--r-md); padding: 8px 13px; cursor: pointer; }
.priv-link .ic { width: 15px; height: 15px; color: var(--plum); }
.priv-link:hover { border-color: var(--border); color: var(--heading); background: var(--surface-2); }

/* ── A3: claim → verdict (BeliefCard) + the frame card's optional hunch input ── */
.belief-card { margin: var(--sp-3) 0; padding: 12px 14px; border-radius: var(--r-md);
  border: 1px solid var(--border-soft); background: var(--surface); max-width: 620px; }
.belief-head { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.belief-chip { font-size: 11px; font-weight: 600; letter-spacing: .02em; padding: 3px 9px;
  border-radius: 999px; border: 1px solid var(--border-soft); color: var(--muted); background: var(--surface-2); }
.belief-chip-ok   { color: var(--ok-text);   background: var(--ok-surface);   border-color: var(--ok-border); }
.belief-chip-bad  { color: var(--err-text, var(--danger, #b4232a)); background: var(--warn-surface); border-color: var(--warn-border); }
.belief-chip-warn { color: var(--warn-text); background: var(--warn-surface); border-color: var(--warn-border); }
.belief-stat { font-family: var(--font-mono); font-size: 11px; color: var(--muted); }
.belief-claim { margin-top: 8px; font-size: 13px; color: var(--heading); font-style: italic; }
.belief-note { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: var(--text, inherit); }
.belief-next { margin-top: 8px; font-size: 11.5px; color: var(--ok-text); }
.belief-info .belief-next { color: var(--muted); }

.spec-hunch { display: flex; flex-direction: column; gap: 5px; margin-top: var(--sp-4); }
.spec-hunch > span { font-size: 12px; color: var(--muted); }
.spec-hunch > span em { font-style: normal; opacity: .7; }
.spec-hunch input { font: inherit; font-size: 13px; padding: 8px 11px; border-radius: var(--r-md);
  border: 1px solid var(--border-soft); background: var(--surface); color: var(--heading); }
.spec-hunch input:focus { outline: none; border-color: var(--border); }
.spec-hunch-note { font-size: 11px; color: var(--muted); line-height: 1.5; }

/* ── A1: the reflection lead on the frame card ── */
.spec-reflect { margin-top: var(--sp-3); padding: 11px 13px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-soft); }
.spec-reflect p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--heading); }
.spec-reflect-q { margin-top: 10px; display: flex; flex-direction: column; gap: 7px; }
.spec-reflect-ask { display: flex; align-items: flex-start; gap: 5px; font-size: 12.5px; color: var(--warn-text); }
.spec-reflect-ask code { font-family: var(--font-mono); font-size: 11.5px; }
.spec-reflect-safe { font-size: 11.5px; line-height: 1.5; color: var(--warn-text); }
.spec-reflect-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.spec-reflect-btns button { display: flex; flex-direction: column; gap: 2px; min-width: 210px; font: inherit; font-size: 12px; font-weight: 500; padding: 7px 10px;
  border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface);
  color: var(--heading); text-align: left; cursor: pointer; }
.spec-reflect-btns button:hover { border-color: var(--border); background: var(--surface-2); }
.spec-reflect-btns strong { font: inherit; font-size: 11.5px; font-weight: 650; }
.spec-reflect-btns small { font: inherit; font-size: 10.5px; line-height: 1.35; color: var(--muted); }
.spec-reflect-btns button:last-child { color: var(--warn-text); }
.spec-reflect-more { font-size: 11px; color: var(--muted); }
.spec-reflect-error { font-size: 11px; color: var(--err-text, var(--danger, #b4232a)); }
.spec-reflect-meaning { display: flex; gap: 8px; flex-wrap: wrap; }
.spec-reflect-meaning input { flex: 1 1 240px; min-width: 180px; font: inherit; font-size: 12.5px; padding: 6px 10px;
  border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface); color: var(--heading); }
.spec-reflect-meaning input:focus { outline: none; border-color: var(--border); }
.spec-reflect-meaning button { font: inherit; font-size: 11.5px; padding: 6px 10px; border-radius: var(--r-md);
  border: 1px solid var(--border-soft); background: var(--surface); color: var(--heading); cursor: pointer; }
.spec-reflect-meaning button:disabled { opacity: .5; cursor: default; }

/* ── the leakage check hasn't finished: the column list above is PROVISIONAL ── */
.spec-leakwait { margin-top: var(--sp-3); padding: 10px 13px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border-soft); }
.spec-leakwait-row { display: flex; align-items: flex-start; gap: var(--sp-2);
  font-size: 12.5px; line-height: 1.55; color: var(--body); }
.spec-leakwait-opt { display: flex; align-items: center; gap: 7px; margin-top: 9px;
  font-size: 12.5px; color: var(--heading); cursor: pointer; }
.spec-leakwait-opt input { cursor: pointer; }

/* ── the mid-run review gate: the run is PARKED until this is answered ── */
.leak-gate { margin-top: var(--sp-3); padding: 11px 13px; border-radius: var(--r-md);
  background: var(--warn-surface); border: 1px solid var(--warn-border); }
.leak-gate-head { display: flex; align-items: center; gap: 7px; font-size: 12.5px;
  font-weight: 600; color: var(--heading); }
.leak-gate-note { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: var(--body); }
.leak-gate-warn { margin-top: 8px; font-size: 12px; line-height: 1.5; color: var(--warn-text); }
.leak-gate-btns { display: flex; gap: 8px; margin-top: 10px; }
/* a held-out chip the user clicked BACK IN — no strike-through, it's a feature again */
.spec-chip.leak.off { background: var(--paper); border-color: var(--border);
  color: var(--body); text-decoration: none; }
.leak-gate .spec-chip.leak { cursor: pointer; }

/* ── A4: free-text meaning answer on the clarify card ── */
.dc-meaning { font: inherit; font-size: 12.5px; padding: 6px 10px; min-width: 240px;
  border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface);
  color: var(--heading); }
.dc-meaning:focus { outline: none; border-color: var(--border); }

/* ── D2: support link in Settings ── */
.set-support { display: inline-flex; align-items: center; font: inherit; font-size: 12.5px;
  font-weight: 500; padding: 8px 14px; border-radius: var(--r-md); text-decoration: none;
  border: 1px solid var(--border-soft); background: var(--surface); color: var(--heading); white-space: nowrap; }
.set-support:hover { border-color: var(--border); background: var(--surface-2); }

/* ── Explainability tab ── */
.ex-sec { margin-top: var(--sp-6); max-width: 720px; }
.ex-sec h3 { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--heading); margin: 0 0 10px; }
.ex-sec h3 svg { width: 15px; height: 15px; color: var(--plum, var(--muted)); }
.ex-sec h4 { font-size: 12.5px; color: var(--heading); margin: 12px 0 6px; }

/* ══ Explainability tab — one surface, several focused pages behind a segmented switch. Light
   panels with a consistent header (no mismatched boxed frames stitched down the page). ══ */
.ex-nav { display: flex; flex-wrap: wrap; gap: 4px; margin: var(--sp-6) 0 var(--sp-2); padding: 4px;
  border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface-2); width: fit-content; max-width: 100%; }
.ex-navtab { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px; font-weight: 500;
  padding: 7px 13px; border: none; border-radius: var(--r-md); background: transparent; color: var(--muted); cursor: pointer;
  white-space: nowrap; transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease); }
.ex-navtab svg { opacity: 0.7; }
.ex-navtab:hover { color: var(--heading); background: color-mix(in oklch, var(--plum) 7%, transparent); }
.ex-navtab.on { background: var(--surface); color: var(--plum-700, var(--heading)); font-weight: 600; box-shadow: var(--shadow-1, 0 1px 2px rgba(0,0,0,0.06)); }
.ex-navtab.on svg { opacity: 1; color: var(--plum-700, var(--heading)); }
.ex-view { max-width: 720px; display: flex; flex-direction: column; gap: var(--sp-6); margin-top: var(--sp-5); }

/* the Trust verdict — the one number a person reads, prominent */
.ex-verdict { padding: var(--sp-6) 0 var(--sp-5); border-bottom: 1px solid var(--border-soft); }
.ex-verdict-metric { display: flex; align-items: baseline; gap: 8px; font-size: 15px; color: var(--muted); }
.ex-verdict-metric b { font-size: 34px; font-weight: 700; color: var(--heading); font-variant-numeric: tabular-nums; line-height: 1.05; }
.ex-verdict-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.ex-verdict-blurb { font-size: 13px; color: var(--body); line-height: var(--lh-relaxed); margin: var(--sp-4) 0 0; max-width: 62ch; }
.ex-rulers { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: var(--sp-4); font-size: 11.5px; color: var(--faint); }
.ex-rulers span { white-space: nowrap; }

/* a content block — consistent header, no heavy border */
.ex-panel { }
.ex-panel-h { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 13.5px;
  font-weight: 600; color: var(--heading); margin-bottom: var(--sp-4); }
.ex-panel-tag { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: var(--muted);
  padding: 2px 8px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface-2); }

/* Chart/Table toggle on a panel header */
.ex-toggle { margin-left: auto; display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-pill); border: 1px solid var(--border-soft); background: var(--surface-2); }
.ex-toggle button { font: inherit; font-size: 11px; font-weight: 500; padding: 3px 10px; border: none; border-radius: var(--r-pill); background: transparent; color: var(--muted); cursor: pointer; }
.ex-toggle button.on { background: var(--surface); color: var(--plum-700, var(--heading)); font-weight: 600; box-shadow: var(--shadow-1, 0 1px 2px rgba(0,0,0,0.06)); }
.ex-calib { max-width: 300px; }
.ex-calib .fig-svg { width: 100%; height: auto; }
.ex-calib-cap { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: var(--sp-2) 0 0; }

/* leakage, detached from its old box — plain labelled chip rows */
.ex-leak { display: flex; flex-direction: column; gap: var(--sp-4); }
.ex-leak-row { display: flex; flex-direction: column; gap: 6px; }
.ex-leak-lab { font-size: 11px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }
.ex-leak-lab.danger { color: var(--warn-text); }
.ex-leak-none { font-size: 12.5px; color: var(--ok-text, var(--muted)); }
.ex-facts { display: flex; flex-wrap: wrap; gap: 8px; }
.ex-fact { font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--muted); }
.ex-fact b { color: var(--heading); }
.ex-note { font-size: 12px; color: var(--muted); line-height: 1.55; margin: 8px 0 0; }
.ex-note.warn { color: var(--warn-text); }
.ex-note a { color: var(--plum, var(--heading)); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.ex-driver, .ex-contrib { display: grid; grid-template-columns: minmax(140px, 1.2fr) 1fr 56px; align-items: center; gap: 10px; padding: 3px 0; font-size: 12.5px; }
.ex-d-label, .ex-c-col { color: var(--heading); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ex-bar i { display: block; height: 100%; background: var(--plum, #6E4A63); border-radius: 999px; }
.ex-bar.signed.up i { background: var(--warn-text, #a15c00); }
.ex-bar.signed.down i { background: var(--ok-text, #1c7a4d); }
.ex-d-share, .ex-c-delta { text-align: right; font-size: 11px; color: var(--muted); }
.ex-rowpick { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 12.5px; color: var(--muted); }
.ex-rowpick input, .ex-rowpick select { font: inherit; font-size: 12.5px; padding: 6px 9px; border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface); color: var(--heading); width: 90px; }
.ex-rowpick select { width: auto; max-width: 220px; }
.ex-chip { font: inherit; font-size: 12px; font-weight: 500; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border-soft); background: var(--surface); color: var(--heading); cursor: pointer; }
.ex-chip:hover { border-color: var(--border); background: var(--surface-2); }
.ex-chip.go { background: var(--plum, #6E4A63); border-color: var(--plum, #6E4A63); color: #fff; }
.ex-headline { font-size: 13px; color: var(--heading); margin: 12px 0 8px; }
.ex-local { margin-top: 4px; }
.ex-recourse { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-md); border: 1px solid var(--border-soft); background: var(--surface); }
.ex-rec-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 4px 0; font-size: 12.5px; }
.ex-rec-chg { padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border-soft); color: var(--heading); }
.ex-rec-to { color: var(--ok-text); font-weight: 600; }
.ex-bands { margin-top: 6px; border: 1px solid var(--border-soft); border-radius: var(--r-md); overflow: hidden; }
.ex-band { display: grid; grid-template-columns: 1fr 1fr 64px; gap: 8px; padding: 6px 12px; font-size: 12px; color: var(--heading); border-top: 1px solid var(--border-soft); }
.ex-bands.fair .ex-band { grid-template-columns: 1.4fr 60px 1fr 1fr 1fr; }
.ex-band:first-child { border-top: none; }
.ex-band.head { background: var(--surface-2); color: var(--muted); font-size: 11px; }
.ex-band .dim { color: var(--muted); }

/* ── "Additional detail" expanders: the slightly-relevant material (build story, column table,
   technical rulers) stays one click away instead of shouting at every user ── */
.ex-more { margin-top: var(--sp-3); max-width: 720px; border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: var(--surface); }
.ex-more-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; border: none; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--heading); cursor: pointer; text-align: left; border-radius: var(--r-lg); }
.ex-more-head:hover { background: var(--surface-2); }
.ex-more.open .ex-more-head { border-bottom: 1px solid var(--border-soft); border-radius: var(--r-lg) var(--r-lg) 0 0; }
.ex-more-head svg { width: 13px; height: 13px; color: var(--muted); flex: none; }
.ex-more-sub { font-weight: 400; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-more-body { padding: var(--sp-5) 14px; }

/* ── knowledge compilation: compiled framings on the belief card ── */
.belief-variants { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.bv-head { font-size: 11px; color: var(--muted); }
.bv-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bv-text { color: var(--heading); flex: 1; min-width: 0; }
.bv-chip { flex: none; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border-soft); background: var(--surface-2); color: var(--muted); }
.bv-chip.ok { color: var(--ok-text); background: var(--ok-surface); border-color: var(--ok-border); }
.bv-chip.pending { font-style: italic; font-weight: 500; }

/* Decision intelligence entry brief: compact enough to sit above the first chat turn, with
   previous investigations deliberately secondary to the ask box. */
.di-brief { margin: 0 auto 20px; max-width: 760px; padding: 18px 20px; border: 1px solid var(--border-soft); border-radius: var(--r-lg); background: linear-gradient(135deg, var(--surface), var(--surface-2)); }
.di-brief-head { display: flex; align-items: center; gap: 11px; }
.di-brief-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 10px; color: var(--plum); background: var(--plum-50); }
.di-brief-icon .ic { width: 16px; height: 16px; }
.di-brief-kicker { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.di-brief h3 { margin: 2px 0 0; font-size: 16px; color: var(--heading); }
.di-brief-copy { margin: 11px 0 14px 41px; font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.di-opp-list { display: flex; flex-direction: column; gap: 7px; }
.di-opp { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border-soft); border-radius: var(--r-md); background: var(--surface); }
.di-opp-main { flex: 1; min-width: 0; }
.di-opp-q { color: var(--heading); font-size: 13px; line-height: 1.35; }
.di-opp-meta { margin-top: 4px; color: var(--muted); font-size: 11px; }
.di-opp-ask { flex: none; padding: 6px 12px; }
.di-history { margin-top: 14px; border-top: 1px solid var(--border-soft); padding-top: 10px; }
.di-history summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.di-history summary span { margin-left: 5px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); }
.di-history-list { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; }
.di-history-row { display: flex; gap: 8px; font-size: 11.5px; color: var(--heading); }
.di-history-state { flex: none; color: var(--muted); min-width: 72px; }
