/* Lyceum — Dr. Beirne quiz portal. Light, classical, quiet. */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,500;0,600;1,500&display=swap');

:root {
  /* Light theme: black text on white, gold accent. */
  --bg: #ffffff;
  --bg-2: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --border: #e1e1dd;
  --border-strong: #c9c9c3;
  --text: #111111;
  --muted: #555555;
  --faint: #7a7a7a;
  --accent: #8a6d2f;        /* gold as text/ink (readable on white) */
  --accent-fill: #c9a961;   /* gold as a fill: buttons, bars, dots */
  --accent-ink: #171308;
  --ok: #1f7a3d;
  --ok-bg: rgba(31,122,61,.10);
  --bad: #b3362b;
  --bad-bg: rgba(179,54,43,.10);
  --warn: #8a5a00;
  --warn-bg: rgba(200,140,0,.12);
  --info-bg: rgba(201,169,97,.16);
  --radius: 10px;
  --serif: 'Cormorant Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: .01em; margin: 0 0 .4em; line-height: 1.15; }
h1 { font-size: 2.4rem; }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .875rem; }
.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }

/* Layout */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.5rem; border-bottom: 1px solid var(--border); background: var(--bg-2);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: var(--serif); font-size: 1.35rem; font-weight: 600; color: var(--text); letter-spacing: .02em; }
.brand small { font-family: var(--sans); font-size: .75rem; color: var(--muted); margin-left: .6rem; letter-spacing: .12em; text-transform: uppercase; }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: .25rem; flex-wrap: wrap; }
.nav a { color: var(--muted); padding: .35rem .7rem; border-radius: 6px; font-size: .9rem; }
.nav a.active, .nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.topbar .who { color: var(--muted); font-size: .85rem; display: flex; align-items: center; gap: .75rem; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.wrap.narrow { max-width: 720px; }
.wrap.wide { max-width: 1240px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.4rem; margin-bottom: 1rem; }
.card.tight { padding: .9rem 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.stat .n { font-family: var(--serif); font-size: 2.2rem; line-height: 1; color: var(--accent); }
.stat .l { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; margin-top: .35rem; }

/* Forms */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .3rem; letter-spacing: .02em; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=datetime-local], textarea, select {
  width: 100%; background: var(--bg-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: .7rem .85rem; font: inherit; font-size: 1rem; outline: none; min-height: 44px;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(201,169,97,.3); }
textarea { min-height: 6rem; resize: vertical; }
input[type=checkbox], input[type=radio] { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); vertical-align: -2px; }
.field { margin-bottom: 1rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }
.check { display: flex; align-items: center; gap: .6rem; color: var(--text); font-size: .95rem; cursor: pointer; }
.check input { margin: 0; }
.help { color: var(--faint); font-size: .85rem; margin-top: .3rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; cursor: pointer; border-radius: 8px; padding: .7rem 1.2rem; min-height: 44px;
  font: inherit; font-size: .92rem; font-weight: 500; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { background: #e9e9e5; border-color: #b5b5ae; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent-fill); color: var(--accent-ink); border-color: var(--accent-fill); }
.btn.primary:hover { background: #d9b96f; }
.btn.danger { color: var(--bad); border-color: rgba(224,133,125,.4); background: transparent; }
.btn.danger:hover { background: var(--bad-bg); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.sm { padding: .4rem .8rem; font-size: .85rem; min-height: 36px; }
.btn.block { width: 100%; justify-content: center; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.actions.end { justify-content: flex-end; }
.actions.between { justify-content: space-between; }

/* Alerts & badges */
.alert { padding: .8rem 1rem; border-radius: 8px; border: 1px solid; margin-bottom: 1rem; font-size: .92rem; }
.alert.error { color: var(--bad); border-color: rgba(224,133,125,.35); background: var(--bad-bg); }
.alert.ok { color: var(--ok); border-color: rgba(127,197,150,.35); background: var(--ok-bg); }
.alert.warn { color: var(--warn); border-color: rgba(227,184,102,.35); background: var(--warn-bg); }
.alert.info { color: var(--text); border-color: rgba(201,169,97,.35); background: var(--info-bg); }
.badge { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; padding: .2rem .55rem; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); white-space: nowrap; }
.badge.open, .badge.submitted, .badge.released { color: var(--ok); border-color: rgba(127,197,150,.4); background: var(--ok-bg); }
.badge.scheduled, .badge.in_progress, .badge.pending { color: var(--warn); border-color: rgba(227,184,102,.4); background: var(--warn-bg); }
.badge.closed, .badge.draft, .badge.not_started { color: var(--muted); }
.badge.accent { color: var(--accent); border-color: rgba(201,169,97,.4); background: var(--info-bg); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
tr:hover td { background: rgba(0,0,0,.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }

/* List rows */
.list { display: flex; flex-direction: column; gap: .6rem; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; }
.item:hover { border-color: var(--border-strong); }
.item .title { font-family: var(--serif); font-size: 1.25rem; font-weight: 600; }
.item .meta { color: var(--muted); font-size: .85rem; margin-top: .15rem; }
.item .side { text-align: right; flex-shrink: 0; }

/* Login */
.login { max-width: 420px; margin: 8vh auto 0; }
.login .mark { text-align: center; margin-bottom: 1.75rem; }
.login .mark h1 { font-size: 2.6rem; margin-bottom: .2rem; }
.login .mark p { color: var(--muted); letter-spacing: .12em; text-transform: uppercase; font-size: .75rem; }

/* Quiz taking */
.quiz-shell { max-width: 720px; margin: 0 auto; }
.quiz-head { margin-bottom: 1rem; }
.quiz-status { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.quiz-status .timer { display: inline-block; font-size: 1rem; padding: .1rem .45rem; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); text-align: center; }
.nav-mid { display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.nav-mid .btn.ghost { color: var(--faint); min-height: 30px; padding: .2rem .6rem; }
.timer { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.timer.low { color: var(--warn); border-color: rgba(227,184,102,.5); }
.timer.critical { color: var(--bad); border-color: rgba(224,133,125,.6); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.qnum { color: var(--accent); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .5rem; display: flex; justify-content: space-between; }
.prompt { font-family: var(--serif); font-size: 1.5rem; line-height: 1.35; margin-bottom: 1.25rem; white-space: pre-wrap; }
.options { display: flex; flex-direction: column; gap: .55rem; }
.opt { display: flex; gap: .8rem; align-items: flex-start; padding: 1rem 1.1rem; font-size: 1.02rem; line-height: 1.45; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-2); cursor: pointer; }
.opt:hover { border-color: var(--accent-fill); }
.opt.selected { border-color: var(--accent); background: var(--info-bg); }
.opt .letter { font-family: var(--serif); font-weight: 600; color: var(--accent); min-width: 1.4rem; }
.opt input { margin-top: .25rem; width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.savestate { font-size: .85rem; color: var(--muted); min-height: 1.2em; text-align: center; }

/* Results */
.score-hero { text-align: center; padding: 2rem 1rem; }
.score-hero .big { font-family: var(--serif); font-size: 4rem; line-height: 1; color: var(--accent); }
.score-hero .sub { color: var(--muted); margin-top: .5rem; }
.result-item { border-left: 3px solid var(--border-strong); padding-left: 1rem; margin-bottom: 1.5rem; }
.result-item.correct { border-left-color: var(--ok); }
.result-item.wrong { border-left-color: var(--bad); }
.result-item.pending { border-left-color: var(--warn); }
.result-item.poll { border-left-color: var(--accent-fill); }
.result-item .prompt { font-size: 1.2rem; margin-bottom: .6rem; }
.answer-line { font-size: .92rem; margin: .2rem 0; }
.answer-line b { color: var(--muted); font-weight: 500; }
.explain { background: var(--surface-2); border-radius: 8px; padding: .7rem .9rem; font-size: .9rem; margin-top: .6rem; color: var(--text); }

/* Admin extras */
.tabs { display: flex; gap: .2rem; border-bottom: 1px solid var(--border); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .6rem .9rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); text-decoration: none; }
.tabs a:hover { text-decoration: none; color: var(--text); }
.qcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.2rem; margin-bottom: .75rem; }
.qcard .qhead { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.qcard .qprompt { font-family: var(--serif); font-size: 1.15rem; }
.qcard .opts { margin: .5rem 0 0; padding-left: 1.2rem; font-size: .9rem; color: var(--muted); }
.qcard .opts li.key { color: var(--ok); }
.opt-editor { display: flex; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.opt-editor input[type=text] { flex: 1; }
.progress { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent-fill); }
.kbd { font-family: var(--mono); font-size: .8rem; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 4px; padding: .05rem .35rem; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 1.5rem; max-width: 720px; width: 100%; max-height: 90vh; overflow: auto; }
.footer { text-align: center; color: var(--faint); font-size: .8rem; padding: 2rem 1rem; }
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); padding: .7rem 1.1rem; border-radius: 8px; z-index: 60; font-size: .9rem; box-shadow: 0 8px 30px rgba(0,0,0,.15); }
.toast.error { border-color: var(--bad); color: var(--bad); }

/* Small screens */
.brand { white-space: nowrap; }
.item .meta { white-space: pre-line; }
.qnum { flex-wrap: wrap; gap: .25rem .75rem; }
@media (max-width: 600px) {
  .brand small { display: none; }
  .topbar { flex-wrap: wrap; row-gap: .4rem; }
  .topbar .nav { order: 3; width: 100%; gap: 0; }
  .topbar .nav a { padding: .3rem .6rem; font-size: .88rem; }
  .topbar .who span { display: none; }
  .tabs a { padding: .55rem .7rem; font-size: .92rem; }
  .quiz-nav { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
  .quiz-nav .nav-mid { grid-column: 1 / -1; order: -1; flex-direction: row; justify-content: center; gap: .6rem; }
  .quiz-nav .btn { width: 100%; }
  .card { padding: 1rem 1rem; }
  .qnum { font-size: .72rem; }
  .score-hero .big { font-size: 3.2rem; }
  .topbar { padding: .75rem 1rem; }
  .topbar .who { gap: .4rem; }
  h1 { font-size: 1.9rem; }
  .prompt { font-size: 1.3rem; }
  .wrap { padding: 1.25rem 1rem 3rem; }
}

/* Confetti overlay (student results) */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 100; }

/* Charts (admin statistics) */
.chart { width: 100%; }
.chart svg { display: block; overflow: visible; }
.chart .mark { cursor: default; outline: none; }
.chart .mark.hover path, .chart .mark.hover circle, .chart .mark.hover rect:not([fill=transparent]) { filter: brightness(.88); }
.chart .mark:focus-visible path, .chart .mark:focus-visible circle { stroke: var(--text); stroke-width: 2; }
.chart-tip { position: fixed; z-index: 70; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text); border-radius: 8px; padding: .5rem .7rem; font-size: .85rem; pointer-events: none; max-width: 320px; box-shadow: 0 8px 30px rgba(0,0,0,.18); white-space: pre-line; }
.chart-tip-value { font-weight: 600; font-size: .95rem; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; margin-right: .3rem; }
.stat-list { margin: .5rem 0 0; padding-left: 1.2rem; display: grid; gap: .5rem; }
.stat-list li { line-height: 1.4; }
.dist-row { padding: .9rem 0; border-top: 1px solid var(--border); }
.dist-row:first-of-type { border-top: 0; }
.dist-q { margin-bottom: .45rem; }
.dist-q b { color: var(--accent); margin-right: .3rem; }
.dist-key { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin-top: .35rem; }

/* Course switcher */
.course-switch { width: auto; min-height: 36px; padding: .3rem 1.8rem .3rem .7rem; font-size: .9rem; border-radius: 6px; background: var(--surface-2); border-color: var(--border-strong); margin-right: .4rem; max-width: 240px; }
.eyebrow { color: var(--accent); font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; margin-bottom: .1rem; }
@media (max-width: 600px) { .course-switch { max-width: 100%; margin: 0 0 .3rem; width: 100%; } }

/* Inline question editor */
.qtop { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .5rem; }
.q-type { width: auto; min-height: 34px; padding: .25rem 1.8rem .25rem .6rem; font-size: .85rem; }
.q-points { display: flex; align-items: center; gap: .3rem; font-size: .85rem; color: var(--muted); margin: 0; }
.q-points-in { width: 4.2rem; min-height: 34px; padding: .25rem .5rem; font-size: .9rem; text-align: right; }
.q-prompt { font-family: var(--serif); font-size: 1.25rem; line-height: 1.35; resize: none; overflow: hidden; min-height: 2.6rem; }
.q-opts { display: flex; flex-direction: column; gap: .35rem; margin-top: .6rem; }
.q-opt { display: flex; align-items: center; gap: .5rem; padding: .15rem .3rem; border-radius: 8px; border: 1px solid transparent; }
.q-opt.dragging { opacity: .4; }
.q-opt.drop-before { box-shadow: 0 -2px 0 var(--accent-fill); }
.q-opt.drop-after { box-shadow: 0 2px 0 var(--accent-fill); }
.q-opt .drag { cursor: grab; color: var(--faint); user-select: none; padding: .2rem .1rem; font-size: 1rem; letter-spacing: -2px; }
.q-opt .drag:active { cursor: grabbing; }
.q-opt .letter { color: var(--accent); font-weight: 600; min-width: 1.4rem; }
.q-opt .q-key { margin: 0; display: flex; }
.q-opt .q-key input { width: 1.25rem; height: 1.25rem; }
.q-opt .q-opt-text { flex: 1; min-height: 38px; padding: .4rem .6rem; }
.q-opt:has(.q-key input:checked) { background: var(--ok-bg); border-color: rgba(31,122,61,.25); }
.q-opt:has(.q-key input:checked) .q-opt-text { border-color: var(--ok); }
.q-more { margin-top: .6rem; }
.q-more summary { cursor: pointer; }
.q-more textarea { margin-top: .4rem; }
.qsave.ok { color: var(--ok); }
.qsave.bad { color: var(--bad); }
.check-list { list-style: none; padding: 0; margin: .3rem 0 1rem; display: grid; gap: .45rem; }
.check-list li { display: flex; gap: .6rem; align-items: baseline; line-height: 1.4; }

.footer .build { margin-top: .4rem; font-family: var(--mono); font-size: .72rem; color: var(--faint); }

.away-flag { color: var(--warn); font-weight: 600; }

/* Student-visible "left page N×" chip: grey -> amber -> orange -> red -> dark red */
.away-chip { display: inline-block; padding: .1rem .55rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2); color: var(--faint); font-weight: 500; transition: background .3s, color .3s, border-color .3s; }
.away-chip.away-1 { color: #7a5a00; background: #fff3cd; border-color: #f0d98a; font-weight: 600; }
.away-chip.away-2 { color: #8a3b00; background: #ffe0c2; border-color: #f2b27a; font-weight: 600; }
.away-chip.away-3 { color: #ffffff; background: #d9534f; border-color: #c9302c; font-weight: 700; }
.away-chip.away-4 { color: #ffffff; background: #a71d2a; border-color: #8b1620; font-weight: 700; }
.away-chip.bump { animation: awaybump .7s ease; }
@keyframes awaybump { 0% { transform: scale(1); } 30% { transform: scale(1.18); } 100% { transform: scale(1); } }
.away-warn { color: var(--warn); font-weight: 600; }
.link-badge { cursor: pointer; font: inherit; font-size: .72rem; }

/* Name sort switch and small filter selects */
.sort-switch { width: auto; min-height: 36px; padding: .3rem 1.8rem .3rem .7rem; font-size: .88rem; border-radius: 6px; }
.stat-link { display: block; color: inherit; }
.stat-link:hover { text-decoration: none; border-color: var(--accent-fill); }
a.badge:hover { text-decoration: none; filter: brightness(.95); }

/* Wide tables: header row and name column stay put while scrolling */
.sticky-table { max-height: 75vh; overflow: auto; }
.sticky-table thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; box-shadow: inset 0 -1px 0 var(--border); }
.sticky-table tfoot th { position: sticky; bottom: 0; background: var(--bg-2); z-index: 2; color: var(--text); box-shadow: inset 0 1px 0 var(--border); }
.sticky-table .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; box-shadow: inset -1px 0 0 var(--border); }
.sticky-table thead .sticky-col, .sticky-table tfoot .sticky-col { z-index: 3; }
.sticky-table tfoot .sticky-col { background: var(--bg-2); }
.sticky-table td, .sticky-table th { vertical-align: middle; }

/* Attendance */
.att-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.att-bar input[type=date] { width: auto; min-height: 36px; padding: .3rem .6rem; font: inherit; font-size: .95rem; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 6px; color: var(--text); }
.att-table td, .att-table th { padding: .35rem .45rem; }
.att-table th.att-active, .att-table td.att-roll { background: var(--info-bg); }
.day-head { all: unset; cursor: pointer; font: inherit; line-height: 1.25; text-transform: none; letter-spacing: 0; font-size: .8rem; padding: .15rem .3rem; border-radius: 4px; }
.day-head:hover, .day-head:focus-visible { background: var(--surface-2); outline: 2px solid var(--accent-fill); }
.popover-menu { margin: 0; inset: auto; position-area: bottom; position-try-fallbacks: flip-block, flip-inline; border: 1px solid var(--border-strong); border-radius: var(--radius); padding: .8rem; background: var(--surface); color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.18); text-transform: none; letter-spacing: 0; font-size: .9rem; min-width: 240px; }
.popover-menu input[type=date] { width: 100%; min-height: 36px; padding: .3rem .5rem; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--bg-2); color: var(--text); font: inherit; }
.att-cell { all: unset; box-sizing: border-box; cursor: pointer; display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 6px; font-weight: 600; font-size: .85rem; color: var(--faint); }
.att-cell:hover, .att-cell:focus-visible { outline: 2px solid var(--accent-fill); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; }
.seg-btn { all: unset; box-sizing: border-box; cursor: pointer; width: 2rem; height: 2rem; display: grid; place-items: center; font-weight: 600; font-size: .85rem; color: var(--muted); background: var(--surface); border-left: 1px solid var(--border); }
.seg-btn:first-child { border-left: 0; }
.seg-btn:hover { background: var(--surface-2); }
.seg-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.att-present.att-cell, .seg-btn.att-present[aria-checked=true] { background: var(--ok-bg); color: var(--ok); }
.att-late.att-cell, .seg-btn.att-late[aria-checked=true] { background: var(--warn-bg); color: var(--warn); }
.att-absent.att-cell, .seg-btn.att-absent[aria-checked=true] { background: var(--bad-bg); color: var(--bad); }
.att-excused.att-cell, .seg-btn.att-excused[aria-checked=true] { background: var(--surface-2); color: var(--text); }
tr[data-row]:has(:focus-visible) td { background: rgba(201,169,97,.08); }

/* Gradebook */
.gb-table td, .gb-table th { padding: .45rem .55rem; }
.gb-q { min-width: 7rem; max-width: 11rem; text-transform: none; letter-spacing: 0; font-size: .82rem; line-height: 1.25; }
.gb-q a { color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.gb-score { color: var(--text); font-variant-numeric: tabular-nums; }
.gb-low { color: var(--bad); }
.gb-low .gb-score { color: var(--bad); }
.gb-mid .gb-score, td.gb-mid { color: var(--warn); }
.gb-flag { color: var(--warn); font-weight: 700; }
.gb-pct { font-size: .78rem; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1.1; }
.gb-low .gb-pct { color: var(--bad); }

/* Grading queue */
.g-progress { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.g-progress .progress { flex: 1; }
.g-card .prompt { margin-bottom: .6rem; }
.g-prompt summary { cursor: pointer; margin-bottom: .3rem; }
.g-student { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; padding: .6rem 0; border-top: 1px solid var(--border); }
.g-answer { font-family: var(--serif); font-size: 1.22rem; line-height: 1.55; white-space: pre-wrap; background: var(--bg-2); border-radius: 8px; padding: 1rem 1.2rem; max-height: 55vh; overflow: auto; }
.g-suggest { margin-top: .8rem; padding: .7rem .9rem; border-radius: 8px; background: var(--info-bg); border: 1px solid rgba(201,169,97,.35); }
.g-suggest.err { background: var(--bad-bg); border-color: rgba(179,54,43,.3); }
.g-form { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-start; margin-top: 1rem; }
.g-points { flex: 0 0 auto; }
.g-points input { width: 6rem; font-size: 1.2rem; text-align: right; }
.g-quick { display: flex; gap: .2rem; margin-top: .3rem; }

/* Academic integrity notices (student) */
.socrates { width: 1.05em; height: 1.05em; vertical-align: -.2em; flex-shrink: 0; }
.away-chip .socrates { margin-right: .15rem; }
dialog.integrity { max-width: 520px; width: calc(100% - 2rem); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 1.5rem; background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.integrity::backdrop { background: rgba(0,0,0,.5); backdrop-filter: blur(2px); }
dialog.integrity[open] { animation: integrity-in .18s ease-out; }
@keyframes integrity-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.integrity-head { display: flex; align-items: center; gap: .9rem; margin-bottom: .8rem; }
.integrity-head .socrates { width: 64px; height: 64px; color: var(--accent); }
.integrity-head h2 { margin: 0; }
.integrity-ask { font-family: var(--serif); font-size: 1.15rem; line-height: 1.4; border-left: 3px solid var(--accent-fill); padding-left: .8rem; }
.integrity-count { display: inline-block; padding: .3rem .7rem; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { dialog.integrity[open] { animation: none; } }

/* Results tab: class-wide actions */
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .4rem; margin: 0 0 .6rem; }
.bulk-bar .bulk-actions { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--accent, #8a6d2f); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
th.sel, td.sel { width: 2rem; padding-right: 0; }
td.sel input, th.sel input { margin: 0; }
.adjust-card { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.gb-adj { font-size: .72rem; color: var(--muted, #6b6b6b); }

/* ---------- Self-paced courses (student) ---------- */
.pre { white-space: pre-wrap; }
.pbar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: .45rem 0 .3rem; }
.pbar > span { display: block; height: 100%; background: var(--accent-fill); border-radius: 999px; transition: width .4s ease; }
.pbar.big { height: 12px; }
.pbar.thin { height: 5px; margin: .3rem 0 0; }
.course-card { color: inherit; text-decoration: none !important; }
.course-card:hover { border-color: var(--accent-fill); }
.course-hero { margin: .6rem 0 1.2rem; }
.course-hero h1 { margin-bottom: .2rem; }
.next-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; color: inherit; text-decoration: none !important; border-color: var(--accent-fill); background: linear-gradient(0deg, var(--info-bg), var(--info-bg)), var(--surface); }
.next-card h2 { margin: .1rem 0 .15rem; font-size: 1.45rem; }
.next-card:hover { box-shadow: 0 2px 12px rgba(138,109,47,.18); }
.next-card.done { background: var(--ok-bg); border-color: rgba(31,122,61,.3); }
.standing .track { position: relative; height: 34px; margin: 1.2rem .5rem .2rem; border-bottom: 2px solid var(--border-strong); }
.standing .dot { position: absolute; bottom: -6px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--border-strong); border: 2px solid var(--surface); }
.standing .dot.me { width: 16px; height: 16px; margin-left: -8px; bottom: -9px; background: var(--accent-fill); z-index: 1; }
.standing .dot.me b { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: .75rem; color: var(--accent); white-space: nowrap; }
.track-scale { display: flex; justify-content: space-between; margin: .6rem .2rem 0; }
.mod-list { display: flex; flex-direction: column; }
.mod-row { display: flex; align-items: center; gap: .9rem; padding: .7rem .4rem; border-top: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.mod-row:first-child { border-top: 0; }
a.mod-row:hover { background: var(--bg-2); }
.mod-row.locked { opacity: .55; }
.mod-code { flex: 0 0 2.6rem; height: 2.6rem; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 600; font-size: 1.05rem; border: 1.5px solid var(--border-strong); color: var(--muted); }
.mod-row.done .mod-code { background: var(--ok-bg); border-color: rgba(31,122,61,.35); color: var(--ok); }
.mod-row.going .mod-code, .mod-row.open .mod-code { border-color: var(--accent-fill); color: var(--accent); }
.mod-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.mod-title { font-family: var(--serif); font-size: 1.18rem; line-height: 1.25; }
.mod-status { flex: 0 0 auto; }
details.intro summary { cursor: pointer; list-style: none; }
details.intro summary::-webkit-details-marker { display: none; }
details.intro summary::after { content: ' ▾'; color: var(--faint); }
.md h4 { font-family: var(--serif); font-size: 1.2rem; margin: 1.1rem 0 .3rem; }
.md ul { padding-left: 1.2rem; margin: .3rem 0 .8rem; }
.md li { margin: .25rem 0; }
.md p { margin: .5rem 0; }
.md-table { font-size: .88rem; }
.md-table td, .md-table th { vertical-align: top; }
.mod-head { margin: .6rem 0 .9rem; }
.mod-head h1 { margin-bottom: .25rem; }
.why { border-left: 3px solid var(--accent-fill); padding: .2rem 0 .2rem 1rem; margin: 0 0 1.2rem; font-family: var(--serif); font-size: 1.2rem; line-height: 1.45; }
.grp { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 1rem 0 .3rem; font-family: var(--sans); font-weight: 600; }
.steps { display: flex; flex-direction: column; }
.step { display: flex; align-items: flex-start; gap: .8rem; padding: .7rem .3rem; border-top: 1px solid var(--border); color: inherit; text-decoration: none !important; }
.steps .step:first-child { border-top: 0; }
a.step:hover { background: var(--bg-2); }
.step-check { flex: 0 0 1.9rem; height: 1.9rem; border-radius: 50%; display: grid; place-items: center; font-size: .85rem; border: 1.5px solid var(--border-strong); color: var(--muted); }
.step-check.on { background: var(--ok); border-color: var(--ok); color: #fff; }
.step-main { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.step-title { font-weight: 600; }
.step.optional .step-title { font-weight: 500; }
.step-note { font-size: .87rem; color: var(--muted); }
.step-meta { flex: 0 0 auto; font-size: .82rem; color: var(--faint); white-space: nowrap; padding-top: .2rem; }
.step.case textarea { margin-top: .4rem; font-size: .95rem; }
.step.case .actions { margin-top: .4rem; }
.quiz-block { display: flex; gap: .8rem; align-items: flex-start; margin-top: .8rem; padding: 1rem; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border); }
.quiz-block.done { background: var(--ok-bg); border-color: rgba(31,122,61,.25); }
.quiz-block p { margin: .2rem 0 .6rem; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { padding: .2rem .65rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: .88rem; }
.btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.module-result { border-left: 4px solid var(--warn); }
.module-result.pass { border-left-color: var(--ok); }
.module-result h2 { margin-bottom: .2rem; }
.video-title { font-size: 1.9rem; margin: .5rem 0 .4rem; }

/* Verified player */
.player { background: #000; border-radius: var(--radius); overflow: hidden; margin: .8rem 0 1rem; }
.player-frame { position: relative; aspect-ratio: 16 / 9; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-shield { position: absolute; inset: 0; cursor: pointer; }
.player-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 1.5rem; background: rgba(0,0,0,.72); color: #fff; font-size: 1.05rem; }
.player-msg p { max-width: 34rem; margin: 0 auto 1rem; }
.player-msg .small { color: #ddd; margin-top: .6rem; }
.player-bar { display: flex; align-items: center; gap: .5rem; padding: .45rem .6rem; background: #141414; color: #eee; }
.pbtn { background: none; border: 0; color: #eee; font-size: 1rem; min-width: 2.1rem; height: 2.1rem; border-radius: 6px; cursor: pointer; }
.pbtn:hover:not(:disabled) { background: rgba(255,255,255,.12); }
.pbtn:disabled { opacity: .4; cursor: default; }
.scrub { position: relative; flex: 1; height: 22px; cursor: pointer; }
.scrub::before { content: ''; position: absolute; left: 0; right: 0; top: 7px; height: 8px; border-radius: 4px; background: #3a3a3a; }
.scrub-reach { position: absolute; left: 0; top: 7px; height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); pointer-events: none; }
#scrub-bits { position: absolute; left: 0; top: 7px; width: 100%; height: 8px; border-radius: 4px; pointer-events: none; }
.scrub-head { position: absolute; top: 3px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; background: #fff; pointer-events: none; }
.ptime { font-size: .8rem; color: #ccc; white-space: nowrap; }
.prate { width: auto; padding: .15rem .3rem; font-size: .82rem; background: #222; color: #eee; border: 1px solid #444; border-radius: 6px; }
.player:fullscreen { border-radius: 0; display: flex; flex-direction: column; justify-content: center; }
.player:fullscreen .player-frame { aspect-ratio: auto; flex: 1; }
.watch-meter { padding: .8rem 1rem; }
.watch-line { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; font-size: .92rem; }
@media (max-width: 600px) { .ptime { display: none; } .player-bar { gap: .25rem; padding: .35rem; } .step-meta { display: none; } }

/* Drawing pad */
.pad { border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: #fff; }
.pad-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; padding: .45rem .55rem; background: var(--bg-2); border-bottom: 1px solid var(--border); }
.pad-tools .sep { width: 1px; height: 1.4rem; background: var(--border-strong); margin: 0 .2rem; }
.pad-tools .on { background: var(--info-bg); border-color: var(--accent-fill); }
.swatch { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--accent-fill); }
.pad canvas { display: block; width: 100%; aspect-ratio: 14 / 9; touch-action: none; cursor: crosshair; }
img.drawing { display: block; width: 100%; max-width: 760px; border: 1px solid var(--border); border-radius: 8px; background: #fff; margin: .4rem 0 .8rem; }

/* ---------- Self-paced courses (admin) ---------- */
.prog-grid td.cell { text-align: center; padding: .3rem .25rem; font-size: .78rem; white-space: nowrap; }
.prog-grid th.mcol { text-align: center; font-size: .75rem; padding: .3rem .25rem; }
.cell.done { background: var(--ok-bg); color: var(--ok); }
.cell.going { background: var(--info-bg); color: var(--accent); }
.cell.locked { color: var(--faint); }
.flag { color: var(--warn); font-size: .8rem; }
.watch-bits { display: block; width: 100%; height: 6px; border-radius: 3px; background: var(--surface-2); }
.cur-mod { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: .6rem; background: var(--surface); }
.cur-mod > summary { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; cursor: pointer; list-style: none; }
.cur-mod > summary::-webkit-details-marker { display: none; }
.cur-mod[open] > summary { border-bottom: 1px solid var(--border); }
.cur-body { padding: 1rem; }
.item-row { display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; align-items: start; padding: .45rem 0; border-top: 1px solid var(--border); font-size: .92rem; }
.item-row:first-child { border-top: 0; }
.watch-note { margin: -.4rem 0 1rem; }
