.review-main [hidden] { display: none !important; }
.review-main { padding-block: clamp(32px, 6vw, 64px) 72px; }
.review-intro h1 { font-size: clamp(30px, 3.8vw, 46px); line-height: 1.3; letter-spacing: -.06em; margin: 12px 0 14px; word-break: keep-all; }
.review-intro h1 span { color: var(--purple-strong); }
.review-intro > p:last-child { max-width: 70ch; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.8; word-break: keep-all; }
.review-intro strong { color: var(--ink); }

.stepper { display: flex; flex-wrap: wrap; gap: 8px 22px; list-style: none; padding: 0; margin: 28px 0 14px; font-size: 13px; font-weight: 650; color: var(--muted); }
.stepper li { display: inline-flex; align-items: center; gap: 8px; }
.stepper span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); font-size: 12px; }
.stepper li[aria-current="step"] { color: var(--purple-strong); }
.stepper li[aria-current="step"] span { background: var(--purple); border-color: var(--purple); color: var(--surface); }
.stepper li.done span { background: var(--lavender); border-color: #cfc3f1; color: var(--purple-strong); }

.panel { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 14px 38px #2a204609; padding: clamp(18px, 3vw, 28px); }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 12px 20px; margin-bottom: 18px; }
.panel h2 { margin: 0; font-size: clamp(18px, 2vw, 22px); letter-spacing: -.045em; }
.samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.samples > span { margin-right: 2px; }
.chip { min-height: 32px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); padding: 5px 12px; font: inherit; font-size: 12px; font-weight: 650; color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--purple); color: var(--purple-strong); }
.chip[aria-pressed="true"] { background: var(--lavender); border-color: #cfc3f1; color: var(--purple-strong); }
button:focus-visible, textarea:focus-visible, input:focus-visible, .button:focus-visible { outline: 3px solid var(--purple); outline-offset: 2px; }

.inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field-label { font-size: 13px; font-weight: 700; }
.field-label small { font-weight: 500; color: var(--muted); margin-left: 4px; }
textarea { width: 100%; min-height: 220px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font: inherit; font-size: 13px; line-height: 1.7; color: var(--ink); background: #fcfbfd; }
.counter { justify-self: end; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.note { margin: 12px 0 0; font-size: 12px; line-height: 1.7; color: var(--muted); word-break: keep-all; }
.note strong { color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px 12px; margin-top: 18px; }
.button { cursor: pointer; font-family: inherit; }
.button[disabled] { opacity: .45; cursor: not-allowed; }
.quota { margin: 0; font-size: 12px; color: var(--muted); }
.error { margin: 12px 0 0; padding: 10px 12px; border-radius: 8px; background: #fdecec; color: #8a1f1f; font-size: 13px; }

.loading { display: flex; align-items: center; gap: 16px; font-size: 14px; line-height: 1.7; }
.spinner { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--lavender); border-top-color: var(--purple); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

.summary { margin: 6px 0 0; max-width: 70ch; color: var(--muted); font-size: 14px; line-height: 1.7; }
.banner { margin: 0 0 14px; padding: 12px 14px; border-radius: 10px; background: #fff4e3; color: #5f3a10; font-size: 13px; line-height: 1.7; }
.banner strong { display: inline-block; margin-right: 6px; padding: 1px 7px; border-radius: 5px; background: #f6d9a8; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin: 0 0 18px; font-size: 12px; color: var(--muted); line-height: 1.8; }
.badge { display: inline-block; border-radius: 5px; padding: 2px 7px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.stated { background: #e5f4ea; color: #1d6337; }
.badge.inferred { background: #fff0da; color: #774718; }
.badge.pending { background: #f1eff4; color: #4f4862; }
.badge.kind { background: var(--lavender); color: var(--purple-strong); }

.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 330px); gap: 22px; align-items: start; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.review-actions p { margin: 0; font-size: 14px; line-height: 1.7; color: var(--muted); word-break: keep-all; }
.review-actions .button { min-height: 44px; font-size: 14px; white-space: nowrap; }
.results > section + section { margin-top: 26px; }
.results h3, .sources h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: -.03em; }
.count { color: var(--muted); font-weight: 600; font-size: 13px; }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.section-head h3 { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 5px; }
.items { display: grid; gap: 10px; }
.empty { margin: 0; font-size: 13px; color: var(--muted); }

.item { border: 1px solid var(--line); border-radius: 12px; padding: 14px 15px; background: var(--surface); }
.item.excluded { opacity: .55; background: #faf9fb; }
.item-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.item-id { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.item-title { margin: 0; flex: 1 1 200px; font-size: 14px; font-weight: 700; line-height: 1.55; word-break: keep-all; }
.item p { margin: 6px 0 0; font-size: 13px; line-height: 1.7; color: var(--muted); word-break: keep-all; }
.item .delta { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; align-items: center; margin-top: 8px; font-size: 13px; }
.item .delta span { padding: 8px 10px; border-radius: 8px; background: #faf9fc; line-height: 1.55; }
.item .delta .arrow { background: none; padding: 0; color: var(--muted); }
.item ol { margin: 6px 0 0; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.kv { margin-top: 8px; font-size: 13px; line-height: 1.7; }
.kv b { display: block; font-size: 11px; color: var(--muted); }
.editable { display: block; width: 100%; border: 1px solid transparent; border-radius: 6px; padding: 3px 6px; margin-left: -6px; font: inherit; color: var(--ink); background: transparent; resize: vertical; }
textarea.editable { min-height: 0; line-height: 1.6; }
.editable:hover { border-color: var(--line); }
.editable:focus { border-color: var(--purple); background: #fcfbfd; }
input.editable.item-title { font-size: 14px; font-weight: 700; }

.item-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.evidence-links { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.ev { min-height: 26px; border: 1px solid #d9cff3; border-radius: 6px; background: #f6f3fd; padding: 2px 7px; font: inherit; font-size: 11px; font-weight: 700; color: var(--purple-strong); cursor: pointer; }
.ev:hover { background: var(--lavender); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.controls .seg + .seg-label { margin-left: 6px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { min-height: 28px; border: 0; border-right: 1px solid var(--line); background: var(--surface); padding: 3px 9px; font: inherit; font-size: 11px; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--ink); background: #faf9fc; }
.seg button[aria-pressed="true"] { background: var(--purple); color: var(--surface); }
.seg.rating button[aria-pressed="true"] { background: #4f4862; }
.seg-label { font-size: 10px; color: var(--muted); align-self: center; }

.sources { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fcfbfd; }
.sources ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.sources li { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 6px; padding: 6px 7px; border-radius: 7px; font-size: 12px; line-height: 1.6; scroll-margin: 12px; }
.sources li b { font-size: 11px; color: var(--purple-strong); font-variant-numeric: tabular-nums; }
.sources li.doc-break { margin-top: 6px; display: block; padding: 0 0 0 2px; font-size: 11px; font-weight: 700; color: var(--muted); }
.sources li.hit { background: #fff3c9; box-shadow: inset 2px 0 0 #e0a800; }

.tally { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 0; }
.tally div { padding: 12px 14px; border-radius: 10px; background: #faf9fc; border: 1px solid var(--line); }
.tally dt { font-size: 12px; color: var(--muted); }
.tally dd { margin: 4px 0 0; font-size: 22px; font-weight: 750; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.survey { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.survey fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; }
.survey legend { width: 100%; margin-bottom: 8px; font-weight: 700; font-size: 14px; }
.survey legend small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.survey label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }

@media (max-width: 860px) {
  .review-layout { grid-template-columns: minmax(0, 1fr); }
  .sources { position: static; max-height: 360px; order: -1; }
}
@media (max-width: 640px) {
  .review-actions .button { width: 100%; }
  .inputs { grid-template-columns: minmax(0, 1fr); }
  textarea { min-height: 160px; }
  .item .delta { grid-template-columns: minmax(0, 1fr); }
  .item .delta .arrow { display: none; }
}
