:root {
  --ink: #202136;
  --muted: #74768a;
  --muted-2: #9b9daf;
  --line: #e7e7ef;
  --line-strong: #d7d8e4;
  --surface: #ffffff;
  --surface-soft: #f7f7fb;
  --canvas: #f2f2f7;
  --primary: #4f46c8;
  --primary-dark: #393295;
  --primary-soft: #eeedff;
  --green: #168f68;
  --green-soft: #e6f8f1;
  --orange: #d97706;
  --orange-soft: #fff3df;
  --red: #d33f49;
  --red-soft: #ffeaec;
  --blue: #2670d8;
  --blue-soft: #eaf2ff;
  --purple: #7b4fd1;
  --shadow-sm: 0 1px 2px rgba(32, 33, 54, .04), 0 5px 16px rgba(32, 33, 54, .04);
  --shadow-md: 0 12px 34px rgba(36, 36, 70, .11);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar-width: 252px;
  --topbar-height: 82px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { max-width: 100%; }
.hidden { display: none !important; }

.app-frame { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  color: #efefff;
  background:
    radial-gradient(circle at 0 0, rgba(113, 102, 255, .34), transparent 33%),
    linear-gradient(160deg, #25245d 0%, #191a42 58%, #161735 100%);
  transition: transform .25s ease;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 18px; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  color: #25245d; background: #fff; border-radius: 12px;
  font-family: serif; font-size: 23px; font-weight: 800;
  box-shadow: 0 5px 16px rgba(0, 0, 0, .2);
}
.brand strong { display: block; color: #fff; font-size: 19px; letter-spacing: .12em; }
.brand span { display: block; margin-top: 1px; color: #a9a8d6; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.school-switcher {
  display: flex; align-items: center; gap: 9px; margin: 0 2px 14px; padding: 10px;
  border: 1px solid rgba(255, 255, 255, .09); border-radius: 13px;
  background: rgba(255, 255, 255, .055);
}
.school-avatar {
  display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px;
  color: #393295; background: #d9d7ff; border-radius: 9px; font-weight: 800;
}
.school-switcher div { min-width: 0; flex: 1; }
.school-switcher b, .school-switcher small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.school-switcher b { color: #fff; font-size: 13px; }
.school-switcher small { margin-top: 2px; color: #aaa9cf; font-size: 10px; }
.chevron { color: #aaa9cf; }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; color: #bbbae0; background: transparent; border: 0; border-radius: 11px;
  text-align: left; cursor: pointer; transition: .18s ease;
}
.nav-item span { width: 20px; color: #9291c5; font-size: 17px; text-align: center; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-item.is-active { color: #fff; background: linear-gradient(90deg, rgba(111, 102, 255, .38), rgba(111, 102, 255, .13)); }
.nav-item.is-active::before {
  position: absolute; left: -14px; top: 10px; width: 3px; height: 22px;
  background: #a9a2ff; border-radius: 0 4px 4px 0; content: "";
}
.nav-item em {
  margin-left: auto; min-width: 21px; padding: 2px 6px; color: #fff; background: #e04a5d;
  border-radius: 99px; font-size: 10px; font-style: normal; text-align: center;
}
.sidebar-spacer { flex: 1; min-height: 12px; }
.upgrade-card { margin: 8px 2px 12px; padding: 15px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 15px; background: rgba(255, 255, 255, .065); }
.upgrade-card .spark { display: block; margin-bottom: 7px; color: #c6c1ff; font-size: 20px; }
.upgrade-card strong { color: #fff; font-size: 13px; }
.upgrade-card p { margin: 6px 0 11px; color: #a5a4ce; font-size: 11px; line-height: 1.6; }
.upgrade-card button { padding: 0; color: #c9c6ff; background: transparent; border: 0; font-size: 11px; cursor: pointer; }
.nav-item-muted { margin-bottom: 10px; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 10px 7px 0; border-top: 1px solid rgba(255, 255, 255, .08); }
.user-avatar { display: grid; place-items: center; width: 34px; height: 34px; color: #2c295e; background: #ffd9b4; border-radius: 50%; font-weight: 800; }
.sidebar-user div { flex: 1; min-width: 0; }
.sidebar-user b, .sidebar-user small { display: block; }
.sidebar-user b { color: #fff; font-size: 12px; }
.sidebar-user small { margin-top: 2px; color: #9d9cc9; font-size: 10px; }

.main-shell { min-height: 100vh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px;
  height: var(--topbar-height); padding: 0 28px; border-bottom: 1px solid rgba(229, 229, 238, .9);
  background: rgba(255, 255, 255, .91); backdrop-filter: blur(18px);
}
.page-heading { flex: 1; min-width: 0; }
.page-heading h1 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -.02em; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.global-search { display: flex; align-items: center; gap: 7px; width: 245px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-soft); }
.global-search span { color: var(--muted-2); font-size: 18px; }
.global-search input { width: 100%; color: var(--ink); background: transparent; border: 0; outline: 0; font-size: 12px; }
.icon-button {
  display: grid; place-items: center; width: 38px; height: 38px; padding: 0;
  color: #5d5f72; background: #fff; border: 1px solid var(--line); border-radius: 11px;
  cursor: pointer; transition: .18s ease;
}
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.notification-button { position: relative; font-size: 12px; }
.notification-button i { position: absolute; top: 7px; right: 8px; width: 7px; height: 7px; background: var(--red); border: 2px solid #fff; border-radius: 50%; }
.mobile-menu, .mobile-school-bar, .mobile-bottom-nav { display: none; }
.content-area { max-width: 1540px; margin: 0 auto; padding: 26px 28px 50px; }

.primary-button, .secondary-button, .ghost-button, .danger-button, .text-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 16px; border-radius: 11px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.primary-button { color: #fff; background: linear-gradient(135deg, #5a50d1, #4037aa); box-shadow: 0 7px 18px rgba(79, 70, 200, .22); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 9px 22px rgba(79, 70, 200, .28); }
.secondary-button { color: var(--primary); background: var(--primary-soft); border-color: #dedbff; }
.ghost-button { color: #55576a; background: #fff; border-color: var(--line); }
.ghost-button:hover, .secondary-button:hover { background: #f5f5ff; }
.danger-button { color: #fff; background: var(--red); }
.text-button { min-height: auto; padding: 4px 0; color: var(--primary); background: transparent; border: 0; }
.primary-button.compact { min-height: 40px; padding: 0 14px; }
.button-small { min-height: 33px; padding: 0 11px; border-radius: 9px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-header { display: flex; align-items: center; gap: 12px; padding: 18px 20px 0; }
.card-header h2, .card-header h3 { flex: 1; margin: 0; font-size: 15px; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.card-body { padding: 18px 20px 20px; }
.section-title { display: flex; align-items: flex-end; gap: 12px; margin: 4px 0 14px; }
.section-title h2 { flex: 1; margin: 0; font-size: 17px; }
.section-title p { margin: 0; color: var(--muted); font-size: 12px; }

.dashboard-hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .8fr);
  gap: 20px; margin-bottom: 22px; padding: 26px; color: #fff; border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 83% 6%, rgba(255, 255, 255, .23), transparent 22%),
    linear-gradient(125deg, #4036a8, #6157d9 58%, #7b72e5);
  box-shadow: 0 18px 38px rgba(63, 54, 168, .24);
}
.dashboard-hero::after {
  position: absolute; right: -48px; bottom: -72px; width: 230px; height: 230px;
  border: 38px solid rgba(255, 255, 255, .08); border-radius: 50%; content: "";
}
.hero-copy { position: relative; z-index: 1; align-self: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; color: #e9e7ff; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .14); border-radius: 99px; font-size: 11px; }
.hero-copy h2 { margin: 13px 0 9px; font-size: clamp(23px, 2.2vw, 31px); line-height: 1.22; letter-spacing: -.03em; }
.hero-copy p { max-width: 600px; margin: 0; color: #d8d5ff; line-height: 1.75; font-size: 13px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 19px; }
.hero-actions .primary-button { color: #373092; background: #fff; box-shadow: 0 8px 20px rgba(28, 23, 91, .18); }
.hero-actions .secondary-button { color: #fff; background: rgba(255, 255, 255, .13); border-color: rgba(255, 255, 255, .22); }
.hero-progress { position: relative; z-index: 1; display: flex; align-items: center; justify-content: center; }
.progress-ring { position: relative; display: grid; place-items: center; width: 150px; height: 150px; border-radius: 50%; background: conic-gradient(#fff var(--progress, 0%), rgba(255, 255, 255, .16) 0); }
.progress-ring::after { position: absolute; inset: 11px; background: #554bc6; border-radius: 50%; content: ""; }
.progress-ring-content { position: relative; z-index: 1; text-align: center; }
.progress-ring-content strong { display: block; font-size: 31px; line-height: 1; }
.progress-ring-content span { display: block; margin-top: 7px; color: #dddaff; font-size: 11px; }
.hero-mini-stats { position: absolute; right: 25px; bottom: 22px; z-index: 2; display: flex; gap: 18px; }
.hero-mini-stats div { text-align: center; }
.hero-mini-stats b { display: block; font-size: 14px; }
.hero-mini-stats span { color: #d8d5ff; font-size: 10px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; margin-bottom: 22px; }
.stat-card { position: relative; overflow: hidden; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-card::after { position: absolute; right: -15px; top: -18px; width: 72px; height: 72px; background: var(--stat-soft, var(--primary-soft)); border-radius: 50%; content: ""; }
.stat-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 11px; }
.stat-icon { display: grid; place-items: center; width: 32px; height: 32px; color: var(--stat-color, var(--primary)); background: var(--stat-soft, var(--primary-soft)); border-radius: 10px; font-size: 15px; }
.stat-value { display: flex; align-items: baseline; gap: 6px; margin-top: 12px; }
.stat-value strong { font-size: 25px; line-height: 1; letter-spacing: -.03em; }
.stat-value span { color: var(--muted); font-size: 11px; }
.stat-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--muted); font-size: 10px; }
.trend-up { color: var(--green); font-weight: 700; }
.trend-down { color: var(--red); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, .75fr); gap: 18px; }
.stack { display: grid; gap: 18px; align-content: start; }
.exam-overview { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 20px; align-items: center; }
.exam-cover {
  position: relative; overflow: hidden; display: grid; place-items: center; min-height: 142px; color: #fff;
  border-radius: 15px; background: linear-gradient(145deg, #34318d, #6860dc);
}
.exam-cover::before { position: absolute; right: -25px; top: -25px; width: 74px; height: 74px; border: 18px solid rgba(255,255,255,.12); border-radius: 50%; content: ""; }
.exam-cover strong { position: relative; z-index: 1; font-size: 32px; }
.exam-cover small { position: absolute; bottom: 11px; z-index: 1; color: #d8d5ff; font-size: 10px; }
.exam-info h3 { margin: 0 0 5px; font-size: 17px; }
.exam-info > p { margin: 0; color: var(--muted); font-size: 11px; }
.exam-meta { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.meta-pill { padding: 4px 8px; color: #5d5f72; background: var(--surface-soft); border-radius: 99px; font-size: 10px; }
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-track { overflow: hidden; flex: 1; height: 7px; background: #ececf3; border-radius: 99px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #8b82f2); border-radius: inherit; }
.progress-value { min-width: 35px; color: var(--muted); font-size: 10px; text-align: right; }
.exam-actions { display: flex; gap: 8px; margin-top: 15px; }

.workflow-list { display: grid; gap: 10px; }
.workflow-item { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; transition: .18s ease; }
.workflow-item:hover { border-color: #d8d5ff; transform: translateX(2px); }
.workflow-index { display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px; color: var(--primary); background: var(--primary-soft); border-radius: 10px; font-weight: 800; }
.workflow-item div { flex: 1; min-width: 0; }
.workflow-item b { display: block; margin-bottom: 3px; font-size: 12px; }
.workflow-item p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.workflow-item .arrow { color: var(--muted-2); }
.task-list { display: grid; gap: 0; }
.task-item { display: flex; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.task-item:last-child { border-bottom: 0; }
.task-marker { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px; background: var(--orange); border-radius: 50%; box-shadow: 0 0 0 4px var(--orange-soft); }
.task-marker.blue { background: var(--blue); box-shadow: 0 0 0 4px var(--blue-soft); }
.task-marker.green { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.task-content { flex: 1; min-width: 0; }
.task-content b { display: block; font-size: 12px; }
.task-content p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.task-time { color: var(--muted-2); font-size: 9px; white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.toolbar-spacer { flex: 1; }
.filter-select, .form-input, .form-select, .form-textarea {
  width: 100%; color: var(--ink); background: #fff; border: 1px solid var(--line-strong);
  border-radius: 10px; outline: 0; transition: border-color .15s ease, box-shadow .15s ease;
}
.filter-select { width: auto; min-width: 120px; height: 38px; padding: 0 30px 0 11px; font-size: 12px; }
.form-input, .form-select { height: 42px; padding: 0 12px; }
.form-textarea { min-height: 90px; padding: 11px 12px; resize: vertical; }
.form-input:focus, .form-select:focus, .form-textarea:focus, .filter-select:focus { border-color: #9e98ee; box-shadow: 0 0 0 3px rgba(79, 70, 200, .1); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group { margin-bottom: 15px; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; margin-bottom: 7px; color: #55576a; font-size: 12px; font-weight: 700; }
.form-hint { margin: 6px 0 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.checkbox-row { display: flex; flex-wrap: wrap; gap: 9px; }
.check-chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 11px; cursor: pointer; }
.check-chip input { accent-color: var(--primary); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { padding: 11px 13px; color: #707286; background: #fafafd; border-bottom: 1px solid var(--line); font-size: 10px; font-weight: 700; text-align: left; }
.data-table td { padding: 12px 13px; border-bottom: 1px solid var(--line); font-size: 11px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfbff; }
.table-primary { font-weight: 700; }
.table-secondary { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.cell-center { text-align: center !important; }
.cell-right { text-align: right !important; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-action { padding: 4px 7px; color: var(--primary); background: transparent; border: 0; border-radius: 7px; font-size: 10px; cursor: pointer; }
.row-action:hover { background: var(--primary-soft); }
.row-action.danger { color: var(--red); }
.row-action.danger:hover { background: var(--red-soft); }

.badge, .status-chip, .type-chip, .score-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 99px; font-size: 9px; font-weight: 700;
}
.badge.green, .status-chip.green { color: var(--green); background: var(--green-soft); }
.badge.orange, .status-chip.orange { color: var(--orange); background: var(--orange-soft); }
.badge.red, .status-chip.red { color: var(--red); background: var(--red-soft); }
.badge.blue, .status-chip.blue { color: var(--blue); background: var(--blue-soft); }
.badge.purple, .status-chip.purple { color: var(--purple); background: #f1eaff; }
.badge.gray, .status-chip.gray { color: #707286; background: #f0f0f5; }
.status-dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.type-chip.single { color: #2863bc; background: #e8f1ff; }
.type-chip.multi { color: #8b4ec0; background: #f2e9ff; }
.type-chip.fill { color: #aa6200; background: #fff1d9; }
.type-chip.subjective { color: #168f68; background: #e5f8f0; }

.empty-state { display: grid; place-items: center; min-height: 230px; padding: 30px; text-align: center; }
.empty-state-icon { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 12px; color: var(--primary); background: var(--primary-soft); border-radius: 18px; font-size: 24px; }
.empty-state h3 { margin: 0 0 7px; font-size: 15px; }
.empty-state p { max-width: 370px; margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.65; }

.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; overflow: hidden; margin-bottom: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.summary-item { padding: 17px 18px; border-right: 1px solid var(--line); }
.summary-item:last-child { border-right: 0; }
.summary-item span { display: block; color: var(--muted); font-size: 10px; }
.summary-item strong { display: block; margin-top: 7px; font-size: 20px; }
.summary-item small { display: block; margin-top: 4px; color: var(--muted-2); font-size: 9px; }

.tabs { display: flex; gap: 5px; padding: 4px; background: #ececf3; border-radius: 11px; }
.tab-button { flex: 1; min-height: 34px; padding: 0 11px; color: #707286; background: transparent; border: 0; border-radius: 8px; font-size: 11px; font-weight: 700; cursor: pointer; }
.tab-button.is-active { color: var(--primary); background: #fff; box-shadow: 0 2px 8px rgba(40, 40, 70, .08); }

.exam-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.exam-card { position: relative; overflow: hidden; padding: 18px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.exam-card::before { position: absolute; inset: 0 0 auto; height: 4px; background: var(--accent, var(--primary)); content: ""; }
.exam-card-head { display: flex; align-items: flex-start; gap: 10px; }
.subject-icon { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; color: var(--accent, var(--primary)); background: color-mix(in srgb, var(--accent, var(--primary)) 12%, white); border-radius: 13px; font-size: 18px; font-weight: 800; }
.exam-card-title { flex: 1; min-width: 0; }
.exam-card-title h3 { overflow: hidden; margin: 0; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.exam-card-title p { margin: 5px 0 0; color: var(--muted); font-size: 10px; }
.exam-card-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 17px 0 14px; }
.exam-card-stat { padding: 10px 8px; background: var(--surface-soft); border-radius: 10px; text-align: center; }
.exam-card-stat b { display: block; font-size: 14px; }
.exam-card-stat span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.exam-card-footer { display: flex; align-items: center; gap: 8px; padding-top: 13px; border-top: 1px solid var(--line); }
.exam-card-footer .progress-track { height: 6px; }
.exam-card-footer .progress-value { min-width: 30px; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 22px; background: rgba(21, 22, 49, .56); backdrop-filter: blur(5px); animation: fade-in .16s ease both;
}
.modal {
  overflow: hidden; width: min(620px, 100%); max-height: calc(100vh - 44px); background: #fff;
  border-radius: 19px; box-shadow: 0 26px 70px rgba(19, 19, 48, .28); animation: modal-in .21s ease both;
}
.modal.modal-wide { width: min(940px, 100%); }
.modal.modal-small { width: min(430px, 100%); }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.modal-header h2 { flex: 1; margin: 0; font-size: 16px; }
.modal-header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.modal-close { display: grid; place-items: center; width: 32px; height: 32px; color: var(--muted); background: var(--surface-soft); border: 0; border-radius: 9px; cursor: pointer; }
.modal-body { overflow-y: auto; max-height: calc(100vh - 200px); padding: 20px 21px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 21px; background: #fafafd; border-top: 1px solid var(--line); }
.modal-section { padding: 16px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 13px; }
.modal-section + .modal-section { margin-top: 12px; }
.modal-section h3 { margin: 0 0 12px; font-size: 12px; }

.toast-root { position: fixed; right: 20px; bottom: 20px; z-index: 150; display: grid; gap: 9px; }
.toast { display: flex; align-items: center; gap: 10px; min-width: 250px; max-width: 390px; padding: 12px 14px; color: #fff; background: #262744; border-radius: 12px; box-shadow: var(--shadow-md); animation: toast-in .22s ease both; }
.toast.success { background: #176d54; }
.toast.error { background: #a8323d; }
.toast.info { background: #36358f; }
.toast-icon { display: grid; place-items: center; width: 24px; height: 24px; background: rgba(255, 255, 255, .15); border-radius: 8px; font-size: 12px; }
.toast p { flex: 1; margin: 0; font-size: 11px; line-height: 1.45; }

.scanner-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(330px, .75fr); gap: 18px; }
.scan-stage-card { min-height: 660px; }
.scan-stage-head { display: flex; align-items: center; gap: 12px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.scan-stage-head h2 { flex: 1; margin: 0; font-size: 15px; }
.scan-status { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; }
.scan-status i { width: 7px; height: 7px; background: var(--green); border-radius: 50%; box-shadow: 0 0 0 4px var(--green-soft); }
.scan-stage { display: grid; place-items: center; min-height: 555px; padding: 20px; background:
  linear-gradient(45deg, #f3f3f8 25%, transparent 25%), linear-gradient(-45deg, #f3f3f8 25%, transparent 25%),
  linear-gradient(45deg, transparent 75%, #f3f3f8 75%), linear-gradient(-45deg, transparent 75%, #f3f3f8 75%);
  background-size: 18px 18px; background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}
.scan-dropzone { width: min(470px, 100%); padding: 42px 28px; text-align: center; background: rgba(255, 255, 255, .95); border: 1.5px dashed #c9c7e4; border-radius: 18px; }
.scan-dropzone.is-dragging { border-color: var(--primary); background: #f7f6ff; }
.scan-illus { position: relative; display: grid; place-items: center; width: 92px; height: 116px; margin: 0 auto 19px; color: var(--primary); background: #f0efff; border: 2px solid #d9d6ff; border-radius: 13px; font-size: 34px; transform: rotate(-3deg); }
.scan-illus::after { position: absolute; right: -13px; bottom: -10px; display: grid; place-items: center; width: 40px; height: 40px; color: #fff; background: var(--primary); border: 4px solid #fff; border-radius: 50%; font-size: 17px; content: "＋"; }
.scan-dropzone h3 { margin: 0 0 7px; font-size: 16px; }
.scan-dropzone p { margin: 0 auto 18px; color: var(--muted); font-size: 11px; line-height: 1.65; }
.scan-dropzone-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 9px; }
.scan-tips { display: flex; align-items: center; justify-content: center; gap: 13px; margin-top: 20px; color: var(--muted-2); font-size: 9px; }
.scan-canvas-wrap { position: relative; display: none; width: min(570px, 100%); }
.scan-canvas-wrap.is-visible { display: block; }
#scan-canvas { display: block; width: 100%; height: auto; background: #fff; border-radius: 12px; box-shadow: 0 9px 30px rgba(24, 25, 50, .16); touch-action: none; cursor: crosshair; }
.corner-label { position: absolute; display: grid; place-items: center; width: 22px; height: 22px; color: #fff; background: var(--red); border: 2px solid #fff; border-radius: 50%; font-size: 9px; font-weight: 800; pointer-events: none; box-shadow: 0 2px 7px rgba(0,0,0,.22); }
.canvas-help { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 12px; padding: 9px 12px; color: #fff; background: rgba(34, 35, 68, .86); border-radius: 10px; font-size: 10px; text-align: center; }
.canvas-help b { color: #dddaff; }

.scan-steps { display: grid; gap: 0; }
.scan-step { position: relative; display: flex; gap: 11px; padding-bottom: 19px; }
.scan-step:last-child { padding-bottom: 0; }
.scan-step::before { position: absolute; left: 13px; top: 29px; bottom: 2px; width: 1px; background: var(--line); content: ""; }
.scan-step:last-child::before { display: none; }
.step-number { position: relative; z-index: 1; display: grid; place-items: center; flex: 0 0 auto; width: 27px; height: 27px; color: var(--muted); background: #fff; border: 1px solid var(--line-strong); border-radius: 50%; font-size: 10px; font-weight: 800; }
.scan-step.is-active .step-number { color: #fff; background: var(--primary); border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.scan-step.is-done .step-number { color: #fff; background: var(--green); border-color: var(--green); }
.step-content { flex: 1; min-width: 0; padding-top: 3px; }
.step-content b { display: block; margin-bottom: 5px; font-size: 12px; }
.step-content p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.step-content .form-select { margin-top: 8px; height: 36px; font-size: 11px; }
.step-badge { display: inline-flex; margin-top: 7px; padding: 3px 7px; color: var(--green); background: var(--green-soft); border-radius: 99px; font-size: 9px; font-weight: 700; }
.scan-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 15px; }
.scan-actions .primary-button { grid-column: span 2; }

.result-panel { display: none; margin-top: 17px; padding-top: 17px; border-top: 1px solid var(--line); }
.result-panel.is-visible { display: block; animation: fade-up .25s ease both; }
.result-score { display: flex; align-items: center; gap: 13px; padding: 14px; background: linear-gradient(135deg, #f2f1ff, #f8f8ff); border: 1px solid #e2dfff; border-radius: 13px; }
.result-score-value { display: grid; place-items: center; width: 58px; height: 58px; color: #fff; background: var(--primary); border-radius: 17px; font-size: 20px; font-weight: 800; }
.result-score-copy { flex: 1; }
.result-score-copy b { display: block; margin-bottom: 4px; font-size: 13px; }
.result-score-copy p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.answer-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; margin-top: 12px; }
.answer-bubble { display: grid; place-items: center; aspect-ratio: 1; color: #707286; background: #f7f7fa; border: 1px solid var(--line); border-radius: 9px; font-size: 10px; font-weight: 800; }
.answer-bubble.correct { color: var(--green); background: var(--green-soft); border-color: #c7eddf; }
.answer-bubble.wrong { color: var(--red); background: var(--red-soft); border-color: #f5c9ce; }
.answer-bubble.pending { color: var(--orange); background: var(--orange-soft); border-color: #f7d9a6; }

.low-confidence-list { display: grid; gap: 9px; margin-top: 12px; }
.confidence-item { display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.confidence-item b { flex: 1; font-size: 11px; }
.confidence-score { color: var(--orange); font-size: 10px; font-weight: 700; }
.review-shell { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 17px; min-height: 700px; }
.review-queue { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.queue-head { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.queue-head h2 { flex: 1; margin: 0; font-size: 14px; }
.queue-head span { color: var(--muted); font-size: 10px; }
.queue-search { margin: 12px; }
.queue-search input { width: 100%; height: 36px; padding: 0 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); outline: 0; font-size: 11px; }
.queue-list { overflow-y: auto; max-height: 625px; padding: 0 8px 10px; }
.queue-item { display: flex; align-items: center; gap: 9px; padding: 11px 9px; border-bottom: 1px solid var(--line); cursor: pointer; }
.queue-item:last-child { border-bottom: 0; }
.queue-item:hover, .queue-item.is-active { background: #f7f6ff; border-radius: 10px; }
.queue-item.is-active { border-bottom-color: transparent; }
.queue-avatar { display: grid; place-items: center; flex: 0 0 auto; width: 35px; height: 35px; color: var(--primary); background: var(--primary-soft); border-radius: 11px; font-size: 12px; font-weight: 800; }
.queue-item div { flex: 1; min-width: 0; }
.queue-item b { display: block; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.queue-item p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.queue-progress { width: 40px; }
.queue-progress .progress-track { height: 4px; }
.queue-progress span { display: block; margin-top: 4px; color: var(--muted-2); font-size: 8px; text-align: right; }

.review-workspace { overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.workspace-head { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.workspace-head h2 { flex: 1; margin: 0; font-size: 14px; }
.workspace-head p { margin: 4px 0 0; color: var(--muted); font-size: 9px; }
.workspace-body { display: grid; grid-template-columns: minmax(300px, .82fr) minmax(390px, 1.18fr); min-height: 625px; }
.answer-preview { position: relative; overflow: hidden; padding: 18px; background: #eeedf4; border-right: 1px solid var(--line); }
.paper-sheet { position: relative; width: min(100%, 390px); min-height: 560px; margin: auto; padding: 25px 23px; background: #fff; box-shadow: 0 10px 30px rgba(25, 25, 50, .12); }
.paper-sheet::before { position: absolute; inset: 13px; border: 1px solid #ececf3; content: ""; pointer-events: none; }
.paper-sheet h3 { position: relative; margin: 0 0 14px; text-align: center; font-size: 14px; }
.paper-student-line { position: relative; display: flex; gap: 20px; padding-bottom: 13px; border-bottom: 1px solid #dedee8; color: #55576a; font-size: 10px; }
.paper-objective { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px 8px; margin-top: 14px; }
.paper-question { font-size: 9px; }
.paper-question b { display: inline-block; min-width: 17px; }
.paper-options { display: inline-flex; gap: 3px; }
.paper-option { display: grid; place-items: center; width: 14px; height: 14px; border: 1px solid #a9aab9; border-radius: 50%; font-size: 7px; }
.paper-option.filled { color: #fff; background: #24243c; border-color: #24243c; }
.paper-option.correct { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-soft); }
.paper-option.wrong { border-color: var(--red); box-shadow: 0 0 0 2px var(--red-soft); }
.paper-subjective { position: relative; margin-top: 20px; }
.paper-subjective-title { margin: 12px 0 7px; font-size: 10px; font-weight: 700; }
.answer-lines { display: grid; gap: 8px; }
.answer-line { height: 1px; background: #d8d8e2; }
.handwriting { position: absolute; top: 0; left: 22px; color: #3461bb; font-family: "KaiTi", serif; font-size: 13px; transform: rotate(-2deg); }
.preview-tools { display: flex; justify-content: center; gap: 7px; margin-top: 13px; }
.preview-tool { display: grid; place-items: center; width: 34px; height: 34px; color: #5d5f72; background: #fff; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.grading-panel { overflow-y: auto; max-height: 625px; padding: 18px; }
.grading-title { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.grading-title h3 { flex: 1; margin: 0; font-size: 14px; }
.grading-title span { color: var(--muted); font-size: 10px; }
.rubric-box { margin-bottom: 14px; padding: 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.rubric-box b { display: block; margin-bottom: 7px; font-size: 11px; }
.rubric-box p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }
.rubric-points { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.rubric-point { padding: 4px 7px; color: var(--green); background: var(--green-soft); border-radius: 7px; font-size: 9px; }
.score-editor { display: grid; grid-template-columns: 1fr 90px; gap: 9px; margin-bottom: 12px; }
.score-input-wrap { position: relative; }
.score-input { width: 100%; height: 43px; padding: 0 35px 0 12px; color: var(--primary); background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; font-size: 16px; font-weight: 800; outline: 0; }
.score-input:focus { border-color: #9e98ee; box-shadow: 0 0 0 3px rgba(79, 70, 200, .1); }
.score-max { position: absolute; right: 11px; top: 14px; color: var(--muted); font-size: 11px; }
.quick-score { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.quick-score button { min-height: 31px; color: #55576a; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-size: 10px; cursor: pointer; }
.quick-score button.is-active { color: var(--primary); background: var(--primary-soft); border-color: #cfcaff; }
.grade-comment { width: 100%; min-height: 72px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; outline: 0; resize: vertical; font-size: 11px; }
.grade-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 15px; }
.grade-nav .primary-button { flex: 1; }

.analysis-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr); gap: 18px; }
.chart-card { min-height: 340px; }
.chart-wrap { position: relative; height: 250px; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 220px; padding: 15px 5px 0; border-bottom: 1px solid var(--line); }
.bar-column { display: flex; align-items: flex-end; justify-content: center; flex: 1; height: 100%; }
.bar-stack { position: relative; width: min(48px, 62%); height: 100%; }
.bar-value { position: absolute; top: -19px; width: 100%; color: var(--muted); font-size: 9px; text-align: center; }
.bar { position: absolute; inset: auto 0 0; height: var(--bar-height); background: linear-gradient(180deg, #837ae9, #554bca); border-radius: 7px 7px 0 0; transition: height .5s ease; }
.bar.second { background: linear-gradient(180deg, #6fcab0, #2ba17b); }
.bar.third { background: linear-gradient(180deg, #f3be6b, #df8a20); }
.bar-labels { display: flex; gap: 12px; padding: 8px 5px 0; }
.bar-labels span { flex: 1; color: var(--muted); font-size: 10px; text-align: center; }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 25px; min-height: 250px; }
.donut { position: relative; display: grid; place-items: center; width: 142px; height: 142px; border-radius: 50%; background: conic-gradient(var(--green) 0 var(--pass), var(--orange) var(--pass) var(--good), var(--red) var(--good) 100%); }
.donut::after { position: absolute; inset: 20px; background: #fff; border-radius: 50%; content: ""; }
.donut-center { position: relative; z-index: 1; text-align: center; }
.donut-center strong { display: block; font-size: 23px; }
.donut-center span { color: var(--muted); font-size: 9px; }
.legend { display: grid; gap: 10px; }
.legend-item { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.legend-dot { width: 8px; height: 8px; border-radius: 3px; }
.legend-item b { margin-left: 4px; color: var(--ink); }
.distribution { display: flex; align-items: flex-end; gap: 7px; height: 190px; padding-top: 24px; }
.dist-col { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; }
.dist-bar-wrap { display: flex; align-items: flex-end; flex: 1; width: 100%; }
.dist-bar { width: 100%; min-height: 2px; height: var(--dist-height); background: #c8c4f4; border-radius: 5px 5px 0 0; }
.dist-bar:hover { background: var(--primary); }
.dist-count { margin-top: 5px; color: var(--muted); font-size: 8px; }
.dist-label { margin-top: 3px; color: var(--muted); font-size: 8px; white-space: nowrap; }
.insight-list { display: grid; gap: 11px; }
.insight-item { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.insight-icon { display: grid; place-items: center; flex: 0 0 auto; width: 31px; height: 31px; color: var(--primary); background: var(--primary-soft); border-radius: 9px; }
.insight-item.warning .insight-icon { color: var(--orange); background: var(--orange-soft); }
.insight-item.success .insight-icon { color: var(--green); background: var(--green-soft); }
.insight-item b { display: block; margin-bottom: 4px; font-size: 11px; }
.insight-item p { margin: 0; color: var(--muted); font-size: 9px; line-height: 1.55; }

.ranking-layout { display: grid; grid-template-columns: minmax(0, 1fr) 305px; gap: 18px; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 10px; margin: 6px 0 17px; }
.podium-item { padding: 16px 8px 12px; color: #fff; border-radius: 14px 14px 10px 10px; text-align: center; }
.podium-item.first { min-height: 126px; background: linear-gradient(150deg, #f4b43d, #d98207); }
.podium-item.second { min-height: 103px; background: linear-gradient(150deg, #9daac3, #738099); }
.podium-item.third { min-height: 92px; background: linear-gradient(150deg, #d7996e, #ad6845); }
.podium-rank { display: grid; place-items: center; width: 27px; height: 27px; margin: 0 auto 7px; background: rgba(255,255,255,.22); border-radius: 9px; font-weight: 800; }
.podium-item b { display: block; font-size: 13px; }
.podium-item span { display: block; margin-top: 4px; color: rgba(255,255,255,.82); font-size: 9px; }
.podium-item strong { display: block; margin-top: 7px; font-size: 19px; }
.ranking-number { display: inline-grid; place-items: center; width: 25px; height: 25px; color: #5d5f72; background: #f1f1f6; border-radius: 8px; font-size: 10px; font-weight: 800; }
.ranking-number.top { color: #a86300; background: #fff0d0; }
.score-strong { color: var(--primary); font-size: 13px; font-weight: 800; }
.rate-high { color: var(--green); font-weight: 700; }
.rate-low { color: var(--red); font-weight: 700; }
.report-list { display: grid; gap: 9px; }
.report-item { display: flex; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; transition: .17s ease; }
.report-item:hover { border-color: #d7d3ff; background: #faf9ff; transform: translateY(-1px); }
.report-icon { display: grid; place-items: center; width: 33px; height: 33px; color: var(--primary); background: var(--primary-soft); border-radius: 9px; }
.report-item div { flex: 1; }
.report-item b { display: block; font-size: 11px; }
.report-item p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }

.settings-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; }
.settings-menu { align-self: start; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.settings-menu button { display: block; width: 100%; padding: 11px 12px; color: var(--muted); background: transparent; border: 0; border-radius: 9px; font-size: 11px; text-align: left; cursor: pointer; }
.settings-menu button.is-active { color: var(--primary); background: var(--primary-soft); font-weight: 700; }
.settings-block + .settings-block { margin-top: 16px; }
.settings-row { display: flex; align-items: center; gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row div { flex: 1; }
.settings-row b { display: block; font-size: 12px; }
.settings-row p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.switch { position: relative; width: 42px; height: 24px; }
.switch input { width: 0; height: 0; opacity: 0; }
.switch span { position: absolute; inset: 0; background: #d4d4df; border-radius: 99px; cursor: pointer; transition: .2s; }
.switch span::before { position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,.16); content: ""; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exam-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ranking-layout, .analysis-grid { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .scanner-layout { grid-template-columns: 1fr; }
  .scan-stage-card { min-height: auto; }
}

@media (max-width: 900px) {
  :root { --topbar-height: 66px; }
  .sidebar { transform: translateX(-100%); box-shadow: 20px 0 45px rgba(15,15,40,.25); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; display: block; background: rgba(20,20,45,.35); }
  .main-shell { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .mobile-menu { display: grid; place-items: center; width: 37px; height: 37px; color: #55576a; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
  .topbar .global-search, .topbar .notification-button, .topbar .primary-button { display: none; }
  .page-heading h1 { font-size: 18px; }
  .page-heading p { display: none; }
  .mobile-school-bar { display: flex; align-items: center; gap: 7px; padding: 10px 16px 0; color: var(--muted); font-size: 10px; }
  .mobile-school-bar .school-avatar { width: 24px; height: 24px; color: #4f46c8; background: #e8e6ff; font-size: 10px; }
  .content-area { padding: 16px 16px 88px; }
  .mobile-bottom-nav {
    position: fixed; right: 0; bottom: 0; left: 0; z-index: 35; display: grid; grid-template-columns: repeat(5, 1fr);
    width: 100vw; max-width: 100vw; overflow: hidden;
    padding: 7px 8px max(7px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(16px);
  }
  .mobile-bottom-nav button { display: grid; place-items: center; gap: 2px; min-width: 0; padding: 3px; color: var(--muted); background: transparent; border: 0; font-size: 9px; }
  .mobile-bottom-nav button span { font-size: 17px; }
  .mobile-bottom-nav button.is-active { color: var(--primary); font-weight: 700; }
  .mobile-bottom-nav i { position: absolute; width: 5px; height: 5px; margin: -20px 0 0 22px; background: var(--red); border-radius: 50%; }
  .dashboard-hero { grid-template-columns: 1fr; padding: 22px; }
  .hero-progress { justify-content: flex-start; }
  .hero-mini-stats { display: none; }
  .review-shell { grid-template-columns: 1fr; }
  .review-queue { max-height: 285px; }
  .queue-list { max-height: 190px; }
  .workspace-body { grid-template-columns: 1fr; }
  .answer-preview { border-right: 0; border-bottom: 1px solid var(--line); }
  .paper-sheet { min-height: 520px; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .stats-grid, .summary-strip, .form-row, .exam-cards, .exam-card-stats { grid-template-columns: 1fr; }
  .summary-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-item:last-child { border-bottom: 0; }
  .exam-overview { grid-template-columns: 96px minmax(0, 1fr); }
  .exam-cover { min-height: 115px; }
  .exam-actions { flex-wrap: wrap; }
  .dashboard-hero { margin-bottom: 15px; border-radius: 17px; }
  .hero-copy h2 { font-size: 22px; }
  .stat-card { padding: 15px; }
  .toolbar { align-items: stretch; }
  .toolbar .filter-select, .toolbar .primary-button, .toolbar .ghost-button { width: 100%; }
  .toolbar-spacer { display: none; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; }
  .modal-body { max-height: calc(92vh - 142px); }
  .scan-stage { min-height: 410px; padding: 12px; }
  .scan-dropzone { padding: 31px 17px; }
  .scan-actions { grid-template-columns: 1fr; }
  .scan-actions .primary-button { grid-column: auto; }
  .answer-grid { grid-template-columns: repeat(5, 1fr); }
  .podium { gap: 6px; }
  .podium-item { padding: 12px 5px 9px; }
  .grading-panel { max-height: none; }
  .review-workspace { overflow: visible; }
  .toast-root { right: 10px; bottom: 79px; left: 10px; }
  .toast { min-width: 0; max-width: none; }
}

/* ============================ 答题卡模板库 ============================ */
.template-guide { margin-bottom: 16px; }
.template-guide-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.template-guide-grid > div { display: flex; gap: 10px; padding: 13px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.template-guide-grid p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.template-guide-grid b { color: var(--ink); }
.guide-step { display: grid; place-items: center; flex: 0 0 26px; width: 26px; height: 26px; color: #fff; background: var(--primary); border-radius: 9px; font-size: 12px; font-weight: 700; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(370px, 1fr)); gap: 16px; margin-bottom: 16px; }
.template-card { display: flex; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.template-thumb { flex: 0 0 120px; overflow: hidden; height: 170px; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; }
.template-thumb canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.template-info { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.template-info h3 { margin: 0 0 4px; font-size: 14px; }
.template-info > p { margin: 0; color: var(--muted); font-size: 11px; }
.template-info .meta-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.meta-pill { padding: 4px 8px; color: #5b5d73; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; font-size: 10px; }
.template-bound { margin-top: auto; color: var(--muted-2) !important; }
.template-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }

/* ============================ 模板编辑器 ============================ */
.editor-shell { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.editor-form { min-width: 0; }
.editor-form .modal-section:first-child { margin-top: 0; }
.editor-table { white-space: normal; }
.editor-table th, .editor-table td { min-width: 88px; }
.editor-table td:first-child { min-width: 210px; }
.editor-table .form-input, .editor-table .form-select { padding: 6px 8px; font-size: 11px; }
.editor-multi-cell { min-width: 210px !important; }
.answer-input { max-width: 110px; letter-spacing: .1em; text-transform: uppercase; }
.editor-preview { position: sticky; top: 0; padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.editor-preview-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 12px; }
.editor-preview canvas { display: block; width: 100%; height: auto; background: #fff; border-radius: 6px; box-shadow: var(--shadow-md); }
.scan-detail { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.scan-detail-image img { width: 100%; border: 1px solid var(--line); border-radius: 10px; }

/* ============================ 展台扫描 ============================ */
.camera-setup { padding: 18px; background: linear-gradient(160deg, #f6f5ff, #eef2ff); border: 1px dashed var(--primary); border-radius: var(--radius); }
.camera-setup-head { display: flex; gap: 12px; align-items: flex-start; }
.camera-setup-head b { font-size: 14px; }
.camera-setup-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.7; }
.camera-icon { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; color: #fff; background: var(--primary); border-radius: 12px; font-size: 19px; }
.camera-setup-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.camera-setup-row .form-select { flex: 1; min-width: 220px; }
.camera-note { margin-top: 12px; padding: 10px 12px; color: #6b5f2a; background: #fffaf0; border: 1px solid #f2e3bd; border-radius: 10px; font-size: 10px; line-height: 1.7; }
.live-wrap { position: relative; overflow: hidden; background: #10112a; border-radius: var(--radius); }
.live-wrap video { display: block; width: 100%; max-height: 62vh; object-fit: contain; background: #10112a; }
.live-badge { position: absolute; top: 12px; left: 12px; padding: 5px 11px; color: #fff; background: rgba(32, 33, 84, .78); border-radius: 999px; font-size: 11px; }
.live-hint { position: absolute; right: 12px; bottom: 66px; left: 12px; padding: 8px 12px; color: #fff; background: rgba(16, 17, 42, .72); border-radius: 10px; font-size: 11px; }
.live-actions { position: absolute; right: 12px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 8px; }
.auto-grade-note { margin-top: 16px; padding: 13px 14px; background: var(--green-soft); border: 1px solid #cdeee0; border-radius: var(--radius); }
.auto-grade-note b { font-size: 12px; }
.auto-grade-note p { margin: 5px 0 8px; color: #3f6f5c; font-size: 11px; line-height: 1.7; }

/* ============================ 扫描批次 ============================ */
.batch-card { margin-top: 16px; }
.batch-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.stat-pill { padding: 8px 14px; color: var(--muted); background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; font-size: 11px; }
.stat-pill b { color: var(--ink); font-size: 14px; }
.batch-list { display: grid; gap: 10px; }
.batch-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.batch-thumb { width: 74px; height: 100px; object-fit: cover; background: var(--surface-soft); border: 1px solid var(--line-strong); border-radius: 8px; }
.batch-thumb.placeholder { display: grid; place-items: center; color: var(--muted); font-size: 20px; }
.batch-main { min-width: 0; }
.batch-main b { font-size: 13px; }
.batch-main p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.batch-detail { color: var(--muted-2) !important; }
.batch-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; max-width: 430px; }
.batch-select { min-width: 200px; }
.batch-footer { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.text-warning { color: var(--orange); }

/* ============================ 主观题小问评分 ============================ */
.sub-score-list { display: grid; gap: 8px; margin-top: 11px; }
.sub-score-row { display: grid; grid-template-columns: 96px 96px minmax(0, 1fr); gap: 8px; align-items: center; }
.sub-label { color: var(--muted); font-size: 11px; }
.sub-score-row .score-input { width: 100%; }
.sub-score-row .quick-score { display: flex; gap: 5px; }
.sub-score-row .quick-score button { padding: 4px 9px; color: var(--primary); background: var(--primary-soft); border: 0; border-radius: 7px; font-size: 10px; cursor: pointer; }
.sub-score-row .quick-score button.is-active { color: #fff; background: var(--primary); }
.sub-total { margin-top: 7px; color: var(--muted); font-size: 11px; text-align: right; }
.sub-total b { color: var(--primary); font-size: 13px; }
.scan-source { margin-bottom: 14px; padding: 12px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: var(--radius); }
.scan-source-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 9px; }
.scan-source-head b { font-size: 12px; }
.scan-source-head span { color: var(--muted); font-size: 10px; }
.scan-source img { display: block; width: 100%; border: 1px solid var(--line-strong); border-radius: 8px; }

@media (max-width: 1080px) {
  .template-guide-grid { grid-template-columns: 1fr; }
  .editor-shell { grid-template-columns: 1fr; }
  .editor-preview { position: static; }
  .scan-detail { grid-template-columns: 1fr; }
  .batch-row { grid-template-columns: 64px minmax(0, 1fr); }
  .batch-actions { grid-column: 1 / -1; max-width: none; justify-content: flex-start; }
}

@media (max-width: 620px) {
  .template-grid { grid-template-columns: 1fr; }
  .template-card { flex-direction: column; }
  .template-thumb { height: 220px; }
  .batch-row { grid-template-columns: 1fr; }
  .batch-thumb { width: 100%; height: 160px; }
}

@media print {
  .sidebar, .topbar, .mobile-bottom-nav, .toolbar, .no-print, .report-list { display: none !important; }
  .main-shell { margin: 0; }
  .content-area { max-width: none; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
}

.version-chip { padding: 8px 12px; color: #4f46c8; background: #f1efff; border: 1px solid #dcd7ff; border-radius: 9px; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.version-chip:hover { background: #e8e4ff; }
