/* prePK — parser-first clinical document workspace */
:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --ink: #101d26;
  --muted: #5f6e78;
  --nav: #123245;
  --nav-muted: #abc0cd;
  --signal: #2f726c;
  --accent: #255f83;
  --accent-weak: #eaf2f6;
  --signal-weak: #e9f3f1;
  --line: #d3dde2;
  --line-strong: #aebdc5;
  --soft: #f5f7f8;
  --ok: #317458;
  --warn: #986c17;
  --err: #b44338;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%; padding: 0;
  -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  font: 15px/1.55 Aptos, "SF Pro Text", -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--ink);
}
body { min-width: 320px; }
img, svg { max-width: 100%; }
.app-shell { min-height: 100vh; display: flex; }
.app-sidebar {
  position: sticky; top: 0; width: 256px; height: 100vh; flex: 0 0 256px;
  display: flex; flex-direction: column; padding: 28px 20px 18px;
  background: var(--nav); color: white;
}
.product-lockup { display: flex; align-items: center; gap: 12px; padding: 0 10px 27px; }
.product-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: white; font: 650 16px/1 "SF Mono", "IBM Plex Mono", monospace;
}
.brand { font: 650 19px/1.1 "Aptos Display", "SF Pro Display", Aptos, sans-serif; letter-spacing: 0.01em; }
.product-sub {
  margin-top: 4px; color: var(--nav-muted);
  font: 9px/1.2 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.09em; text-transform: uppercase;
}
.app-stage {
  min-width: 0; flex: 1; display: flex; flex-direction: column;
  background:
    linear-gradient(180deg, #ffffff 0, #ffffff 72px, var(--bg) 72px, var(--bg) 100%);
}
.app-topbar {
  height: 72px; flex: 0 0 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 clamp(28px, 4vw, 64px); border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.88);
}
.app-topbar > div:first-child { display: flex; align-items: baseline; gap: 14px; }
.topbar-kicker, .eyebrow, .section-index {
  margin: 0; color: var(--muted);
  font: 600 10px/1.3 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.app-topbar strong { font-size: 15px; font-weight: 620; }
.environment-label, .multi-file-label {
  display: inline-flex; align-items: center; min-height: 25px; padding: 0 9px;
  border: 1px solid var(--line); color: var(--muted);
  background: var(--surface); font-size: 11px; white-space: nowrap;
}
.identity-control { display: flex; align-items: center; gap: 10px; }
.identity-name { color: var(--ink); font-size: 12px; white-space: nowrap; }
.identity-action {
  min-height: 0; padding: 0; border: 0; background: transparent;
  color: var(--muted); font: 500 11px/1.3 inherit; text-decoration: none;
}
.identity-action:hover { color: var(--accent); background: transparent; border: 0; }
.app-main {
  width: 100%; min-width: 0; max-width: 1380px; margin: 0 auto; padding: 48px clamp(32px, 4vw, 64px) 72px;
  flex: 1;
}
h1 {
  margin: 8px 0 12px; font: 640 clamp(36px, 3.4vw, 50px)/1.06 "Aptos Display", "SF Pro Display", "PingFang SC", sans-serif;
  letter-spacing: -0.045em;
}
h2 { font: 600 18px/1.4 inherit; margin: 28px 0 8px; padding: 0; border: 0; letter-spacing: -0.01em; }
h3 { font: 500 14px/1.4 inherit; margin: 24px 0 6px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.muted { color: var(--muted); font-size: 13px; }
.drop {
  border: 1px dashed var(--line-strong);
  padding: 32px 24px;
  text-align: center;
  background: var(--surface);
  margin-bottom: 12px;
  position: relative;
  cursor: pointer;
}
.drop.hover { border-color: var(--accent); background: var(--accent-weak); }
.drop input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
}
.drop-hint { color: var(--muted); pointer-events: none; }
#filelist { font-size: 12px; color: var(--ink); margin-top: 8px; max-height: 80px; overflow: auto; text-align: left; }

/* Peek summary card — sits between drop zone and 开始解析 button */
.peek { margin: 0 0 12px; }
.peek.hidden { display: none; }
.peek-loading { color: var(--muted); font-size: 13px; padding: 12px 0; font-style: italic; }
.peek-error { color: var(--accent); font-style: normal; }
.peek-head {
  font-size: 13px; color: var(--muted);
  letter-spacing: 0.4px; text-transform: uppercase;
  margin: 0 0 8px;
}
.peek-kv {
  display: grid; grid-template-columns: 80px 1fr; gap: 8px 16px;
  background: var(--soft); padding: 14px 18px;
  font-size: 13.5px; line-height: 1.7;
  border-left: 3px solid var(--line);
}
.peek-kv .k { color: var(--muted); font-size: 12px; padding-top: 2px; }
.peek-warn {
  margin-top: 8px; padding: 8px 14px;
  background: var(--soft); color: var(--accent);
  font-size: 12.5px;
  border-left: 2px solid var(--line);
}
button {
  min-height: 42px; background: var(--nav); color: white; border: 1px solid var(--nav);
  padding: 9px 20px; border-radius: 0; font: 560 14px inherit; cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
button:disabled { background: #cbd3d7; border-color: #cbd3d7; cursor: not-allowed; }
button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); }
.result.hidden { display: none; }
#summary table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 8px 0 16px; }
#summary td, #summary th { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
#summary th { font-weight: 500; color: var(--muted); background: var(--soft); }
#downloads a {
  display: inline-block; margin: 4px 8px 4px 0; padding: 6px 12px;
  border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: 13px;
}
#downloads a:hover { border-color: var(--accent); color: var(--accent); }
pre {
  background: var(--soft); border-left: 2px solid var(--line);
  padding: 16px 20px; font: 13px/1.6 "SF Mono", "Menlo", monospace;
  white-space: pre-wrap; word-break: break-word;
}
#figures img { display: block; width: 100%; max-width: 720px; margin: 12px 0; border: 1px solid var(--line); }
.app-footer {
  display: flex; gap: 18px; padding: 20px clamp(28px, 5vw, 72px);
  border-top: 1px solid var(--line); color: var(--muted); font-size: 11px;
}
.app-footer a { color: var(--muted); margin-left: auto; }

