:root {
  color-scheme: light;
  --bg: #E8EBE8;
  --surface: #F5F6F4;
  --surface-2: #FFFFFF;
  --line: #C9CECB;
  --line-strong: #858C88;
  --ink: #1F2326;
  --ink-2: #4A5256;
  --ink-3: #5E666B;
  --action: #1F4E8C;
  --action-ink: #FFFFFF;
  --action-soft: #DCE5F1;
  --red: #B3261E;
  --red-soft: #F7E3E0;
  --green: #2A6640;
  --green-soft: #DCEBE1;
  --amber: #7A5600;
  --amber-soft: #F2E7C9;
  --paper: #FFFFFF;
  --paper-ink: #1C1F22;
  --paper-ink-2: #535A5F;
  --paper-line: #D7DADC;
  --paper-tint: #F3F4F3;
  --on-accent: #FFFFFF;
  --scrim: rgba(24, 27, 30, 0.5);
  --shadow: 0 1px 0 rgba(31, 35, 38, 0.06), 0 10px 30px -14px rgba(31, 35, 38, 0.3);
  --ui: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --r: 3px;
  --top: 56px;
  --brand-accent: #1F3A5F;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16191B; --surface: #1F2326; --surface-2: #262B2F; --line: #353B40; --line-strong: #626A70;
    --ink: #E7E9E6; --ink-2: #B4BABD; --ink-3: #9AA1A5;
    --action: #92B3E6; --action-ink: #0E1A2C; --action-soft: #22334B;
    --red: #F19388; --red-soft: #3D2421; --green: #8DCBA2; --green-soft: #1E3327; --amber: #E0BF6B; --amber-soft: #393020;
    --paper: #F2F3F1; --paper-ink: #1C1F22; --paper-ink-2: #50575C; --paper-line: #CFD3D4; --paper-tint: #E8EAE8;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 34px -14px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16191B; --surface: #1F2326; --surface-2: #262B2F; --line: #353B40; --line-strong: #626A70;
  --ink: #E7E9E6; --ink-2: #B4BABD; --ink-3: #9AA1A5;
  --action: #92B3E6; --action-ink: #0E1A2C; --action-soft: #22334B;
  --red: #F19388; --red-soft: #3D2421; --green: #8DCBA2; --green-soft: #1E3327; --amber: #E0BF6B; --amber-soft: #393020;
  --paper: #F2F3F1; --paper-ink: #1C1F22; --paper-ink-2: #50575C; --paper-line: #CFD3D4; --paper-tint: #E8EAE8;
  --scrim: rgba(0, 0, 0, 0.6);
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 14px 34px -14px rgba(0, 0, 0, 0.7);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + var(--top) + 8px); }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 14.5px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.005em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sub { color: var(--ink-2); font-size: 13px; }

