/* Student reviews on the class page (spec/page-course-reviews.md). Tokens only (sys 3); references ABW56, AB82,
   DD82, DD86, DD95, AB97, L94 in the brief. */

/* section (ABW56: summary, hairline, list; no card around a review) */
.rv { padding-top: var(--s-8); scroll-margin-top: var(--s-4); }
.rv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-3) var(--s-4); }
.rv-ht { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); min-width: 0; }
.rv-ht h2 { margin: 0; font: var(--t-item); color: var(--ink); }
.rv-ht h2:focus { outline: none; } /* a heading is a focus target for the jump and ?reviews links, not a control */
.rv-sample { font: var(--t-small); min-height: 20px; padding: 2px var(--s-2); }
.rv-write { flex-shrink: 0; }
.rv-sub { margin: var(--s-1) 0 var(--s-4); font: var(--t-meta); color: var(--muted); max-width: var(--w-read); }

.rv-sum { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 320px); gap: var(--s-4) var(--s-8); align-items: center; padding: var(--s-4) 0 var(--s-6); border-bottom: 1px solid var(--line); }
.rv-avg p { margin: 0; }
.rv-avg-n { font: var(--t-title); color: var(--ink); font-variant-numeric: tabular-nums; }
.rv-of { font: var(--t-meta); color: var(--muted); }
.rv-avg .rv-avg-l { margin-top: var(--s-1); font: var(--t-control); color: var(--ink); }
.rv-avg-m { font: var(--t-label); font-weight: 400; color: var(--muted); }
.rv-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.rv-bars li { display: grid; grid-template-columns: 12px minmax(0, 1fr) 28px; align-items: center; column-gap: var(--s-2); min-height: 16px; font: var(--t-small); color: var(--muted); font-variant-numeric: tabular-nums; }
.rv-bar { position: relative; height: 6px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.rv-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--accent); }
.rv-bn { text-align: right; }

/* your review (DD95: as it will read, a status beside it) */
.rv-mine { margin-top: var(--s-6); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); }
.rv-mine-h { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin-bottom: var(--s-2); }
.rv-mine-t { font: var(--t-label); color: var(--muted); }
.rv-mine .rv-item { padding: 0; border: 0; }
.rv-mine-note { margin: var(--s-3) 0 0; font: var(--t-label); font-weight: 400; color: var(--muted); max-width: var(--w-read); }
.rv-gone, .rv-none { margin: var(--s-6) 0 0; font: var(--t-meta); color: var(--muted); }
.rv-gone:focus { outline: none; }
.rv-you { font-weight: 400; color: var(--muted); }

/* list head (AB82: count left, menu right) */
.rv-lhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-top: var(--s-6); }
.rv-count { margin: 0; font: var(--t-label); color: var(--muted); }
.rv-filter { min-width: 0; }

.rv-item { padding: var(--s-5, 20px) 0; border-bottom: 1px solid var(--line); scroll-margin-top: var(--s-4); }
.rv-item:focus { outline: none; }
.rv-item:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; border-radius: 2px; }
.rv-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0 var(--s-3); }
.rv-name { margin: 0; font: var(--t-item); color: var(--ink); }
.rv-date { font: var(--t-label); font-weight: 400; color: var(--muted); }
.rv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); margin: var(--s-1) 0 0; font: var(--t-label); font-weight: 400; color: var(--muted); }
.rv-pips { display: inline-flex; gap: 3px; }
.rv-pips i { width: 8px; height: 8px; border-radius: 2px; background: var(--line-strong); }
.rv-pips i.on { background: var(--accent); }
.rv-sc { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.rv-body { margin: var(--s-2) 0 0; font: var(--t-body); color: var(--ink-2); max-width: var(--w-read); white-space: pre-wrap; overflow-wrap: anywhere; }
.rv-counts { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-3); margin: var(--s-2) 0 0; font: var(--t-label); font-weight: 400; color: var(--ink-2); }
.rv-counts b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.rv-cl { color: var(--muted); }
.rv-acts { display: flex; gap: var(--s-4); margin-top: var(--s-2); }
.rv-acts .text-btn { margin-left: calc(-1 * var(--s-2)); }
.rv-acts .text-btn + .text-btn { margin-left: 0; }
.text-btn.rv-quiet { color: var(--muted); }
.text-btn.rv-quiet:hover { color: var(--ink); }
.text-btn.rv-danger, .text-btn.rv-danger:hover { color: var(--danger); }
.rv-flagged { display: flex; align-items: center; gap: 6px; margin: var(--s-2) 0 0; font: var(--t-label); font-weight: 400; color: var(--muted); }
.rv-flagged .icon { width: 14px; height: 14px; flex-shrink: 0; }
.rv-more { margin-top: var(--s-4); }

