/* ProActiveScore — design system
   Calm, editorial surfaces; one accent per space (Studio = indigo, Classroom = emerald). */

:root {
  --bg: #f6f4ef;
  --bg-elev: #fbfaf7;
  --surface: #ffffff;
  --surface-2: #f3f1ea;
  --line: #e7e3d9;
  --line-strong: #d6d0c2;
  --ink: #1c1a16;
  --ink-2: #4a463d;
  --ink-3: #8a8474;
  --accent: #4b45c6;
  --accent-ink: #ffffff;
  --accent-soft: #ecebfb;
  --accent-line: #cfcdf4;
  --good: #1f8a5b;
  --good-soft: #e3f4ea;
  --warn: #b7791f;
  --warn-soft: #fbf0dc;
  --bad: #c2413b;
  --bad-soft: #fbe6e4;
  --info-soft: #e7eefb;
  --shadow-sm: 0 1px 2px rgba(28, 26, 22, .05);
  --shadow: 0 1px 2px rgba(28, 26, 22, .04), 0 8px 24px -12px rgba(28, 26, 22, .12);
  --shadow-lg: 0 24px 60px -24px rgba(28, 26, 22, .25);
  --radius: 14px;
  --radius-sm: 9px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Fraunces", Georgia, "Times New Roman", serif;
  --sidebar: 264px;
}

