:root {
  color-scheme: light;
  --ink: #17202a;
  --text: #17202a;
  --muted: #667085;
  --line: #d7dde7;
  --paper: #ffffff;
  --soft: #f4f7fb;
  --accent: #1f7a6d;
  --accent-dark: #155d53;
  --warn: #9a5b00;
  --line-soft: #e6ebf2;
  --shadow-soft: 0 18px 46px rgba(31, 44, 71, 0.07);
  --shadow-lift: 0 22px 54px rgba(31, 44, 71, 0.11);
  --shadow-button: 0 9px 20px rgba(31, 122, 109, 0.13);
}

/* Shared legal footer: every link remains a separate, reliable tap target on phones. */
.legal-footer {
  text-align: center;
  font-size: 12px;
  color: #98a2b3;
  padding: 16px 12px;
  line-height: 1.7;
}

.legal-footer__links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.legal-footer a {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 4px;
  touch-action: manipulation;
}

.legal-footer__separator { color: #c0c7d2; }

@media (max-width: 640px) {
  .legal-footer { padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); }
  .legal-footer__links { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; }
  .legal-footer__separator { display: none; }
  .legal-footer a { justify-content: center; min-height: 42px; border-radius: 8px; background: #f7f9fc; }
  .legal-footer a:last-child { grid-column: 1 / -1; }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7f9fc 0%, #eef3f8 100%);
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.teacher-shell {
  min-width: 980px;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.teacher-sidebar {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 16px;
  padding: 30px 20px 26px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 18px 0 44px rgba(31, 44, 71, 0.06);
  z-index: 5;
}

.teacher-brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.teacher-brand strong {
  display: block;
  color: #151f39;
  font-size: 22px;
  line-height: 1.1;
}

.teacher-brand small,
.teacher-version-badge {
  color: #7a86a5;
  font-size: 12px;
  line-height: 1.3;
}

.teacher-version-badge {
  min-height: 18px;
  margin: -8px 0 6px 52px;
}

.teacher-logo-mark {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.teacher-logo-mark i {
  position: absolute;
  width: 30px;
  height: 11px;
  border-radius: 4px;
  background: linear-gradient(135deg, #64a5ff, #2d6bff);
  transform: rotate(28deg) skewX(-18deg);
  box-shadow: 0 8px 18px rgba(45, 107, 255, 0.2);
}

.teacher-logo-mark i:nth-child(1) {
  top: 7px;
}

.teacher-logo-mark i:nth-child(2) {
  top: 17px;
  opacity: 0.88;
}

.teacher-logo-mark i:nth-child(3) {
  top: 27px;
  opacity: 0.76;
}

.teacher-sidebar-nav {
  display: grid;
  align-content: start;
  gap: 10px;
}

.teacher-sidebar-nav button {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #64708f;
  box-shadow: none;
  font-size: 15px;
  font-weight: 900;
  text-align: left;
}

.teacher-sidebar-nav button:hover,
.teacher-sidebar-nav button.active {
  background: #f0f5ff;
  border-color: #e4ecff;
  color: #2466ff;
  box-shadow: 0 14px 30px rgba(36, 102, 255, 0.09);
  transform: none;
}

.teacher-nav-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 3px;
}

.teacher-nav-icon::before,
.teacher-nav-icon::after,
.teacher-nav-icon span {
  content: "";
}

.teacher-nav-icon::before,
.teacher-nav-icon::after {
  display: block;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.75;
}

.workbench-icon {
  border: 2px solid currentColor;
  border-radius: 4px;
  padding: 2px;
}

.score-icon {
  border: 2px solid currentColor;
  border-radius: 4px;
}

.score-icon::before {
  grid-column: 1 / -1;
}

.teacher-user-menu {
  position: relative;
}

.teacher-user-menu summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  list-style: none;
  cursor: pointer;
}

.teacher-user-menu summary::-webkit-details-marker {
  display: none;
}

.teacher-avatar,
.teacher-top-avatar {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #f3c6a8, #88aaf8);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 22px rgba(31, 44, 71, 0.12);
  text-transform: uppercase;
}

.teacher-avatar-tone-0 {
  background: linear-gradient(135deg, #6aa7ff, #9d8cff);
}

.teacher-avatar-tone-1 {
  background: linear-gradient(135deg, #42c7b3, #6f9fff);
}

.teacher-avatar-tone-2 {
  background: linear-gradient(135deg, #ffb56b, #ee7d92);
}

.teacher-avatar-tone-3 {
  background: linear-gradient(135deg, #7ac66d, #39a9b8);
}

.teacher-avatar-tone-4 {
  background: linear-gradient(135deg, #c08cff, #5fa8ff);
}

.teacher-avatar-tone-5 {
  background: linear-gradient(135deg, #f08f75, #f0c15a);
}

.teacher-user-text {
  min-width: 0;
}

.teacher-user-text strong,
.teacher-user-text small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-user-text strong {
  color: #26324f;
  font-size: 14px;
}

.teacher-user-text small {
  color: #7a86a5;
  font-size: 12px;
}

.teacher-user-chevron {
  color: #52627f;
  font-size: 18px;
}

.teacher-user-actions {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  width: 180px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-lift);
}

.teacher-user-actions form {
  margin: 0;
}

.teacher-user-actions .secondary-button {
  width: 100%;
}

.teacher-main {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px 30px 42px;
}

.teacher-topbar {
  min-height: 64px;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}

.teacher-page-heading {
  display: grid;
  gap: 6px;
}

.teacher-product-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  color: #111a32;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.teacher-product-title img {
  width: auto;
  height: 22px;
  display: block;
}

.teacher-topbar h1 {
  margin: 0;
  color: #141c35;
  font-size: 22px;
  letter-spacing: 0;
}

.teacher-topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.teacher-grade-label {
  color: #5a6683;
  font-size: 14px;
}

.teacher-grade-label strong {
  color: #18213d;
}

.teacher-bell-button {
  width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 50%;
  background: #fff;
  color: #6b7898;
  box-shadow: 0 8px 18px rgba(31, 44, 71, 0.06);
}

.teacher-bell-button span {
  position: relative;
  width: 15px;
  height: 17px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 4px 4px;
}

.teacher-bell-button span::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  transform: translateX(-50%);
}

.teacher-view {
  display: grid;
  gap: 16px;
}

.teacher-view[hidden] {
  display: none !important;
}

.teacher-flow-steps {
  padding: 14px 18px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(31, 44, 71, 0.05);
}

.app-header {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.flow-steps {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.flow-step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.flow-step::before {
  content: attr(data-step);
  display: inline-grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #b8c7d9;
  border-radius: 50%;
  background: #fff;
  color: #53627a;
  font-size: 13px;
  font-weight: 700;
}

.flow-step.active::before,
.flow-step.done::before {
  border-color: #9ec4ff;
  background: #edf5ff;
  color: #2f67c9;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  max-width: 980px;
}

.work-card {
  display: grid;
  gap: 14px;
}

.workspace-column {
  display: contents;
}

.answer-settings-card {
  order: 1;
}

.roster-card {
  order: 2;
}

.upload-card {
  order: 3;
}

.start-card,
.current-run-card {
  order: 4;
}

.work-card,
.results-panel {
  padding: 18px;
}

.card-head,
.results-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.card-corner-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 8px;
}

.corner-reset-button,
.compact-action-button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}

.compact-text {
  max-width: none;
  font-size: 14px;
  line-height: 1.55;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  background: #e7f3dd;
  color: #2f6b22;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.muted-pill {
  background: #f0f2ed;
  color: var(--muted);
}

.mode-tabs {
  display: inline-flex;
  width: fit-content;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.mode-tab {
  min-height: 32px;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: #334155;
  font-size: 14px;
}

.mode-tab:hover,
.mode-tab.active {
  background: #fff;
  color: var(--accent-dark);
  box-shadow: 0 8px 18px rgba(31, 44, 71, 0.08);
}

.upload-mode-pane {
  display: none;
}

.upload-mode-pane.active {
  display: grid;
  gap: 12px;
}

.grading-mode-panel {
  display: grid;
  grid-template-columns: auto repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: #f8fbff;
}

.grading-mode-panel p {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.grading-mode-panel label {
  position: relative;
  min-height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.grading-mode-panel input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.grading-mode-panel span {
  width: 100%;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #cbd7e5;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.grading-mode-panel input:checked + span {
  border-color: var(--accent);
  background: #e9f7f3;
  color: var(--accent-dark);
  box-shadow: 0 8px 18px rgba(31, 122, 109, 0.1);
}

.inline-actions,
.split-actions,
.result-actions,
.history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-actions button,
.result-actions button,
.history-toolbar button {
  padding: 0 14px;
}

.result-more-menu {
  position: relative;
}

.result-more-menu summary {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  background: #f5f7fb;
  color: #31566f;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(31, 44, 71, 0.06);
  list-style: none;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.result-more-menu summary::-webkit-details-marker {
  display: none;
}

.result-more-menu summary:hover {
  background: #e9eef5;
  box-shadow: 0 12px 24px rgba(31, 44, 71, 0.09);
  transform: translateY(-1px);
}

.result-more-content {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  display: grid;
  min-width: 180px;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px rgba(31, 44, 71, 0.16);
}

.result-more-content button {
  width: 100%;
  justify-content: center;
}

.class-overview-panel,
.class-history-panel,
.exam-overview-panel,
.exam-history-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.class-overview-panel[hidden],
.class-history-panel[hidden],
.exam-overview-panel[hidden],
.exam-history-panel[hidden],
.history-filter-panel[hidden] {
  display: none;
}

.class-overview-head,
.class-history-head,
.exam-history-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.exam-history-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.history-inline-status {
  color: #7a4f08;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.emergency-history-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.emergency-history-panel[hidden] {
  display: none;
}

.emergency-history-head,
.emergency-history-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.emergency-history-head > div {
  min-width: min(100%, 360px);
}

.emergency-history-head h3 {
  margin: 0;
  color: #1f2f46;
  font-size: 20px;
}

.emergency-history-tools {
  justify-content: flex-start;
  padding: 12px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: #f8fbff;
}

.emergency-history-tools input[type="search"] {
  flex: 1 1 280px;
  min-height: 38px;
}

.emergency-history-tools button {
  min-height: 36px;
}

.class-overview-head h3,
.class-history-head h3 {
  margin: 0;
  color: #1f2f46;
  font-size: 20px;
}

.class-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.exam-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.class-overview-card,
.exam-overview-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid #d6e1ee;
  border-radius: 8px;
  background: #fff;
  color: #263247;
  text-align: left;
  box-shadow: 0 10px 24px rgba(31, 44, 71, 0.06);
}

.class-overview-card:hover,
.exam-overview-card:hover {
  border-color: var(--accent);
  background: #f7fbfa;
  box-shadow: 0 14px 30px rgba(31, 122, 109, 0.1);
}

.exam-overview-card {
  min-height: 104px;
  border-color: #dbe5ef;
  background: #fbfcfe;
}

.class-card-title,
.exam-card-title {
  color: #18243a;
  font-size: 18px;
  font-weight: 900;
}

.exam-card-title {
  font-size: 17px;
}

.class-card-stats,
.class-card-meta,
.exam-card-stats,
.exam-card-meta {
  color: #5f6f86;
  font-size: 13px;
  line-height: 1.5;
}

.class-card-stats,
.exam-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.class-card-stats strong,
.exam-card-stats strong {
  color: var(--accent-dark);
}

.exam-history-head h4 {
  margin: 0;
  color: #1f2f46;
  font-size: 18px;
}

.history-filter-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 220px)) minmax(240px, 1fr);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dce5f0;
  border-radius: 8px;
  background: #f8fafc;
}

.history-filter-panel label {
  display: grid;
  gap: 6px;
  color: #526177;
  font-size: 13px;
  font-weight: 800;
}

.history-filter-panel select {
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #cbd7e5;
  border-radius: 6px;
  background: #fff;
  color: #263247;
  font: inherit;
}

.upload-card .inline-actions {
  justify-content: flex-end;
}

.upload-card .inline-actions button {
  min-height: 34px;
  padding: 0 10px;
  border-color: #d5dde8;
  background: #fff;
  color: #58677d;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.upload-card .inline-actions .danger-button {
  color: #9b3430;
}

.history-batch-toolbar,
.history-batch-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.history-batch-toolbar {
  margin: 12px 0 10px;
}

.history-batch-controls[hidden] {
  display: none;
}

.history-batch-status {
  color: #667085;
  font-size: 13px;
}

.history-name-cell {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-height: 22px;
}

.history-name-text {
  min-width: 0;
}

.history-select-box {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
  cursor: pointer;
}

.history-select-box input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.history-select-box span {
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 1px solid #b8c4d6;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 5px 12px rgba(31, 44, 71, 0.08);
}

.history-select-box input:checked + span {
  border-color: var(--accent);
  background: var(--accent);
}

.history-select-box input:checked + span::after {
  content: "✓";
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.page-scroll-controls {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: flex;
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(215, 221, 231, 0.86);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 34px rgba(31, 44, 71, 0.14);
  backdrop-filter: blur(10px);
}

.page-scroll-controls[hidden] {
  display: none;
}

.page-scroll-controls button {
  width: 38px;
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #d7e0ed;
  border-radius: 50%;
  background: #fff;
  color: #17202a;
  box-shadow: none;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.page-scroll-controls button:hover {
  background: #edf4ff;
  box-shadow: 0 10px 22px rgba(31, 44, 71, 0.1);
}

.page-scroll-controls button:disabled {
  color: #aab4c4;
  background: #f4f7fb;
  cursor: not-allowed;
  opacity: 0.72;
}

.large-picker {
  min-height: 104px;
}

.user-session-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  margin-top: 12px;
  color: #475467;
  font-size: 14px;
}

.user-session-bar form {
  margin: 0;
}

.admin-entry-button {
  min-height: 36px;
  padding: 0 14px;
  text-decoration: none;
}

.admin-home-page {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 18px;
}

.admin-home-header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.admin-home-title {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  letter-spacing: 0;
}

.admin-home-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  color: #475467;
  font-size: 14px;
}

.admin-home-meta form {
  margin: 0;
}

.admin-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-home-entry {
  min-height: 260px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.admin-home-entry:hover {
  transform: translateY(-2px);
  border-color: #9cc9ff;
  box-shadow: var(--shadow-lift);
}

.admin-home-entry h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.admin-home-entry p {
  margin: 0;
  color: #667085;
  line-height: 1.65;
}

.admin-home-action {
  display: inline-flex;
  width: fit-content;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 6px;
  background: #1f7a6d;
  color: #fff;
  font-weight: 800;
  box-shadow: var(--shadow-button);
}

.admin-home-entry.secondary-entry .admin-home-action {
  background: #1f5fbd;
  box-shadow: 0 9px 20px rgba(31, 95, 189, 0.14);
}

.grade-setting-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  color: #475467;
  font-size: 14px;
}

.grade-chooser-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
}

.grade-chooser-panel {
  width: min(420px, 100%);
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 28px 72px rgba(31, 44, 71, 0.16);
}

.grade-chooser-panel h2 {
  margin: 0 0 8px;
}

.grade-choice-grid,
.segmented-options,
.unit-option-grid {
  display: grid;
  gap: 8px;
}

.grade-choice-grid {
  grid-template-columns: repeat(3, 1fr);
}

.grade-choice-grid button,
.segmented-options button,
.unit-option-grid button,
.answer-selected-button {
  min-height: 42px;
  border: 1px solid #cfd6e4;
  border-radius: 6px;
  background: #fff;
  color: #26364f;
  font-weight: 700;
  cursor: pointer;
}

.segmented-options {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.unit-option-grid {
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
}

.answer-unit-scroll .unit-option-grid {
  grid-template-columns: 1fr;
}

.segmented-options button.active,
.unit-option-grid button.active,
.grade-choice-grid button:hover {
  border-color: var(--accent);
  background: #eaf6f3;
  color: var(--accent-dark);
}

.unit-option-grid button[disabled] {
  cursor: not-allowed;
  background: #f2f4f7;
  color: #98a2b3;
}

.answer-selected-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 0 12px;
  text-align: left;
}

.answer-selected-button.open {
  border-color: var(--accent);
  background: #eef8f5;
}

.answer-select-panel {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  overflow: hidden;
}

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

.answer-select-fields label {
  display: grid;
  gap: 8px;
  color: #253247;
  font-weight: 800;
}

.answer-select-fields select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cfd6e4;
  border-radius: 8px;
  background: #fff;
  color: #1d2939;
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  padding: 0 40px 0 12px;
}

.answer-select-fields select:focus {
  outline: 2px solid rgba(31, 122, 109, 0.18);
  border-color: var(--accent);
}

.answer-select-fields select:disabled {
  background: #f2f4f7;
  color: #98a2b3;
}

.answer-select-scroll {
  display: grid;
  gap: 14px;
  min-height: 0;
  padding-right: 4px;
  overflow: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.answer-unit-scroll {
  max-height: min(260px, 36vh);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 2px 4px 2px 0;
  scrollbar-width: thin;
}

.answer-unit-scroll::-webkit-scrollbar {
  width: 8px;
}

.answer-unit-scroll::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cbd5e1;
}

.answer-unit-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.answer-unit-scroll .unit-option-grid button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 40px;
  padding: 0 12px;
  text-align: left;
}

.answer-select-step {
  display: grid;
  gap: 8px;
}

.answer-select-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #dde5ef;
  background: #f8fafc;
}

.admin-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
  padding: 18px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
}

.admin-table-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #172033;
}

