:root {
  font-family:Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color-scheme:light;
  --bg:#f5f5f5;
  --surface:#fff;
  --soft:#fafafa;
  --rail:#f0f0f0;
  --text:#202020;
  --dim:#626262;
  --line:#e2e2e2;
  --brand:#0e7490;
  --focus:#0e7490;
  --on-brand:#fff;
  --complete:#0369a1;
  --active:#6d28d9;
  --unknown:#626262;
  --red:#b42318;
  --radius:12px;
  --pane:360px;
  color:var(--text);
  background:var(--surface)}
* {
  box-sizing:border-box}
body {
  margin:0;
  font-size:14px}
button,input,select,textarea {
  font:inherit}
button,a,label.attach,select {
  touch-action:manipulation}
button {
  cursor:pointer;
  color:inherit;
  border:1px solid var(--line);
  border-radius:9px;
  background:var(--surface);
  padding:9px 12px}
button:hover:not(:disabled) {
  background:var(--bg)}
button:disabled {
  cursor:not-allowed;
  opacity:.5}
a {
  color:var(--brand)}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,[role="tab"]:focus-visible {
  outline:2px solid var(--focus);
  outline-offset:3px}
[hidden] {
  display:none!important}
.shell {
  height:calc(100dvh - 60px);
  display:flex;
  overflow:hidden}
.wordmark {
  font-size:22px;
  font-weight:650;
  text-decoration:none;
  color:var(--text);
  letter-spacing:-1px;
  display:flex;
  gap:9px;
  align-items:center}
.wordmark:first-letter {
  color:var(--brand)}
.eyebrow {
  font-size:10px;
  font-weight:650;
  letter-spacing:1.5px;
  color:var(--dim)}
.avatar {
  width:29px;
  height:29px;
  display:grid;
  place-items:center;
  border-radius:50%;
  background:var(--brand);
  color:var(--on-brand)}
.workspace {
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
  background:var(--surface)}
header {
  padding:23px 32px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px}
h1 {
  font-size:17px;
  font-weight:550;
  margin:5px 0 0}
h2 {
  font-size:21px;
  font-weight:550;
  letter-spacing:-.5px}
h3 {
  font-size:15px}
.quiet {
  border:0;
  background:transparent;
  color:var(--dim);
  font-size:12px}
.notice {
  margin:0 32px;
  padding:10px 14px;
  font-size:12px;
  background:var(--bg);
  border-radius:8px;
  color:var(--dim)}
.notice.error {
  color:var(--red)}
.timeline {
  overflow:auto;
  flex:1;
  min-height:0;
  padding:22px max(24px,calc((100% - 820px)/2));
  scrollbar-gutter:stable;
  overscroll-behavior:contain}
.welcome {
  padding:10vh 5px 30px;
  text-align:center;
  color:var(--dim)}
.spark {
  font-size:40px;
  color:var(--brand)}
.welcome h2 {
  color:var(--text);
  font-size:28px}
.welcome p {
  line-height:1.8}
.suggestions {
  display:flex;
  justify-content:center;
  gap:9px;
  flex-wrap:wrap;
  margin-top:25px}
.suggestions button {
  font-size:12px;
  display:flex;
  gap:25px}
.suggestions span {
  color:var(--brand)}
.composer {
  margin:12px auto max(18px,env(safe-area-inset-bottom));
  width:calc(100% - 56px);
  max-width:800px;
  border:1px solid var(--line);
  border-radius:16px;
  background:var(--soft);
  padding:14px;
  box-shadow:0 6px 20px #10263205;
  flex-shrink:0}
textarea:focus-visible { outline:2px solid var(--focus); outline-offset:2px; border-radius:6px; }
textarea {
  width:100%;
  border:0;
  outline:0;
  resize:none;
  background:transparent;
  color:var(--text);
  min-height:48px;
  max-height:170px;
  line-height:1.6;
  padding:4px}
textarea::placeholder {
  color:var(--dim)}
