:root {
  color-scheme: light;
  --ink: #162f35;
  --muted: #425e61;
  --line: #cbdad5;
  --paper: #fffefa;
  --wash: #edf3f0;
  --green: #105447;
  --mint: #e5f3ea;
  --rust: #8b3c26;
  font: 15px/1.5 "Segoe UI Variable Text", system-ui, sans-serif;
  color: var(--ink);
  background: var(--wash);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, blockquote { margin: 0; }
h1, h2 { font-family: Bahnschrift, "Segoe UI Variable Display", system-ui, sans-serif; letter-spacing: -.035em; }
h1 { font-size: clamp(34px, 6vw, 66px); line-height: 1.02; }
h2 { font-size: clamp(22px, 3vw, 30px); line-height: 1.2; }
h3 { font-size: 16px; }
button, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--green); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #a75e28; outline-offset: 3px; }
.wrap { width: min(1140px, calc(100% - 32px)); margin-inline: auto; }
.mast { border-bottom: 1px solid var(--line); background: var(--paper); }
.mast-inner, .mast nav, .intro, .actions, .trace-top, .dialog-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 17px; }
.mast-inner { justify-content: space-between; min-height: 58px; padding-block: 9px; }
.mast nav { gap: 7px 17px; }
.intro { justify-content: space-between; margin: 34px 0 22px; }
.intro p, .communication > p, .replay > p { color: var(--muted); margin-top: 6px; }
.sample-label { padding: 5px 10px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.board { display: grid; grid-template-columns: 1.2fr 1fr; gap: 12px; align-items: start; }
.panel { padding: clamp(15px, 2.6vw, 26px); min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.figures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin-block: 14px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--line); }
.figures div { min-width: 0; padding: 9px 11px; background: #f5f8f5; }
.figures span, .figures small { display: block; font-size: 13px; color: var(--muted); }
.figures strong, .trace-top strong { display: block; font-size: clamp(24px, 4.3vw, 39px); letter-spacing: -.045em; font-variant-numeric: tabular-nums; line-height: 1.1; }
#gap { color: var(--rust); }
.result { min-height: 2.9em; font-weight: 650; }
table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 14px; }
td, th { border-bottom: 1px solid var(--line); text-align: left; padding: 7px 5px; vertical-align: top; }
td:nth-child(n+2), th:nth-child(n+2) { text-align: right; white-space: nowrap; }
td small { display: block; }
.recommendation, .trace { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--mint); }
.recommendation p { margin: 3px 0 9px; }
.actions { gap: 8px; }
.primary, .secondary { padding: 8px 12px; min-height: 38px; border-radius: 6px; font-weight: 680; }
.primary { color: white; background: var(--green); border: 1px solid var(--green); }
.primary:hover { background: #19705e; }
.secondary { color: var(--green); background: var(--paper); border: 1px solid #9fb8ae; }
.secondary:hover, .secondary[aria-pressed=true] { background: var(--mint); }
button:disabled { opacity: .58; cursor: default; }
.communication label { display: block; margin: 14px 0 4px; font-weight: 650; }
textarea { display: block; width: 100%; resize: vertical; border: 1px solid #a5b9b0; border-radius: 6px; padding: 9px; margin-bottom: 8px; background: white; color: var(--ink); }
.reply-review { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.reply-review h3, #reply-actions, blockquote { margin-bottom: 8px; }
blockquote { border-left: 3px solid #83a99a; padding: 7px 10px; background: #f0f6f1; }
.replay { margin-top: 20px; }
.trace { margin: 12px 0 10px; }
.trace-top { justify-content: space-between; }
.trace-top strong { display: inline; color: var(--green); }
#agent-pairs { display: flex; margin: 0; padding: 0; list-style: none; gap: 5px; }
#agent-pairs li { width: 14px; height: 14px; border-radius: 50%; border: 1px solid #7b9d90; background: #cbddd3; }
#agent-pairs li[data-active=true] { border-color: var(--green); background: var(--green); }
#queue-counts, #copy-status, .method { font-size: 13px; color: var(--muted); }
.scrub-label { display: flex; justify-content: space-between; margin-top: 10px; font-size: 13px; }
.range { display: block; width: 100%; padding: 0; accent-color: var(--green); }
.review-controls, .source-panel header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 9px; }
.review-controls { margin-block: 13px 8px; }
.agent-board, .review-docs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.agent-board article, .handoff, .source-panel { border: 1px solid var(--line); border-radius: 8px; min-width: 0; }
.agent-board article, .handoff, #review-bank-note { padding: 10px 12px; }
#review-supplier[data-active=true] { border-color: #75aa94; box-shadow: inset 3px 0 var(--green); background: var(--mint); }
#review-bank[data-active=true] { border-color: #85acc2; box-shadow: inset 3px 0 #35739b; background: #e6f2f9; }
.handoff { margin-top: 10px; background: #eef4ef; }
.handoff p + p { margin-top: 4px; }
.source-panel header { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.source-panel header a { font-size: 13px; }
.invoice-window { overflow: hidden; aspect-ratio: 1.13; }
.invoice-sheet { position: relative; }
.invoice-sheet img { display: block; width: 100%; height: auto; }
.invoice-overlays { position: absolute; inset: 0; pointer-events: none; }
.invoice-highlight { position: absolute; background: #ffdb76ad; mix-blend-mode: multiply; outline: 1px solid #af781f; border-radius: 2px; }
.invoice-citations { list-style: none; padding: 7px 12px; margin: 0; border-top: 1px solid var(--line); font-size: 13px; }
.invoice-citations li + li { margin-top: 4px; }
mark { background: #ffe49b; color: #332514; border-radius: 3px; padding: 0 2px; }
.source-table { overflow-x: auto; }
.source-table table { margin: 0; min-width: 365px; }
.source-table th, .source-table td { text-align: left; white-space: normal; padding: 8px; }
.source-table td:nth-child(3) { white-space: nowrap; }
.source-table tr[data-cited=true] { background: #fff2cf; box-shadow: inset 3px 0 #b4802a; }
#review-bank-note { font-size: 13px; color: var(--muted); }
.review-verdict { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.review-verdict strong { font-size: clamp(18px, 3.5vw, 33px); }
#review-gap { color: var(--rust); }
#queue-capacity, #queue-tasks { padding: 0; margin: 8px 0 0; list-style: none; }
#queue-capacity { display: flex; flex-wrap: wrap; gap: 5px; }
#queue-capacity li { padding: 3px 8px; border: 1px solid #a9c4b6; border-radius: 5px; color: var(--muted); font-size: 12px; }
#queue-capacity li[aria-current=step] { background: var(--green); color: #fff; border-color: var(--green); }
#queue-tasks { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 6px; }
#queue-tasks li { border: 1px solid var(--line); padding: 7px; border-radius: 5px; min-width: 0; }
#queue-tasks small { display: block; color: var(--muted); font-size: 12px; }
#queue-tasks li[data-state=working] { background: #e6f2f9; border-color: #85acc2; }
#queue-tasks li[data-state=ready] { background: var(--mint); border-color: #a9c4b6; }
#load-status { margin-block: 26px; }
footer { padding-block: 19px 24px; display: flex; flex-wrap: wrap; gap: 8px 16px; }
dialog { width: min(450px, calc(100% - 32px)); border: 1px solid var(--line); padding: 18px; border-radius: 10px; background: var(--paper); color: var(--ink); }
dialog::backdrop { background: #0f252c8c; }
.dialog-title { justify-content: space-between; }
#bank-record div { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
#bank-record dd { margin: 0; text-align: right; font-weight: 650; }
@media (max-width: 740px) {
  .board, .review-docs { grid-template-columns: 1fr; }
  .intro { margin-top: 22px; }
}