.admin-output {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #b7d8ff;
  border-radius: 6px;
  background: #edf6ff;
  color: #123a6f;
  font-weight: 700;
}

.admin-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.admin-action-row button {
  padding: 0 10px;
  min-height: 30px;
}

.admin-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-stat-card,
.admin-chart-card,
.admin-table-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
  padding: 12px;
}

.admin-stat-card {
  display: grid;
  gap: 6px;
}

.admin-stat-card span,
.admin-muted-line,
.admin-updated-at {
  color: var(--muted);
  font-size: 13px;
}

.admin-stat-card strong {
  color: #182230;
  font-size: 22px;
}

.admin-updated-at {
  margin: -4px 0 0;
}

.admin-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-chart-card {
  min-width: 0;
}

.admin-chart-card h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.admin-chart-card canvas {
  width: 100%;
  height: 220px;
  display: block;
}

.admin-chart-card.wide-chart {
  grid-column: 1 / -1;
}

.admin-chart-card.wide-chart canvas {
  height: 240px;
}

.admin-muted-line {
  margin: 8px 0 0;
}

.admin-detail-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.upload-source-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.file-picker span {
  display: grid;
  gap: 4px;
  text-align: center;
}

.file-picker small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 400;
}

.pair-mode {
  padding-top: 2px;
}