.space-classroom {
  --accent: #0f7a63;
  --accent-soft: #e2f3ee;
  --accent-line: #bfe3d8;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14130f;
    --bg-elev: #1a1915;
    --surface: #1f1e19;
    --surface-2: #26241e;
    --line: #2f2d26;
    --line-strong: #3d3a31;
    --ink: #f1ede3;
    --ink-2: #c9c3b4;
    --ink-3: #8f8979;
    --accent: #8f8af0;
    --accent-ink: #14130f;
    --accent-soft: #26244a;
    --accent-line: #3b3877;
    --good: #4cc38a;
    --good-soft: #173526;
    --warn: #e0a84a;
    --warn-soft: #3a2d15;
    --bad: #ef7a73;
    --bad-soft: #3d1c1a;
    --info-soft: #1d2638;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 60px -24px rgba(0, 0, 0, .7);
  }
  :root:not([data-theme="light"]) .space-classroom {
    --accent: #4fd1ae;
    --accent-soft: #143329;
    --accent-line: #1f5a48;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.55 var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); }
h1 { font: 500 clamp(26px, 3vw, 34px)/1.15 var(--display); letter-spacing: -.01em; font-variation-settings: "opsz" 72; }
h2 { font: 600 17px/1.3 var(--font); letter-spacing: -.005em; }
h3 { font: 600 15px/1.35 var(--font); }
p { margin: 0 0 .8em; }
small, .muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.serif { font-family: var(--display); }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- shell */

.shell {
  display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh;
  background: linear-gradient(to right, var(--bg-elev) calc(var(--sidebar) - 1px), var(--line) calc(var(--sidebar) - 1px) var(--sidebar), transparent var(--sidebar));
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 22px 16px 16px;
  background: var(--bg-elev);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 16px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: var(--ink); color: var(--bg);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-name { font: 600 19px/1 var(--display); letter-spacing: -.01em; }
.brand-space { display: block; font: 600 10.5px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-top: 5px; }

.nav-label { font: 600 11px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); padding: 18px 10px 8px; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 9px;
  color: var(--ink-2); font-weight: 500; font-size: 14px;
}
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.nav a.active svg { color: var(--accent); }
.nav .count { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.course-chip {
  margin: 4px 0 2px; padding: 12px; border-radius: 12px;
  background: var(--accent-soft); border: 1px solid var(--accent-line);
}
.course-chip .code { font: 600 11px/1 var(--font); letter-spacing: .08em; color: var(--accent); text-transform: uppercase; }
.course-chip .title { font: 500 15px/1.3 var(--display); margin-top: 6px; color: var(--ink); }

.sidebar-foot { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font: 600 12.5px/1 var(--font); letter-spacing: .02em;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.who { min-width: 0; line-height: 1.25; }
.who strong { display: block; font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who span { font-size: 12px; color: var(--ink-3); }
.sidebar-foot form { margin-left: auto; }
.icon-btn {
  margin-left: auto; width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center;
  border: 0; background: transparent; color: var(--ink-3); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

.main { min-width: 0; padding: 34px clamp(18px, 4vw, 52px) 80px; }
.page { max-width: 1180px; margin: 0 auto; }
.page.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 26px; }
.eyebrow { font: 600 11.5px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; display: flex; gap: 8px; align-items: center; }
.eyebrow a { color: inherit; }
.page-head p.lede { color: var(--ink-2); margin: 8px 0 0; max-width: 60ch; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.topbar { display: none; }

/* ---------------------------------------------------------------- building blocks */

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 22px 24px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.card-head p { margin: 3px 0 0; font-size: 13px; color: var(--ink-3); }
.card-body { padding: 20px 24px; }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--line); background: var(--bg-elev); border-radius: 0 0 var(--radius) var(--radius); display: flex; justify-content: flex-end; gap: 10px; }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); align-items: start; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.spacer { flex: 1; }
.mt { margin-top: 20px; }
.mt-lg { margin-top: 32px; }

.stat { padding: 20px 22px; }
.stat .label { font-size: 12.5px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.stat .label svg { width: 15px; height: 15px; color: var(--accent); }
.stat .value { font: 500 32px/1.1 var(--display); margin-top: 10px; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat .value small { font: 500 14px var(--font); color: var(--ink-3); margin-left: 3px; }
.stat .hint { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }

/* buttons */
.btn {
  --b: var(--ink); --bi: var(--bg);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  background: var(--b); color: var(--bi); font: 600 14px/1 var(--font); cursor: pointer; white-space: nowrap;
  transition: transform .06s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { text-decoration: none; box-shadow: 0 6px 16px -8px rgba(28, 26, 22, .45); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn-accent { --b: var(--accent); --bi: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn-quiet { background: transparent; color: var(--ink-2); }
.btn-quiet:hover { background: var(--surface-2); box-shadow: none; }
.btn-danger { background: transparent; color: var(--bad); border-color: var(--line-strong); }
.btn-danger:hover { background: var(--bad-soft); box-shadow: none; }
.btn-good { --b: var(--good); --bi: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }

/* badges */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 99px;
  font: 600 11.5px/1 var(--font); letter-spacing: .01em; white-space: nowrap;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.plain::before { display: none; }
.badge.accent, .badge.open, .badge.approved { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.upcoming, .badge.info { background: var(--info-soft); color: #3b64b5; border-color: transparent; }
.badge.pending, .badge.warn, .badge.draft { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.rejected, .badge.bad, .badge.absent { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.closed { background: var(--surface-2); color: var(--ink-3); }
.badge.present { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.excused { background: var(--info-soft); color: #3b64b5; border-color: transparent; }
.badge.ai { background: linear-gradient(90deg, var(--accent-soft), var(--info-soft)); color: var(--accent); border-color: transparent; }
.badge.ai::before { display: none; }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font: 600 11.5px/1 var(--font); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3);
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-elev); white-space: nowrap;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--bg-elev); }
.table .right { text-align: right; }
.table .center { text-align: center; }
.person { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.person .avatar { width: 30px; height: 30px; font-size: 11px; }
.person strong { display: block; font-weight: 600; font-size: 14px; }
.person span { font-size: 12.5px; color: var(--ink-3); }

/* forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.field .errors { font-size: 12.5px; color: var(--bad); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=url], input[type=search],
input[type=datetime-local], input[type=file], select, textarea {
  width: 100%; font: 400 14.5px/1.4 var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 9px 12px; transition: border-color .15s ease, box-shadow .15s ease;
}
input[type=file] { padding: 7px 10px; background: var(--bg-elev); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--bad); }
.form-errors { background: var(--bad-soft); color: var(--bad); padding: 10px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 16px; }
.form-errors ul { margin: 0; padding-left: 18px; }
.radio-row { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-row label { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line-strong); border-radius: 9px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.radio-row label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.radio-row input { accent-color: var(--accent); margin: 0; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { flex: 1 1 160px; }

/* segmented filter */
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; }
.segmented a { padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.segmented a:hover { text-decoration: none; color: var(--ink); }
.segmented a.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented .n { font-weight: 500; opacity: .7; margin-left: 4px; }

/* messages */
.toasts { position: fixed; right: 22px; bottom: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 50; max-width: min(420px, calc(100vw - 44px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg); font-size: 14px;
  animation: toast-in .35s cubic-bezier(.2, .9, .3, 1.2);
}
.toast svg { margin-top: 1px; }
.toast.success svg { color: #6fe0a8; }
.toast.warning svg { color: #f3c16b; }
.toast.error svg { color: #ff8f86; }
.toast button { margin-left: auto; background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 0 0 0 8px; font-size: 18px; line-height: 1; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* empty states */
.empty { text-align: center; padding: 48px 24px; color: var(--ink-3); }
.empty .art { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--accent-soft); color: var(--accent); }
.empty .art svg { width: 26px; height: 26px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; font: 500 19px var(--display); }
.empty p { max-width: 42ch; margin: 0 auto 16px; }

/* progress bars */
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .6s cubic-bezier(.2, .8, .2, 1); }
.bar.good > span { background: var(--good); }
.bar.warn > span { background: var(--warn); }
.bar.bad > span { background: var(--bad); }

/* score ring */
.ring { position: relative; width: var(--size, 132px); height: var(--size, 132px); flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-2); }
.ring .fill { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 1s cubic-bezier(.2, .8, .2, 1); }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .score { font: 500 calc(var(--size, 132px) * .27)/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring .of { display: block; font: 500 12px/1 var(--font); color: var(--ink-3); margin-top: 4px; }

/* component breakdown */
.breakdown { display: flex; flex-direction: column; gap: 16px; }
.breakdown .item .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 7px; }
.breakdown .item .name { font-weight: 600; font-size: 14px; }
.breakdown .item .src { font-size: 12px; color: var(--ink-3); margin-left: 6px; font-weight: 500; }
.breakdown .item .pts { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; }
.breakdown .item .pts small { font-weight: 500; }
.ledger { border-top: 1px dashed var(--line-strong); margin-top: 6px; padding-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.ledger .line { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }
.ledger .line.total { font-weight: 700; font-size: 15px; padding-top: 8px; border-top: 1px solid var(--line); }
.plus { color: var(--good); font-weight: 600; }
.minus { color: var(--bad); font-weight: 600; }

/* course cards */
.course-card { display: flex; flex-direction: column; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease; color: var(--ink); }
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); text-decoration: none; }
.course-card .cover {
  height: 92px; position: relative; overflow: hidden;
  background:
    radial-gradient(120% 140% at 100% 0%, color-mix(in oklab, var(--accent) 55%, transparent) 0%, transparent 55%),
    radial-gradient(90% 120% at 0% 100%, color-mix(in oklab, #e8a74a 35%, transparent) 0%, transparent 60%),
    var(--accent-soft);
}
.course-card .cover .code { position: absolute; left: 20px; bottom: 14px; font: 600 12px/1 var(--font); letter-spacing: .1em; color: var(--ink); background: var(--surface); padding: 6px 9px; border-radius: 7px; box-shadow: var(--shadow-sm); }
.course-card .body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.course-card .body h3 { font: 500 20px/1.25 var(--display); }
.course-card .meta { display: flex; gap: 16px; color: var(--ink-3); font-size: 13px; margin-top: auto; }
.course-card .meta span { display: inline-flex; align-items: center; gap: 6px; }
.course-card .meta svg { width: 15px; height: 15px; }
.new-card { display: grid; place-items: center; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); min-height: 230px; color: var(--ink-3); font-weight: 600; transition: all .2s ease; }
.new-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); text-decoration: none; }
.new-card .plus-ico { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); margin: 0 auto 10px; }

/* hero (student) */
.hero {
  position: relative; overflow: hidden; padding: 28px 30px;
  background:
    radial-gradient(70% 120% at 100% 0%, color-mix(in oklab, var(--accent) 22%, transparent), transparent 60%),
    radial-gradient(60% 100% at 0% 100%, color-mix(in oklab, #e8a74a 16%, transparent), transparent 60%),
    var(--surface);
}
.hero-grid { display: grid; grid-template-columns: auto 1fr; gap: 30px; align-items: center; }

/* histogram */
.histo { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-items: end; height: 150px; padding-top: 8px; }
.histo .col { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.histo .b { width: 100%; border-radius: 8px 8px 3px 3px; background: linear-gradient(180deg, var(--accent), color-mix(in oklab, var(--accent) 60%, var(--bg))); min-height: 3px; }
.histo .n { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.histo .l { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* list rows */
.list { display: flex; flex-direction: column; }
.list .li { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list .li:last-child { border-bottom: 0; }
a.li:hover { background: var(--bg-elev); text-decoration: none; }
.li .grow { flex: 1; min-width: 0; }
.li .title { font-weight: 600; font-size: 14.5px; }
.li .sub { font-size: 13px; color: var(--ink-3); }
.week-tag { width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center; text-align: center; flex: none; background: var(--surface-2); border: 1px solid var(--line); line-height: 1; }
.week-tag small { display: block; font: 600 9.5px/1 var(--font); letter-spacing: .1em; color: var(--ink-3); }
.week-tag b { font: 500 18px/1 var(--display); }

/* questions (teacher review) */
.q-card { padding: 18px 22px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: auto 1fr auto; gap: 14px; }
.q-card:last-child { border-bottom: 0; }
.q-card .q-text { font-weight: 500; margin-bottom: 10px; white-space: pre-line; }
.q-card .choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; font-size: 13.5px; color: var(--ink-2); }
.q-card .choices .c { display: flex; gap: 8px; align-items: flex-start; }
.q-card .choices .c.ok { color: var(--good); font-weight: 600; }
.q-card .choices .c svg { width: 15px; height: 15px; margin-top: 2px; }
.q-card .expl { font-size: 13px; color: var(--ink-3); margin-top: 10px; font-style: italic; }
.q-card input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent); margin-top: 3px; }
.q-card .q-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }

/* quiz taking */
.quiz-bar {
  position: sticky; top: 0; z-index: 10; margin: -34px calc(-1 * clamp(18px, 4vw, 52px)) 28px;
  padding: 14px clamp(18px, 4vw, 52px); background: color-mix(in oklab, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--line);
}
.quiz-bar .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 18px; }
.timer {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line-strong); font: 600 15px/1 var(--font); font-variant-numeric: tabular-nums;
}
.timer.low { color: var(--bad); border-color: var(--bad); background: var(--bad-soft); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px var(--bad-soft); } }
.question { padding: 26px 28px; margin-bottom: 18px; }
.question .qn { font: 600 12px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.question .qt { font: 500 19px/1.45 var(--display); margin-bottom: 18px; white-space: pre-line; }
.options { display: grid; gap: 10px; }
.options.tf { grid-template-columns: 1fr 1fr; }
.option {
  position: relative; display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border: 1.5px solid var(--line-strong); border-radius: 12px; cursor: pointer; background: var(--surface);
  transition: border-color .15s ease, background .15s ease, transform .06s ease;
}
.option:hover { border-color: var(--accent-line); background: var(--bg-elev); }
.option:active { transform: scale(.995); }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .key { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; font: 700 12.5px/1 var(--font); background: var(--surface-2); color: var(--ink-2); transition: all .15s ease; }
.option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.option:has(input:checked) .key { background: var(--accent); color: var(--accent-ink); }
.option:has(input:focus-visible) { box-shadow: 0 0 0 4px var(--accent-soft); }
.saved-dot { font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.saved-dot.ok { color: var(--good); }

/* result review */
.review-item { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.review-item:last-child { border-bottom: 0; }
.review-item .opt { display: flex; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; font-size: 14px; }
.review-item .opt.right { background: var(--good-soft); color: var(--good); font-weight: 600; }
.review-item .opt.wrong { background: var(--bad-soft); color: var(--bad); text-decoration: line-through; }

/* attendance marking */
.att-toggle { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border-radius: 10px; border: 1px solid var(--line); }
.att-toggle label { position: relative; cursor: pointer; }
.att-toggle input { position: absolute; opacity: 0; }
.att-toggle span { display: inline-block; padding: 6px 12px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--ink-3); transition: all .12s ease; }
.att-toggle input:checked + span.p { background: var(--good); color: #fff; }
.att-toggle input:checked + span.a { background: var(--bad); color: #fff; }
.att-toggle input:checked + span.e { background: #3b64b5; color: #fff; }
.att-toggle input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* gradebook */
.gb th, .gb td { padding: 10px 12px; }
.gb th:first-child, .gb td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.gb thead th:first-child { background: var(--bg-elev); }
.gb .comp-h { text-align: center; }
.gb .comp-h small { display: block; font-weight: 500; text-transform: none; letter-spacing: 0; margin-top: 4px; }
.gb input.mark { width: 70px; text-align: center; padding: 6px 8px; font-variant-numeric: tabular-nums; border-radius: 8px; }
.gb .computed { text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.gb tr.gb-group th { position: static; background: var(--accent-soft); color: var(--ink); text-align: left; padding: 9px 12px; border-top: 2px solid var(--accent-line); text-transform: none; letter-spacing: 0; }
.gb tr.gb-group .gb-group-label { position: sticky; left: 12px; display: inline-flex; align-items: baseline; gap: 12px; }
.gb tr.gb-group .gb-group-name { font-size: 14px; font-weight: 700; }
.gb tr.gb-group .muted { font-size: 12.5px; font-weight: 500; }
.cc-pill { display: inline-flex; min-width: 58px; justify-content: center; padding: 5px 10px; border-radius: 99px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 14px; }
.cc-pill.good { background: var(--good-soft); color: var(--good); }
.cc-pill.warn { background: var(--warn-soft); color: var(--warn); }
.cc-pill.bad { background: var(--bad-soft); color: var(--bad); }

/* scheme */
.comp-row { display: grid; grid-template-columns: 1fr auto auto; gap: 16px; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.comp-row:last-child { border-bottom: 0; }
.comp-row .pts { font: 500 22px/1 var(--display); font-variant-numeric: tabular-nums; }
.comp-row .pts small { font: 500 12px var(--font); color: var(--ink-3); }
.scheme-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; gap: 3px; margin: 4px 0 14px; }
.scheme-bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 14px; color: var(--ink-2); }
.callout svg { color: var(--accent); margin-top: 2px; }
.callout.warn { background: var(--warn-soft); border-color: transparent; }
.callout.warn svg { color: var(--warn); }

details.disclosure summary { cursor: pointer; list-style: none; }
details.disclosure summary::-webkit-details-marker { display: none; }

/* ---------------------------------------------------------------- auth */

.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art {
  position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between;
  color: #f6f4ef; background: #16142e;
}
.auth-art::before {
  content: ""; position: absolute; inset: -20%;
  background:
    radial-gradient(40% 40% at 20% 30%, rgba(111, 104, 240, .55), transparent 70%),
    radial-gradient(35% 35% at 80% 70%, rgba(232, 167, 74, .45), transparent 70%),
    radial-gradient(30% 30% at 70% 20%, rgba(38, 190, 150, .35), transparent 70%);
  filter: blur(20px); animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate3d(3%, -4%, 0) rotate(8deg); } }
.auth-art > * { position: relative; }
.auth-art .brand { color: #fff; }
.auth-art .brand-mark { background: #f6f4ef; color: #16142e; }
.auth-art h1 { color: #fff; font-size: clamp(34px, 3.6vw, 50px); line-height: 1.08; max-width: 14ch; font-variation-settings: "opsz" 144; }
.auth-art h1 em { font-style: italic; color: #c9c5ff; }
.auth-art p { color: rgba(246, 244, 239, .72); max-width: 42ch; font-size: 16px; }
.auth-points { display: grid; gap: 14px; margin-top: 28px; }
.auth-points div { display: flex; gap: 12px; align-items: center; color: rgba(246, 244, 239, .85); font-size: 14.5px; }
.auth-points svg { width: 30px; height: 30px; padding: 6px; border-radius: 9px; background: rgba(255, 255, 255, .1); }
.auth-form { display: grid; place-items: center; padding: 48px 24px; background: var(--bg); }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form h2 { font: 500 30px/1.2 var(--display); margin-bottom: 6px; }
.demo-accounts { margin-top: 26px; padding: 14px 16px; border-radius: 12px; border: 1px dashed var(--line-strong); font-size: 13px; color: var(--ink-2); }
.demo-accounts code { font-size: 12.5px; background: var(--surface-2); padding: 2px 6px; border-radius: 5px; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1020px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .sidebar { position: fixed; z-index: 40; width: 280px; left: 0; transform: translateX(-100%); transition: transform .25s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--bg-elev); position: sticky; top: 0; z-index: 30; }
  .main { padding: 24px 16px 60px; }
  .quiz-bar { margin: -24px -16px 22px; padding: 12px 16px; top: 57px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 32px 24px; }
  .auth-points { display: none; }
  .form-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .q-card .choices, .options.tf { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- release, labs & reviews */

.window-inputs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.window-inputs .field { min-width: 0; }
.window-inputs input { font-size: 13px; padding: 7px 8px; min-width: 0; }
.release-row { display: block; }
.release-row summary { gap: 10px; }
details.release-row[open] { background: var(--bg-elev); }

.progress-row { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px 24px; border-bottom: 1px solid var(--line); }
.progress-row:last-child { border-bottom: 0; }
.progress-row .ex-title { font-weight: 500; font-size: 14.5px; }
.progress-row .ex-n { font: 600 11px/1 var(--font); letter-spacing: .08em; color: var(--ink-3); text-transform: uppercase; margin-bottom: 4px; }
.att-toggle input:checked + span.todo { background: var(--line-strong); color: var(--ink); }
.att-toggle input:checked + span.in_progress { background: var(--warn); color: #fff; }
.att-toggle input:checked + span.done { background: var(--good); color: #fff; }
.att-toggle input:disabled + span { cursor: default; }

.badge.submitted { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.returned { background: var(--info-soft); color: #3b64b5; border-color: transparent; }
.badge.validated { background: var(--good-soft); color: var(--good); border-color: transparent; }
.badge.todo { background: var(--surface-2); color: var(--ink-3); }
.badge.in_progress { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.done { background: var(--good-soft); color: var(--good); border-color: transparent; }

.appr { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px; border-radius: 99px; font: 600 12.5px/1 var(--font); white-space: nowrap; }
.appr::before { content: "★"; font-size: 11px; }
.appr.excellent { background: linear-gradient(90deg, #1f8a5b, #26be96); color: #fff; }
.appr.very_good { background: var(--good-soft); color: var(--good); }
.appr.good { background: var(--accent-soft); color: var(--accent); }
.appr.normal { background: var(--surface-2); color: var(--ink-2); }
.appr.poor { background: var(--bad-soft); color: var(--bad); }

.appr-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.appr-picker label { cursor: pointer; }
.appr-picker input { position: absolute; opacity: 0; pointer-events: none; }
.appr-picker span { display: inline-flex; align-items: center; height: 38px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--line-strong); font-weight: 600; font-size: 14px; color: var(--ink-2); transition: all .12s ease; }
.appr-picker label:hover span { border-color: var(--accent-line); }
.appr-picker input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }
.appr-picker input:checked + span.excellent { background: var(--good); border-color: var(--good); color: #fff; }
.appr-picker input:checked + span.very_good { background: var(--good-soft); border-color: var(--good); color: var(--good); }
.appr-picker input:checked + span.good { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.appr-picker input:checked + span.normal { background: var(--surface-2); border-color: var(--ink-3); color: var(--ink); }
.appr-picker input:checked + span.poor { background: var(--bad-soft); border-color: var(--bad); color: var(--bad); }

.sub-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 24px; }
.sub-tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; font-weight: 600; font-size: 14px; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.sub-tabs a:hover { color: var(--ink); text-decoration: none; }
.sub-tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }
.sub-tabs .count { font-size: 11.5px; background: var(--warn-soft); color: var(--warn); padding: 2px 7px; border-radius: 99px; }

.feedback-box { padding: 16px 18px; border-radius: 12px; background: var(--bg-elev); border: 1px solid var(--line); }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-size: 13.5px; font-weight: 500; }
.file-chip:hover { text-decoration: none; border-color: var(--accent-line); }

@media (max-width: 820px) {
  .window-inputs { grid-template-columns: 1fr; }
  .progress-row { grid-template-columns: 1fr; }
}
.btn.copied { color: var(--good); background: var(--good-soft); }
.google-btn { gap: 12px; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 16px; color: var(--ink-3); font-size: 12.5px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* attendance cards with participation stars */
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; padding: 18px 20px; }
.att-card { display: flex; flex-direction: column; gap: 12px; padding: 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); transition: border-color .15s ease, background .15s ease; }
.att-card:has(input[value=absent]:checked) { border-color: var(--bad); background: color-mix(in oklab, var(--bad-soft) 60%, var(--surface)); }
.att-card:has(input[value=excused]:checked) { border-color: #3b64b5; background: color-mix(in oklab, var(--info-soft) 60%, var(--surface)); }
.att-card .att-toggle { align-self: flex-start; }
.stars { display: flex; gap: 4px; align-items: center; }
.stars label { cursor: pointer; position: relative; }  /* keeps the hidden radio inside the table's scroll box */
.stars input { position: absolute; opacity: 0; pointer-events: none; }
.stars span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; font-size: 20px; line-height: 1; color: var(--line-strong); background: var(--surface-2); transition: all .12s ease; }
.stars span.zero { font-size: 15px; color: var(--ink-3); }
.stars input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }
/* light up every star up to the checked one */
.stars:has(label:nth-child(2) input:checked) label:nth-child(2) span,
.stars:has(label:nth-child(3) input:checked) :is(label:nth-child(2), label:nth-child(3)) span,
.stars:has(label:nth-child(4) input:checked) :is(label:nth-child(2), label:nth-child(3), label:nth-child(4)) span { color: #e8a74a; background: #fdf3df; }
.att-card:has(input[value=absent]:checked) .stars, .att-card:has(input[value=excused]:checked) .stars { opacity: .35; pointer-events: none; }
.stars-read { color: #e8a74a; letter-spacing: 1px; white-space: nowrap; }

/* sheet editor: pre-session type & file types */
.type-picker { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.type-picker label { cursor: pointer; }
.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-picker span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 52px; padding: 8px 10px; border-radius: 11px; border: 1.5px solid var(--line-strong); font-weight: 600; font-size: 13.5px; color: var(--ink-2); transition: all .12s ease; }
.type-picker label:hover span { border-color: var(--accent-line); }
.type-picker input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.type-picker input:focus-visible + span { box-shadow: 0 0 0 4px var(--accent-soft); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.check-grid label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 13.5px; cursor: pointer; }
.check-grid label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.check-grid input { accent-color: var(--accent); margin: 0; }
details.card > summary { list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
@media (max-width: 820px) { .type-picker { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* attendance table */
.att-table td { padding-top: 10px; padding-bottom: 10px; }
.att-row:has(input[value=absent]:checked) td { background: color-mix(in oklab, var(--bad-soft) 55%, var(--surface)); }
.att-row:has(input[value=excused]:checked) td { background: color-mix(in oklab, var(--info-soft) 55%, var(--surface)); }
.att-row:has(input[value=absent]:checked) .stars, .att-row:has(input[value=excused]:checked) .stars { opacity: .35; pointer-events: none; }
.att-table .stars span { width: 30px; height: 30px; font-size: 18px; }

/* lecture attendance: one group at a time */
.group-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 18px; }
.group-picker a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 9px 6px; border-radius: 11px; border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--ink-2); }
.group-picker a:hover { text-decoration: none; border-color: var(--accent-line); }
.group-picker a strong { font-size: 14px; }
.group-picker a span { font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.group-picker a.done { background: var(--good-soft); border-color: transparent; }
.group-picker a.done span { color: var(--good); font-weight: 600; }
.group-picker a.partial span { color: var(--warn); font-weight: 600; }
.group-picker a.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--ink); }
.count-pill { display: inline-grid; place-items: center; min-width: 28px; height: 24px; padding: 0 8px; border-radius: 99px; background: var(--surface-2); font-weight: 600; font-size: 13px; }
.count-pill.warn { background: var(--warn-soft); color: var(--warn); }
.count-pill.bad { background: var(--bad-soft); color: var(--bad); }
.att-table th.center { text-align: center; line-height: 1.3; }

/* classroom: module sub-menu */
.subnav { display: flex; flex-direction: column; gap: 2px; margin: 6px 0 8px 10px; padding-left: 10px; border-left: 2px solid var(--accent-line); }
.subnav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--ink-2); font-size: 13.5px; font-weight: 500; }
.subnav a svg { width: 16px; height: 16px; }
.subnav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.subnav a.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--line); }
.subnav a.active svg { color: var(--accent); }

/* course settings: logo + planning table */
.logo-preview { width: 64px; height: 64px; object-fit: contain; border-radius: 12px; background: #fff; border: 1px solid var(--line); padding: 6px; }
.planning-table td { padding: 6px 8px; vertical-align: top; }
.planning-table input, .planning-table textarea { padding: 7px 9px; font-size: 14px; border-radius: 8px; }
.planning-table textarea { resize: vertical; min-height: 38px; field-sizing: content; }
.planning-table input[type=number] { width: 64px; text-align: center; }
.course-identity { display: flex; align-items: center; gap: 14px; }
.course-identity img { width: 44px; height: 44px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); padding: 4px; }

/* project proposal: team picker */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; max-height: 320px; overflow-y: auto; padding: 4px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.team-row:has(input[name=members]:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.team-row input { accent-color: var(--accent); }
.team-row .lead-pick { color: var(--ink-3); }
.team-row:not(:has(input[name=members]:checked)) .lead-pick { visibility: hidden; }

/* roster import wizard */
.wizard-steps { display: flex; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; }
.wizard-steps li { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 11px; background: var(--surface-2); color: var(--ink-3); font-weight: 600; font-size: 14px; }
.wizard-steps b { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); font-size: 12px; }
.wizard-steps li.on { background: var(--accent-soft); color: var(--accent); }
.wizard-steps li.on b { background: var(--accent); color: var(--accent-ink); }
.wizard-steps li.done { color: var(--good); }
.wizard-steps li.done b { background: var(--good); color: #fff; }
td.col-used, th.col-used { background: var(--accent-soft) !important; }
a.card.stat { color: var(--ink); } a.card.stat:hover { text-decoration: none; box-shadow: var(--shadow-lg); }

/* "Log in as" banner: always visible while an admin views the app as someone else. */
.impersonation { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap; padding: 8px 16px; background: #b4531a; color: #fff; font-size: 13.5px; }
.impersonation form { margin: 0; }
.impersonation button { background: #fff; color: #7a3510; border: 0; border-radius: 999px; padding: 5px 14px; font: 600 13px Inter, sans-serif; cursor: pointer; }

/* Course policies editor: a title over its text. */
.policy-row { display: grid; gap: 8px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.policy-row input { font-weight: 600; }

/* View-only pages (TD/TP teachers on the course leader's pages): the server refuses changes anyway;
   this hides the controls so the page reads as a document. */
.readonly-note { display: flex; align-items: center; gap: 8px; max-width: 1180px; margin: 0 auto 14px; padding: 9px 14px;
  border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; color: var(--ink-2); }
.readonly-view [data-edit], .readonly-view form[method=post] button, .readonly-view [data-copy],
.readonly-view [data-mark-all], .readonly-view [data-add-row], .readonly-view [data-add-link],
.readonly-view [data-add-policy], .readonly-view .card-foot:has(> .btn:only-child) { display: none !important; }

/* Projects: list cards, settings groups, radio tiles and member pickers. */
.project-card { color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.project-card:hover { border-color: var(--accent); box-shadow: var(--shadow-sm, 0 2px 10px rgba(0,0,0,.06)); }
.project-card .icon { width: 15px; height: 15px; vertical-align: -2px; }
.settings-group { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; margin: 0; display: grid; gap: 14px; }
.settings-group legend { padding: 0 6px; font-weight: 600; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3, var(--muted)); }
.settings-group .field > label.row { font-size: 14px; }
.segmented-radio { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented-radio label { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer; font-size: 14px; }
.segmented-radio label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft, var(--surface-2)); font-weight: 600; }
.member-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 14px; max-height: 320px; overflow: auto; padding: 4px 2px; }
.member-grid label { padding: 3px 0; }

/* TD/TP exercise boxes (editor) and their rich text (everywhere). */
.ex-box { border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); overflow: hidden; }
.ex-box-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.ex-num { font: 700 12px/1 ui-monospace, "Source Code Pro", monospace; color: #fff; background: var(--accent); border-radius: 6px; padding: 5px 7px; min-width: 28px; text-align: center; }
.ex-title-input { flex: 1 1 240px; font-weight: 600; }
.ex-mode { display: flex; gap: 4px; }
.ex-mode label { cursor: pointer; }
.ex-mode input { position: absolute; opacity: 0; pointer-events: none; }
.ex-mode span { display: inline-block; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 8px; font-size: 13px; }
.ex-mode input:checked + span { border-color: var(--accent); background: var(--accent-soft, var(--surface)); font-weight: 600; }
.ex-duration { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--ink-2); }
.ex-duration input { width: 70px; padding: 6px 8px; }
.ex-box .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); }
.ex-box .ql-container.ql-snow { border: 0; font: 15px/1.6 Inter, sans-serif; }
.ex-box .ql-editor { min-height: 110px; }
.ex-box .ql-editor img, .rich img { max-width: 100%; height: auto; border-radius: 6px; }
.rich { color: var(--ink-2); line-height: 1.6; overflow-wrap: anywhere; }
.rich > :first-child { margin-top: 0; } .rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 8px; }
.rich ul, .rich ol { margin: 0 0 8px; padding-left: 22px; }
.rich pre, .rich .ql-code-block-container { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; overflow: auto; font: 13px/1.5 ui-monospace, monospace; white-space: pre; }
.rich code { font: 0.92em ui-monospace, monospace; background: var(--surface-2); padding: 1px 4px; border-radius: 4px; }
.rich blockquote { border-left: 3px solid var(--line-strong); margin: 0 0 8px; padding-left: 12px; }
.rich .ql-align-center { text-align: center; } .rich .ql-align-right { text-align: right; }
.ex-view { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.ex-view + .ex-view { margin-top: 12px; }
.ex-view-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ex-view-head h3 { margin: 0; font-size: 15px; flex: 1; }
.ex-progress { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 8px 0 18px; padding: 0 4px; }
.sheet-files { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.file-chip-wrap { display: inline-flex; align-items: center; gap: 2px; }
.file-chip-wrap form, .attach-form { margin: 0; }

/* Quiz topics: one card per topic with its bank counts. */
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 14px; margin-bottom: 20px; }
.topic-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.topic-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft, rgba(75,69,198,.12)); }
.topic-main { color: var(--ink); display: block; }
.topic-main h3 { margin: 0; font-size: 16px; }
.topic-context { margin: 6px 0 0; font-size: 13px; color: var(--ink-2); line-height: 1.45; }
.topic-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.topic-stats a { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 10px; background: var(--surface-2); color: var(--ink); }
.topic-stats b { font-size: 18px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.topic-stats span { font-size: 11px; color: var(--ink-3, var(--muted)); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.topic-stats a.warn b { color: var(--warn, #b7791f); } .topic-stats a.good b { color: var(--good); } .topic-stats a.bad b { color: var(--bad, #c2413b); }
.topic-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; margin-top: auto; }
.topic-edit { flex-basis: 100%; } .topic-edit[open] { padding-top: 6px; }
.topic-edit summary { list-style: none; display: inline-flex; } .topic-edit summary::-webkit-details-marker { display: none; }
.topic-actions .topic-edit:not([open]) { flex-basis: auto; }
.topic-new { border-style: dashed; justify-content: center; }
.topic-new summary { cursor: pointer; font-weight: 600; color: var(--accent); display: flex; align-items: center; gap: 8px; list-style: none; }
.topic-move { display: inline-flex; gap: 2px; margin: 0; }
.topic-move button[disabled] { opacity: .3; pointer-events: none; }
.topic-n { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; background: var(--surface-2); font-size: 12px; font-weight: 700; color: var(--ink-2); margin-right: 4px; vertical-align: 1px; }

/* Classical quiz: question editor and the form-like question list. */
.kind-opt { display: inline-block; padding: 7px 12px; border-radius: 8px; font-size: 13.5px; }
input:checked + .kind-opt { background: var(--surface); box-shadow: 0 1px 2px rgba(0,0,0,.08); font-weight: 600; color: var(--accent); }
.answer-row { display: flex; align-items: center; gap: 8px; }
.answer-row input[type=text] { flex: 1; }
.answer-correct input { position: absolute; opacity: 0; pointer-events: none; }
.answer-correct span { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid var(--line-strong); color: transparent; cursor: pointer; }
.answer-correct input:checked + span { background: var(--good); border-color: var(--good); color: #fff; }
.answer-correct input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.classic-q { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 18px 20px; }
.classic-q + .classic-q { margin-top: 14px; }
.classic-q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.classic-q-head .grow { flex: 1; }
.classic-q .choices { margin-top: 12px; }
.q-card { transition: opacity .25s, transform .25s; }
.q-card.q-busy { opacity: .55; pointer-events: none; }
.q-card.q-leaving { opacity: 0; transform: translateX(24px); }

/* Marked TD/TP sessions: points summary and per-exercise points. */
.marking-box { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; gap: 12px; background: var(--surface-2); }
.marking-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.marking-summary div { background: var(--surface); border-radius: 10px; padding: 8px; text-align: center; }
.marking-summary b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.marking-summary span { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3, var(--muted)); }
.marking-summary .left.over b { color: var(--bad, #c2413b); } .marking-summary .left.done b { color: var(--good); }
.ex-points input { width: 60px; }
.marks-table th { font-size: 12px; line-height: 1.3; }
.mark-input { width: 64px; text-align: center; padding: 6px; }
.mark-input.suggested { background: var(--info-soft, #eef3fc); border-color: #9db6e8; }
.ex-move { display: inline-flex; gap: 0; }
.ex-move .btn { padding: 4px 8px; font-weight: 700; }
[data-ex-list] > [data-ex-box]:first-child [data-ex-up], [data-ex-list] > [data-ex-box]:last-child [data-ex-down] { opacity: .3; pointer-events: none; }
.ex-box-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }
.ft-chip input { position: absolute; opacity: 0; pointer-events: none; }
.ft-chip span { display: inline-block; padding: 3px 9px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; cursor: pointer; }
.ft-chip input:checked + span { border-color: var(--accent); background: var(--accent-soft, var(--surface)); color: var(--accent); font-weight: 600; }
.ft-chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Student report on an exercise: status, difficulty, solution. */
.ex-report { display: grid; gap: 8px; margin: 10px 0 20px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.ex-report-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.diff-toggle .d-easy { } .diff-toggle input:checked + .d-easy { background: var(--good-soft, #e3f4ea); color: var(--good); border-color: var(--good); }
.diff-toggle input:checked + .d-normal { background: var(--info-soft, #eef3fc); color: #3b64b5; border-color: #3b64b5; }
.diff-toggle input:checked + .d-difficult { background: var(--bad-soft, #fdecea); color: var(--bad, #c2413b); border-color: var(--bad, #c2413b); }
.badge.d-easy { color: var(--good); } .badge.d-difficult { color: var(--bad, #c2413b); }
.ex-report { transition: opacity .2s; } .ex-report.saving { opacity: .6; }

/* Course on/off switch (course leader). */
.course-switch { margin: 0; }
.course-switch .switch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font: 600 13px Inter, sans-serif; color: var(--ink-2); }
.course-switch .knob { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s; }
.course-switch .knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .2s; }
.course-switch.on .knob { background: var(--good); } .course-switch.on .knob::after { left: 16px; }
.course-switch.off .switch { color: var(--bad, #c2413b); border-color: var(--bad, #c2413b); }

/* Session guests: a scrollable, filterable list of students from other groups */
.guest-list { max-height: 300px; overflow-y: auto; border: 1px solid var(--line); border-radius: 11px; margin-top: 8px; }
.guest-list label { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 13.5px; font-weight: 400; }
.guest-list label:last-child { border-bottom: 0; }
.guest-list label:hover { background: var(--surface-2); }
.guest-list label[hidden] { display: none; }
.guest-list .grow { flex: 1; min-width: 0; }
#guests details > summary { list-style: none; display: inline-flex; }
#guests details > summary::-webkit-details-marker { display: none; }

/* Student attendance page */
.att-weeks td { vertical-align: top; }
.att-cell { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.att-cell + .att-cell { margin-top: 6px; }
.att-stars { color: var(--warn); font-size: 12px; letter-spacing: 1px; }
.callout.bad { background: var(--bad-soft); border-color: transparent; }
.callout.bad svg { color: var(--bad); }

/* Quiz integrity: monitoring notice, name watermark, no copying or printing */
.monitor-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-3); padding: 4px 10px; border-radius: 99px; background: var(--surface-2); white-space: nowrap; }
.monitor-pill svg { width: 14px; height: 14px; }
.monitor-pill.warn { background: var(--warn-soft); color: var(--warn); }
.monitor-note { margin-bottom: 16px; font-size: 13.5px; }
.quiz-protected { position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.quiz-protected input, .quiz-protected label { -webkit-user-select: none; user-select: none; }
.quiz-watermark { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 2; border-radius: 16px; }
.quiz-watermark > div { position: absolute; inset: -60%; display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 46px 34px; transform: rotate(-18deg); opacity: .11; }
.quiz-watermark span { font: 600 13px var(--font); color: var(--ink); white-space: nowrap; }
.timer small { font: 600 10.5px var(--font); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); margin-right: 2px; }
@media (max-width: 640px) { .quiz-bar .inner { flex-wrap: wrap; gap: 8px 12px; } .monitor-pill { order: 5; } }
@media print { .quiz-protected, .quiz-bar { display: none !important; } .page.narrow::before { content: "Printing is disabled for quizzes."; } }

/* Clickable table rows (quiz results → a student's answers) */
tr.row-link { cursor: pointer; }
tr.row-link:hover td { background: var(--surface-2); }
.review-item .answer-tag { height: 18px; margin-left: 6px; }
.teacher-review .opt.wrong { text-decoration: none; }
.teacher-review .opt.wrong .opt-text { text-decoration: line-through; }

/* Accept / Not accepted toggles (pre-session work, exercises on the review page) */
.decide { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.decide button { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; font: 600 12.5px var(--font); color: var(--ink-3); background: none; border: 0; cursor: pointer; }
.decide button + button { border-left: 1px solid var(--line-strong); }
.decide button svg { width: 14px; height: 14px; }
.decide button:hover { color: var(--ink); background: var(--surface-2); }
.decide .decide-yes.on { background: var(--good-soft); color: var(--good); }
.decide .decide-no.on { background: var(--bad-soft); color: var(--bad); }
.decide button:disabled { opacity: .6; cursor: progress; }
.mark-value.full { color: var(--good); font-weight: 600; }
.mark-value.zero { color: var(--bad); }
.review-row { gap: 14px; flex-wrap: wrap; }
.review-feedback { display: flex; flex-direction: column; gap: 14px; padding: 18px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }

/* Team page: members box (leader highlighted) and history */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.badge.leader { background: var(--accent-soft); color: var(--accent); border-color: transparent; height: 20px; font-weight: 600; }
.team-member.is-leader { background: var(--accent-soft); }
.team-member.is-leader .avatar { box-shadow: 0 0 0 2px var(--accent); }
.chatter .li .avatar { width: 30px; height: 30px; font-size: 11px; flex: none; }
.badge.leader::before { display: none; }

/* Native <dialog> wizard (e.g. Validate all submissions) */
.dialog { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); background: var(--bg-elev); color: var(--ink); box-shadow: 0 24px 60px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(15, 15, 30, .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 10px; }
.dialog-head h2 { margin: 0; font-size: 19px; }
.dialog-body { padding: 4px 22px 18px; font-size: 14px; color: var(--ink-2); }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 16px 16px; }

/* Resit Bank: related questions under each original question */
.resit-items { border-top: 1px solid var(--line); }
.resit-items > summary { padding: 10px 22px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.resit-item { display: flex; gap: 14px; align-items: flex-start; padding: 12px 22px; border-top: 1px dashed var(--line); }
.resit-choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.resit-choices span { font-size: 12.5px; padding: 3px 9px; border-radius: 8px; background: var(--surface-2); color: var(--ink-2); }
.resit-choices span.right { background: var(--good-soft); color: var(--good); font-weight: 600; }

/* ---------------------------------------------------------------- phones (found by e2e/test_smoke.py)
   The page never scrolls sideways: tab bars and filters scroll inside themselves, headers and list rows wrap,
   wide tables scroll inside their .table-wrap. */
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .main, .page, .card, .grid > *, .stack > * { min-width: 0; }
  .sub-tabs, .segmented { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .sub-tabs a, .segmented a { flex: none; white-space: nowrap; }
  .card-head { flex-wrap: wrap; padding: 16px; }
  .page-head .actions { flex-wrap: wrap; }
  .list .li { flex-wrap: wrap; padding: 12px 16px; }
  .list .li .grow { flex: 1 1 60%; }
  .card-head .row, .card-body.row, .card-foot { flex-wrap: wrap; }
}
@media (max-width: 820px) {
  .page-head > .row, .q-card .row { flex-wrap: wrap; }
  .q-card { grid-template-columns: auto minmax(0, 1fr); }
  .q-card .q-actions { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
}
/* Attendance on a phone: one block per student (name, counts, then the buttons), no sideways scrolling */
@media (max-width: 820px) {
  .att-table thead { display: none; }
  .att-table, .att-table tbody, .att-table tr { display: block; width: auto; }
  .att-table tr { padding: 10px 16px; border-bottom: 1px solid var(--line); }
  .att-table td { display: inline-flex; align-items: center; gap: 6px; border: 0; padding: 4px 10px 4px 0; }
  .att-table td:first-child, .att-table td.att-control { display: block; padding: 4px 0; }
  .att-table td[data-label]::before { content: attr(data-label); font-size: 12px; color: var(--ink-3); }
  .att-table .person { min-width: 0; }
}
@media (max-width: 820px) { form[data-review-form] > .row { flex-wrap: wrap; } }

/* Students' files (several per exercise / pre-session work): a chip each, with a remove button */
.work-files { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.work-file { display: inline-flex; align-items: center; gap: 2px; }
.work-file-x { border: 0; background: none; color: var(--ink-3); font-size: 17px; line-height: 1; padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.work-file-x:hover { color: var(--bad); background: var(--bad-soft); }

/* ---------------------------------------------------------------- file viewer (2026-10-15) */
.viewer-page { background: var(--bg); }
.viewer { display: flex; flex-direction: column; height: 100vh; }
.viewer-bar { display: flex; align-items: center; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--bg-elev); flex-wrap: wrap; }
.viewer-who { display: flex; flex-direction: column; min-width: 0; flex: 1 1 200px; }
.viewer-who strong { font-size: 15px; }
.viewer-who span { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.viewer-controls .btn.disabled { opacity: .4; pointer-events: none; }
.viewer-sep { width: 1px; height: 26px; background: var(--line); margin: 0 4px; }
.viewer-count { font-size: 13px; color: var(--ink-3); min-width: 44px; text-align: center; }
.viewer-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 330px; min-height: 0; }
.viewer-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.viewer-file { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.viewer-file-name { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.viewer-content { flex: 1; overflow: auto; padding: 14px 18px; min-height: 0; }
.viewer-image { display: flex; justify-content: center; }
.viewer-image img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: var(--shadow-sm); background: #fff; }
.viewer-pdf { width: 100%; height: 100%; min-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.viewer-code { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: auto; background: var(--surface); font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.viewer-code pre { margin: 0; padding: 12px 0; font: inherit; }
.viewer-gutter { padding: 12px 10px !important; text-align: right; color: var(--ink-3); user-select: none; border-right: 1px solid var(--line); background: var(--surface-2); min-width: 46px; }
.viewer-source { flex: 1; padding: 12px 14px !important; }
.viewer-source code.hljs { padding: 0; background: transparent; }
.viewer-zip { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; height: 100%; }
.viewer-zip-list { border: 1px solid var(--line); border-radius: 10px; overflow: auto; max-height: 100%; background: var(--surface); }
.viewer-zip-list a { display: block; padding: 6px 14px; font-size: 12.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-zip-list a.on { background: var(--accent-soft); font-weight: 600; }
.viewer-zip-entry { min-width: 0; overflow: auto; }
.viewer-side { border-left: 1px solid var(--line); background: var(--bg-elev); overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.viewer-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.viewer-ex { padding: 8px 6px; border-radius: 8px; }
.viewer-ex.current { background: var(--accent-soft); }
.viewer-ex-head { display: flex; align-items: center; gap: 6px; font-size: 13px; flex-wrap: wrap; }
.viewer-ex-head span:not(.badge) { color: var(--ink-2); flex: 1; min-width: 0; }
.viewer-ex-file { display: block; font-size: 12.5px; padding: 3px 0 3px 26px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer-ex-file.on { color: var(--accent); font-weight: 600; }
.viewer-notes { display: flex; flex-direction: column; gap: 8px; }
.viewer-notes textarea { min-height: 180px; }
.viewer-keys { font-size: 12px; margin: 0; }
.viewer-keys kbd { font: 11px ui-monospace, monospace; padding: 1px 5px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); }
@media (max-width: 820px) {
  .viewer { height: auto; min-height: 100vh; }
  .viewer-body { grid-template-columns: minmax(0, 1fr); }
  .viewer-side { border-left: 0; border-top: 1px solid var(--line); }
  .viewer-zip { grid-template-columns: minmax(0, 1fr); }
  .viewer-zip-list { max-height: 220px; }
  .viewer-sep { display: none; }
}
.viewer-notes .help { font-size: 12px; }
.viewer-image img { max-height: calc(100vh - 150px); object-fit: contain; }

/* ---------------------------------------------------------------- rich text: code blocks and boxes (2026-10-15) */
/* Pygments colours (github-dark), generated with HtmlFormatter(style="github-dark").get_style_defs(".rich pre.code") */
.rich pre.code .hll { background-color: #6e7681 }
.rich pre.code { background: #0d1117; color: #E6EDF3 }
.rich pre.code .c { color: #8B949E; font-style: italic } /* Comment */
.rich pre.code .err { color: #F85149 } /* Error */
.rich pre.code .esc { color: #E6EDF3 } /* Escape */
.rich pre.code .g { color: #E6EDF3 } /* Generic */
.rich pre.code .k { color: #FF7B72 } /* Keyword */
.rich pre.code .l { color: #A5D6FF } /* Literal */
.rich pre.code .n { color: #E6EDF3 } /* Name */
.rich pre.code .o { color: #FF7B72; font-weight: bold } /* Operator */
.rich pre.code .x { color: #E6EDF3 } /* Other */
.rich pre.code .p { color: #E6EDF3 } /* Punctuation */
.rich pre.code .ch { color: #8B949E; font-style: italic } /* Comment.Hashbang */
.rich pre.code .cm { color: #8B949E; font-style: italic } /* Comment.Multiline */
.rich pre.code .cp { color: #8B949E; font-weight: bold; font-style: italic } /* Comment.Preproc */
.rich pre.code .cpf { color: #8B949E; font-style: italic } /* Comment.PreprocFile */
.rich pre.code .c1 { color: #8B949E; font-style: italic } /* Comment.Single */
.rich pre.code .cs { color: #8B949E; font-weight: bold; font-style: italic } /* Comment.Special */
.rich pre.code .gd { color: #FFA198; background-color: #490202 } /* Generic.Deleted */
.rich pre.code .ge { color: #E6EDF3; font-style: italic } /* Generic.Emph */
.rich pre.code .ges { color: #E6EDF3; font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.rich pre.code .gr { color: #FFA198 } /* Generic.Error */
.rich pre.code .gh { color: #79C0FF; font-weight: bold } /* Generic.Heading */
.rich pre.code .gi { color: #56D364; background-color: #0F5323 } /* Generic.Inserted */
.rich pre.code .go { color: #8B949E } /* Generic.Output */
.rich pre.code .gp { color: #8B949E } /* Generic.Prompt */
.rich pre.code .gs { color: #E6EDF3; font-weight: bold } /* Generic.Strong */
.rich pre.code .gu { color: #79C0FF } /* Generic.Subheading */
.rich pre.code .gt { color: #FF7B72 } /* Generic.Traceback */
.rich pre.code .g-Underline { color: #E6EDF3; text-decoration: underline } /* Generic.Underline */
.rich pre.code .kc { color: #79C0FF } /* Keyword.Constant */
.rich pre.code .kd { color: #FF7B72 } /* Keyword.Declaration */
.rich pre.code .kn { color: #FF7B72 } /* Keyword.Namespace */
.rich pre.code .kp { color: #79C0FF } /* Keyword.Pseudo */
.rich pre.code .kr { color: #FF7B72 } /* Keyword.Reserved */
.rich pre.code .kt { color: #FF7B72 } /* Keyword.Type */
.rich pre.code .ld { color: #79C0FF } /* Literal.Date */
.rich pre.code .m { color: #A5D6FF } /* Literal.Number */
.rich pre.code .s { color: #A5D6FF } /* Literal.String */
.rich pre.code .na { color: #E6EDF3 } /* Name.Attribute */
.rich pre.code .nb { color: #E6EDF3 } /* Name.Builtin */
.rich pre.code .nc { color: #F0883E; font-weight: bold } /* Name.Class */
.rich pre.code .no { color: #79C0FF; font-weight: bold } /* Name.Constant */
.rich pre.code .nd { color: #D2A8FF; font-weight: bold } /* Name.Decorator */
.rich pre.code .ni { color: #FFA657 } /* Name.Entity */
.rich pre.code .ne { color: #F0883E; font-weight: bold } /* Name.Exception */
.rich pre.code .nf { color: #D2A8FF; font-weight: bold } /* Name.Function */
.rich pre.code .nl { color: #79C0FF; font-weight: bold } /* Name.Label */
.rich pre.code .nn { color: #FF7B72 } /* Name.Namespace */
.rich pre.code .nx { color: #E6EDF3 } /* Name.Other */
.rich pre.code .py { color: #79C0FF } /* Name.Property */
.rich pre.code .nt { color: #7EE787 } /* Name.Tag */
.rich pre.code .nv { color: #79C0FF } /* Name.Variable */
.rich pre.code .ow { color: #FF7B72; font-weight: bold } /* Operator.Word */
.rich pre.code .pm { color: #E6EDF3 } /* Punctuation.Marker */
.rich pre.code .w { color: #6E7681 } /* Text.Whitespace */
.rich pre.code .mb { color: #A5D6FF } /* Literal.Number.Bin */
.rich pre.code .mf { color: #A5D6FF } /* Literal.Number.Float */
.rich pre.code .mh { color: #A5D6FF } /* Literal.Number.Hex */
.rich pre.code .mi { color: #A5D6FF } /* Literal.Number.Integer */
.rich pre.code .mo { color: #A5D6FF } /* Literal.Number.Oct */
.rich pre.code .sa { color: #79C0FF } /* Literal.String.Affix */
.rich pre.code .sb { color: #A5D6FF } /* Literal.String.Backtick */
.rich pre.code .sc { color: #A5D6FF } /* Literal.String.Char */
.rich pre.code .dl { color: #79C0FF } /* Literal.String.Delimiter */
.rich pre.code .sd { color: #A5D6FF } /* Literal.String.Doc */
.rich pre.code .s2 { color: #A5D6FF } /* Literal.String.Double */
.rich pre.code .se { color: #79C0FF } /* Literal.String.Escape */
.rich pre.code .sh { color: #79C0FF } /* Literal.String.Heredoc */
.rich pre.code .si { color: #A5D6FF } /* Literal.String.Interpol */
.rich pre.code .sx { color: #A5D6FF } /* Literal.String.Other */
.rich pre.code .sr { color: #79C0FF } /* Literal.String.Regex */
.rich pre.code .s1 { color: #A5D6FF } /* Literal.String.Single */
.rich pre.code .ss { color: #A5D6FF } /* Literal.String.Symbol */
.rich pre.code .bp { color: #E6EDF3 } /* Name.Builtin.Pseudo */
.rich pre.code .fm { color: #D2A8FF; font-weight: bold } /* Name.Function.Magic */
.rich pre.code .vc { color: #79C0FF } /* Name.Variable.Class */
.rich pre.code .vg { color: #79C0FF } /* Name.Variable.Global */
.rich pre.code .vi { color: #79C0FF } /* Name.Variable.Instance */
.rich pre.code .vm { color: #79C0FF } /* Name.Variable.Magic */
.rich pre.code .il { color: #A5D6FF } /* Literal.Number.Integer.Long */
.rich pre.code { position: relative; background: #161b22; color: #e6edf3; border: 0; border-radius: 10px; padding: 14px 16px; margin: 0 0 12px; font: 13.5px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; overflow: auto; }
.rich pre.code .code-lang { position: absolute; top: 6px; right: 10px; font: 600 10.5px/1 Inter, sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #8b949e; }
.rich .box { padding: 2px 16px; border-left: 4px solid; border-radius: 0; margin: 0; }
.rich .box::before { display: block; font: 700 11px/1 Inter, sans-serif; letter-spacing: .1em; text-transform: uppercase; margin: 10px 0 6px; }
.rich .box + .box::before { content: none; }
.rich :not(.box) + .box, .rich .box:first-child { margin-top: 4px; }
.rich .box:has(+ :not(.box)), .rich .box:last-child { padding-bottom: 10px; margin-bottom: 12px; }
.rich .box-warning { background: #fdf3df; border-color: #d97706; color: #3b2a0a; } .rich .box-warning::before { content: "Warning"; color: #b45309; }
.rich .box-info { background: #e7f0fd; border-color: #3b82f6; color: #12284a; } .rich .box-info::before { content: "Info"; color: #1d4ed8; }
.rich .box-tip { background: #e3f6ec; border-color: #10b981; color: #0d3a26; } .rich .box-tip::before { content: "Tip"; color: #047857; }
.rich .box-goal { background: #fde4f1; border-color: #db2777; color: #4a0f2c; } .rich .box-goal::before { content: "What this exercise is about"; color: #be185d; }
.rich .box-important { background: #fde8e8; border-color: #dc2626; color: #4a0d0d; } .rich .box-important::before { content: "Important"; color: #b91c1c; }
/* the editor: boxes look the same while writing, and the Box menu names each kind */
.ql-editor .box { padding: 2px 14px; border-left: 4px solid; }
.ql-editor .box-warning { background: #fdf3df; border-color: #d97706; } .ql-editor .box-info { background: #e7f0fd; border-color: #3b82f6; }
.ql-editor .box-tip { background: #e3f6ec; border-color: #10b981; } .ql-editor .box-goal { background: #fde4f1; border-color: #db2777; }
.ql-editor .box-important { background: #fde8e8; border-color: #dc2626; }
.ql-snow .ql-picker.ql-box { width: 132px; }
.ql-snow .ql-picker.ql-box .ql-picker-label::before, .ql-snow .ql-picker.ql-box .ql-picker-item::before { content: "Box…"; }
.ql-snow .ql-picker.ql-box .ql-picker-item[data-value="warning"]::before, .ql-snow .ql-picker.ql-box .ql-picker-label[data-value="warning"]::before { content: "⚠ Warning"; }
.ql-snow .ql-picker.ql-box .ql-picker-item[data-value="info"]::before, .ql-snow .ql-picker.ql-box .ql-picker-label[data-value="info"]::before { content: "ℹ Info"; }
.ql-snow .ql-picker.ql-box .ql-picker-item[data-value="tip"]::before, .ql-snow .ql-picker.ql-box .ql-picker-label[data-value="tip"]::before { content: "✓ Tip"; }
.ql-snow .ql-picker.ql-box .ql-picker-item[data-value="goal"]::before, .ql-snow .ql-picker.ql-box .ql-picker-label[data-value="goal"]::before { content: "◎ About"; }
.ql-snow .ql-picker.ql-box .ql-picker-item[data-value="important"]::before, .ql-snow .ql-picker.ql-box .ql-picker-label[data-value="important"]::before { content: "! Important"; }
.ql-snow .ql-picker.ql-box .ql-picker-item:not([data-value])::before { content: "No box"; }
.ex-box .ql-code-block-container { background: #161b22; color: #e6edf3; border-radius: 8px; }
.ql-code-block-container { position: relative; }
.ql-code-block-container select.ql-ui { position: absolute; top: 6px; right: 6px; width: auto; height: auto; min-height: 0; padding: 2px 6px; font: 600 11.5px Inter, sans-serif; border-radius: 6px; background: #2d333b; color: #e6edf3; border: 1px solid #444c56; box-shadow: none; }
.rich pre.code .code-lang { right: 108px; top: 11px; }
.rich pre.code .code-copy { position: absolute; top: 6px; right: 8px; padding: 3px 10px; font: 600 11.5px/1.4 Inter, sans-serif; color: #e6edf3; background: #2d333b; border: 1px solid #444c56; border-radius: 6px; cursor: pointer; }
.rich pre.code .code-copy:hover { background: #373e47; }
.rich pre.code .code-copy.done { color: #3fb950; border-color: #3fb950; }
.rich pre.code code { font: inherit; background: none; padding: 0; border-radius: 0; color: inherit; }
.viewer-students { display: flex; align-items: center; gap: 2px; padding-right: 10px; border-right: 1px solid var(--line); }
.viewer-students .btn.disabled { opacity: .4; pointer-events: none; }

/* Attendance on a computer (2026-10-16): one compact line per student, so a whole group fits with little scrolling */
.att-name { font-weight: 600; color: var(--ink); }
.att-name:hover { color: var(--accent); text-decoration: underline; }
.att-id { font-size: 12px; color: var(--ink-3); }
@media (min-width: 821px) {
  .att-table th, .att-table td { padding-top: 3px; padding-bottom: 3px; vertical-align: middle; white-space: nowrap; }
  .att-table td.att-who { max-width: 340px; overflow: hidden; text-overflow: ellipsis; }
  .att-table .att-toggle { padding: 2px; gap: 2px; border-radius: 8px; }
  .att-table .att-toggle span { padding: 3px 10px; font-size: 12.5px; border-radius: 6px; }
  .att-table .stars { flex-wrap: nowrap; gap: 3px; }
  .att-table .stars span { width: 24px; height: 24px; font-size: 15px; border-radius: 6px; }
  .att-table .stars span.zero { font-size: 12px; }
  .att-table .count-pill { padding: 0 7px; font-size: 12px; height: 20px; min-width: 24px; }
  .att-table .badge { height: 20px; }
}

/* Group chips (2026-10-16): one colour per group, the same everywhere on the page */
.gchips { white-space: nowrap; }
.gchip { display: inline-block; padding: 1px 8px; margin: 1px 3px 1px 0; border-radius: 99px; font: 600 11.5px/18px Inter, sans-serif; background: var(--surface-2); color: var(--ink-2); }
.gdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; background: var(--line-strong); }
.gchip.gc-0, .gdot.gc-0 { background: #dbeafe; color: #1d4ed8; } .gdot.gc-0 { background: #3b82f6; }
.gchip.gc-1, .gdot.gc-1 { background: #dcfce7; color: #15803d; } .gdot.gc-1 { background: #22c55e; }
.gchip.gc-2, .gdot.gc-2 { background: #fef3c7; color: #b45309; } .gdot.gc-2 { background: #f59e0b; }
.gchip.gc-3, .gdot.gc-3 { background: #fce7f3; color: #be185d; } .gdot.gc-3 { background: #ec4899; }
.gchip.gc-4, .gdot.gc-4 { background: #ede9fe; color: #6d28d9; } .gdot.gc-4 { background: #8b5cf6; }
.gchip.gc-5, .gdot.gc-5 { background: #cffafe; color: #0e7490; } .gdot.gc-5 { background: #06b6d4; }
.gchip.gc-6, .gdot.gc-6 { background: #fee2e2; color: #b91c1c; } .gdot.gc-6 { background: #ef4444; }
.gchip.gc-7, .gdot.gc-7 { background: #ecfccb; color: #4d7c0f; } .gdot.gc-7 { background: #84cc16; }
.gchip.gc-8, .gdot.gc-8 { background: #ffedd5; color: #c2410c; } .gdot.gc-8 { background: #f97316; }
.gchip.gc-9, .gdot.gc-9 { background: #e0e7ff; color: #4338ca; } .gdot.gc-9 { background: #6366f1; }

/* Deliverable items (2026-10-21): a submission's answers, item by item */
.item-answer { display: flex; flex-direction: column; gap: 4px; }
.item-answer .label { font-size: 12.5px; }

/* View as student (2026-10-22): the banner is indigo, the admin's "Log in as" stays orange */
.impersonation.view-as { background: #3d4fb8; }
.impersonation.view-as a { color: #fff; text-decoration: underline; }
.impersonation.view-as button { color: #283582; }
