:root {
  color-scheme: light;
  --ink: #1f2933;
  --muted: #61707f;
  --line: #d9e0e5;
  --surface: #ffffff;
  --canvas: #f4f6f7;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --amber: #b45309;
  --blue: #2563eb;
  --red: #b42318;
  --green-soft: #e8f5f2;
  --amber-soft: #fff4e5;
  --blue-soft: #eaf1ff;
  --red-soft: #fff0ee;
  --shadow: 0 10px 30px rgba(31, 41, 51, 0.08);
  font-family: Inter, "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  stroke-width: 2;
}

.icon-lg {
  width: 28px;
  height: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 6px;
  color: #fff;
  background: var(--teal);
}

.site-header,
.app-header {
  min-height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.site-header-inner,
.app-header-inner {
  display: flex;
  width: min(1120px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.account-copy {
  min-width: 0;
  text-align: right;
}

.account-copy strong,
.account-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy span {
  color: var(--muted);
  font-size: 12px;
}

.portal-home {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 64px;
}

.portal-intro {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line);
}

.portal-intro h1 {
  max-width: 760px;
  margin: 0 0 12px;
  font-size: 52px;
  line-height: 1.08;
}

.portal-intro p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.portal-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 28px;
}

.portal-card {
  display: flex;
  min-height: 188px;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.portal-card:hover,
.portal-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--teal);
  box-shadow: var(--shadow);
  outline: none;
}

.portal-card h2 {
  margin: 14px 0 4px;
  font-size: 22px;
}

.portal-card p {
  margin: 0;
  color: var(--muted);
}

.portal-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal-dark);
  font-weight: 700;
}

.auth-page {
  min-height: 100vh;
  background: var(--surface);
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  grid-template-columns: minmax(300px, 0.82fr) minmax(420px, 1.18fr);
}

.auth-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 44px;
  color: #fff;
  background: #173f3b;
}

.auth-aside.admin-theme {
  background: #29384a;
}

.auth-aside.teacher-theme {
  background: #174f49;
}

.auth-aside.student-theme {
  background: #384457;
}

.auth-aside .brand-mark {
  color: var(--ink);
  background: #fff;
}

.auth-aside-copy h1 {
  max-width: 440px;
  margin: 0 0 14px;
  font-size: 38px;
  line-height: 1.15;
}

.auth-aside-copy p {
  max-width: 460px;
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 17px;
}

.auth-aside-foot {
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
}

.auth-main {
  display: grid;
  place-items: center;
  padding: 32px;
}

.auth-panel {
  width: min(420px, 100%);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 38px;
  color: var(--muted);
}

.auth-panel h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.auth-panel > p {
  margin: 0 0 26px;
  color: var(--muted);
}