.pair-topline {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.wide-button {
  width: 100%;
}

.answer-preview-box,
.ready-checklist {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #f3f2ea;
}

.answer-preview-box span {
  color: var(--muted);
  font-size: 13px;
}

.answer-preview-box .status {
  max-height: 112px;
  overflow: auto;
  color: #39465a;
  line-height: 1.6;
}

.answer-parse-details {
  display: grid;
  gap: 8px;
}

.answer-parse-details summary {
  cursor: pointer;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
}

.answer-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 6px;
}

.answer-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 8px;
  border: 1px solid #d9e5d0;
  border-radius: 5px;
  background: #eef8e8;
  color: #2f6b22;
  font-size: 13px;
  font-weight: 700;
}

.answer-chip.missing {
  border-color: #f0aaa6;
  background: #fff1f0;
  color: #9f1f1f;
}

.answer-source-preview {
  max-height: 150px;
  overflow: auto;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #39465a;
  white-space: pre-wrap;
  font: 12px/1.5 Consolas, "Microsoft YaHei", Arial, sans-serif;
}

.ready-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.ready-stats div {
  display: grid;
  place-items: center;
  min-height: 74px;
  border-radius: 8px;
  background: #f3f2ea;
}

.ready-stats strong {
  color: #1f6f2c;
  font-size: 26px;
}

.ready-stats span,
.ready-checklist span {
  color: var(--muted);
  font-size: 13px;
}

.ready-checklist span::before {
  content: "○";
  margin-right: 6px;
  color: var(--muted);
}

.ready-checklist span.ready::before {
  content: "✓";
  color: #3b8132;
}

.grading-progress {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #c9d9e8;
  border-radius: 8px;
  background: #f8fbff;
}

.grading-progress[hidden] {
  display: none;
}

.grading-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #18324a;
  font-size: 14px;
}

.grading-progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce8f3;
}

.grading-progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2f7dd3, #2a8f7a);
  transition: width 0.35s ease;
}

.grading-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.grading-progress.success {
  border-color: #add4b3;
  background: #f3fbf3;
}

.grading-progress.success .grading-progress-bar {
  background: #3b8132;
}

.grading-progress.error {
  border-color: #efb3ae;
  background: #fff7f5;
}

.grading-progress.error .grading-progress-bar {
  background: #c43c30;
}

.start-button {
  width: 100%;
}

a.start-button {
  width: fit-content;
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  box-shadow: var(--shadow-button);
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

a.start-button:hover {
  background: var(--accent-dark);
  box-shadow: 0 12px 24px rgba(21, 93, 83, 0.16);
  transform: translateY(-1px);
}

.teacher-topbar .teacher-bell-button:hover {
  background: #fff;
  color: #2466ff;
  border-color: #dbe6ff;
  box-shadow: 0 12px 24px rgba(31, 44, 71, 0.09);
  transform: translateY(-1px);
}

.upload-start-button {
  margin-top: 2px;
}

.upload-action-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.upload-action-grid .start-button {
  width: 100%;
}

.objective-only-button,
.subjective-only-button {
  min-height: 42px;
  padding: 0 18px;
  white-space: nowrap;
}

.objective-only-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.pairing-build-progress {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid #d8d6cc;
  border-radius: 8px;
  background: #faf8f2;
}

.pairing-build-progress[hidden] {
  display: none;
}

.pairing-build-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #222831;
  font-size: 13px;
}

.pairing-build-progress-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #d8d6cc;
}

.pairing-build-progress-track div {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #17a36f;
  transition: width 0.2s ease;
}

.pairing-build-progress p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pairing-build-progress.success {
  border-color: #95c8ae;
  background: #f2fbf6;
}

.pairing-build-progress.error {
  border-color: #f07171;
  background: #fff7f7;
}

.results-panel {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.current-result-panel {
  display: grid;
}

.current-result-panel[hidden] {
  display: none;
}

.history-toolbar input[type="search"] {
  flex: 1;
  min-width: 240px;
}

.upload-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding: 30px;
}

.pair-panel {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding: 22px 30px;
}

.product-header {
  display: grid;
  justify-items: center;
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 4vw, 46px);
  line-height: 1.12;
}

.brand-title {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  display: inline-block;
  width: auto;
  max-width: min(210px, 42vw);
  height: clamp(28px, 3.4vw, 40px);
  object-fit: contain;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

.subtext {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.version-badge {
  display: inline-flex;
  margin: 14px 0 0;
  padding: 7px 10px;
  border: 1px solid #b7d6cf;
  border-radius: 6px;
  background: #edf8f5;
  color: #155d53;
  font-size: 13px;
  font-weight: 700;
}

.upload-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.upload-box.upload-mode-pane:not(.active),
.upload-mode-pane[hidden] {
  display: none;
}

.upload-box .preview,
.upload-box button,
.upload-box .selected-files-info,
.upload-box .status {
  grid-column: auto;
}

.answer-panel {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 430px);
  gap: 24px;
  align-items: center;
  margin-top: 20px;
  padding: 22px 30px;
}

.answer-form {
  display: grid;
  gap: 12px;
}

.answer-form.split-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: stretch;
}

.answer-form.split-actions .status {
  grid-column: 1 / -1;
}

.roster-card .answer-form.split-actions {
  grid-template-columns: minmax(0, 1fr);
}

.answer-settings-card {
  gap: 18px;
  min-width: 0;
  overflow: hidden;
}

.answer-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.answer-settings-head h2 {
  margin: 0;
  font-size: 18px;
}

.answer-summary-card {
  padding: 0;
  border: 0;
  min-width: 0;
  width: 100%;
}

.answer-summary-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 8px;
  background: #f3f2ea;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  list-style: none;
  cursor: pointer;
}

.answer-summary-card summary::-webkit-details-marker {
  display: none;
}

.answer-current-state {
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 8px;
  color: #1d2d3d;
  font-size: 14px;
}

.answer-current-state span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.answer-state-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #aeb8c5;
}

.answer-state-dot.uploaded {
  background: #2563eb;
}

.answer-view-link {
  flex: 0 0 auto;
  color: #1f5fbd;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.answer-inline-status {
  margin: 10px 0 0;
  color: #516174;
  font-size: 13px;
  line-height: 1.55;
}

.answer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.answer-upload-entry {
  position: relative;
  margin-top: -4px;
}

.answer-upload-entry > .corner-reset-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
}

.answer-upload-entry[open] .answer-view-link {
  color: #0f766e;
}

.answer-upload-form {
  margin-top: 12px;
  padding: 42px 14px 14px;
  border: 1px solid #e4ebf3;
  border-radius: 8px;
  background: #fbfcff;
  box-shadow: 0 10px 28px rgba(31, 55, 84, 0.07);
}

.answer-upload-entry summary[hidden] + .answer-upload-form {
  margin-top: 0;
}

.answer-upload-form .answer-inline-status {
  grid-column: 1 / -1;
  margin: 0;
}

.answer-operation-label {
  grid-column: 1 / -1;
  margin: 0;
  color: #56667a;
  font-size: 13px;
}

.answer-upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  justify-self: start;
  min-width: min(100%, 320px);
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid #aab6c5;
  border-radius: 8px;
  background: #fff;
  color: #1d2d3d;
  font-weight: 800;
  cursor: pointer;
}

.answer-upload-button input {
  display: none;
}

.answer-upload-button:hover {
  background: #f6f8fb;
}

.file-picker.upload-drag-over,
.answer-upload-button.upload-drag-over,
.pair-upload-actions label.upload-drag-over {
  border-color: var(--accent);
  background: #eaf7f4;
  color: var(--accent-dark);
  box-shadow: 0 0 0 3px rgba(31, 122, 109, 0.12);
}

.answer-upload-button.is-loading {
  cursor: wait;
  opacity: 0.7;
}