/* Top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 20px; height: var(--top); padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brandmark { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brandmark .mono { display: grid; place-items: center; width: 30px; height: 30px; background: var(--brand-accent); color: var(--on-accent); font-weight: 700; font-size: 15px; border-radius: 2px; }
.brandmark b { display: block; font-size: 14.5px; line-height: 1.15; }
.brandmark small { display: block; color: var(--ink-2); font-size: 12px; font-stretch: 85%; }
.topnav { display: flex; gap: 2px; }
.topnav a { white-space: nowrap; padding: 6px 10px; color: var(--ink-2); text-decoration: none; font-weight: 500; border-radius: var(--r); }
.topnav a:hover { color: var(--ink); }
.topnav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); border-radius: 0; }
.spacer { flex: 1; }
.sample-note { font-size: 12.5px; color: var(--ink-3); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 6px 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-2); color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--ink); }
.btn.primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { color: var(--ink); border-color: var(--line); }
.btn.quiet-danger { background: transparent; border-color: transparent; color: var(--red); }
.btn.quiet-danger:hover { border-color: var(--red); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; filter: none; }
.btn.sm { min-height: 28px; padding: 3px 9px; font-size: 13px; }
.btn.wide { width: 100%; min-height: 40px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--action); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; font-size: inherit; }

/* Status chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 8px; border-radius: 2px; font-size: 12.5px; font-weight: 500; border: 1px solid transparent; font-stretch: 92%; white-space: nowrap; }
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.draft { color: var(--ink-2); border-color: var(--line-strong); }
.chip.sent { color: var(--action); background: var(--action-soft); }
.chip.viewed { color: var(--amber); background: var(--amber-soft); }
.chip.accepted { color: var(--green); background: var(--green-soft); }
.chip.declined { color: var(--red); background: var(--red-soft); }

.view { padding: 24px 20px 72px; max-width: 1600px; margin: 0 auto; }
.lede { margin: 4px 0 0; color: var(--ink-2); max-width: 62ch; }

/* Register */
.reg-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.reg-head h1, .tl-head h1 { font-size: 30px; font-stretch: 82%; font-weight: 650; letter-spacing: -0.01em; }
.filters { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 0; }
.filters button { background: none; border: 0; padding: 8px 12px; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.filters button:hover { color: var(--ink); }
.filters button[aria-pressed="true"] { color: var(--ink); border-bottom-color: var(--ink); font-weight: 600; }
.filters .count { color: var(--ink-3); margin-left: 5px; font-variant-numeric: tabular-nums; font-weight: 400; }
.table-wrap { overflow-x: auto; background: var(--surface-2); border: 1px solid var(--line); border-top: 0; }
table.register { width: 100%; border-collapse: collapse; min-width: 900px; }
.register th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--ink-2); padding: 10px 12px; border-bottom: 1px solid var(--line-strong); font-stretch: 85%; white-space: nowrap; }
.register td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.register tr:last-child td { border-bottom: 0; }
.register tbody tr:hover td { background: var(--surface); }
.register .ref { font-stretch: 85%; font-weight: 600; white-space: nowrap; }
.register .proj { display: block; padding: 0; background: none; border: 0; font-weight: 600; text-align: left; cursor: pointer; color: var(--ink); }
.register .proj:hover { text-decoration: underline; text-underline-offset: 2px; }
.register .amt { text-align: right; white-space: nowrap; }
.register .acts { white-space: nowrap; text-align: right; }
.qflag { display: block; margin-top: 4px; color: var(--amber); font-size: 12.5px; }
.empty { padding: 36px 16px; text-align: center; color: var(--ink-2); }

/* Editor */
.ed-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.back { color: var(--ink-2); font-size: 13px; text-decoration: none; }
.back:hover { color: var(--ink); text-decoration: underline; }
.ed-title h1 { font-size: 25px; font-stretch: 84%; margin-top: 2px; font-weight: 650; }
.ed-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 6px; color: var(--ink-2); font-size: 13px; }
.tag { font-size: 12px; padding: 0 6px; border: 1px dashed var(--line-strong); border-radius: 2px; color: var(--ink-2); }
.ed-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.lock { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; background: var(--surface-2); border: 1px solid var(--line); border-left: 3px solid var(--action); }
.lock.closed { border-left-color: var(--line-strong); }
.lock p { margin: 0; max-width: 80ch; }
.seg.pane-switch { display: none; margin-bottom: 12px; }

.ed-grid { display: grid; grid-template-columns: minmax(340px, 400px) minmax(0, 1fr) 290px; grid-template-areas: "edit doc fee"; gap: 20px; align-items: start; }
.pane-edit { grid-area: edit; }
.pane-doc { grid-area: doc; min-width: 0; }
.pane-fee { grid-area: fee; }
.pane-edit, .pane-fee { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--top) + 16px); max-height: calc(100vh - env(safe-area-inset-top, 0px) - var(--top) - 32px); max-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - var(--top) - 32px); overflow: auto; overscroll-behavior: contain; }
.pane-edit { background: var(--surface); border: 1px solid var(--line); }

