:root {
  color-scheme: light;
  --ink: #15201e;
  --muted: #66716e;
  --paper: #ffffff;
  --surface: #f4f6f4;
  --line: #d7ddda;
  --green: #176b52;
  --green-dark: #0d503c;
  --green-soft: #e5f2ec;
  --red: #c43434;
  --red-dark: #992323;
  --red-soft: #fbe9e8;
  --gold: #b98520;
  --shadow: 0 12px 32px rgba(21, 32, 30, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--surface);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 16px;
  color: var(--ink);
  background: var(--paper);
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(23, 107, 82, 0.25);
  outline-offset: 2px;
}

a {
  color: var(--green);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.16;
}

h2 {
  margin-bottom: 4px;
  font-size: 22px;
  line-height: 1.28;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.topbar {
  min-height: 72px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 28px;
  padding: 12px max(24px, calc((100vw - 1180px) / 2));
  color: #fff;
  background: #183b35;
  border-bottom: 4px solid #d9aa42;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 17px;
  font-weight: 800;
}

.brand > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: block;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar nav a {
  padding: 8px 13px;
  color: rgba(255, 255, 255, 0.8);
  border-radius: 5px;
  text-decoration: none;
  font-weight: 700;
}

.topbar nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.account {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.76);
}

.account form {
  margin: 0;
}

.account .text-button {
  color: #fff;
}

.printer-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
}

.printer-status i {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #b7c1bd;
}

.printer-status-online {
  color: #dcfff1;
  background: rgba(12, 130, 82, 0.3);
  border-color: rgba(140, 242, 202, 0.36);
}

.printer-status-online i {
  background: #67f0a7;
  box-shadow: 0 0 0 3px rgba(103, 240, 167, 0.16);
}

.printer-status-offline {
  color: #ffe3e0;
  background: rgba(180, 44, 44, 0.28);
  border-color: rgba(255, 180, 174, 0.38);
}

.printer-status-offline i {
  background: #ff8a7f;
  box-shadow: 0 0 0 3px rgba(255, 138, 127, 0.14);
}

