/* English Now Exam - styles for the login page, the staff panel and the student pages.
   Colours, font and layout follow the owner's design screens.
   No inline styles are allowed by the Content-Security-Policy, so every style lives here. */

/* ---------- Font: Nunito (SIL Open Font License), self-hosted ---------- */
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/nunito-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/nunito-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2"); }

:root {
    --blue: #0a6ff8;
    --blue-dark: #0857c4;
    --yellow: #ffde59;
    --band: #c8d1d9;
    --paper: #f0efeb;
    --soft: #f4f6fc;
    --soft-blue: #e7f4ff;
    --grey-pill: #848684;
    --red: #fe2c55;
    --green: #16a34a;
    --ink: #111111;
    --muted: #5f6672;
    --line: #d3d7dc;
    --font: "Nunito", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: #fff;
}

h1 { margin: 0; }
p { margin: 0 0 1rem; }
a { color: var(--blue); }
img { max-width: 100%; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: .92em; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .875rem; margin: .35rem 0 0; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    padding: .55rem 1.1rem; border: 1px solid #c4c4c0; border-radius: 999px;
    background: var(--paper); color: var(--ink); font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible, button:focus-visible {
    outline: 3px solid rgba(10, 111, 248, .4); outline-offset: 2px;
}
.btn-primary {
    background: var(--blue); border-color: var(--blue); color: #fff;
    border-radius: 10px; text-transform: uppercase; letter-spacing: .03em;
}
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: #fff; }
.btn-accent { background: var(--yellow); border-color: var(--yellow); color: var(--blue); }
.btn-accent:hover { background: #f5d044; border-color: #f5d044; color: var(--blue-dark); }
.btn-ghost { background: transparent; }
.btn-small { padding: .25rem .8rem; font-size: .875rem; }
.is-disabled { opacity: .45; pointer-events: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 1.1rem; }
label { display: block; font-weight: 700; margin-bottom: .3rem; }
label.check { display: flex; align-items: center; gap: .55rem; font-weight: 600; margin-bottom: 0; }
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"],
input[type="search"], select, textarea {
    width: 100%; padding: .65rem .9rem; border: 1px solid #c4c4c0; border-radius: 8px;
    background: var(--paper); color: var(--ink); font: inherit;
}
::placeholder { color: #767676; font-style: italic; opacity: 1; }
input[type="checkbox"] { width: 1.1rem; height: 1.1rem; accent-color: var(--blue); }
textarea { resize: vertical; }
.field-error { color: #c3173b; font-size: .875rem; font-weight: 600; margin: .35rem 0 0; }
.form { max-width: 620px; }
.form.form-wide, .card.card-wide { max-width: 980px; }
.form .card + .card { margin-top: 1.25rem; }
.form-actions { margin-top: 1.25rem; }

/* Pictures (login logo, login photo, menu logo) on the "Login page" settings screen */
.brand-block { margin-bottom: 1.25rem; }
.brand-slot { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.brand-slot:first-of-type { border-top: 0; padding-top: .4rem; }
.brand-slot-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .6rem; }
.brand-preview {
    display: flex; align-items: center; justify-content: center; height: 150px; padding: .75rem; overflow: hidden;
    border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.brand-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.brand-preview-dark { background: var(--blue); height: 100px; }
.brand-preview-photo { padding: 0; }
.brand-preview-photo img { width: 100%; height: 100%; object-fit: cover; }
.brand-upload { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-top: .6rem; }
.brand-upload input[type="file"] { flex: 0 1 auto; min-width: 0; max-width: 100%; font: inherit; font-size: .9rem; }
.brand-reset { margin-top: .6rem; }

/* ---------- Alerts and badges ---------- */
.alert { padding: .75rem 1rem; border-radius: 8px; margin-bottom: 1rem; font-weight: 600; }
.alert-error { background: #ffe9ee; color: #b4122f; border: 1px solid #ffc2cf; }
.code-sample { background: var(--soft); border: 1px solid var(--line); border-radius: 6px; padding: .6rem .8rem; overflow-x: auto; font-size: .85rem; }
.alert-warn { background: #fff4d6; color: #7a4b00; border: 1px solid #f1d58a; }
.alert-ok { background: #e7f7ec; color: #14532d; border: 1px solid #bde5c9; }
.badge {
    display: inline-block; padding: .05rem .6rem; border-radius: 999px; font-size: .75rem; font-weight: 800;
    background: var(--soft-blue); color: var(--blue-dark);
}
.badge-ok { background: #e7f7ec; color: #14532d; }
.badge-off { background: #e6e7e9; color: var(--muted); }

/* ---------- Cards (blue title bar, like the exam section cards) ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.card-head {
    background: var(--blue); color: #fff; text-align: center; text-transform: uppercase; letter-spacing: .02em;
    font-weight: 800; padding: .7rem 1rem;
}
.card-body { padding: 1.25rem; }
.empty-note { color: var(--muted); margin: 0; }

/* ---------- Login page ---------- */
.login-body { background: #fff; }
.login { display: grid; grid-template-columns: 63.5fr 36.5fr; min-height: 100vh; }
.login-hero { position: relative; background: #8a5a2b; }
.login-hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 30% center; }
.login-panel { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 5.6vw, 6.75rem) 3rem clamp(1.5rem, 6.3vw, 7.5rem); }
.login-inner { width: 100%; max-width: 480px; }
.login-logo {
    display: block; height: 113px; width: auto; max-width: 70%; object-fit: contain; object-position: left center;
    margin-bottom: clamp(1.5rem, 6vh, 4.5rem);
}
.login-welcome { font-size: clamp(1.4rem, 1.7vw, 2rem); font-weight: 700; line-height: 1.2; margin: 0; }
.login-title { font-size: clamp(1.9rem, 2.4vw, 2.9rem); font-weight: 800; line-height: 1.15; margin: 0 0 clamp(1.25rem, 4vh, 2.75rem); }
.login-lead { font-size: 1.1rem; margin: 0 0 .75rem; }
.login-panel form { margin: 0; }
.input-lg {
    display: block; width: 100%; height: 58px; margin-bottom: 14px; padding: 0 1rem;
    border: 1px solid #c4c4c0; border-radius: 8px; background: var(--paper); color: var(--ink); font: inherit; font-size: 1.05rem;
}
.btn-login {
    display: block; width: 100%; height: 58px; margin-top: 2.25rem; border: 0; border-radius: 8px;
    background: var(--blue); color: #fff; font: inherit; font-size: 1.4rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .02em; cursor: pointer;
}
.btn-login:hover { background: var(--blue-dark); }
.login-contact { margin: 2.6rem 0 1.5rem; font-size: 1.1rem; line-height: 1.45; }
.login-contact a { font-style: italic; }
.social { display: flex; gap: .55rem; list-style: none; margin: 0; padding: 0; }
.social a {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
    background: var(--blue); color: #fff;
}
.social a:hover { background: var(--blue-dark); }
.social svg { width: 22px; height: 22px; fill: currentColor; }

/* ---------- App shell (student pages and staff panel): blue sidebar + grey title band ---------- */
.app { display: grid; grid-template-columns: clamp(250px, 20.4vw, 392px) 1fr; min-height: 100vh; }
/* The menu column stays in view while the page scrolls; its footer (Log out) is pinned to the bottom-left corner. */
.side { display: flex; flex-direction: column; background: #fff; border-right: 1px solid #1115; position: sticky; top: 0; height: 100vh; align-self: start; }
.side-brand { display: flex; align-items: center; height: 70px; padding: 0 .9rem; background: var(--blue); }
.side-brand img { height: 50px; width: auto; max-width: 100%; object-fit: contain; object-position: left center; }
.side-profile { display: flex; align-items: center; gap: .75rem; padding: .8rem .9rem; background: #fff; }
.avatar { flex: none; display: block; width: 52px; height: 52px; }
.avatar svg { width: 100%; height: 100%; display: block; }
.side-who { min-width: 0; }
.side-name { font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.side-sub { font-size: .85rem; color: var(--muted); }
.side-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.side-head {
    background: var(--yellow); padding: .5rem .9rem; font-weight: 800; text-transform: uppercase; letter-spacing: .01em;
}
.side-list { display: flex; flex-direction: column; gap: .5rem; padding: .6rem .6rem 1rem; }
.side-empty { margin: 0; padding: .75rem .9rem 1rem; color: var(--muted); font-size: .9rem; }
.pill {
    display: flex; align-items: center; gap: .65rem; padding: .22rem .9rem .22rem .25rem; min-height: 40px;
    background: var(--paper); border: 1px solid #c4c4c0; border-radius: 999px;
    color: var(--ink); text-decoration: none; font-size: .95rem;
}
.pill:hover { border-color: var(--blue); }
.pill.active { background: #fff; border-color: var(--blue); font-weight: 800; box-shadow: 0 0 0 2px rgba(10, 111, 248, .18); }
.pill-dot { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--blue); }
.side-foot { flex: none; padding: .9rem; background: var(--blue); }
.side-foot form { margin: 0; }
.btn-logout {
    display: block; width: 100%; max-width: 250px; margin: 0 auto; padding: .45rem 1rem; border: 0; border-radius: 999px;
    background: #fff; color: var(--blue); font: inherit; font-size: 1.15rem; font-weight: 600; text-transform: uppercase; cursor: pointer;
}
.btn-logout:hover { background: var(--yellow); }

.app-main { min-width: 0; display: flex; flex-direction: column; background: #fff; }
.band { background: var(--band); text-align: center; padding: clamp(.9rem, 2vw, 1.6rem) 1rem; border-bottom: 1px solid #1113; }
.band h1 { font-size: clamp(1.5rem, 2.8vw, 3.2rem); font-weight: 800; text-transform: uppercase; line-height: 1.1; }
.band p { margin: .3rem 0 0; font-size: clamp(.95rem, 1.5vw, 1.7rem); font-weight: 600; text-transform: uppercase; }
.app-content { padding: 1.5rem; }
.actions-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: #fff; }
.table th, .table td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid #e3e5e8; vertical-align: middle; }
.table th {
    background: var(--yellow); font-size: .8rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em;
}
.table tbody tr:hover td { background: var(--soft); }
.table tr:last-child td { border-bottom: 0; }
.table .actions { text-align: right; min-width: 11.5rem; }
.table .actions form { display: inline; }
.table .actions .btn { margin: .1rem 0; }
.table .nowrap { white-space: nowrap; }
.table .break { overflow-wrap: anywhere; }
.table-compact th, .table-compact td { padding: .6rem .6rem; }
.table-compact td { font-size: .94rem; }
.table-compact .actions { min-width: 10.5rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; flex: 1 1 320px; }
.toolbar input[type="search"] { flex: 1 1 200px; width: auto; border-radius: 999px; }
.toolbar select { width: auto; border-radius: 999px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: 1rem; }

/* ---------- One-time PIN ---------- */
.pin-banner { background: var(--yellow); border-radius: 14px; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.pin-banner .hint { color: #4a4a2a; }
.pin-row { display: flex; align-items: center; gap: 1rem; margin: .5rem 0; flex-wrap: wrap; }
.pin-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 2rem; font-weight: 800; letter-spacing: .2em; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.stat .card-body { text-align: center; background: var(--paper); }
.stat-number { font-size: 2.6rem; font-weight: 800; color: var(--blue); line-height: 1.1; }

/* ---------- Schedules, student exam pages ---------- */
[hidden] { display: none !important; }
.card-gap { margin-top: 1.25rem; }
.btn-row { display: inline-flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.btn-row form { margin: 0; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; align-items: start; }
.meta { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0 0 1rem; }
.meta dt { font-weight: 800; }
.meta dd { margin: 0; }
.badge-open { background: #e7f7ec; color: #14532d; }
.badge-upcoming { background: var(--soft-blue); color: var(--blue-dark); }
.badge-closed { background: #ffe9ee; color: #b4122f; }
.checklist { border: 1px solid var(--line); border-radius: 10px; padding: .75rem 1rem 1rem; margin: 0; }
.checklist legend { font-weight: 800; padding: 0 .4rem; }
.checklist .check { margin-top: .5rem; }
.code-box {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 2.4rem; font-weight: 800; letter-spacing: .2em;
    text-align: center; background: var(--yellow); border-radius: 12px; padding: .6rem 1rem; margin: 0 0 .75rem;
}
.code-input { text-transform: uppercase; letter-spacing: .25em; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-weight: 700; }
.exam-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.exam-card {
    display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; padding: 1rem 1.1rem;
    border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink); text-decoration: none;
}
.exam-card:hover { border-color: var(--blue); }
.rules { margin: 0 0 1.25rem; padding-left: 1.25rem; }
.rules li { margin-bottom: .45rem; }
.audio-check { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; }
.audio-check .check { margin-top: .75rem; }
.audio-check p > strong:first-child, .mic-check p > strong:first-child { display: block; margin-bottom: .25rem; }
.add-ids textarea { margin: .3rem 0 .6rem; }
.danger-zone { margin-top: 2rem; text-align: right; }
.results-note { margin-top: 1rem; }

/* ---------- Set builder ---------- */
.inline-form { display: flex; align-items: flex-end; gap: .6rem; flex-wrap: wrap; margin: 0; }
.inline-form label { margin: 0; font-size: .85rem; }
.inline-form input[type="text"] { min-width: 14rem; margin-top: .2rem; }
.inline-form input[type="number"], .narrow { width: 6rem; margin-top: .2rem; }
input[type="number"] { padding: .65rem .6rem; border: 1px solid #c4c4c0; border-radius: 8px; background: var(--paper); font: inherit; width: 100%; }
.section-tools { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.audio-box { margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.audio-box audio { display: block; width: 100%; max-width: 480px; margin: .4rem 0 .8rem; }
.audio-box form { margin-bottom: .5rem; }
.part-block { margin-top: 1.25rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.part-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; justify-content: space-between; margin-bottom: 1rem; }
.part-range { font-weight: 700; color: var(--blue-dark); }
.doc-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.doc-slot { padding: .85rem 1rem; border: 1px dashed #aab1b8; border-radius: 10px; background: var(--soft); }
.doc-slot p { margin: .3rem 0 .5rem; }
.pdf-upload { margin-top: .6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.pdf-upload input[type="file"] { flex: 1 1 200px; min-width: 0; font: inherit; font-size: .9rem; }
.pdf-progress { flex: 1 1 100%; width: 100%; height: .7rem; }
.pdf-status { flex: 1 1 100%; margin: 0; }
.q-rows { margin: .75rem 0; display: flex; flex-direction: column; gap: .6rem; }
.q-row {
    display: flex; flex-wrap: wrap; gap: .6rem .8rem; align-items: flex-end;
    padding: .7rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft);
}
.q-f { flex: 0 0 auto; }
.q-f:first-child { width: 230px; }
.q-small { width: 90px; }
.q-row .q-key { flex: 1 1 220px; }
.q-f label { margin: 0; font-size: .8rem; }
.q-f input, .q-f select { margin-top: .2rem; padding: .5rem .6rem; }
.q-fixed { display: flex; flex-direction: column; gap: .1rem; }
.q-end { margin-left: auto; }
.part-add { margin-top: 1.25rem; }
.write-form { display: flex; flex-direction: column; gap: .5rem; }
.write-fields { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; }
.write-fields label { margin: 0; font-size: .85rem; }
.write-form textarea { width: 100%; padding: .6rem .7rem; border: 1px solid #c4c4c0; border-radius: 8px; background: var(--paper); font: inherit; }

/* ---------- Sitting screen (proctors) ---------- */
.sitting-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.sitting-code { display: flex; align-items: center; gap: .8rem; }
.sitting-code .code-box { margin: 0; font-size: 1.6rem; padding: .25rem .9rem; }
.row-locked td { background: #fff3f5; }
.row-warn td { background: #fffbe6; }
.strike-dots { letter-spacing: .15em; font-weight: 800; color: var(--red); white-space: nowrap; }
.seen-old { color: var(--red); font-weight: 700; }
.proctor-forms { display: flex; flex-direction: column; gap: .4rem; min-width: 260px; }
.proctor-forms form { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.proctor-forms input[type="text"] { flex: 1 1 150px; padding: .3rem .6rem; font-size: .85rem; }
.proctor-forms input[type="number"] { width: 4.5rem; padding: .3rem .4rem; font-size: .85rem; }
.event-log { font-size: .85rem; color: var(--muted); margin: .4rem 0 .9rem; padding-left: 1.1rem; }

/* ---------- Small screens ---------- */
@media (max-width: 900px) {
    .login { grid-template-columns: 1fr; }
    .login-hero { height: 200px; }
    .login-panel { padding: 2rem 1.25rem 3rem; }
    .login-inner { margin: 0 auto; }

    .app { grid-template-columns: 1fr; }
    .side { position: static; height: auto; min-height: 0; border-right: 0; border-bottom: 1px solid #1115; }
    .side-scroll { max-height: 300px; }
    .app-content { padding: 1rem; }
}

/* ---------- Grading ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grading-note { margin: 0 0 1rem; max-width: 60rem; }
.grading-grid td { vertical-align: middle; }
.grade-link { text-decoration: none; display: inline-flex; gap: .4rem; align-items: center; color: inherit; }
.grade-link:hover .badge { filter: brightness(.95); }
.grade-score { font-variant-numeric: tabular-nums; font-weight: 700; }
.push-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; padding: .4rem 0; border-bottom: 1px solid #0001; }
.push-row:last-child { border-bottom: 0; }
.push-name { font-weight: 800; min-width: 14rem; }
.push-row .btn { margin-left: auto; }
.grade-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin: .5rem 0 1rem; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; }
.tab { padding: .35rem .9rem; border-radius: 999px; background: #fff; border: 1px solid #0002; color: inherit; text-decoration: none; font-weight: 700; font-size: .9rem; }
.tab.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.tab-off { color: var(--muted); font-weight: 600; }
.grade-status { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.grade-total { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.paper { background: #fff; border: 1px solid #0002; border-radius: 12px; padding: .6rem 1rem; margin-bottom: 1rem; }
.paper summary { cursor: pointer; font-weight: 800; }
.paper-part { margin: 1rem 0 .4rem; }
.paper-pages { display: flex; flex-wrap: wrap; gap: .6rem; }
.paper-pages img { max-width: 100%; width: 560px; height: auto; border: 1px solid #0002; background: #fff; }
.grade-part th { background: var(--soft-blue); text-align: left; }
.grade-answer.wrong, .grade-key.wrong { color: #b4122f; }
.grade-answer { font-weight: 700; }
.chips { display: inline-flex; gap: .25rem; flex-wrap: wrap; }
.chip { min-width: 1.7rem; text-align: center; padding: .1rem .35rem; border-radius: 6px; border: 1px solid #0002; background: #fff; font-weight: 700; color: var(--muted); }
.chip-key { color: #14532d; border-color: #14532d; background: #e7f7ec; }
.chip-chosen { box-shadow: 0 0 0 3px #bfe2ff; }
.grade-key.wrong .chip-key { color: #b4122f; border-color: #b4122f; background: #ffe9ee; }
.grade-mark { white-space: nowrap; }
.grade-table .mark-input, .rubric-table .mark-input { width: 4.4rem; display: inline-block; padding: .3rem .5rem; text-align: right; font-variant-numeric: tabular-nums; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.result { display: inline-flex; flex-wrap: wrap; gap: .4rem; align-items: baseline; }
.result-stack { display: flex; flex-direction: column; gap: .35rem; }
.result-scaled { background: var(--soft-blue); color: var(--blue-dark); border-radius: 999px; padding: .1rem .6rem; font-weight: 700; font-size: .85rem; }
.comment-text { white-space: pre-wrap; margin: 0; }

/* ---------- Grading: Writing ---------- */
.part-grade-head { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.part-grade-meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-weight: 400; }
.essay {
    white-space: pre-wrap; overflow-wrap: anywhere; max-height: 30rem; overflow-y: auto;
    padding: .9rem 1rem; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft);
    font-size: 1.02rem; line-height: 1.6;
}
.rubric-table td, .rubric-table th { vertical-align: top; }
.rubric-table label { font-weight: 700; }
.rubric-table tfoot th { text-align: right; background: var(--soft); }
.rubric-table td.grade-mark { width: 9rem; }
.part-grade-meta .muted { color: #fff; opacity: .9; }
.mark-input.invalid { border-color: #c62828; background: #fdecea; }
.feedback-part { margin: 0 0 .3rem; font-size: 1rem; }
.feedback-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.feedback-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .25rem 0; border-bottom: 1px solid var(--line); }
.clip-list { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-direction: column; gap: .8rem; }
.clip { padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.clip-text { margin: 0 0 .2rem; font-weight: 700; }
.clip p.muted { margin: 0 0 .4rem; }
.clip audio { display: block; width: 100%; max-width: 480px; margin: .3rem 0; }
.clip-missing { margin: .3rem 0 0; color: #a11919; font-weight: 700; }

/* ---------- Microphone check ---------- */
.mic-check { padding: 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.mic-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: .5rem 0; }
.mic-row select { flex: 1 1 260px; min-width: 0; padding: .5rem .6rem; border: 1px solid #c4c4c0; border-radius: 8px; background: var(--paper); font: inherit; }
#mic-level { width: 10rem; height: .9rem; }
#mic-playback { display: block; width: 100%; max-width: 420px; margin: .5rem 0; }

/* Phase 7: overall result, certificate, review */
.overall-figure { margin: 0 0 .3rem; font-size: 2.2rem; display: flex; align-items: baseline; gap: .7rem; }
.overall-figure .result-scaled { font-size: 1rem; }
.cert-row { align-items: center; margin-top: .8rem; }
.cert-cell { min-width: 14rem; }
.cert-cell .badge { margin-right: .3rem; }
.cert-reason { margin: .3rem 0 0; font-size: .85rem; }
.cert-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: flex-start; margin-top: .4rem; }
.void-box summary { cursor: pointer; font-size: .85rem; font-weight: 700; color: #b4122f; padding: .25rem 0; }
.void-form { display: grid; gap: .4rem; margin-top: .3rem; max-width: 18rem; }
.void-form textarea { width: 100%; padding: .4rem .5rem; border: 1px solid #c4c4c0; border-radius: 8px; font: inherit; background: var(--paper); }
.review-table .review-answer { font-weight: 700; }
.review-wrong .review-answer, .review-wrong .review-key { color: #b4122f; }
.review-partial .review-answer { color: #8a5a00; }
.review-correct .review-answer { color: #14532d; }

/* Accounts (PIN card) */
.form-actions form { display: inline-block; margin: 0 .5rem .5rem 0; }

/* Scoring: table-form editor */
.field-row { display: flex; flex-wrap: wrap; gap: 1rem; }
.field-row .field { flex: 1 1 14rem; }
.template-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.template-form select { flex: 0 1 18rem; min-width: 0; padding: .5rem .6rem; border: 1px solid #c4c4c0; border-radius: 8px; background: var(--paper); font: inherit; }
.template-totals { margin: .3rem 0 1rem; padding-left: 1.2rem; }
.grid-title { margin: 1.2rem 0 .4rem; font-size: 1.05rem; }
.grid-scroll { max-height: 26rem; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.grid-scroll-short { max-height: 24rem; }
.grid-input { min-width: 30rem; }
.grid-input thead th { position: sticky; top: 0; z-index: 1; }
.grid-input td { padding: .3rem .5rem; }
.grid-input input { width: 100%; min-width: 4.5rem; padding: .4rem .5rem; border: 1px solid #c4c4c0; border-radius: 6px; background: var(--paper); font: inherit; }
.grid-input tbody tr:hover td { background: transparent; }
.rubric-step { margin-bottom: .6rem; }
.rubric-step select { padding: .5rem .6rem; border: 1px solid #c4c4c0; border-radius: 8px; background: var(--paper); font: inherit; }
.grid-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .6rem; }

.danger-password { display: inline-flex; align-items: center; gap: .5rem; margin-right: .6rem; font-size: .85rem; font-weight: 600; }
.danger-password input { width: 12rem; }