.answer-upload-icon {
  font-size: 16px;
  line-height: 1;
}

.answer-reset-button {
  min-height: 38px;
}

.answer-save-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  grid-column: 1 / -1;
  min-height: 22px;
  color: #4e5d70;
  font-size: 14px;
  font-weight: 500;
}

.answer-save-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.answer-meta {
  margin: 12px 0 0;
  color: #31566f;
  font-weight: 700;
}

.file-picker {
  display: grid;
  min-height: 112px;
  place-items: center;
  border: 2px dashed #9eb5c9;
  border-radius: 8px;
  background: var(--soft);
  color: #31566f;
  font-weight: 700;
  cursor: pointer;
}

.compact-picker {
  min-height: 70px;
}

.file-picker input {
  display: none;
}

.file-picker.disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.preview {
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.selected-files-info {
  max-height: 220px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  color: #31566f;
  font-size: 14px;
  line-height: 1.6;
}

.selected-files-summary {
  margin-bottom: 8px;
  color: var(--muted);
}

.selected-file-list {
  display: grid;
  gap: 8px;
}

.selected-file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 8px;
  border: 1px solid #e1e7f0;
  border-radius: 6px;
  background: #fff;
}

.selected-file-check {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: #31566f;
  font-weight: 700;
}

.selected-file-name {
  display: grid;
  min-width: 0;
  color: var(--ink);
}

.selected-file-name strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-name span {
  color: var(--muted);
  font-size: 12px;
}

.selected-file-remove {
  grid-column: auto;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #f0b6b6;
  background: #fff3f3;
  color: #9f1f1f;
  font-size: 13px;
}

.selected-file-remove:hover {
  background: #ffe5e5;
}

.pair-counter {
  color: var(--muted);
  font-size: 14px;
}

.pair-list {
  display: grid;
  gap: 12px;
}

.pair-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.pair-row-title {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-weight: 700;
}

.pair-delete {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #f0b6b6;
  background: #fff3f3;
  color: #9f1f1f;
  font-size: 13px;
}

.pair-card-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: center;
}

.pair-upload-box {
  display: grid;
  gap: 10px;
  min-height: 112px;
  padding: 12px;
  border: 1px dashed #b6c2d0;
  border-radius: 8px;
  background: #fbfcfe;
  color: #31566f;
  text-align: center;
}

.pair-upload-box input {
  display: none;
}

.pair-upload-box.uploaded {
  border-color: #69a549;
  background: #edf7e5;
  color: #2f6b22;
}

.pair-upload-box strong,
.pair-upload-box small {
  display: block;
}

.pair-upload-state {
  display: grid;
  gap: 4px;
  place-items: center;
}

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

.pair-upload-actions label {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px solid #c9d7e8;
  border-radius: 6px;
  background: #fff;
  color: #31566f;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.pair-upload-actions label:hover {
  background: #eef4fb;
}

.pair-link {
  color: var(--muted);
  font-size: 22px;
}

.pair-help {
  color: var(--muted);
  font-size: 13px;
}

.pairing-confirm-panel {
  display: grid;
  gap: 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.pairing-confirm-panel[hidden] {
  display: none;
}

.pairing-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.pairing-stat {
  display: grid;
  gap: 6px;
  min-height: 70px;
  padding: 13px 14px;
  border-radius: 8px;
  background: #faf8f2;
}

.pairing-stat span {
  color: #353b42;
  font-size: 13px;
}

.pairing-stat strong {
  font-size: 24px;
  line-height: 1;
}

.pairing-stat.neutral strong {
  color: #111827;
}

.pairing-stat.success strong {
  color: #10825f;
}

.pairing-stat.warning strong {
  color: #9a5c00;
}

.pairing-stat.danger strong {
  color: #d83a35;
}

.pairing-progress-card,
.pairing-action-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 0;
  border-radius: 8px;
  background: #faf8f2;
}

.pairing-progress-card[hidden] {
  display: none;
}

.pairing-action-panel {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.pairing-progress-head,
.pairing-progress-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #222831;
  font-size: 13px;
}

.pairing-progress-head strong {
  font-size: 14px;
}

.pairing-progress-track {
  position: relative;
  display: flex;
  height: 14px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 999px;
  border: 1px solid #cbc8be;
  background: #d8d6cc;
}

.pairing-progress-track div {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: inherit;
  background: #17a36f;
}

.pairing-action-panel[hidden] {
  display: none;
}

.pairing-skip-option {
  display: flex;
  gap: 10px;
  align-items: center;
  color: #1f2933;
  font-weight: 500;
}

.pairing-skip-option input {
  width: 16px;
  height: 16px;
}

.pairing-action-panel > span,
.pairing-action-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.pairing-action-panel .start-button,
.pairing-action-hint {
  grid-column: 1 / -1;
}

.pairing-action-hint {
  text-align: center;
}

.start-button:disabled {
  border: 1px solid #b9b9b9;
  background: #fff;
  color: #1f2933;
  cursor: not-allowed;
  opacity: 1;
}

.start-button.ready-to-grade {
  border: 0;
  background: #169b6b;
  color: #fff;
}

.start-button.ready-to-grade:hover {
  background: #0d7b55;
}

.pairing-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
}

.pairing-summary-grid span,
.pairing-page {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dfe7f0;
  border-radius: 6px;
  background: #fff;
}

.pairing-summary-grid strong {
  color: var(--accent-dark);
  font-size: 20px;
}

.pairing-list,
.pairing-row {
  display: grid;
  gap: 10px;
}

.pairing-group {
  display: grid;
  gap: 10px;
}

.pairing-group h3 {
  margin: 0;
  color: #27313b;
  font-size: 14px;
  font-weight: 600;
}

.pairing-group-list {
  display: grid;
  gap: 10px;
}

.pairing-row {
  padding: 12px 14px;
  border: 1px solid #d9d9d9;
  border-radius: 8px;
  background: #fff;
}

.pairing-row.ready {
  border-color: #d9d9d9;
  background: #fff;
}

.pairing-row.warning {
  border-color: #f49a28;
  background: #fffaf3;
}

.pairing-row.danger,
.batch-pending {
  border-color: #f07171;
  background: #fff7f7;
}

.pairing-row-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.pairing-row-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pairing-student-title {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.pairing-student-title strong {
  color: #111827;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pairing-avatar {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #dff4ee;
  color: #0b7c63;
  font-weight: 800;
}

.pairing-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: #dff4ee;
  color: #0b7c63;
  font-size: 12px;
}

.pairing-row-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #374151;
  white-space: nowrap;
}

.pairing-row.warning .pairing-avatar,
.pairing-row.warning .pairing-chip {
  background: #fff1dd;
  color: #a45705;
}

.pairing-row.danger .pairing-avatar,
.pairing-row.danger .pairing-chip {
  background: #ffe1e1;
  color: #bf2525;
}

.pairing-pages {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pairing-view-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.pairing-view-button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 1px solid #bfc7d1;
  border-radius: 6px;
  color: #111827;
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.pairing-view-button.secondary {
  color: #1f5fbd;
}

.pairing-page {
  min-height: 68px;
}

.pairing-page span,
.pairing-page small,
.pairing-failed {
  color: var(--muted);
  font-size: 12px;
}

.pairing-page b {
  color: #00836a;
}

.pairing-more {
  margin: 0;
  color: #555;
  font-size: 13px;
  text-align: center;
}

.pairing-page.missing {
  border-color: #efbbb5;
  background: #fff7f5;
  color: #9f1f1f;
}

.pairing-page.warning {
  border-color: #f49a28;
  background: #fffaf3;
}

.pairing-page.danger {
  border-color: #f07171;
  background: #fff7f7;
}

.pairing-page a {
  color: #1f5fbd;
  font-size: 13px;
  font-weight: 700;
}

.pairing-failed {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #efbbb5;
  border-radius: 8px;
  background: #fff7f5;
}

.pair-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-button);
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: 0 12px 24px rgba(21, 93, 83, 0.16);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.7;
  box-shadow: none;
  transform: none;
}

.status {
  margin: 0;
  color: var(--muted);
  min-height: 22px;
}

.score-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(520px, 1.4fr);
  gap: 20px;
  margin-top: 20px;
}

.result-panel,
.score-grid > .panel {
  padding: 22px;
}