.primary {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.primary:hover:not(:disabled) {
  background: var(--green-dark);
  border-color: var(--green-dark);
}

.secondary {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}

.secondary:hover:not(:disabled) {
  border-color: #8b9995;
  background: #f9faf9;
}

.danger {
  color: var(--red);
  background: var(--paper);
  border-color: #e9b2af;
}

.danger:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

.text-button {
  min-height: 34px;
  padding: 4px 8px;
  color: var(--green);
  background: transparent;
  border: 0;
}

.wide {
  width: 100%;
}

.hidden {
  display: none !important;
}

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

.section-label {
  display: block;
  margin-bottom: 6px;
  color: var(--green);
  font: 800 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 1.4px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 30px;
  margin-bottom: 30px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.page-heading > p {
  max-width: 450px;
  margin-bottom: 5px;
  color: var(--muted);
  text-align: right;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.7fr);
  gap: 22px;
  align-items: start;
}

.upload-workspace-simple {
  max-width: 760px;
  margin: 0 auto;
}

.upload-page-heading {
  align-items: start;
}

.query-band.query-band-compact {
  width: min(520px, 100%);
  grid-template-columns: minmax(130px, 0.55fr) minmax(250px, 1fr);
  align-items: end;
  gap: 8px 14px;
  margin: 0;
  padding: 0;
  border: 0;
}

.query-band-compact h2 {
  font-size: 16px;
}

.query-band-compact .query-form input,
.query-band-compact .query-form button {
  min-height: 40px;
}

.query-band-compact .query-form input {
  font-size: 16px;
}

.query-band-compact .query-result {
  grid-column: 1 / -1;
  min-height: 0;
}

.query-band-compact .query-result:empty {
  display: none;
}

.upload-dashboard {
  display: grid;
  grid-template-columns: minmax(390px, 0.72fr) minmax(0, 1.28fr);
  align-items: start;
  gap: 20px;
}

.upload-dashboard .upload-workspace-simple {
  max-width: none;
  margin: 0;
}

.upload-recent-section {
  min-width: 0;
  margin-top: 0;
}

.upload-recent-section .record-list {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grading-lists-dashboard {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
  margin-top: 34px;
}

.grading-lists-dashboard .list-section {
  min-width: 0;
  margin-top: 0;
}

.grading-lists-dashboard .record-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.simple-capture-panel {
  width: 100%;
}

.capture-panel,
.submit-panel {
  padding: 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.submit-panel {
  position: sticky;
  top: 18px;
}

.panel-heading,
.section-heading,
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.panel-heading {
  margin-bottom: 20px;
}

.panel-heading > div,
.editor-toolbar > div:first-child {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.record-pagination {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.record-pagination button {
  min-height: 28px;
  padding: 3px 8px;
  font-size: 12px;
}

.record-pagination span {
  min-width: 36px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.panel-heading h2,
.section-heading h2 {
  margin: 0;
}

.step {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--green);
  color: var(--green);
  border-radius: 50%;
  font: 800 12px/1 ui-monospace, monospace;
}

.quality-badge {
  padding: 5px 8px;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.camera-button {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 30px;
  color: var(--ink);
  background-color: #f8faf8;
  background-image: linear-gradient(#e3e8e5 1px, transparent 1px), linear-gradient(90deg, #e3e8e5 1px, transparent 1px);
  background-size: 32px 32px;
  border: 2px dashed #9cadA7;
  border-radius: 6px;
  cursor: pointer;
  text-align: center;
}

.camera-button:hover {
  border-color: var(--green);
  background-color: #f2f8f4;
}

.camera-button strong {
  margin-top: 8px;
  font-size: 20px;
}

.camera-button small {
  color: var(--muted);
}

.upload-mode-divider {
  position: relative;
  margin: 14px 0;
  color: var(--muted);
  text-align: center;
}

.upload-mode-divider::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--line);
}

.upload-mode-divider span {
  position: relative;
  padding: 0 12px;
  background: var(--paper);
}

.batch-upload-button {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  color: var(--green-dark);
  background: var(--green-soft);
  border: 1px solid #afd4c5;
  border-radius: 6px;
  cursor: pointer;
}

.batch-upload-button:hover {
  border-color: var(--green);
}

.batch-upload-button strong {
  font-size: 17px;
}

.batch-upload-button small {
  color: var(--muted);
  text-align: right;
}

.batch-upload-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.batch-upload-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.batch-upload-list {
  max-height: 300px;
  margin: 0 0 12px;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  border-top: 1px solid var(--line);
}

.batch-upload-list li {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}

.batch-upload-list li > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.batch-upload-list b {
  width: 24px;
  display: inline-block;
  color: var(--muted);
  font: 700 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.batch-upload-list small {
  max-width: 220px;
  color: var(--muted);
  text-align: right;
}

.batch-upload-list li[data-state="success"] small {
  color: var(--green-dark);
  font-weight: 800;
}

.batch-upload-list li[data-state="failed"] small {
  color: var(--red-dark);
}

.capture-entry.batch-busy > .camera-button,
.capture-entry.batch-busy > .batch-upload-button {
  opacity: 0.45;
  pointer-events: none;
}

.camera-icon {
  position: relative;
  width: 58px;
  height: 42px;
  display: block;
  border: 3px solid var(--green);
  border-radius: 7px;
  background: #fff;
}

.camera-icon::before {
  content: "";
  position: absolute;
  width: 17px;
  height: 8px;
  left: 6px;
  top: -10px;
  border: 3px solid var(--green);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}

.camera-icon::after {
  content: "";
  position: absolute;
  width: 17px;
  height: 17px;
  left: 17px;
  top: 9px;
  border: 3px solid var(--green);
  border-radius: 50%;
}

.corner-editor {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.corner-editor-heading,
.corner-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.corner-editor-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.rotate-button {
  width: 38px;
  min-height: 36px;
  padding: 2px;
  font-size: 23px;
  line-height: 1;
}

.corner-editor-heading {
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}

.corner-stage {
  position: relative;
  width: 100%;
  overflow: hidden;
  line-height: 0;
  background: #1f2725;
}

#cornerCanvas {
  width: 100%;
  height: auto;
  display: block;
}

#cornerOverlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
  touch-action: none;
}

.corner-actions {
  justify-content: flex-end;
  background: #f7f9f7;
  border-top: 1px solid var(--line);
}

.corner-actions button {
  min-width: 130px;
}

.processing-state {
  min-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--muted);
  background: #f8faf8;
  border: 1px solid var(--line);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid #cfdbd6;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.preview-wrap {
  overflow: hidden;
  background: #e6e9e7;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.preview-actions {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 10px;
  padding: 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.preview-actions button {
  width: 100%;
}

#previewCanvas {
  width: 100%;
  height: auto;
  display: block;
  background: #fff;
}

.preview-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.upload-checks {
  margin: 8px 0 24px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.upload-checks p {
  display: flex;
  gap: 9px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 14px;
}

.check-dot {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--green-soft);
  border: 5px solid var(--green);
}

.upload-result {
  margin-top: 16px;
  padding: 18px;
  text-align: center;
  background: var(--green-soft);
  border: 1px solid #afd4c5;
  border-radius: 6px;
}

.upload-result strong {
  display: block;
  color: var(--green-dark);
  font: 900 42px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.query-band {
  display: grid;
  grid-template-columns: minmax(200px, 0.7fr) minmax(300px, 1fr) minmax(240px, 1fr);
  align-items: center;
  gap: 24px;
  margin: 32px 0;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.query-band h2 {
  margin: 0;
}

.query-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bcc7c3;
  border-radius: 5px;
}

textarea {
  resize: vertical;
}

.query-form input {
  font: 800 20px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.query-form button {
  color: #fff;
  background: #23312e;
}

.query-result {
  min-height: 54px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 14px;
}

.query-result strong {
  margin-right: 8px;
  color: var(--ink);
  font: 900 22px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.query-result.has-preview {
  grid-column: 1 / -1;
  display: block;
}

.query-result-card {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.query-result-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.query-open-button {
  flex: 0 0 auto;
}

.query-paper-preview {
  position: relative;
  width: min(760px, 100%);
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
}

.query-paper-preview img {
  width: 100%;
  height: auto;
  display: block;
}

.query-paper-preview canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  color: #5c4944;
  background: #f2eee4;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.status-all_correct,
.status-pill.status-one_wrong {
  color: var(--green-dark);
  background: var(--green-soft);
}

.status-pill.status-failed {
  color: var(--red-dark);
  background: var(--red-soft);
}

.record-status-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-status-row .status-pill {
  flex: 0 0 auto;
}

.record-reference-name {
  min-width: 0;
  overflow: hidden;
  color: #5c4944;
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-reference-name.status-all_correct,
.record-reference-name.status-one_wrong {
  color: var(--green-dark);
}

.record-reference-name.status-failed {
  color: var(--red-dark);
}

.list-section {
  margin-top: 34px;
}

.section-heading {
  margin-bottom: 16px;
}

.record-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

@media (max-width: 1100px) {
  .record-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.record-item {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.record-item.clickable {
  cursor: pointer;
}

.record-item.clickable:hover {
  background: #f5faf7;
  box-shadow: inset 0 0 0 2px var(--green);
}

.record-code {
  color: var(--ink);
  overflow-wrap: anywhere;
  font: 900 24px/1.12 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.record-meta {
  color: var(--muted);
  font-size: 12px;
}

.empty-list {
  grid-column: 1 / -1;
  padding: 36px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.grading-editor {
  --grading-view-height: clamp(620px, calc(100dvh - 150px), 980px);
  width: min(1500px, calc(100vw - 32px));
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 40px;
  padding-top: 28px;
  border-top: 4px solid #183b35;
}

.editor-toolbar {
  margin-bottom: 14px;
}

#activeCode {
  font: 900 30px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.grading-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.reference-panel,
.student-paper-panel {
  min-width: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.reference-panel-heading,
.student-paper-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  margin: 0;
  padding: 13px 14px 10px;
  border-bottom: 1px solid var(--line);
}

.reference-panel-heading strong,
.student-paper-heading strong {
  font-size: 16px;
}

.reference-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 94px minmax(150px, 0.6fr);
  align-items: end;
  gap: 10px;
  min-height: 78px;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
}

.reference-controls select,
.reference-controls input {
  width: 100%;
  min-width: 0;
}

.recent-reference-control {
  grid-column: 1 / -1;
}

.listening-reference {
  height: 100%;
  overflow: auto;
  padding: 16px;
  background: #fff;
}

.listening-reference-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -16px -16px 12px;
  padding: 14px 16px 12px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
}

.listening-reference-heading strong,
.listening-reference-heading span {
  display: block;
}

.listening-reference-heading span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.listening-answer-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.listening-answer-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 4px 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.listening-answer-list b {
  grid-row: span 2;
  color: var(--accent);
  font-family: var(--mono);
}

.listening-answer-list span {
  font-weight: 800;
}

.listening-answer-list small {
  color: var(--muted);
  font-size: 12px;
}

.reference-viewer,
.student-paper-viewer {
  height: var(--grading-view-height);
  min-height: 0;
  overflow: hidden;
  background: #eef1ef;
}

.reference-viewer {
  position: relative;
}

.reference-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #fff;
}

.reference-empty {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.student-tool-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  min-height: 78px;
  margin: 0;
  padding: 12px 14px 14px;
  border-bottom: 1px solid var(--line);
}

.student-name-button {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-nav-button {
  width: 44px;
  justify-self: center;
}

.active-record-code {
  min-height: 24px;
  padding: 2px 5px;
  color: var(--ink);
  background: transparent;
  border: 0;
  font: 700 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  opacity: 0.5;
}

.student-assignment-modal {
  position: fixed;
  inset: 0;
  z-index: 96;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 30, 27, 0.12);
}

.navigation-confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 97;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 30, 27, 0.38);
}

.recent-listening-modal {
  position: fixed;
  inset: 0;
  z-index: 98;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 30, 27, 0.52);
}

.recent-listening-card {
  width: min(340px, 100%);
  max-height: calc(100dvh - 36px);
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 18px 48px rgba(19, 31, 28, 0.32);
}

.recent-listening-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.recent-listening-heading h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.listening-number-display {
  min-height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  color: var(--ink);
  background: #f3f6f4;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: 900 36px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.listening-number-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  user-select: none;
}

.listening-number-keypad button {
  min-width: 0;
  min-height: 52px;
  padding: 5px;
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  font: 900 24px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.listening-number-keypad button:hover,
.listening-number-keypad button:focus-visible {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.listening-number-keypad .listening-key-action {
  font-family: inherit;
  font-size: 14px;
}

.listening-number-confirm {
  width: 100%;
  margin-top: 10px;
}

.navigation-confirm-card {
  width: min(390px, 100%);
  padding: 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 18px 45px rgba(19, 31, 28, 0.28);
}

.navigation-confirm-card h2 {
  margin-bottom: 10px;
  font-size: 20px;
}

.navigation-confirm-card p {
  margin: 0 0 20px;
  color: var(--muted);
}

.navigation-confirm-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.student-assignment-card {
  width: min(560px, 100%);
  height: min(620px, calc(100dvh - 36px));
  max-height: min(720px, calc(100dvh - 36px));
  display: flex;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(150, 166, 161, 0.52);
  border-radius: 6px;
  box-shadow: 0 10px 28px rgba(19, 31, 28, 0.14);
  transform: translateY(8vh);
}

.student-assignment-card h2 {
  margin: 5px 0 16px;
}

.student-assignment-card input {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(111, 137, 129, 0.62);
}

.student-keyboard {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  user-select: none;
}

.student-keyboard-row {
  display: grid;
  gap: 6px;
}

.student-keyboard-row-top {
  grid-template-columns: repeat(10, minmax(0, 1fr));
}

.student-keyboard-row-middle {
  width: 90%;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  justify-self: center;
}

.student-keyboard-row-bottom {
  grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(48px, 1.35fr) minmax(54px, 1.5fr);
}

.student-keyboard button {
  min-width: 0;
  min-height: 40px;
  padding: 4px 2px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  border-color: rgba(111, 137, 129, 0.5);
  font: 800 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.student-keyboard button:hover,
.student-keyboard button:focus-visible {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.student-keyboard .student-keyboard-action {
  font-family: inherit;
  font-size: 13px;
}

.student-match-list {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-content: start;
  grid-auto-rows: 48px;
  gap: 6px;
  margin: 10px 0;
  overflow-y: auto;
}

.student-match-list:empty {
  display: none;
  margin: 0;
}

#cancelStudentAssignment {
  flex: 0 0 auto;
  margin-top: 14px;
}

.student-match-list button {
  height: 48px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.82);
  border-color: rgba(150, 166, 161, 0.58);
  text-align: left;
}

.student-match-list button:hover {
  border-color: var(--green);
  background: var(--green-soft);
}

.student-match-list button span {
  font-weight: 800;
}

.student-match-list button small,
.student-match-empty {
  color: var(--muted);
}

.student-match-empty {
  padding: 24px 10px;
  text-align: center;
}

@media (min-width: 901px) {
  .grading-editor {
    position: fixed;
    inset: 0;
    z-index: 80;
    width: 100vw;
    height: 100dvh;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    background: #fff;
    transform: none;
  }

  .grading-layout {
    width: 100%;
    min-height: 100dvh;
    grid-template-columns: 50% 50%;
    gap: 0;
  }

  .reference-panel,
  .student-paper-panel {
    position: relative;
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  .reference-panel-heading,
  .student-paper-heading {
    display: none;
  }

  .editor-toolbar {
    margin: 0;
  }

  .editor-toolbar > div:first-child {
    display: none;
  }

  #closeEditor {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 98;
    width: 58px;
    height: 44px;
    min-height: 44px;
    color: #7a3d00;
    background: rgba(255, 174, 74, 0.34);
    border: 1px solid rgba(219, 125, 28, 0.56);
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(21, 32, 30, 0.08);
    transition: background-color 140ms ease, border-color 140ms ease;
  }

  #activeRecordCode {
    position: fixed;
    top: 55px;
    right: 10px;
    z-index: 93;
    max-width: 220px;
    color: rgba(21, 32, 30, 0.58);
    font-size: 10px;
    text-align: right;
  }

  #closeEditor:hover,
  #closeEditor:focus-visible {
    color: #6a3200;
    background: rgba(255, 174, 74, 0.82);
    border-color: rgba(219, 125, 28, 0.9);
  }

  .reference-controls,
  .student-tool-actions {
    position: fixed;
    top: 8px;
    z-index: 92;
    height: 44px;
    min-height: 44px;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .reference-controls {
    right: auto;
    left: 8px;
    width: calc(50vw - 16px);
    grid-template-columns: minmax(0, 1.2fr) 78px minmax(0, 1fr) minmax(0, 1fr);
    gap: 6px;
  }

  .reference-controls .recent-reference-control {
    grid-column: auto;
  }

  .student-tool-actions {
    right: 74px;
    left: calc(50vw + 8px);
    width: auto;
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    align-items: center;
    align-content: center;
  }

  .reference-controls label {
    height: 44px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 4px 7px 4px 9px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(150, 166, 161, 0.48);
    border-radius: 6px;
    box-shadow: 0 3px 10px rgba(21, 32, 30, 0.08);
    font-size: 12px;
    font-weight: 800;
    transition: background-color 140ms ease, border-color 140ms ease;
  }

  .reference-controls label:hover,
  .reference-controls label:focus-within {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(150, 166, 161, 0.82);
  }

  .reference-controls select,
  .reference-controls input {
    min-height: 34px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.26);
    border-color: rgba(150, 166, 161, 0.46);
    font-size: 13px;
    transition: background-color 140ms ease;
  }

  .reference-controls label:hover select,
  .reference-controls label:focus-within select,
  .reference-controls label:hover input,
  .reference-controls label:focus-within input {
    background: rgba(255, 255, 255, 0.76);
  }

  .student-tool-actions button {
    flex: 0 0 58px;
    min-height: 42px;
    padding: 6px 7px;
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(150, 166, 161, 0.48);
    box-shadow: 0 3px 10px rgba(21, 32, 30, 0.08);
    transition: background-color 140ms ease, border-color 140ms ease;
  }

  .student-tool-actions .result-pass {
    color: #fff;
    background: rgba(15, 119, 84, 0.52);
    border-color: rgba(15, 119, 84, 0.62);
  }

  .student-tool-actions .result-pass,
  .student-tool-actions .result-fail {
    flex-basis: 96px;
    font-size: 15px;
  }

  .student-tool-actions .record-nav-button {
    flex-basis: 40px;
    width: 40px;
    padding-inline: 4px;
    font-size: 13px;
  }

  .student-tool-actions .result-fail {
    color: #fff;
    background: rgba(202, 43, 43, 0.52);
    border-color: rgba(202, 43, 43, 0.62);
  }

  .student-tool-actions button.secondary:hover:not(:disabled),
  .student-tool-actions button.secondary:focus-visible {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(150, 166, 161, 0.82);
  }

  .student-tool-actions .result-pass:hover:not(:disabled),
  .student-tool-actions .result-pass:focus-visible {
    background: rgba(15, 119, 84, 0.84);
    border-color: rgba(15, 119, 84, 0.9);
  }

  .student-tool-actions .result-fail:hover:not(:disabled),
  .student-tool-actions .result-fail:focus-visible {
    background: rgba(202, 43, 43, 0.84);
    border-color: rgba(202, 43, 43, 0.9);
  }

  .student-tool-actions button.selected {
    outline: 3px solid rgba(255, 255, 255, 0.95);
    outline-offset: -5px;
  }

  .reference-viewer,
  .student-paper-viewer {
    width: 100%;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    background: #fff;
  }

  .reference-viewer {
    position: static;
  }

  .reference-image {
    position: static;
    width: 100%;
    height: auto;
    object-fit: fill;
  }

  .reference-empty {
    min-height: 100dvh;
  }

  .grading-editor .student-paper-viewer {
    display: block;
  }

  .student-paper-panel .paper-stage {
    max-width: none;
    max-height: none;
    box-shadow: none;
  }

  .editor-tip {
    display: none;
  }

  .save-state {
    position: fixed;
    right: auto;
    left: calc(50vw + 12px);
    bottom: 10px;
    z-index: 92;
    min-height: 0;
    margin: 0;
    padding: 7px 10px;
    color: #34433f;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(180, 191, 188, 0.75);
    border-radius: 6px;
    box-shadow: 0 5px 16px rgba(21, 32, 30, 0.13);
    backdrop-filter: blur(8px);
  }
}

.student-tool-actions button {
  min-width: 0;
  padding-inline: 8px;
  font-size: 13px;
}

.student-paper-panel .grading-corner-editor,
.student-paper-panel .student-paper-viewer {
  width: 100%;
}

.student-paper-viewer {
  display: flex;
  align-items: center;
  justify-content: center;
}

.grading-corner-editor {
  width: min(100%, 900px);
  margin: 0 auto 14px;
}

.paper-stage {
  position: relative;
  flex: 0 0 auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(21, 32, 30, 0.14);
  touch-action: manipulation;
}

.paper-stage img {
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.paper-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: manipulation;
  z-index: 2;
}

.ai-assist-status {
  margin-left: auto;
  padding: 3px 6px;
  color: #0f684d;
  background: rgba(224, 242, 235, 0.88);
  border: 1px solid rgba(15, 104, 77, 0.25);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-assist-status.loading {
  color: #4d5c58;
  background: rgba(246, 247, 247, 0.88);
}

.ai-assist-status.warning {
  color: #8c5300;
  background: rgba(255, 241, 202, 0.9);
  border-color: rgba(174, 111, 12, 0.3);
}

.ai-answer-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.ai-answer-mask {
  position: absolute;
  width: 13.8%;
  height: 2.25%;
  min-width: 0;
  min-height: 0;
  padding: 0;
  transform: translateY(-100%);
  border: 1px solid transparent;
  border-radius: 3px;
  appearance: none;
  cursor: pointer;
  pointer-events: auto;
}

.ai-answer-mask:disabled {
  cursor: default;
  pointer-events: none;
}

.ai-answer-state {
  position: absolute;
  right: 0;
  bottom: calc(100% + 2px);
  min-width: 0;
  min-height: 0;
  max-width: 180%;
  height: auto;
  padding: 0;
  color: #c3212d;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  text-align: right;
  white-space: nowrap;
  pointer-events: none;
}

.ai-answer-cross {
  position: absolute;
  inset: -30%;
  display: none;
  place-items: center;
  color: #b51f2c;
  font-family: Arial, sans-serif;
  font-size: clamp(34px, 4.5vw, 68px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 0 2px rgba(255, 255, 255, 0.95);
  pointer-events: none;
}

.ai-answer-mask.ai-match {
  background: transparent;
  border-color: transparent;
}

.ai-answer-mask.ai-review {
  background: rgba(226, 179, 65, 0.12);
  border-color: rgba(174, 111, 12, 0.34);
}

.ai-answer-mask.ai-mismatch {
  background: rgba(200, 59, 59, 0.14);
  border-color: rgba(190, 39, 39, 0.38);
}

.ai-answer-mask.ai-blank {
  background: rgba(102, 114, 111, 0.1);
  border-color: rgba(89, 103, 100, 0.32);
}

.ai-answer-mask.human-correct {
  background: rgba(22, 130, 94, 0.2);
  border-color: rgba(22, 130, 94, 0.58);
}

.ai-answer-mask.human-correct .ai-answer-state {
  color: #0f7553;
}

.ai-answer-mask.human-incorrect {
  background: rgba(183, 31, 43, 0.3);
  border-color: rgba(164, 22, 34, 0.78);
}

.ai-answer-mask.human-incorrect .ai-answer-cross {
  display: grid;
}

.ai-answer-mask.human-incorrect.circle-marked .ai-answer-cross {
  display: none;
}

.efficiency-mode .grading-layout {
  grid-template-columns: minmax(0, 1fr);
}

.efficiency-mode .reference-panel,
.efficiency-mode .student-paper-viewer,
.efficiency-mode .editor-tip,
.efficiency-mode .answer-peek-button {
  display: none !important;
}

.efficiency-review {
  min-height: min(68vh, 760px);
  padding: 18px;
  background: #f4f7f5;
  border-bottom: 1px solid var(--line);
}

.efficiency-review-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.efficiency-review-heading h2 {
  margin: 3px 0 0;
  font-size: 24px;
}

.efficiency-review-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.efficiency-review-item {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(100px, 0.75fr);
  gap: 10px 14px;
  padding: 12px;
  background: #fff;
  border: 1px solid #cbd5d1;
  border-radius: 6px;
}

.efficiency-crop {
  position: relative;
  overflow: hidden;
  min-width: 0;
  background: #fff;
  border: 1px solid #d4dcda;
  border-radius: 4px;
}

.efficiency-crop canvas {
  width: 100%;
  height: 82px;
  display: block;
}

.efficiency-crop span {
  position: absolute;
  top: 5px;
  left: 6px;
  padding: 2px 5px;
  color: #fff;
  background: rgba(24, 59, 53, 0.82);
  border-radius: 3px;
  font-size: 10px;
  font-weight: 800;
}

.efficiency-answer {
  min-width: 0;
  align-self: center;
}

.efficiency-answer small {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.efficiency-answer strong {
  display: block;
  overflow-wrap: anywhere;
  color: #b8202d;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.15;
}

.efficiency-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.efficiency-actions button {
  min-height: 42px;
  border-radius: 4px;
  color: #fff;
  font-size: 17px;
  font-weight: 900;
}

.efficiency-shortcut {
  display: none;
  margin-left: 8px;
  opacity: 0.72;
  font-size: 11px;
  font-weight: 800;
}

.efficiency-correct {
  background: #147452;
  border-color: #147452;
}

.efficiency-incorrect {
  background: #c92f36;
  border-color: #c92f36;
}

.efficiency-review-empty {
  display: grid;
  align-content: center;
  gap: 16px;
  min-height: 360px;
  margin: 0;
  color: var(--accent);
  font-size: 20px;
  font-weight: 800;
  text-align: center;
}

.efficiency-review-empty p {
  margin: 0;
}

.efficiency-review-empty strong {
  color: #b8202d;
  font-size: 30px;
}

@media (min-width: 901px) {
  .efficiency-shortcut {
    display: inline;
  }

  .efficiency-mode .efficiency-review {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: calc(100dvh - 126px);
  }

  .efficiency-mode .efficiency-review-grid {
    width: min(680px, 100%);
    margin: 0 auto;
    place-self: center;
    grid-template-columns: minmax(0, 1fr);
  }

  .efficiency-mode .efficiency-review-item {
    grid-template-columns: minmax(0, 1.45fr) minmax(140px, 0.75fr);
    gap: 14px 20px;
    padding: 17px;
  }

  .efficiency-mode .efficiency-crop canvas {
    height: 108px;
  }

  .efficiency-mode .efficiency-answer strong {
    font-size: 31px;
  }

  .efficiency-mode .efficiency-actions button {
    min-height: 55px;
    font-size: 21px;
  }
}

.editor-tip {
  margin: 14px 14px 10px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.answer-peek-button {
  display: none;
}

.mobile-reference-toggle {
  display: none;
}

.answer-peek-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  overflow: hidden;
  background: #fff;
}

.answer-peek-overlay > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #fff;
}

.answer-peek-listening {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 10px;
  background: #fff;
  text-align: left;
  touch-action: pan-y;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.result-actions {
  width: calc(100% - 28px);
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 14px;
}

.result-actions button {
  min-height: 54px;
  color: #fff;
  font-size: 17px;
}

.result-pass {
  background: var(--green);
}

.result-fail {
  background: var(--red);
}

.result-actions button.selected,
.student-tool-actions button.selected {
  outline: 4px solid rgba(21, 32, 30, 0.2);
  outline-offset: -4px;
}

.save-state {
  min-height: 26px;
  margin: 8px 14px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.overview-page main {
  width: min(calc(100% - 32px), 1600px);
}

.overview-controls {
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(260px, 320px) auto;
  align-items: end;
  gap: 8px;
  margin-bottom: 10px;
}

.overview-controls label {
  display: grid;
  grid-template-rows: 22px 52px;
  align-items: end;
  gap: 0;
}

.overview-controls label input,
.overview-controls label select {
  height: 52px;
  margin-top: 0;
}

.overview-controls button {
  min-height: 52px;
  align-self: end;
  justify-self: start;
}

.overview-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 10px;
  padding: 8px 12px;
  color: #6c3e12;
  background: #fff5d8;
  border: 1px solid #e8c977;
  border-radius: 6px;
}

.overview-alert div {
  display: grid;
  gap: 3px;
}

.overview-alert span {
  color: #765f43;
  font-size: 13px;
}

.overview-alert a {
  flex: 0 0 auto;
  color: #174e40;
  font-weight: 800;
}

.overview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 8px;
  border-block: 1px solid var(--line);
  background: #fff;
}

.overview-summary div {
  min-height: 56px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border-right: 1px solid var(--line);
}

.overview-summary div:last-child {
  border-right: 0;
}

.overview-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.overview-summary strong {
  font: 900 24px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.overview-summary div:nth-child(3) strong {
  color: var(--green);
}

.overview-summary div:nth-child(4) strong {
  color: var(--red-dark);
}

.overview-legend {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
  margin: 6px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.overview-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.progress-table-wrap {
  position: relative;
  width: 100%;
  max-height: calc(100dvh - 220px);
  min-height: 240px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
}

.progress-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.progress-matrix {
  width: max-content;
  min-width: 0;
  table-layout: fixed;
}

.progress-matrix th,
.progress-matrix td {
  height: 42px;
  padding: 5px 7px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.progress-matrix thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 88px;
  color: #fff;
  background: #14654f;
  border-color: rgba(255, 255, 255, 0.22);
}

.progress-matrix tbody tr:nth-child(even) td,
.progress-matrix tbody tr:nth-child(even) th {
  background: #f8faf8;
}

.progress-matrix .progress-sticky {
  position: sticky;
  z-index: 3;
  background: #fff;
}

.progress-matrix thead .progress-sticky {
  z-index: 6;
  color: #fff;
  background: #174e40;
}

.progress-class-column {
  left: 0;
  width: 64px;
  min-width: 64px;
  max-width: 64px;
}

.progress-name-column {
  left: 64px;
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  box-shadow: 4px 0 7px rgba(21, 32, 30, 0.08);
}

.progress-matrix tbody .progress-name-column {
  color: var(--ink);
  font-size: 13px;
}

.progress-test-heading {
  width: 118px;
  min-width: 118px;
  max-width: 118px;
  white-space: normal;
}

.progress-empty-heading,
.progress-empty-cell {
  width: 118px;
  min-width: 118px;
  max-width: 118px;
}

.progress-test-heading time,
.progress-test-heading strong,
.progress-test-heading span {
  display: block;
}

.progress-test-heading time {
  margin-bottom: 3px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
}

.progress-test-heading strong {
  max-height: 34px;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.3;
}

.progress-test-heading span {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
}

.progress-test-heading span b {
  color: #fff;
}

.progress-cell-control {
  position: relative;
  width: 100%;
  min-height: 30px;
  display: grid;
  place-items: center;
}

.progress-checkbox-wrap {
  position: relative;
  width: 24px;
  height: 24px;
  display: block;
}

.progress-checkbox {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  min-height: 100%;
  height: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  opacity: 0;
  cursor: pointer;
}

.progress-checkbox-mark {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  border: 1px solid #cfd6d3;
  border-radius: 5px;
  background: #fff;
  color: #9ba5a2;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.progress-checkbox-mark.passed {
  border-color: #0d7e58;
  background: #159469;
  color: #fff;
}

.progress-checkbox-mark.failed {
  border-color: #b62626;
  background: #cf3434;
  color: #fff;
}

.progress-checkbox.manual + .progress-checkbox-mark,
.progress-state.manual {
  box-shadow: 0 0 0 2px #d9aa42;
}

.progress-checkbox:focus-visible + .progress-checkbox-mark {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.progress-checkbox:disabled + .progress-checkbox-mark {
  opacity: 0.55;
}

.progress-record-link {
  position: absolute;
  top: 50%;
  right: 2px;
  width: 17px;
  min-height: 22px;
  display: grid;
  place-items: center;
  transform: translateY(-50%);
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
}

.progress-record-link:hover {
  color: var(--green);
}

.progress-state {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 5px;
  font-style: normal;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
}

.progress-state.passed {
  color: #fff;
  background: #159469;
  border-color: #0d7e58;
}

.progress-state.failed {
  color: #fff;
  background: #cf3434;
  border-color: #b62626;
}

.progress-state.untouched {
  color: #9ba5a2;
  background: #fff;
  border-color: #cfd6d3;
}

.admin-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.admin-tabs button {
  min-width: 118px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
}

.admin-tabs button.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.admin-panel {
  min-height: 300px;
}

.section-actions,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.select-column {
  width: 44px;
  padding-right: 5px;
  padding-left: 12px;
  text-align: center;
}

.select-column input {
  width: 18px;
  min-height: 18px;
  margin: 0;
}

.admin-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100dvh - 36px);
  padding: 0;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: 0 24px 60px rgba(19, 31, 28, 0.28);
}

.admin-dialog::backdrop {
  background: rgba(18, 30, 27, 0.42);
}

.admin-dialog form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dialog-heading h2 {
  margin: 4px 0 0;
}

.dialog-actions {
  justify-content: flex-end;
}

.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.record-code-link {
  color: inherit;
  font-weight: 800;
  text-decoration: none;
}

.record-code-link:hover,
.record-code-link:focus-visible {
  color: var(--green);
  text-decoration: underline;
  text-underline-offset: 3px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f7f9f7;
  font-size: 12px;
  font-weight: 800;
}

td {
  font-size: 14px;
}

tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  gap: 6px;
}

.table-actions button {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 12px;
}

.table-link {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 5px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.table-link:hover {
  color: var(--green);
  border-color: var(--green);
}

.inline-create {
  display: grid;
  grid-template-columns: 1fr 1fr 180px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 22px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.reference-upload-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.4fr) auto;
  gap: 12px;
  align-items: end;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.reference-file-field {
  min-width: 0;
  color: #3d4845;
  font-size: 13px;
  font-weight: 700;
}

.field-label {
  display: block;
}

.reference-file-picker {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 5px 6px;
  overflow: hidden;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-weight: 500;
}

.reference-file-picker button {
  min-height: 32px;
  flex: 0 0 auto;
  padding: 4px 12px;
  font-size: 13px;
}

#referencePdfName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-note {
  margin: 10px 0 18px;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: block;
  color: #3d4845;
  font-size: 13px;
  font-weight: 700;
}

label input,
label select,
label textarea {
  margin-top: 6px;
  font-weight: 500;
}

.settings-form {
  max-width: 720px;
  display: grid;
  gap: 18px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.compact-settings-form {
  max-width: none;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
}

.settings-form button {
  justify-self: start;
}

.print-settings-save {
  min-width: 88px;
  white-space: nowrap;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-line input {
  width: 20px;
  height: 20px;
  margin-top: 0;
  accent-color: var(--green);
}

.print-queue-admin {
  max-width: none;
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.print-queue-admin .section-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.print-queue-admin h2 {
  margin: 6px 0;
  font-size: 24px;
}

.print-queue-admin .admin-note {
  margin: 0;
}

.print-status {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 900;
}

.print-status-queued {
  color: #0f6d52;
  background: #dff2eb;
}

.print-status-processing,
.print-status-submitted {
  color: #7a5600;
  background: #fff0c2;
}

.print-status-printed {
  color: #0f6d52;
  background: #dff2eb;
}

.print-status-failed {
  color: #a52b2b;
  background: #fbe2e2;
}

.attempt-count {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.print-job-task-head,
.print-job-task-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.print-job-task-head input,
.print-job-task-cell input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.compact-danger {
  min-height: 28px;
  padding: 4px 8px;
  font-size: 12px;
}

.print-job-detail {
  max-width: 360px;
  white-space: normal;
  word-break: break-all;
  color: var(--muted);
  font-size: 12px;
}

.login-page {
  min-height: 100vh;
  background: #eef2ef;
}

.login-page .topbar {
  display: none;
}

.login-page main {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
}

.login-layout {
  width: min(940px, 100%);
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  min-height: 520px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.login-heading {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 54px;
  color: #fff;
  background: #183b35;
  border-right: 8px solid #d9aa42;
}

.login-heading .section-label {
  color: #f0c66f;
}

.login-heading h1 {
  max-width: 570px;
  margin-bottom: 14px;
  font-size: 40px;
}

.login-heading p {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
}

.login-form {
  align-self: center;
  display: grid;
  gap: 18px;
  padding: 38px;
}

.login-form h2 {
  margin-bottom: 6px;
}

.form-error {
  margin: 0;
  padding: 9px 11px;
  color: var(--red-dark);
  background: var(--red-soft);
  border-radius: 5px;
  font-size: 13px;
}

.empty-page {
  padding: 80px 0;
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  color: #fff;
  background: #23312e;
  border-radius: 6px;
  box-shadow: var(--shadow);
  font-size: 14px;
}

.toast.error {
  background: var(--red-dark);
}

.new-record-notice {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 100;
  min-height: 58px;
  padding: 14px 22px;
  color: #fff;
  background: var(--green);
  border-color: var(--green-dark);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(15, 72, 57, 0.28);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.new-record-notice:hover,
.new-record-notice:focus-visible {
  background: var(--green-dark);
  transform: translateY(-1px);
}

@media (max-width: 900px) {
  .efficiency-review {
    min-height: 62vh;
    padding: 12px;
  }

  .efficiency-review-heading h2 {
    font-size: 19px;
  }

  .efficiency-review-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .efficiency-review-item {
    grid-template-columns: minmax(0, 1.55fr) minmax(90px, 0.7fr);
    padding: 9px;
  }

  .efficiency-crop canvas {
    height: 72px;
  }

  .efficiency-answer strong {
    font-size: 20px;
  }

  .efficiency-actions button {
    min-height: 38px;
  }

  .ai-assist-status {
    padding: 2px 4px;
    font-size: 9px;
  }

  .ai-answer-state {
    font-size: 14px;
    line-height: 1;
  }

  .grading-page .query-band {
    display: none;
  }

  .grading-page .grading-lists-dashboard .list-section {
    margin-top: 18px;
  }

  .grading-page .grading-lists-dashboard .section-heading {
    margin-bottom: 8px;
  }

  .grading-page .grading-lists-dashboard .record-item {
    gap: 6px;
    padding: 9px 10px;
  }

  .grading-page .grading-lists-dashboard .record-code {
    font-size: 19px;
  }

  .grading-page .grading-lists-dashboard .record-status-row {
    gap: 5px;
  }

  .grading-page .grading-lists-dashboard .status-pill {
    min-height: 22px;
    padding: 2px 6px;
    font-size: 10px;
  }

  .grading-page .grading-lists-dashboard .record-reference-name {
    font-size: 10px;
  }

  .grading-page .grading-lists-dashboard .record-meta {
    display: none;
  }

  .grading-page .mobile-completed-last {
    margin-top: 34px;
  }

  .grading-page .mobile-completed-last .section-heading {
    margin-bottom: 8px;
  }

  .grading-page .mobile-completed-last .record-item {
    gap: 6px;
    padding: 9px 10px;
  }

  .grading-page .mobile-completed-last .record-code {
    font-size: 19px;
  }

  .grading-page .mobile-completed-last .record-status-row {
    gap: 5px;
  }

  .grading-page .mobile-completed-last .status-pill {
    min-height: 22px;
    padding: 2px 6px;
    font-size: 10px;
  }

  .grading-page .mobile-completed-last .record-reference-name {
    font-size: 10px;
  }

  .grading-page .mobile-completed-last .record-meta {
    display: none;
  }

  .recent-listening-card {
    width: min(320px, 100%);
    padding: 14px;
  }

  .grading-editor {
    --grading-view-height: min(68vh, 720px);
    width: 100%;
    left: auto;
    transform: none;
  }

  .grading-layout {
    grid-template-columns: 1fr;
  }

  .student-paper-panel {
    order: -1;
  }

  .student-paper-panel .editor-tip,
  .student-paper-panel .save-state {
    display: none;
  }

  .mobile-reference-toggle {
    width: calc(100% - 28px);
    min-height: 46px;
    display: block;
    margin: 12px 14px 14px;
    color: var(--green-dark);
    background: var(--green-soft);
    border-color: rgba(15, 119, 84, 0.42);
    font-size: 15px;
    font-weight: 800;
  }

  .reference-panel.mobile-reference-collapsed .reference-viewer {
    display: none;
  }

  .answer-peek-button {
    width: calc(100% - 28px);
    min-height: 48px;
    display: block;
    margin: 12px 14px 14px;
    color: #fff;
    background: var(--green);
    border-color: var(--green-dark);
    font-size: 15px;
    font-weight: 800;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .answer-peek-button.active {
    background: var(--green-dark);
    transform: translateY(1px);
  }

  .student-tool-actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .student-tool-actions .result-pass,
  .student-tool-actions .result-fail {
    grid-column: span 3;
  }

  .student-tool-actions .student-name-button,
  .student-tool-actions #undoCircle,
  .student-tool-actions #clearCircles,
  .student-tool-actions #printRecord,
  .student-tool-actions .record-nav-button {
    grid-column: span 1;
    width: 100%;
    min-width: 0;
    min-height: 42px;
    justify-self: stretch;
    padding-inline: 2px;
    font-size: 13px;
  }

  .student-assignment-modal {
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    background: rgba(18, 30, 27, 0.1);
  }

  .student-assignment-card {
    width: 100%;
    height: min(560px, calc(100dvh - 90px));
    max-height: min(560px, calc(100dvh - 90px));
    padding: 14px;
    background: rgba(255, 255, 255, 0.75);
    transform: translateY(5vh);
  }

  .student-assignment-card h2 {
    margin: 2px 0 10px;
    font-size: 19px;
  }

  .student-keyboard,
  .student-keyboard-row {
    gap: 4px;
  }

  .student-keyboard button {
    min-height: 38px;
    font-size: 13px;
  }

  #cancelStudentAssignment {
    width: 100%;
    min-height: 48px;
    margin-top: 16px;
  }

  .reference-viewer,
  .student-paper-viewer {
    height: var(--grading-view-height);
    min-height: 540px;
  }
}

@media (max-width: 420px) {
  .recent-listening-modal {
    padding: 10px;
  }

}

@media (max-width: 900px) {
  .topbar {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .topbar nav {
    order: 3;
    grid-column: 1 / -1;
    justify-content: center;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    padding-top: 8px;
  }

  .account {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 8px;
  }

  .workspace,
  .query-band {
    grid-template-columns: 1fr;
  }

  .upload-page-heading {
    display: block;
  }

  .query-band.query-band-compact {
    grid-template-columns: 1fr;
    width: 100%;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
  }

  .upload-dashboard {
    grid-template-columns: 1fr;
  }

  .upload-recent-section {
    margin-top: 34px;
  }

  .upload-recent-section .record-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grading-lists-dashboard {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 0;
  }

  .grading-lists-dashboard .list-section {
    margin-top: 34px;
  }

  .grading-lists-dashboard .record-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .submit-panel {
    position: static;
  }

  .query-band {
    gap: 14px;
  }

  .record-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-create {
    grid-template-columns: 1fr 1fr;
  }

  .reference-upload-form {
    grid-template-columns: 1fr 1fr;
  }

  .reference-upload-form > button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-heading {
    min-height: 260px;
    padding: 34px;
    border-right: 0;
    border-bottom: 6px solid #d9aa42;
  }
}

@media (max-width: 640px) {
  body {
    font-size: 15px;
  }

  main {
    width: min(100% - 24px, 1180px);
    padding: 24px 0 56px;
  }

  .topbar {
    min-height: 62px;
    padding: 10px 12px;
  }

  .brand {
    font-size: 14px;
  }

  .brand-mark {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .account > span:not(.printer-status) {
    display: none;
  }

  .printer-status {
    padding: 3px 6px;
    font-size: 10px;
  }

  .page-heading {
    display: block;
    margin-bottom: 20px;
    padding-bottom: 16px;
  }

  .page-heading > p {
    margin: 10px 0 0;
    text-align: left;
  }

  h1 {
    font-size: 29px;
  }

  h2 {
    font-size: 19px;
  }

  .capture-panel,
  .submit-panel {
    padding: 16px;
  }

  .camera-button,
  .processing-state {
    min-height: 270px;
  }

  .corner-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .corner-actions button {
    min-width: 0;
    padding-inline: 8px;
  }

  .quality-badge {
    display: none;
  }

  .query-band {
    margin: 24px 0;
    padding: 20px 0;
  }

  .query-form {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .record-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .record-item {
    padding: 13px;
  }

  .record-code {
    font-size: 24px;
  }

  .compact-settings-form {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 16px;
  }

  .compact-settings-form .checkbox-line {
    min-width: 0;
    font-size: 13px;
    line-height: 1.35;
  }

  .compact-settings-form .checkbox-line input {
    flex: 0 0 auto;
  }

  .compact-settings-form .print-settings-save {
    min-width: 64px;
    min-height: 44px;
    padding: 8px 14px;
    justify-self: end;
  }

  .editor-toolbar {
    align-items: center;
    flex-direction: row;
  }

  .student-tool-actions {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .student-tool-actions button {
    min-width: 0;
    padding: 8px;
    font-size: 12px;
  }

  #closeEditor {
    margin-left: auto;
  }

  .result-actions {
    bottom: 6px;
    gap: 6px;
    padding: 7px;
  }

  .result-actions button {
    min-width: 0;
    min-height: 50px;
    padding: 8px 4px;
    font-size: 16px;
  }

  .reference-viewer,
  .student-paper-viewer {
    height: 68vh;
    min-height: 440px;
  }

  .overview-page main {
    width: calc(100% - 16px);
    padding-top: 14px;
  }

  .overview-heading {
    margin-bottom: 10px;
    padding-bottom: 8px;
  }

  .overview-heading h1 {
    font-size: 27px;
  }

  .overview-heading > p {
    display: none;
  }

  .overview-controls {
    grid-template-columns: 84px minmax(0, 1fr) 54px;
    gap: 6px;
    margin-bottom: 8px;
  }

  .overview-controls button {
    grid-column: auto;
    width: 100%;
    min-height: 38px;
    padding: 5px;
    font-size: 12px;
  }

  .overview-controls label {
    gap: 4px;
    font-size: 11px;
  }

  .overview-controls select,
  .overview-controls input {
    min-height: 38px;
    padding: 6px;
    font-size: 12px;
  }

  .overview-alert {
    align-items: center;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 8px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .overview-alert span {
    display: none;
  }

  .overview-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 5px;
  }

  .overview-summary div {
    min-height: 48px;
    display: grid;
    place-items: center;
    gap: 3px;
    padding: 6px 3px;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .overview-summary div:last-child {
    border-right: 0;
  }

  .overview-summary span {
    font-size: 10px;
  }

  .overview-summary strong {
    font-size: 20px;
  }

  .overview-legend {
    justify-content: flex-start;
    gap: 8px;
    margin: 4px 0;
    font-size: 10px;
  }

  .progress-table-wrap {
    max-height: 72dvh;
    min-height: 210px;
    background: #fff;
  }

  .progress-matrix th,
  .progress-matrix td {
    height: 36px;
    padding: 3px 4px;
    font-size: 12px;
  }

  .progress-matrix thead th {
    height: 74px;
  }

  .progress-class-column {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
  }

  .progress-name-column {
    left: 46px;
    width: 82px;
    min-width: 82px;
    max-width: 82px;
  }

  .progress-test-heading {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
  }

  .progress-empty-heading,
  .progress-empty-cell {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
  }

  .progress-test-heading time {
    margin-bottom: 2px;
    font-size: 9px;
  }

  .progress-test-heading strong {
    max-height: 29px;
    font-size: 11px;
  }

  .progress-test-heading span {
    margin-top: 2px;
    font-size: 9px;
  }

  .progress-state {
    width: 20px;
    height: 20px;
    font-size: 14px;
  }

  .progress-checkbox-wrap {
    width: 20px;
    height: 20px;
  }

  .progress-checkbox-mark {
    font-size: 14px;
  }

  .progress-record-link {
    right: 0;
    width: 14px;
    font-size: 9px;
  }

  .admin-tabs {
    overflow-x: auto;
  }

  .admin-tabs button {
    min-width: 100px;
  }

  .inline-create,
  .reference-upload-form {
    grid-template-columns: 1fr;
  }

  .reference-upload-form > button {
    grid-column: auto;
    justify-self: stretch;
  }

  .login-page main {
    padding: 12px;
  }

  .login-layout {
    min-height: auto;
  }

  .login-heading {
    min-height: 230px;
    padding: 26px;
  }

  .login-heading h1 {
    font-size: 30px;
  }

  .login-form {
    padding: 26px;
  }
}

@media (max-width: 380px) {
  .record-list {
    grid-template-columns: 1fr;
  }

  .panel-heading > div {
    gap: 8px;
  }

}

.auto-grade-form {
  display: grid;
  grid-template-columns: minmax(240px, 1.5fr) minmax(110px, .45fr) minmax(210px, .8fr) auto;
  gap: 12px;
  align-items: end;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.auto-grade-form label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.auto-grade-actions {
  display: flex;
  gap: 8px;
}

.auto-grade-status {
  min-height: 24px;
  margin: 14px 0;
  color: var(--muted);
}

.auto-grade-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  padding: 12px 0;
}

.auto-grade-summary strong {
  margin-right: auto;
}

.auto-grade-warning {
  color: var(--danger);
  font-weight: 700;
}

.auto-grade-state {
  display: inline-block;
  padding: 4px 7px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.ai-learning-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 16px 0 0;
  border: 1px solid var(--line);
  background: #fff;
}

.ai-learning-summary div {
  display: grid;
  gap: 7px;
  min-height: 92px;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.ai-learning-summary div:last-child {
  border-right: 0;
}

.ai-learning-summary span,
.ai-learning-progress span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ai-learning-summary strong {
  font-size: 30px;
  line-height: 1;
}

.ai-learning-progress {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 1fr);
  gap: 24px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.ai-learning-progress > div {
  display: grid;
  gap: 5px;
}

.ai-learning-progress progress {
  width: 100%;
  height: 14px;
  accent-color: var(--green);
}

.ai-learning-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
  padding: 18px 0 12px;
}

.ai-learning-filters label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.ai-learning-result-note {
  min-height: 22px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.ai-learning-table td {
  vertical-align: middle;
}

.ai-learning-table td:nth-child(6) {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.ai-learning-text {
  max-width: 190px;
  white-space: normal !important;
  line-height: 1.4;
}

.ai-learning-text span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ai-learning-excluded {
  opacity: .58;
  background: #f3f4f3;
}

.auto-grade-reference,
.auto-grade-match {
  color: #075a43;
  background: #e2f3ed;
}

.auto-grade-review {
  color: #765200;
  background: #fff1c9;
}

.auto-grade-mismatch,
.auto-grade-blank {
  color: #a3262b;
  background: #fde5e5;
}

@media (max-width: 760px) {
  .auto-grade-form {
    grid-template-columns: 1fr 100px;
  }

  .auto-grade-form label:nth-child(3),
  .auto-grade-actions {
    grid-column: 1 / -1;
  }

  .auto-grade-actions > * {
    flex: 1;
  }

  .ai-learning-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ai-learning-summary div {
    min-height: 72px;
    padding: 12px;
    border-bottom: 1px solid var(--line);
  }

  .ai-learning-summary div:nth-child(2n) {
    border-right: 0;
  }

  .ai-learning-summary strong {
    font-size: 24px;
  }

  .ai-learning-progress,
  .ai-learning-filters {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
