/* Styles for this app's own markup.
 *
 * Kept separate from styles.css, which is a verbatim copy of superssk's —
 * so that file can be re-synced when the shared grid macros change without
 * anything of ours having to be picked back out of it. Tokens (--panel,
 * --line, --muted, ...) come from there.
 */

.page { max-width: none; margin: 0; padding: 24px 20px 60px; }
.subtitle { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }

.banner { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.banner-warn { background: rgba(217,119,6,.10); border: 1px solid rgba(217,119,6,.35);
  color: #92400e; }
/* A fact worth stating, not a warning. The ending of a session is printed
   for every run; only the ones that put the tutor at the end of it get the
   amber treatment. */
.banner-quiet { background: var(--panel); border: 1px solid var(--line); }

/* Counts, not scores. Each tile is one state the pipeline can be in. */
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; min-width: 132px; }
.stat-n { font-size: 22px; font-weight: 700; }
.stat-l { font-size: 12px; color: var(--muted); }

.note { background: var(--panel2); border-left: 3px solid var(--line);
  padding: 8px 12px; margin: 10px 0; color: var(--muted); max-width: 90ch; }

.table-scroll { overflow-x: auto; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; }
table.sheet { border-collapse: collapse; width: 100%; font-size: 13px; }
table.sheet th, table.sheet td { padding: 7px 10px; border-bottom: 1px solid var(--line);
  text-align: left; white-space: nowrap; vertical-align: top; }
table.sheet tbody tr:hover { background: var(--panel2); }
table.sheet td.empty { text-align: center; color: var(--muted); padding: 28px; white-space: normal; }
.table-actions { margin-top: 12px; }

/* A disagreement is the row worth looking at, so it is the row that is
   marked. Everything else stays quiet — colouring every state would make
   the one that matters no easier to find. */
tr.agreement-disagree { background: rgba(220,38,38,.05); }
tr.agreement-disagree:hover { background: rgba(220,38,38,.09); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px 20px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px 16px; margin-bottom: 18px; }
.facts .k, p.k { color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: .4px; margin-right: 6px; }
p.k { margin: 14px 0 4px; }

.verdicts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; }
.card h2 { margin-top: 0; }
.verdict { font-size: 16px; font-weight: 600; margin: 4px 0; }
.pending { color: var(--muted); font-style: italic; }
.remarks { white-space: pre-wrap; max-width: 80ch; }
.ai-fields { margin: 10px 0; padding-left: 18px; }
.ai-fields li { margin: 2px 0; }
.raw { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.transcript { white-space: pre-wrap; background: var(--panel2); padding: 12px;
  border-radius: 8px; max-height: 420px; overflow: auto; font-size: 12px; max-width: 100%; }

/* --- sessions: table + detail panel ---------------------------------- */

table.sheet.sheet-click tbody tr { cursor: pointer; }
table.sheet tbody tr.is-open { background: rgba(59,110,245,.10); }
a.row-open { font-weight: 600; }

/* A side panel rather than a split: the table keeps its full width until
   someone asks for a row. */
.detail-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(680px, 92vw);
  background: var(--panel); border-left: 1px solid var(--line); z-index: 40;
  overflow-y: auto; padding: 44px 22px 30px; box-shadow: -8px 0 24px rgba(0,0,0,.10); }
.detail-scrim { position: fixed; inset: 0; background: rgba(15,20,30,.22); z-index: 30; }
.detail-close { position: absolute; top: 10px; right: 14px; border: 0; background: none;
  font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; }
.detail-close:hover { color: var(--text); }
.detail-loading { color: var(--muted); padding: 40px 0; text-align: center; }

.detail-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px; margin-bottom: 12px; }
.detail-head h2 { margin: 0 0 2px; font-size: 18px; }
.detail-head p { margin: 0; font-size: 12px; }

.rating { font-weight: 700; font-size: 12px; padding: 1px 7px; border-radius: 10px;
  background: var(--panel2); color: var(--muted); flex-shrink: 0; }
.rating-1, .rating-2 { background: rgba(220,38,38,.12); color: var(--danger); }
.rating-lg { font-size: 15px; padding: 4px 12px; }

.pill { font-size: 10px; padding: 1px 7px; border-radius: 10px; background: var(--panel2);
  color: var(--muted); white-space: nowrap; }