.rv-empty { margin-top: var(--s-2); padding: var(--s-6); border: 1px dashed var(--line-strong); border-radius: var(--r-panel); }
.rv-empty-h { margin: 0; font: var(--t-item); color: var(--ink); }
.rv-empty-m { margin: var(--s-1) 0 var(--s-4); font: var(--t-meta); color: var(--muted); max-width: var(--w-read); }
.rv-err { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-panel); }
.rv-err p { margin: 0; font: var(--t-meta); color: var(--ink-2); }
.rv .loading { padding: var(--s-8) 0; }

.rv-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-top: var(--s-6); padding-top: var(--s-4); border-top: 1px solid var(--line); }
.rv-foot p { margin: 0; }
.rv-foot-h { font: var(--t-control); color: var(--ink); }
.rv-foot-m { font: var(--t-label); font-weight: 400; color: var(--muted); }
.rv-foot .btn { flex-shrink: 0; }
.rv-how { display: flex; flex-wrap: wrap; gap: 0 var(--s-4); margin: var(--s-2) 0 0; }
.rv-f > input#rv-name { display: block; width: 100%; max-width: 320px; margin-top: var(--s-2); }

/* drawer blocks */
.rv-dline { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: 0; font: var(--t-meta); color: var(--ink-2); }
.rv-dline b { color: var(--ink); }
.rv-dlinks { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-4); margin: var(--s-2) 0 0; font: var(--t-control); }
.rv-ilist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s-2); font: var(--t-meta); }
.rv-ilist li { display: flex; flex-wrap: wrap; gap: 0 var(--s-2); }

/* write sheet (L94 at 600 and up; DD86 full screen under 600) */
dialog.rv-sheet { width: min(600px, calc(100vw - 32px)); max-height: min(860px, calc(100dvh - 48px)); overflow: hidden; }
dialog.rv-sheet[open] { display: flex; flex-direction: column; }
.rv-form { display: flex; flex-direction: column; min-height: 0; flex: 1; max-height: inherit; }
.rv-sh { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: var(--s-3); padding: var(--s-4) var(--s-4) var(--s-3) var(--s-6); border-bottom: 1px solid var(--line); }
.rv-sh .rv-x { order: 2; }
.rv-sh-t h2:focus, #rv-modal-title:focus { outline: none; } /* focused on open so no choice looks preselected (check 0, m9); a title, not a control */
.rv-sh-t h2 { margin: 0; font: var(--t-h2); color: var(--ink); }
.rv-sh-t p { margin: 2px 0 0; font: var(--t-meta); color: var(--muted); }
.rv-sb { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-4) var(--s-6) var(--s-6); display: grid; gap: var(--s-6); align-content: start; }
.rv-sf { display: flex; align-items: center; gap: var(--s-2); padding: var(--s-3) var(--s-6); border-top: 1px solid var(--line); background: var(--surface); }
.rv-sf-r { display: flex; gap: var(--s-2); margin-left: auto; }
.rv-del-m { display: none; }
.rv-as p { margin: 0; font: var(--t-meta); color: var(--ink-2); }
.rv-as b { color: var(--ink); }
.rv-f { min-width: 0; margin: 0; padding: 0; border: 0; }
.rv-f > label:not(.rv-check), .rv-f legend { margin-bottom: 6px; padding: 0; font: var(--t-control); font-weight: 600; color: var(--ink); }
.rv-opt { font-weight: 400; color: var(--muted); }
.rv-word { margin-left: var(--s-2); font-weight: 400; color: var(--muted); }
.rv-seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line-strong); border-radius: var(--r-control); overflow: hidden; max-width: 360px; }
.rv-seg .rv-r { position: relative; display: block; gap: 0; margin: 0; font: var(--t-control); font-weight: 500; }
.rv-r + .rv-r { border-left: 1px solid var(--line-strong); }
.rv-seg .rv-r input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.rv-r span { display: flex; align-items: center; justify-content: center; min-height: 40px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rv-r:hover span { background: var(--bg); }
.rv-r input:checked + span { background: var(--accent); color: var(--on-accent); }
.rv-r input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -4px; border-radius: 4px; }
.rv-rate .field-help { margin-top: 6px; }
.rv-pair { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
.rv-pair select, .rv-pair .csel { width: 100%; }
.rv-f .field-help + textarea { margin-top: var(--s-2); }
.rv-crow { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-3); }
.rv-crow .field-error { margin-top: 6px; }
.rv-left { margin-left: auto; margin-top: 6px; font: var(--t-label); font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-wl summary { display: inline-flex; align-items: center; gap: var(--s-1); min-height: 32px; font: var(--t-control); font-weight: 600; color: var(--accent); cursor: pointer; }
.rv-wl[open] summary { margin-bottom: var(--s-1); }
.rv-cgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); margin-top: var(--s-3); }
.rv-c { display: grid; gap: 4px; font: var(--t-label); font-weight: 500; color: var(--ink-2); }
.rv-c input { margin-top: 0; width: 100%; font-variant-numeric: tabular-nums; }
.rv-f .rv-check { display: flex; align-items: flex-start; gap: var(--s-2); font: var(--t-meta); color: var(--ink-2); }
.rv-check input { margin-top: 2px; }
.rv-errs { padding: var(--s-3) var(--s-4); border: 1px solid var(--danger); border-radius: var(--r-panel); background: var(--danger-subtle); font: var(--t-meta); color: var(--ink); }
.rv-errs:focus { outline: 2px solid var(--focus); outline-offset: 2px; }
.rv-errs p { margin: 0 0 var(--s-1); font-weight: 600; }
.rv-errs ul { margin: 0; padding-left: var(--s-4); }
.rv-errs a { color: var(--danger); }
.rv-prob { padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--warning-subtle); }
.rv-prob p { margin: 0; font: var(--t-meta); color: var(--ink-2); }
.rv-prob .rv-prob-h { font: var(--t-control); font-weight: 600; color: var(--ink); margin-bottom: var(--s-1); }
.rv-prob-a { margin-top: var(--s-3); }
.rv-form [aria-invalid="true"] { border-color: var(--danger); }

