/* Review and handoff: neutral paper, lavender selection, readable evidence. */

/* Shared work surfaces */
.content-wrap:has(.review-layout), .content-wrap:has(.handoff-viewer) { max-width: none; margin: 0; padding: 24px; }
.content-wrap:has(.review-layout) > .content-footer, .content-wrap:has(.handoff-viewer) > .content-footer { display: none; }
#content:has(.review-layout), #content:has(.handoff-viewer) { min-width: 0; min-height: 0; }
.review-layout, .output-layout:has(.handoff-viewer) { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; min-width: 0; min-height: 620px; }
.review-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); align-items: stretch; gap: 0; }
.review-layout :is(.panel-head, .stage-toolbar), .handoff-viewer .stage-toolbar, .handoff-inspector .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.review-layout :is(.rules-panel, .detail-panel), .handoff-inspector.output-side { min-width: 0; min-height: 0; box-shadow: none; border-radius: 0; }
.review-layout :is(.rules-list, .stage-body, .detail-body), :is(.handoff-document-body, .handoff-inspector-body) { scrollbar-width: thin; scrollbar-color: #d6d5df transparent; }
.stage-toolbar { flex-shrink: 0; min-height: 72px; padding: 16px 20px; background: var(--surface); }
.stage-title { display: grid; min-width: 0; gap: 3px; }
.stage-title strong { color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.5; }
.stage-title span { color: var(--muted); font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.material-view-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 3px; border-radius: 8px; background: var(--bg); min-width: 0; }
.material-view-tabs button { padding: 6px 10px; min-height: 32px; border: 0; background: transparent; color: var(--muted); font-size: 12px; white-space: nowrap; }
.material-view-tabs button.active, .material-view-tabs button[aria-pressed="true"] { background: var(--surface); color: var(--ink); }
.material-view-tabs .status-tag { margin: 3px 6px; }
.review-layout .evidence-link, .handoff-inspector .evidence-link { color: var(--accent); padding: 0; border: 0; background: transparent; font-size: 12px; line-height: 1.8; text-align: left; white-space: normal; overflow-wrap: anywhere; }
.review-layout .evidence-link:hover, .handoff-inspector .evidence-link:hover { color: #0f504b; text-decoration: underline; background: transparent; }

/* Rule queue */
.rules-panel { display: flex; flex-direction: column; border: 0; border-right: 1px solid var(--line); background: #fbfafc; }
.review-queue-head { flex-shrink: 0; padding: 22px 18px 16px; }
.review-queue-head .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0; }
.review-queue-head h1 { margin: 0; color: var(--ink); font-size: 20px; font-weight: 600; line-height: 1.5; letter-spacing: -.3px; }
.review-queue-head .heading-actions { display: flex; gap: 3px; margin: 0; }
.review-queue-head .heading-actions button { min-height: 30px; min-width: 28px; padding: 5px; border: 0; background: transparent; color: var(--muted); }
.review-queue-head .heading-actions .icon { width: 16px; height: 16px; margin: 0; }
.review-context { margin: 8px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.progress-overview { display: flex; align-items: center; gap: 3px; margin-top: 20px; padding: 4px; border-radius: 10px; background: #f0eef4; }
.progress-item { flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 4px; padding: 7px 3px; min-height: 36px; border: 0; background: transparent; font-size: 12px; line-height: 1.5; color: var(--muted); }
.progress-item strong { font-size: 12px; font-weight: 600; color: inherit; font-variant-numeric: tabular-nums; }
.progress-item.active { color: var(--ink); background: var(--surface); }
.queue-section-heading { flex-shrink: 0; padding: 18px 18px 8px; border-bottom: 0 !important; background: transparent; }
.queue-section-heading h2 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); }
.queue-tabs { display: flex; flex-shrink: 0; flex-wrap: wrap; gap: 5px; padding: 0 12px 10px; }
.queue-tabs button { min-height: 28px; padding: 4px 7px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.queue-tabs button.active { color: var(--ink); background: var(--soft); }
.queue-selector { display: none; }
.rules-list { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 16px; }
.rule-row { display: block; width: 100%; margin: 0 0 5px; padding: 14px 12px; position: relative; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--text); text-align: left; }
.rule-row:hover:not(:disabled):not(.selected) { background: #f2f0f5; border-color: transparent; }
.rule-row.selected { color: var(--ink); background: var(--soft); border-color: #e5e0ef; }
.rule-row.selected:hover:not(:disabled) { background: var(--soft); border-color: #d7d1e2; }
.rule-row.selected::before { content: ""; position: absolute; top: 17px; bottom: 17px; left: -1px; width: 3px; border-radius: 0 3px 3px 0; background: #857a9d; }
.rule-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.rule-id { font-size: 12px; line-height: 1.5; color: var(--muted); }
.rule-row strong { display: block; font-size: 14px; line-height: 1.7; font-weight: 500; overflow-wrap: anywhere; }
.rule-row small { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.queue-footnote { flex-shrink: 0; border-top: 1px solid var(--line); padding: 14px 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.queue-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 25px 16px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.queue-empty strong { color: var(--ink); font-weight: 500; }
.queue-empty p { margin: 0; }
.queue-empty button { font-size: 12px; }
.detail-empty { grid-column: 1 / -1; justify-content: center; align-items: center; padding: 48px 24px; text-align: center; }
.detail-empty h2 { margin: 0; font-size: 24px; font-weight: 600; color: var(--ink); }

/* Source comparison: two continuous documents */
#detail.detail-panel { display: grid; grid-template-columns: minmax(0, 1fr) 300px; border: 0; background: var(--bg); overflow: hidden; }
.evidence-stage { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.stage-body { flex: 1; min-width: 0; min-height: 0; padding: 20px; overflow: auto; }
.source-comparison { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: 16px; min-width: 0; }
.source-document { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.source-document-head { display: flex; align-items: flex-start; gap: 10px; padding: 20px 16px 15px; }
.source-document-head > div { min-width: 0; }
.source-document-head small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.source-document-head h3 { margin: 0; font-size: 14px; line-height: 1.7; font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.document-file-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 34px; flex-shrink: 0; color: #96939f; }
.document-file-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.source-document-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 8px; padding: 9px 16px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.source-authority { margin-left: auto; }
.source-authority.current { color: var(--accent); }
.document-lines { padding: 18px 0 22px; color: var(--text); font-size: 14px; line-height: 1.9; }
.document-line { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 7px 15px 7px 8px; min-width: 0; }
.document-line .line-number { color: var(--muted); font: 12px/2.2 Consolas, monospace; text-align: right; user-select: none; }
.document-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.9; }
.document-line.is-match { color: var(--text); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.document-line.is-match .line-number { color: var(--accent); }
.current-documents { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.document-interpretation { padding: 14px 16px; background: #faf9fc; border-bottom: 1px solid var(--line); color: var(--text); font-size: 14px; line-height: 1.8; }
.document-interpretation > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.document-interpretation p { margin: 0; }
.source-document-footer { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 13px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.source-document-footer small { font-size: 12px; line-height: 1.7; }
.source-document-footer .evidence-link { display: inline-flex; align-items: center; gap: 5px; }
.source-document-footer .icon { flex-shrink: 0; width: 14px; height: 14px; }
.document-unlocated { padding: 0 16px; font-size: 14px; line-height: 1.9; color: var(--text); }
.document-unlocated p { margin: 0 0 15px; }
.document-unlocated small { color: var(--muted); font-size: 12px; line-height: 1.8; }
.empty-source-document { min-height: 320px; align-items: center; justify-content: center; padding: 32px 22px; text-align: center; background: #fbfafc; border-style: dashed; }
.empty-document-symbol { width: 46px; height: 50px; margin-bottom: 15px; color: #bbb7c7; }
.empty-document-symbol svg { width: 46px; height: 46px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.empty-source-document h3 { margin: 0 0 10px; font-size: 14px; line-height: 1.8; font-weight: 600; color: var(--ink); }
.empty-source-document p { margin: 0; font-size: 14px; line-height: 1.9; color: var(--muted); }
.empty-source-document > span { margin-top: 18px; color: var(--muted); font-size: 12px; }
.stage-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px 15px; flex-shrink: 0; padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.7; }
.citation-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; margin-right: 4px; background: var(--accent); vertical-align: 2px; }
.project-context-view { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.project-context-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 16px 20px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.project-context-view img { display: block; width: 100%; max-width: 100%; height: auto; object-fit: contain; }
.project-context-note { padding: 18px 20px; font-size: 14px; line-height: 1.8; color: var(--text); }
.project-context-note strong { font-weight: 600; color: var(--ink); }
.project-context-note p { margin: 6px 0 12px; }
.project-context-note a { font-size: 12px; color: var(--accent); }

/* Decision inspector */
.decision-inspector { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--line); background: var(--surface); overflow: hidden; }
.decision-inspector > .panel-head { padding: 21px 20px; align-items: flex-start; }
.decision-inspector > .panel-head > div { min-width: 0; }
.decision-inspector .panel-head h2 { margin: 0; font-size: 20px; line-height: 1.6; font-weight: 600; color: var(--ink); letter-spacing: -.25px; overflow-wrap: anywhere; }
.rule-category { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.detail-body { flex: 1; min-width: 0; min-height: 0; padding: 20px; overflow-y: auto; overflow-x: hidden; }
.question-summary { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 25px; color: var(--text); font-size: 14px; line-height: 1.85; }
.question-summary p { margin: 0; }
.summary-dot { flex-shrink: 0; width: 5px; height: 5px; margin-top: 10px; border-radius: 50%; background: #9586aa; }
.summary-dot.covered { background: var(--accent); }
.summary-dot.conflict { background: #b98a47; }
.detail-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.detail-toolbar h3 { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink); line-height: 1.6; }
.decision-fields { display: grid; gap: 10px; }
.decision-area .field { display: grid; gap: 8px; min-width: 0; margin: 0; }
.decision-area .field label { color: var(--text); font-size: 12px; line-height: 1.6; }
.decision-area .field textarea { width: 100%; min-height: 168px; padding: 13px; border: 1px solid #dad8e1; border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 14px; line-height: 1.8; resize: vertical; }
.decision-area .field textarea:focus { outline: 2px solid #e6dfef; outline-offset: 1px; border-color: #8d7ca5; }
.decision-area .field textarea::placeholder { color: #91909a; }
.decision-area .field small { color: var(--muted); font-size: 12px; line-height: 1.8; }
.decision-secondary { min-width: 0; }
.decision-secondary > summary, .decision-note-details > summary { cursor: pointer; list-style: none; color: var(--muted); font-size: 12px; line-height: 1.7; }
.decision-secondary > summary { padding: 4px 0; }
.decision-secondary > summary::after { content: "⌄"; margin-left: 6px; }
.decision-secondary[open] { flex-basis: 100%; }
.decision-types { display: grid; gap: 7px; margin: 10px 0; }
.decision-types label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; line-height: 1.7; color: var(--text); }
.decision-types label:has(input:checked) { background: var(--soft); border-color: #dfd8eb; color: var(--ink); }
.decision-types label:has(input:disabled) { color: #a09da7; }
.decision-types input { margin: 0; flex-shrink: 0; accent-color: var(--ink); }
.decision-note-details > summary { padding: 5px 0 10px; }
.decision-note-details > summary::before { content: "+"; display: inline-block; width: 16px; }
.decision-note-details[open] > summary::before { content: "−"; }
.decision-note-details textarea { min-height: 96px !important; }
.decision-footer { display: flex; flex-direction: column; flex-shrink: 0; gap: 10px; padding: 18px 20px; border-top: 1px solid var(--line); background: var(--surface); }
.decision-footer p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.decision-footer p:empty { display: none; }
.decision-footer .actions { display: flex; align-items: center; gap: 8px; margin: 0; }
.decision-footer button { min-height: 40px; padding: 9px 11px; font-size: 12px; white-space: nowrap; }
.decision-footer .primary { flex: 1; }
.review-layout .primary, .handoff-package-nav .primary, .handoff-viewer .primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.reason-box, .saved-decision { margin-bottom: 20px; padding: 14px; border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-size: 14px; line-height: 1.8; }
.reason-box.stale, .saved-decision.stale { background: #f8f1e5; color: #856027; }
.saved-decision strong { font-weight: 600; }
.saved-decision p { margin: 6px 0; }
.saved-decision small { font-size: 12px; }
.advanced-review, .technical-details { margin-top: 24px; padding: 0; border-top: 1px solid var(--line); color: var(--muted); }
.advanced-review > summary, .technical-details > summary { display: flex; align-items: center; gap: 6px; padding: 12px 0; list-style: none; cursor: pointer; font-size: 12px; line-height: 1.7; }
.advanced-review > summary::before, .technical-details > summary::before { content: "›"; width: 8px; font-size: 16px; }
.advanced-review[open] > summary::before, .technical-details[open] > summary::before { transform: rotate(90deg); }
.advanced-review h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; color: var(--ink); }
.advanced-review p, .advanced-review ul, .advanced-review .evidence-card { font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.advanced-review ul { padding-left: 18px; }
.advanced-review .evidence-card { padding: 12px 0; border-top: 1px solid var(--line); }
.advanced-review .evidence-card p { margin: 6px 0; }
.source-document > .technical-details { margin: 0; padding: 0 16px; }
.technical-details .comparison-value, .technical-details .meta { margin-bottom: 12px; font-size: 12px; line-height: 1.8; overflow-wrap: anywhere; }
.technical-details b { font-weight: 500; color: var(--text); }
.detail-overflow { position: relative; flex-shrink: 0; }
.detail-overflow > summary { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); list-style: none; cursor: pointer; }
.detail-overflow > summary:hover { background: var(--soft); }
.detail-overflow > div { position: absolute; z-index: 15; top: calc(100% + 6px); right: 0; min-width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 10px 28px #20212716; }
.detail-overflow > div button { display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: transparent; padding: 9px; color: var(--text); font-size: 12px; text-align: left; white-space: nowrap; }
.detail-overflow > div button:hover { background: var(--soft); }
.detail-overflow > summary::-webkit-details-marker { display: none; }

/* Handoff file directory and readable document */
.output-layout:has(.handoff-viewer) { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; gap: 0; align-items: stretch; }
.handoff-package-nav { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--line); background: #fbfafc; }
.package-section-label { margin: 22px 18px 10px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.handoff-package-nav .payload-tabs { display: grid; gap: 6px; padding: 0 10px; }
.handoff-package-nav .payload-tabs button { display: flex; align-items: flex-start; gap: 10px; width: 100%; border: 1px solid transparent; border-radius: 12px; background: transparent; color: var(--text); padding: 14px 12px; font-size: 14px; text-align: left; line-height: 1.6; }
.handoff-package-nav .payload-tabs button.active { background: var(--soft); border-color: #e5e0ef; color: var(--ink); }
.handoff-package-nav .payload-tabs .icon { flex-shrink: 0; width: 18px; height: 18px; margin: 2px 0 0; }
.handoff-package-nav .payload-tabs small { display: block; margin-top: 5px; font-size: 12px; line-height: 1.7; color: var(--muted); }
.package-context { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 25px 18px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.package-context strong { color: var(--text); font-weight: 500; }
.package-context small { grid-column: 1 / -1; font-size: 12px; overflow-wrap: anywhere; }
.package-nav-footer { display: grid; gap: 10px; margin-top: auto; padding: 18px; border-top: 1px solid var(--line); }
.package-nav-footer button { width: 100%; min-height: 38px; font-size: 12px; }
.package-nav-footer small { color: var(--muted); font-size: 12px; line-height: 1.7; }
.package-nav-footer #go-verify { margin-top: 8px; }
.handoff-viewer { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); overflow: hidden; }
.handoff-document-body { flex: 1; min-width: 0; min-height: 0; overflow: auto; padding: 24px; }
.handoff-readable { max-width: 880px; margin: 0 auto; padding: 34px 32px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.95; overflow-wrap: anywhere; }
.handoff-readable h1 { margin: 0 0 22px; font-size: 28px; line-height: 1.5; font-weight: 600; color: var(--ink); letter-spacing: -.4px; }
.handoff-readable h2 { margin: 32px 0 16px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--ink); font-size: 20px; line-height: 1.6; font-weight: 600; }
.handoff-readable h3 { margin: 24px 0 12px; font-size: 16px; line-height: 1.7; font-weight: 600; color: var(--ink); }
.handoff-readable p { margin: 11px 0; }
.handoff-readable ul { margin: 12px 0 18px; padding-left: 22px; }
.handoff-readable li { margin: 8px 0; }
.handoff-readable strong { color: var(--ink); font-weight: 600; }
.handoff-readable code { padding: 2px 5px; border-radius: 4px; background: var(--bg); color: var(--text); font: 12px/1.8 Consolas, "Microsoft YaHei", monospace; }
.handoff-readable pre { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #f8f7fa; white-space: pre-wrap; overflow-wrap: anywhere; }
.handoff-readable pre code { padding: 0; background: transparent; }
.handoff-document-body .payload { margin: 0; padding: 28px; min-height: 100%; max-height: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); font: 13px/1.9 Consolas, "Microsoft YaHei", monospace; white-space: pre-wrap; overflow-wrap: anywhere; overflow: visible; }
.handoff-viewer .export-actions { display: flex; align-items: center; flex-wrap: wrap; flex-shrink: 0; gap: 8px; padding: 16px 20px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.handoff-viewer .export-actions button { min-height: 38px; font-size: 12px; padding: 8px 11px; }
.handoff-viewer > .tiny { flex-shrink: 0; margin: 0; padding: 0 20px 16px; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.7; }

/* Handoff status and unresolved items */
.handoff-inspector.output-side { display: flex; flex-direction: column; border: 0; border-left: 1px solid var(--line); background: var(--surface); }
.handoff-inspector > .panel-head { flex-shrink: 0; min-height: 72px; padding: 18px 20px; }
.handoff-inspector .panel-head h2 { margin: 0; font-size: 16px; line-height: 1.6; font-weight: 600; color: var(--ink); }
.handoff-inspector-body { flex: 1; min-width: 0; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 22px 20px; }
.handoff-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; color: var(--muted); font-size: 12px; }
.handoff-summary > span { display: grid; gap: 5px; }
.handoff-summary strong { color: var(--ink); font-size: 28px; line-height: 1.3; font-weight: 500; font-variant-numeric: tabular-nums; }
.handoff-use-guide { padding: 16px; border-radius: 10px; background: var(--soft); font-size: 14px; line-height: 1.8; color: var(--text); }
.handoff-use-guide strong { color: var(--ink); font-weight: 600; }
.handoff-use-guide p { margin: 7px 0 13px; }
.handoff-use-guide button { width: 100%; border-color: #ddd7e8; background: var(--surface); color: var(--ink); font-size: 12px; }
.handoff-status-note { margin-top: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.8; }
.handoff-open-questions h3, .handoff-backfill h3 { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 23px 0 9px; color: var(--ink); font-size: 14px; line-height: 1.7; font-weight: 600; }
.handoff-open-questions h3 span, .handoff-backfill h3 span { color: var(--muted); font-size: 12px; font-weight: 400; }
.handoff-backfill > p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.handoff-inspector .output-item { padding: 17px 0; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 1.8; }
.output-item-id { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.handoff-inspector .output-item strong { display: block; color: var(--ink); font-size: 14px; line-height: 1.8; font-weight: 500; }
.handoff-inspector .output-item p { margin: 7px 0 10px; color: var(--muted); font-size: 12px; line-height: 1.85; overflow-wrap: anywhere; }
.handoff-inspector .output-item > button:not(.evidence-link) { min-height: 30px; padding: 5px 9px; color: var(--accent); border-color: #dbe8e3; background: var(--surface); font-size: 12px; }
.handoff-awaiting { margin-top: 23px; }
.awaiting-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; padding: 14px; border: 0; border-radius: 10px; background: var(--soft); color: var(--ink); text-align: left; }
.awaiting-heading strong { display: block; font-size: 14px; line-height: 1.7; font-weight: 500; }
.awaiting-heading small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.handoff-unconfirmed, .handoff-source-details { margin-top: 16px; border-top: 1px solid var(--line); }
.handoff-unconfirmed > summary, .handoff-source-details > summary { display: flex; align-items: center; gap: 8px; padding: 13px 0; list-style: none; color: var(--muted); font-size: 12px; line-height: 1.7; cursor: pointer; }
.handoff-unconfirmed > summary::before, .handoff-source-details > summary::before { content: "›"; width: 8px; font-size: 16px; }
.handoff-unconfirmed[open] > summary::before, .handoff-source-details[open] > summary::before { transform: rotate(90deg); }
.handoff-source-details > summary span { margin-left: auto; }
.snapshot-card { display: grid; gap: 7px; padding: 15px 0; border-bottom: 1px solid var(--line); color: var(--text); font-size: 12px; line-height: 1.8; }
.snapshot-card small { color: var(--muted); font-size: 12px; }

/* Large screens: each column scrolls, actions stay outside the reading area. */
@media (min-width: 1201px) {
  body:has(.review-layout), body:has(.handoff-viewer) { overflow: hidden; }
  .shell:has(.review-layout), .shell:has(.handoff-viewer) { height: calc(100dvh - 24px); min-height: 0; }
  .main:has(.review-layout), .main:has(.handoff-viewer) { display: flex; flex-direction: column; height: 100%; min-height: 0; overflow: hidden; }
  .main:has(.review-layout) > .topbar, .main:has(.handoff-viewer) > .topbar { flex-shrink: 0; }
  .content-wrap:has(.review-layout), .content-wrap:has(.handoff-viewer) { flex: 1; min-height: 0; display: flex; flex-direction: column; }
  #content:has(.review-layout), #content:has(.handoff-viewer) { flex: 1; display: flex; flex-direction: column; }
  .review-layout, .output-layout:has(.handoff-viewer) { flex: 1; min-height: 0; }
  .review-layout > *, #detail > *, .output-layout:has(.handoff-viewer) > * { min-height: 0; }
}

/* Narrow desktops: give long citations a full reading line. */
@media (max-width: 1480px) {
  .review-layout { grid-template-columns: 230px minmax(0, 1fr); }
  #detail.detail-panel { grid-template-columns: minmax(0, 1fr) 280px; }
  .source-comparison { grid-template-columns: minmax(0, 1fr); }
  .output-layout:has(.handoff-viewer) { grid-template-columns: 210px minmax(0, 1fr) 280px; }
  .stage-body, .handoff-document-body { padding: 18px; }
  .handoff-readable { padding: 28px 24px; }
}

/* Tablet: reading and decision continue vertically without cramped columns. */
@media (max-width: 1200px) {
  .content-wrap:has(.review-layout), .content-wrap:has(.handoff-viewer) { padding: 20px; }
  .review-layout { grid-template-columns: 230px minmax(0, 1fr); align-items: start; }
  .rules-panel { align-self: stretch; }
  .rules-list { max-height: 650px; }
  #detail.detail-panel { display: flex; flex-direction: column; overflow: visible; }
  .evidence-stage { overflow: visible; }
  .stage-body { overflow: visible; }
  .decision-inspector { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .detail-body { overflow: visible; }
  .decision-area .field textarea { min-height: 140px; }
  .decision-footer .primary { flex: 0 1 auto; min-width: 150px; }
  .decision-footer .actions { justify-content: flex-end; }
  .output-layout:has(.handoff-viewer) { grid-template-columns: 210px minmax(0, 1fr); grid-template-areas: "directory document" "directory status"; }
  .handoff-package-nav { grid-area: directory; }
  .handoff-viewer { grid-area: document; overflow: visible; }
  .handoff-document-body { overflow: visible; }
  .handoff-inspector.output-side { grid-area: status; border-left: 0; border-top: 1px solid var(--line); }
  .handoff-inspector-body { overflow: visible; }
  .handoff-summary { max-width: 420px; }
}

/* Mobile: every operation remains reachable in the stacked layout. */
@media (max-width: 800px) {
  .content-wrap:has(.review-layout), .content-wrap:has(.handoff-viewer) { padding: 14px; }
  .review-layout, .output-layout:has(.handoff-viewer) { display: flex; flex-direction: column; min-height: 0; }
  .rules-panel, .handoff-package-nav { border-right: 0; border-bottom: 1px solid var(--line); }
  .review-queue-head { padding: 18px; }
  .review-queue-head h1 { font-size: 22px; }
  .progress-overview { max-width: 420px; margin-top: 16px; }
  .queue-section-heading { padding-top: 5px; }
  .queue-selector { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 18px 13px; }
  .queue-selector label { font-size: 12px; color: var(--muted); }
  .queue-selector select { flex: 1; min-width: 160px; max-width: 100%; font-size: 14px; }
  .queue-selector button { font-size: 12px; }
  .rules-list { max-height: 205px; padding-inline: 10px; }
  .rule-row { padding: 12px; }
  .queue-footnote { padding: 12px 18px; }
  .stage-toolbar { flex-wrap: wrap; min-height: 0; padding: 16px; }
  .stage-body { padding: 16px; }
  .stage-caption { padding: 12px 16px; }
  .source-comparison { gap: 16px; }
  .source-document-head { padding-top: 18px; }
  .document-lines { padding-block: 14px; }
  .empty-source-document { min-height: 240px; }
  .decision-inspector > .panel-head, .detail-body, .decision-footer { padding: 18px; }
  .decision-footer { position: sticky; bottom: 0; z-index: 2; }
  .decision-footer button { min-height: 42px; }
  .handoff-package-nav .payload-tabs { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding-inline: 12px; }
  .handoff-package-nav .payload-tabs button { padding: 12px 10px; }
  .package-section-label { margin-top: 0; }
  .package-context { margin: 18px; }
  .package-nav-footer { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 16px 18px; }
  .package-nav-footer small { grid-column: 1 / -1; grid-row: 2; }
  .package-nav-footer #go-verify { margin: 0; }
  .handoff-document-body { padding: 16px; }
  .handoff-readable { padding: 25px 21px; }
  .handoff-readable h1 { font-size: 26px; }
  .handoff-document-body .payload { padding: 21px; font-size: 12px; }
  .handoff-viewer .export-actions { padding: 15px 16px 10px; }
  .handoff-viewer > .tiny { padding-inline: 16px; }
  .handoff-inspector > .panel-head, .handoff-inspector-body { padding: 18px; }
}

@media (max-width: 420px) {
  .content-wrap:has(.review-layout), .content-wrap:has(.handoff-viewer) { padding: 10px; }
  .material-view-tabs { width: 100%; justify-content: flex-start; }
  .stage-body, .handoff-document-body { padding: 12px; }
  .document-line { grid-template-columns: 20px minmax(0, 1fr); gap: 8px; padding-right: 12px; }
  .handoff-readable { padding: 22px 18px; }
  .handoff-readable h1 { font-size: 24px; }
  .handoff-package-nav .payload-tabs { grid-template-columns: minmax(0, 1fr); }
  .package-nav-footer { grid-template-columns: minmax(0, 1fr); }
  .package-nav-footer small { grid-row: auto; }
  .decision-footer .actions { flex-wrap: wrap; }
  .decision-footer .primary { flex: 1; }
  .handoff-viewer .export-actions button { flex: 1 1 auto; }
}
