:root {
  --bg: #f4f3f2;
  --surface: #ffffff;
  --surface-2: #f8f7f6;
  --ink: #1d1a1a;
  --muted: #706b6b;
  --line: #ded9d7;
  --brand: #7a1f2b;
  --brand-dark: #4c1119;
  --brand-soft: #f5e9eb;
  --gold: #d9aa42;
  --green: #27745b;
  --amber: #9a6508;
  --red: #a12b36;
  --blue: #2f608f;
  --shadow: 0 14px 36px rgba(54, 31, 34, 0.09);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: 0;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 64px;
  color: #fff;
  background: var(--brand-dark);
  border-bottom: 3px solid var(--gold);
}

.topbar-inner {
  width: min(1280px, calc(100% - 40px));
  height: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 26px;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 250px;
  gap: 12px;
}

.brand-logo { flex: 0 0 43px; width: 43px; height: 43px; object-fit: contain; }

.brand-copy { display: grid; align-content: center; line-height: 1.08; }
.brand-copy strong { color: #fff; font-size: 16px; font-weight: 850; white-space: nowrap; }
.brand-copy small { margin-top: 4px; color: #efc76c; font-size: 11px; font-weight: 800; white-space: nowrap; }

.nav { display: flex; align-self: stretch; gap: 3px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  color: rgba(255,255,255,.72);
  font-weight: 650;
  border-bottom: 3px solid transparent;
}
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.06); border-bottom-color: var(--gold); }
.mobile-nav-toggle { display: none; }

