/* assess.css — Assignments: sign-in, account menu, unavailable card, and the privacy page.
 * Loaded before the inline <style> in index.html, so it uses the same tokens (no hard-coded colours).
 * Rules that must beat an inline rule of equal specificity use a more specific selector.
 * Exception: privacy.html is a separate page without index.html's inline token table, so the
 * .privacy-doc blocks below restate the tokens it uses; tests/public-build.test.cjs checks that
 * they equal index.html's values.
 */

/* ---------- sign-in ---------- */
.login-card { max-width: 440px; margin: 8px auto 0; padding: 22px; gap: 16px; }
.login-card h3 { font-size: 19px; }
.login-form { gap: 12px; }
.login-form .remember { display: flex; flex-direction: column; gap: 2px; }
.login-form .remember .check { align-self: flex-start; }
.login-form .remember input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.login-form .remember-hint { padding-left: 22px; }
.login-card .login-form .btn-primary { width: 100%; padding-block: 9px; }
.login-card .data-notice { display: block; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.45; }
.login-card .data-notice a { white-space: nowrap; }
.form-error { color: var(--bad); font-size: 13px; line-height: 1.4; }
.form-error:empty { display: none; }
.field-hint { font-weight: 400; }
.btn .spinner { width: 12px; height: 12px; border-width: 2px; }
.btn-primary .spinner { border-color: color-mix(in srgb, var(--accent-ink) 35%, transparent); border-top-color: var(--accent-ink); }

/* ---------- not available ---------- */
.unavailable-card { max-width: 560px; margin: 8px auto 0; }