.composer-tools,.composer-tools>div {
  display:flex;
  align-items:center;
  gap:10px}
.composer-tools {
  justify-content:space-between}
.attach {
  font-size:24px;
  cursor:pointer;
  padding:0 7px}
.attach[aria-disabled=true] {
  opacity:.4;
  cursor:not-allowed}
select {
  max-width:180px;
  border:0;
  background:transparent;
  color:var(--dim);
  padding:7px;
  font-size:12px}
.send {
  border-radius:50%;
  background:var(--brand);
  color:var(--on-brand);
  width:33px;
  height:33px;
  padding:0;
  font-size:20px}
.send:hover:not(:disabled) {
  background:var(--brand)}
.composer-note {
  margin:10px 0 0;
  font-size:10px;
  color:var(--dim)}
.muted {
  color:var(--dim);
  font-size:12px;
  line-height:1.6}
.message {
  margin:0 0 26px;
  line-height:1.75;
  overflow-wrap:anywhere}
.message.user {
  margin-left:12%}
.user-bubble {
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:14px;
  padding:12px 16px;
  white-space:pre-wrap}
.message .body {
  white-space:pre-wrap}
.message-label {
  font-size:10px;
  letter-spacing:1px;
  color:var(--dim);
  font-weight:650;
  margin-bottom:6px;
  text-transform:uppercase}
.message footer {
  font-size:11px;
  color:var(--dim);
  margin-top:8px}
.card {
  border:1px solid var(--line);
  border-radius:var(--radius);
  padding:14px;
  margin-top:12px;
  background:var(--soft)}
.card h3 {
  margin:0 0 8px}
.card p {
  margin:7px 0}
.card button {
  margin:8px 8px 0 0;
  font-size:12px}
.badge {
  font-size:11px;
  border-radius:5px;
  padding:3px 6px;
  background:var(--rail);
  display:inline-block}
.activity {
  margin-top:10px;
  border-left:2px solid var(--line);
  padding:5px 12px;
  font-size:12px}
.activity summary {
  cursor:pointer}
.activity ul {
  padding-left:18px}
.attachments {
  display:flex;
  flex-wrap:wrap;
  gap:8px}
.attachment {
  border:1px solid var(--line);
  padding:6px 8px;
  border-radius:8px;
  font-size:11px;
  max-width:100%;
  overflow-wrap:anywhere}
.attachment button {
  border:0;
  padding:0 5px;
  background:none}
.attachment progress {
  width:80px;
  display:block}
.context {
  width:var(--pane);
  flex-shrink:0;
  background:var(--soft);
  padding:24px;
  overflow:auto;
  border-left:1px solid var(--line)}
.context-head {
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:25px}
.context h2 {
  font-size:20px}
.context dl {
  font-size:12px}
.context dt {
  color:var(--dim);
  margin-top:14px}
.context dd {
  margin:4px 0;
  overflow-wrap:anywhere}
.splitter {
  width:5px;
  cursor:col-resize;
  background:var(--line);
  touch-action:none}
.splitter:hover {
  background:var(--brand)}
.sr-only,.skip:not(:focus) {
  position:absolute;
  width:1px;
  height:1px;
  overflow:hidden;
  clip-path:inset(50%)}
.skip:focus {
  position:fixed;
  z-index:10;
  background:var(--surface);
  padding:12px}
#older {
  display:block;
  margin:0 auto 20px}
.error-text {
  color:var(--red)}