.pill-both_pending, .pill-human_pending { background: rgba(217,119,6,.14); color: #92400e; }
.pill-disagree { background: rgba(220,38,38,.12); color: var(--danger); }

/* A fixed, TALL box — reserved before anything loads.
 *
 * Two problems in one rule. First, a bare <video> is 300x150 until its
 * metadata arrives and then jumps to the real aspect; with the verdicts
 * sitting right below it, that reflow happened exactly when playback
 * started and moved what the reader was looking at. Second, these
 * recordings are not one shape: tutors record on phones, so plenty are
 * portrait (540x960) alongside the landscape ones (960x540). An aspect
 * box sized for either wastes most of the panel on the other — a 16:9 box
 * shrinks a portrait session to a sliver.
 *
 * So: a fixed height in vh, and object-fit: contain. Both orientations
 * fill it as well as they can, nothing resizes on play, and the box is
 * tall enough that a portrait recording is actually watchable.
 */
.player { width: 100%; height: 58vh; max-height: 620px; min-height: 320px;
  background: #000; border-radius: 8px; display: block; margin-bottom: 16px;
  object-fit: contain; }
/* Deliberately NOT the same height. Reserving 58vh for a session with
   nothing to watch would push both verdicts off the screen for the one
   case where they are all there is to read. */
.player-none { display: flex; align-items: center; justify-content: center; text-align: center;
  width: 100%; height: 130px; background: var(--panel2); color: var(--muted);
  font-size: 13px; padding: 0 24px; border-radius: 8px; margin-bottom: 16px; }

.verdicts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.vcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; margin-bottom: 12px; }
.vcard h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); }
.small { font-size: 12px; }
.transcript-wrap summary { cursor: pointer; color: var(--accent); margin-top: 10px; }

/* --- date range bar --------------------------------------------------- */
.rangebar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; margin-bottom: 14px; font-size: 13px; }
.rangebar-label { color: var(--muted); }
/* width:auto overrides the lifted styles.css, which sets `input, select
   { width: 100% }` for its stacked forms — inside this flex row that made
   each date field span the whole bar and pushed the presets onto their own
   line. */
.rangebar input[type="date"] { font: inherit; width: auto; flex: 0 0 auto;
  border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px;
  background: var(--panel); color: var(--text); }
.rangebar-presets { display: flex; gap: 5px; margin-left: 6px; }
.chip { font: inherit; font-size: 12px; padding: 4px 10px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--panel2); color: var(--muted); cursor: pointer; }
.chip:hover { color: var(--text); }
.chip-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.rangebar-have { margin-left: auto; font-size: 12px; }

/* --- overview widgets -------------------------------------------------- */
.stat-link { color: inherit; display: block; }
.stat-link:hover { text-decoration: none; border-color: var(--accent); }

.widgets { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr));
  gap: 14px; align-items: start; }
.widget { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; }
.widget-wide { grid-column: 1 / -1; }
.widget h2 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); display: flex; justify-content: space-between;
  align-items: baseline; gap: 10px; }