.form-stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field label,
.field-label {
  color: #344150;
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bcc8d1;
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 104px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.field-help {
  color: var(--muted);
  font-size: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  font-weight: 700;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.button-primary {
  color: #fff;
  background: var(--teal);
}

.button-primary:hover {
  background: var(--teal-dark);
}

.button-secondary {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.button-secondary:hover {
  border-color: #9dacb7;
  background: #f8fafb;
}

.button-danger {
  border-color: #f0c4be;
  color: var(--red);
  background: var(--red-soft);
}

.button-block {
  width: 100%;
}

.icon-button {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.demo-credentials {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 3px solid var(--amber);
  color: #6f4a1b;
  background: var(--amber-soft);
  font-size: 13px;
}

.page-main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-heading h1,
.section-heading h2 {
  margin: 0;
}

.page-heading h1 {
  font-size: 28px;
}

.page-heading p,
.section-heading p {
  margin: 5px 0 0;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
  gap: 1px;
}

.page-heading-secondary {
  margin-top: 32px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-stats {
  margin-bottom: 0;
}

.ops-alerts {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.ops-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid #f0cf9f;
  border-radius: 6px;
  color: #71440a;
  background: var(--amber-soft);
}

.ops-alert.critical {
  border-color: #efb4ad;
  color: var(--red);
  background: var(--red-soft);
}

.ops-alert strong,
.ops-alert span,
#providerTable small,
#gradingRunTable small {
  display: block;
}

.ops-alert span,
#providerTable small,
#gradingRunTable small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.model-list {
  display: grid;
  gap: 3px;
  min-width: 210px;
  font-size: 12px;
}

.model-list b {
  display: inline-block;
  min-width: 32px;
  color: var(--muted);
}

.stat {
  min-height: 96px;
  padding: 16px;
  background: var(--surface);
}

.stat strong,
.stat span {
  display: block;
}

.stat strong {
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
}

.workspace-grid.equal {
  grid-template-columns: 1fr 1fr;
}

.section {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.section + .section,
.section-wide {
  margin-top: 20px;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 19px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f6f7;
}

.segment {
  min-height: 34px;
  padding: 6px 12px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 700;
}

.segment.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(31, 41, 51, 0.12);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.password-reset-form {
  display: flex;
  min-width: 280px;
  gap: 8px;
}

.password-reset-form input {
  min-width: 140px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid #e8ecef;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

td {
  font-size: 14px;
}

.empty-state {
  display: grid;
  min-height: 150px;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.item-list {
  display: grid;
  gap: 10px;
}

.list-item {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

button.list-item {
  width: 100%;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

button.list-item:hover,
button.list-item.active {
  border-color: var(--teal);
  background: #fbfefd;
}

.library-item {
  display: grid;
  gap: 8px;
}

.file-name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.file-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-file-link {
  width: fit-content;
  max-width: 100%;
}

.item-head,
.item-meta,
.item-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.item-head h3 {
  min-width: 0;
  margin: 0;
  font-size: 16px;
}

.item-meta {
  justify-content: flex-start;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #344150;
  background: #edf1f3;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.pending {
  color: #7a4a09;
  background: var(--amber-soft);
}

.badge.reviewed {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.badge.returned {
  color: var(--red);
  background: var(--red-soft);
}

.assignment-cover {
  width: 100%;
  max-height: 190px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.photo-grid a,
.photo-preview-item {
  position: relative;
  display: block;
  overflow: hidden;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #edf1f3;
}

.photo-grid img,
.photo-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-number,
.photo-remove {
  position: absolute;
  z-index: 1;
}

.photo-number {
  bottom: 6px;
  left: 6px;
  min-width: 24px;
  padding: 3px 6px;
  border-radius: 4px;
  color: #fff;
  background: rgba(31, 41, 51, 0.82);
  font-size: 12px;
  font-weight: 750;
  text-align: center;
}

.photo-remove {
  top: 6px;
  right: 6px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 50%;
  color: #fff;
  background: rgba(31, 41, 51, 0.82);
  cursor: pointer;
}

.upload-box {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px dashed #9eacb7;
  border-radius: 6px;
  background: #fafcfc;
}

.upload-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.upload-summary strong {
  flex: 0 0 auto;
  color: var(--ink);
}

.document-dropzone {
  display: grid;
  min-height: 138px;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 20px;
  border: 2px dashed #9eacb7;
  border-radius: 6px;
  color: var(--teal-dark);
  background: #fafcfc;
  cursor: pointer;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.document-dropzone.dragging {
  border-color: var(--teal);
  background: var(--green-soft);
}

.document-dropzone span {
  color: var(--muted);
  font-size: 12px;
}

.document-dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-status {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.upload-status.error {
  color: var(--red);
}

.upload-status progress {
  width: 100%;
  height: 8px;
  accent-color: var(--teal);
}

.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-actions .button {
  min-height: 38px;
}

.assignment-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--line);
  gap: 1px;
}

.assignment-metrics span {
  min-width: 0;
  padding: 9px;
  color: var(--muted);
  background: #f9fbfb;
  font-size: 11px;
}

.assignment-metrics strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
}

.assignment-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: #e4e9ec;
}

.assignment-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.missing-students {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.missing-students strong {
  color: var(--amber);
}

.missing-students span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.result-filters {
  display: grid;
  grid-template-columns: 150px 140px 140px minmax(200px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 20px;
}

.result-filters .field {
  gap: 5px;
}

.result-table-wrap {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.results-table th {
  background: #f7f9f9;
}

.results-table td {
  max-width: 260px;
  overflow-wrap: anywhere;
}

.results-table td small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
}

.results-table tbody tr:hover {
  background: #fbfefd;
}

.score-cell {
  color: var(--amber);
  font-size: 18px;
  font-weight: 800;
}

.button-compact {
  min-height: 34px;
  padding: 6px 10px;
  white-space: nowrap;
}

.submission-dialog {
  width: min(1040px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 18px 55px rgba(31, 41, 51, 0.22);
}

.submission-dialog::backdrop {
  background: rgba(31, 41, 51, 0.54);
}

.dialog-shell {
  display: grid;
  max-height: calc(100dvh - 34px);
  grid-template-rows: auto minmax(0, 1fr);
}

.dialog-header {
  z-index: 1;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.dialog-header h2,
.dialog-header p {
  margin: 0;
}

.dialog-header h2 {
  font-size: 21px;
}

.dialog-header p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.submission-detail {
  overflow-y: auto;
  padding: 20px;
}

.detail-overview {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}

.detail-score {
  display: grid;
  min-height: 154px;
  place-content: center;
  padding: 18px;
  border-radius: 6px;
  color: #fff;
  background: var(--teal-dark);
  text-align: center;
}

.detail-score span,
.detail-score small {
  color: #d8f1ec;
}

.detail-score strong {
  font-size: 48px;
  line-height: 1.05;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
  gap: 1px;
}

.detail-meta-grid > div {
  min-width: 0;
  padding: 14px;
  background: #fff;
}

.detail-meta-grid span,
.detail-meta-grid strong {
  display: block;
}

.detail-meta-grid > div > span {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-meta-grid strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.detail-section {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.detail-section .section-heading {
  margin-bottom: 12px;
}

.detail-section h3 {
  margin: 0;
  font-size: 17px;
}

.detail-section p {
  margin: 2px 0 0;
  color: var(--muted);
}

.detail-photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.detail-photo-grid a {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f7f8f9;
}

.detail-photo-grid img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
}

.detail-photo-grid span {
  padding: 7px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.question-list {
  border: 1px solid var(--line);
  border-radius: 6px;
}

.question-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.question-row:last-child {
  border-bottom: 0;
}

.question-number {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 5px;
  color: var(--teal-dark);
  background: var(--green-soft);
  font-weight: 800;
}

.question-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.question-heading strong,
.question-reference,
.question-copy p {
  overflow-wrap: anywhere;
}

.question-state {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.question-state.correct {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.question-state.partial {
  color: var(--amber);
  background: var(--amber-soft);
}

.question-state.wrong,
.question-state.unanswered {
  color: var(--red);
  background: var(--red-soft);
}

.question-reference,
.question-copy p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.detail-review-form {
  display: grid;
  grid-template-columns: 110px 150px minmax(240px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.detail-feedback textarea {
  min-height: 48px;
}

.processing-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(31, 41, 51, 0.64);
}

.processing-panel {
  width: min(620px, 100%);
  padding: 26px;
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(31, 41, 51, 0.24);
  text-align: center;
}

.processing-panel h2,
.processing-panel p {
  margin: 0;
}

.processing-panel h2 {
  margin-top: 12px;
  font-size: 22px;
}

.processing-panel p {
  min-height: 48px;
  margin-top: 6px;
  color: var(--muted);
}

.processing-panel > progress {
  width: 100%;
  height: 9px;
  margin: 18px 0;
  accent-color: var(--teal);
}

.processing-icon {
  display: grid;
  width: 54px;
  height: 54px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--teal-dark);
  background: var(--green-soft);
}

.processing-icon.active .icon {
  animation: processing-spin 1s linear infinite;
}

.processing-icon.success {
  color: var(--teal-dark);
  background: var(--green-soft);
}

.processing-icon.error {
  color: var(--red);
  background: var(--red-soft);
}

.processing-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  gap: 6px;
  list-style: none;
}

.processing-steps li {
  display: grid;
  min-width: 0;
  justify-items: center;
  gap: 6px;
  color: #8a96a1;
  font-size: 11px;
}

.processing-steps li span {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #f6f8f9;
}

.processing-steps li strong {
  overflow-wrap: anywhere;
}

.processing-steps li.active,
.processing-steps li.complete {
  color: var(--teal-dark);
}

.processing-steps li.active span {
  border-color: var(--teal);
  background: var(--green-soft);
}

.processing-steps li.complete span {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.processing-elapsed {
  display: block;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
}

@keyframes processing-spin {
  to { transform: rotate(360deg); }
}

.upload-trigger {
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--teal-dark);
  background: #fff;
  cursor: pointer;
  font-weight: 750;
}

.upload-trigger input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.student-layout {
  width: min(760px, calc(100% - 24px));
}

.student-profile {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.student-profile-icon {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 6px;
  color: var(--teal-dark);
  background: var(--green-soft);
}

.feedback-box {
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  background: var(--green-soft);
}

.feedback-box strong,
.feedback-box span {
  display: block;
}

.feedback-box span {
  margin-top: 4px;
  color: #3c5551;
}

.feedback-box.issue-box {
  border-left-color: #b7791f;
  background: var(--amber-soft);
}

.feedback-box.issue-box span {
  color: #69420f;
}

.review-form {
  display: grid;
  grid-template-columns: 110px minmax(220px, 1fr) 130px auto;
  gap: 10px;
  align-items: end;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  width: min(360px, calc(100% - 36px));
  gap: 8px;
}

.toast {
  padding: 12px 14px;
  border: 1px solid #b7d5cf;
  border-radius: 5px;
  color: #173f3b;
  background: #f5fffc;
  box-shadow: var(--shadow);
}

.toast.error {
  border-color: #efbbb5;
  color: #7e251d;
  background: #fff7f6;
}

@media (max-width: 900px) {
  .auth-layout,
  .workspace-grid,
  .workspace-grid.equal {
    grid-template-columns: 1fr;
  }

  .auth-aside {
    min-height: 280px;
    padding: 30px;
  }

  .auth-main {
    padding: 34px 24px 54px;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .result-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-query {
    grid-column: 1 / -1;
  }

  .detail-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-review-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-feedback {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .site-header-inner,
  .app-header-inner,
  .page-main,
  .portal-home {
    width: min(100% - 24px, 1120px);
  }

  .site-header-inner,
  .app-header-inner {
    min-height: 58px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .account-copy {
    display: none;
  }

  .portal-home {
    padding-top: 28px;
  }

  .portal-intro h1 {
    font-size: 34px;
  }

  .auth-aside {
    min-height: 236px;
    padding: 24px;
  }

  .auth-aside-copy h1 {
    font-size: 30px;
  }

  .auth-main {
    padding: 28px 20px 44px;
  }

  .back-link {
    margin-bottom: 26px;
  }

  .page-main {
    padding-top: 20px;
  }

  .page-heading,
  .section-heading,
  .item-head,
  .item-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat {
    min-height: 84px;
  }

  .section {
    padding: 17px;
  }

  .form-row,
  .review-form,
  .result-filters,
  .detail-review-form {
    grid-template-columns: 1fr;
  }

  .result-query,
  .detail-feedback {
    grid-column: auto;
  }

  .assignment-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .missing-students,
  .detail-overview {
    grid-template-columns: 1fr;
  }

  .submission-dialog {
    width: 100%;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .dialog-shell {
    max-height: 100dvh;
  }

  .dialog-header,
  .submission-detail {
    padding: 16px;
  }

  .detail-score {
    min-height: 124px;
  }

  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .detail-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-heading {
    flex-direction: column;
  }

  .processing-panel {
    padding: 22px 16px;
  }

  .processing-steps {
    grid-template-columns: repeat(5, 58px);
    justify-content: start;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  th,
  td {
    min-width: 112px;
  }
}
