/* Pencil & Sheet staff pages: admin and teacher. Colours follow the parent app (mobile/src/theme.ts). */

:root {
  color-scheme: light;
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-muted: #f0f2f7;
  --text: #101828;
  --text-muted: #667085;
  --text-subtle: #98a2b3;
  --border: #e4e7ec;
  --border-strong: #d0d5dd;
  --primary: #4f46e5;
  --primary-pressed: #4338ca;
  --primary-soft: #eef2ff;
  --on-primary: #ffffff;
  --success: #067647;
  --success-soft: #dcfae6;
  --warning: #b54708;
  --warning-soft: #fef0c7;
  --danger: #c4320a;
  --danger-soft: #fee4e2;
  --info: #175cd3;
  --info-soft: #d1e9ff;
  --series-1: #4f46e5;
  --grid: #eaecf0;
  --scrim: rgba(16, 24, 40, 0.45);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0e1220;
    --surface: #171c2e;
    --surface-muted: #1f2539;
    --text: #f2f4f8;
    --text-muted: #a6aec4;
    --text-subtle: #8790a9;
    --border: #2a3149;
    --border-strong: #3a4260;
    --primary: #8b93ff;
    --primary-pressed: #b9beff;
    --primary-soft: #272d55;
    --on-primary: #0e1220;
    --success: #47cd89;
    --success-soft: #0f2e1f;
    --warning: #fdb022;
    --warning-soft: #3a2e12;
    --danger: #f97066;
    --danger-soft: #3d1714;
    --info: #84caff;
    --info-soft: #102a4c;
    --series-1: #8b93ff;
    --grid: #252b42;
    --scrim: rgba(0, 0, 0, 0.6);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
/* The staff pages are for a laptop or desktop browser only: a narrower window scrolls sideways
   rather than reflowing. */
body {
  min-width: 1180px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body.on-auth { min-width: 0; }  /* the sign-in screens fit a phone (app.js sets the viewport) */
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 8px; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.boot { padding: 80px; text-align: center; color: var(--text-muted); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- layout */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; display: block; flex-shrink: 0; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--text-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-subtle); padding: 14px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--text-muted); font-weight: 500;
}
.nav a:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--primary-soft); color: var(--primary); }
.nav svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: var(--primary);
  color: var(--on-primary); font-size: 11px; font-weight: 700; text-align: center; line-height: 18px; }
.role-switch { margin: auto 0 10px; justify-content: flex-start; gap: 8px; width: 100%; font-size: 13px; }
.role-switch svg { width: 16px; height: 16px; flex: none; }
.role-switch + .sidebar-foot { margin-top: 0; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding: 12px 8px 0; display: flex;
  align-items: center; gap: 10px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-muted); display: grid;
  place-items: center; font-weight: 600; font-size: 13px; color: var(--text-muted); flex: none; }
