/* Page-specific layout: sign-in, lists, editors, results. */

.auth-card { max-width: 24rem; margin: 3rem auto; }

.ordered-list { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--border); }
.ordered-list li { display: flex; gap: 0.5rem; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--border); }
.ordered-list .text { flex: 1; min-width: 0; }

.meter { height: 0.5rem; background: var(--surface-2); }
.meter > span { display: block; height: 100%; background: var(--meter); }

.notice { padding: 1rem; text-align: center; }

.auth-card form .btn-primary { width: 100%; }
.auth-card form .muted { margin-top: var(--gap); }

/* ---- results: the score on top, the review as the main column, competences beside it ---- */
.result-hero { display: flex; align-items: center; gap: 1.2rem 2rem; flex-wrap: wrap; margin-bottom: 0.75rem; }
.score-ring { position: relative; width: 6.5rem; height: 6.5rem; flex: none; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track, .ring-arc { fill: none; stroke-width: 10; }
.ring-track { stroke: var(--surface-2); }
.ring-arc { stroke: var(--accent); stroke-linecap: butt; transition: stroke-dasharray 0.8s var(--ease-out); }
.tone-good .ring-arc { stroke: var(--good); }
.tone-warn .ring-arc { stroke: var(--warn); }
.tone-bad .ring-arc { stroke: var(--bad); }
.ring-pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 1.35rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-score { flex: 1 1 14rem; }
.hero-score .muted { margin: 0.3rem 0 0; }
.score { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.rs-row { display: grid; grid-template-columns: repeat(3, minmax(5.5rem, 1fr)); gap: 0.5rem; flex: 0 1 22rem; }
.rs { border: 1px solid var(--border); padding: 0.5rem 0.7rem; display: grid; }
.rs-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rs-label { font-size: 0.85em; color: var(--text-muted); }
.rs.good .rs-value { color: var(--good); }
.rs.bad .rs-value { color: var(--bad); }
.result-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: 0.75rem; align-items: stretch; height: calc(100dvh - 17rem); min-height: 26rem; }
.result-layout.solo { grid-template-columns: 1fr; }
.result-layout > .card { margin-bottom: 0; min-height: 0; }
.result-comps { overflow-y: auto; display: grid; gap: 0.9rem; align-content: start; }
.result-comps h2 { margin: 0; }
.comp-hint { margin: -0.6rem 0 0; font-size: 0.85em; }
.comp { display: grid; gap: 0.3rem; }
.comp-head { display: flex; justify-content: space-between; gap: 0.6rem; align-items: baseline; }
.comp-n { flex: none; font-variant-numeric: tabular-nums; }
.comp .gist { font-size: 0.85em; }

.review-panel { display: flex; flex-direction: column; gap: 0.7rem; }
.review-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.review-head h2 { margin: 0; }
.chips { display: flex; gap: 0.35rem; }
.chip-btn { font: inherit; padding: 0.2rem 0.7rem; border: 1px solid var(--border-strong); background: transparent; color: var(--text); cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.answer-strip { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.15rem; } /* every question square shows: no inner scroll box */
.answer-strip button { width: 2.2rem; height: 2.2rem; border: 0; font: inherit; font-weight: 600; color: #fff; cursor: pointer; }
.answer-strip .right { background: var(--good); }
.answer-strip .wrong { background: var(--bad); }
.answer-strip button { outline: none; transition: transform 0.2s var(--ease-spring), box-shadow 0.15s; }
.answer-strip .current { transform: scale(1.14); box-shadow: inset 0 0 0 3px rgb(255 255 255 / 85%); }
.answer-strip button:focus-visible { box-shadow: inset 0 0 0 3px rgb(255 255 255 / 85%); }
.answer-detail { flex: 1; min-height: 0; overflow-y: auto; border-top: 1px solid var(--border); padding-top: 0.7rem; }
.answer-detail .item { border-left: 6px solid var(--border); padding: 0.1rem 0 0.1rem 1rem; animation: rise 0.25s var(--ease-out) both; }
.answer-detail .item.right { border-left-color: var(--good); }
.answer-detail .item.wrong { border-left-color: var(--bad); }
.review-title { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; font-size: 1.1rem; margin-bottom: 0.4rem; }
.verdict { margin-left: auto; font-size: 0.9rem; font-weight: 600; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.review-text { margin-bottom: 0.7rem; }
.review-options { display: grid; gap: 0.35rem; }
.review-options .opt { display: flex; align-items: baseline; gap: 0.6rem; padding: 0.45rem 0.7rem; border: 1px solid var(--border); }
.opt-letter { font-weight: 700; width: 1.2em; flex: none; }
.opt-text { flex: 1; min-width: 0; }
.opt-tag { flex: none; font-size: 0.85em; font-weight: 600; }
.review-options .opt.is-correct { border-color: var(--good); }
.review-options .opt.is-correct .opt-tag, .review-options .opt.is-correct .opt-letter { color: var(--good); }
.review-options .opt.picked-wrong { border-color: var(--bad); }
.review-options .opt.picked-wrong .opt-tag, .review-options .opt.picked-wrong .opt-letter { color: var(--bad); }
.review-options .opt.picked { background: var(--surface-2); }
.review-nav { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.review-pos { font-variant-numeric: tabular-nums; }
@media (max-width: 52rem) {
  .result-layout { grid-template-columns: 1fr; height: auto; }
  .result-comps { overflow: visible; }
  .answer-detail { max-height: 60vh; }
}
.btn .icon:last-child:not(:first-child) { margin: 0 0 0 0.4em; }

/* ---- preferences: pick by picture ---- */
.card-choices { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 0.4rem; }
.card-choice {
  font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--border-strong); padding: 0.5rem; cursor: pointer;
  display: grid; gap: 0.4rem; justify-items: center; min-width: 6.2rem; text-align: center;
  transition: border-color 0.15s, transform 0.25s var(--ease-spring), background-color 0.15s;
}
.card-choice:hover { border-color: var(--accent); transform: translateY(-2px); }
.card-choice.on { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.card-choice:focus-visible { outline: 2px solid var(--focus, var(--accent)); outline-offset: 2px; }
.card-preview { display: block; width: 100%; }
.card-label { font-size: 0.9em; }
.card-choice.on .card-label { font-weight: 600; }

.swatch { display: grid; grid-template-columns: 1fr; gap: 3px; width: 5.5rem; height: 3.2rem; padding: 4px; border: 1px solid #9aa; }
.swatch i { display: block; }
.swatch-light { background: #ffffff; } .swatch-light .bar { background: var(--brand); height: 0.7rem; } .swatch-light .line { background: #c9d3cd; height: 0.35rem; }
.swatch-dark { background: #0c100e; } .swatch-dark .bar { background: var(--brand-bright); height: 0.7rem; } .swatch-dark .line { background: #36433c; height: 0.35rem; }
.cb-swatch { display: flex; gap: 3px; justify-content: center; }
.cb-swatch i { width: 1.4rem; height: 1.4rem; display: block; }
.cb-swatch .g { background: var(--good); } .cb-swatch .b { background: var(--bad); } .cb-swatch .w { background: var(--warn); }

/* tiny diagrams of the exam screen, for the picture cards */
.lp { display: flex; width: 100%; max-width: 6rem; aspect-ratio: 4 / 3; margin: 0 auto; background: var(--surface-2); border: 1px solid var(--border-strong); overflow: hidden; border-radius: var(--radius-sm); }
.lp-rail-left { flex-direction: row; } .lp-rail-right { flex-direction: row-reverse; }
.lp-rail-top { flex-direction: column; } .lp-rail-bottom { flex-direction: column-reverse; }
.lp-rail { display: block; flex: none; }
.lp-rail-left .lp-rail, .lp-rail-right .lp-rail { width: 14%; }
.lp-rail-top .lp-rail, .lp-rail-bottom .lp-rail { height: 17%; }
.lp-stage { flex: 1; display: flex; flex-direction: column; gap: 3px; padding: 3px; min-width: 0; min-height: 0; }
.lp-stage.lp-bar-top { flex-direction: column-reverse; }
.lp-panels { flex: 1; display: flex; gap: 3px; min-height: 0; }
.lp-text, .lp-opts { display: block; flex: 1; }
.lp-barline { display: block; height: 12%; flex: none; }

/* What a card is about is drawn light and outlined; everything else is a quiet grey. */
.lp-rail, .lp-text, .lp-opts, .lp-barline { background: color-mix(in srgb, var(--text-muted) 45%, var(--surface-2)); }
.lp.focus-rail .lp-rail,
.lp.focus-arrange .lp-text, .lp.focus-arrange .lp-opts,
.lp.focus-bar .lp-barline { background: color-mix(in srgb, var(--accent) 22%, var(--bg)); box-shadow: inset 0 0 0 2px var(--accent); }
.lp.focus-arrange .lp-opts { background: color-mix(in srgb, var(--accent) 42%, var(--bg)); }
.card-choice .lp { transition: transform 0.25s var(--ease-spring); }
.card-choice:hover .lp { transform: scale(1.04); }

/* colour choices: each card shows its own colours (data-accent on the dot picks the palette) */
.accent-choices .card-choice { min-width: 4.6rem; padding: 0.4rem; }
.accent-dot { display: flex; width: 2.4rem; height: 2.4rem; margin: 0 auto; border: 1px solid var(--border-strong); overflow: hidden; }
.accent-dot i { display: block; flex: 1; }
.accent-dot .a1 { background: var(--brand); } .accent-dot .a2 { background: var(--brand-bright); }
.lp.focus-all .lp-rail, .lp.focus-all .lp-text, .lp.focus-all .lp-opts, .lp.focus-all .lp-barline { background: color-mix(in srgb, var(--accent) 28%, var(--bg)); box-shadow: inset 0 0 0 2px var(--accent); }
.lp.focus-all .lp-opts { background: color-mix(in srgb, var(--accent) 45%, var(--bg)); }
.arrange-card { display: flex; gap: 1rem; align-items: flex-start; }
.arrange-card .lp { flex: none; width: 8rem; max-width: 8rem; margin: 0.2rem 0 0; }
.arrange-card p { margin: 0 0 0.6rem; }

/* ---- the question editor: the editor on the left, the student's view on the right ---- */
.qe-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.qe-pane h3 { margin: 1.4rem 0 0.5rem; }
.qe-pane > .field:first-child { margin-top: 0; }
.qe-side { position: sticky; top: 0; }
.qe-side h3 { margin-top: 0; }
.qe-taxonomy { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem 1.2rem; }
/* An answer option on one line: the letter (click it to mark the answer), the text with its image button, a menu. */
.option-editor { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.6rem; align-items: start; }
.option-letter { position: relative; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; background: var(--surface-2); color: var(--text); font-weight: 700; border-radius: var(--radius-sm); cursor: pointer; transition: background-color 0.15s, color 0.15s; }
.option-letter:hover { background: color-mix(in srgb, var(--good) 22%, var(--surface-2)); }
.option-letter input { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; }
.option-letter:has(input:checked) { background: var(--good); color: #fff; }
.option-letter:has(input:focus-visible) { outline: 2px solid var(--focus, var(--accent)); outline-offset: 2px; }
.letter-tick { display: none; position: absolute; right: -0.3rem; top: -0.3rem; width: 1rem; height: 1rem; place-items: center; background: #fff; color: var(--good); border: 1px solid var(--good); border-radius: var(--radius-round); }
.letter-tick .icon { width: 0.7rem; height: 0.7rem; margin: 0; }
.option-letter:has(input:checked) .letter-tick { display: grid; }
.option-block > .btn { margin-top: 0.3rem; }
.btn-icon { padding-inline: 0.5rem; }
.btn-icon .icon { margin: 0; }
.option-list { display: grid; gap: 0.5rem; margin-bottom: 0.6rem; }
.checks { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.checks .check { padding: 0.3rem 0.7rem; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); cursor: pointer; transition: background-color 0.14s, border-color 0.14s; }
.checks .check:has(input:checked) { background: var(--surface-2); border-color: var(--accent); }

.qe-preview { min-width: 0; }

/* ---- the teacher's exam page: questions and results on the left, the rest beside them ---- */

.qlist { list-style: none; margin: 0 0 1rem; padding: 0 0.3rem 0 0; display: grid; max-height: min(30rem, 58vh); overflow-y: auto; overscroll-behavior: contain; }
.qrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 0.8rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--border); background: var(--bg); }
.qrow:last-child { border-bottom: 0; }
.q-no { display: grid; place-items: center; width: 2rem; height: 2rem; color: var(--text); font-weight: 700; border-radius: var(--radius-sm); user-select: none; -webkit-user-select: none; }
.q-body { min-width: 0; }
.q-line { overflow-wrap: anywhere; }
.q-excerpt { font-size: 0.9em; overflow-wrap: anywhere; margin-top: 0.1rem; }

@media (max-width: 40rem) {  .qrow { grid-template-columns: auto minmax(0, 1fr) auto; } }
.lifted-row { position: relative; z-index: 20; background: var(--surface-2); border-color: var(--accent); transition: none !important; }

.perf-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; margin-bottom: 0.8rem; }
.perf-stat { display: grid; padding: 0.5rem 0.6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perf-stat strong { font-size: 1.3rem; }
.perf-rows { display: grid; gap: 0.5rem; }

.sched-list, .ver-list { list-style: none; margin: 0 0 0.8rem; padding: 0; display: grid; gap: 0.5rem; }
.sched-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.8rem; padding: 0.55rem 0.7rem; border: 1px solid var(--border); border-radius: var(--radius); }
.sched-main { min-width: 0; display: grid; gap: 0.15rem; }
.sched-main .muted { font-size: 0.9em; }
.ver-row { display: flex; align-items: baseline; gap: 0.8rem; padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.ver-no { min-width: 2.2rem; color: var(--accent); }

/* ---- tag and competence pickers ---- */
/* The tag / competence picker: one field with chips inside, and a list that floats above the page. */
.chip-pick { font: inherit; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.2rem 0.15rem 0.6rem; cursor: pointer; border-radius: var(--radius-sm); background: var(--accent); color: var(--accent-contrast); border: 1px solid var(--accent); font-size: 0.9em; }
.chip-pick .icon { width: 0.9em; height: 0.9em; margin: 0; }
.chip-pick:hover { filter: brightness(1.1); }
.combo-pill.on { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.combo-item:hover, .combo-item.active { background: var(--surface-2); }
.combo-item.picked { font-weight: 600; }
.combo-tick .icon { margin: 0; width: 1rem; height: 1rem; }
.combo-foot .muted { margin-right: auto; }

/* license card on the admin dashboard */
.license-state { font-weight: 700; margin: 0 0 0.25rem; }
.license-active { color: var(--good); }
.license-grace, .license-expired { color: var(--bad); }
.license-body { min-height: 4rem; }

/* unsaved changes: a bar that sticks to the bottom of the screen while there is something to save */
.save-bar { position: sticky; bottom: 0.8rem; z-index: 10; display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem; margin-top: 0.8rem; padding: 0.55rem 0.8rem; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius); }
.save-bar > span:first-child { margin-right: auto; color: var(--text-muted); }

/* ---- the exam page: one column; the title is the form, the rest follows in the order you work ---- */

.back-link { display: inline-block; margin-bottom: 0.5rem; color: var(--text-muted); text-decoration: none; }
.back-link:hover { color: var(--text); text-decoration: underline; }

.head-actions { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.title-input, .desc-input { width: 100%; border: 1px solid transparent; background: transparent; color: inherit; font: inherit; padding: 0.2rem 0.4rem; margin-left: -0.4rem; }
.title-input { font-size: 1.6rem; font-weight: 600; letter-spacing: -0.01em; }
.desc-input { resize: none; overflow: hidden; color: var(--text-muted); min-height: 0; }
.title-input:hover, .desc-input:hover { border-color: var(--border); }
.title-input:focus, .desc-input:focus { border-color: var(--accent); background: var(--bg); color: var(--text); outline: none; }

.fold > summary { display: flex; align-items: center; gap: 0.6rem; cursor: pointer; list-style: none; }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::before { content: "›"; color: var(--text-muted); transition: transform 0.15s; display: inline-block; width: 0.8em; }
.fold[open] > summary::before { transform: rotate(90deg); }
.fold > summary h2 { margin: 0; }
.fold[open] > summary { margin-bottom: 0.9rem; }
.form-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
@media (max-width: 40rem) { .form-cols { grid-template-columns: 1fr; }  }
.letter-text { line-height: 1; }
.qe-taxonomy { margin-top: 1.6rem; }
.qe-pane .qe-taxonomy h3 { margin-top: 0; }

/* ---- choosing competences: a field of chips with a button, and a two-pane popup (matrix list, competence list) ---- */
.comp-field > .btn { margin-left: auto; }
.matrix-nav { display: grid; gap: 0.2rem; overflow-y: auto; align-content: start; }
.matrix-item { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0.6rem; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.matrix-item:hover { background: var(--surface-2); }
.matrix-item.on { background: var(--accent); color: var(--accent-contrast); }
.matrix-name { min-width: 0; overflow-wrap: anywhere; }
.matrix-count { flex: none; font-size: 0.85em; opacity: 0.8; }
.comp-foot .muted { margin-right: auto; }
@media (max-width: 40rem) { .matrix-nav { grid-auto-flow: column; overflow-x: auto; } }

/* tags and competences: a short list that scrolls inside its card; a click on a row edits it */
.catalog-list { list-style: none; margin: 0; padding: 0; }
.catalog { margin-top: 0.6rem; }
.catalog-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 0.8rem; row-gap: 0.1rem; padding: 0.5rem 0.3rem; border-bottom: 1px solid var(--border); }
.catalog-row > .catalog-name, .catalog-row > .catalog-detail { grid-column: 1; }
.catalog-row > :not(.catalog-name):not(.catalog-detail) { grid-column: 2; grid-row: 1 / span 2; }
.catalog-row:last-child { border-bottom: 0; }
.catalog-name { flex: 0 1 auto; min-width: 0; font-weight: 600; }
.catalog-detail { flex: 1 1 100%; min-width: 0; font-size: 0.9em; }
.card > input[type="search"] { margin-top: 0.2rem; }

/* ---- matrices / competences / tags: master and detail on one screen ---- */
.taxo { display: grid; gap: 0.75rem; }
.taxo-pane { display: grid; grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr); gap: 1.4rem; margin-bottom: 0; height: calc(100vh - 11rem); min-height: 24rem; }
.taxo-side h2, .taxo-main > .card-head h2 { margin-bottom: 0.7rem; }
.taxo-side .matrix-nav { margin-bottom: 0.6rem; }
.taxo-main { min-width: 0; }
.quick-add { display: flex; align-items: flex-start; gap: 0.5rem; padding: 0.15rem 0.5rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--bg); }
.quick-add:focus-within { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.quick-add > .icon { margin-top: 0.7rem; color: var(--text-muted); flex: none; }
.quick-add > input[type="color"] { margin-top: 0.35rem; width: 1.8rem; height: 1.8rem; padding: 0; border: 0; background: none; flex: none; }
.quick-input { flex: 1; min-width: 0; border: 0; box-shadow: none; background: transparent; resize: none; padding: 0.55rem 0.2rem; min-height: 0; overflow: hidden; outline: none; }
.quick-go { flex: none; margin-top: 0.3rem; }

.taxo-main .quick-add { margin-bottom: 0.7rem; }
.taxo-search { margin-bottom: 0.5rem; }
@media (max-width: 52rem) { .taxo-pane { grid-template-columns: 1fr; height: auto; } }

/* ---- the exam list: a name with its state, a quiet line about it, and the numbers on the right ---- */
.exam-list { list-style: none; margin: 0; padding: 0; }
.exam-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 1.2rem; align-items: center; padding: 0.8rem 0.4rem; border-bottom: 1px solid var(--border); }
.exam-row:last-child { border-bottom: 0; }
.exam-name { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.5rem; font-weight: 600; overflow-wrap: anywhere; }
.exam-name .badge { font-weight: 400; vertical-align: middle; }
.exam-desc { margin-top: 0.15rem; font-size: 0.9em; }
.exam-main { min-width: 0; }
.exam-meta { display: flex; gap: 0.3rem 1rem; flex-wrap: wrap; justify-content: flex-end; font-size: 0.9em; text-align: right; }
.exam-search { margin-bottom: 0.5rem; }
@media (max-width: 40rem) { .exam-row { grid-template-columns: minmax(0, 1fr) auto; } .exam-meta { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; text-align: left; } }

/* ---- the exam builder: questions on the left, what students see (and the rest of the exam) on the right ---- */
.exam-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 1.2rem; height: calc(100vh - 15rem); min-height: 26rem; }

.pane-title { font-size: 1rem; margin: 0 0 0.4rem; }
.pane-body { padding-top: 0.8rem; }

.qrow.on { background: var(--surface-2); box-shadow: inset 3px 0 0 var(--accent); }
.tabs { display: flex; gap: 0.2rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); position: sticky; top: -0.8rem; background: var(--bg); padding-top: 0.2rem; z-index: 2; margin: 0 -1rem; padding-inline: 1rem; }
.tab { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.5rem 0.55rem; white-space: nowrap; font-size: 0.92em; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--text-muted); font: inherit; cursor: pointer; margin-bottom: -1px; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
@media (max-width: 62rem) { .exam-split { grid-template-columns: 1fr; height: auto; }  .tabs { position: static; } }
.tab .badge { font-size: 0.8em; padding: 0 0.35rem; }

/* ---- the exam workspace: a strip on top, then bank | exam | preview filling the rest of the window ---- */
main:has(.xbuild) { max-width: none; padding-bottom: 0.8rem; }
.xbuild { display: grid; gap: 0.8rem; }
.xstrip { display: grid; gap: 0.3rem; }
.xstrip-row { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.xstrip-row .title-input { flex: 1; min-width: 12rem; }
.xstrip-row .desc-input { flex: 1; min-width: 12rem; }
.back-link { display: inline-flex; align-items: center; gap: 0.3rem; margin: 0; }
.back-link .icon { margin: 0; }
.builder { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.8rem; height: calc(100vh - 10.5rem); min-height: 28rem; }
.xpane { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 0.7rem 0.9rem 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; }
.pane-head .pane-title { margin: 0; }
.pane-head .actions { display: flex; align-items: center; gap: 0.4rem; }
.pane-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 0.8rem; }
.qrow.on { box-shadow: inset 3px 0 0 var(--accent); }
.outline-pane .qlist { max-height: none; overflow: visible; padding: 0; margin: 0; }
.outline-pane .qrow { grid-template-columns: auto minmax(0, 1fr) auto; }
.outline-pane .save-bar { position: sticky; bottom: 0; margin: 0 -0.9rem; border-radius: 0; border-width: 1px 0 0; flex-wrap: wrap; }
.preview-actions { margin-top: 0.8rem; display: flex; justify-content: flex-end; }
@media (max-width: 52rem) { .builder { grid-template-columns: 1fr; height: auto; } .side-pane, .outline-pane { height: 30rem; } }
.row-preview { flex-basis: 100%; grid-column: 1 / -1; margin: 0.5rem 0 0.2rem; cursor: default; }
.row-preview .preview-actions { margin-top: 0.6rem; }

/* the side sheet (schedule and results) */
dialog.side { position: fixed; inset: 0 0 0 auto; margin: 0; width: min(38rem, 100vw); max-width: none; height: 100vh; max-height: 100vh; border-radius: 0; }
dialog.side .dialog-body { overflow-y: auto; }

/* ---- groups: classes on the left, the roster of students (tick to add or remove) on the right ---- */
.roster { list-style: none; margin: 0; padding: 0; max-height: calc(100vh - 20rem); min-height: 12rem; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.roster-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.5rem 0.8rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.roster-row:last-child { border-bottom: 0; }
.roster-row:hover { background: var(--surface-2); }
.roster-row.in { background: var(--surface-2); }
.roster-label { display: flex; align-items: center; gap: 0.7rem; flex: 1; cursor: pointer; }
.roster-row input { margin: 0; flex: none; }

.group-stats .stats { margin: 0.4rem 0 1rem; }
.group-grid { gap: 1.4rem; align-items: start; }
.group-grid h3 { margin: 0.2rem 0 0.4rem; }
.group-grid h3 ~ h3 { margin-top: 1.2rem; }
.taxo-main > .tabs { margin: 0 0 0.8rem; padding-inline: 0; position: static; }

/* ---- the question bank: list | the highlighted question as students see it ---- */
/* the wide workspace pages: the header opens up with them, so the logo and the content share one left edge */
body:has(main .xbuild) .side-inner, body:has(main .xbuild) .header-inner { max-width: none; }
.qbank { display: grid; grid-template-columns: minmax(18rem, 0.9fr) minmax(0, 1.1fr); gap: 0.8rem; height: calc(100vh - 12rem); min-height: 28rem; }
.qbank-filters { display: grid; gap: 0.4rem; margin-bottom: 0.5rem; }
.qbank-search { display: flex; gap: 0.4rem; }
.qbank-search .search { flex: 1; min-width: 0; }
.qbank-selects { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 0.4rem; }
.qbank-list .question-row { padding: 0.55rem 0.5rem; }
.qbank-list .question-row.on { box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.qbank-list .tag-line { margin-top: 0.2rem; }
.qdetail { padding-top: 0.9rem; }
.qdetail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.qdetail-title { font-size: 1.15rem; margin: 0 0 0.3rem; }
@media (max-width: 62rem) { .qbank { grid-template-columns: 1fr; height: auto; } .qbank > .xpane:first-child { height: 30rem; } }
.qbank-list .grow { min-width: 0; }

/* ---- preferences: settings rows, saved as you go ---- */
.settings { max-width: 56rem; }
.save-status { font-size: 0.9em; }
.set-section { border-top: 1px solid var(--border); padding: 1.1rem 0 0.4rem; }
.set-section > h2 { font-size: 1rem; margin: 0 0 0.6rem; color: var(--text-muted); }
.set-row { display: grid; grid-template-columns: minmax(12rem, 18rem) minmax(0, 1fr); gap: 0.4rem 2rem; padding: 0.8rem 0; align-items: start; }
.set-row + .set-row { border-top: 1px dashed var(--border); }
.set-label { display: grid; gap: 0.2rem; }
.set-label small { font-size: 0.85em; line-height: 1.4; }
.set-control .arrange-card { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
@media (max-width: 44rem) { .set-row { grid-template-columns: 1fr; } }

/* ---- admin: accounts ---- */
.users-bar { display: flex; align-items: flex-end; justify-content: space-between; gap: 0.6rem 1rem; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin-bottom: 0.4rem; }
.users-bar .tabs { border-bottom: 0; position: static; margin: 0; padding: 0; }
.users-bar .search { max-width: 18rem; margin-bottom: 0.4rem; }
.user-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.55rem 0.3rem; }
.user-row .avatar { flex: none; }
.avatar[data-role="teacher"] { background: var(--accent); color: var(--accent-contrast); }
.avatar[data-role="student"] { background: var(--surface-2); color: var(--text); }
.avatar[data-role="admin"] { background: var(--text); color: var(--bg); }
.user-name .badge { font-size: 0.75em; vertical-align: middle; }
.user-meta { font-size: 0.88em; margin-top: 0.1rem; }
.user-seen { flex: none; font-size: 0.85em; color: var(--text-muted); white-space: nowrap; }
.user-seen.never { color: var(--warn, var(--text-muted)); }
.user-row .grow { min-width: 0; }
@media (max-width: 40rem) { .user-seen { display: none; } }
.user-list { min-height: 8rem; }

/* compact rows for paged lists */
.qbank-list .question-row { padding: 0.45rem 0.4rem; }
.qbank-list .q-line { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; flex-wrap: wrap; }
.qbank-list .q-title { flex: 0 1 auto; min-width: 0; font-weight: 600; }
.qbank-list .q-line .badge { flex: none; margin: 0; font-size: 0.75em; }
.qbank-list .q-excerpt { font-size: 0.9em; margin-top: 0.15rem; }
.add-search { min-width: 0; }

/* ---- sign in: the brand on one side, the form on the other; no top bar ---- */
body:has(.auth-split) .site-header { display: none; }
main:has(.auth-split) { max-width: none; padding: 0; margin: 0; }
.auth-split { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(22rem, 1fr); min-height: 100vh; }
.auth-brand { display: flex; flex-direction: column; justify-content: center; gap: 1.2rem; padding: 3rem clamp(2rem, 6vw, 6rem); background: var(--brand); color: #fff; }
[data-theme="dark"] .auth-brand { background: var(--brand-night); }
.auth-lockup { display: block; height: 3.6rem; width: auto; align-self: flex-start; }
.auth-school { margin: 0; font-size: 1.3rem; font-weight: 700; }
.auth-tagline { margin: 0; max-width: 26rem; font-size: 1.15rem; line-height: 1.5; color: rgb(255 255 255 / 85%); }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 5vw, 5rem); max-width: 30rem; width: 100%; justify-self: center; }
.auth-panel h1 { font-size: 1.6rem; margin: 0 0 1.2rem; }
.auth-panel form .btn-primary { width: 100%; justify-content: center; min-height: 2.8rem; margin-top: 0.4rem; }
.auth-panel form .muted { margin-top: 1.2rem; font-size: 0.9em; }
.has-reveal { position: relative; }
.has-reveal input { padding-right: 2.8rem; }
.reveal-btn { position: absolute; right: 0.35rem; bottom: 0.35rem; width: 2.2rem; height: 2.2rem; display: grid; place-items: center; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text-muted); cursor: pointer; }
.reveal-btn:hover, .reveal-btn[aria-pressed="true"] { color: var(--text); background: var(--surface-2); }
.reveal-btn .icon { margin: 0; }
@media (max-width: 52rem) {
  .auth-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 2rem 1.5rem; gap: 0.6rem; }
  .auth-lockup { height: 2.6rem; }
  .auth-tagline { font-size: 1rem; }
  .auth-panel { justify-content: flex-start; padding: 2rem 1.5rem; }
}

.group-title { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; min-width: 0; }
.card-head .actions { display: flex; align-items: center; gap: 0.5rem; }
.roster-row { cursor: default; }
.roster-label { cursor: default; }
.roster-login { font-size: 0.88em; }

/* the exam's right pane: tabs (the bank, schedule, results...) over a body that fills the rest */
.side-head { gap: 0.4rem; }
.side-head .tabs { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; position: static; margin: 0; padding-inline: 0; }
.side-head .tab { flex: none; padding-inline: 0.55rem; white-space: nowrap; }
.side-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-body > .pane-body { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: 0.7rem; }
.empty-cta { display: grid; gap: 0.8rem; justify-items: start; }

/* a row of the question list: tags and author on one quiet line */
.q-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.7rem; margin-top: 0.2rem; font-size: 0.82em; }
.q-tag { display: inline-flex; align-items: center; gap: 0.3rem; }

/* the question editor: the form on the left; on the right what the student sees, the classification, and what is left to do */
.qe-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; margin: 1.4rem 0 0.5rem; }
.qe-section-head h3 { margin: 0; }
.qe-class { display: grid; gap: 0.7rem; margin-top: 1.1rem; padding-top: 0.9rem; border-top: 1px solid var(--border); }
.qe-class-row h3 { margin: 0 0 0.35rem; font-size: 0.95em; }

/* competences and tags: how many questions use each */
.catalog-end { display: flex; align-items: center; gap: 0.6rem; }
.catalog-uses { font-size: 0.85em; font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }
.catalog-uses.none { color: var(--warn); }
.catalog-name .tag-dot { margin-right: 0.55rem; vertical-align: 0.05em; }
.side-hint { font-size: 0.88em; margin: 0.4rem 0 0; }
/* a row with no description line (a tag): the name and the count sit on the same line */
.catalog-row:not(:has(.catalog-detail)) > :not(.catalog-name) { grid-row: 1; }
.catalog-row:not(:has(.catalog-detail)) { padding-block: 0.7rem; }

/* competences and tags: the card fits the window; only the list scrolls (the add box, filter and pager stay put) */
.taxo-side, .taxo-main { min-height: 0; display: flex; flex-direction: column; }
.taxo-side .matrix-nav { overflow-y: auto; flex: 0 1 auto; min-height: 0; }
.taxo-main > .catalog { flex: 1; min-height: 0; overflow-y: auto; }
.taxo-main > .card-head, .taxo-main > .quick-add, .taxo-main > .taxo-search, .taxo-main > div:last-child:not(.catalog):not(.group-stats) { flex: none; }
.taxo-main > .group-stats { flex: 1; min-height: 0; overflow-y: auto; }
@media (max-width: 52rem) { .taxo-main > .catalog, .taxo-main > .group-stats { overflow: visible; } }

/* grading a paper sitting: the students and the pictures on the left, one student's answers on the right */
.grade-layout { display: grid; grid-template-columns: minmax(16rem, 21rem) minmax(0, 1fr); gap: 1rem; align-items: start; }
.grade-side { display: grid; gap: 0.8rem; position: sticky; top: 4.2rem; }
.grade-drop { display: flex; gap: 0.8rem; align-items: center; padding: 0.9rem 1rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer; }
.grade-drop > span { display: grid; gap: 0.15rem; }
.grade-drop:hover, .grade-drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.grade-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.grade-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; font-size: 0.88em; max-height: 9rem; overflow-y: auto; }
.grade-log li { display: flex; gap: 0.4rem; align-items: baseline; }
.grade-log li.ok .icon { color: var(--good); }
.grade-log li.bad { color: var(--bad); }
.grade-log .icon { width: 0.9em; height: 0.9em; flex: none; margin: 0; }
.grade-summary { margin: 0; }
.grade-students { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.15rem; max-height: 55vh; overflow-y: auto; }
.grade-student { display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.5rem 0.6rem; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; border-radius: var(--radius-sm); }
.grade-student:hover { background: var(--surface-2); }
.grade-student.on { background: var(--accent); color: var(--accent-contrast); }
.grade-student.on .badge { background: var(--bg); color: var(--text); }
.grade-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grade-editor { min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; }
.grade-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.grade-head h2 { display: inline; margin: 0 0.6rem 0 0; }
.grade-head .actions { display: flex; gap: 0.5rem; }
.grade-see { margin-left: 0.6rem; }
.grade-empty { display: grid; gap: 0.8rem; justify-items: start; }
.grade-note { margin: 0 0 0.8rem; }
.grade-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.35rem 1rem; }
.grade-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.4rem; border-radius: var(--radius-sm); }
.grade-row.flag { background: color-mix(in srgb, var(--warn) 18%, transparent); box-shadow: inset 3px 0 0 var(--warn); }
.grade-row.blank .grade-n { color: var(--text-muted); }
.grade-n { width: 1.7em; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.grade-opts { display: flex; gap: 0.25rem; }
.grade-opt { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; padding: 0; border: 1.5px solid var(--border-strong); border-radius: var(--radius-round); background: none; color: var(--text); font: inherit; font-size: 0.8em; font-weight: 700; cursor: pointer; }
.grade-opt:hover { border-color: var(--accent); }
.grade-opt.on { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.grade-sheet { margin-top: 1.1rem; }
.grade-sheet > summary { cursor: pointer; font-weight: 600; margin-bottom: 0.6rem; }
.grade-figure { margin: 0 0 1rem; }
.grade-canvas { display: block; max-width: 100%; height: auto; border: 1px solid var(--border-strong); }
.grade-bulk:empty { display: none; }
@media (max-width: 52rem) { .grade-layout { grid-template-columns: 1fr; } .grade-side { position: static; } }
.grade-page { min-width: 0; }
.grade-confirm { margin-left: auto; display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; padding: 0; border: 1px solid var(--warn); border-radius: var(--radius-sm); background: none; color: var(--warn); cursor: pointer; }
.grade-confirm:hover { background: var(--warn); color: #fff; }
.grade-confirm .icon { width: 0.9rem; height: 0.9rem; margin: 0; }
.grade-confirm-all { font: inherit; padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline; cursor: pointer; }

/* the outline's rows are grabbed by any empty part (js/pages/teacher-exam.js); the number is only decoration */
.outline-pane .qrow { cursor: grab; }
.outline-pane .qrow .more-btn, .outline-pane .qrow a, .outline-pane .qrow button { cursor: pointer; }
.outline-pane .qrow.lifted-row { cursor: grabbing; user-select: none; }
.q-no { user-select: none; }

/* the accounts just created: a table to read, and copy */
.created-wrap { max-height: 50vh; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); margin: 0.6rem 0; }
.created { width: 100%; border-collapse: collapse; }
.created th { position: sticky; top: 0; background: var(--surface-2); text-align: left; font-size: 0.8em; color: var(--text-muted); font-weight: 600; padding: 0.4rem 0.7rem; }
.created td { padding: 0.4rem 0.7rem; border-top: 1px solid var(--border); }
.created-code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: 0.02em; user-select: all; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