.section-title {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-title button,
.query button {
  padding: 0 14px;
  min-height: 36px;
}

.query {
  display: flex;
  gap: 8px;
}

input[type="search"] {
  width: 170px;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.empty {
  padding: 28px 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.score-card {
  display: grid;
  gap: 14px;
}

.batch-result {
  display: grid;
  gap: 14px;
}

.batch-summary {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.batch-list {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
}

.batch-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(31, 44, 71, 0.05);
}

.batch-score {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--muted);
}

.batch-error {
  border-color: #f1b7b7;
  background: #fff3f3;
  color: #8f1f1f;
}

.batch-detail {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.batch-detail summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.batch-detail .detail-list {
  margin-top: 10px;
}

.student-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  color: var(--muted);
}

.score-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.score-number {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(31, 44, 71, 0.05);
}

.score-number strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 26px;
}

.feedback {
  margin: 0;
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: #eef8f5;
  color: #25453f;
  line-height: 1.6;
}

.debug-link {
  display: inline-flex;
  width: fit-content;
  padding: 8px 10px;
  border-radius: 6px;
  background: #ecf4ff;
  color: #1d4f8f;
  font-weight: 700;
  text-decoration: none;
}

.subjective-panel {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding: 22px 30px;
}

.subjective-panel[hidden] {
  display: none;
}

.subjective-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.subjective-editor label {
  display: grid;
  gap: 7px;
  color: #31566f;
  font-weight: 700;
}

.subjective-editor textarea {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  color: var(--ink);
  font: 15px/1.55 Consolas, "Microsoft YaHei", Arial, sans-serif;
}

.subjective-editor textarea:focus {
  outline: 2px solid #b7d6cf;
  border-color: var(--accent);
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.candidate-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px dashed #b7c7da;
  border-radius: 8px;
  background: #f7fbff;
}

.candidate-panel[hidden] {
  display: none;
}

.candidate-panel h3,
.candidate-panel p {
  margin: 0;
}

.candidate-panel section {
  display: grid;
  gap: 6px;
}

.candidate-panel pre {
  overflow: auto;
  max-height: 160px;
  margin: 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  white-space: pre-wrap;
  font: 13px/1.5 Consolas, "Microsoft YaHei", Arial, sans-serif;
}

.candidate-copy {
  justify-self: start;
  min-height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.ocr-error {
  padding: 10px;
  border: 1px solid #f0b6b6;
  border-radius: 6px;
  background: #fff3f3;
  color: #8f1f1f;
}

.ocr-error ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.debug-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.review-actions button {
  padding: 0 18px;
}

.secondary-button {
  border: 1px solid var(--line-soft);
  background: #f5f7fb;
  color: #31566f;
  box-shadow: 0 8px 18px rgba(31, 44, 71, 0.06);
}

a.secondary-button,
a.danger-button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  text-decoration: none;
}

.secondary-button:hover {
  background: #e9eef5;
  box-shadow: 0 12px 24px rgba(31, 44, 71, 0.09);
}

.history-detail-button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid #b7d6cf;
  background: #edf8f5;
  color: var(--accent-dark);
  font-size: 13px;
}

.history-detail-button:hover {
  background: #d9eee9;
}

.danger-button {
  border: 1px solid #f0b6b6;
  background: #fff3f3;
  color: #9f1f1f;
  box-shadow: 0 8px 18px rgba(159, 31, 31, 0.08);
}

.danger-button:hover {
  background: #ffe5e5;
  box-shadow: 0 12px 24px rgba(159, 31, 31, 0.12);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop[hidden] {
  display: none;
}

.history-modal {
  width: min(1100px, 96vw);
  max-height: 88vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 34px 88px rgba(31, 44, 71, 0.18);
}

.modal-title-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pdf-download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 700;
  text-decoration: none;
}

.pdf-download-button[hidden] {
  display: none;
}

.modal-title-row h2 {
  margin: 0;
}

#historyDetailContent {
  display: grid;
  gap: 14px;
}

body.modal-open {
  overflow: hidden;
}

.report-header {
  display: grid;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.report-topbar,
.detail-nav,
.report-identity,
.report-stat-row {
  display: flex;
  align-items: center;
}

.report-topbar {
  justify-content: space-between;
}

.detail-back-button {
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 500;
}

.detail-back-button:hover {
  background: transparent;
  color: var(--accent-dark);
}

.detail-nav {
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.detail-nav button {
  width: 34px;
  min-height: 30px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.report-identity {
  gap: 14px;
}

.student-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4f8f;
  font-weight: 700;
}

.student-profile {
  min-width: 0;
  flex: 1;
}

.student-profile h2 {
  margin: 0 0 4px;
}

.student-profile p,
.report-total span,
.report-stat-row span,
.report-stat-row small {
  margin: 0;
  color: var(--muted);
}

.report-total {
  display: grid;
  justify-items: end;
}

.report-total strong {
  color: #111827;
  font-size: 44px;
  line-height: 1;
}

.report-stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.report-section-stat-row {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.report-stat-row div {
  display: grid;
  gap: 2px;
  padding: 12px;
  border-radius: 8px;
  background: #f5f4ed;
}

.report-stat-row strong {
  color: #111827;
  font-size: 20px;
}

.subjective-report {
  display: grid;
  gap: 16px;
}

.subjective-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.subjective-section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7f6ef;
}

.subjective-section-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}

.subjective-section-head span,
.question-range-label,
.reference-line {
  color: var(--muted);
  font-size: 13px;
}

.subjective-section-tools {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  justify-content: flex-end;
}

.subjective-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.subjective-review-actions small {
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.subjective-review-button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid #b7d6cf;
  border-radius: 6px;
  background: #fff;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.subjective-review-button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.subjective-review-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.subjective-review-backdrop {
  z-index: 96;
}

.subjective-review-modal {
  width: min(1180px, 96vw);
  max-height: 92vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 34px 88px rgba(31, 44, 71, 0.2);
}

.subjective-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.subjective-review-pane {
  display: grid;
  min-width: 0;
  align-content: start;
  background: #fff;
}

.subjective-review-pane + .subjective-review-pane {
  border-left: 1px solid var(--line);
}

.subjective-review-pane-head {
  display: flex;
  min-height: 52px;
  padding: 8px 12px;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: #f7f6ef;
}

.subjective-review-pane h3 {
  margin: 0;
  font-size: 15px;
}

.subjective-image-link {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.subjective-review-image-stage {
  display: grid;
  min-height: 425px;
  place-items: center;
  overflow: auto;
  padding: 12px;
  background: #f1f3f5;
}

.subjective-review-image-stage img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.subjective-review-editor {
  gap: 10px;
  padding: 14px;
}

.subjective-review-editor label {
  color: var(--ink);
  font-weight: 800;
}

#subjectiveReviewText {
  width: 100%;
  min-height: 330px;
  resize: vertical;
  padding: 12px;
  border: 1px solid #9fb0c3;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-family: Consolas, "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.7;
}

#subjectiveReviewText:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(31, 122, 109, 0.12);
}

.subjective-original-ocr {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.subjective-original-ocr summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.subjective-original-ocr pre {
  max-height: 150px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: #f5f7fb;
  white-space: pre-wrap;
  word-break: break-word;
}

.subjective-review-status {
  min-height: 24px;
  margin: 10px 0 0;
}

.subjective-review-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

.subjective-review-footer button {
  min-height: 40px;
  padding: 0 16px;
}

.subjective-table-wrap {
  overflow-x: auto;
}

.subjective-table th,
.subjective-table td {
  padding: 9px 12px;
}

.subjective-table th {
  background: #fbfaf4;
}

.grade-badge,
.score-note {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 700;
}

.grade-badge.good,
.score-note.good {
  background: #e8f5dd;
  color: #2f7d22;
}

.grade-badge.bad,
.score-note.bad {
  background: #fdeaea;
  color: #b42318;
}

.grade-badge.partial,
.score-note.partial {
  background: #fff3d8;
  color: #8a5a00;
}

.grade-badge.unknown,
.score-note.unknown {
  background: #eef2f7;
  color: var(--muted);
}

.task-reading-list {
  display: grid;
}

.task-reading-row {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.task-reading-row:last-child {
  border-bottom: 0;
}

.task-answer-line {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
}

.question-range-label {
  margin: 12px 14px 4px;
  font-weight: 700;
}

.writing-section {
  display: grid;
}

.writing-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.writing-meta {
  margin: 10px 14px 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fbfaf4;
  color: #374151;
  font-size: 13px;
  font-weight: 700;
}

.writing-meta.warning {
  border-color: #f9c2c2;
  background: #fff1f1;
  color: #b42318;
}

.writing-legend span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 2px;
  vertical-align: 1px;
}

.legend-grammar::before {
  background: #ef4444;
}

.legend-word::before {
  background: #f59e0b;
}

.legend-logic::before {
  background: #6366f1;
}

.writing-paper {
  padding: 14px;
  color: #111827;
  font-size: 15px;
  line-height: 1.8;
}

.writing-paper mark {
  padding: 0 2px;
  border-radius: 3px;
}

.issue-grammar {
  background: #ffe5e5;
  color: #b42318;
  text-decoration: underline;
  text-decoration-color: #ef4444;
}

.issue-word {
  background: #fff2d8;
  color: #92400e;
  text-decoration: underline;
  text-decoration-color: #f59e0b;
}

.issue-logic {
  background: #e9eaff;
  color: #3730a3;
  text-decoration: underline;
  text-decoration-color: #6366f1;
}

.writing-dimensions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 14px 12px;
}