.who { min-width: 0; flex: 1; }
.who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { font-size: 12px; color: var(--text-muted); text-transform: capitalize; }
.main { min-width: 0; padding: 28px 32px 64px; max-width: 1280px; width: 100%; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 240px; }
.page-head p { color: var(--text-muted); margin: 4px 0 0; }
.crumbs { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.crumbs a { color: var(--text-muted); }


/* ---------------------------------------------------------------- building blocks */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { flex: 1; }
.card-head p { margin: 0; color: var(--text-muted); font-size: 13px; flex-basis: 100%; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.muted { color: var(--text-muted); }
.subtle { color: var(--text-subtle); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.pre { white-space: pre-wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font-weight: 550; cursor: pointer;
  white-space: nowrap; line-height: 20px; text-decoration: none !important;
}
.btn:hover { background: var(--surface-muted); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-pressed); border-color: var(--primary-pressed); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.good { color: var(--success); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-muted); }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.btn.icon { padding: 6px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.input, select.input, textarea.input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); min-height: 38px;
}
textarea.input { min-height: 80px; resize: vertical; line-height: 1.45; }
.input:focus { outline: 2px solid var(--primary-soft); border-color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 13px; font-weight: 550; }
.field .hint { font-size: 12px; color: var(--text-muted); }
.form { display: flex; flex-direction: column; gap: 14px; }
.inline-fields { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.inline-fields .field { min-width: 160px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--text-subtle); }
.search .input { padding-left: 32px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }

.seg { display: inline-flex; background: var(--surface-muted); border-radius: var(--radius-sm); padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; cursor: pointer; color: var(--text-muted); font-weight: 550; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg .n { color: var(--text-subtle); font-weight: 500; margin-left: 4px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: 12px;
  font-weight: 600; background: var(--surface-muted); color: var(--text-muted); white-space: nowrap; line-height: 20px; }
.badge.good { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.brand { background: var(--primary-soft); color: var(--primary); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); display: inline-block; flex: none; }

table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); padding: 10px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-muted); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tr.link { cursor: pointer; }
.table tr.link:hover td { background: var(--surface-muted); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.table th:first-child { border-top-left-radius: 0; }

.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty svg { width: 36px; height: 36px; color: var(--text-subtle); margin-bottom: 8px; }
.empty h3 { color: var(--text); margin-bottom: 4px; }
.error-box { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius-sm); padding: 10px 12px; }
.note { background: var(--surface-muted); border-radius: var(--radius-sm); padding: 10px 12px; }
.note.info { background: var(--info-soft); color: var(--info); }
.note.warn { background: var(--warning-soft); color: var(--warning); }
.problems { margin: 6px 0 0; padding-left: 18px; color: var(--danger); font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--surface-muted), var(--border), var(--surface-muted));
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius-sm); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { padding: 16px 18px; }
.kpi .label { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.kpi.link { cursor: pointer; }
.kpi.link:hover { border-color: var(--primary); }
.delta-up { color: var(--success); font-weight: 600; }
.delta-down { color: var(--danger); font-weight: 600; }

/* Charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--text-muted); font-size: 11px; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart .bar { fill: var(--series-1); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover + .bar, .chart .bar.hover { opacity: .75; }
.tooltip { position: absolute; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px;
  border-radius: 6px; font-size: 12px; white-space: nowrap; transform: translate(-50%, calc(-100% - 8px)); z-index: 5; box-shadow: var(--shadow-lg); }
.tooltip b { font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 150px 1fr 64px; align-items: center; gap: 10px; padding: 5px 0; }
.hbar .track { height: 14px; background: var(--surface-muted); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.hbar .val small { color: var(--text-muted); font-weight: 500; }
.heat td.cell { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Lists and items */
.list > * + * { border-top: 1px solid var(--border); }
.item { padding: 14px 20px; display: flex; gap: 14px; align-items: flex-start; }
.item.link { cursor: pointer; }
.item.link:hover { background: var(--surface-muted); }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 600; }
.item .meta { font-size: 12px; color: var(--text-muted); }
.clamp { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread .title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary); margin-right: 8px; vertical-align: 1px; }

/* Questions */
.q { padding: 16px 20px; display: flex; gap: 14px; }
.q + .q { border-top: 1px solid var(--border); }
.q .body { flex: 1; min-width: 0; }
.q .stem { font-size: 16px; font-weight: 500; line-height: 1.45; }
.drawing { display: inline-block; background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
  margin-top: 8px; line-height: 0; max-width: 100%; overflow-x: auto; }
.drawing svg { display: block; }
.passage { border: 1px solid var(--border); border-radius: 6px; margin-bottom: 8px; background: var(--surface-muted); }
.passage > summary { cursor: pointer; padding: 6px 10px; font-size: 13px; color: var(--text-muted); }
.passage > summary b { color: var(--text); font-weight: 600; }
.passage .text { padding: 2px 12px 8px; font-size: 14px; line-height: 1.5; max-width: 70ch; }
.passage .text p { margin: 6px 0 0; }
.q .opts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.q .opt { border: 1px solid var(--border); border-radius: 6px; padding: 2px 10px; }
.q .opt.right { border-color: var(--success); background: var(--success-soft); color: var(--success); font-weight: 600; }
.q .answer { margin-top: 6px; }
.q .answer b { color: var(--success); }
.q .facts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.q .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.q.decided-approve { box-shadow: inset 3px 0 0 var(--success); }
.q.decided-reject { box-shadow: inset 3px 0 0 var(--danger); }
.q.decided-edit { box-shadow: inset 3px 0 0 var(--info); }
.note.verdict { border: 1px solid var(--border); }
.note.verdict .row { align-items: center; }
.note.verdict-approve { border-color: color-mix(in srgb, var(--success) 40%, var(--border)); background: color-mix(in srgb, var(--success) 8%, var(--surface)); }
.note.verdict-reject { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: color-mix(in srgb, var(--danger) 8%, var(--surface)); }
.q.retired { opacity: .6; }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.diff > div { border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; }
.diff .was { background: var(--danger-soft); }
.diff .now { background: var(--success-soft); }
.diff .lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; opacity: .7; display: block; }
.comment { border-left: 3px solid var(--border-strong); padding: 2px 0 2px 10px; margin-top: 8px; font-size: 13px; }