.user-menu { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-name { color: rgba(255,255,255,.72); font-size: 12px; }

.app-shell { width: min(1280px, calc(100% - 40px)); margin: 0 auto; padding: 26px 0 60px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 20px;
}
.page-head h1 { margin: 0; font-size: 25px; line-height: 1.25; }
.page-head p { margin: 6px 0 0; color: var(--muted); }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.student-page-actions { align-items: center; flex-wrap: nowrap; }
.student-search-form { display: flex; align-items: center; gap: 8px; }
.student-search-form .input { width: 310px; }
.student-name-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink); }
.student-name-link:hover { color: var(--brand); }
.student-name-link svg { width: 16px; height: 16px; color: var(--brand); }
.student-average-score { color: var(--brand); font-weight: 800; }
.score-overview-table { min-width: 1040px; table-layout: fixed; }
.score-overview-table th, .score-overview-table td { padding: 8px 7px; border: 1px solid #d7d3d1; text-align: center; }
.score-overview-table thead th { color: #fff; font-size: 11px; }
.score-overview-table .overview-student-head, .score-overview-table .overview-total-head { width: 114px; background: #88898c; }
.score-overview-table .overview-listening { background: #1687a8; }
.score-overview-table .overview-reading { background: #27865d; }
.score-overview-table .overview-cloze { background: #356f9d; }
.score-overview-table .overview-grammar { background: #b85c63; }
.score-overview-table .overview-essay { background: #397858; }
.score-overview-table tbody td:first-child { text-align: left; }
.score-overview-table tbody td:first-child a { display: grid; gap: 1px; }
.score-overview-table tbody td:first-child small { color: var(--muted); font-size: 10px; font-weight: 500; }
.score-overview-table .overview-total { background: #f2f1f0; font-size: 15px; }
.score-overview-table .overview-total a { display: grid; gap: 1px; }
.score-overview-table .overview-total small { color: var(--amber); font-size: 9px; }
.score-overview-table .overview-absence { color: #8b2530; background: #faf1f2; font-weight: 800; letter-spacing: 0; }
.score-overview-table .is-absent td:first-child { color: var(--muted); }
.score-overview-table tfoot th, .score-overview-table tfoot td { color: #b52218; background: #fffafa; font-weight: 850; }
.exam-page-head { align-items: center; }
.exam-heading-summary { display: flex; flex: 1 1 auto; align-items: center; min-width: 0; gap: 22px; }
.exam-heading-copy { flex: 0 1 auto; min-width: 250px; }
.exam-score-statistics { display: grid; flex: 0 0 auto; grid-template-columns: repeat(4, minmax(82px, 1fr)); min-width: 372px; margin: 0; overflow: hidden; background: #f8f6f5; border: 1px solid var(--line); border-radius: 6px; }
.exam-score-statistics > div { display: grid; justify-items: center; gap: 2px; min-width: 0; padding: 8px 13px 9px; border-right: 1px solid #e3dedd; text-align: center; }
.exam-score-statistics > div:last-child { border-right: 0; }
.exam-score-statistics dt { color: var(--muted); font-size: 10px; font-weight: 720; line-height: 1.25; white-space: nowrap; }
.exam-score-statistics dd { min-width: 4ch; margin: 0; color: var(--brand); font-size: 18px; font-weight: 820; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 5px 18px rgba(42, 26, 28, .035);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.panel-head h2, .panel-head h3 { margin: 0; font-size: 15px; }
.panel-body { padding: 16px; }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { padding: 15px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 5px; font-size: 27px; line-height: 1.15; }
.metric-icon { color: var(--brand); }

.two-col { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(290px, 1fr); gap: 16px; }
.stack { display: grid; gap: 16px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #cfc9c7;
  border-radius: 6px;
  font-weight: 700;
}
.btn:hover { background: var(--surface-2); border-color: #b7aeac; }
.btn-primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.btn-primary:hover { background: #681823; border-color: #681823; }
.btn-danger { color: var(--red); background: #fff; border-color: #dcbac0; }
.btn-quiet { color: rgba(255,255,255,.76); background: transparent; border-color: rgba(255,255,255,.25); min-height: 33px; padding: 6px 9px; }
.btn-sm { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.btn-icon { width: 34px; min-width: 34px; padding: 0; }
.btn svg { width: 16px; height: 16px; }
.btn.mobile-nav-toggle { display: none; }

.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 750; color: #474141; }
.status-fieldset { min-width: 0; margin-right: 0; margin-left: 0; padding: 0; border: 0; }
.status-fieldset legend { margin-bottom: 7px; color: #474141; font-size: 12px; font-weight: 750; }
.status-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 520px; }
.status-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.status-picker label { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 0; height: 42px; color: #514b49; background: #fff; border: 1px solid #d1cbc8; border-radius: 6px; font-size: 13px; font-weight: 750; cursor: pointer; transition: color .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.status-picker label:hover { color: var(--brand); border-color: #a7797e; background: #fdf9f9; }
.status-picker label svg { flex: 0 0 auto; width: 17px; height: 17px; }
.status-picker input:checked + label { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 2px 7px rgba(97,24,34,.18); }
.status-picker input:focus-visible + label { outline: 2px solid rgba(122,31,43,.35); outline-offset: 2px; }
.class-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.class-fieldset legend { margin-bottom: 8px; color: #3e3937; font-size: 13px; font-weight: 750; }
.class-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.class-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.class-picker label { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px; color: #514b49; background: #fff; border: 1px solid #d1cbc8; border-radius: 6px; font-size: 13px; font-weight: 750; cursor: pointer; transition: color .16s ease, background .16s ease, border-color .16s ease, box-shadow .16s ease; }
.class-picker label:hover { color: var(--brand); border-color: #a7797e; background: #fdf9f9; }
.class-picker label svg { width: 16px; height: 16px; }
.class-picker input:checked + label { color: #fff; background: var(--brand); border-color: var(--brand); box-shadow: 0 2px 7px rgba(97,24,34,.18); }
.class-picker input:focus-visible + label { outline: 2px solid rgba(122,31,43,.35); outline-offset: 2px; }
.field-note { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.class-picker-empty { padding: 12px 14px; color: var(--muted); background: #f8f6f5; border: 1px solid #e2dcda; border-radius: 6px; font-size: 13px; }
.input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9c3c1;
  border-radius: 5px;
  outline: none;
}
textarea { resize: vertical; }
.input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(122,31,43,.13); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.help { color: var(--muted); font-size: 12px; }
.live-search-empty { padding: 22px 12px; color: var(--muted); text-align: center; font-size: 12px; }
.account-panel { width: min(520px, 100%); }
.account-panel form { display: grid; gap: 14px; }

.flash-wrap { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 10px 13px; border: 1px solid; border-radius: 6px; font-weight: 650; }
.flash.success { color: #175b45; background: #e9f4ef; border-color: #b7d7ca; }
.flash.error { color: #81202a; background: #f8e9eb; border-color: #e2b9bf; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #ece8e6; vertical-align: middle; }
th { color: var(--muted); background: #faf9f8; font-size: 11px; font-weight: 800; white-space: nowrap; }
tbody tr:hover { background: #fcfbfa; }
.submission-clickable-row, .clickable-table-row { cursor: pointer; }
.submission-clickable-row:hover, .clickable-table-row:hover { background: #f8f2f3; }
.submission-clickable-row:focus-visible, .clickable-table-row:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; background: #f8f2f3; }
.submission-clickable-row [data-row-actions], .clickable-table-row [data-row-actions] { cursor: default; }
.submission-score-sort { display: inline-flex; align-items: center; gap: 5px; min-height: 38px; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 0; font: inherit; font-weight: 800; white-space: nowrap; }
.submission-score-sort:hover, .submission-score-sort:focus-visible, .submission-score-sort[data-sort-state]:not([data-sort-state="none"]) { color: var(--brand); }
.submission-score-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.submission-score-label { display: grid; gap: 2px; text-align: left; }
.submission-score-label strong { font: inherit; font-weight: 800; }
.submission-score-average { color: #8a8280; font-size: 9px; font-weight: 650; line-height: 1; }
.submission-sort-icons { display: inline-grid; width: 13px; height: 13px; place-items: center; }
.submission-sort-icons svg { display: none; grid-area: 1 / 1; width: 13px; height: 13px; }
.submission-score-sort[data-sort-state="none"] [data-sort-icon="none"],
.submission-score-sort[data-sort-state="desc"] [data-sort-icon="desc"],
.submission-score-sort[data-sort-state="asc"] [data-sort-icon="asc"] { display: block; }
td.num { font-variant-numeric: tabular-nums; font-weight: 750; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }

.past-paper-page-head { align-items: center; }
.past-paper-metrics .metric strong { display: flex; align-items: baseline; gap: 3px; }
.past-paper-metrics .metric strong small { color: var(--muted); font-size: 13px; font-weight: 720; }
.past-paper-panel { overflow: hidden; }
.past-paper-panel-head { align-items: center; min-height: 64px; }
.past-paper-panel-title { display: flex; flex: 1 1 auto; align-items: center; gap: 10px; min-width: 0; white-space: nowrap; }
.past-paper-last-updated { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding-left: 16px; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; font-style: normal; }
.past-paper-last-updated svg { width: 14px; height: 14px; }
.past-paper-last-updated strong { color: #5f5a58; font-weight: 740; }
.past-paper-toolbar { display: flex; flex: 0 1 auto; align-items: center; justify-content: flex-end; gap: 10px; min-width: 0; }
.past-paper-filters { display: inline-flex; flex: 0 0 auto; height: 38px; gap: 2px; padding: 3px; background: #efedeb; border: 1px solid #dfdad7; border-radius: 6px; }
.past-paper-filters button { height: 30px; padding: 4px 11px; color: var(--muted); background: transparent; border: 0; border-radius: 4px; font-size: 11px; font-weight: 760; }
.past-paper-filters button:hover { color: var(--brand); }
.past-paper-filters button.active { color: #fff; background: var(--brand); box-shadow: 0 1px 4px rgba(78, 20, 28, .2); }
.past-paper-search { position: relative; display: block; flex: 0 1 230px; height: 38px; min-width: 170px; }
.past-paper-search > svg { position: absolute; top: 50%; left: 11px; z-index: 1; width: 20px; height: 20px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.past-paper-search input { display: block; width: 100%; height: 38px; padding: 7px 34px 7px 40px; color: var(--ink); background: #fff; border: 1px solid #c9c3c1; border-radius: 5px; outline: 0; }
.past-paper-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(122,31,43,.13); }
.past-paper-table-wrap { max-height: calc(100vh - 340px); min-height: 360px; overflow: auto; overscroll-behavior: contain; isolation: isolate; }
.past-paper-table { min-width: 1132px; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.past-paper-table thead { position: static; }
.past-paper-table th { position: sticky; top: 0; z-index: 4; height: 48px; padding: 9px 5px; color: #5d5856; background: #f7f5f4; border-bottom: 1px solid #d8d3d0; text-align: center; font-size: 13px; font-weight: 800; }
.past-paper-table td { height: 52px; padding: 6px 4px; text-align: center; font-size: 13px; }
.past-paper-table .past-paper-title-column { width: 250px; padding-left: 16px; text-align: left; }
.past-paper-table .past-paper-progress-column { width: 76px; }
.past-paper-table .past-paper-action-column { width: 44px; }
.past-paper-table .past-paper-title-column { left: 0; z-index: 6; box-shadow: 1px 0 0 #ddd7d4; }
.past-paper-table th.past-paper-module-listening { color: #245f78; background: #e8f2f7; box-shadow: inset 0 3px 0 #4c89a1; }
.past-paper-table th.past-paper-module-reading_1,
.past-paper-table th.past-paper-module-reading_2,
.past-paper-table th.past-paper-module-reading_3,
.past-paper-table th.past-paper-module-reading_4 { color: #28634e; background: #e9f3ee; box-shadow: inset 0 3px 0 #4c8b70; }
.past-paper-table th.past-paper-module-cloze,
.past-paper-table th.past-paper-module-grammar { color: #75551d; background: #f6efdf; box-shadow: inset 0 3px 0 #bd8e37; }
.past-paper-table th.past-paper-module-small_essay,
.past-paper-table th.past-paper-module-big_essay { color: #7a1f2b; background: #f5e9eb; box-shadow: inset 0 3px 0 #9a3846; }
.past-paper-table td.past-paper-module-listening { background: #fbfdfe; }
.past-paper-table td.past-paper-module-reading_1,
.past-paper-table td.past-paper-module-reading_2,
.past-paper-table td.past-paper-module-reading_3,
.past-paper-table td.past-paper-module-reading_4 { background: #fbfdfc; }
.past-paper-table td.past-paper-module-cloze,
.past-paper-table td.past-paper-module-grammar { background: #fffdf8; }
.past-paper-table td.past-paper-module-small_essay,
.past-paper-table td.past-paper-module-big_essay { background: #fffafb; }
.past-paper-table .past-paper-module-reading_1 { border-left: 2px solid #c9ded4; }
.past-paper-table .past-paper-module-cloze { border-left: 2px solid #e3d3ad; }
.past-paper-table .past-paper-module-small_essay { border-left: 2px solid #dfc2c7; }
.past-paper-title-cell { position: sticky; left: 0; z-index: 2; padding-left: 16px !important; background: #fff; box-shadow: 1px 0 0 #ece8e6; text-align: left !important; }
.past-paper-table tbody tr:hover .past-paper-title-cell { background: #fcfbfa; }
.past-paper-table tbody tr:hover td.past-paper-module-listening { background: #f5fafc; }
.past-paper-table tbody tr:hover td.past-paper-module-reading_1,
.past-paper-table tbody tr:hover td.past-paper-module-reading_2,
.past-paper-table tbody tr:hover td.past-paper-module-reading_3,
.past-paper-table tbody tr:hover td.past-paper-module-reading_4 { background: #f5faf7; }
.past-paper-table tbody tr:hover td.past-paper-module-cloze,
.past-paper-table tbody tr:hover td.past-paper-module-grammar { background: #fcf8ed; }
.past-paper-table tbody tr:hover td.past-paper-module-small_essay,
.past-paper-table tbody tr:hover td.past-paper-module-big_essay { background: #fcf4f5; }
.past-paper-title-content { display: flex; align-items: center; gap: 6px; min-width: 0; }
.past-paper-drag-handle { display: inline-flex; flex: 0 0 24px; align-items: center; justify-content: center; width: 24px; height: 30px; padding: 0; color: #98918e; background: transparent; border: 0; border-radius: 4px; cursor: grab; }
.past-paper-drag-handle:hover { color: var(--brand); background: #f5eeef; }
.past-paper-drag-handle:active { cursor: grabbing; }
.past-paper-drag-handle:focus-visible { color: var(--brand); outline: 2px solid rgba(122,31,43,.3); outline-offset: 1px; }
.past-paper-drag-handle svg { width: 17px; height: 17px; }
.past-paper-table tr.is-dragging td { opacity: .5; }
.past-paper-table tr.is-drop-target td { box-shadow: inset 0 2px 0 var(--brand); }
.past-paper-title-cell strong { display: block; flex: 1 1 auto; min-width: 0; }
.past-paper-title-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 780; }
.past-paper-title-edit { flex: 0 0 28px; width: 28px; height: 28px; padding: 0; color: #817a77; background: transparent; border-color: transparent; opacity: .58; }
.past-paper-title-cell:hover .past-paper-title-edit, .past-paper-title-edit:focus-visible { color: var(--brand); background: #f5eeef; border-color: #e3d6d8; opacity: 1; }
.past-paper-module-cell { width: 88px; }
.past-paper-module-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; width: 70px; height: 34px; padding: 0; color: #6f6967; background: #fff; border: 1px solid #d2ccca; border-radius: 5px; font-size: 12px; font-weight: 780; transition: color .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease; }
.past-paper-module-button svg { width: 15px; height: 15px; }
.past-paper-module-button:hover { color: var(--brand); background: #fdf9f9; border-color: #af7c83; }
.past-paper-module-button.is-complete { color: #fff; background: var(--green); border-color: var(--green); box-shadow: 0 2px 6px rgba(39, 116, 91, .18); }
.past-paper-module-button.is-complete:hover { background: #1f624b; border-color: #1f624b; }
.past-paper-module-button.is-none { color: #6f6a68; background: #e7e4e2; border-color: #d0cbc8; box-shadow: none; }
.past-paper-module-button.is-none:hover { color: #5d5856; background: #ddd9d6; border-color: #c4bfbc; }
.past-paper-module-button:focus-visible { outline: 2px solid rgba(122,31,43,.34); outline-offset: 2px; }
.past-paper-module-button[aria-busy="true"] { opacity: .56; cursor: wait; }
.past-paper-row-progress { display: grid; justify-items: center; gap: 5px; }
.past-paper-row-progress strong { color: var(--brand); font-size: 13px; font-weight: 820; font-variant-numeric: tabular-nums; }
.past-paper-row-progress > span { display: block; width: 52px; height: 5px; overflow: hidden; background: #e7e2df; border-radius: 3px; }
.past-paper-row-actions { display: flex; align-items: center; justify-content: center; gap: 4px; }
.past-paper-row-actions form { margin: 0; }
.past-paper-row-progress > span > i { display: block; height: 100%; background: var(--green); border-radius: inherit; transition: width .18s ease; }
.past-paper-dialog { width: min(480px, calc(100vw - 28px)); padding: 0; color: var(--ink); background: #fff; border: 1px solid #c9c2bf; border-radius: 7px; box-shadow: 0 22px 64px rgba(38, 20, 23, .25); }
.past-paper-dialog::backdrop { background: rgba(34, 23, 25, .54); }
.past-paper-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.past-paper-dialog-head span { display: block; color: var(--brand); font-size: 9px; font-weight: 820; }
.past-paper-dialog-head h2 { margin: 1px 0 0; font-size: 18px; }
.past-paper-dialog-body { padding: 18px; }
.past-paper-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }

.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge-queued, .badge-processing { color: #2c547a; background: #e6eef6; }
.badge-ready { color: #6d4c05; background: #f7eed9; }
.badge-review, .badge-error { color: #8b2530; background: #f7e6e8; }
.badge-graded { color: #23664f; background: #e4f2ec; }
.badge-draft { color: #6b6562; background: #eeeae8; }
.badge-active { color: #23664f; background: #e4f2ec; }
.badge-closed { color: #514d4b; background: #e7e4e2; }
.badge-scan-assigned { color: #23664f; background: #e4f2ec; }
.badge-scan-received, .badge-scan-awaiting_pair { color: #6d4c05; background: #f7eed9; }
.badge-scan-needs_assignment, .badge-scan-duplicate, .badge-scan-error { color: #8b2530; background: #f7e6e8; }
.badge-phase-completed { color: #23664f; background: #e4f2ec; }
.badge-phase-pending, .badge-phase-waiting { color: #6d4c05; background: #f7eed9; }
.badge-phase-processing { color: #2c547a; background: #e6eef6; }
.badge-phase-review, .badge-phase-error { color: #8b2530; background: #f7e6e8; }

.empty { padding: 34px 18px; text-align: center; color: var(--muted); }
.empty svg { width: 30px; height: 30px; margin-bottom: 8px; color: #a69e9b; }

.tabs {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0 16px;
  overflow-x: auto;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.exam-management-toolbar { display: flex; align-items: center; background: #fff; border-bottom: 1px solid var(--line); }
.exam-management-toolbar .tabs { flex: 1 1 auto; min-width: 0; border-bottom: 0; }
.exam-submission-search { position: relative; flex: 0 0 250px; margin: 7px 14px 7px 8px; }
.exam-submission-search[hidden] { display: none; }
.exam-submission-search > svg { position: absolute; top: 50%; left: 11px; z-index: 1; width: 17px; height: 17px; color: var(--muted); transform: translateY(-50%); pointer-events: none; }
.exam-submission-search .input { width: 100%; min-height: 36px; padding: 7px 34px 7px 36px; background: #faf9f8; border-color: #d4cecb; border-radius: 6px; font-size: 13px; }
.exam-submission-search .input:focus { background: #fff; }
.tab {
  appearance: none;
  flex: 0 0 auto;
  min-height: 50px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); background: #faf8f8; }
.tab:focus-visible { outline: 2px solid var(--brand); outline-offset: -4px; }
.tab.active { color: var(--brand); background: transparent; border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.answer-score-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 10px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; gap: 1px; }
.answer-score-summary > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 38px; padding: 7px 10px; background: #f8f6f5; }
.answer-score-summary span { color: var(--muted); font-size: 10px; }
.answer-score-summary strong { color: var(--brand); font-size: 11px; white-space: nowrap; }
.answer-entry-toolbar { display: flex; justify-content: flex-end; margin-bottom: 10px; }
.quick-answer-panel[hidden] { display: none; }
.quick-answer-panel { display: grid; gap: 10px; margin-bottom: 12px; padding: 12px; background: #faf9f8; border: 1px solid #d8d1cf; border-radius: 6px; }
.quick-answer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.quick-answer-head > div { display: flex; align-items: baseline; gap: 10px; }
.quick-answer-head strong { font-size: 14px; }
.quick-answer-head span { color: var(--brand); font-size: 11px; font-weight: 750; }
.quick-answer-editor { display: grid; grid-template-columns: 52px minmax(0, 1fr); height: 420px; overflow: hidden; background: #fff; border: 1px solid #c9c3c1; border-radius: 5px; }
.quick-answer-editor:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(122,31,43,.13); }
.quick-answer-lines { height: 100%; overflow: hidden; color: #7a7371; background: #f3f0ef; border-right: 1px solid #ddd7d4; text-align: center; font-size: 12px; font-variant-numeric: tabular-nums; user-select: none; }
.quick-answer-lines > div { padding: 9px 0; will-change: transform; }
.quick-answer-lines span { display: block; height: 28px; line-height: 28px; }
.quick-answer-editor textarea { height: 100%; min-height: 0; padding: 9px 12px; overflow-x: hidden; overflow-y: auto; border: 0; border-radius: 0; box-shadow: none; resize: none; font-family: "IBM Plex Sans SC", ui-monospace, monospace; font-size: 14px; font-weight: 750; line-height: 28px; letter-spacing: 0; text-transform: uppercase; white-space: pre; }
.quick-answer-editor textarea:focus { border: 0; box-shadow: none; }
.quick-answer-feedback { min-height: 18px; color: var(--muted); font-size: 11px; }
.quick-answer-feedback.is-error { color: var(--red); font-weight: 700; }
.answer-grid { display: grid; grid-template-rows: repeat(10, 96px); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 7px; }
.answer-item { min-width: 0; padding: 8px; background: #faf9f8; border: 1px solid #e5e0de; border-radius: 6px; }
.answer-item:hover { background: #fff; border-color: #cfc5c3; }
.answer-item-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.answer-number { font-weight: 850; }
.answer-card-title { display: flex; align-items: baseline; min-width: 0; gap: 6px; }
.answer-card-title small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.answer-card-score { display: flex; align-items: center; flex: 0 0 auto; gap: 4px; }
.answer-card-score span { color: var(--muted); font-size: 9px; }
.answer-score { width: 47px; min-height: 27px; padding: 3px 4px; text-align: center; font-size: 11px; font-variant-numeric: tabular-nums; }
.answer-alternative-input { min-height: 34px; padding: 5px 7px; font-size: 11px; }
.choice-set { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.choice-set input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.choice-set label { display: grid; place-items: center; height: 30px; color: #514b49; background: #fff; border: 1px solid #d4cecb; border-radius: 4px; font-weight: 800; cursor: pointer; }
.choice-set input:checked + label { color: #fff; background: var(--brand); border-color: var(--brand); }
.choice-set input:focus-visible + label { outline: 2px solid rgba(122,31,43,.35); outline-offset: 2px; }
.answer-key-choices { width: 100%; }
.answer-key-choices label { height: 34px; font-size: 11px; }
.answer-save-bar { position: sticky; bottom: 10px; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 18px; padding: 10px 12px; background: rgba(255,255,255,.96); border: 1px solid #d7d1ce; border-radius: 6px; box-shadow: 0 8px 24px rgba(50,31,33,.12); backdrop-filter: blur(8px); }
.answer-save-bar > div { display: flex; align-items: baseline; gap: 9px; }
.answer-save-bar strong { color: var(--brand); }
.answer-save-bar span { color: var(--muted); font-size: 11px; }
[data-answer-key-form].quick-entry-open .answer-save-bar { position: static; }

.upload-zone { padding: 38px 20px; text-align: center; background: #fbfaf9; border: 1px dashed #bdb5b2; border-radius: 6px; }
.upload-zone input { max-width: 520px; }
.upload-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.upload-step { display: flex; gap: 10px; padding: 12px; background: var(--surface-2); border-radius: 6px; }
.step-number { display: grid; place-items: center; flex: 0 0 25px; height: 25px; color: #fff; background: var(--brand); border-radius: 50%; font-weight: 800; }

.review-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(430px, .75fr); gap: 16px; align-items: start; }
.review-page-head { align-items: flex-start; }
.review-page-heading { display: flex; flex: 1 1 auto; align-items: flex-start; gap: 18px; min-width: 0; }
.review-title-copy { flex: 0 0 auto; min-width: 220px; padding-top: 2px; }
.review-binding-inline { display: grid; grid-template-columns: 150px minmax(240px, 1fr); gap: 8px; width: min(460px, 42vw); }
.review-binding-inline .field { gap: 4px; }
.review-binding-inline .field label { font-size: 10px; }
.review-student-select-shell { position: relative; display: block; min-width: 0; }
.review-binding-inline .input, .review-binding-inline .review-student-select { height: 40px; min-height: 40px; }
.review-student-select { appearance: none; -webkit-appearance: none; padding-right: 40px; cursor: pointer; }
.review-student-select-shell > svg { position: absolute; top: 50%; right: 10px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; transform: translateY(-50%); transition: color .16s ease; }
.review-student-select-shell:focus-within > svg { color: var(--brand); }
.scan-viewer { position: sticky; top: 86px; overflow: hidden; background: #292525; border-radius: 7px; }
.scan-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; color: #fff; background: #3b3334; }
.scan-tabs { display: flex; gap: 5px; }
.scan-tabs button { padding: 5px 9px; color: rgba(255,255,255,.7); background: transparent; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; }
.scan-tabs button.active { color: #251d1e; background: var(--gold); border-color: var(--gold); }
.scan-image-wrap { max-height: calc(100vh - 150px); overflow: auto; text-align: center; }
.scan-image { display: block; max-width: 100%; margin: 0 auto; }
.issue-list { display: grid; gap: 7px; margin-bottom: 12px; }
.issue { display: flex; gap: 8px; padding: 9px 10px; color: #7a242d; background: #f8e9eb; border-left: 3px solid var(--red); }
.issue.warning { color: #72510b; background: #fbf2df; border-left-color: var(--amber); }
.review-answer-grid { display: grid; grid-template-rows: repeat(10, auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.review-answer { padding: 7px; background: #faf9f8; border: 1px solid #e6e1de; border-radius: 5px; transition: background-color .16s ease, border-color .16s ease; }
.review-answer.is-correct { background: #e8f3ef; border-color: #bad8cc; }
.review-answer.is-incorrect { background: #f8e9eb; border-color: #dfb8be; }
.review-answer .choice-set label { height: 27px; font-size: 11px; }
.review-answer .choice-set input:checked + label { color: #fff; background: #706b6b; border-color: #706b6b; }
.answer-color-legend { display: flex; align-items: center; gap: 13px; color: var(--muted); font-size: 11px; font-weight: 700; }
.answer-color-legend span { display: flex; align-items: center; gap: 5px; }
.answer-color-legend i { width: 10px; height: 10px; background: var(--red); border-radius: 2px; }
.answer-color-legend i.is-correct { background: #23664f; }
.recognized-note { margin-top: 4px; color: var(--muted); font-size: 10px; }
.score-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.review-score-total { display: flex; align-items: baseline; gap: 4px; color: var(--muted); font-size: 10px; }
.review-score-total strong { color: var(--brand); font-size: 20px; font-variant-numeric: tabular-nums; }
.review-score-total small { font-size: 10px; }
.review-score-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.review-score-item { min-width: 0; padding: 11px 13px; border-right: 1px solid #ece7e4; border-bottom: 1px solid #ece7e4; }
.review-score-item:nth-child(3n) { border-right: 0; }
.review-score-item:nth-last-child(-n + 3) { border-bottom: 0; }
.review-score-item > span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 10px; font-weight: 720; white-space: nowrap; }
.review-score-item > div { display: flex; align-items: baseline; gap: 3px; min-width: 0; }
.review-score-item strong { color: #322d2c; font-size: 23px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.review-score-item small { color: var(--muted); font-size: 9px; white-space: nowrap; }

.paper-page-head { align-items: center; margin-bottom: 12px; }
.paper-record-navigation { display: grid; grid-template-columns: 34px auto 34px; align-items: center; overflow: hidden; min-height: 38px; background: #fff; border: 1px solid #d4cecb; border-radius: 5px; }
.paper-record-navigation a, .paper-record-navigation > span { display: grid; place-items: center; width: 34px; height: 36px; color: var(--brand); }
.paper-record-navigation a:hover { background: var(--brand-soft); }
.paper-record-navigation > span.disabled { color: #c7c1be; }
.paper-record-navigation strong { padding: 0 9px; font-size: 11px; font-variant-numeric: tabular-nums; }
.paper-record-navigation svg { width: 18px; height: 18px; }
.paper-menu { position: relative; }
.paper-menu summary { list-style: none; }
.paper-menu summary::-webkit-details-marker { display: none; }
.paper-menu[open] summary { color: #fff; background: var(--brand); border-color: var(--brand); }
.paper-menu-popover { position: absolute; top: calc(100% + 7px); right: 0; z-index: 15; display: grid; width: 220px; padding: 6px; background: #fff; border: 1px solid #cfc8c5; border-radius: 6px; box-shadow: 0 16px 38px rgba(43, 25, 28, .18); }
.paper-menu-popover a { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 8px 10px; border-radius: 4px; font-weight: 700; }
.paper-menu-popover a:hover { color: var(--brand); background: var(--brand-soft); }
.paper-menu-popover svg { width: 16px; height: 16px; color: var(--brand); }
.paper-score-band { display: grid; grid-template-columns: minmax(230px, auto) 1fr auto; align-items: center; gap: 28px; margin-bottom: 12px; padding: 12px 18px; background: #fff; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.paper-score-value { display: flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; }
.paper-score-value strong { font-size: 30px; line-height: 1; }
.paper-score-value span { color: var(--muted); font-size: 15px; font-weight: 750; }
.paper-score-value b { margin-left: 8px; color: var(--brand); font-size: 17px; }
.paper-student-identity { display: grid; }
.paper-student-identity strong { font-size: 17px; }
.paper-student-identity span { color: var(--muted); font-size: 12px; }
body:has(.paper-review-shell) .app-shell { padding-bottom: 10px; }
.paper-review-shell { padding-bottom: 6px; }
.paper-review-workspace { display: grid; grid-template-columns: minmax(400px, .82fr) minmax(650px, 1.28fr); gap: 14px; height: clamp(460px, calc(100vh - 263px), 940px); min-height: 0; }
.paper-scan-column, .paper-analysis-column { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; }
.paper-analysis-column { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.paper-workspace-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 2px 9px; }
.paper-analysis-column > .paper-workspace-heading { min-height: 51px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.paper-workspace-heading h2 { margin: 0; font-size: 15px; }
.paper-workspace-heading > div:first-child { display: grid; min-width: 0; }
.paper-workspace-heading > div:first-child > span { color: var(--muted); font-size: 10px; }
.paper-analysis-legend { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 9px; font-weight: 700; white-space: nowrap; }
.paper-analysis-legend span { display: flex; align-items: center; gap: 4px; }
.paper-analysis-legend i { width: 8px; height: 8px; background: #aaa4a1; border-radius: 2px; }
.paper-analysis-legend .is-correct { background: var(--green); }
.paper-analysis-legend .is-partial { background: var(--amber); }
.paper-analysis-legend .is-incorrect { background: var(--red); }
.paper-image-viewer { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; overflow: hidden; background: #302c2d; border: 1px solid #484143; border-radius: 7px; }
.paper-image-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 9px; min-height: 46px; padding: 6px 8px; color: #fff; background: #3b3435; border-bottom: 1px solid #504849; }
.paper-page-options { display: flex; min-width: 0; gap: 5px; overflow-x: auto; }
.paper-page-options button { flex: 0 0 auto; min-height: 32px; padding: 5px 8px; color: rgba(255,255,255,.7); background: transparent; border: 1px solid rgba(255,255,255,.2); border-radius: 4px; font-size: 11px; font-weight: 700; }
.paper-page-options button:hover { color: #fff; border-color: rgba(255,255,255,.42); }
.paper-page-options button.active { color: #302728; background: var(--gold); border-color: var(--gold); }
.paper-image-tools { display: flex; flex: 0 0 auto; align-items: center; gap: 5px; }
.paper-image-stage { display: grid; place-items: start center; min-height: 0; padding: 8px; overflow: auto; background: #242122; }
.paper-image-stage img { display: block; width: auto; height: auto; max-width: none; max-height: none; margin: 0 auto; object-fit: contain; background: #fff; transform-origin: top center; }
.paper-analysis-scroll { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-gutter: stable; }
.paper-section-panel { padding: 10px 12px 12px; border-bottom: 1px solid var(--line); }
.paper-subsection-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; margin-bottom: 6px; }
.paper-subsection-head h3 { margin: 0; font-size: 13px; }
.paper-subsection-head > span { color: var(--muted); font-size: 9px; font-weight: 650; }
.paper-section-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 5px; gap: 1px; }
.paper-section-summary-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 5px 8px; min-width: 0; min-height: 57px; padding: 7px 9px; background: #fff; }
.paper-section-summary-item > div:first-child { display: flex; grid-column: 1 / -1; align-items: center; justify-content: space-between; gap: 7px; min-width: 0; }
.paper-section-summary-item strong { overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.paper-section-summary-item b { color: var(--brand); font-size: 12px; font-variant-numeric: tabular-nums; }
.paper-section-summary-item > span { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper-section-summary-item .bar { height: 5px; }
.paper-question-panel { padding: 8px 12px 12px; }
.paper-question-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--line); border-radius: 5px; }
.paper-question-group { min-width: 0; border-right: 1px solid var(--line); }
.paper-question-group:last-child { border-right: 0; }
.paper-question-group-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-height: 29px; padding: 5px 7px; color: #4f4846; background: #f2efed; border-bottom: 1px solid var(--line); }
.paper-question-group-head strong { font-size: 10px; }
.paper-question-group-head span { color: var(--muted); font-size: 8px; }
.paper-question-item { display: grid; grid-template-columns: 24px minmax(0, 1fr) 44px 20px; align-items: center; gap: 5px; min-height: 29px; padding: 3px 6px; border-bottom: 1px solid #eeeae8; font-size: 10px; font-variant-numeric: tabular-nums; }
.paper-question-item:last-child { border-bottom: 0; }
.paper-question-item:hover { background: #faf8f7; }
.paper-question-number { color: #4b4543; font-size: 11px; }
.paper-answer-comparison { display: flex; align-items: center; min-width: 0; gap: 3px; }
.paper-answer-comparison > span, .paper-answer-comparison > strong { max-width: 44%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-answer-comparison > span { color: var(--muted); }
.paper-answer-comparison > svg { flex: 0 0 auto; width: 10px; height: 10px; color: #aaa29f; }
.paper-answer-comparison > em { flex: 0 0 auto; padding: 0 2px; color: #6d4c05; background: #f7eed9; border-radius: 2px; font-size: 7px; font-style: normal; font-weight: 800; }
.paper-question-score { color: var(--muted); text-align: right; white-space: nowrap; }
.paper-result { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; }
.paper-result svg { width: 14px; height: 14px; }
.result-correct { color: var(--green); background: #e5f2ed; }
.result-incorrect { color: var(--red); background: #f8e7e9; }
.result-partial { color: var(--amber); background: #f8eedb; }
.result-unscored { color: #7d7674; background: #ece9e7; }

.bar { height: 8px; overflow: hidden; background: #ece7e5; border-radius: 4px; }
.bar > span { display: block; height: 100%; background: var(--brand); }
.accuracy-grid { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 8px; }
.accuracy-item { padding: 10px; border: 1px solid #e4dfdc; border-radius: 6px; }
.accuracy-item-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 12px; }

.item-analysis-page-head { align-items: flex-start; }
.item-analysis-heading-copy { min-width: 0; }
.item-analysis-title-row { display: flex; align-items: center; gap: 12px; }
.item-analysis-title-row .btn { min-height: 40px; }
.item-analysis-head-tools { align-items: center; flex-wrap: nowrap; margin-left: auto; }
.analysis-filter-form { display: flex; align-items: center; gap: 8px; }
.analysis-filter-field { width: 138px; }
.item-analysis-head-tools .btn, .analysis-filter-form select { height: 40px; min-height: 40px; }
.analysis-filter-form select { padding: 8px 10px; border-color: #cfc9c7; border-radius: 6px; font-size: 14px; font-weight: 700; }
.analysis-section-buttons { display: inline-flex; align-items: stretch; height: 40px; overflow: hidden; background: #fff; border: 1px solid #cfc9c7; border-radius: 6px; }
.analysis-section-button { min-width: 52px; padding: 0 12px; color: #514b49; background: #fff; border: 0; border-right: 1px solid #ddd7d4; font: inherit; font-size: 13px; font-weight: 760; cursor: pointer; }
.analysis-section-button:last-child { border-right: 0; }
.analysis-section-button:hover { color: var(--brand); background: var(--brand-soft); }
.analysis-section-button.is-active { color: #fff; background: var(--brand); }
.analysis-section-button:focus-visible { position: relative; z-index: 1; outline: 2px solid rgba(122,31,43,.36); outline-offset: -2px; }
.item-analysis-content { transition: opacity .14s ease; }
.item-analysis-content.is-loading { opacity: .48; pointer-events: none; }
.item-analysis-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.item-analysis-metrics .metric { height: 72px; padding: 7px 12px; }
.item-analysis-metrics .metric-top { font-size: 11px; line-height: 1.2; }
.item-analysis-metrics .metric-icon { width: 18px; height: 18px; }
.item-analysis-metrics > .metric > strong { margin-top: 1px; font-size: 22px; line-height: 1.1; }
.section-rate-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 2px; }
.section-rate-row { display: grid; justify-items: center; min-width: 0; color: #403a38; border-right: 1px solid #ece7e4; line-height: 1.15; text-align: center; }
.section-rate-row:last-child { border-right: 0; }
.section-rate-row b { font-size: 10px; font-weight: 760; }
.section-rate-row strong { margin-top: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.section-accuracy-panel { margin-bottom: 16px; overflow: hidden; }
.section-accuracy-table-wrap { overflow-x: auto; }
.section-accuracy-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.section-accuracy-table.is-listening { min-width: 1034px; }
.section-accuracy-table.is-reading { min-width: 520px; }
.section-accuracy-table th, .section-accuracy-table td { min-width: 94px; padding: 10px 8px; border-right: 1px solid #e5dfdc; text-align: center; }
.section-accuracy-table th:last-child, .section-accuracy-table td:last-child { border-right: 0; }
.section-accuracy-table th { color: #4e4745; background: #faf9f8; border-bottom: 1px solid #e5dfdc; font-size: 11px; }
.section-accuracy-table th strong, .section-accuracy-table th small, .section-accuracy-table td strong, .section-accuracy-table td small { display: block; }
.section-accuracy-table th strong { font-size: 11px; }
.section-accuracy-table th small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 600; }
.section-accuracy-table td strong { color: var(--brand); font-size: 18px; font-variant-numeric: tabular-nums; }
.section-accuracy-table td small { margin-top: 2px; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.item-analysis-panel { overflow: hidden; }
.item-analysis-header, .item-analysis-row { display: grid; grid-template-columns: 90px 130px minmax(360px, 1fr) 110px 64px; align-items: center; gap: 16px; }
.item-analysis-header { min-height: 44px; padding: 8px 16px; color: var(--muted); background: #faf9f8; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 800; }
.item-analysis-header > :last-child { text-align: center; }
.analysis-sort-link { display: inline-flex; align-items: center; justify-content: flex-start; gap: 5px; width: fit-content; min-height: 30px; padding: 4px 6px; margin-left: -6px; color: inherit; border-radius: 5px; }
.analysis-sort-link:hover { color: var(--brand); background: #f2ecec; }
.analysis-sort-link.is-active { color: var(--brand); }
.analysis-sort-link.is-centered { justify-self: center; justify-content: center; margin-left: 0; }
.analysis-sort-link svg { width: 14px; height: 14px; }
.analysis-sort-link:focus-visible { outline: 2px solid rgba(122,31,43,.35); outline-offset: 1px; }
.item-analysis-list { display: grid; }
.item-analysis-row { min-height: 116px; padding: 13px 16px; border-bottom: 1px solid #ece8e6; }
.item-analysis-row:last-child { border-bottom: 0; }
.item-analysis-row:hover { background: #fcfbfa; }
.analysis-question { display: grid; align-content: center; }
.analysis-question strong { font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.analysis-question span { margin-top: 4px; color: var(--muted); font-size: 11px; }
.analysis-question small { margin-top: 1px; color: var(--brand); font-size: 10px; font-weight: 750; }
.analysis-accuracy { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 5px 8px; }
.analysis-accuracy strong { color: var(--brand); font-size: 20px; font-variant-numeric: tabular-nums; }
.analysis-accuracy > span { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.analysis-accuracy .bar { grid-column: 1 / -1; }
.response-frequency { display: flex; align-items: flex-end; min-width: 0; gap: 12px; }
.response-option { appearance: none; display: grid; grid-template-columns: 44px; justify-items: center; gap: 1px; flex: 0 0 44px; min-width: 0; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 4px; font: inherit; cursor: pointer; }
.response-option:hover, .response-option.is-active { background: #f3efed; }
.response-option:focus-visible { outline: 2px solid rgba(122,31,43,.38); outline-offset: 2px; }
.response-track { display: flex; align-items: flex-end; justify-content: center; width: 38px; height: 45px; }
.response-track span { display: block; width: 28px; min-height: 2px; max-height: 100%; background: var(--red); border-radius: 2px 2px 0 0; }
.response-option.is-empty .response-track span { display: none; }
.response-option.is-correct .response-track span { background: var(--green); }
.response-option.is-blank .response-track span { background: #9a9391; }
.response-option.is-invalid .response-track span { background: var(--amber); }
.response-option strong { font-size: 13px; line-height: 1.2; }
.response-option.is-correct strong { color: var(--green); }
.response-option small { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.response-frequency.is-fill { overflow-x: auto; padding: 3px 1px; }
.response-option.is-text { grid-template-columns: minmax(70px, auto); flex-basis: auto; min-width: 70px; }
.response-option.is-text .response-track { width: 100%; min-width: 58px; }
.response-option.is-text .response-track span { width: 50px; }
.response-option.is-text strong { max-width: 120px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.analysis-discrimination { display: grid; justify-items: center; gap: 5px; text-align: center; }
.analysis-discrimination > strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.df-badge { display: inline-flex; justify-content: center; min-width: 48px; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 800; }
.df-neutral { color: #68615f; background: #ece9e7; }
.df-danger { color: #892530; background: #f7e5e8; }
.df-low { color: #805509; background: #f8edd7; }
.df-medium { color: #3f5f79; background: #e7eef4; }
.df-good, .df-excellent { color: #21634d; background: #e3f1eb; }
.analysis-points { display: grid; justify-items: center; text-align: center; }
.analysis-points strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.analysis-points span { color: var(--muted); font-size: 10px; }
.item-response-detail { grid-column: 1 / -1; width: 100%; margin-top: 2px; overflow: hidden; background: #fff; border: 1px solid #ded8d5; border-radius: 6px; }
.item-response-detail[hidden] { display: none; }
.item-response-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 42px; padding: 7px 9px 7px 12px; background: #f7f5f4; border-bottom: 1px solid #e5dfdc; }
.item-response-detail-head > div { display: flex; align-items: baseline; gap: 9px; }
.item-response-detail-head strong { color: var(--brand); font-size: 13px; }
.item-response-detail-head span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.response-student-list { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px; padding: 6px; background: #fff; }
.response-student-row { display: flex; flex: 0 0 86px; align-items: center; justify-content: center; min-width: 0; min-height: 36px; padding: 6px; background: #fff; border: 1px solid #e5dfdc; border-radius: 4px; text-align: center; }
.response-student-row:hover { color: var(--brand); background: var(--brand-soft); }
.response-student-row strong { overflow: hidden; font-size: 15px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.response-student-empty { grid-column: 1 / -1; padding: 18px; color: var(--muted); text-align: center; font-size: 11px; }

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 30px; background: #f0f1ef; }
.login-shell { width: min(940px, 100%); min-height: 520px; display: grid; grid-template-columns: 1.65fr 1fr; overflow: hidden; background: #fff; border: 1px solid #d8d5d2; border-radius: 7px; box-shadow: var(--shadow); }
.login-brand { position: relative; display: flex; align-items: flex-end; padding: 54px; color: #fff; background: var(--brand-dark); border-right: 7px solid var(--gold); }
.login-brand::before { content: ""; position: absolute; top: 44px; left: 54px; width: 42px; height: 5px; background: var(--gold); }
.login-brand small { color: #efc76c; font-weight: 800; letter-spacing: .08em; }
.login-brand h1 { max-width: 480px; margin: 10px 0 12px; font-size: 39px; line-height: 1.18; }
.login-brand p { margin: 0; color: rgba(255,255,255,.68); font-size: 15px; }
.login-form { display: grid; align-content: center; padding: 38px; }
.login-form h2 { margin: 0 0 22px; font-size: 22px; }
.login-form form { display: grid; gap: 14px; }
.login-form .btn { width: 100%; min-height: 45px; margin-top: 3px; }
.login-switch-link { display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-top: 16px; color: var(--brand); font-size: 12px; font-weight: 750; }
.login-switch-link:hover { text-decoration: underline; }
.login-switch-link svg { width: 16px; height: 16px; }
.student-login-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.student-login-heading h2 { margin: 0; }
.student-login-heading p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.student-login-icon { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; color: var(--brand); background: var(--brand-soft); border: 1px solid #ead5d8; border-radius: 7px; }
.student-login-icon svg { width: 22px; height: 22px; }
.student-login-shell { min-height: 440px; grid-template-columns: 1.35fr 1fr; }
.student-login-brand { padding: 42px; background: #39191e; }
.student-login-brand::before { top: 34px; left: 42px; }
.student-login-brand h1 { margin: 8px 0 0; font-size: 34px; }

.student-results-page { background: #f3f2f1; }
.student-results-topbar { position: sticky; top: 0; z-index: 20; height: 64px; color: #fff; background: var(--brand-dark); border-bottom: 3px solid var(--gold); }
.student-results-topbar-inner { display: flex; align-items: center; justify-content: space-between; width: min(1180px, calc(100% - 40px)); height: 100%; margin: 0 auto; }
.student-results-brand { display: flex; align-items: center; gap: 9px; font-weight: 820; }
.student-results-brand img { width: 42px; height: 42px; object-fit: contain; }
.student-results-brand > span { display: grid; line-height: 1.12; }
.student-results-brand small { margin-top: 3px; color: rgba(255,255,255,.62); font-size: 9px; font-weight: 650; }
.student-results-account { display: flex; align-items: center; gap: 16px; }
.student-results-account > span { display: grid; justify-items: end; line-height: 1.2; }
.student-results-account small { margin-top: 3px; color: rgba(255,255,255,.62); font-size: 10px; }
.student-results-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 28px 0 64px; }
.student-dashboard-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.student-dashboard-heading h1 { margin: 2px 0 5px; font-size: 28px; line-height: 1.2; }
.student-dashboard-heading p { margin: 0; color: var(--muted); }
.student-dashboard-eyebrow { color: var(--brand) !important; font-size: 11px; font-weight: 820; }
.student-dashboard-count { display: flex; align-items: baseline; gap: 5px; white-space: nowrap; }
.student-dashboard-count strong { color: var(--brand); font-size: 28px; }
.student-dashboard-count span { color: var(--muted); font-size: 12px; }
.student-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 16px; }
.student-kpi { min-height: 102px; padding: 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.student-kpi.primary { color: #fff; background: var(--brand); border-color: var(--brand); }
.student-kpi > span { color: var(--muted); font-size: 11px; font-weight: 730; }
.student-kpi.primary > span, .student-kpi.primary p { color: rgba(255,255,255,.72); }
.student-kpi strong { display: block; margin-top: 4px; font-size: 27px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.student-kpi strong small { margin-left: 4px; color: var(--muted); font-size: 12px; font-weight: 700; }
.student-kpi.primary strong small { color: rgba(255,255,255,.72); }
.student-kpi p { margin: 3px 0 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.student-section-summary, .student-exam-history { margin-bottom: 16px; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.student-section-title { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 61px; padding: 11px 16px; border-bottom: 1px solid var(--line); }
.student-section-title span { color: var(--brand); font-size: 9px; font-weight: 820; }
.student-section-title h2 { margin: 0; color: var(--brand); font-size: 16px; }
.student-section-title > p { margin: 0; color: var(--muted); font-size: 10px; }
.student-section-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.student-section-grid article { min-width: 0; padding: 9px 14px 10px; border-right: 1px solid #ece8e6; }
.student-section-grid article:last-child { border-right: 0; }
.student-section-grid article > span { color: #3f3938; font-size: 13px; font-weight: 820; line-height: 1.25; }
.student-section-grid strong { display: block; margin-top: 1px; color: var(--brand); font-size: 20px; line-height: 1.2; font-variant-numeric: tabular-nums; }
.student-section-grid strong small { margin-left: 3px; color: var(--muted); font-size: 10px; }
.student-section-grid p { margin: 1px 0 0; color: var(--muted); font-size: 9px; line-height: 1.35; white-space: nowrap; }
.student-trend-legend { display: flex; gap: 14px; color: var(--muted); font-size: 10px; }
.student-trend-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.student-trend-legend span::before { content: ""; width: 15px; height: 4px; background: var(--brand); }
.student-trend-legend .class::before { background: #a9a4a1; }
.student-trend-list { display: grid; }
.student-trend-row { display: grid; grid-template-columns: minmax(190px, 1.1fr) minmax(260px, 2fr) 84px; align-items: center; gap: 18px; min-height: 68px; padding: 10px 16px; border-bottom: 1px solid #eeeae8; }
.student-trend-row:last-child { border-bottom: 0; }
.student-trend-label { display: grid; min-width: 0; }
.student-trend-label time { color: var(--muted); font-size: 9px; }
.student-trend-label strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.student-trend-bars { display: grid; gap: 5px; }
.student-trend-bars > div { height: 7px; overflow: hidden; background: #eeeae8; border-radius: 2px; }
.student-trend-bars span { display: block; height: 100%; max-width: 100%; background: var(--brand); }
.student-trend-bars > div:last-child span { background: #a9a4a1; }
.student-trend-values { display: grid; justify-items: end; font-size: 11px; font-variant-numeric: tabular-nums; }
.student-trend-values strong { color: var(--brand); }
.student-trend-values span { color: var(--muted); }
.student-exam-list { display: grid; }
.student-exam-card { border-bottom: 8px solid #f3f2f1; }
.student-exam-card:last-child { border-bottom: 0; }
.student-exam-toggle { display: flex; align-items: center; justify-content: space-between; gap: 20px; min-height: 72px; padding: 13px 16px; cursor: pointer; list-style: none; }
.student-exam-toggle::-webkit-details-marker { display: none; }
.student-exam-toggle:hover { background: #fbfaf9; }
.student-exam-toggle:focus-visible { outline: 2px solid rgba(122,31,43,.35); outline-offset: -3px; }
.student-exam-toggle > div:first-child { min-width: 0; }
.student-exam-card[open] > .student-exam-toggle { border-bottom: 1px solid #eeeae8; }
.student-exam-card time { color: var(--muted); font-size: 9px; }
.student-exam-card h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; max-width: 100%; margin: 4px 0 0; font-size: 15px; line-height: 1.35; }
.student-exam-title-main { display: inline-block; max-width: 100%; color: var(--brand); overflow-wrap: anywhere; }
.student-exam-title-hint { color: var(--muted); font-size: 50%; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.student-exam-toggle-meta { display: flex; align-items: center; justify-content: flex-end; gap: 20px; flex: 0 0 auto; }
.student-exam-toggle-meta > span:not(.student-exam-status) { display: grid; gap: 1px; min-width: 72px; }
.student-exam-toggle-meta > span:not(.student-exam-status) small { color: var(--muted); font-size: 8px; font-weight: 700; }
.student-exam-toggle-meta > span:not(.student-exam-status) strong { font-size: 12px; font-variant-numeric: tabular-nums; }
.student-exam-chevron { width: 19px; height: 19px; color: var(--muted); transition: transform .16s ease; }
.student-exam-card[open] .student-exam-chevron { transform: rotate(180deg); }
.student-exam-status { flex: 0 0 auto; padding: 4px 8px; color: var(--green); background: #e8f3ef; border-radius: 4px; font-size: 10px; font-weight: 800; }
.student-exam-status.absent { color: var(--red); background: #f8eaec; }
.student-exam-details { background: #fff; }
.student-exam-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fbfaf9; border-bottom: 1px solid #eeeae8; }
.student-exam-summary > div { min-width: 0; padding: 11px 16px; border-right: 1px solid #eeeae8; }
.student-exam-summary > div:last-child { border-right: 0; }
.student-exam-summary span { display: block; color: var(--muted); font-size: 9px; }
.student-exam-summary strong { display: block; margin-top: 2px; color: var(--brand); font-size: 18px; font-variant-numeric: tabular-nums; }
.student-exam-summary small { margin-left: 3px; color: var(--muted); font-size: 9px; }
.student-score-table { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.student-score-table > div { display: grid; gap: 2px; min-width: 0; padding: 10px 16px; border-right: 1px solid #eeeae8; }
.student-score-table > div:last-child { border-right: 0; }
.student-score-table span { color: #3f3938; font-size: 13px; font-weight: 820; line-height: 1.25; }
.student-score-table strong { font-size: 17px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.student-score-table small { margin-left: 2px; color: var(--muted); font-size: 9px; }
.student-score-table em { margin-top: 0; color: var(--muted); font-size: 9px; font-style: normal; line-height: 1.35; }
.student-exam-details > footer { display: flex; flex-wrap: wrap; gap: 10px 24px; padding: 9px 16px; color: var(--muted); background: #fbfaf9; border-top: 1px solid #eeeae8; font-size: 9px; }
.student-exam-details > footer strong { color: var(--ink); }
.student-exam-card.is-absent .student-score-table strong { color: var(--muted); }
.student-empty-state { display: grid; justify-items: center; max-width: 680px; margin: 80px auto; padding: 46px 30px; text-align: center; background: #fff; border: 1px solid var(--line); border-radius: 7px; }
.student-empty-state.compact { margin: 24px auto; }
.student-empty-state > svg { width: 34px; height: 34px; color: var(--brand); }
.student-empty-state h1, .student-empty-state h2 { margin: 14px 0 6px; }
.student-empty-state p { max-width: 520px; margin: 0; color: var(--muted); }

@media (max-width: 760px) {
  .student-results-topbar { height: 58px; }
  .student-results-topbar-inner, .student-results-shell { width: calc(100% - 24px); }
  .student-results-brand img { width: 36px; height: 36px; }
  .student-results-brand > span { font-size: 13px; }
  .student-results-account { gap: 8px; }
  .student-results-account > span { display: none; }
  .student-results-account .btn { width: 36px; min-width: 36px; padding: 0; }
  .student-results-account .btn span { display: none; }
  .student-results-shell { padding: 18px 0 42px; }
  .student-dashboard-heading { align-items: flex-start; }
  .student-dashboard-heading h1 { font-size: 22px; }
  .student-dashboard-heading > div:first-child > p:last-child { font-size: 10px; }
  .student-dashboard-count { display: grid; justify-items: end; gap: 0; }
  .student-dashboard-count strong { font-size: 23px; }
  .student-dashboard-count span { font-size: 9px; }
  .student-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .student-kpi { min-height: 92px; padding: 10px 12px; }
  .student-kpi strong { font-size: 22px; }
  .student-kpi strong small { font-size: 9px; }
  .student-section-title { min-height: 54px; padding: 9px 12px; }
  .student-section-title > p { display: none; }
  .student-section-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-section-grid article { padding: 8px 12px 9px; border-bottom: 1px solid #ece8e6; }
  .student-section-grid article:nth-child(2n) { border-right: 0; }
  .student-section-grid article:nth-last-child(-n + 2) { border-bottom: 0; }
  .student-trend-row { grid-template-columns: minmax(0, 1fr) 58px; gap: 7px 10px; min-height: 78px; padding: 9px 12px; }
  .student-trend-bars { grid-column: 1 / -1; grid-row: 2; }
  .student-trend-values { grid-column: 2; grid-row: 1; }
  .student-exam-toggle { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; min-height: 0; padding: 11px 12px; }
  .student-exam-toggle-meta { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto 24px; gap: 8px; width: 100%; }
  .student-exam-toggle-meta > span:not(.student-exam-status) { min-width: 0; }
  .student-exam-chevron { justify-self: end; }
  .student-exam-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-exam-summary > div { padding: 9px 12px; border-bottom: 1px solid #eeeae8; }
  .student-exam-summary > div:nth-child(2n) { border-right: 0; }
  .student-exam-summary > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .student-score-table { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .student-score-table > div { padding: 8px 12px; border-bottom: 1px solid #eeeae8; }
  .student-score-table > div:nth-child(2n) { border-right: 0; }
  .student-score-table > div:nth-last-child(-n + 2) { border-bottom: 0; }
  .student-exam-details > footer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; padding: 9px 12px; }
  .student-empty-state { margin: 40px auto; padding: 34px 20px; }
}

.student-filter-panel { margin-bottom: 0; }
.sheet-filter-form { display: grid; grid-template-columns: 220px minmax(260px, 1fr) auto auto; align-items: end; gap: 10px; padding: 14px 16px; }
.sheet-filter-control { min-height: 44px; padding: 9px 12px; background: #fff; border: 1px solid #c9c2bf; border-radius: 7px; box-shadow: 0 1px 2px rgba(54,31,34,.04); font-size: 14px; transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease; }
.sheet-filter-control:hover { background: #fdfbfb; border-color: #a89194; }
.sheet-filter-control:focus { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(122,31,43,.12); }
.sheet-select-shell { position: relative; display: block; min-width: 0; }
.sheet-select-shell .sheet-filter-control { appearance: none; -webkit-appearance: none; width: 100%; padding-right: 40px; font-weight: 700; cursor: pointer; }
.sheet-select-shell > svg { position: absolute; top: 50%; right: 12px; width: 18px; height: 18px; color: #6f6866; pointer-events: none; transform: translateY(-50%); transition: color .16s ease, transform .16s ease; }
.sheet-select-shell:focus-within > svg { color: var(--brand); transform: translateY(-50%) rotate(180deg); }
.sheet-filter-form .btn { min-height: 40px; }
.roster-preview .panel-head > div { display: grid; gap: 2px; }

.roster-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin: 16px 0; overflow: hidden; background: var(--line); border: 1px solid var(--line); border-radius: 7px; }
.roster-summary > div { display: grid; gap: 4px; min-height: 82px; padding: 14px 16px; background: #fff; }
.roster-summary span { color: var(--muted); font-size: 11px; font-weight: 700; }
.roster-summary strong { font-size: 22px; line-height: 1.2; }
.roster-summary .summary-status { background: #f1f7f4; }
.summary-status strong { display: flex; align-items: center; gap: 7px; color: var(--green); font-size: 15px; }
.summary-status svg { width: 18px; height: 18px; }

.sheet-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.roster-table-wrap { max-height: 590px; overflow: auto; }
.roster-table-wrap thead { position: sticky; top: 0; z-index: 1; }
.selection-cell { width: 48px; text-align: center; }
.selection-checkbox { width: 18px; height: 18px; margin: 0; accent-color: var(--brand); vertical-align: middle; cursor: pointer; }
[data-student-row]:has(.selection-checkbox:checked) { background: #fcf8f8; }
[data-student-row]:has(.selection-checkbox:not(:checked)) { color: #9a9391; }
.student-sheet-link { display: inline-flex; align-items: center; gap: 7px; padding: 2px 0; color: var(--ink); background: transparent; border: 0; }
.student-sheet-link strong { font-size: 14px; }
.student-sheet-link svg { width: 15px; height: 15px; color: var(--brand); opacity: 0; transform: translateX(-3px); transition: opacity .15s ease, transform .15s ease; }
.student-sheet-link:hover, .student-sheet-link:focus-visible { color: var(--brand); }
.student-sheet-link:hover svg, .student-sheet-link:focus-visible svg { opacity: 1; transform: translateX(0); }
.student-sheet-link:focus-visible { outline: 2px solid rgba(122,31,43,.28); outline-offset: 3px; }
.generate-panel { position: static; }
.generate-form { display: grid; gap: 16px; }
.generate-selection { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 2px 10px; padding: 12px; background: #f7f5f4; border-left: 3px solid var(--brand); }
.generate-selection > span { color: var(--muted); font-size: 11px; }
.generate-selection > strong { color: var(--brand); font-size: 16px; }
.generate-selection > small { grid-column: 1 / -1; color: var(--muted); }
.generate-selection b { font-variant-numeric: tabular-nums; }
.option-fieldset { display: grid; gap: 8px; min-width: 0; margin: 0; padding: 0; border: 0; }
.option-fieldset legend { margin-bottom: 7px; color: #474141; font-size: 12px; font-weight: 750; }
.output-option { position: relative; display: grid; grid-template-columns: 38px 1fr 18px; align-items: center; gap: 10px; min-height: 64px; padding: 10px; background: #fff; border: 1px solid #d5cfcc; border-radius: 6px; cursor: pointer; }
.output-option:hover { background: #fbf8f8; border-color: #bcaeb0; }
.output-option:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.output-option input { position: absolute; opacity: 0; }
.option-icon { display: grid; place-items: center; width: 38px; height: 38px; color: var(--brand); background: #f3eeee; border-radius: 5px; }
.option-icon svg { width: 18px; height: 18px; }
.output-option > span:nth-of-type(2) { display: grid; }
.output-option small { color: var(--muted); }
.option-check { width: 18px; height: 18px; color: var(--brand); opacity: 0; }
.output-option:has(input:checked) .option-check { opacity: 1; }
.print-note { display: flex; align-items: flex-start; gap: 9px; padding: 10px; color: #5f5755; background: #f7f5f4; border-left: 3px solid #b8aeab; font-size: 12px; }
.print-note svg { flex: 0 0 16px; width: 16px; height: 16px; margin-top: 1px; color: var(--brand); }
.generate-button { width: 100%; min-height: 44px; }
.generate-button:disabled { color: #817a78; background: #d8d3d1; border-color: #d8d3d1; cursor: not-allowed; }
.empty .btn { margin-top: 14px; }

.scan-record-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.scan-record-metrics .metric { color: inherit; }
.scan-record-metrics .metric:hover { border-color: #baaeb0; background: #fff; }
.scan-record-metrics .metric.is-selected { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.scan-filter-select { width: min(290px, 36vw); }
.scan-select-shell { position: relative; display: block; min-width: 0; }
.scan-select-shell > svg { position: absolute; top: 50%; right: 12px; width: 18px; height: 18px; color: #6f6866; pointer-events: none; transform: translateY(-50%); transition: color .16s ease, transform .16s ease; }
.scan-select { appearance: none; -webkit-appearance: none; width: 100%; min-height: 44px; padding: 9px 40px 9px 13px; color: #2d2928; background: #fff; border: 1px solid #c9c2bf; border-radius: 7px; box-shadow: 0 1px 2px rgba(54,31,34,.04); font-size: 13px; font-weight: 700; line-height: 1.25; cursor: pointer; transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease; }
.scan-select-shell:hover .scan-select { background: #fdfbfb; border-color: #a89194; }
.scan-select-shell:focus-within .scan-select { background: #fff; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(122,31,43,.12); }
.scan-select-shell:focus-within > svg { color: var(--brand); transform: translateY(-50%) rotate(180deg); }
.scan-file-link { display: flex; align-items: center; min-width: 180px; gap: 9px; }
.scan-file-link > svg { flex: 0 0 18px; width: 18px; color: var(--brand); }
.scan-file-link > span { display: grid; }
.scan-file-link small { color: var(--muted); font-size: 10px; }
.scan-assignment { display: grid; grid-template-columns: minmax(170px, .9fr) minmax(250px, 1.35fr) 104px 44px; align-items: center; gap: 8px; }
.scan-assignment .btn-icon { width: 44px; height: 44px; min-height: 44px; }
.scan-issue { margin-top: 5px; color: var(--red); font-size: 11px; }
.scan-record-table td:nth-child(3) { min-width: 650px; }
.scan-record-table tbody td { padding-top: 14px; padding-bottom: 14px; }
.workflow-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.workflow-metrics .metric:hover { border-color: #baaeb0; background: #fff; }
.workflow-metrics .metric.is-selected { border-color: var(--brand); box-shadow: inset 0 3px 0 var(--brand); }
.submission-score-cell { color: #4c4543; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.submission-total-score { color: var(--brand); font-size: 17px; }
.grammar-review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grammar-review-item { display: grid; gap: 10px; min-width: 0; padding: 16px; border-right: 1px solid #ece8e6; border-bottom: 1px solid #ece8e6; }
.grammar-review-item:nth-child(2n) { border-right: 0; }
.grammar-review-item.needs-review { box-shadow: inset 3px 0 0 var(--brand); }
.grammar-review-head, .grammar-ocr-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.grammar-review-head strong { font-size: 19px; }
.grammar-review-head span, .grammar-ocr-meta { color: var(--muted); font-size: 11px; }
.grammar-crop { display: grid; place-items: center; min-height: 100px; overflow: hidden; background: #f5f3f2; border: 1px solid #ddd7d4; }
.grammar-crop img { display: block; max-width: 100%; max-height: 130px; }
.grammar-answer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.grammar-answer-row .field { min-width: 0; }
.grammar-decision { position: relative; display: grid; grid-template-columns: repeat(2, 42px); gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.grammar-decision legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.grammar-decision input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.grammar-decision label { display: grid; place-items: center; width: 42px; height: 40px; background: #fff; border: 1px solid currentColor; border-radius: 5px; font-size: 22px; font-weight: 850; line-height: 1; cursor: pointer; transition: background-color .14s ease, color .14s ease, box-shadow .14s ease; }
.grammar-decision label.is-correct { color: #23664f; }
.grammar-decision label.is-incorrect { color: var(--brand); }
.grammar-decision label:hover { box-shadow: 0 0 0 3px rgba(54, 45, 43, .08); }
.grammar-decision input:checked + label { color: #fff; }
.grammar-decision input:checked + label.is-correct { background: #23664f; border-color: #23664f; }
.grammar-decision input:checked + label.is-incorrect { background: var(--brand); border-color: var(--brand); }
.reference-answer { min-height: 40px; padding: 9px 10px; color: var(--brand); background: var(--brand-soft); border-radius: 5px; font-weight: 750; }
.grammar-batch-page-head { align-items: center; }
.grammar-batch-page-head .page-actions { align-items: center; }
.grammar-overall-progress { display: flex; align-items: baseline; gap: 4px; min-height: 38px; padding: 7px 11px; background: #fff; border: 1px solid var(--line); border-radius: 6px; font-variant-numeric: tabular-nums; }
.grammar-overall-progress span { margin-right: 5px; color: var(--muted); font-size: 11px; font-weight: 720; }
.grammar-overall-progress strong { color: var(--brand); font-size: 18px; line-height: 1; }
.grammar-overall-progress small { color: var(--muted); font-size: 11px; }
.grammar-batch-panel { overflow: hidden; }
.grammar-question-nav { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); background: #f8f6f5; border-bottom: 1px solid var(--line); }
.grammar-question-tab { position: relative; display: flex; align-items: center; justify-content: center; gap: 7px; min-width: 0; height: 54px; border-right: 1px solid var(--line); }
.grammar-question-tab:last-child { border-right: 0; }
.grammar-question-tab::after { content: ""; position: absolute; right: 12px; bottom: 0; left: 12px; height: 3px; background: transparent; }
.grammar-question-tab strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.grammar-question-tab span { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.grammar-question-tab span b { color: inherit; }
.grammar-question-tab:hover { background: #fff; }
.grammar-question-tab.is-active { color: var(--brand); background: #fff; }
.grammar-question-tab.is-active::after { background: var(--brand); }
.grammar-question-tab.is-complete:not(.is-active) { color: var(--green); background: #f1f8f5; }
.grammar-question-tab.is-complete span { color: var(--green); }
.grammar-batch-head { display: grid; grid-template-columns: minmax(150px, auto) minmax(300px, 1fr) auto; align-items: center; gap: 24px; min-height: 82px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.grammar-batch-kicker { display: block; color: var(--muted); font-size: 10px; font-weight: 720; }
.grammar-batch-head h2 { margin: 1px 0 0; font-size: 24px; line-height: 1.2; }
.grammar-reference { display: flex; align-items: stretch; min-width: 0; margin: 0; }
.grammar-reference > div { min-width: 120px; padding: 3px 18px; border-left: 1px solid var(--line); }
.grammar-reference dt { color: var(--muted); font-size: 10px; font-weight: 720; }
.grammar-reference dd { margin: 2px 0 0; overflow: hidden; color: var(--ink); font-size: 15px; font-weight: 780; text-overflow: ellipsis; white-space: nowrap; }
.grammar-question-progress { display: flex; align-items: baseline; gap: 3px; min-width: 102px; justify-content: flex-end; font-variant-numeric: tabular-nums; }
.grammar-question-progress span { margin-right: 5px; color: var(--muted); font-size: 10px; font-weight: 720; }
.grammar-question-progress strong { color: var(--brand); font-size: 24px; }
.grammar-question-progress small { color: var(--muted); font-size: 11px; }
.grammar-save-status { min-height: 0; color: var(--muted); font-size: 11px; text-align: center; transition: min-height .15s ease, padding .15s ease; }
.grammar-save-status:not(:empty) { min-height: 30px; padding: 7px 12px 5px; border-bottom: 1px solid var(--line); }
.grammar-save-status.is-error { color: var(--brand); background: var(--brand-soft); }
.grammar-student-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grammar-student-card { display: grid; grid-template-columns: 132px minmax(0, 1fr) 106px; align-items: stretch; min-width: 0; min-height: 84px; background: #fff; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background-color .14s ease, box-shadow .14s ease; }
.grammar-student-card:nth-child(2n) { border-right: 0; }
.grammar-student-card.is-correct { background: #eef7f3; box-shadow: inset 4px 0 0 var(--green); }
.grammar-student-card.is-incorrect { background: #fbf0f1; box-shadow: inset 4px 0 0 var(--brand); }
.grammar-student-card.is-active-review { position: relative; z-index: 1; outline: none; box-shadow: inset 0 0 0 3px #191716; }
.grammar-student-card.is-active-review .grammar-student-order { color: #fff; background: #191716; border-color: #191716; }
.grammar-student-card.is-saving { opacity: .72; }
.grammar-student-identity { display: grid; grid-template-columns: 25px minmax(0, 1fr); align-content: start; align-items: start; gap: 8px; min-width: 0; padding: 9px 8px 12px 12px; border-right: 1px solid rgba(145,132,129,.2); }
.grammar-student-order { display: grid; place-items: center; width: 25px; height: 25px; color: var(--muted); background: rgba(255,255,255,.72); border: 1px solid #d8d2cf; border-radius: 50%; font-size: 10px; font-weight: 800; font-variant-numeric: tabular-nums; }
.grammar-student-copy { display: grid; align-content: start; justify-items: start; gap: 4px; min-width: 0; }
.grammar-student-identity strong { align-self: start; min-width: 0; overflow: hidden; font-size: 18px; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.grammar-penalty-button { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 20px; padding: 0; color: #fff; background: #77716f; border: 1px solid #77716f; border-radius: 3px; font-size: 9px; font-weight: 800; line-height: 1; }
.grammar-penalty-button:hover { background: #5f5a58; border-color: #5f5a58; }
.grammar-penalty-button:focus-visible { outline: 2px solid rgba(25,23,22,.28); outline-offset: 2px; }
.grammar-student-answer { display: grid; place-content: start stretch; min-width: 0; padding: 9px 10px; }
.grammar-answer-crop { position: relative; display: grid; place-items: center; min-width: 0; height: 66px; overflow: hidden; background: rgba(255,255,255,.82); border: 1px solid #d9d3d0; border-radius: 4px; }
.grammar-answer-crop img { position: absolute; inset: 10px 26px; display: block; width: calc(100% - 52px); height: calc(100% - 20px); object-fit: contain; mix-blend-mode: multiply; }
.grammar-answer-crop span { color: var(--muted); font-size: 10px; }
.grammar-card-actions { display: grid; align-content: start; justify-items: center; gap: 5px; padding: 9px 8px; border-left: 1px solid rgba(145,132,129,.2); }
.grammar-card-decision { display: grid; grid-template-columns: repeat(2, 43px); gap: 5px; }
.grammar-mark-button { display: grid; place-items: center; width: 43px; height: 66px; padding: 0; color: #625b59; background: rgba(255,255,255,.92); border: 1px solid #cfc8c5; border-radius: 5px; }
.grammar-mark-button svg { width: 24px; height: 24px; stroke-width: 2.6; }
.grammar-mark-button:hover { color: var(--ink); border-color: #a99f9b; }
.grammar-mark-button.is-correct[aria-pressed="true"] { color: #fff; background: var(--green); border-color: var(--green); }
.grammar-mark-button.is-incorrect[aria-pressed="true"] { color: #fff; background: var(--brand); border-color: var(--brand); }
.penalty-copy-dialog { width: min(540px, calc(100vw - 28px)); }
.penalty-copy-dialog-body { display: grid; gap: 15px; }
.penalty-copy-student { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; background: #f4f2f1; border-left: 3px solid #77716f; }
.penalty-copy-student span { color: var(--muted); font-size: 10px; font-weight: 750; }
.penalty-copy-student strong { font-size: 17px; }
.penalty-copy-textarea { min-height: 140px; padding: 11px 12px; resize: vertical; line-height: 1.6; }
.penalty-copy-dialog .field small { color: var(--muted); font-size: 10px; }
.penalty-copy-confirm-content { min-height: 74px; max-height: 210px; overflow-y: auto; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: #fff; border: 1px solid #d6cfcc; border-radius: 5px; font-size: 14px; line-height: 1.65; }
.penalty-copy-print-note { margin: 0; padding: 10px 12px; color: #5e5654; background: #f7f5f4; border-left: 3px solid var(--brand); font-size: 11px; line-height: 1.55; }
.penalty-copy-error { margin: 0; color: var(--brand); font-size: 11px; font-weight: 750; }
.penalty-copy-success-icon { display: grid; place-items: center; width: 58px; height: 58px; margin: 4px auto 0; color: #fff; background: var(--green); border-radius: 50%; }
.penalty-copy-success-icon svg { width: 27px; height: 27px; }
.penalty-copy-success p { margin: 0; text-align: center; font-weight: 750; }
.essay-review-heading { align-items: center; }
.essay-review-editor { display: grid; grid-template-columns: 190px minmax(620px, 1fr) 280px; gap: 12px; align-items: start; }
.essay-tools, .essay-finalize { position: sticky; top: 86px; padding: 12px; }
.essay-tools { display: grid; gap: 12px; }
.essay-tool-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.essay-tool { display: grid; place-items: center; gap: 4px; min-height: 55px; padding: 7px; color: #595251; background: #faf9f8; border: 1px solid #d7d1cf; border-radius: 5px; font-size: 10px; font-weight: 750; }
.essay-tool svg { width: 18px; height: 18px; }
.essay-tool:hover, .essay-tool.active { color: #fff; background: var(--brand); border-color: var(--brand); }
.essay-auto-comment-settings { display: grid; overflow: hidden; background: #faf8f7; border: 1px solid #ddd7d4; border-radius: 5px; }
.essay-auto-comment-control { min-height: 38px; padding: 7px 9px; display: flex; align-items: center; gap: 8px; color: #423c3a; font-size: 11px; font-weight: 800; cursor: pointer; }
.essay-auto-comment-control input { width: 17px; height: 17px; margin: 0; accent-color: var(--brand); }
.essay-setting-slider { padding: 7px 9px; border-top: 1px solid #e4dfdd; display: grid; grid-template-columns: auto minmax(0, 1fr) 22px; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.essay-setting-slider input { min-width: 0; accent-color: var(--brand); }
.essay-color-code-control { min-width: 0; padding: 7px; border-top: 1px solid #e4dfdd; display: grid; grid-template-columns: 48px 26px minmax(0, 1fr); align-items: center; gap: 4px; color: var(--muted); font-size: 10px; }
.essay-color-code-control input[type="color"] { width: 26px; height: 28px; padding: 2px; background: #fff; border: 1px solid #d5cfcc; cursor: pointer; }
.essay-color-code-control input[type="text"], .essay-highlight-custom input[type="text"] { min-width: 0; height: 30px; padding: 3px 5px; color: #312c2b; background: #fff; border: 1px solid #d5cfcc; font: 700 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; }
.essay-auto-comment-settings:has([data-essay-auto-comment]:not(:checked)) .essay-setting-slider,
.essay-auto-comment-settings:has([data-essay-auto-comment]:not(:checked)) .essay-color-code-control { opacity: .45; }
.essay-color-controls, .essay-highlight-controls { display: grid; align-items: center; justify-content: center; gap: 7px; }
.essay-color-controls { grid-template-columns: repeat(3, 30px); }
.essay-highlight-controls { grid-template-columns: repeat(4, 27px); }
.essay-color-controls[hidden], .essay-highlight-controls[hidden] { display: none !important; }
.essay-swatch { width: 29px; height: 29px; padding: 0; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #bcb5b2; cursor: pointer; }
.essay-swatch-red { background: #d62828; }
.essay-swatch-blue { background: #1455a0; }
.essay-swatch-black { background: #171714; }
.essay-highlight-yellow { background: #ffd84d; }
.essay-highlight-pink { background: #ff79ad; }
.essay-highlight-green { background: #63d79b; }
.essay-highlight-blue { background: #63b8ff; }
.essay-swatch.active { box-shadow: 0 0 0 2px var(--brand); }
.essay-stroke { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.essay-color-controls > .essay-stroke { grid-column: 1 / -1; }
.essay-stroke input { min-width: 0; }
.essay-highlight-custom { grid-column: 1 / -1; display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center; gap: 5px; }
.essay-highlight-custom input[type="color"] { width: 32px; height: 31px; padding: 2px; background: #fff; border: 1px solid #d5cfcc; cursor: pointer; }
.essay-highlight-custom button { width: 32px; height: 31px; padding: 0; display: grid; place-items: center; color: var(--brand); background: #fff; border: 1px solid #d5cfcc; }
.essay-highlight-custom button svg { width: 16px; height: 16px; }
.essay-highlight-custom.is-active input[type="text"] { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.essay-highlight-width { grid-column: 1 / -1; width: 100%; padding-inline: 0; }
.essay-history { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.essay-history .btn { width: 100%; }
.essay-deskew { width: 100%; justify-content: center; }
.essay-deskew svg { width: 17px; height: 17px; }
.essay-save-state { min-height: 30px; margin: 0; line-height: 1.4; }
.essay-save-state.is-saved { color: #23664f; }
.essay-save-state.is-error { color: #b14d14; }
.essay-canvas-stage { position: relative; min-height: 72vh; overflow: auto; padding: 14px; background: #2a2727; border: 1px solid #484141; border-radius: 7px; }
.essay-canvas-loading { position: absolute; z-index: 3; top: 18px; left: 50%; min-width: 170px; padding: 8px 12px; color: rgba(255,255,255,.88); background: rgba(28,25,25,.84); text-align: center; transform: translateX(-50%); }
.essay-canvas-wrap { width: min(100%, 1280px); margin: 0 auto; background: #fff; box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.essay-canvas-wrap .canvas-container { width: 100% !important; height: auto !important; aspect-ratio: var(--essay-paper-aspect, 210 / 297); }
.essay-canvas-wrap .lower-canvas, .essay-canvas-wrap .upper-canvas { width: 100% !important; height: 100% !important; }
.essay-finalize { display: grid; gap: 16px; }
.essay-finalize h2 { margin: 3px 0 0; font-size: 19px; }
.essay-score-field { display: grid; gap: 7px; color: #474141; font-size: 12px; font-weight: 750; }
.essay-score-field > span { display: grid; grid-template-columns: 1fr auto; align-items: baseline; overflow: hidden; border: 1px solid #c9c3c1; border-radius: 6px; }
.essay-score-field input { width: 100%; min-width: 0; padding: 10px; border: 0; outline: 0; font-size: 26px; font-weight: 800; }
.essay-score-field input[readonly] { pointer-events: none; caret-color: transparent; user-select: none; appearance: textfield; }
.essay-score-field input[readonly]::-webkit-inner-spin-button, .essay-score-field input[readonly]::-webkit-outer-spin-button { margin: 0; appearance: none; }
.essay-score-field b { padding-right: 10px; color: var(--muted); font-size: 13px; }
.essay-score-field.is-keyboard-active > span { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(122,31,43,.13); }

.sheet-preview-dialog { width: min(1180px, calc(100vw - 36px)); height: calc(100vh - 32px); max-width: none; max-height: none; padding: 0; overflow: hidden; background: #fff; border: 1px solid #bfb8b5; border-radius: 7px; box-shadow: 0 24px 70px rgba(32, 19, 21, .28); }
.sheet-preview-dialog::backdrop { background: rgba(29, 21, 22, .62); }
.sheet-preview-shell { display: grid; grid-template-rows: auto minmax(0, 1fr); height: 100%; }
.sheet-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 70px; padding: 11px 14px 11px 18px; border-bottom: 1px solid var(--line); }
.sheet-preview-head > div:first-child { display: grid; grid-template-columns: auto auto; align-items: baseline; gap: 1px 10px; }
.sheet-preview-head span { grid-column: 1 / -1; color: var(--brand); font-size: 10px; font-weight: 800; }
.sheet-preview-head h2 { margin: 0; font-size: 17px; }
.sheet-preview-head small { color: var(--muted); font-variant-numeric: tabular-nums; }
.sheet-preview-actions { display: flex; align-items: center; gap: 8px; }
.sheet-preview-body { min-height: 0; background: #3d3938; }
.sheet-preview-body iframe { display: block; width: 100%; height: 100%; background: #fff; border: 0; }

.exam-seat-layout { display: grid; grid-template-columns: minmax(360px, .88fr) minmax(480px, 1.12fr); margin: -16px; }
.exam-seat-editor, .exam-seat-roster { min-width: 0; padding: 22px 24px 24px; }
.exam-seat-editor { border-right: 1px solid var(--line); }
.exam-seat-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.exam-seat-heading h2 { margin: 0; font-size: 18px; line-height: 1.35; }
.exam-seat-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.exam-seat-count { flex: 0 0 auto; min-width: 66px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); background: #faf9f8; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.exam-seat-count.is-complete { border-color: #bddbd0; color: #216c55; background: #e6f3ee; }
.exam-seat-textarea { display: block; width: 100%; min-height: 330px; resize: vertical; padding: 13px 14px; font-family: "IBM Plex Sans SC", "PingFang SC", sans-serif; font-size: 15px; line-height: 1.75; font-variant-numeric: tabular-nums; }
.exam-seat-actions { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; margin-top: 14px; }
.exam-seat-actions .btn { flex: 0 0 auto; padding-inline: 12px; }
.exam-seat-actions .btn-seat-randomize { border-color: #b9878f; color: var(--brand); background: #fff8f8; }
.exam-seat-actions .btn-seat-randomize:hover { border-color: var(--brand); background: #f9edef; }
.exam-seat-actions + .field-note { margin-top: 10px; }
.exam-seat-errors { margin-bottom: 14px; padding: 12px 14px; border-left: 3px solid var(--brand); background: #fbf1f2; color: #74303a; }
.exam-seat-errors strong { display: block; margin-bottom: 5px; }
.exam-seat-errors ul { margin: 0; padding-left: 20px; line-height: 1.65; }
.exam-seat-table-wrap { max-height: 480px; border: 1px solid var(--line); border-radius: 6px; }
.exam-seat-table { min-width: 520px; }
.exam-seat-table th { position: sticky; top: 0; z-index: 1; background: #f8f6f5; }
.exam-seat-table td, .exam-seat-table th { padding: 10px 12px; }

@media (max-width: 980px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .two-col, .review-layout { grid-template-columns: 1fr; }
  .review-page-head { flex-wrap: wrap; }
  .review-page-heading { width: 100%; }
  .scan-viewer { position: static; }
  .accuracy-grid { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
  .answer-grid { grid-template-rows: repeat(20, 96px); }
  .answer-score-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-analysis-header, .item-analysis-row { grid-template-columns: 70px 110px minmax(310px, 1fr) 90px 54px; gap: 10px; }
  .response-frequency { gap: 7px; }
  .response-option { grid-template-columns: 40px; flex-basis: 40px; }
  .sheet-filter-form { grid-template-columns: 1fr 1fr auto auto; }
  .sheet-workspace { grid-template-columns: 1fr; }
  .brand { min-width: auto; }
  .user-name { display: none; }
  .scan-record-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .workflow-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .essay-review-editor { grid-template-columns: 170px minmax(520px, 1fr); }
  .essay-finalize { position: static; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; }
  .exam-page-head { align-items: flex-start; flex-direction: column; }
  .exam-heading-summary { width: 100%; }
  .exam-page-head .page-actions { justify-content: flex-start; }
  .paper-review-workspace { grid-template-columns: 1fr; height: auto; }
  .paper-scan-column, .paper-analysis-column { display: grid; }
  .paper-image-viewer { height: min(72vh, 760px); }
  .paper-analysis-column { margin-top: 14px; }
  .paper-analysis-scroll { overflow: visible; }
  .past-paper-panel-head { align-items: flex-start; flex-direction: column; }
  .past-paper-panel-title { width: 100%; }
  .past-paper-toolbar { justify-content: space-between; width: 100%; }
  .past-paper-search { flex-basis: 260px; }
  .exam-seat-layout { grid-template-columns: 1fr; }
  .exam-seat-editor { border-right: 0; border-bottom: 1px solid var(--line); }
  .grammar-question-nav { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .grammar-question-tab:nth-child(5) { border-right: 0; }
  .grammar-question-tab:nth-child(-n + 5) { border-bottom: 1px solid var(--line); }
  .grammar-student-grid { grid-template-columns: 1fr; }
  .grammar-student-card { border-right: 0; }
}

@media (max-width: 720px) {
  .topbar { position: sticky; height: 60px; }
  .topbar-inner { position: relative; width: 100%; height: 60px; padding: 7px 10px; flex-wrap: nowrap; gap: 7px; }
  .brand { flex: 1 1 auto; min-width: 0; gap: 7px; overflow: hidden; }
  .brand-logo { flex-basis: 38px; width: 38px; height: 38px; }
  .brand-copy { min-width: 0; overflow: hidden; }
  .brand-copy strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; }
  .brand-copy small { margin-top: 2px; font-size: 9px; }
  .btn.mobile-nav-toggle { display: inline-flex; flex: 0 0 36px; width: 36px; min-width: 36px; min-height: 36px; order: 3; }
  .mobile-nav-toggle:hover, .mobile-nav-toggle:focus-visible { color: #fff; background: rgba(255,255,255,.08); border-color: rgba(217,170,66,.7); }
  .nav { position: absolute; top: 60px; right: 0; left: 0; display: none; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px 10px 11px; background: var(--brand-dark); border-bottom: 3px solid var(--gold); box-shadow: 0 14px 28px rgba(41, 15, 19, .22); }
  .topbar.is-nav-open .nav { display: grid; }
  .nav a { justify-content: flex-start; min-width: 0; min-height: 42px; padding: 0 10px; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-bottom-width: 1px; border-radius: 5px; white-space: nowrap; }
  .nav a:hover, .nav a.active { border-color: rgba(217,170,66,.7); background: rgba(255,255,255,.08); }
  .user-menu { flex: 0 0 auto; order: 2; margin-left: 0; gap: 5px; }
  .user-menu .btn { width: 34px; min-width: 34px; min-height: 34px; padding: 0; }
  .user-menu .btn span { display: none; }
  .app-shell { width: calc(100% - 20px); padding: 14px 0 42px; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
  .grammar-batch-page-head .page-actions { width: 100%; }
  .grammar-overall-progress { flex: 1 1 auto; }
  .grammar-batch-head { grid-template-columns: 1fr auto; gap: 10px; }
  .grammar-reference { grid-column: 1 / -1; grid-row: 2; }
  .grammar-reference > div { flex: 1 1 50%; padding: 3px 10px; }
  .grammar-student-card { grid-template-columns: 112px minmax(0, 1fr); min-height: 154px; }
  .grammar-student-identity { grid-template-columns: 22px minmax(0, 1fr); padding-left: 8px; }
  .grammar-student-order { width: 22px; height: 22px; }
  .grammar-student-answer { grid-template-rows: 74px auto; }
  .grammar-answer-crop { height: 74px; }
  .grammar-answer-crop img { inset: 8px 14px; width: calc(100% - 28px); height: calc(100% - 16px); }
  .grammar-card-actions { grid-column: 1 / -1; grid-template-columns: auto 1fr auto; border-top: 1px solid rgba(145,132,129,.2); border-left: 0; }
  .review-page-heading { flex-direction: column; gap: 12px; }
  .review-title-copy { min-width: 0; }
  .review-binding-inline { grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); width: 100%; }
  .item-analysis-head-tools { width: 100%; justify-content: flex-start; flex-wrap: wrap; margin-left: 0; }
  .item-analysis-section-metric .section-rate-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 8px; margin-top: 1px; }
  .item-analysis-section-metric .section-rate-row { display: flex; align-items: center; justify-content: space-between; gap: 3px; padding: 1px 0; border-right: 0; }
  .item-analysis-section-metric .section-rate-row b,
  .item-analysis-section-metric .section-rate-row strong { min-width: 0; margin: 0; font-size: 9px; line-height: 1.2; white-space: nowrap; }
  .past-paper-page-head .page-actions, .past-paper-page-head .btn { width: 100%; }
  .past-paper-toolbar { align-items: stretch; flex-direction: column; }
  .past-paper-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .past-paper-search { flex-basis: auto; width: 100%; min-width: 0; }
  .past-paper-table-wrap { max-height: none; }
  .student-page-actions { width: 100%; flex-wrap: wrap; }
  .student-search-form { width: 100%; }
  .student-search-form .input { flex: 1 1 auto; width: auto; min-width: 0; }
  .exam-management-toolbar { align-items: stretch; flex-direction: column; }
  .exam-management-toolbar .tabs { border-bottom: 1px solid var(--line); }
  .exam-submission-search { flex-basis: auto; width: calc(100% - 28px); margin: 9px 14px; }
  .exam-heading-summary { align-items: flex-start; flex-direction: column; gap: 12px; }
  .exam-heading-copy { min-width: 0; }
  .exam-score-statistics { grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; min-width: 0; }
  .exam-score-statistics > div { padding: 8px 5px 9px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .form-row, .score-grid { grid-template-columns: 1fr; }
  .accuracy-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-answer-grid { width: 100%; grid-template-rows: repeat(10, auto); grid-auto-flow: column; grid-auto-columns: minmax(112px, 1fr); overflow-x: auto; padding-bottom: 4px; contain: inline-size paint; }
  .answer-grid { grid-template-rows: repeat(30, 96px); }
  .answer-save-bar { bottom: 6px; }
  .quick-answer-editor { grid-template-columns: 44px minmax(0, 1fr); height: 360px; }
  .quick-answer-head > div { align-items: flex-start; flex-direction: column; gap: 2px; }
  .analysis-filter-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; width: 100%; }
  .analysis-filter-field { width: auto; }
  .analysis-section-buttons { grid-column: 1 / -1; width: 100%; }
  .analysis-section-button { flex: 1 1 20%; min-width: 0; padding: 0 8px; }
  .analysis-filter-form > .btn-icon { grid-column: 2; grid-row: 1; }
  .item-analysis-header { display: flex; align-items: center; gap: 6px; min-height: 0; padding: 8px 14px; }
  .item-analysis-header > span { display: none; }
  .item-analysis-header .analysis-sort-link { flex: 1 1 0; justify-content: center; width: auto; min-width: 0; min-height: 36px; padding: 6px 8px; margin: 0; color: #514b49; background: #fff; border: 1px solid #d8d1ce; border-radius: 5px; font-size: 12px; }
  .item-analysis-header .analysis-sort-link:hover { color: var(--brand); background: var(--brand-soft); }
  .item-analysis-header .analysis-sort-link.is-active { color: #fff; background: var(--brand); border-color: var(--brand); }
  .item-analysis-header .analysis-sort-link.is-centered { display: none; }
  .item-analysis-row { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "question accuracy points" "responses responses responses" "detail detail detail"; gap: 12px; min-height: 0; padding: 15px 14px; }
  .analysis-question { grid-area: question; }
  .analysis-accuracy { grid-area: accuracy; min-width: 88px; }
  .analysis-points { grid-area: points; min-width: 42px; }
  .response-frequency { grid-area: responses; width: 100%; gap: 8px; overflow-x: auto; padding: 4px 0; contain: inline-size paint; }
  .response-option { grid-template-columns: 54px; flex-basis: 54px; }
  .analysis-discrimination { display: none; }
  .item-response-detail { grid-area: detail; }
  .paper-page-head { flex-direction: row; align-items: center; }
  .paper-page-head > div:first-child { min-width: 0; }
  .paper-page-head h1 { font-size: 21px; }
  .paper-page-head p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .paper-page-head .page-actions > .btn { width: 38px; padding: 0; font-size: 0; }
  .paper-record-navigation { order: -1; }
  .paper-score-band { grid-template-columns: 1fr auto; gap: 8px 14px; padding: 14px 12px; }
  .paper-score-value { grid-column: 1 / -1; justify-content: center; }
  .paper-score-value strong { font-size: 30px; }
  .paper-score-value span { font-size: 15px; }
  .paper-score-value b { font-size: 16px; }
  .paper-student-identity strong { font-size: 15px; }
  .paper-image-toolbar { align-items: stretch; flex-direction: column; }
  .paper-page-options { width: 100%; }
  .paper-page-options button { flex: 1 0 auto; }
  .paper-image-tools { justify-content: flex-end; }
  .paper-image-viewer { height: 64vh; min-height: 460px; }
  .paper-section-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper-question-groups { grid-template-columns: 1fr; }
  .paper-question-group { border-right: 0; border-bottom: 1px solid var(--line); }
  .paper-question-group:last-child { border-bottom: 0; }
  .paper-question-item { grid-template-columns: 30px minmax(0, 1fr) 54px 24px; min-height: 34px; padding: 4px 9px; font-size: 11px; }
  .paper-result { width: 22px; height: 22px; }
  .paper-result svg { width: 16px; height: 16px; }
  .upload-steps { grid-template-columns: 1fr; }
  .sheet-filter-form { grid-template-columns: 1fr; }
  .sheet-filter-form .btn { width: 100%; }
  .roster-summary { grid-template-columns: 1fr 1fr; }
  .login-shell { min-height: 0; grid-template-columns: 1fr; }
  .login-brand { min-height: 250px; padding: 34px; border-right: 0; border-bottom: 6px solid var(--gold); }
  .login-brand h1 { font-size: 30px; }
  .login-form { padding: 32px; }
  .student-login-brand { min-height: 126px; padding: 26px 28px; }
  .student-login-brand::before { top: 20px; left: 28px; width: 34px; height: 4px; }
  .student-login-brand h1 { margin-top: 7px; font-size: 26px; }
  .student-login-shell .login-form { padding: 26px 28px 30px; }
  .sheet-preview-dialog { width: 100vw; height: 100vh; border: 0; border-radius: 0; }
  .sheet-preview-head { align-items: flex-start; }
  .sheet-preview-head > div:first-child { grid-template-columns: 1fr; }
  .sheet-preview-head span { grid-column: auto; }
  .scan-record-metrics { grid-template-columns: 1fr 1fr; }
  .workflow-metrics { grid-template-columns: 1fr 1fr; }
  .exam-seat-editor, .exam-seat-roster { padding: 18px 14px; }
  .exam-seat-textarea { min-height: 280px; }
  .exam-seat-actions { flex-wrap: wrap; }
  .exam-seat-actions .btn { width: 100%; }
  .grammar-review-grid { grid-template-columns: 1fr; }
  .grammar-review-item { border-right: 0; }
  .essay-review-editor { grid-template-columns: 1fr; }
  .essay-tools, .essay-finalize { position: static; }
  .essay-tool-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .essay-tool { min-height: 52px; }
  .essay-auto-comment-settings { grid-template-columns: 1fr 1fr; }
  .essay-auto-comment-control { grid-column: 1 / -1; }
  .essay-setting-slider { border-top: 1px solid #e4dfdd; }
  .essay-color-code-control { grid-template-columns: 54px 28px minmax(78px, 1fr); }
  .essay-color-controls { grid-template-columns: repeat(3, 32px) minmax(120px, 1fr); }
  .essay-color-controls > .essay-stroke { grid-column: auto; }
  .essay-highlight-controls { grid-template-columns: repeat(4, 30px) minmax(150px, 1fr); }
  .essay-highlight-custom { grid-column: auto; }
  .essay-highlight-width { grid-column: 1 / -1; }
  .essay-canvas-stage { min-height: 60vh; padding: 10px; }
  .essay-finalize { grid-column: auto; grid-template-columns: 1fr; }
  .sheet-preview-actions .btn-primary { min-width: 40px; padding: 8px; font-size: 0; }

  .page-head { gap: 12px; margin-bottom: 14px; }
  .page-head h1 { font-size: 22px; }
  .page-head p { margin-top: 4px; font-size: 12px; }
  .panel-head { min-height: 50px; padding: 11px 14px; }
  .panel-body { padding: 14px; }
  .form-actions { width: 100%; }
  .form-actions .btn { flex: 1 1 auto; }
  .flash-wrap { margin-bottom: 12px; }
  .metric { padding: 12px 13px; }
  .metric strong { font-size: 24px; }

  .exam-page-head .page-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .exam-page-head .page-actions .btn { min-width: 0; padding-inline: 8px; }
  .workflow-metrics { gap: 8px; margin-bottom: 14px; }
  .workflow-metrics .metric { min-height: 92px; }
  .exam-management-toolbar .tabs { width: 100%; padding-inline: 8px; scroll-snap-type: x proximity; }
  .exam-management-toolbar .tab { min-height: 46px; padding-inline: 12px; scroll-snap-align: start; }

  .exam-list-table, .exam-list-table tbody { display: block; }
  .exam-list-table thead { display: none; }
  .exam-list-table tbody { display: grid; gap: 10px; padding: 10px; }
  .exam-list-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; padding: 13px; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
  .exam-list-table td { display: grid; gap: 2px; min-width: 0; padding: 0; border: 0; }
  .exam-list-table td:first-child { grid-column: 1 / -1; font-size: 16px; }
  .exam-list-table td:first-child strong { overflow-wrap: anywhere; }
  .exam-list-table td:nth-child(2)::before { content: "日期"; }
  .exam-list-table td:nth-child(3)::before { content: "状态"; }
  .exam-list-table td:nth-child(4)::before { content: "完成 / 答卷"; }
  .exam-list-table td:nth-child(5)::before { content: "平均分"; }
  .exam-list-table td:nth-child(n + 2):nth-child(-n + 5)::before { color: var(--muted); font-size: 9px; font-weight: 700; }
  .exam-list-table td:last-child { grid-column: 1 / -1; }
  .exam-list-table td:last-child .btn { width: 100%; }

  .table-wrap:has([data-submission-sort-table]) { overflow: visible; }
  [data-submission-sort-table], [data-submission-sort-table] tbody { display: block; }
  [data-submission-sort-table] thead { display: block; }
  [data-submission-sort-table] thead tr { display: flex; gap: 6px; padding: 8px 10px; overflow-x: auto; background: #faf9f8; border-bottom: 1px solid var(--line); }
  [data-submission-sort-table] thead th { flex: 0 0 auto; padding: 0; background: transparent; border: 0; }
  [data-submission-sort-table] thead th:nth-child(-n + 4), [data-submission-sort-table] thead th:last-child { display: none; }
  [data-submission-sort-table] .submission-score-sort { min-height: 36px; padding: 4px 9px; background: #fff; border: 1px solid #d6d0cd; border-radius: 5px; }
  [data-submission-sort-table] .submission-score-average { display: none; }
  [data-submission-sort-table] tbody { display: grid; gap: 10px; padding: 10px; }
  [data-submission-sort-table] tr[data-submission-sort-row] { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td { display: grid; align-content: center; gap: 1px; min-width: 0; min-height: 47px; padding: 7px 8px; border: 0; border-right: 1px solid #eee9e7; border-bottom: 1px solid #eee9e7; overflow-wrap: anywhere; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(4n) { border-right: 0; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(1) { color: var(--brand); font-size: 12px; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(2)::before { content: "准考证号"; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(3)::before { content: "学生"; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(4)::before { content: "状态"; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(n + 2):nth-child(-n + 4)::before,
  [data-submission-sort-table] td[data-submission-score]::before { color: var(--muted); font-size: 9px; font-weight: 700; line-height: 1.2; }
  [data-submission-sort-table] td[data-submission-score="listening"]::before { content: "听力"; }
  [data-submission-sort-table] td[data-submission-score="reading"]::before { content: "阅读"; }
  [data-submission-sort-table] td[data-submission-score="cloze"]::before { content: "完型"; }
  [data-submission-sort-table] td[data-submission-score="fill"]::before { content: "语填"; }
  [data-submission-sort-table] td[data-submission-score="small"]::before { content: "小作文"; }
  [data-submission-sort-table] td[data-submission-score="big"]::before { content: "大作文"; }
  [data-submission-sort-table] td[data-submission-score="total"]::before { content: "总分"; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(n + 5):nth-child(-n + 11) { text-align: left; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:nth-child(11) { grid-column: span 2; color: var(--brand); background: var(--brand-soft); border-bottom: 0; }
  [data-submission-sort-table] tr[data-submission-sort-row] > td:last-child { grid-column: 1 / -1; min-height: 52px; padding: 8px; border: 0; background: #faf9f8; }
  [data-submission-sort-table] .row-actions { flex-wrap: wrap; justify-content: flex-start; }
  [data-submission-sort-table] tr[data-student-search-empty] { display: block; }
  [data-submission-sort-table] tr[hidden] { display: none !important; }

  .review-layout, .review-layout > *, .review-layout .stack, .scan-viewer { min-width: 0; max-width: 100%; }
  .review-layout .stack { grid-template-columns: minmax(0, 1fr); }
  .review-page-head .page-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .review-page-head .page-actions .btn { min-width: 0; padding-inline: 8px; }
  .scan-toolbar { min-width: 0; gap: 8px; }
  .scan-tabs { min-width: 0; overflow-x: auto; overscroll-behavior-inline: contain; }
  .scan-tabs button { flex: 0 0 auto; }
  .scan-toolbar > .help { display: none; }
  .scan-image-wrap { max-height: 62vh; }
  .scan-image { width: 100%; height: auto; }
  .review-score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .review-score-item:nth-child(3n) { border-right: 1px solid #ece7e4; }
  .review-score-item:nth-child(2n) { border-right: 0; }
  .review-score-item:nth-last-child(-n + 3) { border-bottom: 1px solid #ece7e4; }
  .review-score-item:nth-last-child(-n + 2) { border-bottom: 0; }

  .grammar-batch-page-head .page-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .grammar-batch-page-head .page-actions > *, .grammar-batch-page-head .page-actions .btn { width: 100%; }
  .grammar-overall-progress { justify-content: center; }
  .grammar-batch-head { min-height: 72px; padding: 10px 12px; }
  .grammar-batch-head h2 { font-size: 21px; }
  .grammar-reference > div { min-width: 0; }
  .grammar-student-card { grid-template-columns: 88px minmax(0, 1fr) 76px; min-height: 84px; }
  .grammar-student-identity { grid-template-columns: 20px minmax(0, 1fr); gap: 6px; padding: 9px 6px 9px 8px; }
  .grammar-student-order { width: 20px; height: 20px; font-size: 9px; }
  .grammar-student-identity strong { font-size: 15px; }
  .grammar-penalty-button { width: 36px; height: 18px; font-size: 8px; }
  .grammar-student-answer { display: grid; grid-template-rows: none; padding: 9px 6px; }
  .grammar-answer-crop { height: 66px; }
  .grammar-answer-crop img { inset: 6px 8px; width: calc(100% - 16px); height: calc(100% - 12px); }
  .grammar-card-actions { grid-column: auto; display: grid; grid-template-columns: 1fr; align-content: start; padding: 9px 4px; border-top: 0; border-left: 1px solid rgba(145,132,129,.2); }
  .grammar-card-decision { grid-template-columns: repeat(2, 33px); gap: 4px; }
  .grammar-mark-button { width: 33px; height: 66px; }
  .grammar-mark-button svg { width: 22px; height: 22px; }
  .penalty-copy-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); margin: auto; overflow-y: auto; }
  .past-paper-dialog-body { padding: 14px; }
  .past-paper-dialog-actions { padding: 10px 14px 14px; }

  .scan-filter { width: 100%; }
  .scan-filter-select { width: 100%; }
  .scan-record-metrics > :last-child { grid-column: 1 / -1; }
  .table-wrap:has(.scan-record-table) { overflow: visible; }
  .scan-record-table, .scan-record-table tbody { display: block; }
  .scan-record-table thead { display: none; }
  .scan-record-table tbody { display: grid; gap: 10px; padding: 10px; }
  .scan-record-table tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 6px; }
  .scan-record-table tbody td { display: grid; align-content: start; gap: 5px; min-width: 0; min-height: 58px; padding: 10px; border: 0; border-right: 1px solid #ece8e6; border-bottom: 1px solid #ece8e6; }
  .scan-record-table tbody td::before { content: attr(data-mobile-label); color: var(--muted); font-size: 9px; font-weight: 750; }
  .scan-record-table tbody td:first-child, .scan-record-table tbody td:nth-child(3) { grid-column: 1 / -1; }
  .scan-record-table tbody td:first-child { border-right: 0; }
  .scan-record-table tbody td:nth-child(2), .scan-record-table tbody td:nth-child(4) { border-right: 0; }
  .scan-record-table tbody td:nth-child(3) { min-width: 0; border-right: 0; }
  .scan-record-table tbody td:nth-child(5) { border-bottom: 0; }
  .scan-file-link { min-width: 0; overflow-wrap: anywhere; }
  .scan-assignment { grid-template-columns: 1fr; }
  .scan-assignment .btn-icon { width: 100%; }
  .scan-record-delete { place-items: center end; border-bottom: 0 !important; }

  .past-paper-panel-title { flex-wrap: wrap; white-space: normal; }
  .past-paper-last-updated { width: 100%; margin-left: 0; padding-left: 0; white-space: normal; }
  .past-paper-table th:first-child, .past-paper-table td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; }
  .past-paper-table thead th:first-child { z-index: 4; background: #faf9f8; }

  .table-wrap:has(.sheet-roster-table) { overflow: visible; }
  .sheet-roster-table, .sheet-roster-table tbody { display: block; }
  .sheet-roster-table thead { display: none; }
  .sheet-roster-table tbody { display: grid; gap: 8px; padding: 10px; }
  .sheet-roster-table tr[data-student-row] { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; grid-template-rows: auto auto; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; }
  .sheet-roster-table tr[data-student-row] td { min-width: 0; padding: 8px 9px; border: 0; }
  .sheet-roster-table tr[data-student-row] td:nth-child(1) { grid-row: 1 / 3; display: grid; place-items: center; padding: 8px 4px; border-right: 1px solid #ece8e6; }
  .sheet-roster-table tr[data-student-row] td:nth-child(2) { display: none; }
  .sheet-roster-table tr[data-student-row] td:nth-child(3) { grid-column: 2; grid-row: 2; color: var(--muted); font-size: 10px; }
  .sheet-roster-table tr[data-student-row] td:nth-child(4) { grid-column: 2; grid-row: 1; }
  .sheet-roster-table tr[data-student-row] td:nth-child(5) { grid-column: 3; grid-row: 1; font-size: 12px; }
  .sheet-roster-table tr[data-student-row] td:nth-child(6) { grid-column: 3; grid-row: 2; text-align: right; }
  .sheet-roster-table tr[data-student-search-empty] { display: block; }
  .sheet-roster-table tr[hidden] { display: none !important; }

  .exam-overview-page .panel-head { align-items: flex-start; flex-direction: column; }
  .score-overview-table th:first-child, .score-overview-table td:first-child { position: sticky; left: 0; z-index: 2; background: #fff; }
  .score-overview-table thead th:first-child { z-index: 4; background: #88898c; }
  .score-overview-table tfoot th:first-child { z-index: 3; background: #fffafa; }
}

@media (max-width: 430px) {
  .answer-grid { grid-template-rows: repeat(60, 96px); }
  .response-student-list { gap: 3px; padding: 5px; }
  .response-student-row { flex-basis: calc((100% - 9px) / 4); min-height: 34px; padding: 5px 2px; }
  .response-student-row strong { font-size: 14px; }
}

@media print {
  body:has(.exam-overview-page) { background: #fff; font-size: 10px; }
  body:has(.exam-overview-page) .topbar,
  body:has(.exam-overview-page) .flash-wrap,
  body:has(.exam-overview-page) .exam-overview-page-head .page-actions { display: none; }
  body:has(.exam-overview-page) .app-shell { width: 100%; padding: 0; }
  body:has(.exam-overview-page) .exam-overview-page-head { margin: 0 0 8px; }
  body:has(.exam-overview-page) .exam-overview-page-head h1 { font-size: 19px; }
  body:has(.exam-overview-page) .exam-overview-page { border: 0; box-shadow: none; }
  body:has(.exam-overview-page) .exam-overview-page .panel-head { min-height: 0; padding: 5px 0; border: 0; }
  body:has(.exam-overview-page) .score-overview-table { min-width: 0; }
  body:has(.exam-overview-page) .score-overview-table th,
  body:has(.exam-overview-page) .score-overview-table td { padding: 4px 3px; }
}