.writing-dimensions div {
  display: grid;
  place-items: center;
  min-height: 68px;
  border-radius: 8px;
  background: #f5f4ed;
}

.writing-dimensions span,
.writing-dimensions small {
  color: var(--muted);
  font-size: 13px;
}

.writing-dimensions strong {
  color: #111827;
  font-size: 20px;
}

.ai-feedback-box {
  display: grid;
  gap: 8px;
  margin: 0 14px 14px;
  padding: 12px;
  border-radius: 8px;
  background: #f5f4ed;
  line-height: 1.7;
}

.ai-feedback-box p,
.writing-deduction-list {
  margin: 0;
}

.writing-deduction-list {
  padding-left: 18px;
}

.ai-feedback-table-card {
  display: grid;
  gap: 8px;
  margin: 0 14px 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}

.ai-feedback-title {
  padding: 10px 12px 0;
  color: #111827;
  font-weight: 700;
}

.ai-feedback-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ai-feedback-table {
  width: max(100%, 960px);
  min-width: 960px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 13px;
  line-height: 1.55;
}

.ai-feedback-table th,
.ai-feedback-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ai-feedback-table th {
  background: #f3f2ea;
  color: #4b5563;
  font-weight: 600;
}

.ai-feedback-table th:nth-child(1),
.ai-feedback-table td:nth-child(1) {
  width: 150px;
  min-width: 150px;
}

.ai-feedback-table th:nth-child(2),
.ai-feedback-table td:nth-child(2) {
  width: 74px;
  min-width: 74px;
  color: #d12b20;
  font-weight: 700;
  white-space: nowrap;
}

.ai-feedback-table th:nth-child(3),
.ai-feedback-table td:nth-child(3) {
  width: 92px;
  min-width: 92px;
}

.ai-feedback-table th:nth-child(4),
.ai-feedback-table td:nth-child(4),
.ai-feedback-table th:nth-child(5),
.ai-feedback-table td:nth-child(5) {
  min-width: 300px;
}

.ai-feedback-group-row {
  background: #fffdfa;
}

.ai-feedback-group-row td {
  font-weight: 600;
}

.ai-feedback-group-row td:first-child,
.ai-feedback-issue-row td:first-child {
  white-space: nowrap;
}

.ai-feedback-issue-row {
  background: #fff;
}

.ai-feedback-issue-row td:first-child {
  padding-left: 22px;
  color: #4b5563;
}

.feedback-toggle {
  display: inline-grid;
  width: 16px;
  height: 16px;
  min-width: 16px;
  place-items: center;
  margin-right: 6px;
  border: 1px solid #c8c6bc;
  border-radius: 4px;
  color: #8a8172;
  font-size: 11px;
}

.feedback-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.feedback-dot.high {
  background: #c43c30;
}

.feedback-dot.medium {
  background: #d39124;
}

.feedback-dot.low {
  background: #3b8132;
}

.issue-index {
  display: inline-grid;
  width: 18px;
  height: 18px;
  min-width: 18px;
  place-items: center;
  margin-right: 8px;
  border: 1px solid #c8c6bc;
  border-radius: 50%;
  color: #6b7280;
  font-size: 12px;
}

.severity-badge {
  display: inline-flex;
  min-width: 24px;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
}

.severity-badge.high {
  background: #ffe4e6;
  color: #c01821;
}

.severity-badge.medium {
  background: #fff1d6;
  color: #9a5a00;
}

.severity-badge.low {
  background: #e6f4e8;
  color: #256b2f;
}

.ai-feedback-summary {
  margin: 0;
  padding: 0 12px 12px;
  color: #4b5563;
  line-height: 1.7;
}

.formatted-feedback {
  white-space: pre-wrap;
}

.subjective-review-button.teacher-review {
  border-color: #b7791f;
  background: #fff8e8;
  color: #8a5700;
}

.subjective-manual-score-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #e2b45b;
  border-radius: 10px;
  background: #fffaf0;
}

.subjective-manual-score-panel[hidden] {
  display: none !important;
}

.subjective-manual-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.subjective-manual-head h3,
.subjective-manual-head p {
  margin: 0;
}

.subjective-manual-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.subjective-manual-head > strong {
  flex: 0 0 auto;
  color: #8a5700;
  font-size: 20px;
}

.manual-task-grid,
.manual-writing-grid {
  display: grid;
  gap: 10px;
}

.manual-task-row,
.manual-writing-row {
  display: grid !important;
  grid-template-columns: 78px 38px 110px minmax(180px, 1fr);
  align-items: center;
  gap: 8px !important;
  margin: 0 !important;
}

.manual-task-row input,
.manual-writing-row textarea,
.subjective-manual-feedback {
  width: 100%;
}

.manual-writing-row textarea {
  min-height: 62px;
  resize: vertical;
}

.manual-score-adjusted {
  padding: 6px 8px;
  border-radius: 8px;
  background: #fff7e0;
  outline: 1px solid #f0c75e;
}

.manual-score-hint {
  grid-column: 1 / -1;
  color: #8a5700;
  font-size: 12px;
  line-height: 1.5;
}

.manual-score-ack {
  display: flex !important;
  align-items: flex-start;
  gap: 8px !important;
  margin: 12px 0 0 !important;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7e0;
  color: #6b4400;
  font-size: 13px;
  line-height: 1.6;
}

.manual-score-ack input {
  flex: 0 0 auto;
  width: auto;
  margin-top: 4px;
}

.subjective-manual-feedback {
  min-height: 120px;
  resize: vertical;
}

.writing-dimension-comment {
  grid-column: 1 / -1;
  margin: 6px 0 0;
  color: #5d6470;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.subjective-result {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.subjective-result summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.subjective-text-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.subjective-text-grid section {
  display: grid;
  gap: 6px;
}

.subjective-text-grid pre {
  overflow: auto;
  max-height: 220px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  white-space: pre-wrap;
  font: 14px/1.55 Consolas, "Microsoft YaHei", Arial, sans-serif;
}

.deduction-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d7c7a5;
  border-radius: 8px;
  background: #fffaf1;
}

.compact-title {
  margin-bottom: 0;
}

.deduction-block {
  display: grid;
  gap: 8px;
}

.deduction-block h3 {
  margin: 0;
  color: #7a4b00;
  font-size: 16px;
}

.deduction-block ul {
  margin: 0;
  padding-left: 20px;
  line-height: 1.7;
}

.deduction-list {
  display: grid;
  gap: 8px;
}

.deduction-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid #ead9b8;
  border-radius: 6px;
  background: #fff;
}

.deduction-item p {
  margin: 0;
  color: #39465a;
  line-height: 1.6;
}

.deduction-score {
  color: #9a5b00;
  font-weight: 700;
}

.objective-groups {
  display: grid;
  gap: 14px;
}

.objective-group {
  display: grid;
  gap: 10px;
}

.objective-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0 6px;
  border-bottom: 1px solid #d8e1ec;
}

.objective-group-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}

.objective-group-head span,
.objective-subhead span {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.objective-subsection {
  display: grid;
  gap: 8px;
}

.objective-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: #334155;
  font-size: 14px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  display: grid;
  gap: 4px;
  min-height: 76px;
  padding: 8px;
  border: 1px solid #dfe5ee;
  border-radius: 6px;
  background: #f7f8fa;
  color: var(--muted);
  font-size: 13px;
}

.detail-list .correct {
  border-color: #9ed2ae;
  background: #eef9f0;
  color: #196b35;
}

.detail-list .wrong {
  border-color: #f0aaa6;
  color: #9f1f1f;
  background: #fff1f0;
}

.detail-list .missing-answer {
  border-color: #edbf7c;
  color: #8f1f1f;
  background: #fff7e8;
}