.outcome { padding: 16px 20px; }
.outcome + .outcome { border-top: 1px solid var(--border); }
.outcome .code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; font-weight: 600; color: var(--primary); }
.bench { border-left: 2px solid var(--border); margin: 10px 0 0 2px; padding: 4px 0 4px 14px; }
.bench .scope { font-size: 13px; color: var(--text-muted); }
.thread { background: var(--surface-muted); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 8px; font-size: 13px; }
.thread .reply { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.thread.resolved { opacity: .7; }

/* Progress */
.progress { height: 8px; background: var(--surface-muted); border-radius: 99px; overflow: hidden; display: flex; gap: 2px; }
.progress > span { height: 100%; }
.progress .p-approve { background: var(--success); }
.progress .p-reject { background: var(--danger); }
.progress .p-edit { background: var(--info); }
.progress .p-done { background: var(--primary); }

/* Messages (support) */
.messages { display: flex; flex-direction: column; gap: 12px; padding: 20px; }
.msg { max-width: 80%; border-radius: 14px; padding: 10px 14px; white-space: pre-wrap; }
.msg.parent { background: var(--surface-muted); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.team { background: var(--primary); color: var(--on-primary); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .meta { font-size: 11px; opacity: .75; margin-top: 4px; }
.composer { border-top: 1px solid var(--border); padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.answers-table td.ok { color: var(--success); font-weight: 600; }
.answers-table td.no { color: var(--danger); font-weight: 600; }
.photo { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }

/* Modal and toasts */
.modal-back { position: fixed; inset: 0; background: var(--scrim); z-index: 50; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(640px, 100%);
  max-height: calc(100vh - 32px); display: flex; flex-direction: column; }
.modal.wide { width: min(860px, 100%); }
.modal-head { padding: 18px 22px 0; display: flex; align-items: flex-start; gap: 12px; }
.modal-head h2 { flex: 1; font-size: 18px; }
.modal-head p { color: var(--text-muted); margin: 4px 0 0; font-size: 13px; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
#toasts { position: fixed; bottom: 20px; left: 50%; translate: -50% 0; z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-weight: 500; animation: rise .2s ease; max-width: 90vw; }
.toast.bad { background: var(--danger); color: #fff; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Sign in */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 24px 16px; }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth h1 { margin: 14px 0 4px; }
.auth .lede { color: var(--text-muted); margin-bottom: 18px; text-wrap: pretty; }
.auth a.btn { justify-content: center; text-decoration: none; }
.or { display: flex; align-items: center; gap: 10px; color: var(--text-subtle); font-size: 12px; margin: 6px 0; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Preview of a printed question */
.preview { border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-muted); }
.preview .printed { font-size: 16px; }
.preview .box { display: inline-block; min-width: 64px; height: 30px; border: 2px solid var(--text-subtle); border-radius: 6px; vertical-align: middle; margin-left: 8px; }
.opt-row { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 8px; align-items: center; }
.opt-row .lab { font-weight: 700; color: var(--text-muted); text-align: center; }
.sticky-bar { position: sticky; bottom: 0; background: var(--surface); border-top: 1px solid var(--border); padding: 12px 20px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; border-radius: 0 0 var(--radius) var(--radius); z-index: 3; }

/* ------------------------------------------------------------------ bank review: outcome and difficulty groups */
.grp > summary, .lvl > summary { list-style: none; cursor: pointer; }
.grp > summary::-webkit-details-marker, .lvl > summary::-webkit-details-marker { display: none; }
.grp { border-top: 1px solid var(--border); }
.grp:first-child { border-top: 0; }
.grp > summary { display: flex; gap: 10px; align-items: flex-start; padding: 14px 20px; }
.grp > summary:hover, .lvl > summary:hover { background: var(--surface-muted); }
.chev { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--text-subtle); transition: transform .15s; }
.chev svg { width: 18px; height: 18px; }
details[open] > summary > .chev { transform: rotate(90deg); }
.grp .code { font-family: ui-monospace, Menlo, monospace; font-size: 12px; font-weight: 600; color: var(--primary); }
.grp-body { padding: 0 0 8px; }
.lvl { margin: 0 20px 10px 48px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.lvl > summary { display: flex; gap: 8px; align-items: center; padding: 8px 12px; border-radius: var(--radius-sm); font-weight: 600; }
.lvl[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.lvl .q { padding: 14px 16px; }
.checks { margin-top: 8px; padding: 8px 10px; background: var(--surface-muted); border-radius: var(--radius-sm); }
.checks b { color: var(--text); font-weight: 600; }
.checks p { margin: 4px 0 0; }
.mini-progress { width: 64px; height: 6px; border-radius: 99px; background: var(--surface-muted); overflow: hidden; flex: none; }
.mini-progress span { display: block; height: 100%; background: var(--success); }
.similar { margin-top: 10px; border-left: 3px solid var(--primary-soft); padding: 8px 12px; background: var(--surface-muted); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.similar ol { margin: 6px 0 0; padding-left: 20px; }
.similar li { margin: 3px 0; }
.similar li .ans { color: var(--success); font-weight: 600; }
.similar li.held { color: var(--text-muted); }
.family-note { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: 13px; }
.family-note svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1; min-width: 180px; }
.brief { max-height: 280px; overflow: auto; font-family: ui-monospace, Menlo, monospace; font-size: 12px; white-space: pre; }
.note svg, .badge svg { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.badge svg { width: 12px; height: 12px; vertical-align: -1px; }

/* Handwriting labels: each answer box as the model saw it, with a field for what was really written. */
.label-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.label-box { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.label-box .prompt { white-space: pre-wrap; max-height: 5.6em; overflow: hidden; }
.label-box img { display: block; width: 100%; height: 84px; object-fit: contain; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-sm); }
.label-box.changed { border-color: var(--warning); }
.label-box .badge.differs { background: var(--warning-soft); color: var(--warning); }
.help-text { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.help-text h3:not(:first-child) { margin-top: 10px; }
.help-text ol, .help-text ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.help-text .brief { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.page-head .title-row { display: flex; align-items: center; gap: 4px; }
.page-head .help-btn { padding: 4px; color: var(--text-muted); }
.page-head .help-btn:hover { color: var(--primary); }
.page-head .help-btn svg { width: 24px; height: 24px; }
.welcome { display: flex; align-items: center; gap: 10px; background: var(--primary-soft); color: var(--primary-pressed);
  border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 16px; font-weight: 500; }
.welcome a { color: inherit; text-decoration: underline; }
.welcome .wave { font-size: 18px; }

/* Sample sheets: one sheet at a time, as a picture, with arrows either side */
.viewer { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; gap: 12px; align-items: center; }
.nav-arrow { width: 44px; height: 96px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  cursor: pointer; display: grid; place-items: center; color: var(--text-muted); box-shadow: var(--shadow); }
.nav-arrow:hover:not(:disabled) { background: var(--surface-muted); color: var(--text); }
.nav-arrow:disabled { opacity: .35; cursor: default; }
.nav-arrow svg { width: 24px; height: 24px; }
.sheet-frame { background: var(--surface-muted); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  display: grid; place-items: center; min-height: 640px; }
.sheet-frame img { display: block; width: 100%; max-width: 620px; aspect-ratio: 210 / 297; background: #fff; border-radius: 4px;
  box-shadow: var(--shadow-lg); user-select: none; -webkit-user-drag: none; pointer-events: none; }
.sheet-frame .skeleton { width: 100%; max-width: 620px; aspect-ratio: 210 / 297; }
/* Fit to screen: the whole sheet in view, however tall the window */
.sheet-frame.fit { min-height: 0; }
.sheet-frame.fit img, .sheet-frame.fit .skeleton { width: auto; max-width: 100%; height: calc(100vh - 150px); min-height: 420px; }
/* The sheet's questions beside it */
.sheet-questions { list-style: none; margin: 0; padding: 0; }
.sheet-questions li { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); }
.sheet-questions .qnum { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--surface-muted);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; }
.sheet-questions .stem { font-weight: 500; }
.sheet-questions .opts { margin-top: 4px; }
.sheet-questions .thread { margin-top: 8px; }
.sheet-questions [data-raise] { margin-top: 6px; padding-left: 0; }

/* Messages between a teacher and the team */
.msg.them { background: var(--surface-muted); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: var(--primary); color: var(--on-primary); align-self: flex-end; border-bottom-right-radius: 4px; }
.msg .who { font-size: 12px; font-weight: 600; opacity: .85; margin-bottom: 2px; }

/* A bank review: the foot of a level, and one question at a time */
.lvl-foot { padding: 10px 20px 14px; border-top: 1px solid var(--border); }
.focus-head { display: flex; gap: 12px; align-items: flex-start; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.focus-foot { display: flex; gap: 8px; align-items: center; padding: 12px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* Raised by me */
.raised-item { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; }
.raised-item.is-new { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary-soft); }
.raised-item .thread { margin-top: 8px; }
/* The logo with the name under it, centred at the top of every sign-in card and linking to the
   home page; the heading and everything under it stay on the left. */
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center;
  padding-bottom: 20px; margin-bottom: 4px; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none !important; border-radius: var(--radius) var(--radius) 0 0; }
.auth-brand:hover span { color: var(--primary); }
.auth-brand:focus-visible { outline: 2px solid var(--primary); outline-offset: 4px; }
.auth-brand .brand-mark { width: 88px; height: 88px; border-radius: 20px; }
.auth-brand span { font-weight: 650; font-size: 26px; letter-spacing: -0.015em; line-height: 1.2; }
/* "Sign in with Google" in Google's own button style: white, a grey edge, dark type and the
   four-colour G (dark: Google's dark button). */
.btn.google { gap: 10px; background: #fff; color: #1f1f1f; border: 1px solid #747775; font-weight: 500; }
.btn.google:hover { background: #f7f8f8; }
.btn.google svg { width: 18px; height: 18px; flex: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.google { background: #131314; color: #e3e3e3; border-color: #8e918f; } }
:root[data-theme="dark"] .btn.google { background: #131314; color: #e3e3e3; border-color: #8e918f; }
/* The sign-in screen: the form and "New to Pencil & Sheet?" side by side, stacked on a phone. */
.auth .card.auth-wide { width: min(880px, 100%); padding: 0; overflow: hidden; }
.auth-wide .auth-brand { padding: 26px 24px 20px; margin: 0; }
.auth-panes { display: grid; }
.auth-pane { padding: 28px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.auth-pane h1, .auth-pane h2 { margin: 0; font-size: 22px; }
.auth-pane .lede { margin: -8px 0 4px; }
.auth-new { background: var(--primary-soft); border-top: 1px solid var(--border); }
.auth-new .small { margin: 0; }
.auth-new .btn.ghost { background: var(--surface); border: 1px solid var(--border); }
.auth-panes.no-account .auth-new { order: -1; border-top: 0; border-bottom: 1px solid var(--border); }
@media (min-width: 760px) {
  .auth-panes { grid-template-columns: 1fr 1fr; }
  .auth-new, .auth-panes.no-account .auth-new { order: 0; border-top: 0; border-bottom: 0; border-left: 1px solid var(--border); }
}
.auth-notice { background: var(--info-soft); color: var(--info); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 13px; font-weight: 600; }
.auth-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: step; }
.auth-steps li { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: center; counter-increment: step; }
.auth-steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--primary); font-weight: 700; font-size: 13px; }
.stores-soon { margin: -6px 0 0; text-align: center; font-size: 12px; color: var(--text-muted); }
/* The app stores' badges on "Get the app": black, white type, a thin edge, the store's own mark. */
.stores { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.store { display: flex; align-items: center; gap: 10px; min-width: 0; height: 52px; padding: 0 14px; border-radius: 10px;
  background: #000; color: #fff; border: 1px solid #a6a6a6; text-decoration: none !important; }
.store svg { width: 24px; height: 24px; flex: none; }
.store .words { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.store small { font-size: 10px; letter-spacing: .02em; opacity: .85; white-space: nowrap; }
.store b { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; }
a.store:hover { filter: brightness(1.25); }
@media (max-width: 420px) {   /* two badges side by side on a phone */
  .stores { gap: 8px; }
  .store { gap: 8px; padding: 0 10px; }
  .store svg { width: 20px; height: 20px; }
  .store small { font-size: 9px; }
  .store b { font-size: 15px; }
}
@media (max-width: 359px) { .stores { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .store { border-color: #5b6380; } }
