:root {
  --bg: #f6f6f4; --panel: #ffffff; --ink: #1d1d1b; --muted: #66665f; --line: #deded8;
  --accent: #1f5f8b; --accent-ink: #ffffff; --error: #a32020; --current: #e8f0f7;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 15px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); min-width: 1366px; }
a { color: var(--accent); }
button, .button {
  font: inherit; padding: 6px 12px; border: 1px solid var(--accent); border-radius: 4px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block;
}
button.link { background: none; border: none; color: var(--accent); padding: 0; text-decoration: underline; }
input { font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: 16px; align-items: center; }
.topbar form { margin: 0; }
.brand { font-weight: 600; color: var(--ink); text-decoration: none; }
.who { color: var(--muted); }
.page { max-width: 1100px; margin: 24px auto; padding: 0 20px; }
.narrow { max-width: 380px; margin: 80px auto; padding: 0 20px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; }
.error { color: var(--error); }
.tender-list { list-style: none; padding: 0; display: grid; gap: 12px; }
.tender-card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; color: inherit; text-decoration: none; }
.tender-card:hover { border-color: var(--accent); }
.tender-id { font-weight: 600; }
.count { color: var(--muted); }
.tender-meta { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 8px 0; }
.tender-meta div { display: flex; gap: 6px; }
.tender-meta dt { color: var(--muted); }
.tender-meta dd { margin: 0; }
.case-list li { margin: 6px 0; }
.question-preview { color: var(--muted); margin-left: 8px; }