.detail-list .correct strong,
.detail-list .wrong strong,
.detail-list .missing-answer strong {
  color: inherit;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

@media (max-width: 860px) {
  .teacher-shell {
    grid-template-columns: 1fr;
  }

  .teacher-sidebar {
    position: static;
    min-height: auto;
    grid-template-rows: auto auto auto;
    padding: 18px;
  }

  .teacher-sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .teacher-user-menu {
    display: none;
  }

  .teacher-main {
    padding: 16px;
  }

  .teacher-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .teacher-topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .workspace-grid,
  .admin-home-grid,
  .admin-grid,
  .admin-stat-grid,
  .admin-chart-grid,
  .upload-panel,
  .answer-panel,
  .subjective-editor,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .flow-steps {
    grid-template-columns: 1fr 1fr;
  }

  .admin-home-page {
    align-content: start;
  }

  .admin-home-entry {
    min-height: 210px;
  }

  .card-head,
  .results-head {
    flex-direction: column;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .query {
    width: 100%;
  }

  input[type="search"] {
    flex: 1;
    width: auto;
  }

  .history-modal {
    width: 100%;
    max-height: 92vh;
    padding: 16px;
  }

  .modal-title-row {
    align-items: flex-start;
  }

  .pair-card-grid,
  .pair-actions,
  .pairing-stat-grid,
  .pairing-pages,
  .upload-action-grid,
  .upload-source-grid,
  .grade-choice-grid,
  .segmented-options,
  .unit-option-grid,
  .answer-form.split-actions,
  .ready-stats,
  .report-stat-row,
  .writing-dimensions {
    grid-template-columns: 1fr;
  }

  .pair-link {
    display: none;
  }

  .result-actions,
  .history-toolbar {
    width: 100%;
  }

  .result-more-menu,
  .result-more-menu summary {
    width: 100%;
  }

  .answer-select-panel {
    max-height: min(390px, 58vh);
  }

  .answer-select-fields {
    grid-template-columns: 1fr;
  }

  .answer-select-scroll {
    gap: 12px;
  }

  .answer-unit-scroll {
    max-height: min(230px, 34vh);
  }

  .answer-select-actions .start-button {
    width: 100%;
  }

  .report-identity {
    align-items: flex-start;
  }

  .report-total strong {
    font-size: 34px;
  }
}

@media (max-width: 860px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden;
  }

  body {
    font-size: 16px;
    line-height: 1.65;
    background: #f4f7fb;
  }

  .teacher-shell {
    width: 100%;
    min-width: 0;
    display: block;
  }

  .teacher-sidebar {
    position: sticky;
    top: 0;
    z-index: 40;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--line-soft);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 12px 26px rgba(31, 44, 71, 0.08);
  }

  .teacher-brand {
    gap: 10px;
  }

  .teacher-brand strong {
    font-size: 18px;
  }

  .teacher-brand small,
  .teacher-version-badge {
    font-size: 11px;
  }

  .teacher-version-badge {
    margin: -4px 0 0 48px;
  }

  .teacher-logo-mark {
    width: 38px;
    height: 38px;
  }

  .teacher-sidebar-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .teacher-sidebar-nav button {
    min-height: 48px;
    justify-content: center;
    padding: 0 10px;
    font-size: 15px;
  }

  .teacher-main {
    gap: 12px;
    padding: 12px 10px 30px;
  }

  .teacher-topbar {
    min-height: auto;
    gap: 10px;
    padding: 2px 2px 0;
  }

  .teacher-product-title {
    font-size: 15px;
  }

  .teacher-product-title img {
    height: 19px;
  }

  .teacher-topbar h1 {
    font-size: 24px;
  }

  .teacher-topbar-actions {
    gap: 8px;
  }

  .teacher-bell-button {
    display: none;
  }

  .teacher-flow-steps {
    padding: 10px;
  }

  .flow-steps {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .flow-steps::-webkit-scrollbar {
    display: none;
  }

  .flow-step {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 6px 10px;
    border: 1px solid #e0e8f2;
    border-radius: 999px;
    background: #fff;
    font-size: 14px;
    white-space: nowrap;
  }

  .flow-step::before {
    width: 22px;
    height: 22px;
  }

  .work-card,
  .results-panel,
  .admin-panel,
  .subjective-panel,
  .pair-panel,
  .upload-panel {
    padding: 14px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .compact-text,
  .subtext,
  .status,
  .answer-inline-status,
  .answer-operation-label,
  .objective-only-note,
  .selected-files-info,
  .answer-meta,
  .student-line,
  .pairing-action-hint,
  .pairing-action-panel > span {
    font-size: 15px;
    line-height: 1.7;
  }

  button,
  a.secondary-button,
  a.danger-button,
  a.start-button,
  .answer-upload-button,
  .pairing-view-button {
    min-height: 48px;
    font-size: 16px;
  }

  .secondary-button,
  .danger-button,
  .history-detail-button {
    min-height: 44px;
  }

  .corner-reset-button,
  .compact-action-button {
    width: auto;
    min-height: 32px;
    padding: 0 10px;
    font-size: 13px;
  }

  input[type="search"],
  .answer-select-fields select {
    min-height: 48px;
    font-size: 16px;
  }

  .workspace-grid {
    gap: 12px;
  }

  .card-head,
  .results-head,
  .answer-settings-head,
  .pairing-row-head,
  .report-topbar,
  .modal-title-row {
    gap: 10px;
  }

  .status-pill {
    width: fit-content;
    min-height: 34px;
    font-size: 14px;
  }

  .upload-action-grid,
  .answer-actions,
  .answer-form.split-actions,
  .answer-select-actions,
  .result-actions,
  .class-overview-head,
  .class-history-head,
  .exam-history-head,
  .history-filter-panel,
  .history-toolbar,
  .history-batch-toolbar,
  .history-batch-controls,
  .inline-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

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

  .grading-mode-panel p {
    text-align: left;
  }

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

  .exam-history-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    width: 100%;
  }

  .history-inline-status {
    white-space: normal;
  }

  .result-actions button,
  .result-more-menu summary,
  .history-toolbar button,
  .inline-actions button,
  .answer-actions button,
  .answer-upload-button,
  .answer-reset-button,
  .answer-select-actions .start-button,
  .answer-select-actions .secondary-button {
    width: 100%;
  }

  .answer-save-option {
    align-items: flex-start;
    line-height: 1.6;
  }

  .answer-upload-button {
    min-width: 100%;
  }

  .file-picker {
    min-height: 116px;
    padding: 14px;
  }

  .compact-picker {
    min-height: 78px;
  }

  .file-picker small {
    font-size: 14px;
    line-height: 1.5;
  }

  .selected-file-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: flex-start;
  }

  .selected-file-remove {
    grid-column: 1 / -1;
    width: 100%;
  }

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

  .pairing-stat {
    min-height: 76px;
  }

  .pairing-pages {
    grid-template-columns: 1fr;
  }

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

  .ready-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ready-stats div {
    min-height: 72px;
    padding: 8px 4px;
  }

  .ready-stats strong {
    font-size: 24px;
  }

  .ready-stats span,
  .ready-checklist span {
    font-size: 13px;
    text-align: center;
  }

  .batch-list {
    max-height: none;
    overflow: visible;
  }

  .batch-item {
    padding: 14px;
  }

  .batch-score {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .batch-score span,
  .batch-score strong {
    display: grid;
    place-items: center;
    min-height: 42px;
    border-radius: 6px;
    background: #f5f4ed;
    text-align: center;
  }

  .modal-backdrop {
    padding: 8px;
  }

  .history-modal {
    width: 100%;
    max-height: 94vh;
    padding: 14px;
  }

  .modal-title-row,
  .modal-actions,
  .report-identity {
    flex-direction: column;
    align-items: stretch;
  }

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

  .report-identity {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .report-total {
    grid-column: 1 / -1;
    justify-items: stretch;
    padding: 12px;
    border-radius: 8px;
    background: #f5f4ed;
  }

  .report-total strong {
    font-size: 40px;
  }

  .report-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-stat-row div {
    padding: 10px;
  }

  .writing-paper {
    padding: 12px;
    font-size: 16px;
    line-height: 1.9;
  }

  .writing-dimensions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 0 12px 12px;
  }

  .writing-dimensions div {
    min-height: 78px;
    padding: 8px 4px;
    text-align: center;
  }

  .writing-dimensions strong {
    font-size: 22px;
  }

  .ai-feedback-box,
  .ai-feedback-table-card {
    margin: 0 12px 12px;
    font-size: 16px;
    line-height: 1.8;
  }

  .formatted-feedback {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 680px) {
  .results-panel .table-wrap,
  .current-run-card .table-wrap {
    overflow: visible;
  }

  .results-panel .table-wrap table,
  .results-panel .table-wrap tbody,
  .results-panel .table-wrap tr,
  .results-panel .table-wrap td,
  .current-run-card .table-wrap table,
  .current-run-card .table-wrap tbody,
  .current-run-card .table-wrap tr,
  .current-run-card .table-wrap td {
    display: block;
    width: 100%;
  }

  .results-panel .table-wrap thead,
  .current-run-card .table-wrap thead {
    display: none;
  }

  #historyBody tr,
  #workbenchCurrentResultBody tr {
    display: grid;
    gap: 8px;
    margin-bottom: 12px;
    padding: 14px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(31, 44, 71, 0.06);
  }

  #historyBody td,
  #workbenchCurrentResultBody td {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    border: 0;
    color: #263247;
    font-size: 15px;
    white-space: normal;
  }

  #historyBody td::before,
  #workbenchCurrentResultBody td::before {
    flex: 0 0 72px;
    color: var(--muted);
    font-weight: 800;
  }

  #historyBody td:nth-child(1)::before,
  #workbenchCurrentResultBody td:nth-child(1)::before {
    content: "姓名";
  }

  #historyBody td:nth-child(2)::before,
  #workbenchCurrentResultBody td:nth-child(2)::before {
    content: "班级";
  }

  #historyBody td:nth-child(3)::before,
  #workbenchCurrentResultBody td:nth-child(3)::before {
    content: "学号";
  }

  #historyBody td:nth-child(4)::before,
  #workbenchCurrentResultBody td:nth-child(4)::before {
    content: "客观";
  }

  #historyBody td:nth-child(5)::before,
  #workbenchCurrentResultBody td:nth-child(5)::before {
    content: "主观";
  }

  #historyBody td:nth-child(6)::before,
  #workbenchCurrentResultBody td:nth-child(6)::before {
    content: "总分";
  }

  #historyBody td:nth-child(7)::before,
  #workbenchCurrentResultBody td:nth-child(7)::before {
    content: "详情";
  }

  #historyBody td:nth-child(8)::before,
  #workbenchCurrentResultBody td:nth-child(8)::before {
    content: "时间";
  }

  #historyBody td[colspan]::before,
  #workbenchCurrentResultBody td[colspan]::before {
    content: "";
    display: none;
  }

  #historyBody td:nth-child(7),
  #workbenchCurrentResultBody td:nth-child(7) {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
  }

  #historyBody td:nth-child(7)::before,
  #workbenchCurrentResultBody td:nth-child(7)::before {
    align-self: center;
  }

  #historyBody .history-detail-button,
  #workbenchCurrentResultBody .history-detail-button {
    width: 100%;
  }

  .subjective-table-wrap,
  .ai-feedback-table-wrap {
    overflow: visible;
  }

  .subjective-table,
  .subjective-table tbody,
  .subjective-table tr,
  .subjective-table td,
  .ai-feedback-table,
  .ai-feedback-table tbody,
  .ai-feedback-table tr,
  .ai-feedback-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .subjective-table thead,
  .ai-feedback-table thead {
    display: none;
  }

  .subjective-table tr,
  .ai-feedback-table tr {
    display: grid;
    gap: 8px;
    margin: 0 0 10px;
    padding: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: #fff;
  }

  .subjective-table td,
  .ai-feedback-table td {
    padding: 0;
    border: 0;
    font-size: 15px;
    line-height: 1.7;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .subjective-table td::before,
  .ai-feedback-table td::before {
    display: block;
    margin-bottom: 2px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
  }

  .subjective-table td:nth-child(1)::before {
    content: "题号";
  }

  .subjective-table td:nth-child(2)::before {
    content: "学生答案";
  }

  .subjective-table td:nth-child(3)::before {
    content: "正确答案";
  }

  .subjective-table td:nth-child(4)::before {
    content: "得分";
  }

  .ai-feedback-table td:nth-child(1)::before {
    content: "维度";
  }

  .ai-feedback-table td:nth-child(2)::before {
    content: "得分";
  }

  .ai-feedback-table td:nth-child(3)::before {
    content: "严重程度";
  }

  .ai-feedback-table td:nth-child(4)::before {
    content: "主要问题";
  }

  .ai-feedback-table td:nth-child(5)::before {
    content: "改进建议";
  }

  .ai-feedback-table th:nth-child(1),
  .ai-feedback-table td:nth-child(1),
  .ai-feedback-table th:nth-child(2),
  .ai-feedback-table td:nth-child(2),
  .ai-feedback-table th:nth-child(3),
  .ai-feedback-table td:nth-child(3) {
    width: auto;
    min-width: 0;
  }

  .ai-feedback-group-row {
    background: #fbfaf5;
  }

  .ai-feedback-issue-row {
    background: #fff;
  }
}