.widget-more { font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.chart-empty { color: var(--muted); font-size: 12px; padding: 26px 0; text-align: center; }

table.mini { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mini td { padding: 4px 6px; border-bottom: 1px solid var(--line);
  overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
table.mini tr:last-child td { border-bottom: 0; }
table.mini td.num { text-align: right; white-space: nowrap; }

/* Bars, not a chart library: one value per day and a second value inside
   it. The dark portion is what is still unreviewed. */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  align-items: center; height: 100%; min-width: 0; }
.bar:hover { text-decoration: none; }
.bar-fill { width: 100%; background: var(--accent); border-radius: 3px 3px 0 0;
  min-height: 2px; display: flex; flex-direction: column; justify-content: flex-end; }
.bar:hover .bar-fill { background: var(--accent2); }
.bar-un { width: 100%; background: rgba(15,20,30,.45); border-radius: 0 0 3px 3px; }
.bar-lab { font-size: 10px; color: var(--muted); margin-top: 3px; }

/* --- tutor detail ------------------------------------------------------ */
.tutor-head { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.tutor-head h1 { margin: 0 0 4px; }
.avatar { width: 60px; height: 60px; border-radius: 50%; object-fit: cover;
  background: var(--panel2); flex-shrink: 0; }
.avatar-none { border: 1px solid var(--line); }
.grow { flex: 1; min-width: 0; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.tag-ok { background: rgba(18,161,80,.12); color: var(--ok); border-color: transparent; }
.tag-warn { background: rgba(217,119,6,.14); color: #92400e; border-color: transparent; }
.tag-bad { background: rgba(220,38,38,.12); color: var(--danger); border-color: transparent; }
.btn-link { flex-shrink: 0; font-size: 13px; }
table.mini.kv td:first-child { color: var(--muted); width: 40%; }

/* A tutor cleared on fifty subtopics would otherwise make that one card
   longer than everything else on the page put together. */
.widget-scroll table.mini { display: block; max-height: 320px; overflow-y: auto; }

/* A student who gives this tutor most of their own billed time. */
tr.is-flagged { background: rgba(217,119,6,.10); }
tr.watch-row td { padding: 10px 0; }
tr.watch-row .player { height: 50vh; max-height: 520px; }
.widget h2 .muted { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }
/* A second chart inside one card: same voice as the card's own h2, a size
   down and ruled off, so the two canvases read as one argument in two
   steps rather than as a card that forgot its heading. */
.widget .sub-h { margin: 18px 0 10px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted);
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.widget .sub-h .muted { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 11px; }

/* --- signals ----------------------------------------------------------- */
.signals { list-style: none; margin: 0 0 18px; padding: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.sig { display: flex; align-items: flex-start; gap: 12px;
  padding: 11px 16px; border-bottom: 1px solid var(--line); }
.sig:last-child { border-bottom: 0; }
.sig-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex-shrink: 0;
  background: var(--line); }
.sig-concern .sig-dot { background: var(--danger); }
.sig-watch .sig-dot { background: var(--warn); }
.sig-ok .sig-dot { background: var(--ok); }
.sig-unknown .sig-dot { background: var(--muted); opacity: .45; }
/* A raised finding should be readable from across the room; a quiet one
   should not compete with it. */
.sig-concern { background: rgba(220,38,38,.05); }
.sig-body { flex: 1; min-width: 0; }
.sig-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.sig-label { color: var(--muted); font-size: 12px; min-width: 200px; }
.sig-head { font-size: 14px; }
.sig-concern .sig-head, .sig-watch .sig-head { font-weight: 600; }
.sig-ok .sig-head, .sig-unknown .sig-head { color: var(--muted); }
.sig-detail { color: var(--muted); font-size: 12px; margin-top: 2px; }
.sig-link { font-size: 12px; flex-shrink: 0; }

.reference { margin-top: 18px; }
.reference > summary { cursor: pointer; color: var(--muted); font-size: 13px;
  padding: 10px 0; }
.reference[open] > summary { margin-bottom: 10px; }

/* --- identity strip ----------------------------------------------------- */
.idcards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 12px; margin-bottom: 14px; align-items: start; }
.idcard { background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; }
.idcard h3 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .5px; color: var(--muted); display: flex; justify-content: space-between; }
.idcard h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }
.idcard-scroll table.mini { display: block; max-height: 210px; overflow-y: auto; }

/* --- published ranking rule --------------------------------------------- */
.rules { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin: 0 0 12px; padding: 0; font-size: 12px; color: var(--muted); }
.rules-n { display: inline-block; min-width: 17px; height: 17px; line-height: 17px;
  text-align: center; border-radius: 50%; background: var(--panel2);
  border: 1px solid var(--line); font-size: 10px; font-weight: 700; margin-right: 4px; }
.rules-last { font-style: italic; }

.ped-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; }
.ped-list { margin: 4px 0 8px; padding-left: 18px; font-size: 12px; color: var(--muted);
  columns: 2; }
.ped-list li { break-inside: avoid; }

/* --- pedagogy review detail -------------------------------------------- */
.ped-review { margin-bottom: 14px; }
.ped-review h2 { display: flex; justify-content: space-between; align-items: baseline;
  gap: 14px; flex-wrap: wrap; text-transform: none; letter-spacing: 0; font-size: 14px;
  color: var(--text); }
.ped-review h2 .muted { font-size: 12px; }
.ped-sessions { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.ped-session { font-size: 12px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 12px; padding: 2px 10px; }
.ped-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ped-group .ped-list { columns: 1; }
.ped-na > summary { cursor: pointer; color: var(--muted); font-size: 12px; margin-top: 10px; }
.ped-list-wide { columns: 4; }
.page-narrow { max-width: 70ch; }
.page-narrow code { background: var(--panel2); padding: 1px 5px; border-radius: 4px;
  font-size: 12px; }

/* --- review lab --------------------------------------------------------- */
.labform { display: flex; gap: 10px; align-items: center; margin-bottom: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; }
.labform input[type="text"] { flex: 1; font: inherit; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: var(--text); }
.btn-primary { font: inherit; font-weight: 600; padding: 8px 16px; border: 0;
  border-radius: 6px; background: var(--accent); color: #fff; cursor: pointer; }
.btn-primary:hover { background: #2f5fe0; }
.framegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px; }
.framegrid figure { margin: 0; }
.framegrid img { width: 100%; border-radius: 6px; border: 1px solid var(--line);
  display: block; }
.framegrid figcaption { font-size: 11px; color: var(--muted); text-align: center;
  margin-top: 2px; }

/* --- lab opinions ------------------------------------------------------- */
.opinion-intro { margin: 0 0 6px; }
.sig-opinion { background: var(--panel2); padding-top: 6px; padding-bottom: 6px; }
.sig-opinion .sig-dot { background: transparent; }
.op-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.op-label { color: var(--muted); font-size: 12px; min-width: 200px; }
.op-btn { font: inherit; font-size: 12px; padding: 3px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--panel); color: var(--muted);
  cursor: pointer; }
.op-btn:hover { color: var(--text); }
.op-btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.op-note { flex: 1; min-width: 180px; font: inherit; font-size: 12px; padding: 4px 8px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
  color: var(--text); }
.op-state { min-width: 120px; }

/* A criterion that cannot apply to this medium — quieter than "unknown",
   which means we tried and could not tell. */
.sig-na .sig-dot { background: var(--line); }
.sig-na .sig-head, .sig-na .sig-label { color: var(--muted); opacity: .7; }

/* --- supply cohorts ----------------------------------------------------- */
table.cohorts th { font-weight: 600; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .4px; }
/* A cell the cohort is too young for. Visibly absent rather than empty —
   it should not read as a zero. */
td.is-immature { background: repeating-linear-gradient(45deg,
  var(--panel2), var(--panel2) 4px, transparent 4px, transparent 8px); }

.prose-cell { display: inline-block; max-width: 34ch; white-space: normal; line-height: 1.3;
  font-size: 12px; color: var(--muted); }
ol.mistakes { margin: 4px 0 8px; padding-left: 20px; white-space: normal; }
ol.mistakes li { margin: 3px 0; }
form.inline { display: inline; margin: 0; }
.freshness { display: flex; align-items: center; gap: 10px; margin: -4px 0 12px; font-size: 12px; }

/* The transcript is read, not skimmed: a measured column width and real
   line height. Pre-wrap keeps whatever paragraphing survived the audit
   without letting a single long line scroll the page sideways. */
.transcript-text {
  max-width: 68ch; white-space: pre-wrap; line-height: 1.65;
  font-size: 13px; color: var(--text); margin: 8px 0 0;
}
.question-text { max-width: 68ch; white-space: pre-wrap; line-height: 1.5; margin: 4px 0 0; }

/* The question photo. Capped rather than full-width: these are phone
   photos of a page, often portrait, and one at full width pushes the
   verdicts off the screen — which is the comparison the page exists for. */
.q-images { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 10px; }
.q-images img {
  max-height: 320px; max-width: 100%; border-radius: 6px;
  border: 1px solid var(--line); background: #fff;
}

/* The day x hour grid. Its own container rather than .chart-card, which
   lives in the lifted styles.css and would be re-synced away from under
   it. Narrow screens scroll it rather than squashing 24 columns to
   nothing — a cell that is under a pixel wide is not a cell. */
.heat { overflow-x: auto; }
.heat svg { display: block; width: 100%; min-width: 620px; height: auto; }

/* Push depth's headline bands. A row of four figures above the chart,
   because the range total is the number people quote and hunting it off a
   stacked bar is guesswork. The colours match the chart's bands in
   charts.py — literals there because a canvas cannot read a custom
   property, so these are the pair that must be kept in step. */
.push-head { display: flex; flex-wrap: wrap; gap: 18px; margin: 0 0 12px; font-size: 12px; }
.push-band { display: flex; align-items: baseline; gap: 5px; }
.push-band strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.push-band.push-0 strong { color: #dc2626; }
.push-band.push-1 strong { color: #d97706; }
.push-band.push-2 strong { color: #3b6ef5; }
.push-band.push-3 strong { color: #12a150; }

/* A card whose data cannot follow the page's date range says so in a band
   the reader cannot skim past. Only one card needs this — tutor presence
   is written nightly and is a fixed trailing week — and it sits on a tab
   where every other number moves with from/to, which is exactly why a
   quiet footnote would not do. */
.range-warn { margin: 0 0 10px; padding: 6px 10px; font-size: 12px;
  border-left: 3px solid var(--warn, #d97706); background: rgba(217,119,6,.07);
  border-radius: 0 5px 5px 0; }

/* Column bands. A sheet whose columns belong to different date ranges is
   unreadable without them: "change vs range" next to four trailing
   windows looks like one continuous block of numbers, and a reader cannot
   see which two things are actually being compared. Applied via
   <colgroup>, so the lifted _sheet_filter_macros.html stays untouched.
   Kept pale — these are bands, not highlights, and the numbers have to
   stay the loudest thing in the cell. */
.sheet col.cg-sel   { background: rgba(59, 110, 245, .07); }   /* the chosen range */
.sheet col.cg-prior { background: rgba(122, 122, 122, .07); }  /* the window before it */
.sheet col.cg-trail { background: rgba(18, 161, 80, .05); }    /* trailing windows */
.sheet col.cg-verdict { background: rgba(217, 119, 6, .08); }  /* the comparison */



/* The filter summary and the export button on one line: the export belongs
   beside the count it exports, not adrift at the bottom of the page. */
.table-actions { display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; }
.table-actions > :first-child { flex: 1 1 auto; }
