/* LAY-10…21: the user-supplied reference is the Review-specific visual authority. */
.review-page {
  --rv-bg:#F6F7F9; --rv-surface:#FFFFFF; --rv-ink:#16202B; --rv-ink-2:#4A5563; --rv-ink-3:#7A8594;
  --rv-line:#E4E7EC; --rv-line-2:#EEF0F3; --rv-accent:#2E6BD9; --rv-accent-soft:#EAF1FD;
  --rv-gap:#E07B39; --rv-gap-soft:#FCEFE6; --rv-before:#C9CFD8; --rv-neutral:#F0F2F5;
  --rv-ok:#1F7A4D; --rv-ok-soft:#E7F4EC; --rv-warn:#A65F00; --rv-warn-soft:#FBF1DE;
  --rv-bad:#B42318; --rv-bad-soft:#FDECEC;
  display:grid; grid-template-columns:260px minmax(0,1fr); height:calc(100dvh - 60px); min-height:640px;
  background:var(--rv-bg); color:var(--rv-ink); font-size:15px; line-height:1.5; font-variant-numeric:tabular-nums;
}
.screen:has(.review-page) { padding:0; max-width:none; }
.top [data-original-preview-trigger] { flex-shrink:0; white-space:nowrap; }
body.ui-pages-active .top:has([data-original-preview-trigger]) { position:sticky; top:0; z-index:10; }
.review-issues { display:flex; flex-direction:column; min-width:0; min-height:0; padding:24px 0; background:var(--rv-surface); border-right:1px solid var(--rv-line); }
.review-issues-heading { display:flex; justify-content:space-between; align-items:center; margin:0 24px 12px; }
.review-issues-heading h2 { font-size:13px; color:var(--rv-ink-3); margin:0; font-weight:600; text-transform:uppercase; }
.review-issues-heading > span { font-size:12px; color:var(--rv-ink-3); }
.review-issues-filter { display:grid; gap:8px; margin:0 24px 16px; }
.review-queue-disclosure { position:relative; height:0; flex:1; min-height:0; overflow:hidden; }
.review-queue-disclosure > summary { display:none; }
.review-queue-content { position:absolute; inset:0; display:flex; flex-direction:column; min-height:0; }
.review-issue-list { flex:1; min-height:0; overflow:auto; scrollbar-color:var(--rv-before) transparent; }
.review-issue-column { margin-bottom:12px; }
.review-issue-column h3 { margin:0; padding:8px 24px 4px; font-size:13px; font-weight:400; color:var(--rv-ink-3); overflow-wrap:anywhere; }
.review-issue { position:relative; display:grid; grid-template-columns:8px minmax(0,1fr) auto; gap:8px; width:100%; text-align:left; padding:8px 24px; border:0; border-radius:0; background:transparent; color:var(--rv-ink-2); font-size:14px; }
.review-issue.active { background:var(--rv-accent-soft); color:var(--rv-ink); }
.review-issue.active::before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background:var(--rv-accent); }
.review-issue > b { font-weight:400; color:var(--rv-ink-3); }
.review-issue-dot { width:6px; height:6px; border-radius:50%; align-self:center; background:var(--rv-accent); }
.review-issue-dot.accepted,.review-issue-dot.fixed { background:var(--rv-before); }
.review-resolved { margin:16px 24px 0; padding-top:12px; border-top:1px solid var(--rv-line); font-size:13px; color:var(--rv-ink-3); }
.review-main { display:flex; flex-direction:column; min-width:0; min-height:0; padding:32px 48px 0; }
.review-issue-header,.review-tabs,.review-tab-content,.rc-footer > div { width:100%; max-width:880px; }
.review-issue-header { display:flex; align-items:start; justify-content:space-between; gap:24px; }
.review-issue-header h1 { margin:0; font-size:24px; font-weight:600; letter-spacing:0; overflow-wrap:anywhere; }
.review-issue-header p { margin:4px 0 0; color:var(--rv-ink-3); font-size:14px; }
.review-issue-header > div { min-width:0; }
.review-issue-header > .text-button { white-space:nowrap; }
.review-tabs { display:flex; gap:24px; border-bottom:1px solid var(--rv-line); margin:24px 0 32px; flex-shrink:0; }
.review-tabs > button { min-height:40px; padding:0 0 12px; border:0; border-bottom:2px solid transparent; border-radius:0; background:transparent; color:var(--rv-ink-3); font-size:14px; font-weight:600; }
.review-tabs > button[aria-selected=true] { color:var(--rv-ink); border-bottom-color:var(--rv-accent); }
.review-tab-content { flex:1; min-height:0; overflow:auto; padding-bottom:24px; scrollbar-color:var(--rv-before) transparent; }
.review-page p { margin:0; }
.review-page button { box-shadow:none; font-family:var(--font-ui); cursor:pointer; }
.review-page input:not([type=checkbox]):not([type=radio]):not([type=range]),.review-page select,.review-page textarea { font:inherit; font-size:14px; padding:4px 8px; color:var(--rv-ink); border:1px solid var(--rv-line); border-radius:6px; background:var(--rv-surface); max-width:100%; min-width:0; }
.review-page input[type=radio],.review-page input[type=checkbox] { accent-color:var(--rv-accent); width:16px; height:16px; margin:0; }
.review-page input[type=range] { accent-color:var(--rv-accent); }
.review-page code { font:13px ui-monospace,monospace; overflow-wrap:anywhere; }
.review-page .text-button { display:inline-block; border:0; background:transparent; padding:0; color:var(--rv-accent); font:inherit; font-size:14px; text-align:left; }
.review-page button:focus-visible,.review-page input:focus-visible,.review-page select:focus-visible,.review-page summary:focus-visible,.rc-table-scroll:focus-visible { outline:2px solid var(--rv-accent); outline-offset:4px; }
.rc-lead { margin-bottom:24px; }
.rc-lead > p { font-size:18px; font-weight:600; }
.rc-lead > div { margin-top:4px; color:var(--rv-ink-2); font-size:15px; }
.rc-section { margin-bottom:32px; }
.rc-section > h2 { margin:0 0 12px; font-size:15px; font-weight:600; }
.rc-card { border:1px solid var(--rv-line); border-radius:8px; background:var(--rv-surface); overflow:hidden; }
.rc-indent { padding-inline-start:44px; }
.rc-num { text-align:right !important; font-variant-numeric:tabular-nums; }
.rc-select-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:16px; align-items:start; }
.rc-select-layout:not(:has(.rc-ai)) { grid-template-columns:minmax(0,1fr); }
.rc-choice-row { display:grid; grid-template-columns:28px minmax(0,1fr) 64px 56px minmax(110px,140px); align-items:center; min-width:0; gap:0; width:100%; padding:10px 16px; border:0; border-top:1px solid var(--rv-line-2); background:transparent; text-align:left; color:var(--rv-ink); font-size:14px; }
.rc-selection > :first-child,.rc-choice-group:first-child > .rc-choice-row { border-top:0; }
.rc-choice-group { border-top:1px solid var(--rv-line-2); }
.rc-choice-group summary { list-style:none; cursor:pointer; }
.rc-choice-value { min-width:0; }
.rc-choice-value > code { white-space:pre-wrap; }
.rc-choice-meta,.rc-share { color:var(--rv-ink-3); font-size:13px; text-align:right; }
.rc-choice-value input { width:100%; }
.rc-choice-control { display:flex; align-items:center; }
.rc-check { display:grid; place-items:center; width:16px; height:16px; border:1px solid var(--rv-before); border-radius:4px; color:transparent; }
[aria-pressed=true] .rc-check { color:var(--rv-surface); background:var(--rv-accent); border-color:var(--rv-accent); }
.rc-check svg { width:12px; height:12px; }
.rc-total { font-size:13px; color:var(--rv-ink-3); margin-top:8px !important; }
.rc-ai { min-width:0; padding:16px; border:1px solid var(--rv-line); border-radius:8px; background:var(--rv-surface); font-size:14px; color:var(--rv-ink-2); }
.rc-ai > p { margin-bottom:8px; }
.rc-ai .review-ai-status { font-size:13px; }
.rc-ai:empty { display:none; }
.rc-toolbar { display:flex; align-items:center; flex-wrap:wrap; gap:12px; margin-bottom:12px; font-size:14px; color:var(--rv-ink-2); }
.rc-toolbar > label { display:flex; align-items:center; gap:8px; }
/* LAY-22…26: keep rule drafts visually separate from the applied evidence below. */
.rc-rule-editor { padding-bottom:16px; border-bottom:1px solid var(--rv-line); }
.rc-rule-fields,.rc-rule-parameters { display:flex; flex-wrap:wrap; align-items:end; gap:12px 20px; min-width:0; }
.rc-rule-fields label { display:grid; gap:6px; font-size:14px; color:var(--rv-ink-2); }
.rc-rule-fields input[type=number] { width:100px; min-height:40px; }
.rc-rule-fields select { min-height:40px; }
.rc-rule-slider { flex:1; min-width:160px; }
.rc-rule-slider input { width:100%; min-height:40px; margin:0; }
.rc-rule-actions { display:flex; flex-wrap:wrap; align-items:center; gap:12px 20px; margin-top:16px; }
.rc-rule-actions > p { flex-basis:100%; max-width:70ch; color:var(--rv-ink-2); font-size:14px; }
.rc-rule-actions .rc-secondary-button { border:1px solid var(--rv-accent); border-radius:6px; background:var(--rv-surface); color:var(--rv-accent); padding:8px 14px; min-height:44px; font-size:14px; font-weight:600; }
.rc-rule-actions .rc-secondary-button:hover { background:var(--rv-accent-soft); }
.rc-rule-actions .text-button { min-height:44px; }
.rc-rule-actions [hidden] { display:none; }
.rc-chip { display:inline-flex; align-items:center; flex-wrap:wrap; gap:8px; padding:4px 12px; border:1px solid var(--rv-line); border-radius:24px; background:var(--rv-surface); }
.rc-headline { padding:10px 16px; background:var(--rv-neutral); border-radius:8px; font-size:14px; margin-bottom:12px !important; }
.rc-table-scroll { overflow:auto; max-height:320px; }
.rc-table-scroll table { border-collapse:collapse; width:100%; font-size:14px; }
.rc-table-scroll th { position:sticky; top:0; background:var(--rv-bg); color:var(--rv-ink-3); text-align:left; font-size:12px; font-weight:600; padding:8px 16px; white-space:nowrap; border-bottom:1px solid var(--rv-line); z-index:1; }
.rc-table-scroll td { padding:8px 16px; border-bottom:1px solid var(--rv-line-2); white-space:nowrap; }
/* CORE-58 / CORE-63: bound generated review lists; expanded content scrolls in its own region. */
body.ui-pages-active .vals > div > .card { max-height:min(45vh,360px); overflow-y:auto; overscroll-behavior:contain; }
body.ui-pages-active .scroll-x:has(> table) { max-height:min(45vh,360px); overflow:auto; overscroll-behavior:contain; }
body.ui-pages-active .scroll-x:has(> table) th { position:sticky; top:0; z-index:1; background:var(--rv-bg); }
body.ui-pages-active .scroll-x[data-ui="review.table"]:has(> .grp) { max-height:min(55vh,480px); overflow:auto; overscroll-behavior:contain; }
body.ui-pages-active [data-ui="review.explore.missing.sheet"]:not(.scroll-x):not(.group-browser) { max-height:min(55vh,480px); overflow-y:auto; overscroll-behavior:contain; scrollbar-color:var(--rv-before) transparent; }
body.ui-pages-active [data-ui="review.explore.missing.sheet"]:not(.scroll-x):not(.group-browser) .scroll-x:has(> table),body.ui-pages-active [data-ui="review.table"]:not(.group-browser) .scroll-x:has(> table) { max-height:none; }
#reviewAiRequest > label,#reviewAiRuleRequest > label { display:block; margin-bottom:12px; }
#reviewAiRuleRequest .btn2 { min-height:40px; margin:4px 4px 0 0; }
.rc-problem { color:var(--rv-gap); background:var(--rv-gap-soft); }
.rc-removed { text-decoration:line-through; }
.rc-evidence-group { border-top:1px solid var(--rv-line-2); }
.rc-group-table.rc-card { max-height:340px; overflow:auto; }
.rc-evidence-group:first-child { border:0; }
.rc-evidence-group > summary { display:grid; grid-template-columns:minmax(0,1fr) 90px 160px; padding:10px 16px; gap:12px; font-size:14px; cursor:pointer; }
.rc-rate { display:flex; justify-content:end; align-items:center; gap:8px; font-size:13px; }
.rc-rate > i { position:relative; display:block; width:80px; height:6px; background:var(--rv-line-2); border-radius:4px; }
.rc-rate b { position:absolute; inset:0 auto 0 0; background:var(--rv-gap); border-radius:4px; }
.rc-rate em { position:absolute; top:-4px; width:1px; height:14px; background:var(--rv-ink-3); }
.rc-more { display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; padding:12px 16px; color:var(--rv-ink-3); font-size:14px; }
.rc-option { position:relative; display:grid; grid-template-columns:28px minmax(0,1fr) auto; column-gap:16px; padding:16px; border-top:1px solid var(--rv-line-2); }
.rc-option:first-child { border:0; }
.rc-option.selected { background:var(--rv-accent-soft); }
.rc-option.selected::before { content:""; position:absolute; inset:0 auto 0 0; width:3px; background:var(--rv-accent); }
.rc-option > input { margin-top:4px !important; }
.rc-option > label { font-size:15px; font-weight:600; cursor:pointer; }
.rc-inline-edit { display:inline-flex; margin-inline-start:4px; }
.review-page .rc-inline-edit input { width:110px; padding:2px 8px; font-weight:600; }
.rc-option-description,.rc-option-parameters { grid-column:2/-1; font-size:14px; color:var(--rv-ink-2); margin-top:4px !important; }
.rc-option-description .text-button { display:block; margin-top:4px; }
.rc-option-parameters { display:flex; gap:8px 16px; flex-wrap:wrap; align-items:center; margin-top:12px !important; }
.rc-option-parameters > label { display:inline-flex; gap:8px; align-items:center; }
.rc-option-parameters input[type=number],.rc-option-parameters input[type=text] { width:120px; }
.rc-options > .rc-more { border-top:1px solid var(--rv-line-2); padding-inline-start:60px; }
.rc-ai-fix { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px 16px; padding:16px; border-top:1px solid var(--rv-line); color:var(--rv-ink-2); font-size:14px; }
.rc-ai-fix > label,.rc-ai-fix > .review-ai-status { grid-column:1/-1; }
.rc-ai-fix > input { width:100%; min-height:44px; }
.rc-ai-fix > .text-button { min-height:44px; }
.rc-risk { align-self:start; white-space:nowrap; border-radius:24px; padding:2px 8px; font-size:12px; font-weight:600; }
.rc-risk.neutral,.rc-risk.structure { color:var(--rv-ink-2); background:var(--rv-neutral); }
.rc-risk.safe { color:var(--rv-ok); background:var(--rv-ok-soft); }
.rc-risk.estimate { color:var(--rv-warn); background:var(--rv-warn-soft); }
.rc-risk.remove { color:var(--rv-bad); background:var(--rv-bad-soft); }
.rc-change { padding:16px; }
.rc-metrics { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:24px; margin-bottom:16px; }
.rc-metrics > div > span { display:block; color:var(--rv-ink-3); font-size:12px; }
.rc-metrics > div > b { display:block; font-size:18px; font-weight:600; }
.rc-label-change { display:grid; grid-template-columns:150px minmax(0,1fr) 120px; align-items:center; gap:12px; padding:8px 0; font-size:14px; }
.rc-label-change > span:nth-child(2) { display:grid; gap:4px; }
.rc-label-change i { height:8px; display:block; border-radius:2px; }
.rc-before-bar,.rc-legend .before { background:var(--rv-before); }
.rc-after-bar,.rc-legend .after { background:var(--rv-accent); }
.rc-legend { display:flex; gap:16px; font-size:12px; color:var(--rv-ink-3); margin-bottom:8px; }
.rc-legend i { display:inline-block; width:10px; height:8px; margin-inline-end:4px; }
.rc-footer { flex-shrink:0; width:calc(100% + 96px); margin-inline:-48px; padding:16px 48px; background:var(--rv-bg); border-top:1px solid var(--rv-line); }
.rc-footer > div { display:flex; gap:24px; align-items:center; }
.rc-footer > div > span { flex:1; display:flex; flex-wrap:wrap; gap:8px 16px; font-size:14px; color:var(--rv-ink-2); }
.rc-footer .primary { color:var(--rv-surface); background:var(--rv-accent); border:0; border-radius:8px; padding:10px 16px; font-size:15px; font-weight:600; min-height:44px; }
.review-chart { margin:0; }
.review-chart figcaption { font-size:14px; font-weight:600; margin-bottom:8px; }
.review-chart svg,.outlier-scatter,.cross-scatter { display:block; max-width:100%; width:100%; height:auto; }
.review-chart svg text,.outlier-scatter text,.cross-scatter text { font:12px var(--font-ui); fill:var(--rv-ink-2); }
.review-chart-legend { display:flex; flex-wrap:wrap; gap:12px; color:var(--rv-ink-3); font-size:12px; margin-bottom:8px; }
.review-chart-legend .before::before,.review-chart-legend .after::before,.review-chart-legend .filled::before { content:""; display:inline-block; width:8px; height:8px; margin-inline-end:4px; background:var(--rv-before); }
.review-chart-legend .after::before,.review-chart-legend .filled::before { background:var(--rv-accent); }
.review-chart-legend .after::before { opacity:.4; }
.review-chart-legend .filled::before { opacity:1; }
.review-chart-edges { color:var(--rv-ink-3); font-size:12px; }
/* CHART-01: impact first; populations, medians and clipped tails stay in one disclosure. */
.review-chart-impact > figcaption { font-size:18px; line-height:1.45; margin-bottom:16px; max-width:65ch; color:var(--ink); }
.review-chart-impact > .review-chart-legend { gap:12px 20px; margin-bottom:4px; font-size:13px; }
.review-chart-impact { position:relative; }
.review-chart-impact .review-chart-legend .before::before { background:#B6CBF2; }
.review-chart-impact.histogram-problem .review-chart-legend .before::before { background:var(--rv-gap); }
.review-chart-impact .review-chart-legend .after::before { background:#2E6BD9; opacity:1; }
.review-chart-impact [data-bin-index] { cursor:help; }
.review-chart-impact [data-bin-index]:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }
.review-bar-tooltip { position:absolute; z-index:4; pointer-events:none; display:grid; gap:4px; max-width:calc(100% - 16px); padding:10px 12px; border:1px solid var(--line); border-radius:var(--radius); background:var(--panel); color:var(--ink); font-size:13px; box-shadow:0 4px 12px #142c4d26; }
.review-bar-tooltip[hidden] { display:none; }
.review-bar-tooltip small { color:var(--muted); font-size:12px; font-variant-numeric:tabular-nums; }
.review-chart-impact > svg { margin-bottom:16px; }
.review-chart-details { border-top:1px solid var(--line); padding-top:12px; }
.review-chart-details > summary { color:var(--muted); font-size:13px; min-height:32px; }
.review-chart-details > p { margin:8px 0 12px; font-size:13px; line-height:1.6; max-width:70ch; color:var(--muted); }
.review-chart-details > table { width:100%; table-layout:fixed; font-size:13px; }
.review-chart-details th,.review-chart-details td { padding:8px; white-space:normal; overflow-wrap:anywhere; }
.review-chart-details th:first-child { width:50%; }
.review-chart-details tbody th { background:transparent; font-weight:400; }
.review-chart-details th:not(:first-child),.review-chart-details td { text-align:right; font-variant-numeric:tabular-nums; }
.review-category-bars { display:grid; gap:12px; }
.review-category-bars > div { display:grid; grid-template-columns:150px minmax(0,1fr) 120px; gap:12px; font-size:14px; }
.review-category-bars > div > div { display:grid; gap:4px; }
.review-category-bars i { height:8px; background:var(--rv-before); display:block; }
.review-category-bars i.after { background:var(--rv-accent); }
.review-category-bars b { text-align:right; font-weight:400; }
.review-row-panel { margin:0 0 0 auto; width:min(760px,96vw); height:100dvh; max-height:100dvh; max-width:none; padding:32px; border:0; border-inline-start:1px solid #E4E7EC; border-radius:0; box-shadow:none; font:15px var(--font-ui); }
.review-row-panel::backdrop { background:#16202B20; }
.review-row-panel header { display:flex; align-items:center; justify-content:space-between; gap:24px; margin-bottom:24px; }
.review-row-panel .text-button { color:#2E6BD9; border:0; background:transparent; }
.review-row-panel table { width:100%; font-size:14px; }
.review-row-panel td,.review-row-panel th { padding:8px 12px; text-align:left; }
.review-row-panel select,.review-row-panel input,.review-row-panel textarea { max-width:100%; font:inherit; }
.review-row-panel label { display:grid; gap:8px; margin-bottom:16px; }
.review-spinner { display:inline-block; width:12px; height:12px; border:2px solid var(--rv-line); border-top-color:var(--rv-accent); border-radius:50%; margin-right:8px; animation:review-spin .8s linear infinite; }
@keyframes review-spin { to { transform:rotate(360deg); } }
@media (prefers-reduced-motion:reduce) { .review-spinner { animation:none; } }
.debug-ui .review-page [data-ui] { outline:1px dashed var(--rv-before); outline-offset:-1px; }
.debug-ui .review-page [data-ui]::after { content:attr(data-ui); position:absolute; top:0; right:0; color:var(--rv-ink-3); background:var(--rv-surface); font:10px ui-monospace,monospace; pointer-events:none; z-index:8; }
@media (max-width:1100px) {
  .review-main { padding:32px 32px 0; }
  .rc-footer { width:calc(100% + 64px); margin-inline:-32px; padding-inline:32px; }
  .rc-select-layout { grid-template-columns:minmax(0,1fr); }
  .rc-ai { border:0; padding:0; background:transparent; }
}
@media (max-width:900px) {
  .review-page { grid-template-columns:minmax(0,1fr); height:auto; min-height:0; }
  .review-issues { padding:12px 24px; border:0; border-bottom:1px solid var(--rv-line); }
  .review-issues-heading { display:none; }
  .review-queue-disclosure { height:auto; flex:none; overflow:visible; }
  .review-queue-disclosure > summary { display:list-item; font-size:14px; }
  .review-queue-disclosure > summary > span { float:right; }
  .review-queue-content { position:static; }
  .review-issue-list { max-height:200px; }
  .review-main { min-height:650px; }
  .review-tab-content { overflow:visible; }
}
@media (max-width:800px) {
  .app-shell:has(.review-page) { grid-template-columns:minmax(0,1fr); }
  .app-shell:has(.review-page) .sidebar { padding:12px 16px; }
  .app-shell:has(.review-page) .sidebar nav { margin-top:8px; }
}
@media (max-width:620px) {
  .review-main { padding:24px 16px 0; }
  .review-tabs { gap:16px; margin-bottom:24px; }
  .review-tabs > button { min-height:44px; min-width:64px; }
  .rc-footer { width:calc(100% + 32px); margin-inline:-16px; padding:16px; }
  .rc-footer > div { flex-wrap:wrap; gap:12px; }
  .rc-footer .primary { width:100%; }
  .rc-footer .text-button { min-height:44px; display:inline-flex; align-items:center; }
  .rc-choice-row { grid-template-columns:28px minmax(0,1fr) 48px 48px; }
  .rc-choice-meta { grid-column:2/-1; margin-top:4px; text-align:left; }
  .rc-option { column-gap:16px; }
  .rc-risk { grid-column:2/-1; justify-self:start; margin-top:8px; }
  .rc-option-description,.rc-option-parameters { grid-column:2/-1; }
  .rc-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
  .rc-evidence-group > summary { grid-template-columns:minmax(0,1fr) 80px; }
  .rc-rate { grid-column:1/-1; justify-content:start; }
  .rc-label-change,.review-category-bars > div { grid-template-columns:90px minmax(0,1fr) 80px; }
  .rc-options > .rc-more { padding-inline-start:16px; }
  .rc-indent { padding-inline-start:16px; }
  #reviewAiRuleRequest .btn2 { min-height:44px; }
}

/* LAY-27…31: keep the reference shell usable on narrow screens without changing shared.css. */
body.ui-pages-active .shell { grid-template-rows:minmax(0,1fr); height:100%; min-height:0; }
body.ui-pages-active .body { height:100%; min-height:0; overflow:hidden; }
body.ui-pages-active .issues { min-height:0; }
body.ui-pages-active .main { min-height:0; overflow-y:auto; overscroll-behavior:contain; }
/* Reference templates share the application's control and evidence palette. */
body.ui-pages-active { --bg:var(--paper); --surface:var(--panel); --ink-2:var(--muted); --ink-3:var(--muted); --accent:var(--blue); --accent-soft:var(--blue-soft); --nav:var(--rail); --rv-accent:var(--blue); }
body.ui-pages-active .btn, body.ui-pages-active .btn2 { min-height:40px; border-radius:var(--radius); font-size:14px; }
body.ui-pages-active .btn:hover:not(:disabled) { background:#1b49a4; }
body.ui-pages-active .btn2:hover:not(:disabled) { background:var(--blue-soft); border-color:var(--blue); }
body.ui-pages-active .link, body.ui-pages-active .text-button { line-height:1.5; text-underline-offset:3px; }
body.ui-pages-active .link:hover:not(:disabled), body.ui-pages-active .text-button:hover:not(:disabled) { text-decoration:underline; }
body.ui-pages-active .opt .title { min-width:0; overflow-wrap:anywhere; }
body.ui-pages-active .question, body.ui-pages-active .toolbar, body.ui-pages-active .moreopts { display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; }
body.ui-pages-active .moreopts .link { margin:0; }
body.ui-pages-active .main input:not([type=checkbox]):not([type=radio]):not([type=range]), body.ui-pages-active .main select, body.ui-pages-active .main textarea { border:1px solid var(--line); border-radius:var(--radius); background:var(--panel); color:var(--ink); max-width:100%; min-width:0; padding:6px 8px; font:14px var(--font-ui); }
body.ui-pages-active .inline-edit { max-width:100%; }
body.ui-pages-active .inline-edit input { min-height:28px; border:0; padding:2px 0; }
body.ui-pages-active .foot { position:static; flex-shrink:0; background:var(--paper); backdrop-filter:none; }
body.ui-pages-active .content { padding-bottom:32px; min-width:0; }
body.ui-pages-active .main > .content { overflow-y:auto; min-height:0; }
/* LAY-27…31: size evidence by its task column, not the full viewport. */
body.ui-pages-active .main { container-type:inline-size; min-width:0; }
body.ui-pages-active .top .file { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
body.ui-pages-active .head { gap:12px 24px; }
body.ui-pages-active .head > div { min-width:0; }
body.ui-pages-active .head h1 { overflow-wrap:anywhere; }
body.ui-pages-active .head > .link { flex-shrink:0; }
body.ui-pages-active .btn, body.ui-pages-active .btn2 { display:inline-flex; align-items:center; justify-content:center; gap:8px; text-align:center; }
@container (max-width:900px) {
  body.ui-pages-active .vals { grid-template-columns:minmax(0,1fr); }
  body.ui-pages-active .vals > * { min-width:0; }
  body.ui-pages-active .vrow, body.ui-pages-active .vrow.v-out, body.ui-pages-active .vrow.v-rule { grid-template-columns:22px minmax(0,1fr) auto auto; gap:6px 8px; }
  body.ui-pages-active .vrow .mono { overflow-wrap:anywhere; white-space:normal; }
  body.ui-pages-active .vrow .m { grid-column:2/-1; text-align:left; white-space:normal; }
  body.ui-pages-active .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  body.ui-pages-active .metrics .v { white-space:normal; overflow-wrap:anywhere; }
  body.ui-pages-active .ghead { grid-template-columns:20px minmax(0,1fr) auto; gap:4px 8px; }
  body.ui-pages-active .ghead .rate { grid-column:2/-1; justify-content:flex-start; }
}
@container (max-width:520px) {
  body.ui-pages-active .content { padding-inline:24px; }
  body.ui-pages-active .foot { padding-inline:24px; }
  body.ui-pages-active .foot .in { flex-wrap:wrap; gap:12px; }
  body.ui-pages-active .foot .sum { flex-basis:100%; }
  body.ui-pages-active .foot .btn { width:100%; white-space:normal; }
  body.ui-pages-active .opt { grid-template-columns:24px minmax(0,1fr); gap:4px 10px; }
  body.ui-pages-active .opt .badge, body.ui-pages-active .opt .desc, body.ui-pages-active .opt .extra { grid-column:2; white-space:normal; }
  body.ui-pages-active .crow { grid-template-columns:minmax(0,1fr); }
}
body.ui-pages-active .review-chart-legend { color:var(--muted); }
/* GROUP-01…05: one shared category/range/quantile browser, matching the surrounding task tabs. */
body.ui-pages-active .group-browser { min-width:0; max-width:100%; overflow:hidden; }
body.ui-pages-active .group-tabs { display:flex; flex-wrap:nowrap; gap:0; overflow-x:auto; overscroll-behavior-x:contain; scrollbar-color:var(--rv-before) var(--paper); border-bottom:1px solid var(--line); background:var(--panel); }
body.ui-pages-active .group-tabs > button { flex:0 0 auto; display:inline-flex; align-items:center; gap:8px; min-height:44px; padding:10px 16px; border:0; border-bottom:2px solid transparent; border-radius:0; background:transparent; color:var(--muted); font-size:14px; text-align:left; white-space:nowrap; }
body.ui-pages-active .group-tabs > button > span { max-width:28ch; overflow:hidden; text-overflow:ellipsis; }
body.ui-pages-active .group-tabs > button small { font-size:12px; font-variant-numeric:tabular-nums; }
body.ui-pages-active .group-tabs > button[aria-selected=true] { border-bottom-color:var(--blue); background:var(--blue-soft); color:var(--ink); font-weight:600; }
body.ui-pages-active .group-tabs > button:hover { color:var(--blue); background:var(--blue-soft); }
body.ui-pages-active .group-browser > [role=tabpanel] { min-width:0; }
body.ui-pages-active .group-summary { display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; padding:12px 16px; border-bottom:1px solid var(--line); font-size:13px; overflow-wrap:anywhere; }
body.ui-pages-active .group-summary > span { color:var(--muted); }
body.ui-pages-active .group-summary .check { display:inline-flex; align-items:center; gap:8px; }
body.ui-pages-active .group-browser > [role=tabpanel] > .scroll-x { height:min(50dvh,420px); max-height:min(50dvh,420px); overflow:auto; overscroll-behavior:contain; scrollbar-color:var(--rv-before) var(--paper); }
body.ui-pages-active .group-progress { padding:8px 16px; border-top:1px solid var(--line); font-size:12px; color:var(--muted); }
body.ui-pages-active .group-browser .group-browser { border:0; border-radius:0; }
body.ui-pages-active .mono { font-family:ui-monospace,monospace; }
body.ui-pages-active button:focus-visible, body.ui-pages-active a:focus-visible, body.ui-pages-active [tabindex="0"]:focus-visible { outline:3px solid #83a9f1; outline-offset:2px; }
@media (max-width:800px) {
  body.ui-pages-active { height:auto; min-height:100dvh; overflow-x:hidden; overflow-y:auto; overscroll-behavior-y:contain; -webkit-overflow-scrolling:touch; }
  #screen.reference-screen { min-height:0; overflow:visible; }
  body.ui-pages-active .app { grid-template-columns:minmax(0,1fr); grid-template-rows:auto; height:auto; min-height:0; }
  body.ui-pages-active .nav { display:flex; align-items:center; gap:4px; min-width:0; overflow-x:auto; padding:8px 12px; }
  body.ui-pages-active .nav .brand { flex:0 0 auto; padding:0 8px 0 0; font-size:18px; white-space:nowrap; }
  body.ui-pages-active .nav a { flex:0 0 auto; min-height:40px; margin:0; padding:8px 10px; white-space:nowrap; }
  body.ui-pages-active .shell { grid-template-rows:auto; width:100%; min-width:0; height:auto; min-height:0; overflow:visible; }
  body.ui-pages-active .top { min-width:0; min-height:56px; height:auto; flex-wrap:wrap; gap:8px 12px; padding:8px 16px; }
  body.ui-pages-active .top .file { flex:1 1 100%; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  body.ui-pages-active .body { grid-template-columns:minmax(0,1fr); width:100%; height:auto; min-width:0; min-height:0; overflow:visible; }
  body.ui-pages-active .issues { min-width:0; max-height:190px; padding:8px 0; overflow-x:hidden; overflow-y:auto; overscroll-behavior:contain; touch-action:pan-y; -webkit-overflow-scrolling:touch; border-right:0; border-bottom:1px solid var(--line); }
  body.ui-pages-active .issues .hd { position:sticky; top:-8px; z-index:2; margin:0 16px 6px; padding:4px 0; background:var(--surface); }
  body.ui-pages-active .issues .col { max-width:calc(100vw - 24px); padding:8px 16px 2px; overflow-wrap:anywhere; white-space:normal; }
  body.ui-pages-active .issues .item { min-height:36px; padding:6px 16px 6px 28px; }
  body.ui-pages-active .main { min-width:0; min-height:620px; overflow:visible; }
  body.ui-pages-active .main > .content { overflow:visible; }
  body.ui-pages-active .content { min-width:0; padding:24px 16px calc(var(--foot-h) + 24px); }
  body.ui-pages-active .wrap { min-width:0; }
  body.ui-pages-active .foot { padding:12px 16px; }
  body.ui-pages-active .foot .in { flex-wrap:wrap; gap:8px 12px; }
  body.ui-pages-active .foot .sum { flex:1 1 100%; }
  body.ui-pages-active .foot .btn { width:100%; min-height:44px; text-align:center; }
  body.ui-pages-active .content { padding-bottom:24px; }
  body.ui-pages-active .btn2, body.ui-pages-active .moreopts .link, body.ui-pages-active .foot .link { min-height:44px; display:inline-flex; align-items:center; }
}
@media (max-width:620px) {
  body.ui-pages-active .head { flex-wrap:wrap; gap:8px 16px; }
  body.ui-pages-active .head h1 { font-size:20px; overflow-wrap:anywhere; }
  body.ui-pages-active .tabs { gap:20px; margin:20px 0 24px; }
  body.ui-pages-active .tab { display:inline-flex; align-items:center; min-height:44px; }
  body.ui-pages-active .lead { font-size:16px; }
  body.ui-pages-active .vals { grid-template-columns:minmax(0,1fr); min-width:0; }
  body.ui-pages-active .vals > div,.ui-pages-active .vals > aside { min-width:0; max-width:100%; }
  body.ui-pages-active .vrow,body.ui-pages-active .vrow.v-out,body.ui-pages-active .vrow.v-rule { grid-template-columns:22px minmax(0,1fr) auto auto; gap:6px 8px; min-width:0; padding:10px 12px; }
  body.ui-pages-active .vrow .mono { min-width:0; overflow-wrap:anywhere; white-space:normal; }
  body.ui-pages-active .vrow .r { text-align:right; }
  body.ui-pages-active .vrow .m { grid-column:2/-1; text-align:left; overflow-wrap:anywhere; white-space:normal; }
  body.ui-pages-active .metrics { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
  body.ui-pages-active .metrics .v { font-size:15px; white-space:normal; overflow-wrap:anywhere; }
  body.ui-pages-active .opt { grid-template-columns:24px minmax(0,1fr); gap:4px 10px; padding:14px 12px; }
  body.ui-pages-active .opt .title { min-width:0; overflow-wrap:anywhere; }
  body.ui-pages-active .opt .badge,.ui-pages-active .opt .desc,.ui-pages-active .opt .extra { grid-column:2; }
  body.ui-pages-active .opt .badge { justify-self:start; white-space:normal; }
  body.ui-pages-active .moreopts { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:12px 16px; }
  body.ui-pages-active .moreopts .link { margin-left:0; }
  body.ui-pages-active .ghead { grid-template-columns:20px minmax(0,1fr) auto; gap:4px 8px; padding:10px 12px; }
  body.ui-pages-active .ghead .n { text-align:left; }
  body.ui-pages-active .ghead .rate { grid-column:2/-1; justify-content:flex-start; }
  body.ui-pages-active .crow { grid-template-columns:minmax(0,1fr); gap:6px; }
  body.ui-pages-active .pairs { grid-template-columns:auto auto minmax(0,1fr); gap:6px 8px; overflow-wrap:anywhere; }
  body.ui-pages-active .change { padding:12px; }
  body.ui-pages-active .legend { flex-wrap:wrap; }
  body.ui-pages-active .foot .link { min-height:44px; display:inline-flex; align-items:center; }
}

/* DISTILL-03: evidence → treatment effect → action. No repeated stage introductions. */
body.ui-pages-active .head h1 { font-size:24px; line-height:1.3; }
body.ui-pages-active .head .sub { margin-top:6px; font-size:13px; }
body.ui-pages-active .head .state { background:var(--status-bg); color:var(--muted); border-radius:4px; }
body.ui-pages-active .tabs { margin:20px 0 24px; }
body.ui-pages-active .main [data-review-section] { margin:0 0 24px; }
body.ui-pages-active .main [data-review-section] > h2 { margin:0 0 12px; color:var(--ink); font-size:16px; line-height:1.4; font-weight:600; }
body.ui-pages-active .lead { font-size:21px; line-height:1.4; margin:0 0 20px; max-width:65ch; }
body.ui-pages-active .review-context { margin:0 0 18px; color:var(--muted); font-size:13px; max-width:70ch; }
body.ui-pages-active .headline { padding:0; margin:0 0 12px; background:none; border-radius:0; color:var(--muted); font-size:14px; }
body.ui-pages-active .vals { grid-template-columns:minmax(0,1fr); gap:12px; }
body.ui-pages-active .review-assistance { padding:0; color:var(--muted); font-size:13px; max-width:70ch; }
body.ui-pages-active .review-assistance p { margin:0 0 8px; }
body.ui-pages-active .review-assistance .link { font-size:13px; margin-inline-end:16px; }
body.ui-pages-active .selection-value { min-width:0; overflow-wrap:anywhere; }
body.ui-pages-active button.vrow { width:100%; border:0; border-top:1px solid var(--line-2); border-radius:0; background:var(--surface); color:inherit; text-align:left; }
body.ui-pages-active button.vrow:first-child { border-top:0; }
body.ui-pages-active button.vrow:focus-visible { outline:3px solid var(--blue); outline-offset:-3px; }
body.ui-pages-active .vrow:not(button) { cursor:default; }
body.ui-pages-active .selection-context { display:block; margin-top:4px; color:var(--muted); font:13px/1.5 var(--font-ui); }
body.ui-pages-active .selection-value > .mono { overflow-wrap:anywhere; white-space:normal; }
body.ui-pages-active .review-scope-line { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:8px 20px; margin:0 0 24px; color:var(--muted); font-size:14px; }
body.ui-pages-active .review-scope-line b { color:var(--ink); font-weight:600; }
body.ui-pages-active .review-scope-line .link { font-size:13px; }
body.ui-pages-active .treatment-list { border-block:1px solid var(--line); }
body.ui-pages-active .opt { grid-template-columns:20px minmax(0,1fr) auto; align-items:start; gap:6px 12px; padding:14px 16px; }
body.ui-pages-active .opt.on { background:var(--blue-soft); box-shadow:none; }
body.ui-pages-active .opt .title { font-size:15px; line-height:1.5; }
body.ui-pages-active .opt .inline-edit { border:0; padding:0; margin-left:6px; }
body.ui-pages-active .treatment-radio { width:16px; height:16px; margin:3px 0 0; padding:0; accent-color:var(--blue); }
body.ui-pages-active .opt .badge { align-self:center; font-size:12px; font-weight:400; border-radius:4px; }
body.ui-pages-active .opt:not(.on) .badge { background:none; padding:0; color:var(--muted); }
body.ui-pages-active .opt .desc { grid-column:2/-1; margin:0; font-size:14px; max-width:70ch; }
body.ui-pages-active .opt .extra { margin-top:6px; }
body.ui-pages-active .treatment-caveat { grid-column:2/-1; margin:0; font-size:13px; color:var(--muted); }
body.ui-pages-active .review-treatment-details { grid-column:2/-1; margin:2px 0 0; font-size:13px; color:var(--muted); }
body.ui-pages-active .review-treatment-details summary { font-size:13px; font-weight:400; }
body.ui-pages-active .review-treatment-details p { margin:10px 0; max-width:70ch; }
body.ui-pages-active .review-treatment-details dl { margin:12px 0; }
body.ui-pages-active .review-treatment-details dl > div { display:flex; justify-content:space-between; gap:16px; max-width:520px; padding-block:4px; }
body.ui-pages-active .review-treatment-details dd { margin:0; color:var(--ink); font-variant-numeric:tabular-nums; }
body.ui-pages-active .review-more-methods { margin:0; border-bottom:1px solid var(--line); }
body.ui-pages-active .review-more-methods summary { padding:12px 0; font-weight:400; color:var(--muted); }
body.ui-pages-active .review-more-methods summary span { margin-inline-start:4px; }
body.ui-pages-active .review-more-methods > div { display:flex; flex-wrap:wrap; gap:8px; padding:0 0 14px; max-height:220px; overflow:auto; }
body.ui-pages-active .review-tools { display:flex; justify-content:space-between; flex-wrap:wrap; gap:12px 24px; padding-top:14px; }
body.ui-pages-active .review-settings, body.ui-pages-active .review-ai-tools { display:flex; align-items:center; flex-wrap:wrap; gap:8px 16px; }
body.ui-pages-active .review-tools .link { font-size:13px; }
body.ui-pages-active .review-ai-tools .meta { font-size:12px; }
body.ui-pages-active .review-ai-request, body.ui-pages-active #reviewAiRuleRequest { background:none; border:0; border-top:1px solid var(--line); border-radius:0; padding:18px 0 0; margin-top:18px; }
body.ui-pages-active .change { border:0; border-radius:0; padding:0; background:none; }
body.ui-pages-active .change .metrics { padding-bottom:16px; border-bottom:1px solid var(--line); margin-bottom:20px; gap:16px 24px; }
body.ui-pages-active .change .metrics .l { margin-bottom:4px; }
body.ui-pages-active .change .metrics .v { font-size:21px; line-height:1.3; }
body.ui-pages-active .review-decision-meta { display:flex; flex-wrap:wrap; gap:6px 16px; margin-top:24px; padding-top:14px; border-top:1px solid var(--line); color:var(--muted); font-size:13px; }
body.ui-pages-active .review-decision-meta p, body.ui-pages-active .review-decision-meta details { flex-basis:100%; margin:4px 0 0; }
body.ui-pages-active .foot .in { gap:16px; }
body.ui-pages-active .foot .sum { display:flex; align-items:center; flex-wrap:wrap; gap:8px 20px; }
body.ui-pages-active .foot .sum > .link { margin:0; }
body.ui-pages-active .foot .sum > [role=status] { flex-basis:100%; }
@container (max-width:600px) {
  body.ui-pages-active .opt { grid-template-columns:20px minmax(0,1fr); }
  body.ui-pages-active .opt .badge, body.ui-pages-active .opt .desc, body.ui-pages-active .opt .extra { grid-column:2; justify-self:start; }
}
@media (max-width:620px) {
  body.ui-pages-active .review-tools .link, body.ui-pages-active .review-scope-line .link { display:inline-flex; align-items:center; min-height:44px; }
  body.ui-pages-active .review-more-methods summary { min-height:44px; }
  body.ui-pages-active .change .metrics .v { font-size:18px; }
  body.ui-pages-active .review-tools { gap:8px 20px; }
}