/* ---------- first-login note ---------- */
.first-login-note { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- account menu in the top bar (in place of the brand subtitle) ---------- */
.brand.signed-in .brand-sub { display: none; }
.who-menu { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.topbar-inner .who-menu .who { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar-inner .who-menu .btn { padding: 1px 6px; font-size: 12px; color: var(--accent); }
.account-body strong { font-size: 15px; }

/* ---------- privacy page (privacy.html) ---------- */
.privacy-doc {
  --bg: #f3f5f9; --surface: #ffffff; --surface-2: #eceff5; --ink: #151b27; --ink-2: #333c4d; --muted: #5b6577;
  --line: #d6dce7; --accent: #2a52c4; --warn: #9a6408; --warn-soft: #fbefd6;
  --font-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  .privacy-doc {
    --bg: #0d1118; --surface: #141a24; --surface-2: #1a212d; --ink: #e3e8f1; --ink-2: #c3cad7; --muted: #95a0b3;
    --line: #283141; --accent: #7d9dff; --warn: #e7b04d; --warn-soft: #33270f;
    color-scheme: dark;
  }
}
.privacy-doc body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font-ui); -webkit-font-smoothing: antialiased; }
.privacy-page { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; }
.privacy-page a { color: var(--accent); }
.privacy-page .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.privacy-page h1 { font-family: var(--font-text); font-size: 28px; line-height: 1.2; font-weight: 600; margin: 6px 0 10px; text-wrap: balance; }
.privacy-page h2 { font-family: var(--font-text); font-size: 19px; line-height: 1.3; font-weight: 600; margin: 0 0 6px; }
.privacy-page .lead { color: var(--ink-2); margin: 0; }
.privacy-page section { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; margin-top: 14px; }
.privacy-page section p, .privacy-page section ul { margin: 0; }
.privacy-page section p + p, .privacy-page section p + ul, .privacy-page section ul + p { margin-top: 8px; }
.privacy-page ul { padding-left: 1.3em; }
.privacy-page li + li { margin-top: 3px; }
.privacy-page .back { display: inline-block; margin-bottom: 18px; font-size: 14px; }
.privacy-page .updated { margin-top: 20px; color: var(--muted); font-size: 13px; }
@media (max-width: 560px) {
  .privacy-page { padding-top: 20px; }
  .privacy-page h1 { font-size: 24px; }
  .privacy-page section { padding: 14px 14px; }
}

/* ======================================================================
 * Round 2 (unit E): assignments, roster, grading, key sheets, print.
 * ====================================================================== */

/* ---------- shared ---------- */
.field-error { color: var(--bad); font-size: 12.5px; font-weight: 400; line-height: 1.4; }
.field-error:empty { display: none; }
.as-main { min-width: 0; }
.as-head { margin-bottom: 2px; }
.as-actions { justify-content: flex-end; }
.as-item.is-archived { opacity: .85; }
.problem-list { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.subnav .subnav-refresh { margin-top: 6px; padding-top: 10px; border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; color: var(--muted); font-weight: 400; }
.feedback.partial { color: var(--warn); }
.variant-code { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.statement-options { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-family: var(--font-text); font-size: 15.5px; line-height: 1.45; }
.statement-options li { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 6px; }
.statement-options .key { font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--muted); padding-top: 3px; }
.statement-tf { font-size: 13px; color: var(--muted); }

/* ---------- follow-up parts (Practice and assignments, js/problem.js) ---------- */
.part-locked { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 12px; border: 1px dashed var(--line-2);
  border-radius: 8px; color: var(--muted); font-size: 13.5px; line-height: 1.4; background: transparent; }
.part-locked-tag { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.part-locked .btn { margin-left: auto; }
.part-opened > .part-body, .part-body.part-opened { animation: part-opened 1.4s ease-out; border-radius: 8px; }
@keyframes part-opened { from { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); } to { background: transparent; box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .part-opened > .part-body, .part-body.part-opened { animation: none; } }
/* question builder: read-only follow-up / cond / sample fields of a part (assess-teacher.js frameworkFields) */
.part-extra > summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.part-extra[open] > summary { margin-bottom: 6px; }
.part-extra-rows { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.part-extra-row { display: grid; grid-template-columns: 8.5em minmax(0, 1fr); gap: 2px 10px; padding: 6px 10px; border-top: 1px solid var(--line); }
.part-extra-row:first-child { border-top: 0; }
.part-extra-key { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.part-extra-row .mono { font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.part-extra p { margin: 6px 0 0; }
@media (max-width: 560px) { .part-extra-row { grid-template-columns: minmax(0, 1fr); } .part-extra-key:empty { display: none; } }

/* ---------- student: quiz work view ---------- */
.work-bar { min-height: 34px; }
.work-bar .row { justify-content: flex-end; }
.work-head h2 { overflow-wrap: anywhere; }
.check-note { display: flex; gap: 8px; align-items: baseline; }
.check-note::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); transform: translateY(-1px); }
.timer { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); font-size: 13px; }
.timer:empty { display: none; }
.timer.timer-low { color: var(--bad); background: var(--bad-soft); }
.start-card { max-width: 560px; }
.results-banner strong { font-size: 15px; }
.item-feedback { border-top: 1px solid var(--line); padding-top: 10px; }
.item-feedback .keys { color: var(--ink-2); }
.work-foot .row-between { width: 100%; }
.quiz-statement .row .small { max-width: 46ch; }
.as-intro { max-width: 72ch; }
.as-view .qhead > .row:first-child, .handin-item .qhead > .row:first-child, .keysheet-item .qhead > .row:first-child { flex-wrap: nowrap; align-items: baseline; min-width: 0; }
.as-view .qhead h3, .handin-item .qhead h3, .keysheet-item .qhead h4 { min-width: 0; overflow-wrap: anywhere; }

/* ---------- student: hand-in statement sheet ---------- */
.handin-note { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.handin-sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px 28px; display: flex; flex-direction: column; gap: 18px; }
.handin-head { display: flex; flex-direction: column; gap: 6px; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.handin-head h2 { font-size: 24px; overflow-wrap: anywhere; }
.handin-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13.5px; color: var(--ink-2); }
.handin-meta span:first-child { font-weight: 600; color: var(--ink); }
.handin-item { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.handin-head + .handin-item, .handin-head + .as-intro + .handin-item { border-top: 0; padding-top: 0; }
.handin-item .qhead h3 { font-size: 16.5px; }
.dialog .handin-sheet { border: 0; padding: 0; }

/* ---------- teacher: editor ---------- */
.editor-notes:empty { display: none; }
.item-clamp { font-size: 14.5px !important; max-height: 6.5em; overflow: hidden; color: var(--ink-2); }
.as-settings .divider { margin: 2px 0; }
.aud-list { max-height: 280px; overflow: auto; padding: 2px; }
.aud-list .check { gap: 8px; }
.aud-list .check .small { margin-left: 2px; }
.extensions { padding-top: 4px; }
.as-settings .ext-add { grid-template-columns: minmax(0, 1fr); }
.ext-row { padding: 6px 8px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; }
.ext-row strong { font-weight: 600; }
.qe-preview { position: sticky; top: 76px; }
.part-label-input { width: 64px !important; }
.editor-actions .row { justify-content: flex-end; }

/* ---------- teacher: gradebook ---------- */
.gb-tools { justify-content: flex-end; }
.gb-tools .gb-filter { width: auto; max-width: 280px; }
.gb-status { display: flex; align-items: center; gap: 6px; }
.gb-note .row { gap: 8px 10px; }
.gradebook td:first-child { min-width: 150px; }
.gradebook td.gb-cell:focus-visible { outline-offset: -2px; }
.gb-col { display: inline-block; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.gb-max { text-transform: none; letter-spacing: 0; font-weight: 400; }
.gb-grade { font-variant-numeric: tabular-nums; }
.gb-badge { font-weight: 700; margin-left: 1px; }
.gb-badge.gb-review { color: var(--bad); }
.gb-missing { color: var(--bad); font-size: 12.5px; }
.tbl tr.is-disabled td { color: var(--muted); }

/* ---------- teacher: grading one student ---------- */
.grade-head h3 { overflow-wrap: anywhere; }
.grade-item .part-chips { gap: 6px; }
.chip.unchecked { display: inline-block; white-space: normal; overflow-wrap: anywhere; max-width: 100%; border-radius: 10px; padding: 2px 10px; line-height: 1.45; }
.chip.unchecked code { font-size: 11.5px; }
.student-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; background: var(--surface-2); border-radius: var(--radius-sm); padding: 10px 12px; }
.grade-points { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px; align-items: start; padding-top: 10px; border-top: 1px solid var(--line); }
.points-row { align-items: flex-start; gap: 10px 14px; }
.points-row .row { flex-wrap: nowrap; }
.grade-foot .grade-total { font-size: 15px; }
.grade-foot .row-between > .row { justify-content: flex-end; }

/* ---------- teacher: key sheets ---------- */
.ks-tools .input { width: auto; flex: 1 1 200px; }
.ks-tools select.input { flex: 0 1 200px; }
.keysheets { display: flex; flex-direction: column; gap: 16px; }
.keysheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; display: flex; flex-direction: column; gap: 14px; break-after: page; }
.keysheet-head { display: flex; flex-direction: column; gap: 4px; padding-bottom: 12px; border-bottom: 2px solid var(--ink); }
.keysheet-head h2 { overflow-wrap: anywhere; }
.keysheet-item { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.keysheet-head + .keysheet-item { border-top: 0; padding-top: 0; }
.keysheet-item h4 { font-size: 15.5px; }
.keysheet-key { display: flex; flex-direction: column; gap: 8px; border-left: 3px solid var(--good); padding: 2px 0 2px 12px; font-size: 14px; }

/* ---------- teacher: roster ---------- */
.roster-paste { min-height: 110px; }
.roster-summary { font-weight: 600; font-size: 13.5px; }
.roster-errors { margin: 0; padding-left: 1.2em; color: var(--bad); font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.roster-errors code { margin-left: 6px; color: var(--muted); overflow-wrap: anywhere; }
.roster-rename { padding: 6px 10px; border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; }
.roster-new td { padding-block: 5px; }
.roster-tools .roster-filter { width: auto; }
.roster-table td { vertical-align: middle; }
.roster-table .roster-check { width: 34px; }
.roster-table input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); vertical-align: middle; }
.roster-who { min-width: 170px; }
.roster-chips { margin-top: 4px; gap: 4px; }
.roster-buttons { display: flex; flex-wrap: wrap; gap: 4px; min-width: 250px; }
.credentials .password { font-size: 13.5px; letter-spacing: .02em; color: var(--ink); white-space: nowrap; }
.credentials-body .table-wrap { max-height: 46vh; overflow: auto; }

/* ---------- sign-in slips (eight per A4 page when printed) ---------- */
.signin-slips { display: flex; flex-direction: column; gap: 16px; }
.signin-page { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--surface); border: 1px dashed var(--line-2); }
.signin-slip { padding: 14px 18px; border-right: 1px dashed var(--line-2); border-bottom: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.signin-slip:nth-child(2n) { border-right: 0; }
.slip-brand { font-size: 10.5px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.slip-name { font-family: var(--font-text); font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.slip-fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 12px; margin: 0; font-size: 13px; }
.slip-fields dt { color: var(--muted); }
.slip-fields dd { margin: 0; overflow-wrap: anywhere; }
.slip-fields dd.mono { font-size: 13.5px; }
.slip-fields dt.slip-url-label { grid-column: 1 / -1; margin-top: 2px; }
.slip-fields dd.slip-url { grid-column: 1 / -1; font-size: 11.5px; }
.slip-note { margin-top: auto; font-size: 11.5px; color: var(--ink-2); }
/* editor item rows: the controls wrap instead of squeezing the title column */
.item-row .item-controls { max-width: 300px; }

@media (max-width: 980px) {
  .subnav .subnav-refresh { margin-top: 0; padding-top: 8px; border-top: 0; border-radius: 6px; margin-left: auto; }
  .qe-preview { position: static; }
}
@media (max-width: 560px) {
  .item-row .item-controls { max-width: none; }
  .handin-sheet, .keysheet { padding: 16px; }
  .handin-head h2 { font-size: 21px; }
  .as-actions, .gb-tools, .editor-actions .row, .grade-foot .row-between > .row { justify-content: flex-start; }
  .gb-tools .gb-filter { max-width: 100%; flex: 1 1 100%; }
  .grade-points { grid-template-columns: minmax(0, 1fr); }
  .points-row .row { flex-wrap: wrap; }
  .signin-page { grid-template-columns: minmax(0, 1fr); }
  .signin-slip { border-right: 0; }
  .work-bar .row { justify-content: flex-start; }
  /* the roster table becomes one card per account */
  .roster-table thead { display: none; }
  .roster-table, .roster-table tbody, .roster-table tr { display: block; }
  .roster-table tr { position: relative; padding: 10px 12px 12px 44px; border-bottom: 1px solid var(--line); }
  .roster-table tr:last-child { border-bottom: 0; }
  .tbl.roster-table td { display: inline-block; padding: 0; border: 0; margin: 0 12px 4px 0; font-size: 12.5px; text-align: left; vertical-align: baseline; }
  .tbl.roster-table td.roster-check { position: absolute; left: 12px; top: 11px; margin: 0; }
  .tbl.roster-table td.roster-who { display: block; font-size: 13.5px; }
  .tbl.roster-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); }
  .tbl.roster-table td.roster-actions { display: block; margin: 6px 0 0; }
  .roster-who, .roster-buttons { min-width: 0; }
}

/* ---------- print (keep this block last: it may restate colours) ----------
 * Custom properties need !important: the inline <style> of index.html comes later in the cascade. */
@media print {
  :root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
    color-scheme: light !important;
    --bg: #fff !important; --surface: #fff !important; --surface-2: #f3f5f9 !important; --surface-3: #eceff5 !important;
    --ink: #000 !important; --ink-2: #1a1a1a !important; --muted: #444 !important;
    --line: #bbb !important; --line-2: #999 !important;
    --accent: #1f3f9c !important; --good: #1c7f54 !important; --bad: #bd3a2c !important; --warn: #7a4f06 !important;
  }
  html, body { color: #000 !important; background: #fff !important; }
  .topbar, .tabs, .subnav, .no-print, #toast, .overlay { display: none !important; }
  main, .card { background: #fff !important; box-shadow: none !important; }
  .card { border: 0; }
  .keysheet { break-after: page; }
  .signin-slip { break-inside: avoid; }
  mjx-container { color: #000 !important; }
  main { padding: 0 !important; max-width: none !important; }
  .view-head { display: none !important; }
  .as-layout { display: block !important; }
  .handin-sheet, .keysheet { border: 0 !important; border-radius: 0 !important; padding: 0 !important; background: #fff !important; }
  .handin-item .qhead, .keysheet-item .qhead { break-after: avoid; }
  .keysheet:last-child { break-after: auto; }
  .signin-slips { page: slips; gap: 0; }
  .signin-page { height: 268mm; grid-template-columns: 1fr 1fr !important; grid-template-rows: repeat(4, 1fr); border: 0 !important; break-after: page; }
  .signin-page:last-child { break-after: auto; }
  .signin-slip { border-right: 1px dashed #999 !important; border-bottom: 1px dashed #999 !important; padding: 7mm 8mm; overflow: hidden; }
  /* each slip draws its own cut lines, so an unfilled last page has no empty frame */
  .signin-page .signin-slip:nth-child(-n+2) { border-top: 1px dashed #999 !important; }
  .signin-page .signin-slip:nth-child(2n+1) { border-left: 1px dashed #999 !important; }
  .slip-fields dd.slip-url { font-size: 10.5px; }
  @page slips { size: A4 portrait; margin: 10mm; }
}