:root[data-theme="dark"] {
  color-scheme:dark;
  --bg:#0b0e13;
  --surface:#131820;
  --soft:#1a2029;
  --rail:#1a2029;
  --text:#edf0f5;
  --dim:#a3adba;
  --line:#303946;
  --brand:#67e8f9;
  --focus:#67e8f9;
  --red:#fda4af;
  --on-brand:#131820;
  --complete:#7dd3fc;
  --active:#c4b5fd;
  --unknown:#a3adba}
:root[data-theme="dark"] .send,:root[data-theme="dark"] .avatar {
  background:var(--brand);
  color:var(--on-brand)}
@media(max-width:1100px) {
header {
  padding:20px}
.notice {
  margin:0 20px}
.context {
  width:320px}
}
@media(max-width:800px) {
header {
  padding:16px 20px}
.context {
  position:fixed;
  inset:0 0 0 auto;
  z-index:5;
  width:min(100%,420px);
  box-shadow:-10px 0 40px #0003}
.splitter {
  display:none}
.composer {
  width:calc(100% - 28px);
  margin-bottom:max(10px,env(safe-area-inset-bottom))}
.timeline {
  padding:18px}
.notice {
  margin:0 14px}
.welcome {
  padding-top:5vh}
.composer-tools .muted {
  display:none}
.workspace {
  width:100%}
}
@media(prefers-reduced-motion:reduce) {
  * {
  scroll-behavior:auto!important;
  animation:none!important;
  transition:none!important}
}
.typed-controls { display:flex; gap:6px; margin-top:6px; }
#typed-form { border-top:1px solid var(--line); margin-top:8px; padding-top:10px; }
#typed-form label { display:block; font-size:12px; margin:12px 0; }
#typed-form label > input, #typed-form label > select { display:block; margin-top:7px; }
#typed-form label[hidden] { display:none; }
#typed-form fieldset label > input { display:inline-block; margin-top:0; }
#typed-form input { width:100%; border:1px solid var(--line); border-radius:6px; padding:8px; background:var(--surface); color:var(--text); }
@media(max-width:800px) {
  header { gap:8px; }
}

#typed-form fieldset { border:1px solid var(--line); border-radius:8px; margin:12px 0; }
#typed-form fieldset input { width:auto; }

/* Compact workflows remain in the page flow, with no nested scroll trap. */
#typed-form.job-form { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:10px 12px; }
#typed-form.job-form[hidden] { display:none; }
#typed-form.job-form h3 { grid-column:1/-1; margin:0; font-size:14px; }
#typed-form.job-form label { margin:0; min-width:0; }
#typed-form.job-form label > input, #typed-form.job-form label > select { width:100%; margin-top:4px; min-height:36px; }
#typed-form.job-form .job-identity, #typed-form.job-form fieldset, .job-actions { grid-column:1/-1; }
#typed-form.job-form fieldset { display:flex; flex-wrap:wrap; gap:6px 14px; margin:0; padding:6px 10px 9px; }
#typed-form.job-form fieldset label { display:inline-flex; align-items:center; gap:4px; min-height:28px; }
#typed-form.job-form fieldset label > input { width:auto; min-height:0; margin:0; }
.job-actions { display:flex; gap:8px; }
@media(max-width:480px) { #typed-form.job-form { grid-template-columns:minmax(0,1fr); } }

/* Durable stage state, independent coverage and binary identity. */
.report-context {
  margin:16px 0;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--radius);
  background:var(--surface);
}
.report-context h3 {
  font-size:13px;
  margin:12px 0 8px;
}
.stage-strip {
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(145px,1fr));
  gap:8px;
  padding:0;
  margin:10px 0;
  list-style:none;
}
.stage-step {
  border:1px solid var(--line);
  border-top:3px solid var(--line);
  border-radius:8px;
  padding:9px;
  display:flex;
  flex-direction:column;
  gap:5px;
  font-size:11px;
}
.stage-step.is-complete {
  border-top-color:var(--complete);
}
.stage-state {
  display:flex;
  align-items:center;
  gap:5px;
}
.stage-dot {
  display:inline-block;
  width:6px;
  height:6px;
  border:1px solid currentColor;
  border-radius:50%;
  flex-shrink:0;
}
.is-complete .stage-dot {
  background:var(--complete);
  border-color:var(--complete);
}
.is-active .stage-dot {
  background:var(--active);
  border-color:var(--active);

}
.stage-scope,.stage-basis,.stage-detail {
  color:var(--dim);
}
.outcome-counts {
  display:flex;
  flex-wrap:wrap;
  gap:6px 12px;
  list-style:none;
  padding:0;
  font-size:12px;
}
.digest-row {
  display:grid;
  gap:8px;
  padding:10px 0;
  font-size:12px;
}
.digest-row button {
  justify-self:start;
  font-size:11px;
}
.digest-heading {
  display:flex;
  gap:9px;
  align-items:center;
}
.fingerprint {
  display:grid;
  grid-template-columns:repeat(5,4px);
  grid-template-rows:repeat(5,4px);
  gap:1px;
  padding:3px;
  border:1px solid var(--line);
  border-radius:4px;
  flex-shrink:0;
}
.fingerprint .filled {
  background:var(--brand);
}
.full-digest code {
  display:block;
  overflow-wrap:anywhere;
  user-select:text;
  margin-top:6px;
}
.component-digests summary,.full-digest summary {
  cursor:pointer;
}
@keyframes stage-pulse {
  50% { opacity:.35; }
}
@media (prefers-reduced-motion:reduce) {
  .is-active .stage-dot { animation:none; }
}

.live-state .is-active .stage-dot {
  animation:stage-pulse 1.6s ease-in-out infinite;
}
.report-preview {
  margin:12px 0;
  border-left:2px solid var(--brand);
  padding-left:12px;
  font-size:12px;
}
.compact-outcomes {
  font-weight:600;
}
.mini-stage-strip {
  display:flex;
  flex-wrap:wrap;
  gap:5px 12px;
  padding:0;
  list-style:none;
  color:var(--dim);
  font-size:11px;
}
.compact-digest {
  flex-wrap:wrap;
  font-size:11px;
  margin:8px 0;
}
.report-expanded > summary {
  cursor:pointer;
  color:var(--brand);
}
@media (prefers-reduced-motion:reduce) {
  .live-state .is-active .stage-dot { animation:none; }
}

.admin-tabs,.admin-actions {display:flex;flex-wrap:wrap;gap:6px;margin-bottom:14px}
.admin-tabs [aria-current] {background:var(--rail);border-color:var(--brand)}
.admin-row {padding:14px 0;border-top:1px solid var(--line);overflow-wrap:anywhere}
.admin-row button {margin:4px 4px 0 0}
.admin-row p {margin:6px 0}
.admin-form {display:grid;gap:12px}
.admin-field {display:grid;gap:6px}
.admin-field input,.admin-form select {width:100%;min-width:0;padding:8px;border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text)}
.admin-form fieldset {border:1px solid var(--line);border-radius:8px;display:grid;gap:7px}
.admin-check {display:flex;gap:6px;align-items:center}
.admin-capabilities {font-size:12px;line-height:1.7}
.token-panel {padding:14px;background:var(--soft);border:1px solid var(--brand);border-radius:var(--radius);margin-bottom:14px}