@media (max-width: 780px) {
  .subjective-section-head,
  .subjective-section-tools {
    align-items: stretch;
    flex-direction: column;
  }

  .subjective-section-tools,
  .subjective-review-actions {
    justify-content: flex-start;
  }

  .subjective-review-modal {
    width: 100%;
    max-height: 95vh;
    padding: 12px;
  }

  .subjective-review-grid {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .subjective-review-pane + .subjective-review-pane {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .subjective-review-image-stage {
    min-height: 260px;
    max-height: 54vh;
  }

  #subjectiveReviewText {
    min-height: 280px;
  }

  .subjective-review-footer {
    display: grid;
    grid-template-columns: 1fr;
  }

  .manual-task-row,
  .manual-writing-row {
    grid-template-columns: 68px minmax(0, 1fr);
  }

  .manual-task-row input,
  .manual-writing-row textarea {
    grid-column: 1 / -1;
  }
}

@media (max-width: 430px) {
  .teacher-main {
    padding-inline: 8px;
  }

  .work-card,
  .results-panel {
    padding: 12px;
  }

  .result-actions,
  .modal-actions,
  .ready-stats,
  .report-stat-row,
  .writing-dimensions,
  .batch-score {
    grid-template-columns: 1fr;
  }

  .result-more-content {
    position: static;
    margin-top: 8px;
  }

  .teacher-sidebar-nav button {
    font-size: 14px;
  }

  .teacher-product-title {
    font-size: 14px;
  }

  .teacher-top-avatar {
    display: none;
  }
}

/* v5.12.2: On phones, let all answer selectors participate in normal page flow.
   The former 390px panel cap clipped the period/unit selector behind the actions. */
@media (max-width: 860px) {
  .answer-select-panel {
    max-height: none;
    grid-template-rows: auto auto;
    overflow: visible;
  }

  .answer-select-scroll {
    overflow: visible;
    padding-right: 0;
  }
}
.answer-fixed-preview{display:grid;gap:14px;margin-top:16px;padding:18px;border:1px solid #cfdce7;border-radius:16px;background:#fbfdff}.answer-fixed-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;flex-wrap:wrap}.answer-fixed-head h3{margin:2px 0 0}.answer-preview-status{max-width:100%;padding:7px 11px;border-radius:999px;font-size:.9rem;font-weight:800}.answer-preview-status.ready{background:#e7f7ef;color:#176b57}.answer-preview-status.needs-check{background:#fff3d6;color:#8a5700}.answer-preview-help{margin:0;color:#667085}.answer-preview-section{border:1px solid #dbe5ed;border-radius:12px;background:#fff;overflow:hidden}.answer-preview-section>summary{cursor:pointer;padding:13px 15px;background:#f4f8fb;font-weight:850}.answer-preview-section>summary small{margin-left:8px;color:#667085;font-weight:600}.answer-objective-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(82px,1fr));gap:8px;padding:14px}.answer-objective-grid label{display:flex!important;align-items:center;gap:5px!important}.answer-objective-grid input{min-width:0;text-align:center;text-transform:uppercase}.answer-subjective-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;padding:14px}.answer-subjective-list label{display:grid!important;grid-template-columns:76px minmax(0,1fr);align-items:center;gap:8px!important}.answer-subjective-list label.missing input{border-color:#e09b2d;background:#fffaf0}.answer-writing-preview{padding-bottom:14px}.answer-writing-preview>label{display:grid!important;gap:7px!important;margin:14px 14px 0}.answer-writing-preview textarea{min-height:130px!important;resize:vertical}.answer-preview-host[hidden]{display:none!important}@media(max-width:700px){.answer-fixed-preview{padding:12px}.answer-subjective-list{grid-template-columns:1fr}.answer-objective-grid{grid-template-columns:repeat(4,minmax(0,1fr))}.answer-preview-status{border-radius:10px}.answer-writing-preview textarea{min-height:160px!important}}
.answer-task-item{display:grid;gap:9px;padding:12px;border:1px solid #dbe5ed;border-radius:10px;background:#fbfdff}.answer-task-item>label{display:grid!important;grid-template-columns:1fr!important;gap:5px!important}.answer-task-item textarea{min-height:72px!important;resize:vertical}.answer-task-item.missing{border-color:#e09b2d;background:#fffaf0}
.answer-passage-field{display:grid!important;gap:7px!important;margin:14px 14px 0}.answer-passage-field textarea{min-height:220px!important;resize:vertical;font-family:inherit!important;line-height:1.65}.question-image-tools{display:grid;gap:12px;padding:16px;border:1px solid #dbe5ed;border-radius:14px;background:#f8fbfd}.question-image-tools h3{margin:0 0 5px}.question-image-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.question-image-card{display:grid!important;gap:8px!important;align-content:start;padding:13px;border:1px dashed #8aa9bf;border-radius:12px;background:#fff;min-width:0}.question-image-card input{width:100%;min-width:0}.question-image-card span{font-size:.9rem;color:#667085;overflow-wrap:anywhere}.question-image-card img{display:block;width:100%;max-height:360px;object-fit:contain;border:1px solid #dbe5ed;border-radius:9px;background:#eef3f7}.question-image-card img[hidden]{display:none!important}.answer-confirmations{display:grid;gap:10px;padding:14px 16px;border:1px solid #e2b45b;border-radius:12px;background:#fffaf0}.answer-confirmations legend{padding:0 7px;color:#8a5700;font-weight:850}.answer-confirmations label{display:flex!important;align-items:flex-start;gap:9px!important;font-weight:700}.answer-confirmations input{width:auto!important;margin-top:3px;flex:0 0 auto}@media(max-width:700px){.question-image-grid{grid-template-columns:1fr}.question-image-card img{max-height:280px}.answer-passage-field textarea{min-height:180px!important}}