/* small modals: how reviews work, report (AB97 rows), delete */
.rv-modal .modal-body p { margin: 0 0 var(--s-2); }
.rv-how-b ul { margin: 0; padding-left: var(--s-4); display: grid; gap: var(--s-2); }
.rv-private { display: flex; gap: var(--s-2); font: var(--t-label); font-weight: 400; color: var(--muted); }
.rv-private .icon { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.rv-reasons { margin: var(--s-2) 0 0; padding: 0; border: 0; }
.rv-reasons .rv-reason { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 48px; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); font: var(--t-control); color: var(--ink); cursor: pointer; }
.rv-reason-t { display: grid; }
.rv-reason small { font: var(--t-label); font-weight: 400; color: var(--muted); }
.rv-reasons .rv-reason input { width: 18px; height: 18px; }
.rv-note-l { margin-top: var(--s-4); }
.rv-note-l + textarea { margin-top: 6px; }

@media (max-width: 879px) {
  .rv-sum { grid-template-columns: minmax(0, 1fr) minmax(0, 280px); gap: var(--s-4) var(--s-6); }
}
@media (max-width: 599px) {
  .rv-sum { grid-template-columns: 1fr; }
  .rv-bars { max-width: none; }
  .rv-write { min-height: 36px; position: relative; }
  .rv-write::before { content: ''; position: absolute; inset: -5px -1px; } /* 36 tall, 44 to the finger (check 0, m6) */
  .rv-lhead { align-items: stretch; }
  .rv-top { flex-direction: column; align-items: flex-start; gap: 2px; } /* the date moves under the name (brief 3; check 1, m1) */
  .rv-filter, .rv-filter .csel, .rv-filter select { width: 100%; }
  .rv-foot .btn { width: 100%; justify-content: center; }
  /* the sheet fills the screen: close top left, title under it, one full width Save pinned at the bottom (DD86) */
  dialog.rv-sheet { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; }
  .rv-sh { grid-template-columns: 1fr; padding: var(--s-2) var(--s-4) var(--s-3); gap: var(--s-2); }
  .rv-sh .rv-x { order: 0; justify-self: start; width: 44px; height: 44px; min-height: 44px; margin-left: -10px; }
  .rv-sh-t h2 { font: var(--t-title); font-size: 22px; line-height: 28px; }
  .rv-sb { padding: var(--s-4); }
  .rv-sf { padding: var(--s-3) var(--s-4) calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); }
  .rv-sf .rv-cancel, .rv-sf .rv-del-d { display: none; }
  .rv-sf-r { flex: 1; }
  .rv-sf-r .primary { flex: 1; min-height: 44px; }
  .rv-del-m { display: block; }
  .rv-pair { grid-template-columns: 1fr; }
  .rv-cgrid { grid-template-columns: 1fr 1fr; }
  .rv-seg { max-width: none; }
  .rv-r span { min-height: 44px; }
}
@media (pointer: coarse) {
  .rv-acts .text-btn, .rv-how .text-btn, .rv-dlinks a { position: relative; }
  .rv-acts .text-btn::before, .rv-how .text-btn::before, .rv-dlinks a::before { content: ''; position: absolute; inset: -6px 0; }
}