.signal-controls,.signal-heading {display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.signal-controls {margin:12px 0}
.signal-controls select {background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:8px;padding:6px}
.signal-row {padding:14px 0;border-top:1px solid var(--line);overflow-wrap:anywhere}
.signal-heading {justify-content:space-between}
.signal-row p {margin:7px 0}
.signal-risk {color:var(--dim)}
.signal-provenance {margin-top:12px}
.signal-provenance code {display:block;overflow-wrap:anywhere;font-size:11px;margin:6px 0}

#typed-form button.primary, .card button.primary { background:var(--brand); color:var(--on-brand); border-color:var(--brand); font-weight:600; }
#typed-form button.primary:hover:not(:disabled), .card button.primary:hover:not(:disabled) { background:var(--brand); filter:brightness(.92); }
#typed-form button.secondary { background:var(--surface); color:var(--text); border:1px solid var(--line); }
#typed-form > button { margin:8px 8px 0 0; }

/* Shared family banner, with account controls separate from conversation history. */
.top-banner { height:60px; padding:8px 24px; border-bottom:1px solid var(--line); background:var(--surface); position:relative; z-index:10; }
.brand { display:flex; align-items:center; gap:12px; text-decoration:none; color:var(--text); font-weight:650; font-size:17px; }
.brand svg { width:26px; height:26px; fill:none; stroke:var(--focus); stroke-width:1.5; }
.brand small { font-weight:400; font-size:13px; color:var(--dim); margin-left:8px; }
.account { position:relative; }
.account-toggle { border-radius:50%; padding:3px; display:grid; place-items:center; width:44px; height:44px; }
.account-toggle img,.account-toggle .avatar { width:36px; height:36px; object-fit:cover; border-radius:50%; }
.account-menu { position:absolute; right:0; top:calc(100% + 10px); width:min(360px,calc(100vw - 32px)); padding:16px; background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:0 8px 24px #0002; max-height:calc(100dvh - 80px); overflow:auto; }
.account-identity { display:grid; gap:4px; padding-bottom:14px; margin-bottom:12px; border-bottom:1px solid var(--line); overflow-wrap:anywhere; }
.account-identity span { font-size:12px; color:var(--dim); }
.account-menu button { width:100%; text-align:left; margin-top:8px; display:flex; align-items:center; justify-content:space-between; }
.account-menu button span { color:var(--dim); font-size:12px; }
.build-details { padding:12px; background:var(--soft); border:1px solid var(--line); border-radius:8px; display:grid; grid-template-columns:auto minmax(0,1fr); gap:10px; font-size:12px; }
.build-details dt { color:var(--dim); }.build-details dd { margin:0; text-align:right; overflow-wrap:anywhere; }
@media(max-width:800px) { .top-banner { padding:8px 16px; }.context { top:60px; }.brand { font-size:16px; } }

/* Context tabs retain independent report/admin state without replacing the conversation. */
.context-bar { display:flex; align-items:center; flex-shrink:0; border-bottom:1px solid var(--line); background:var(--rail); }
.context-tabs { display:flex; overflow-x:auto; min-width:0; flex:1; }
.icon-button { display:inline-grid; place-items:center; min-width:34px; height:34px; padding:6px; flex-shrink:0; }
.tool-choice { display:flex; align-items:center; gap:12px; width:100%; text-align:left; padding:12px; }
.worker-outline { width:20px; height:20px; border:1.5px solid currentColor; border-radius:4px; display:inline-block; position:relative; flex-shrink:0; }
.worker-outline::before { content:""; position:absolute; width:5px; height:5px; border:1px solid currentColor; border-radius:50%; top:3px; left:6px; }
.worker-outline::after { content:""; position:absolute; width:10px; height:4px; border:1px solid currentColor; border-radius:4px 4px 0 0; bottom:2px; left:3px; }
.context-tab { display:flex; align-items:center; flex-shrink:0; max-width:230px; border-right:1px solid var(--line); }
.context-tab > [role="tab"] { border:0; border-radius:0; max-width:190px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.context-tab > [aria-selected="true"] { box-shadow:inset 0 -2px var(--focus); background:var(--soft); }
.context-tab-close { border:0; padding:6px; min-width:28px; }
#context-content { min-height:0; overflow:hidden; padding:0; flex:1; }
.context-view { height:100%; overflow:auto; padding:20px; }
.context { display:flex; flex-direction:column; padding:0; overflow:hidden; }
.context-head { flex-shrink:0; margin:0; padding:12px 16px; }

/* Quiet composer, with deterministic workflows behind one familiar action. */
.workflow-picker { position:relative; }
.workflow-menu { position:fixed; max-height:45dvh; overflow-y:auto; min-width:220px; max-width:calc(100vw - 64px); padding:5px; z-index:8; background:var(--surface); border:1px solid var(--line); border-radius:12px; box-shadow:0 8px 28px #0002; }
.workflow-menu button { display:flex; align-items:center; justify-content:space-between; gap:16px; width:100%; text-align:left; padding:10px 12px; border-radius:7px; }
.workflow-menu button:hover:not(:disabled),.workflow-menu button:focus-visible { background:var(--soft); }
.workflow-menu small { color:var(--dim); font-size:11px; }
.composer-tools .attach { width:34px; height:34px; padding:0; line-height:1; border-radius:50%; }
.message .result-card { border:0; border-left:2px solid var(--line); border-radius:0; background:transparent; padding:4px 12px; margin-top:10px; }
.result-card h3 { font-size:14px; margin:0 0 3px; }
.result-card p { margin:3px 0; font-size:13px; }
.result-card button { margin:4px 8px 0 0; }
.result-lineage { font-size:11px; color:var(--dim); }
.activity-line { display:flex; flex-wrap:wrap; align-items:baseline; gap:4px 10px; padding:5px 0; margin:0; background:transparent; border:0; border-radius:0; }
.activity-line h3,.activity-line p { margin:0; font-size:12px; }
.activity-line h3 { min-width:90px; }
.activity-line .badge { margin-left:auto; }
/* An active stage is a real state, not an animated estimate of progress. */
.live-state .is-active .stage-dot { animation:none; }

.user-message-tools { display:flex; align-items:center; justify-content:flex-end; gap:8px; min-height:30px; opacity:0; transition:opacity .12s; }
.message.user:hover .user-message-tools, .message.user:focus-within .user-message-tools { opacity:1; }
.copy-message { display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; padding:6px; color:var(--dim); background:transparent; border:0; }
.copy-icon { width:11px; height:12px; border:1px solid currentColor; border-radius:2px; position:relative; }
.copy-icon::before { content:""; position:absolute; width:9px; height:10px; top:-4px; left:-4px; border-top:1px solid currentColor; border-left:1px solid currentColor; border-radius:2px; }
.copy-feedback:empty { display:none; }
@media (hover:none) { .user-message-tools { opacity:1; } .copy-message { width:44px; height:44px; } }
@media (prefers-reduced-motion:reduce) { .user-message-tools { transition:none; } }

:root[data-theme="dark"] .user-bubble { background:var(--bg); border-color:transparent; }

.job-stages .is-complete { border-top-color:var(--complete); }
.job-stages .is-active { border-top-color:var(--active); }
.job-stages .is-failed { border-top-color:var(--red); }
.job-stages .is-idle { border-top-style:dashed; }
.job-stages .stage-detail { margin:0; overflow-wrap:anywhere; }

.workflow-menu button { justify-content:flex-start; border:0; background:transparent; gap:10px; }
.workflow-copy { display:flex; flex-direction:column; gap:2px; }
.workflow-icon { width:19px; height:19px; fill:none; stroke:currentColor; stroke-width:1.6; stroke-linecap:round; stroke-linejoin:round; flex-shrink:0; color:var(--dim); }
#upload-app .workflow-icon { color:var(--brand); }

.stage-step.is-active { border-top-color:var(--active); }
.stage-step.is-failed { border-top-color:var(--red); }
.stage-step.is-idle { border-top-color:var(--unknown); }
.is-failed .stage-dot { background:var(--red); border-color:var(--red); }

.message.assistant + .message.user { border-top:1px solid var(--line); padding-top:22px; }
#typed-form input:focus-visible,#typed-form select:focus-visible { outline-offset:2px; }

/* Active conversations keep only the accessible pane control above history. */
.workspace > header.conversation-active { padding:6px 20px; justify-content:flex-end; min-height:0; }

.admin-job { margin:12px 0; padding:16px; border:1px solid var(--line); border-radius:8px; background:var(--soft); }
.admin-job-submitted { display:block; margin:8px 0; font-size:12px; }
.admin-job-detail:not([hidden]) { margin-top:12px; padding-top:10px; border-top:1px solid var(--line); }
.job-chevron { margin-left:7px; }