.steps { display: flex; position: sticky; top: 0; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); }
.steps button { flex: 1; display: flex; flex-direction: column; align-items: flex-start; padding: 8px 10px 7px; background: none; border: 0; border-right: 1px solid var(--line); cursor: pointer; text-align: left; color: var(--ink-2); min-width: 0; }
.steps button:last-child { border-right: 0; }
.steps .n { font-size: 11.5px; font-stretch: 80%; color: var(--ink-3); }
.steps .l { font-weight: 600; font-size: 13px; }
.steps .rl { color: var(--red); font-size: 11.5px; font-weight: 600; font-stretch: 85%; }
.steps .ok { color: var(--ink-3); font-size: 11.5px; font-stretch: 85%; }
.steps button[aria-current="step"] { background: var(--surface-2); color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }

.form { padding: 16px; }
.form h2 { font-size: 16px; margin-bottom: 4px; }
.form > .hint:first-of-type { margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; min-width: 0; }
.field label, .lbl { font-size: 12.5px; font-weight: 500; color: var(--ink-2); font-stretch: 88%; }
.input { width: 100%; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface-2); color: var(--ink); min-height: 34px; min-width: 0; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus { outline: 2px solid var(--action); outline-offset: -1px; border-color: var(--action); }
.input[disabled] { background: var(--bg); color: var(--ink-2); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field.has-issue .input { border-color: var(--red); }
.field.has-note .input { border-color: var(--amber); }
.field-issue { margin: 0; font-size: 12.5px; color: var(--red); }
.field.has-note .field-issue { color: var(--amber); }
.field-issue:empty { display: none; }
.hint { margin: 0; font-size: 12.5px; color: var(--ink-2); }
.affix { display: flex; align-items: stretch; min-width: 0; }
.affix > span { display: grid; place-items: center; padding: 0 9px; border: 1px solid var(--line-strong); background: var(--bg); color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.affix > span:first-child { border-right: 0; border-radius: var(--r) 0 0 var(--r); }
.affix > span:last-child { border-left: 0; border-radius: 0 var(--r) var(--r) 0; }
.affix > .input { border-radius: 0; flex: 1; }
.affix > .input:first-child { border-radius: var(--r) 0 0 var(--r); }
.affix > .input:last-child { border-radius: 0 var(--r) var(--r) 0; }
.affix.sm .input { min-height: 30px; padding: 4px 6px; text-align: right; }
.affix.sm > span { padding: 0 6px; }
.group { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.field-issue + .group, .hint + .group { margin-top: 18px; }
.ed-mobilebar { display: none; }
.group legend, .group-title { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; padding: 0; }
.source-note { margin: 0 0 14px; padding: 8px 10px; border: 1px dashed var(--line-strong); font-size: 13px; color: var(--ink-2); }
.readonly { padding: 7px 9px; border: 1px solid var(--line); background: var(--bg); border-radius: var(--r); font-size: 13.5px; overflow-wrap: anywhere; }

.seg { display: flex; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; margin-bottom: 6px; }
.seg button { flex: 1; padding: 7px 6px; background: var(--surface-2); border: 0; border-right: 1px solid var(--line-strong); cursor: pointer; font-size: 13px; color: var(--ink-2); line-height: 1.25; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface-2); font-weight: 600; }
.seg button[disabled] { cursor: not-allowed; }

.stage { border-top: 1px solid var(--line); padding: 8px 0; }
.stage-row { display: grid; grid-template-columns: auto 1fr 86px; gap: 10px; align-items: center; }
.stage-row input[type="checkbox"] { accent-color: var(--action); width: 16px; height: 16px; }
.stage-name { cursor: pointer; }
.stage-name .code { display: inline-block; min-width: 2.2em; font-weight: 700; font-stretch: 80%; }
.stage.off .stage-name { color: var(--ink-3); text-decoration: line-through; text-decoration-color: var(--ink-3); }
.stage details summary { font-size: 12.5px; color: var(--ink-2); cursor: pointer; margin: 4px 0 0 26px; }
.checks { display: flex; flex-direction: column; gap: 5px; margin: 6px 0 0 26px; }
.checks.flat { margin-left: 0; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--action); flex: none; }
.check .meta { display: block; color: var(--ink-2); font-size: 12.5px; }
.weights { display: flex; justify-content: space-between; padding: 8px 0 0; border-top: 1px solid var(--line-strong); font-weight: 600; font-size: 13.5px; }
.weights.bad { color: var(--red); }
.inline-add { display: flex; gap: 6px; margin-top: 10px; }

table.grid { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 6px; }
.grid th, .grid td { padding: 4px 3px; border-bottom: 1px solid var(--line); text-align: right; }
.grid th { font-weight: 500; color: var(--ink-2); font-size: 12px; font-stretch: 85%; vertical-align: bottom; }
.grid th:first-child, .grid td:first-child { text-align: left; }
.grid td:first-child { font-weight: 600; font-stretch: 85%; }
.grid input { width: 52px; text-align: right; padding: 3px 5px; min-height: 28px; }
.grid tfoot td { font-weight: 600; border-bottom: 0; }
.roles { display: grid; grid-template-columns: 1fr 96px auto; gap: 6px; align-items: center; margin-bottom: 6px; }

.addon { display: grid; grid-template-columns: minmax(0, 180px) auto; gap: 6px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.addon > .input:first-child { grid-column: 1 / -1; }
.addon > .btn { justify-self: start; }
.addon-opts { grid-column: 1 / -1; display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; }

.ready { margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--green); color: var(--green); background: var(--green-soft); font-size: 13.5px; }
.issue-list { list-style: none; margin: 0 0 16px; padding: 0; }
.issue-list li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.issue-list li:first-child { border-top: 0; }
.mark { width: 14px; height: 14px; margin-top: 2px; border: 1.5px solid var(--red); border-radius: 52% 46% 55% 47%; }
.mark.note { border-color: var(--amber); border-style: dashed; }
.goto { display: block; margin-top: 2px; background: none; border: 0; padding: 0; font-size: 12.5px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.goto:hover { color: var(--ink); }
.question { margin: 0 0 10px; padding: 10px 12px; background: var(--amber-soft); border-left: 3px solid var(--amber); font-size: 13.5px; }
.question small { display: block; margin-top: 4px; color: var(--ink-2); }
.log { list-style: none; padding: 0; margin: 0; }
.log li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 13px; }
.log time { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Fee panel as a drawing title block */
.tblock { background: var(--surface-2); border: 1.5px solid var(--ink); }
.tb-total { padding: 14px 14px 12px; border-bottom: 1px solid var(--ink); }
.tb-total span { display: block; font-size: 12.5px; color: var(--ink-2); font-stretch: 85%; }
.tb-total strong { display: block; font-size: 32px; font-weight: 650; font-stretch: 78%; letter-spacing: -0.01em; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tb-total small { color: var(--ink-2); font-size: 12.5px; }
.tb-scale { padding: 12px 14px 10px; border-bottom: 1px solid var(--ink); }
.scale-cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; font-stretch: 88%; }
.scale { display: flex; height: 12px; border: 1px solid var(--ink); }
.scale i { display: block; min-width: 2px; border-right: 1px solid var(--ink); }
.scale i:last-child { border-right: 0; }
.scale i:nth-child(odd) { background: var(--ink); }
.scale i:nth-child(even) { background: var(--surface-2); }
.scale-labels { display: flex; margin-top: 4px; font-size: 11px; font-stretch: 80%; color: var(--ink-2); }
.scale-labels span { min-width: 2px; overflow: hidden; white-space: nowrap; }
.tb-lines { margin: 0; padding: 9px 14px; border-bottom: 1px solid var(--ink); }
.tb-lines div { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; font-size: 13.5px; }
.tb-lines dt { color: var(--ink-2); }
.tb-lines dd { margin: 0; font-variant-numeric: tabular-nums; }
.tb-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--ink); margin: 0; }
.tb-grid div { padding: 7px 14px; background: var(--surface-2); }
.tb-grid dt { font-size: 11px; color: var(--ink-2); font-stretch: 82%; }
.tb-grid dd { margin: 0; font-weight: 600; font-size: 13.5px; }
.redlines { margin-top: 16px; }
.redlines h3 { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.redlines h3 span { color: var(--red); }
.clear { margin: 0; padding: 8px 0; color: var(--green); font-size: 13px; border-top: 1px solid var(--line); }

/* The proposal document */
.sheet { --accent: #1F3A5F; --doc-font: 'Newsreader', Georgia, serif; background: var(--paper); color: var(--paper-ink); font-family: var(--doc-font); box-shadow: var(--shadow); max-width: 820px; margin: 0 auto; padding: 52px 64px 64px; font-size: 16.5px; line-height: 1.62; }
.sheet p { margin: 0 0 12px; max-width: 66ch; }
.doc-firm { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--accent); }
.doc-firm .firm { font-weight: 600; font-size: 16px; color: var(--accent); }
.doc-firm .tagline { font-family: var(--ui); font-size: 12px; color: var(--paper-ink-2); font-stretch: 85%; }
.doc-kind { font-family: var(--ui); font-size: 12.5px; color: var(--paper-ink-2); font-stretch: 85%; }
.doc-title { text-wrap: balance; font-size: clamp(32px, 4.4vw, 48px); line-height: 1.04; font-weight: 500; letter-spacing: -0.015em; margin: 34px 0 10px; max-width: 17ch; }
.doc-for { color: var(--paper-ink-2); font-size: 18px; margin: 0 0 28px; }
.doc-tb { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--paper-ink); border: 1px solid var(--paper-ink); margin: 0 0 10px; }
.doc-tb div { padding: 8px 10px; background: var(--paper); min-width: 0; }
.doc-tb dt { font-family: var(--ui); font-size: 11px; color: var(--paper-ink-2); font-stretch: 82%; }
.doc-tb dd { margin: 0; font-size: 14.5px; line-height: 1.35; overflow-wrap: anywhere; }
table.doc-revs { width: 100%; border-collapse: collapse; font-family: var(--ui); font-size: 12px; color: var(--paper-ink-2); }
.doc-revs th, .doc-revs td { text-align: left; padding: 3px 10px 3px 0; border-bottom: 1px solid var(--paper-line); font-weight: 400; }
.doc-revs th { font-stretch: 82%; }
.doc-revs .amt { text-align: right; padding-right: 0; }
.doc-sec { margin-top: 44px; }
.doc-sec > h3 { display: flex; gap: 14px; align-items: baseline; font-size: 23px; font-weight: 500; padding-bottom: 8px; border-bottom: 1px solid var(--paper-line); margin-bottom: 14px; }
.doc-sec > h3 .no { font-family: var(--ui); font-size: 13px; font-weight: 700; color: var(--accent); font-stretch: 80%; }
.placeholder { color: var(--paper-ink-2); font-style: italic; }
.doc-stages { list-style: none; margin: 0 0 14px; padding: 0; }
.doc-stages > li { display: grid; grid-template-columns: 40px 1fr; gap: 12px; padding: 10px 0; border-top: 1px solid var(--paper-line); }
.doc-stages > li:first-child { border-top: 0; }
.doc-stages .code { font-family: var(--ui); font-weight: 700; font-stretch: 80%; color: var(--accent); font-size: 14px; padding-top: 3px; }
.doc-stages h4 { font-size: 17px; font-weight: 600; }
.doc-stages ul { margin: 2px 0 0; padding-left: 18px; color: var(--paper-ink-2); font-size: 15px; }
.doc-small { font-size: 15px; color: var(--paper-ink-2); }
.doc-small b { color: var(--paper-ink); font-weight: 600; }
table.doc-fees { width: 100%; border-collapse: collapse; font-size: 15.5px; margin-bottom: 8px; }
.doc-fees td, .doc-fees th { padding: 7px 0; border-top: 1px solid var(--paper-line); vertical-align: top; text-align: left; font-weight: 400; }
.doc-fees .amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 16px; }
.doc-fees .group td { padding-top: 18px; font-family: var(--ui); font-size: 12px; color: var(--paper-ink-2); border-top: 0; font-stretch: 85%; }
.doc-fees .code { font-family: var(--ui); font-weight: 700; font-stretch: 80%; color: var(--accent); font-size: 13px; display: inline-block; min-width: 2.4em; }
.doc-fees .muted td { color: var(--paper-ink-2); }
.doc-fees .sum td { border-top: 1px solid var(--paper-ink); }
.doc-fees .total td { border-top: 2px solid var(--paper-ink); font-weight: 700; font-size: 18px; padding-top: 10px; }
.opt { font-family: var(--ui); font-size: 11.5px; border: 1px solid var(--paper-line); padding: 0 5px; border-radius: 2px; margin-left: 6px; color: var(--paper-ink-2); white-space: nowrap; }
.doc-sched { margin-top: 26px; }
.doc-sched h4 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.doc-team { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px 24px; }
.doc-team h4 { font-size: 17px; font-weight: 600; }
.doc-team .role { font-family: var(--ui); font-size: 12.5px; color: var(--accent); margin-bottom: 4px; }
.doc-team p { font-size: 15px; color: var(--paper-ink-2); margin: 0; }
.doc-work { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
.doc-work figure { margin: 0; }
.doc-work svg { display: block; width: 100%; height: auto; background: var(--paper-tint); color: var(--paper-ink); border: 1px solid var(--paper-line); }
.doc-work figcaption { margin-top: 8px; font-size: 15px; }
.doc-work figcaption b { display: block; font-weight: 600; }
.doc-work figcaption span { display: block; font-family: var(--ui); font-size: 12px; color: var(--paper-ink-2); }
.doc-accept { margin-top: 44px; padding: 18px 20px; border: 1.5px solid var(--paper-ink); }
.doc-accept h4 { font-size: 17px; font-weight: 600; margin-bottom: 10px; }
.sig { display: inline-block; min-width: 240px; padding-bottom: 2px; border-bottom: 1px solid var(--paper-ink); font-family: 'Newsreader', Georgia, serif; font-style: italic; font-size: 30px; line-height: 1.25; }
.doc-declined { margin-top: 44px; padding: 16px 20px; border: 1.5px dashed var(--paper-ink-2); color: var(--paper-ink-2); }

/* Client view */
.client-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 16px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.client-bar p { margin: 0; }
.notice { margin: 0 0 16px; padding: 10px 14px; background: var(--amber-soft); border-left: 3px solid var(--amber); font-size: 13.5px; }
.client-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.client-aside { position: sticky; top: calc(env(safe-area-inset-top, 0px) + var(--top) + 16px); background: var(--surface-2); border: 1.5px solid var(--ink); padding: 18px; }
.ca-total span { display: block; font-size: 12.5px; color: var(--ink-2); font-stretch: 85%; }
.ca-total strong { display: block; font-size: 32px; font-weight: 650; font-stretch: 78%; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ca-total small { color: var(--ink-2); font-size: 12.5px; }
.ca-opts { border: 0; padding: 0; margin: 16px 0 0; }
.ca-opts legend { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; padding: 0; }
.toggle { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); cursor: pointer; }
.toggle b { display: block; font-weight: 500; font-size: 13.5px; }
.toggle small { display: block; color: var(--ink-2); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.toggle input { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; margin: 0; border-radius: 11px; background: var(--line-strong); position: relative; cursor: pointer; transition: background 0.15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--surface-2); transition: transform 0.15s; }
.toggle input:checked { background: var(--action); }
.toggle input:checked::after { transform: translateX(16px); }
.toggle input:disabled { opacity: 0.5; cursor: not-allowed; }
.ca-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.ca-done { margin: 16px 0 0; padding: 10px 12px; background: var(--green-soft); color: var(--green); font-size: 13.5px; }
.ca-closed { margin: 16px 0 0; padding: 10px 12px; background: var(--bg); color: var(--ink-2); font-size: 13.5px; }
.ca-qs { margin-top: 18px; }
.ca-qs h3 { font-size: 13.5px; margin-bottom: 6px; }
.client-mobilebar { display: none; }

/* Modals and toast */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); background: var(--scrim); }
.modal { width: min(560px, 100%); max-height: 100%; overflow: auto; background: var(--surface-2); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow); padding: 22px; animation: rise 0.16s ease-out; }
.modal.wide { width: min(880px, 100%); }
.modal h2 { font-size: 21px; font-stretch: 86%; font-weight: 650; margin-bottom: 4px; }
.modal h3 { font-size: 14.5px; margin-bottom: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.err { margin: 10px 0 0; color: var(--red); font-size: 13px; }
.err:empty { display: none; }
.sigbox { margin-top: 16px; padding: 12px 14px; background: var(--paper); color: var(--paper-ink); border: 1px solid var(--line); }
.sigbox .lbl { display: block; color: var(--paper-ink-2); }
.sigbox .sig { min-height: 40px; }
.new-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 16px; }
.new-grid section { padding-top: 12px; border-top: 1.5px solid var(--ink); }
.new-grid .hint { margin-bottom: 10px; }
.pick { list-style: none; margin: 0; padding: 0; }
.pick li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.pick li:first-child { border-top: 0; }
.pick b { display: block; font-weight: 600; font-size: 13.5px; }
.stack { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.swatch { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.swatch input[type="radio"] { accent-color: var(--action); }
.swatch i { display: block; width: 22px; height: 22px; border-radius: 2px; border: 1px solid var(--line-strong); }
.swatch input[type="color"] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line-strong); background: none; cursor: pointer; }
.font-opt { display: flex; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.font-opt span.sample { font-size: 22px; }
.toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + var(--top) + 12px); transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px); padding: 9px 14px; background: var(--ink); color: var(--surface-2); border-radius: var(--r); font-size: 13.5px; box-shadow: var(--shadow); animation: rise 0.16s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.toast { animation-name: toast-in; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* Test lab */
.tl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.tl-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tl-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: start; }
.tl-grid > section > h2 { font-size: 18px; font-stretch: 86%; font-weight: 650; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); }
.score { display: flex; align-items: baseline; gap: 10px; margin: 12px 0 4px; }
.score strong { font-size: 34px; font-stretch: 78%; font-weight: 650; font-variant-numeric: tabular-nums; }
.score.ok strong { color: var(--green); }
.score.bad strong { color: var(--red); }
.tgroup h3 { font-size: 13px; color: var(--ink-2); font-weight: 600; margin: 18px 0 6px; }
.tlist { list-style: none; margin: 0; padding: 0; background: var(--surface-2); border: 1px solid var(--line); }
.tlist li { display: grid; grid-template-columns: 18px 1fr; gap: 8px; padding: 7px 10px; border-top: 1px solid var(--line); font-size: 13.5px; }
.tlist li:first-child { border-top: 0; }
.tlist .mk { font-weight: 700; color: var(--green); }
.tlist li.fail .mk { color: var(--red); }
.tlist .det { grid-column: 2; font-size: 12.5px; color: var(--red); }
.scn { background: var(--surface-2); border: 1px solid var(--line); padding: 16px 18px; margin-top: 14px; }
.scn-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.scn h3 { font-size: 16px; }
.scn .covers { color: var(--ink-2); font-size: 13.5px; margin: 3px 0 0; max-width: 60ch; }
.scn-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.scn ol { margin: 12px 0 0; padding: 0; list-style: none; counter-reset: s; }
.scn li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); counter-increment: s; font-size: 13.5px; }
.scn li::before { content: counter(s); font-weight: 700; font-stretch: 80%; color: var(--ink-3); }
.scn .expect { display: block; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.scn .expect b { color: var(--ink); font-weight: 600; }
.scn li.done::before { content: "✓"; color: var(--green); }
.scn .tick { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.scn .tick input { accent-color: var(--green); }
.progress { font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }


/* Utilities and drawing marks */
.mt { margin-top: 14px; }
.mt-sm { margin-top: 8px; }
.table-scroll { overflow-x: auto; }
.linkbtn.hint { align-self: flex-start; color: var(--ink-2); font-size: 12.5px; }
.linkbtn.hint:hover { color: var(--ink); }
.btn.danger-solid { background: var(--red); border-color: var(--red); color: var(--surface-2); }
.btn.danger-solid:hover { filter: brightness(1.08); }
.toast[hidden] { display: none; }
.doc-work svg .b { fill: var(--paper); stroke: currentColor; stroke-width: 1; }
.doc-work svg .l { fill: none; stroke: currentColor; stroke-width: 1; }
.doc-work svg .w { fill: none; stroke: currentColor; stroke-width: 0.6; }
.doc-work svg .wf { fill: var(--accent); fill-opacity: 0.55; stroke: currentColor; stroke-width: 0.6; }
.doc-work svg .g { stroke: currentColor; stroke-width: 1.6; }
.doc-work svg .sb { fill: currentColor; }

/* Responsive */
@media (max-width: 1300px) {
  .ed-grid { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); grid-template-areas: "edit fee" "edit doc"; }
  .pane-edit { grid-row: 1 / 3; }
  .pane-fee { position: static; max-height: none; overflow: visible; }
  #live-fee { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; align-items: start; }
  #live-fee .redlines { margin-top: 0; }
}
@media (max-width: 960px) {
  .seg.pane-switch { display: flex; }
  .ed-grid { display: block; }
  .pane-edit, .pane-fee { position: static; max-height: none; overflow: visible; }
  #live-fee { display: block; }
  #live-fee .redlines { margin-top: 16px; }
  .ed-mobilebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface-2); border-top: 1px solid var(--line); }
  .ed-mobilebar small { display: block; font-size: 12px; color: var(--ink-2); }
  .ed-mobilebar b { font-size: 20px; font-stretch: 80%; font-variant-numeric: tabular-nums; }
  .ed-mobilebar .rl { color: var(--red); }
  .view.editor { padding-bottom: 120px; }
  .steps { top: calc(env(safe-area-inset-top, 0px) + var(--top)); }
  .editor[data-pane="edit"] .pane-doc, .editor[data-pane="edit"] .pane-fee,
  .editor[data-pane="preview"] .pane-edit, .editor[data-pane="preview"] .pane-fee,
  .editor[data-pane="fee"] .pane-edit, .editor[data-pane="fee"] .pane-doc { display: none; }
  .client-grid { grid-template-columns: 1fr; }
  .client-aside { position: static; }
  .client-mobilebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px; padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--surface-2); border-top: 1px solid var(--line); }
  .client-mobilebar small { display: block; font-size: 12px; color: var(--ink-2); }
  .client-mobilebar b { font-size: 20px; font-stretch: 80%; font-variant-numeric: tabular-nums; }
  .view.client { padding-bottom: 120px; }
  .tl-grid { grid-template-columns: 1fr; }
  .new-grid { grid-template-columns: 1fr; }
  .sheet { padding: 36px 32px 44px; }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brandmark small, .brandmark b, .sample-note { display: none; }
  .view { padding: 16px 12px 64px; }
  .row2 { grid-template-columns: 1fr; }
  .ed-actions { width: 100%; }
  .ed-actions .btn { flex: 1; }
  .sheet { padding: 26px 20px 34px; font-size: 16px; }
  .doc-tb { grid-template-columns: 1fr 1fr; }
  .doc-firm { flex-direction: column; gap: 2px; }
  .steps .n { display: none; }
  .steps button { padding: 8px 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