/* Hide helper for legacy elements */
.hidden { display: none !important; }

/* User-supplied cohort context callout (LLM anchor) */
.cohort-ctx {
  display: flex; gap: 12px; align-items: baseline;
  background: var(--soft); border-left: 3px solid var(--line);
  padding: 10px 16px; margin: 12px 0;
  font-size: 13px; line-height: 1.5;
}
.cohort-ctx-tag {
  font-size: 11px; color: var(--warn); font-weight: 500;
  white-space: nowrap;
}

/* App navigation */
.tabs { display: flex; flex-direction: column; gap: 4px; }
.nav-section {
  margin: 0 10px 8px; color: #7896a8;
  font: 600 9px/1.2 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.nav-section-secondary { margin-top: 24px; }
.tab {
  display: grid; grid-template-columns: 25px 1fr; gap: 8px; align-items: start;
  min-height: 51px; padding: 9px 10px; border: 1px solid transparent;
  color: var(--nav-muted); text-decoration: none;
}
.tab > span:last-child { min-width: 0; }
.tab:hover { color: white; background: rgba(255, 255, 255, 0.05); }
.tab.active {
  color: white; border-color: rgba(255, 255, 255, 0.11);
  border-left: 3px solid #79b8b1; background: rgba(255, 255, 255, 0.09);
}
.tab strong { display: block; color: inherit; font-size: 13px; line-height: 1.25; font-weight: 560; }
.tab small { display: block; margin-top: 3px; color: #839eae; font-size: 10px; }
.tab.active small { color: #bcd0db; }
.nav-index { padding-top: 2px; color: #718fa1; font: 500 9px/1.3 "SF Mono", "IBM Plex Mono", monospace; }
.tab.active .nav-index { color: #83c0bb; }
.tab-disabled { color: #66808f; cursor: not-allowed; opacity: 0.68; }
.tab-disabled:hover { color: #66808f; background: transparent; }
.tab-disabled small { color: #66808f; }

.clinical-heading {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  padding-bottom: 22px;
}

.beta-badge {
  border: 1px solid #9db9b5;
  color: var(--signal);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 7px 10px;
}
.tab:focus-visible { outline: 2px solid #83c0bb; outline-offset: 2px; }
.tab-panel.hidden { display: none; }
.sidebar-status {
  display: grid; grid-template-columns: 8px 1fr auto; gap: 9px; align-items: center;
  margin-top: auto; padding: 13px 10px 4px; border-top: 1px solid rgba(255, 255, 255, 0.13);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #55a683; box-shadow: 0 0 0 3px rgba(85, 166, 131, 0.13); }
.sidebar-status small { display: block; color: var(--nav-muted); font-size: 9px; }
.sidebar-status strong { display: block; margin-top: 2px; font: 600 11px/1.25 "SF Mono", "IBM Plex Mono", monospace; }
.status-label { color: #73b79b; font: 600 8px/1 "SF Mono", "IBM Plex Mono", monospace; letter-spacing: 0.08em; }

/* History */
.badge {
  display: inline-block; padding: 1px 6px;
  background: var(--soft); color: var(--accent); font-size: 11px; font-weight: 500;
  vertical-align: 2px; margin-left: 4px;
}
.job-card {
  border: 1px solid var(--line); padding: 12px 16px;
  margin-bottom: 8px; cursor: pointer; transition: border-color 0.1s;
}
.job-card:hover { border-color: var(--accent); }
.job-card .row1 { display: flex; gap: 16px; align-items: baseline; }
.job-card code { color: var(--accent); font-size: 13px; }
.job-card .ts { color: var(--muted); font-size: 12px; }
.job-card .stats { color: var(--muted); font-size: 12px; margin-top: 4px; }

.back { background: transparent; color: var(--muted); border: 1px solid var(--line); padding: 6px 12px; margin-bottom: 16px; }
.back:hover { color: var(--accent); border-color: var(--accent); background: transparent; }

#detail-body h4 { margin: 20px 0 6px; font-size: 14px; }
#detail-body details { margin: 8px 0; border-left: 2px solid var(--line); padding-left: 12px; }
#detail-body details summary { cursor: pointer; font-size: 13px; color: var(--ink); padding: 4px 0; }
#detail-body details[open] summary { color: var(--accent); }
#detail-body .step-tag {
  display: inline-block; font-size: 11px; padding: 1px 6px;
  background: var(--soft); color: var(--muted); margin-right: 8px;
}
/* renderManifest 的 key/value 网格 — 渲染到 #summary (新解析) / #detail-body
   (历史详情) 等多个容器, 故不能 scope 到单一父节点, 否则非 #detail-body 容器里
   label 与链接会挤成一行 (新解析视图 bug). */
.kv {
  display: grid; grid-template-columns: 200px 1fr; gap: 4px 16px;
  font-size: 13px; margin: 8px 0;
}
.kv .k { color: var(--muted); }
#detail-body .scroll { max-height: 240px; overflow: auto; }
#detail-body pre { font-size: 12px; max-height: 280px; overflow: auto; }

/* 文档解析 — 解析优先工作轨 */
.page-heading {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 36px;
  margin: 2px 0 30px;
}
.page-heading.compact { margin-bottom: 32px; }
.page-heading > div:first-child { max-width: 760px; }
.page-lead { max-width: 720px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.8; }
.workspace-status {
  min-width: 254px; padding: 17px 20px 16px;
  background: var(--signal-weak);
  box-shadow: inset 3px 0 var(--signal);
}
.workspace-status-head {
  display: flex; align-items: center; gap: 9px; margin-bottom: 6px;
  color: var(--ok); font: 650 9px/1.3 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.workspace-status strong {
  display: block; color: var(--ink); font: 650 15px/1.35 "SF Mono", "IBM Plex Mono", monospace;
}
.workspace-status small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; }

.parser-grid {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(330px, 0.72fr);
  gap: 22px; background: transparent;
}
.parser-primary {
  min-width: 0; padding: 27px 30px 25px;
  background: var(--surface);
  box-shadow: 0 10px 34px rgba(28, 53, 68, 0.07), inset 0 3px var(--nav);
}
.parser-aside {
  min-width: 0; padding: 27px 27px 25px;
  background: var(--accent-weak); color: var(--ink);
  box-shadow: 0 10px 34px rgba(28, 53, 68, 0.06), inset 0 3px var(--accent);
}
.section-heading {
  display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 21px;
}
.section-heading h2 { margin: 5px 0 0; font-size: 20px; font-weight: 620; }
.document-drop {
  min-height: 310px; margin: 0; display: flex; flex-direction: column; align-items: stretch; justify-content: space-between;
  padding: 32px 34px 25px; border-style: dashed;
  background:
    linear-gradient(90deg, rgba(40, 101, 141, 0.035) 1px, transparent 1px),
    linear-gradient(rgba(40, 101, 141, 0.035) 1px, transparent 1px),
    #fbfcfd;
  background-size: 28px 28px;
  transition: border-color 120ms ease, background-color 120ms ease;
}
.document-drop:hover { border-color: var(--signal); }
.document-drop:focus-within { outline: 2px solid var(--signal); outline-offset: 3px; }
.upload-prompt {
  min-height: 190px; display: flex; align-items: center; justify-content: center; gap: 32px;
  pointer-events: none;
}
.upload-diagram { display: flex; align-items: center; gap: 23px; }
.document-scanner {
  position: relative; width: 72px; height: 88px; flex: 0 0 72px;
  display: block; border: 1px solid #76909e; background: rgba(255, 255, 255, 0.88);
}
.document-scanner::before {
  content: ""; position: absolute; inset: 13px 13px 20px;
  background: repeating-linear-gradient(to bottom, #c4d0d6 0 1px, transparent 1px 8px);
}
.document-scanner i {
  position: absolute; left: -7px; right: -7px; top: 42px; height: 2px;
  background: var(--signal); box-shadow: 0 0 0 4px rgba(46, 111, 109, 0.08);
  transition: transform 180ms ease;
}
.document-drop:hover .document-scanner i { transform: translateY(-12px); }
.document-scanner b {
  position: absolute; right: -1px; top: -1px; width: 17px; height: 17px;
  border-left: 1px solid #76909e; border-bottom: 1px solid #76909e; background: var(--soft);
}
.document-scanner em {
  position: absolute; left: 0; right: 0; bottom: 6px; color: var(--accent);
  font: 650 8px/1 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.12em; text-align: center; font-style: normal;
}
.structure-nodes {
  position: relative; display: grid; gap: 10px; padding-left: 19px;
}
.structure-nodes::before {
  content: ""; position: absolute; left: -15px; top: 50%; width: 24px;
  border-top: 1px solid #9babb3;
}
.structure-nodes::after {
  content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px;
  border-left: 1px solid #9babb3;
}
.structure-nodes i {
  position: relative; width: 54px; height: 15px; display: flex; align-items: center;
  color: #71838d; font-style: normal;
}
.structure-nodes i::before {
  content: ""; width: 10px; margin-right: 6px; border-top: 1px solid #9babb3;
}
.structure-nodes b {
  font: 620 7px/1 "SF Mono", "IBM Plex Mono", monospace; letter-spacing: 0.08em;
}
.document-drop .drop-hint { display: flex; flex-direction: column; gap: 7px; text-align: left; }
.document-drop .drop-hint strong { color: var(--ink); font-size: 18px; font-weight: 620; letter-spacing: -0.015em; }
.document-drop .drop-hint span { color: var(--muted); font-size: 12px; }
.drop-capabilities {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0;
  color: var(--muted);
  font: 550 9px/1.4 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.025em;
}
.drop-capabilities span { position: relative; padding: 14px 12px 0; }
.drop-capabilities span + span::before {
  content: ""; position: absolute; left: -1px; top: 19px;
  width: 3px; height: 3px; background: var(--signal);
}
.drop-capabilities span:first-child { padding-left: 0; }
.drop-capabilities span:last-child { padding-right: 0; }
#sa-filelist {
  position: relative; z-index: 1; width: min(100%, 520px); margin-top: 16px; padding: 0 10px;
  color: var(--ink); font: 11px/1.55 "SF Mono", "IBM Plex Mono", monospace;
  max-height: 100px; overflow: auto; text-align: left; white-space: pre-wrap; pointer-events: none;
}
#sa-filelist:empty { display: none; }
#sa-filelist.has-error { color: var(--err); }
.parser-actions { align-items: center; justify-content: space-between; margin-top: 20px; }
.parser-actions button { min-width: 142px; }
.parser-actions button span { margin-left: 18px; }
.action-note { color: var(--muted); font-size: 11px; text-align: right; }
.multi-file-label {
  min-height: 23px; padding: 0; border: 0; background: transparent;
  font: 650 8px/1 "SF Mono", "IBM Plex Mono", monospace; letter-spacing: 0.08em;
}

.profile-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.parser-profile .section-index { color: var(--muted); }
.profile-availability {
  display: inline-flex; align-items: center; gap: 6px; color: var(--ok);
  font: 650 8px/1 "SF Mono", "IBM Plex Mono", monospace; letter-spacing: 0.08em;
}
.profile-availability i { width: 6px; height: 6px; background: #67b08f; border-radius: 50%; }
.profile-identity {
  display: flex; align-items: center; gap: 14px; margin: 22px 0 13px;
}
.profile-mark {
  width: 43px; height: 43px; display: grid; place-items: center;
  background: var(--surface); color: var(--signal);
  box-shadow: inset 0 0 0 1px rgba(40, 101, 141, 0.22);
  font: 650 11px/1 "SF Mono", "IBM Plex Mono", monospace; letter-spacing: 0.08em;
}
.profile-identity > div { display: flex; flex-direction: column; gap: 3px; }
.profile-identity strong { color: var(--ink); font: 650 16px/1.25 "SF Mono", "IBM Plex Mono", monospace; }
.profile-identity span { color: var(--muted); font-size: 10px; }
.profile-description { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.75; }
.profile-section { margin-top: 24px; }
.profile-section h3 {
  margin: 0 0 10px; color: var(--muted);
  font: 650 8px/1.3 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.11em; text-transform: uppercase;
}
.capability-ledger { display: grid; gap: 2px; }
.capability-ledger > div {
  display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 5px 0;
}
.capability-ledger span { color: var(--muted); font-size: 10px; }
.capability-ledger strong {
  color: var(--ink); font: 550 9px/1.45 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.01em;
}
.delivery-formats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
}
.delivery-formats strong {
  display: block; color: var(--ink);
  font: 650 10px/1.25 "SF Mono", "IBM Plex Mono", monospace; letter-spacing: 0.03em;
}
.delivery-formats span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.profile-specs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px;
}
.profile-specs > div { min-width: 0; padding: 3px 0; }
.profile-specs span { display: block; color: var(--muted); font-size: 8px; }
.profile-specs strong {
  display: block; margin-top: 4px; color: var(--ink);
  font: 620 10px/1.25 "SF Mono", "IBM Plex Mono", monospace; white-space: nowrap;
}
.profile-policy {
  display: grid; grid-template-columns: 12px 1fr; gap: 11px; margin-top: 25px;
  padding: 14px 15px; background: rgba(255, 255, 255, 0.7);
}
.policy-mark { width: 8px; height: 10px; margin-top: 2px; border: 1px solid #6b908f; border-top-width: 3px; }
.profile-policy strong { display: block; color: var(--ink); font-size: 11px; font-weight: 600; }
.profile-policy p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.65; }

.professional-preview {
  margin-top: 22px; padding: 25px 30px 22px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 28px rgba(28, 53, 68, 0.05);
  color: var(--muted);
}
.professional-preview-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 28px;
}
.professional-preview-head h2 {
  margin: 5px 0 3px; color: #4f5d66; font-size: 18px;
}
.professional-preview-head p:not(.section-index) {
  margin: 0; color: #7a878e; font-size: 12px;
}
.update-status {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  padding: 7px 10px; background: var(--accent-weak); color: var(--accent);
  font: 600 10px/1.2 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.04em;
}
.update-status i {
  width: 6px; height: 6px; background: var(--accent);
  box-shadow: 0 0 0 3px rgba(40, 101, 141, 0.1);
}
.professional-flow-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px; margin-top: 20px;
}
.professional-flow-grid > div {
  position: relative; min-width: 0; padding: 16px 17px 15px;
  background: #f0f3f4; color: #67757d;
}
.professional-flow-grid > div:not(:last-child)::after {
  content: "→"; position: absolute; right: -9px; top: 50%; z-index: 1;
  width: 18px; height: 18px; margin-top: -9px; display: grid; place-items: center;
  background: var(--surface); color: #9aa6ac; font: 500 11px/1 monospace;
}
.professional-flow-grid span {
  display: block; margin-bottom: 9px; color: #94a0a6;
  font: 600 9px/1 "SF Mono", "IBM Plex Mono", monospace;
}
.professional-flow-grid strong {
  display: block; color: #536169; font-size: 12px; font-weight: 600;
}
.professional-flow-grid small {
  display: block; margin-top: 4px; color: #89959b; font-size: 9px; line-height: 1.5;
}
.professional-preview-note {
  margin: 13px 0 0; color: #8a969c; font-size: 10px;
}

.sa-result-chain {
  display: inline-flex; align-items: center; gap: 8px; margin: 2px 0 18px;
  color: var(--muted); font-size: 11px; letter-spacing: 0.03em;
}
.sa-result-chain strong {
  color: var(--accent); font: 600 12px/1.2 "SF Mono", "IBM Plex Mono", monospace;
}
.sa-result-chain { margin: 8px 0 0; }
.sa-evidence-rail {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px; border: 1px solid var(--line); background: white;
}
.sa-evidence-rail > div {
  position: relative; min-width: 0; padding: 12px 13px 11px 28px;
}
.sa-evidence-rail > div + div { border-left: 1px solid var(--line); }
.sa-evidence-rail > div::before {
  content: ""; position: absolute; left: 13px; top: 17px;
  width: 6px; height: 6px; background: var(--ok);
}
.sa-evidence-rail > div[data-state="review"]::before { background: var(--warn); }
.sa-evidence-rail i {
  display: block; color: var(--muted); font: 600 8px/1 "SF Mono", "IBM Plex Mono", monospace;
  font-style: normal;
}
.sa-evidence-rail strong { display: block; margin-top: 5px; color: var(--ink); font-size: 11px; }
.sa-evidence-rail span {
  display: block; margin-top: 3px; overflow: hidden; color: var(--muted); font-size: 9px;
  text-overflow: ellipsis; white-space: nowrap;
}
.records-panel {
  padding: 26px 28px; border: 1px solid var(--line); border-top: 3px solid var(--nav); background: var(--surface);
}
.text-action { color: var(--accent); font-size: 12px; text-decoration: none; }
.text-action:hover { text-decoration: underline; }

.sa-failure-card {
  margin: 18px 0 0; padding: 18px 20px;
  border: 1px solid var(--line); border-left: 3px solid var(--err);
  background: white;
}
.sa-failure-kicker {
  color: var(--err); font: 600 11px/1.3 "SF Mono", "Menlo", monospace;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.sa-failure-card h3 {
  margin: 5px 0 6px; color: var(--ink); border: 0; padding: 0;
  font-size: 15px; text-transform: none; letter-spacing: 0;
}
.sa-failure-card > p { margin: 0; color: var(--ink); font-size: 13px; }
.sa-failure-card .sa-failure-support { margin-top: 8px; color: var(--muted); font-size: 12px; }
.sa-failure-actions { display: flex; gap: 10px; margin-top: 16px; }
.sa-failure-actions button { padding: 8px 16px; font-size: 13px; }
.sa-failure-actions button.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.sa-failure-actions button.ghost:hover { color: var(--accent); border-color: var(--accent); }
.sa-failure-actions button:focus-visible,
#sa-run:focus-visible, #sa-reset:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

/* 结果: HTML 预览 + 多格式可编辑下载 */
.sa-quality-review {
  display: grid; grid-template-columns: minmax(120px, auto) 1fr;
  gap: 12px 18px; align-items: baseline; margin-top: 15px; padding: 11px 13px;
  border-left: 3px solid var(--ok); background: var(--signal-weak);
}
.sa-quality-review strong { color: var(--ink); font-size: 12px; }
.sa-quality-review span { color: var(--muted); font-size: 11px; line-height: 1.55; }
.sa-quality-review[data-state="review_required"] {
  border-left-color: var(--warn); background: #fbf4e5;
}
.sa-quality-review[data-state="auto_fixed"] { border-left-color: var(--accent); background: var(--accent-weak); }
.sa-download-label {
  margin: 15px 0 7px; color: var(--muted);
  font: 600 9px/1.3 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.09em; text-transform: uppercase;
}
.sa-dl-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 9px; align-items: stretch; margin-top: 0;
}
.sa-download-option {
  min-width: 0; display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; border: 1px solid var(--line);
  background: white; color: var(--ink); text-decoration: none;
}
.sa-download-option b {
  color: var(--accent); font: 650 11px/1.3 "SF Mono", "IBM Plex Mono", monospace;
  letter-spacing: 0.04em;
}
.sa-download-option span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.sa-download-option:hover { border-color: var(--accent); box-shadow: inset 0 -2px var(--accent); }
.sa-download-option.primary { border-color: var(--nav); background: var(--nav); color: white; }
.sa-download-option.primary b, .sa-download-option.primary span { color: white; }
.sa-download-option.technical { background: var(--soft); }
.sa-export-note {
  margin: 10px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6;
}
.sa-originals { margin-top: 17px; }
.sa-originals p {
  margin: 0 0 7px; color: var(--ok);
  font: 600 10px/1.3 "SF Mono", "IBM Plex Mono", monospace;
}
.sa-originals div { display: flex; flex-wrap: wrap; gap: 7px 14px; }
.sa-originals a {
  max-width: 320px; overflow: hidden; color: var(--muted); font-size: 11px;
  text-decoration: none; text-overflow: ellipsis; white-space: nowrap;
}
.sa-originals a:hover { color: var(--accent); }
.sa-source-policy {
  display: grid; grid-template-columns: minmax(130px, auto) 1fr;
  gap: 12px 18px; align-items: baseline; margin-top: 16px; padding: 11px 13px;
  border-left: 3px solid var(--signal); background: var(--signal-weak);
}
.sa-source-policy strong { color: var(--ink); font-size: 12px; }
.sa-source-policy span { color: var(--muted); font-size: 11px; line-height: 1.55; }
.sa-html-preview {
  margin-top: 24px; padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--line); border-top: 3px solid var(--nav); background: white;
  overflow: hidden;
}
.sa-dl-link {
  display: inline-block; padding: 6px 12px; border: 1px solid var(--line);
  color: var(--ink); text-decoration: none; font-size: 13px;
}
.sa-dl-link:hover { border-color: var(--accent); color: var(--accent); }
.sa-file-head { margin: 24px 0 8px; font-size: 14px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.sa-file-head .brief-stat { font-weight: 400; }

.sa-source-note {
  display: flex; align-items: center; gap: 9px; color: var(--muted);
  margin: 4px 0 10px; font-size: 11px;
}
.sa-source-note i { color: var(--accent); font-style: normal; }

.sa-detail { margin: 6px 0 4px; font-size: 13px; border-left: 2px solid var(--line); padding-left: 12px; }
.sa-detail summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.sa-detail[open] summary { color: var(--accent); }
.sa-md { font-size: 13px; max-height: 460px; overflow: auto; margin-top: 8px;
  background: white; border: 1px solid var(--line); padding: 14px 18px; line-height: 1.7; }
.sa-md-h { font-weight: 600; color: var(--ink); margin: 12px 0 6px; font-size: 13px; }
.sa-md-h:first-child { margin-top: 0; }
.sa-md-p { margin: 6px 0; color: var(--ink); white-space: pre-wrap; }
.sa-md-hr { border: none; border-top: 1px dashed var(--line); margin: 12px 0; }
.sa-md-table { margin: 8px 0 14px; font-size: 12.5px; }
.sa-md-table th { white-space: nowrap; }
.sa-md-table td { vertical-align: top; }

@media (max-width: 980px) {
  .app-shell { display: block; }
  .app-sidebar {
    position: relative; width: 100%; height: auto; padding: 15px 18px 12px;
  }
  .product-lockup { padding: 0 4px 14px; }
  .tabs { flex-direction: row; gap: 7px; overflow-x: auto; padding: 0 0 3px; scrollbar-width: thin; }
  .nav-section { display: none; }
  .tab { flex: 0 0 172px; }
  .sidebar-status { display: none; }
  .app-topbar { height: 64px; flex-basis: 64px; }
  .app-main { padding: 38px clamp(24px, 4vw, 40px) 58px; }
  .parser-grid { grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.8fr); }
  .records-panel { overflow-x: auto; }
}

@media (max-width: 840px) {
  .page-heading { display: block; margin-bottom: 24px; }
  .page-heading > div:first-child { max-width: none; }
  .workspace-status {
    width: 100%; min-width: 0; margin-top: 20px; padding: 15px 17px;
  }
  .parser-grid { display: block; }
  .parser-primary { padding: 25px 24px 22px; }
  .parser-aside { margin-top: 20px; padding: 25px 24px 22px; }
  .document-drop { min-height: 276px; padding: 25px 24px 21px; }
  .upload-prompt { min-height: 158px; }
  .parser-actions { align-items: stretch; flex-direction: column; }
  .parser-actions button { width: 100%; }
  .action-note { text-align: left; }
  .professional-flow-grid { grid-template-columns: 1fr 1fr; }
  .professional-flow-grid > div:not(:last-child)::after { display: none; }
  .sa-dl-row { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .app-sidebar { padding: 12px 14px 10px; }
  .product-lockup { padding: 0 3px 11px; gap: 10px; }
  .product-mark { width: 30px; height: 30px; font-size: 14px; }
  .brand { font-size: 17px; }
  .product-sub { font-size: 8px; }
  .tabs { gap: 5px; }
  .tab {
    flex-basis: 146px; min-height: 46px; padding: 7px 8px;
    grid-template-columns: 21px 1fr;
  }
  .tab strong { font-size: 12px; }
  .tab small { margin-top: 2px; font-size: 9px; }
  .app-topbar { padding: 0 20px; }
  .app-topbar > div:first-child { display: block; }
  .topbar-kicker { display: none; }
  .environment-label { display: none; }
  .identity-control .identity-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .app-main { padding: 26px 16px 46px; }
  h1 { margin: 6px 0 10px; font-size: 32px; letter-spacing: -0.035em; }
  .page-heading { margin-bottom: 20px; }
  .page-lead { font-size: 12.5px; line-height: 1.7; }
  .workspace-status { margin-top: 17px; padding: 13px 15px; }
  .document-steps { gap: 11px; margin-bottom: 16px; padding: 0 14px; }
  .document-steps .ws-step { padding: 11px 0 12px; font-size: 11px; }
  .document-steps .ws-step span { margin-right: 5px; font-size: 8px; }
  .parser-primary { padding: 21px 16px 18px; }
  .parser-aside { padding: 21px 16px; }
  .section-heading { margin-bottom: 16px; }
  .section-heading h2 { font-size: 18px; }
  .document-drop { min-height: 236px; padding: 19px 14px 17px; }
  .upload-prompt { min-height: 130px; gap: 14px; }
  .upload-diagram { gap: 0; }
  .structure-nodes { display: none; }
  .document-scanner { width: 52px; height: 66px; flex-basis: 52px; }
  .document-drop .drop-hint strong { font-size: 15px; }
  .document-drop .drop-hint span { font-size: 11px; }
  .drop-capabilities span { padding: 10px 5px 0; font-size: 7px; }
  .sa-source-note { flex-wrap: wrap; }
  .sa-quality-review { display: block; }
  .sa-quality-review span { display: block; margin-top: 4px; }
  .sa-source-policy { display: block; }
  .sa-source-policy span { display: block; margin-top: 4px; }
  .sa-html-preview { padding: 22px 17px; overflow-x: auto; }
  .sa-failure-actions { align-items: stretch; flex-direction: column-reverse; }
  .sa-failure-actions button { width: 100%; }
  .records-panel { padding: 22px 18px; overflow-x: auto; }
  .section-heading { align-items: start; }
  .professional-preview { padding: 22px 20px 20px; }
  .professional-preview-head { display: block; }
  .update-status { margin-top: 13px; }
  .delivery-formats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .capability-ledger > div { grid-template-columns: 66px 1fr; }
  .app-footer { flex-wrap: wrap; padding: 18px 20px; }
  .app-footer a { margin-left: 0; }
  .flow-node.self { min-width: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .rp-step.active .rp-icon { animation: none !important; }
  .document-scanner i { transition: none; }
  .document-drop:hover .document-scanner i { transform: none; }
}

/* Business-layer (业务流程概览 + per-step business 解释) */
.biz-overview {
  background: var(--soft); border-left: 2px solid var(--line);
  padding: 12px 16px; margin: 12px 0;
  font-size: 13px; line-height: 1.6; color: var(--ink);
}
.biz-block {
  background: var(--soft); padding: 16px 20px; margin: 8px 0;
  font-size: 13.5px; line-height: 1.7;
}
.biz-block > div { margin-bottom: 14px; display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.biz-block > div:last-child { margin-bottom: 0; }
.biz-block strong { color: var(--ink); font-weight: 600; }
.biz-k {
  font-weight: 500; color: var(--accent);
  font-size: 12px; letter-spacing: 0.4px;
  padding-top: 2px;
}
.biz-v {
  min-width: 0;  /* allow long content to wrap inside the 1fr column */
  line-height: 1.75;
}
.biz-v strong { display: inline; }  /* keep bold inline, not block-level */
details.tech { margin-top: 8px; }
details.tech summary { color: var(--muted); font-size: 12px; }

/* Mode intro paragraph — sits between subtabs and the actual content */
.mode-intro {
  background: var(--soft);
  padding: 14px 18px; margin: 8px 0 16px;
  font-size: 13px; line-height: 1.75; color: var(--ink);
  border-left: 3px solid var(--line);
}
.mode-intro strong { color: var(--accent); font-weight: 500; }

/* ---- Wizard stepper ---- */
.wizard-steps {
  display: flex; gap: 4px; list-style: none; padding: 0; margin: 0 0 24px;
  border-bottom: 1px solid var(--line);
}
.ws-step {
  flex: 1; text-align: center; padding: 10px 8px;
  color: var(--muted); font-size: 13px;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}
.ws-step.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.ws-step.done { color: var(--ok); }
.ws-step.done::before { content: "✓ "; }
.document-steps {
  gap: clamp(24px, 4vw, 58px); margin: 0 0 20px; padding: 0 24px;
  border: 0; background: rgba(255, 255, 255, 0.78); overflow: visible;
  box-shadow: 0 6px 24px rgba(28, 53, 68, 0.04);
}
.document-steps .ws-step {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto; column-gap: 10px; row-gap: 3px;
  margin: 0; padding: 12px 18px 13px; border: 0;
  text-align: left; font-size: 12px; background: transparent;
}
.document-steps .ws-step span {
  grid-row: 1 / 3; align-self: center; margin: 0; color: #8b9aa4;
  font: 600 9px/1 "SF Mono", "IBM Plex Mono", monospace;
}
.document-steps .ws-step strong {
  min-width: 0; color: inherit; font-size: 12px; font-weight: 620; line-height: 1.25;
}
.document-steps .ws-step small {
  min-width: 0; overflow: hidden; color: var(--muted); font-size: 9px;
  line-height: 1.3; text-overflow: ellipsis; white-space: nowrap;
}
.document-steps .ws-step:not(:last-child) { border-right: 1px solid var(--line); }
.document-steps .ws-step.active { color: var(--ink); box-shadow: inset 0 -2px var(--signal); }
.document-steps .ws-step.active span { color: var(--signal); }
.document-steps .ws-step.done { color: var(--ok); background: transparent; }
.document-steps .ws-step.done::before { content: none; }

.ws-panel.hidden { display: none; }
.ws-actions { margin-top: 20px; display: flex; gap: 12px; }
.ws-actions button.ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
}
.ws-actions button.ghost:hover { color: var(--accent); border-color: var(--accent); }

.prompt-block {
  background: var(--soft); border-left: 2px solid var(--accent);
  padding: 16px 20px; margin: 20px 0;
}
.prompt-block label { display: block; margin-bottom: 4px; font-size: 14px; }
.prompt-block p.muted { margin: 0 0 10px; font-size: 12.5px; }
.prompt-block textarea,
.prompt-block input[type="text"] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 0;
  font: inherit; font-size: 13px; resize: vertical; background: white;
  box-sizing: border-box;
}
.prompt-block input[type="text"] { max-width: 320px; }

/* Cohort filter on history tab */
.cohort-filter {
  margin: 0 0 16px;
  display: flex; gap: 12px; align-items: center; font-size: 13px;
}
.cohort-filter select {
  padding: 6px 10px; border: 1px solid var(--line); border-radius: 0;
  font: inherit; background: white;
}
.cohort-tag {
  display: inline-block; font-size: 11px; padding: 1px 6px;
  background: var(--soft); color: var(--muted); margin-left: 6px;
}

a.dl-primary {
  display: inline-block; padding: 6px 14px;
  background: var(--accent); color: white !important;
  text-decoration: none; font-size: 13px;
}
a.dl-primary:hover { opacity: 0.9; }

/* Paired LLM review widget (per patient) */
.paired-review {
  border: 1px solid var(--line); padding: 14px 18px;
  margin: 14px 0; background: white;
}
.pr-head { display: flex; gap: 12px; align-items: baseline; margin-bottom: 8px; }
.pr-head h5 { margin: 0; font-size: 15px; color: var(--ink); font-weight: 500; }
.pr-status { font-size: 11px; padding: 2px 8px; letter-spacing: 0.4px; }
.pr-status.pending  { background: #f3eddb; color: var(--warn); }
.pr-status.approved { background: #e7f1ea; color: var(--ok); }
.pr-status.modified { background: var(--accent-weak); color: var(--accent); }
.pr-status.rejected { background: #f3e1df; color: var(--err); }
.pr-llm { background: var(--soft); padding: 10px 14px; border-left: 2px solid var(--line);
           font-size: 13px; line-height: 1.7; margin: 8px 0; }
.pr-actions { display: flex; gap: 8px; margin-top: 12px; }
.pr-actions button {
  font-size: 12px; padding: 6px 12px;
  background: white; color: var(--ink); border: 1px solid var(--line); border-radius: 0;
}
.pr-actions button.approve:hover { border-color: var(--ok); color: var(--ok); }
.pr-actions button.modify:hover  { border-color: var(--accent); color: var(--accent); }
.pr-actions button.reject:hover  { border-color: var(--err); color: var(--err); }
.pr-form { margin-top: 12px; padding: 12px 14px; background: var(--soft);
            border: 1px solid var(--line); display: none; }
.pr-form.show { display: block; }
.pr-form textarea {
  width: 100%; box-sizing: border-box; min-height: 60px;
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 0; font: inherit; font-size: 13px;
  background: white; resize: vertical;
}
.pr-form label { font-size: 12px; color: var(--muted); display: block; margin: 8px 0 4px; }
.pr-existing { font-size: 12px; color: var(--muted); margin-top: 8px; padding-top: 8px;
                border-top: 1px dashed var(--line); }
.pr-existing strong { color: var(--ink); }

/* peek confirmation */
.peek-table {
  width: 100%; border-collapse: collapse; font-size: 12px; margin: 16px 0;
  background: white; border: 1px solid var(--line);
}
.peek-table th, .peek-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: left; }
.peek-table th { background: var(--soft); color: var(--muted); font-weight: 500; }
.peek-table tr.excluded { opacity: 0.5; text-decoration: line-through; }
.peek-table .peek-err { color: var(--warn); font-size: 11px; }
.peek-table code { font-size: 11px; word-break: break-all; }

/* run progress */
.run-progress {
  background: white; border: 1px solid var(--line);
  padding: 24px 28px; margin: 20px 0;
}
.rp-step {
  padding: 8px 0; font-size: 14px; color: var(--muted);
  display: flex; align-items: center; gap: 10px;
}
.rp-step .rp-icon { display: inline-block; width: 16px; font-family: "SF Mono", monospace; }
.rp-step.active { color: var(--accent); font-weight: 500; }
.rp-step.active .rp-icon { animation: spin 0.8s linear infinite; }
.rp-step.done { color: var(--ok); }
.rp-step.failed { color: var(--err); font-weight: 500; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* Overview tab */
.ov-section { margin: 28px 0 36px; overflow-x: auto; }
.ov-section h3 { margin: 0 0 4px; font-size: 16px; color: var(--ink); text-transform: none; letter-spacing: 0; }
.ov-section p.muted { margin: 0 0 12px; }
.ov-footer { margin: 40px 0 0; padding-top: 16px; border-top: 1px dashed var(--line); font-size: 12px; }

/* Flow diagram */
.flow-diagram {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; background: white; border: 1px solid var(--line);
}
.flow-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; }
.flow-node {
  padding: 10px 14px; min-width: 140px; text-align: center;
  font-size: 13px; line-height: 1.4; border: 1px solid var(--line);
}
.flow-node.upstream { background: var(--soft); }
.flow-node.self { background: var(--accent); color: white; border-color: var(--accent); padding: 16px 24px; min-width: 320px; font-weight: 500; }
.flow-node.self .flow-sub { color: #cdddea; }
.flow-node.downstream { background: white; }
.flow-sub { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.flow-arrow { color: var(--muted); font-size: 18px; }
.flow-arrow.flow-down { font-size: 22px; }

/* Todo list */
.todo-list { list-style: none; padding: 0; margin: 0; }
.todo-list li {
  padding: 12px 16px; margin-bottom: 8px;
  background: white; border-left: 2px solid var(--line);
  font-size: 13.5px;
}
.todo-tag {
  display: inline-block; font-size: 11px; padding: 1px 8px;
  background: var(--accent); color: white; margin-right: 10px; letter-spacing: 0.4px;
}

/* Cohort + recent tables */
.cohort-table, .recent-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  background: white; border: 1px solid var(--line);
}
.cohort-table th, .recent-table th {
  background: var(--soft); padding: 8px 12px; text-align: left;
  font-weight: 500; color: var(--muted); border-bottom: 1px solid var(--line);
}
.cohort-table td, .recent-table td { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.cohort-table tr:last-child td, .recent-table tr:last-child td { border-bottom: none; }

.recent-row { cursor: pointer; }
.recent-row:hover { background: var(--soft); }

.status-ok { color: var(--ok); background: #e7f1ea; padding: 2px 8px; font-size: 11px; }
.status-pending { color: var(--accent); background: var(--soft); padding: 2px 8px; font-size: 11px; }
.status-warn { color: var(--warn); background: #f3eddb; padding: 2px 8px; font-size: 11px; }

/* Cross-cohort table */
.cohort-block { margin-bottom: 24px; }
.cohort-block-head { font-size: 14px; margin-bottom: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.cross-cohort-table {
  width: 100%; min-width: 980px; border-collapse: collapse; font-size: 12px;
  background: white; border: 1px solid var(--line);
}
.cross-cohort-table th, .cross-cohort-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top;
}
.cross-cohort-table th {
  background: var(--soft); color: var(--muted); font-weight: 500;
  white-space: nowrap;
}
.cross-cohort-table tr.cross-row { cursor: pointer; }
.cross-cohort-table tr.cross-row:hover { background: var(--soft); }
.clinical-number { font-family: "SFMono-Regular", Consolas, monospace; font-weight: 650; }
.cross-cohort-table .judgment-cell {
  max-width: 280px; font-size: 11px; color: var(--muted); line-height: 1.5;
}
.followup-tag {
  display: inline-block; font-size: 10px; padding: 0 4px;
  background: #f3eddb; color: var(--warn);
}

.review-log-table {
  width: 100%; min-width: 720px; border-collapse: collapse;
  background: white; border: 1px solid var(--line); font-size: 12px;
}
.review-log-table th, .review-log-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--line);
  text-align: left; vertical-align: top;
}
.review-log-table th { background: var(--soft); color: var(--muted); font-weight: 500; }

.cross-cohort-mobile { display: none; }

/* Sub-tabs inside detail view */
.subtabs {
  display: flex; gap: 4px;
  margin: -8px 0 16px;
  border-bottom: 1px solid var(--line);
}
.subtab {
  padding: 8px 16px;
  font-size: 13px; color: var(--muted); text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.subtab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 500; }
.subtab:hover:not(.active) { color: var(--ink); }

/* Brief mode — one card per step, no nested details */
.brief-step {
  background: var(--soft); padding: 14px 18px; margin: 10px 0;
  border-left: 2px solid var(--line);
}
.brief-head { font-size: 14px; margin-bottom: 6px; }
.brief-head strong { color: var(--ink); }
.brief-stat { color: var(--muted); font-size: 12px; margin-left: 6px; }
.brief-body { font-size: 13.5px; line-height: 1.7; color: var(--ink); }

/* Script evolve box */
.evolve-box {
  border: 1px solid var(--line); padding: 14px 16px;
  background: var(--soft);
}
.evolve-box select, .evolve-box textarea {
  width: 100%; font: inherit; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 0; background: white;
  margin-bottom: 8px; resize: vertical;
}
.evolve-box select { max-width: 320px; display: block; }
.evolve-box textarea { font-family: inherit; }
.evolve-box button { padding: 8px 18px; font-size: 13px; }
.evolve-result {
  background: white; border: 1px solid var(--line);
  margin-top: 12px; padding: 12px; font-size: 12px;
  white-space: pre-wrap; max-height: 400px; overflow: auto;
}

/* Final responsive contract lives after legacy/business rules so later generic
   selectors cannot undo the product workspace's narrow-screen layout. */
@media (max-width: 560px) {
  html, body { max-width: 100%; overflow-x: hidden; }
  .app-shell, .app-stage, .app-main, .tab-panel,
  .parser-grid, .parser-primary, .parser-aside, .document-drop {
    width: 100%; min-width: 0; max-width: 100%;
  }
  .tabs { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
  .tab { width: auto; min-width: 0; }
  .tab-disabled { display: none; }
  .document-steps {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0; margin-bottom: 16px; padding: 0; overflow: hidden;
  }
  .document-steps .ws-step {
    display: block; min-width: 0; padding: 10px 6px 11px; text-align: center;
  }
  .document-steps .ws-step span,
  .document-steps .ws-step strong,
  .document-steps .ws-step small { display: block; margin: 0; }
  .document-steps .ws-step strong { margin-top: 4px; font-size: 10.5px; }
  .cross-cohort-table { display: none; }
  .cross-cohort-mobile { display: grid; gap: 8px; }
  .cross-mobile-card {
    display: grid; gap: 10px; width: 100%; padding: 13px 14px;
    border: 1px solid var(--line); background: white; color: var(--ink);
    text-align: left;
  }
  .cross-mobile-head, .cross-mobile-metrics {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
  }
  .cross-mobile-card small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 2px; }
  .cross-mobile-card strong { font-size: 13px; }
  .cross-mobile-metrics > span { flex: 1; font-family: "SFMono-Regular", Consolas, monospace; }
  .cross-mobile-judgment { color: var(--muted); font-size: 12px; line-height: 1.55; }
  .document-steps .ws-step small {
    margin-top: 3px; font-size: 7.5px; text-overflow: ellipsis; white-space: nowrap;
  }
  .upload-prompt { flex-direction: column; gap: 12px; text-align: center; }
  .document-drop .drop-hint { align-items: center; text-align: center; }
  .drop-capabilities { grid-template-columns: 1fr; text-align: left; }
  .drop-capabilities span { padding: 7px 0 0 12px; font-size: 8px; }
  .drop-capabilities span + span::before { left: 0; top: 12px; }
  .professional-flow-grid { grid-template-columns: 1fr; }
  .sa-evidence-rail { grid-template-columns: 1fr 1fr; }
  .sa-evidence-rail > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .sa-evidence-rail > div:nth-child(4) { border-top: 1px solid var(--line); }
}