/* Case workspace: documents beside the question panel. */
body.workspace { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.tender-bar { display: flex; gap: 24px; align-items: center; padding: 4px 20px; background: var(--panel); border-bottom: 1px solid var(--line); font-size: 13px; }
.tender-bar .tender-meta { margin: 0; }
.tender-bar .object dd { max-width: 520px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.columns { flex: 1; display: grid; grid-template-columns: 300px 1fr 420px; min-height: 0; }
.tree { overflow: auto; border-right: 1px solid var(--line); background: var(--panel); padding: 8px 4px 24px 12px; font-size: 13px; }
.tree h2, .case-panel .case-number { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 4px 0 8px; }
.tree ul { list-style: none; margin: 0; padding-left: 14px; }
.tree .tree-root { padding-left: 0; }
.tree summary { cursor: pointer; padding: 2px 0; }
.tree li.file { padding: 2px 0; display: flex; gap: 6px; justify-content: space-between; }
.tree li.file a, .tree li.file span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree li.current { background: var(--current); }
.tree .size { color: var(--muted); white-space: nowrap; }
.tree .listed-only { color: var(--muted); }
.tree .loading { color: var(--muted); }
.viewer { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.viewer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.doc-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pdf-viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.pdf-controls { display: flex; gap: 8px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.pdf-controls input { width: 70px; }
.pdf-controls button { padding: 2px 10px; }
.pdf-pages { flex: 1; overflow: auto; padding: 16px; background: #8a8a85; position: relative; }
.pdf-page { position: relative; margin: 0 auto 16px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.pdf-page canvas { display: block; }
#sheet-viewer { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.sheet-controls { display: flex; gap: 12px; align-items: center; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sheet-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.sheet-tabs button { padding: 2px 10px; background: var(--panel); color: var(--ink); border-color: var(--line); }
.sheet-tabs button[aria-selected="true"] { background: var(--current); border-color: var(--accent); font-weight: 600; }
.sheet-selection { color: var(--muted); font-size: 13px; }
.sheet-selection input { width: 110px; margin-left: 4px; padding: 2px 6px; }
.sheet-controls .cite { margin-left: auto; background: #2e7d32; border-color: #2e7d32; white-space: nowrap; }
.sheet-grid { flex: 1; overflow: auto; background: var(--panel); }
.sheet-grid table { border-collapse: collapse; font-size: 13px; }
.sheet-grid th, .sheet-grid td { border: 1px solid var(--line); padding: 2px 6px; white-space: pre; max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.sheet-grid th { background: var(--bg); color: var(--muted); font-weight: normal; position: sticky; top: 0; }
.sheet-grid tbody th { position: sticky; left: 0; text-align: right; }
.sheet-grid td { cursor: cell; }
.sheet-grid td.selected { background: var(--current); outline: 1px solid var(--accent); }
.sheet-grid > p, .sheet-grid > button { margin: 12px; }
.case-panel { overflow: auto; border-left: 1px solid var(--line); background: var(--panel); padding: 16px 20px; }
.question { font-size: 18px; line-height: 1.4; margin: 0 0 16px; }
.case-nav { display: flex; justify-content: space-between; margin-top: 24px; }

/* pdf.js text layer (from pdf_viewer.css, trimmed): transparent text over the canvas for selection. */
.textLayer { position: absolute; inset: 0; overflow: clip; opacity: 1; line-height: 1; text-align: initial; -webkit-text-size-adjust: none; text-size-adjust: none; forced-color-adjust: none; transform-origin: 0 0; caret-color: CanvasText; z-index: 0; }
.textLayer :is(span, br) { color: transparent; position: absolute; white-space: pre; cursor: text; transform-origin: 0% 0%; }
.textLayer > :not(.markedContent), .textLayer .markedContent span:not(.markedContent) { z-index: 1; }
.textLayer span.markedContent { top: 0; height: 0; }
.textLayer ::selection { background: rgba(0, 100, 255, .25); }
.textLayer br::selection { background: transparent; }
.textLayer .endOfContent { display: block; position: absolute; inset: 100% 0 0; z-index: 0; cursor: default; user-select: none; }

/* Pass 1: answer panel. */
.case-head { display: flex; justify-content: space-between; align-items: center; }
.case-head .case-number { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.status { font-size: 12px; padding: 1px 8px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.status-closed { background: #e6f2e6; border-color: #a9cfa9; color: #245c24; }
.status-skipped { background: #fff4dc; border-color: #e7cf94; color: #6b5212; }
.progress { color: var(--muted); }
.answer-form { display: flex; flex-direction: column; gap: 14px; }
.answer-form fieldset { border: 1px solid var(--line); border-radius: 4px; padding: 8px 12px; margin: 0; }
.answer-form legend { color: var(--muted); font-size: 13px; padding: 0 4px; }
.answer-form fieldset label { display: block; padding: 2px 0; }
.confidence label { display: inline-block !important; margin-right: 14px; }
.answer-form textarea { width: 100%; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; resize: vertical; }
label.block { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 13px; }
label.block textarea { color: var(--ink); font-size: 15px; }
.citation { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--bg); border-radius: 4px; }
.citation .label { color: var(--muted); font-size: 13px; }
[hidden] { display: none !important; }
.notice { background: #e6f2e6; padding: 6px 10px; border-radius: 4px; }
.errors { background: #fbeaea; color: var(--error); padding: 8px 10px 8px 28px; border-radius: 4px; }
button.secondary, .button.secondary { background: var(--panel); color: var(--accent); }
.pdf-controls .cite { margin-left: auto; background: #2e7d32; border-color: #2e7d32; }
.case-nav { align-items: center; }
.case-nav form { margin: 0; }
.history { margin-top: 20px; font-size: 13px; color: var(--muted); }
.history li { margin: 4px 0; }
.case-list .status { margin: 0 6px; }

/* Review and pass 2. */
.state { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); font-weight: normal; }
.state-pass2 { background: #e8f0f7; border-color: #a9c3dc; color: var(--accent); }
.state-complete { background: #e6f2e6; border-color: #a9cfa9; color: #245c24; }
.warning { background: #fff4dc; border: 1px solid #e7cf94; border-radius: 6px; padding: 4px 16px; margin: 16px 0; }
.narrow-page { max-width: 760px; }
.open-cases li { margin: 6px 0; }
button.danger { background: #a35b10; border-color: #a35b10; }
button:disabled { opacity: .45; cursor: not-allowed; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.blind-answer, .gold, .verdict { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin: 12px 0; }
.blind-answer h3, .gold h3, .verdict h3 { font-size: 14px; margin: 0 0 8px; }
.blind-answer { background: var(--bg); }
.gold { border-color: #a9c3dc; }
.gold dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; }
.gold dt { color: var(--muted); font-size: 13px; }
.gold dd { margin: 0; }
.gold dd ul { margin: 0; padding-left: 18px; }
.gold-value { font-weight: 600; }
.gold h4 { font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.gold-evidence { list-style: none; padding: 0; margin: 0; }
.gold-evidence li { margin: 6px 0; }
.gold-evidence blockquote { margin: 4px 0 0; padding-left: 10px; border-left: 3px solid #a9c3dc; }
.locator { font-size: 12px; color: var(--muted); margin-left: 8px; }

/* Proposals. */
.proposals { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 8px; }
.proposal-current { background: var(--bg); border-radius: 4px; padding: 6px 10px; margin: 8px 0; }
.proposal-current p { margin: 4px 0; }
.proposal-form summary { cursor: pointer; color: var(--accent); margin: 6px 0; }

/* Search, above the document tree */
.tree form.search { margin: 4px 0 10px; }
.tree form.search label { display: block; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; }
.tree .search-row { display: flex; gap: 4px; }
.tree .search-row input { flex: 1; min-width: 0; }
#search-results:not(:empty) { border-bottom: 1px solid var(--line); padding-bottom: 8px; margin-bottom: 8px; }
#search-results .hit-count { color: var(--muted); margin: 0 0 4px; }
#search-results ol.hits { list-style: none; padding-left: 0; margin: 0; }
#search-results ol.hits li { padding: 4px 0; }
#search-results .snippet { margin: 2px 0 0; color: var(--muted); overflow-wrap: anywhere; }
#search-results mark { background: #fbe9a8; color: inherit; padding: 0 1px; }

/* Guide and calibration */
.guide { max-width: 760px; }
.guide dt { font-weight: 600; margin-top: 8px; }
.guide dd { margin: 2px 0 0 0; }
.calibration { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 4px 16px 12px; margin-bottom: 24px; }
.calibration-cases li { padding: 3px 0; }

/* Admin */
.admin-nav { display: flex; gap: 16px; margin-bottom: 4px; }
table.data { border-collapse: collapse; width: 100%; margin: 8px 0 20px; font-size: 13px; background: var(--panel); }
table.data th, table.data td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
table.data thead th { background: var(--bg); }
.figures div { display: flex; gap: 8px; }
.figures dt { color: var(--muted); min-width: 160px; }
.figures dd { margin: 0; }
.check-match { color: #1b6e2d; font-weight: 600; }
.check-mismatch { color: var(--error); font-weight: 600; }
pre.json { white-space: pre-wrap; font-size: 12px; background: var(--bg); padding: 8px; max-height: 480px; overflow: auto; }
