:root {
  color-scheme: light;
  --ink: #20312b;
  --muted: #51665c;
  --paper: #fff;
  --background: #f5f7f3;
  --border: #dce4db;
  --accent: #1e654e;
  --accent-dark: #174e3c;
  --accent-light: #e8f2ec;
  --danger: #9e3528;
  --radius: 12px;
  font-family: "Inter", "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--background);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid #46977d; outline-offset: 3px; }
h1, h2, h3 { margin: 0 0 .75rem; line-height: 1.28; letter-spacing: -.025em; }
h1 { font-size: clamp(1.85rem, 3vw, 2.55rem); font-weight: 740; }
h2 { font-size: 1.35rem; font-weight: 690; }
h3 { font-size: 1.05rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
p:last-child, ul:last-child, ol:last-child, dl:last-child { margin-bottom: 0; }
img { max-width: 100%; vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }

.skip-link {
  position: fixed;
  top: .75rem;
  left: .75rem;
  z-index: 20;
  transform: translateY(-200%);
  padding: .5rem .75rem;
  background: var(--paper);
}
.skip-link:focus { transform: none; }
.shell { min-height: 100vh; }
.topbar { background: #eef3ec; border-bottom: 1px solid var(--border); }
.topbar-inner {
  display: flex;
  align-items: center;
  gap: clamp(.75rem, 3vw, 2.25rem);
  max-width: 1460px;
  min-height: 64px;
  margin-inline: auto;
  padding: .55rem clamp(1.4rem, 4vw, 3.6rem);
}
.brand { display: flex; align-items: center; gap: .7rem; min-width: 0; text-decoration: none; color: var(--ink); }
.brand-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px 13px 13px 4px;
  background: var(--accent);
  color: #fff;
  font-family: Georgia, "Songti SC", serif;
  font-size: 1.65rem;
  line-height: 1;
}
.brand-name { font-size: 1.05rem; line-height: 1.25; overflow-wrap: anywhere; }
.brand-name strong { font-weight: 760; }
.nav-link {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-height: 42px;
  padding: .65rem .85rem;
  border-radius: 8px;
  color: var(--accent);
  font-weight: 660;
  text-decoration: none;
  white-space: nowrap;
}
.nav-link:hover, .nav-link[aria-current="page"] { background: #dfece3; }
.topbar nav { display: flex; gap: .25rem; }
.nav-folders { position: relative; display: inline-block; width: 15px; height: 10px; border: 1.5px solid currentColor; border-radius: 2px; }
.nav-folders::before { content: ""; position: absolute; top: -5px; left: -1.5px; width: 8px; height: 4px; border: 1.5px solid currentColor; border-bottom: 0; border-radius: 2px 2px 0 0; }
.account { display: flex; align-items: center; gap: .65rem; margin-inline-start: auto; padding: .35rem .1rem; color: var(--muted); overflow-wrap: anywhere; text-decoration: none; }
.account:hover { color: var(--accent); text-decoration: underline; }
.account-dot { flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
.workspace { width: 100%; max-width: 1460px; margin: 0 auto; padding: 2.65rem clamp(1.4rem, 4vw, 3.6rem) 4rem; }

.guest .shell { max-width: 540px; margin: 0 auto; padding-top: clamp(1.5rem, 10vh, 6rem); }
.guest .topbar { border: 0; background: transparent; }
.guest .workspace { padding-top: .75rem; }
.guest .brand { margin: 0; }

.breadcrumb, .breadcrumbs { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.15rem; color: var(--muted); font-size: .87rem; }
.page-head, .page-header { margin: 0 0 1.5rem; }
.page-head > :last-child, .page-header > :last-child { margin-bottom: 0; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); align-items: start; }
.grid > *, .row > *, .panel > * { min-width: 0; }
.stack { display: grid; gap: 1rem; }
.row, .actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem .8rem; }
.row.between, .row.space-between { justify-content: space-between; }
.panel {
  margin: 0 0 1rem;
  padding: clamp(1rem, 2.4vw, 1.5rem);
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.grid > .panel, .stack > .panel { margin: 0; }
.panel > :last-child { margin-bottom: 0; }
.muted, .help, small { color: var(--muted); }
.muted, .help { font-size: .91rem; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 99px;
  padding: .13rem .56rem;
  background: var(--accent-light);
  color: #245342;
  font-size: .79rem;
  font-weight: 650;
  white-space: nowrap;
}
.badge.warning { color: #704713; background: #fdf0d7; }
.badge.error { color: var(--danger); background: #fff1ee; }
.notice { margin-bottom: 1rem; padding: .75rem 1rem; border: 1px solid #bddecb; background: var(--accent-light); border-radius: 8px; }
.notice.error, .alert { border-color: #edc6be; background: #fff1ee; color: var(--danger); }
.workspace-feedback { position: fixed; z-index: 10; inset-block-start: .75rem; inset-inline-end: .75rem; max-width: min(32rem, calc(100vw - 1.5rem)); box-shadow: 0 3px 12px #20312b1a; }
.error { color: var(--danger); }
.empty { padding: 1.5rem 1rem; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: 8px; }
.thumbnail, figure { margin: 0; }
figcaption { margin-top: .45rem; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.thumbnail img, figure > img { display: block; width: 100%; height: auto; border: 1px solid var(--border); border-radius: 6px; }
.preview-grid {
  display: grid;
  gap: .85rem;
  grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr));
  margin-block: .85rem;
}
.preview-grid img {
  display: block;
  width: 100%;
  height: clamp(120px, 20vw, 240px);
  object-fit: contain;
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.source-counts { gap: .85rem 1.75rem; margin-block: .9rem; }
.source-counts dt { color: var(--muted); font-size: .84rem; }
.source-counts dd { margin: 0; font-size: 1.32rem; font-weight: 680; font-variant-numeric: tabular-nums; }
.review-image { display: block; margin-inline: auto; max-height: 85vh; object-fit: contain; }

form { margin: 0; }
form > * + * { margin-top: .85rem; }
form.row > *, form.actions > * { margin-top: 0; }
form + form { margin-top: .85rem; }
fieldset { min-width: 0; padding: .85rem 1rem; margin-inline: 0; border: 1px solid var(--border); border-radius: 8px; }
legend { padding-inline: .3rem; font-weight: 650; }
label { display: inline-block; font-size: .9rem; font-weight: 620; }
label > input:not([type="checkbox"], [type="radio"]), label > select, label > textarea { display: block; margin-top: .3rem; }
label:has(input:is([type="checkbox"], [type="radio"])) { display: inline-flex; align-items: center; gap: .4rem; margin-inline-end: .7rem; }
input, select, textarea, button, .button { font: inherit; }
input:not([type="checkbox"], [type="radio"], [type="hidden"], [type="submit"], [type="button"], [type="reset"]), select, textarea {
  max-width: 100%;
  padding: .55rem .7rem;
  border: 1px solid #bdcbbf;
  border-radius: 7px;
  background: var(--paper);
  color: var(--ink);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1rem; height: 1rem; margin: 0; }
input[type="file"] { display: block; font-size: .89rem; }
input:disabled, select:disabled, textarea:disabled { background: #eef2ee; }
textarea { display: block; min-height: 6rem; width: 100%; resize: vertical; }
label:has(textarea), .field:has(textarea) { display: block; }
button, .button, input[type="submit"], input[type="button"], input[type="reset"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: .47rem .82rem;
  border: 1px solid var(--accent);
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-weight: 650;
  cursor: pointer;
}
button:hover, .button:hover, input[type="submit"]:hover { background: var(--accent-dark); color: #fff; }
button.secondary, .button.secondary, button.ghost, .button.ghost { color: var(--accent); background: var(--paper); border-color: #b9cfc2; }
button.secondary:hover, .button.secondary:hover, button.ghost:hover, .button.ghost:hover, .button[aria-current="page"] { background: var(--accent-light); }
button:disabled, .button[aria-disabled="true"] { opacity: .56; cursor: default; }
button.danger, .button.danger { background: var(--paper); color: var(--danger); border-color: #edc6be; }
button.danger:hover, .button.danger:hover { background: #fff1ee; }

.table-wrap, .table-scroll { overflow-x: auto; }
table, .table { width: 100%; border-collapse: collapse; text-align: left; font-variant-numeric: tabular-nums; }
thead { background: #f0f4ef; color: #35493f; }
th, td { padding: .58rem .7rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85rem; font-weight: 700; }
tr:last-child td { border-bottom: 0; }
:is(.exam-list, .source-list, .roster-students) tbody tr { position: relative; }
:is(.exam-list, .source-list, .roster-students) tbody tr:is(:hover, :focus-within) { background: var(--accent-light); }
:is(.exam-list, .source-list, .roster-students) tbody a::after { content: ""; position: absolute; inset: 0; }
.source-list td:last-child { white-space: nowrap; }
.roster-students th { white-space: nowrap; }
.roster-students td { overflow-wrap: anywhere; }
.roster-pagination { margin-top: .85rem; }
.roster-pagination :is(button, .button) { font: inherit; font-weight: 650; white-space: nowrap; }
.roster-page-jump label { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.roster-page-jump label > .page-number { width: 4.5rem; margin: 0; font: inherit; font-variant-numeric: tabular-nums; }
.progress-scroll { overflow-x: auto; padding-bottom: .4rem; }
.progress-flow {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(11rem, 1fr);
  gap: 2.2rem;
}
.progress-flow:has(.progress-grading > :nth-child(2)) {
  grid-template-columns: minmax(10rem, 1fr) minmax(10rem, 1fr) minmax(23rem, 2fr);
}
.progress-step { min-width: 0; position: relative; padding-top: .7rem; }
.progress-flow > .progress-step::after {
  content: "→";
  position: absolute;
  inset: .7rem auto auto calc(100% + .65rem);
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.3;
}
.progress-grading { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; column-gap: 1.2rem; }
.progress-grading:has(> :nth-child(2)) {
  background: linear-gradient(var(--border), var(--border)) center top / calc(50% + .6rem) 1px no-repeat;
}
.progress-grading:has(> :nth-child(2)) .progress-step {
  background: linear-gradient(var(--border), var(--border)) center top / 1px .45rem no-repeat;
}
.progress-label { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.progress-label h3 { font-size: .95rem; margin: 0; }
.progress-percent { color: var(--accent); font-size: 1.25rem; line-height: 1; font-variant-numeric: tabular-nums; }
.progress-step progress { display: block; width: 100%; height: .55rem; margin: .48rem 0; accent-color: var(--accent); }
.progress-count, .progress-status, .progress-pause { margin: .25rem 0 0; font-size: .81rem; }
.progress-status { color: var(--muted); display: flex; flex-wrap: wrap; gap: .1rem .55rem; }
.progress-pause:empty { display: none; }
.markdown { overflow-wrap: anywhere; }
.markdown :is(ul, ol) { padding-inline-start: 1.35rem; }
.markdown pre { overflow-x: auto; padding: .75rem; background: var(--background); border-radius: 7px; }
.markdown code { font-family: ui-monospace, monospace; background: var(--background); }
.markdown blockquote { margin-inline: 0; padding-inline-start: .85rem; border-inline-start: 3px solid var(--border); color: var(--muted); }
.markdown .report-annotation {
  border: 1px solid currentColor;
  padding: 0 .16em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.box-editor-ui { margin: 1rem 0; --box-color: #116b55; }
.box-editor-toolbar, .box-editor-controls { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; }
.box-editor-toolbar { margin: 0 0 .65rem; }
.box-editor-toolbar:first-child { justify-content: space-between; gap: .5rem 1rem; }
.box-editor-toolbar button { min-height: 34px; padding: .3rem .58rem; font-size: .83rem; }
.box-editor-toolbar button[aria-pressed="true"] { color: #fff; background: var(--accent); }
.box-editor-method { display: flex; align-items: center; gap: .45rem; margin-inline-start: .35rem; font-size: .83rem; }
.box-editor-method select { min-height: 34px; width: auto; margin-top: 0; padding-block: .3rem; }
.box-editor-save-status { margin-inline-start: auto; color: var(--muted); font-size: .83rem; }
.box-editor-save-status.error { color: var(--danger); }
.box-editor-caption { margin: 0 0 .55rem; color: var(--muted); font-size: .84rem; }
.box-editor-viewport { max-height: 72vh; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 8px; background: #e7ede6; }
.box-editor-stage { position: relative; width: min(100%, 72rem); margin-inline: auto; }
.box-editor-stage img { display: block; width: 100%; max-width: none; height: auto; user-select: none; -webkit-user-drag: none; }
.box-editor-overlay { position: absolute; inset: 0; user-select: none; touch-action: none; cursor: crosshair; }
.box-editor-overlay.box-editor-browse { cursor: grab; }
.box-editor-overlay.box-editor-browse:active { cursor: grabbing; }
.box-editor-overlay.box-editor-browse .box-editor-rectangle { pointer-events: none; }
.box-editor-rectangle {
  position: absolute;
  border: 2px solid var(--box-color);
  background: color-mix(in srgb, var(--box-color) 14%, transparent);
  color: var(--box-color);
  cursor: move;
}
.box-editor-rectangle[data-inactive] { border-style: dashed; cursor: crosshair; pointer-events: none; }
.box-editor-rectangle[data-selected] { border-width: 3px; }
.box-editor-rectangle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.box-editor-index {
  position: absolute;
  top: 0;
  left: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 0 .28rem;
  color: #fff;
  background: var(--box-color);
  font-size: .7rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: none;
}
.box-editor-handle { position: absolute; width: 16px; height: 16px; border: 1px solid #fff; background: var(--box-color); }
.box-editor-handle[data-resize="nw"] { top: -4px; left: -4px; cursor: nwse-resize; }
.box-editor-handle[data-resize="ne"] { top: -4px; right: -4px; cursor: nesw-resize; }
.box-editor-handle[data-resize="sw"] { bottom: -4px; left: -4px; cursor: nesw-resize; }
.box-editor-handle[data-resize="se"] { bottom: -4px; right: -4px; cursor: nwse-resize; }
.box-editor-coordinates { display: flex; flex-wrap: wrap; align-items: end; gap: .35rem .65rem; margin: 0 0 .65rem; color: var(--muted); font-size: .84rem; }
.box-editor-coordinates label { font-size: inherit; }
.box-editor-coordinates input { width: 5.7rem; padding: .22rem .3rem !important; }
.box-editor-size { min-width: 3.5rem; align-self: center; font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: .55rem; min-height: 52px; padding: .45rem .9rem; }
  .brand { flex-basis: 100%; }
  .brand-mark { width: 34px; height: 34px; font-size: 1.4rem; }
  .brand-name { font-size: .95rem; }
  .nav-folders { display: none; }
  .nav-link { gap: .45rem; padding: .4rem .58rem; min-height: 36px; font-size: .85rem; }
  .account { max-width: 6rem; padding: 0; font-size: .82rem; }
  .account-dot { display: none; }
  .workspace { padding: 1.45rem .9rem 3rem; }
  table { font-size: .85rem; }
  th, td { padding: .42rem; }
}

.report-editor { min-height: 24rem; font-family: ui-monospace, "PingFang SC", monospace; line-height: 1.55; }
.report-preview { max-height: 60vh; overflow: auto; }
.report-download-form { align-items: end; }
.report-download-form :is([data-download-status], [data-scope-status]) { flex-basis: 100%; margin-bottom: 0; }
.report-download-form :is([data-download-status], [data-scope-status]):empty { display: none; }
