/* ============================================================
   阅+教务系统 ·「阅读生长」视觉系统
   品牌线索：稿纸边线 / 新芽 / 朱红批注 / 清晰的工作台层级
   ============================================================ */
:root {
  --bg: #edf3eb;
  --surface: #ffffff;
  --surface-warm: #f6f9f4;

  --primary: #155b45;
  --primary-strong: #0f4636;
  --primary-soft: #e4eee0;
  --on-primary: #ffffff;

  --accent: #c74f3d;
  --accent-strong: #a83f31;
  --accent-soft: #f8e8e3;

  --leaf: #89a962;
  --gold: #c58a25;
  --ok: #2f7658;
  --ok-strong: #245d46;
  --danger: #b84436;
  --danger-strong: #93362c;

  --text: #23312a;
  --muted: #66736b;
  --faint: #89958d;

  --border: #d8e3d5;
  --border-strong: #c3d2bf;

  /* 间距（只用这 6 档） */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px;

  /* 圆角 */
  --r-sm: 8px; --r: 12px; --r-lg: 20px;

  /* 阴影（暖色调投影） */
  --sh-1: 0 1px 2px rgba(21, 67, 50, .06), 0 5px 16px rgba(21, 67, 50, .05);
  --sh-2: 0 12px 30px rgba(21, 67, 50, .10);
  --sh-3: 0 24px 64px rgba(21, 67, 50, .16);

  --sans: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  --serif: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--text); background: var(--bg);
  display: flex; flex-direction: column; height: 100vh;
  font-size: 14px; line-height: 1.6;
}
h1, h2, h3, h4 { font-family: var(--serif); color: var(--text); font-weight: 700; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; gap: var(--sp-6);
  background: var(--primary); color: #fff; padding: 0 var(--sp-5); height: 58px;
  flex: 0 0 auto; box-shadow: var(--sh-1);
}
.brand {
  padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer;
  font-family: var(--serif); font-size: 21px; font-weight: 700; letter-spacing: 1px;
}
.brand:disabled { cursor: default; }
.nav { display: flex; gap: var(--sp-1); }
.nav-btn {
  background: transparent; color: rgba(255,255,255,.78); border: none; cursor: pointer;
  font-size: 15px; padding: 8px 16px; border-radius: var(--r-sm); transition: background .15s, color .15s;
}
.nav-btn:hover { background: rgba(255,255,255,.12); color: #fff; }
.nav-btn.active { background: rgba(255,255,255,.20); color: #fff; font-weight: 700; }
.nav-btn[hidden] { display: none !important; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.ghost-btn {
  background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35);
  padding: 7px 14px; border-radius: var(--r-sm); cursor: pointer; font-size: 13px; transition: background .15s;
}
.ghost-btn:hover { background: rgba(255,255,255,.24); }
.current-teacher { color: #fff; font-size: 14px; align-self: center; opacity: .95; }

.help-panel {
  display: none; background: var(--surface-warm); border-bottom: 1px solid var(--border);
  padding: var(--sp-3) var(--sp-6); font-size: 14px; line-height: 1.7; color: var(--muted);
}
.help-panel ol { margin: 6px 0 0; padding-left: 22px; }

/* ---------- 头像 ---------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; overflow: hidden; vertical-align: middle; flex: 0 0 auto;
}
.avatar img { object-fit: cover; border-radius: 50%; display: block; }
.avatar-initial { color: #fff; font-weight: 700; line-height: 1; }

/* ============================================================
   通用组件
   ============================================================ */
.view { flex: 1 1 auto; overflow: hidden; }
.panel { background: var(--surface); border-radius: var(--r); box-shadow: var(--sh-1); }
.card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  border: 1px solid var(--border);
}

/* 按钮统一 */
.primary-btn, .danger-btn {
  border: none; border-radius: var(--r-sm); cursor: pointer;
  padding: 10px 16px; font-size: 14px; font-family: inherit;
  transition: background .15s, box-shadow .15s; line-height: 1.2;
}
.primary-btn { background: var(--primary); color: var(--on-primary); }
.primary-btn:hover { background: var(--primary-strong); }
.primary-btn.big { padding: 13px 20px; font-size: 16px; }
.danger-btn { background: var(--danger); color: #fff; }
.danger-btn:hover { background: var(--danger-strong); }
.primary-btn:focus-visible, .danger-btn:focus-visible, .ghost-btn:focus-visible,
.tool-btn:focus-visible, .file-btn:focus-visible {
  outline: none; box-shadow: 0 0 0 3px var(--primary-soft);
}

.empty { color: var(--faint); padding: var(--sp-4); }
.empty.big { font-size: 16px; padding: 40px; text-align: center; }

/* 表单统一 */
select, input[type="text"], input[type="password"], .login-card input, textarea {
  padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font-size: 14px; font-family: inherit; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input[type="text"]:focus, input[type="password"]:focus,
.login-card input:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
::placeholder { color: var(--faint); }

/* ---------- 我的资料 ---------- */
.profile-view { flex: 1 1 auto; overflow-y: auto; padding: var(--sp-6); display: block; }
.profile-card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  border: 1px solid var(--border); max-width: 480px; margin: 0 auto; padding: var(--sp-6) 28px;
}
.profile-card h2 { margin: 0 0 var(--sp-5); }
.profile-row { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.profile-row > label { flex: 0 0 76px; color: var(--muted); font-size: 14px; }
.profile-row input[type="text"] { flex: 1; }
.avatar-preview { width: 72px; height: 72px; }
.avatar-modes { display: flex; gap: var(--sp-5); }
.avatar-modes label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.avatar-colors { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.color-sw {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 3px solid transparent; box-sizing: content-box;
}
.color-sw.sel { border-color: var(--text); }
.profile-actions { display: flex; align-items: center; gap: var(--sp-4); margin-top: var(--sp-2); }
.profile-msg { color: var(--ok); font-size: 14px; }

/* ---------- 月度统计 ---------- */
.stats-view { flex: 1 1 auto; overflow-y: auto; padding: var(--sp-6); display: block; }
.stats-card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-1);
  border: 1px solid var(--border); max-width: 720px; margin: 0 auto; padding: var(--sp-6) 28px;
}
.stats-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.stats-month { font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--primary); min-width: 92px; text-align: center; }
.stats-total { margin-left: auto; color: var(--muted); font-size: 14px; }
.stats-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.stats-row { display: flex; align-items: center; gap: var(--sp-3); padding: 8px; border-radius: var(--r-sm); }
.stats-row.me { background: var(--primary-soft); }
.stats-name { flex: 0 0 120px; font-size: 14px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats-bar { flex: 1; height: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.stats-bar-fill { display: block; height: 100%; background: var(--primary); border-radius: 7px; }
.stats-count { flex: 0 0 56px; text-align: right; font-size: 14px; font-weight: 700; color: var(--primary); }
.stats-empty { color: var(--faint); font-size: 14px; padding: var(--sp-6) 0; text-align: center; }

/* ---------- 登录 ---------- */
.view-login {
  flex: 1 1 auto; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(47,75,110,.07), transparent 70%),
    var(--bg);
  padding: var(--sp-6);
}
.login-card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-3);
  border: 1px solid var(--border);
  padding: 40px 32px 32px; width: 360px; display: flex; flex-direction: column; gap: var(--sp-3);
}
.login-brand { text-align: center; margin-bottom: var(--sp-2); }
.login-seal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px; border-radius: 14px; margin-bottom: var(--sp-3);
  background: var(--accent); color: #fff; font-family: var(--serif);
  font-size: 30px; font-weight: 700; box-shadow: var(--sh-1);
}
.login-card h1 { margin: 0; font-family: var(--serif); font-size: 26px; text-align: center; color: var(--primary); letter-spacing: 2px; }
.login-sub { margin: 6px 0 var(--sp-3); text-align: center; color: var(--muted); font-size: 14px; }
.login-card input { padding: 11px 13px; font-size: 15px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; }
.login-actions { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-1); }
.login-actions .primary-btn { width: 100%; }
.login-actions .ghost-btn {
  background: var(--surface); color: var(--primary); border: 1px solid var(--border-strong);
}
.login-actions .ghost-btn:hover { background: var(--primary-soft); }

/* ============================================================
   学生档案
   ============================================================ */
#view-students { display: flex; gap: var(--sp-4); padding: var(--sp-4); }
.student-panel {
  flex: 0 0 280px; padding: var(--sp-4); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.add-row { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.add-row input { flex: 1; }
.grade-select, .class-input { flex: 1; }
.filter-row { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.filter-row select { flex: 1; }
.search { margin-bottom: var(--sp-3); width: 100%; }
.student-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.student-list li {
  padding: 11px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 15px;
  display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2);
  transition: background .12s;
}
.student-list li:hover { background: var(--primary-soft); }
.student-list li.active { background: var(--primary); color: #fff; font-weight: 700; }
.student-list li.active .stu-tag { color: rgba(255,255,255,.8); }
.student-list li.empty { cursor: default; color: var(--faint); }
.stu-tag { font-size: 12px; color: var(--faint); white-space: nowrap; }
.detail-tag {
  background: var(--primary-soft); color: var(--primary); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 600;
}

.detail-panel {
  flex: 1; padding: var(--sp-5); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--sh-1);
}
.detail-head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-5); }
.detail-head h2 { margin: 0; }
.detail-stat { color: var(--muted); font-size: 15px; }
.detail-head .primary-btn { margin-left: auto; }

.submission-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--sp-4);
}
.sub-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden; cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.sub-card:hover { box-shadow: var(--sh-2); transform: translateY(-2px); }
.sub-thumb {
  position: relative; height: 130px; background: var(--surface-warm);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
.sub-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sub-badge {
  position: absolute; top: 8px; right: 8px;
  background: var(--primary); color: #fff; font-weight: 700; font-size: 14px;
  padding: 3px 9px; border-radius: 999px; box-shadow: var(--sh-1); letter-spacing: .5px;
}
.sub-badge.unrated { background: var(--faint); }
.sub-meta { padding: var(--sp-2) var(--sp-3) var(--sp-3); display: flex; flex-direction: column; gap: 6px; }
.sub-meta-top { display: flex; justify-content: space-between; align-items: center; }
.sub-rating { font-weight: 700; color: var(--primary); font-size: 18px; }
.sub-date { font-size: 12px; color: var(--faint); }
.sub-teacher { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.tch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   批改
   ============================================================ */
.grader-view { display: flex; }
.tools {
  flex: 0 0 196px; background: var(--surface); padding: var(--sp-4); overflow-y: auto;
  border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: var(--sp-5);
}
.tool-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.tool-sec-title {
  font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--faint);
  text-transform: uppercase; margin: 0 0 2px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.tool-btn {
  background: var(--surface-warm); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  padding: 9px; cursor: pointer; font-size: 14px; text-align: center; color: var(--text);
  transition: background .12s, border-color .12s;
}
.tool-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.tool-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.tool-btn.warn { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 700; }
.file-btn {
  display: block; background: var(--ok); color: #fff; text-align: center;
  padding: 11px; border-radius: var(--r-sm); cursor: pointer; font-size: 14px; transition: background .15s;
}
.file-btn:hover { background: var(--ok-strong); }
.file-btn:focus-within { outline: 3px solid #0b3d2e; outline-offset: 2px; }
.doc-btn { background: var(--primary); }
.doc-btn:hover { background: var(--primary-strong); }
.upload-hint { margin: 2px 0 0; font-size: 12px; color: var(--faint); line-height: 1.5; }
.doc-busy {
  display: none; margin-left: var(--sp-3); color: var(--accent-strong); font-weight: 700; font-size: 13px;
}
.pen-opts label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.pen-opts label > input[type="range"] { flex: 1 1 auto; min-width: 0; }
.pen-opts label > input[type="color"] { margin-left: auto; width: 46px; height: 24px; padding: 0; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); cursor: pointer; }
.pen-opts label > span { flex: 0 0 auto; min-width: 16px; text-align: right; color: var(--text); }
.pen-opts label > select { margin-left: auto; min-width: 102px; max-width: 118px; padding: 5px 7px; font-size: 12px; }

.canvas-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.canvas-head {
  padding: 10px var(--sp-4); background: var(--surface); border-bottom: 1px solid var(--border);
  font-size: 14px; color: var(--muted);
}
.canvas-head strong { color: var(--text); font-family: var(--serif); font-size: 16px; }
.canvas-scroll { flex: 1; overflow: auto; background: #e7e0d2; padding: var(--sp-5); }
.canvas-scroll.drag-over { outline: 3px dashed var(--primary); outline-offset: -8px; background: #ddd4c2; }
#grade-canvas { background: #fff; box-shadow: 0 0 0 1px var(--border-strong); }
.canvas-scroll .canvas-container { box-shadow: var(--sh-2); }

.grade-side {
  flex: 0 0 350px; background: var(--surface); border-left: 1px solid var(--border);
  padding: var(--sp-4); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3);
}
.grade-side h3 {
  margin: 0 0 var(--sp-1); padding-bottom: 6px; border-bottom: 2px solid var(--primary-soft); color: var(--primary);
}
.hint { font-size: 12px; color: var(--faint); font-weight: normal; }
.rating-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.rating-btn {
  padding: 12px 0; font-size: 18px; font-weight: 700; cursor: pointer;
  background: var(--surface-warm); border: 2px solid var(--border-strong); border-radius: var(--r-sm); color: var(--muted);
  font-family: var(--serif); transition: border-color .12s, background .12s;
}
.rating-btn:hover { border-color: var(--primary); color: var(--primary); }
.rating-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* 五维总评 */
.eval-sections { display: flex; flex-direction: column; gap: var(--sp-3); }
.eval-sec { display: flex; flex-direction: column; gap: 6px; }
.eval-head { display: flex; align-items: center; justify-content: space-between; }
.eval-label { font-weight: 700; font-size: 14px; color: var(--text); }
.star-widget { user-select: none; display: inline-flex; align-items: center; }
.star-widget .star { border: 0; background: transparent; color: var(--border-strong); font-size: 20px; cursor: pointer; line-height: 1; padding: 0 1px; }
.star-widget .star:hover { color: var(--gold); }
.star-widget .star.on { color: var(--gold); }
.star-widget .star-clear { border: 0; background: transparent; font-size: 11px; color: var(--faint); cursor: pointer; margin-left: 6px; }
.star-widget .star-clear:hover { color: var(--accent); }
.eval-text {
  width: 100%; resize: vertical; padding: 9px 11px; font-size: 14px; line-height: 1.6;
}
.quick-comment-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px; }
.quick-comment-select { min-width: 0; width: 100%; padding: 6px 8px; font-size: 12px; color: var(--muted); }
.quick-comment-add, .quick-comment-delete {
  border: 1px solid var(--border-strong); border-radius: var(--r-sm); padding: 4px 7px;
  background: var(--primary-soft); color: var(--primary); font-size: 11px; cursor: pointer; white-space: nowrap;
}
.quick-comment-delete { background: var(--surface-warm); color: var(--muted); }
.quick-comment-add:hover { background: #dde6f0; }
.quick-comment-delete:hover { color: var(--danger); border-color: var(--danger); }
.save-row { display: flex; flex-direction: column; gap: var(--sp-2); margin-top: var(--sp-4); }
.save-row button:disabled { opacity: .55; cursor: wait; }

/* 弹窗内的五维总评 */
.cmt-dim { margin-bottom: var(--sp-3); }
.cmt-dim-head { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: 2px; }
.cmt-label { font-weight: 700; color: var(--primary); }
.cmt-stars { color: var(--gold); letter-spacing: 2px; }
.cmt-text { font-size: 14px; line-height: 1.7; color: var(--text); }
.cmt-empty { color: var(--faint); }

/* ============================================================
   查看弹窗
   ============================================================ */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(40,32,20,.55);
  align-items: center; justify-content: center; z-index: 50; padding: var(--sp-5);
}
.modal-box {
  background: var(--surface); border-radius: var(--r-lg); max-width: 1000px; width: 100%;
  max-height: 90vh; overflow: hidden; position: relative; box-shadow: var(--sh-3);
}
.modal-close {
  position: absolute; top: 8px; right: 12px; border: none; background: transparent;
  font-size: 28px; cursor: pointer; color: var(--muted); line-height: 1; z-index: 2;
}
.modal-close:hover { color: var(--text); }
.modal-body { display: flex; gap: 0; max-height: 90vh; }
.modal-img-wrap { flex: 1; background: #2a2620; display: flex; align-items: center; justify-content: center; overflow: auto; padding: var(--sp-3); }
.modal-img-wrap img { max-width: 100%; max-height: 86vh; }
.modal-info { flex: 0 0 320px; padding: var(--sp-5); overflow-y: auto; }
.modal-date { color: var(--faint); font-size: 13px; }
.modal-teacher { display: flex; align-items: center; gap: var(--sp-2); font-size: 14px; color: var(--muted); margin-top: var(--sp-2); }
.modal-teacher:empty { display: none; }
.modal-rating-big { font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--primary); margin: var(--sp-2) 0 var(--sp-1); }
.modal-info h4 { margin: var(--sp-4) 0 6px; font-size: 15px; }
.modal-comment { white-space: pre-wrap; line-height: 1.7; font-size: 14px; color: var(--text); }
.modal-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: var(--sp-5);
}
.modal-actions button { min-width: 0; padding-inline: 7px; font-size: 12px; white-space: nowrap; }

/* ============================================================
   批改页：页内学生选择 + 写作讲次
   ============================================================ */
.side-student-picker { display: flex; flex-direction: column; gap: var(--sp-2); }
.grader-filter-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.grader-filter-row select { width: 100%; min-width: 0; }
.grader-student-pick { display: flex; align-items: center; gap: var(--sp-2); }
.grader-student-select {
  flex: 1 1 auto; min-width: 0; padding: 7px 8px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text); font-size: 13px;
}
.side-student-picker .ghost-btn { flex: 0 0 auto; background: var(--primary-soft); color: var(--primary); border-color: var(--border-strong); padding: 7px 9px; }
.side-student-picker .ghost-btn:hover { background: #dde6f0; }
.lesson-input {
  width: 100%; box-sizing: border-box; padding: 8px 10px; margin-bottom: var(--sp-2);
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface-warm); color: var(--text); font-size: 14px;
}

/* ============================================================
   账号管理（仅管理员）
   ============================================================ */
.admin-view { padding: var(--sp-5); overflow: auto; }
.admin-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  max-width: 880px; margin: 0 auto; padding: var(--sp-5); box-shadow: var(--sh-1);
}
.admin-head { display: flex; align-items: baseline; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.admin-head h2 { margin: 0; }
.admin-msg { color: var(--muted); font-size: 13px; }
.admin-list-head, .admin-row {
  display: grid; grid-template-columns: 48px 1.4fr 1.2fr 1fr auto;
  align-items: center; gap: var(--sp-3); padding: 8px var(--sp-2);
}
.admin-list-head { color: var(--faint); font-size: 12px; border-bottom: 1px solid var(--border); }
.admin-row { border-bottom: 1px solid var(--border); }
.admin-user { font-weight: 600; color: var(--text); display: flex; align-items: center; gap: var(--sp-2); }
.admin-role {
  font-size: 11px; font-weight: 600; color: var(--accent-strong);
  background: var(--accent-soft); border-radius: 999px; padding: 1px 8px;
}
.admin-nick, .admin-date { color: var(--muted); font-size: 14px; }
.admin-ops { display: flex; gap: var(--sp-2); justify-content: flex-end; }
.admin-ops button { padding: 4px 12px; font-size: 13px; }
.admin-ops .ghost-btn {
  background: var(--primary-soft); color: var(--primary); border: 1px solid var(--border-strong);
}
.admin-ops .ghost-btn:hover { background: #dde6f0; }
.admin-ops button[disabled] { opacity: .4; cursor: not-allowed; }

/* ============================================================
   2026 视觉升级：阅读生长工作台
   ============================================================ */
.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.eyebrow {
  display: block;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  line-height: 1.3;
  text-transform: uppercase;
}

body {
  min-width: 0;
  background:
    linear-gradient(90deg, rgba(21, 91, 69, .035) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(rgba(21, 91, 69, .025) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--bg);
  font-size: 14px;
  line-height: 1.55;
}
h1, h2, h3, h4 { letter-spacing: -.02em; }
button, input, select, textarea { font: inherit; }
button, label.file-btn, .student-list li, .sub-card, .color-sw { -webkit-tap-highlight-color: transparent; }
button:not(:disabled), label.file-btn, .student-list li, .sub-card, .color-sw { cursor: pointer; }
button:disabled, select:disabled, input:disabled { cursor: not-allowed; }

.primary-btn, .danger-btn, .ghost-btn, .tool-btn, .rating-btn,
.quick-comment-add, .quick-comment-delete {
  min-height: 44px;
}
.primary-btn, .danger-btn {
  border-radius: 10px;
  font-weight: 700;
  transition: background-color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.primary-btn { box-shadow: 0 4px 12px rgba(21, 91, 69, .16); }
.primary-btn:hover { box-shadow: 0 7px 18px rgba(21, 91, 69, .22); transform: translateY(-1px); }
.primary-btn:active { transform: translateY(0); }
.ghost-btn {
  min-height: 40px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--primary);
  font-weight: 650;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}
.ghost-btn:hover { background: var(--primary-soft); border-color: var(--primary); }
.primary-btn:focus-visible, .danger-btn:focus-visible, .ghost-btn:focus-visible,
.tool-btn:focus-visible, .file-btn:focus-visible, .rating-btn:focus-visible,
.nav-btn:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible,
.quick-comment-add:focus-visible, .quick-comment-delete:focus-visible {
  outline: 3px solid #0b3d2e;
  outline-offset: 2px;
  box-shadow: none;
}
select, input[type="text"], input[type="password"], .login-card input, textarea {
  min-height: 44px;
  border-color: var(--border-strong);
  border-radius: 10px;
  background: #fff;
}
select:hover, input[type="text"]:hover, input[type="password"]:hover, textarea:hover {
  border-color: #9fb39a;
}

/* 顶部品牌导航 */
.topbar {
  position: relative;
  z-index: 20;
  height: 72px;
  min-height: 72px;
  padding: 0 20px 0 16px;
  gap: 22px;
  color: var(--text);
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 5px 24px rgba(21, 67, 50, .07);
  backdrop-filter: blur(14px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
  min-width: 216px;
  color: var(--text);
  letter-spacing: 0;
}
#brand-logo {
  display: block;
  width: 58px;
  height: 50px;
  object-fit: contain;
  object-position: left center;
}
.brand-copy { display: flex; flex-direction: column; padding-left: 10px; border-left: 1px solid var(--border); line-height: 1.15; }
.brand-copy strong { font-size: 16px; color: var(--primary-strong); }
.brand-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; font-weight: 500; letter-spacing: .06em; }
.nav { gap: 3px; min-width: 0; }
.nav-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.nav-btn:hover { background: var(--surface-warm); color: var(--primary); }
.nav-btn.active { background: var(--primary-soft); color: var(--primary-strong); font-weight: 800; }
.nav-btn.active::after {
  display: none;
}
.topbar-right { gap: 8px; }
.topbar-right .ghost-btn { padding: 8px 12px; }
.current-teacher {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-warm);
  color: var(--primary-strong);
  font-weight: 700;
  opacity: 1;
}
#btn-logout { color: var(--muted); background: transparent; border-color: transparent; }
#btn-logout:hover { color: var(--danger); background: var(--accent-soft); }

.help-panel {
  position: relative;
  z-index: 15;
  padding: 0;
  background: var(--primary-strong);
  border: 0;
  color: #fff;
  box-shadow: var(--sh-2);
}
.help-inner { display: grid; grid-template-columns: 210px 1fr; gap: 32px; max-width: 1440px; margin: 0 auto; padding: 20px 28px 22px; }
.help-title span { color: #b9d29d; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.help-title strong { display: block; margin-top: 5px; color: #fff; font-size: 18px; line-height: 1.4; }
.help-panel ol { columns: 2; column-gap: 34px; margin: 0; padding-left: 22px; color: rgba(255,255,255,.82); line-height: 1.65; }
.help-panel li { break-inside: avoid; margin: 0 0 7px; padding-left: 3px; }

/* 登录：一半是任务，一半是阅读生长的品牌世界 */
.view-login {
  background:
    radial-gradient(circle at 14% 18%, rgba(137, 169, 98, .18), transparent 29%),
    radial-gradient(circle at 90% 92%, rgba(21, 91, 69, .12), transparent 30%),
    #f3f7f1;
  padding: 38px;
  overflow: auto;
}
.login-shell {
  display: grid;
  grid-template-columns: minmax(360px, .84fr) minmax(420px, 1.16fr);
  width: min(1040px, 100%);
  min-height: 590px;
  margin: auto;
  overflow: hidden;
  border: 1px solid rgba(21, 91, 69, .13);
  border-radius: 28px;
  background: #fff;
  box-shadow: var(--sh-3);
}
.login-card {
  width: auto;
  padding: 58px 58px 44px;
  gap: 14px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #fff;
}
.login-brand { margin: 0 0 22px; text-align: left; }
.login-brand .eyebrow { margin-bottom: 12px; }
.login-card h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.25;
  letter-spacing: -.055em;
  text-align: left;
}
.login-card h1 em { color: var(--primary); font-style: normal; }
.login-sub { max-width: 390px; margin: 15px 0 0; color: var(--muted); font-size: 15px; line-height: 1.75; text-align: left; }
.login-field { display: flex; flex-direction: column; gap: 7px; }
.login-field label { color: var(--text); font-size: 13px; font-weight: 750; }
.login-card input { min-height: 50px; padding: 12px 14px; background: var(--surface-warm); }
.login-error { min-height: 20px; margin-top: -2px; }
.login-actions { margin-top: 0; }
.login-actions .primary-btn { min-height: 50px; }
.login-actions .ghost-btn { min-height: 46px; background: #fff; color: var(--primary); }
.login-note { margin: 5px 0 0; color: var(--faint); font-size: 12px; line-height: 1.6; text-align: center; }
.login-visual {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: #e7efe3;
  border-left: 1px solid var(--border);
}
.login-visual::before {
  content: "";
  position: absolute;
  inset: 18px;
  z-index: 1;
  border: 1px solid rgba(21, 91, 69, .14);
  border-radius: 18px;
  pointer-events: none;
}
.login-visual img { width: 100%; height: 100%; object-fit: cover; object-position: 53% center; }
.login-visual-caption {
  position: absolute;
  right: 38px;
  bottom: 36px;
  left: 38px;
  z-index: 2;
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 16px;
  background: rgba(15, 70, 54, .88);
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 70, 54, .22);
  backdrop-filter: blur(10px);
}
.login-visual-caption span { display: block; color: #c9dcb4; font-size: 11px; font-weight: 750; letter-spacing: .14em; }
.login-visual-caption strong { display: block; margin-top: 5px; font-size: 18px; font-weight: 700; letter-spacing: .02em; }

/* 通用页面壳 */
.page-shell { width: min(1060px, 100%); margin: 0 auto; }
.page-heading { margin: 0 0 22px; }
.page-heading h1, .panel-heading h1 { margin: 4px 0 5px; color: var(--text); font-size: 28px; line-height: 1.25; }
.page-heading p, .panel-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.field-label { display: block; margin: 20px 0 8px; color: var(--text); font-size: 12px; font-weight: 750; }

/* 学生档案：左侧目录 + 右侧成长册 */
#view-students {
  grid-template-columns: 310px minmax(0, 1fr);
  min-height: 0;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}
.student-panel {
  min-width: 0;
  padding: 22px;
  overflow-y: auto;
  border-color: rgba(21, 91, 69, .12);
  border-radius: 20px;
  box-shadow: var(--sh-1);
}
.panel-heading { padding-bottom: 17px; border-bottom: 1px solid var(--border); }
.panel-heading h1 { font-size: 24px; }
.panel-heading p { font-size: 12px; line-height: 1.6; }
.add-row { margin-bottom: 9px; }
.add-row-meta select, .add-row-meta input { min-width: 0; }
.add-row .primary-btn { min-width: 70px; }
.filter-row { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.search { padding-left: 14px; }
.student-list { margin: 3px -6px -4px; padding: 0 6px 4px; }
.student-list li {
  min-height: 48px;
  margin-bottom: 3px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
}
.student-list li:hover { border-color: var(--border); background: var(--surface-warm); }
.student-list li.active { border-color: var(--primary); background: var(--primary); box-shadow: 0 5px 14px rgba(21,91,69,.17); }
.stu-name { font-weight: 700; }
.stu-tag { font-size: 11px; }
.detail-panel {
  min-width: 0;
  padding: 26px 28px;
  overflow-y: auto;
  border-color: rgba(21, 91, 69, .12);
  border-radius: 20px;
  box-shadow: var(--sh-1);
}
.detail-head { gap: 12px; margin-bottom: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.detail-person { display: flex; flex-direction: column; min-width: 120px; }
.detail-person h2 { margin: 3px 0 0; font-size: 26px; }
.detail-tag { background: var(--primary-soft); color: var(--primary-strong); }
.detail-stat { padding: 6px 11px; border-radius: 999px; background: var(--surface-warm); font-size: 13px; }
#detail-empty {
  display: flex;
  min-height: calc(100% - 20px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
}
#detail-empty strong { color: var(--text); font-size: 18px; }
#detail-empty > span:last-child { max-width: 300px; font-size: 13px; }
.empty-illustration { position: relative; display: block; width: 106px; height: 82px; margin-bottom: 12px; }
.empty-illustration i { position: absolute; display: block; width: 66px; height: 80px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; box-shadow: var(--sh-1); }
.empty-illustration i:nth-child(1) { left: 0; top: 1px; transform: rotate(-7deg); background: #eaf2e6; }
.empty-illustration i:nth-child(2) { right: 0; top: 2px; transform: rotate(6deg); background: #f7f2e9; }
.empty-illustration i:nth-child(3) { left: 20px; top: 0; border-top: 5px solid var(--primary); }
.submission-list { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 16px; }
.sub-card { border-radius: 14px; box-shadow: 0 2px 8px rgba(21,67,50,.05); }
.sub-card:hover { border-color: #a9bfa4; box-shadow: var(--sh-2); transform: translateY(-3px); }
.sub-thumb { height: 148px; background: #edf3eb; }
.sub-badge { top: 10px; right: 10px; background: var(--primary); }
.sub-meta { padding: 11px 13px 13px; }

/* 批改工作台 */
.grader-view {
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr) 390px;
  min-height: 0;
  background: #dfe9dc;
}
.tools {
  min-width: 0;
  padding: 16px 12px 24px;
  gap: 12px;
  background: #f8faf7;
  border-right: 1px solid var(--border);
}
.tools-heading, .grade-side-heading { display: flex; flex-direction: column; padding: 1px 6px 4px; }
.tools-heading strong, .grade-side-heading strong { margin-top: 3px; color: var(--text); font-size: 17px; }
.tool-card, .grade-card {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 9px rgba(21,67,50,.04);
}
.tool-group { gap: 8px; }
.tool-sec-title { margin-bottom: 2px; padding: 0; border: 0; color: var(--primary); font-size: 10px; letter-spacing: .14em; }
.file-btn {
  display: flex;
  min-height: 52px;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--primary);
  border-radius: 11px;
  background: var(--primary);
  text-align: left;
}
.file-btn .icon { width: 21px; height: 21px; }
.file-btn > span { display: flex; flex-direction: column; font-weight: 750; line-height: 1.25; }
.file-btn small { margin-top: 3px; color: rgba(255,255,255,.68); font-size: 10px; font-weight: 500; }
.doc-btn { border-color: #6f8655; background: #6f8655; }
.doc-btn:hover { background: #5d7347; }
.upload-hint { color: var(--muted); font-size: 10px; text-align: center; }
kbd { padding: 1px 4px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-warm); color: var(--text); font: 10px/1.2 var(--sans); }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.tool-grid .tool-wide { grid-column: 1 / -1; }
.tool-btn {
  display: inline-flex;
  min-width: 0;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 7px;
  border-color: var(--border);
  border-radius: 9px;
  background: var(--surface-warm);
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}
.tool-btn:hover { border-color: #93ae8b; background: var(--primary-soft); color: var(--primary-strong); }
.tool-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(21,91,69,.16); }
.tool-btn.warn { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.compact-actions { display: grid; grid-template-columns: 1fr 1fr; }
.compact-actions .tool-sec-title { grid-column: 1 / -1; }
.compact-actions .tool-span { grid-column: 1 / -1; }
.pen-opts label { min-height: 30px; color: var(--muted); font-size: 11px; }
.pen-opts label > input[type="color"] { width: 42px; height: 28px; border-radius: 7px; }
.pen-opts label > select { min-width: 96px; max-width: 105px; }
.pen-opts .pressure-toggle {
  justify-content: space-between;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-warm);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}
.pressure-toggle input { width: 18px; height: 18px; margin-left: auto; accent-color: var(--primary); }
.pressure-toggle span { order: -1; }
.pressure-note { margin: -2px 2px 2px; color: var(--faint); font-size: 10px; line-height: 1.55; }
.recent-color-row {
  display: grid;
  gap: 5px;
  min-height: 34px;
  color: var(--faint);
  font-size: 10px;
}
.recent-colors {
  display: grid;
  width: 100%;
  min-height: 30px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: center;
  gap: 3px;
}
.recent-color {
  width: 100%;
  max-width: 32px;
  height: auto;
  aspect-ratio: 1;
  justify-self: center;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: 0 0 0 1px rgba(35,49,42,.24), 0 2px 5px rgba(35,49,42,.14);
}
.recent-color:hover { transform: translateY(-1px) scale(1.06); }
.recent-color:focus-visible { outline: 3px solid rgba(137,169,98,.66); outline-offset: 2px; }
.compact-actions .tool-btn kbd {
  margin-left: auto;
  border: 1px solid rgba(76,92,83,.22);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 4px;
  background: rgba(255,255,255,.72);
  color: var(--faint);
  font: 700 9px/1.3 var(--font-sans);
}
input[type="range"] { accent-color: var(--primary); }
.tools, .grade-side {
  scrollbar-width: thin;
  scrollbar-color: #9cb496 transparent;
}
.tools::-webkit-scrollbar, .grade-side::-webkit-scrollbar { width: 7px; }
.tools::-webkit-scrollbar-thumb, .grade-side::-webkit-scrollbar-thumb { border-radius: 999px; background: #9cb496; }
.tools::-webkit-scrollbar-track, .grade-side::-webkit-scrollbar-track { background: transparent; }

.canvas-area { min-width: 0; background: #dfe9dc; }
.canvas-head {
  display: flex;
  min-height: 64px;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  background: rgba(255,255,255,.93);
  border-bottom: 1px solid var(--border);
}
.canvas-title-wrap { display: flex; min-width: 0; flex-direction: column; }
.canvas-workspace-title { color: var(--text); font-size: 15px; font-weight: 800; }
.canvas-student { color: var(--muted); font-size: 11px; }
.canvas-head .canvas-student strong { color: var(--primary); font-family: var(--sans); font-size: 12px; }
.canvas-shortcut { margin-left: auto; color: var(--faint); font-size: 10px; white-space: nowrap; }
.canvas-status {
  max-width: 320px;
  padding: 5px 8px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 10px;
  line-height: 1.35;
}
.canvas-status:empty { display: none; }
.doc-busy { margin-left: 0; padding: 5px 8px; border-radius: 7px; background: var(--accent-soft); }
.canvas-scroll {
  background:
    linear-gradient(45deg, rgba(255,255,255,.24) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.24) 75%),
    linear-gradient(45deg, rgba(255,255,255,.24) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.24) 75%),
    #dfe9dc;
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
  padding: 26px 44px 44px 26px;
}
.canvas-scroll.drag-over { outline-color: var(--leaf); background-color: #d4e5cf; }
#grade-canvas { border-radius: 2px; box-shadow: 0 0 0 1px rgba(35,49,42,.12); }
.canvas-scroll .canvas-container { border-radius: 3px; box-shadow: 0 12px 30px rgba(35,49,42,.18), 0 0 0 1px rgba(35,49,42,.08); }
.canvas-resize-handle {
  position: absolute;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
  touch-action: none;
  user-select: none;
}
.canvas-resize-handle::after {
  content: "";
  display: block;
  border-radius: 999px;
  background: rgba(21, 91, 69, .56);
  box-shadow: 0 0 0 4px rgba(255,255,255,.84), 0 3px 10px rgba(21,67,50,.22);
  transition: background .18s ease, box-shadow .18s ease;
}
.canvas-resize-handle:hover::after,
.canvas-resize-handle:focus-visible::after,
.canvas-resize-handle.dragging::after {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(255,255,255,.94), 0 4px 14px rgba(168,63,49,.28);
}
.canvas-resize-handle:focus-visible { outline: 3px solid rgba(137,169,98,.68); outline-offset: 2px; }
.canvas-resize-right { top: 0; right: -36px; width: 44px; height: calc(100% - 8px); cursor: ew-resize; }
.canvas-resize-right::after { width: 5px; height: 70px; }
.canvas-resize-bottom { bottom: -36px; left: 0; width: calc(100% - 8px); height: 44px; cursor: ns-resize; }
.canvas-resize-bottom::after { width: 70px; height: 5px; }
.canvas-resize-both { right: -36px; bottom: -36px; width: 44px; height: 44px; cursor: nwse-resize; }
.canvas-resize-both::after { width: 14px; height: 14px; border-radius: 5px 2px 5px 2px; }

.grade-side {
  min-width: 0;
  flex-basis: auto;
  padding: 15px 13px 20px;
  gap: 11px;
  background: #f8faf7;
  border-left-color: var(--border);
}
.grade-side-heading { padding-bottom: 3px; }
.grade-card { display: flex; flex-direction: column; gap: 9px; padding: 13px; }
.grade-card h3 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin: 0; padding: 0; border: 0; color: var(--text); font-size: 14px; }
.grade-card h3 small, .lesson-card label small { color: var(--faint); font-size: 9px; font-weight: 500; letter-spacing: 0; }
.side-student-picker { gap: 8px; }
.grader-filter-row { gap: 7px; }
.grader-filter-row select, .grader-student-select { min-height: 40px; padding: 7px 9px; font-size: 12px; }
.side-student-picker .ghost-btn { min-height: 40px; padding: 7px 10px; background: var(--primary-soft); }
.lesson-card label { display: flex; align-items: baseline; justify-content: space-between; color: var(--text); }
.lesson-input { min-height: 42px; margin: 0; background: var(--surface-warm); }
.rating-buttons { gap: 7px; }
.rating-btn {
  min-height: 48px;
  padding: 8px 0;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-warm);
  color: var(--muted);
  font: 800 17px/1 var(--sans);
}
.rating-btn:hover { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.rating-btn.active { position: relative; border-color: var(--primary); background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(21,91,69,.18); }
.rating-btn.active::after { content: "已选"; position: absolute; right: 3px; bottom: 2px; color: rgba(255,255,255,.7); font-size: 7px; font-weight: 600; }
.evaluation-card { gap: 11px; }
.eval-sections { gap: 9px; }
.eval-sec { gap: 6px; padding: 10px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-warm); }
.eval-sec[data-key="revision"] { border-color: #ecd3ca; background: #fff8f5; }
.eval-label { color: var(--primary-strong); font-size: 13px; }
.star-widget .star { display: inline-flex; width: 25px; min-height: 30px; align-items: center; justify-content: center; font-size: 18px; }
.star-widget .star-clear { display: inline-flex; min-height: 30px; align-items: center; margin-left: 4px; padding: 0 3px; }
.eval-text { min-height: 72px; padding: 8px 10px; border-radius: 9px; background: #fff; font-size: 13px; }
.quick-comment-row { grid-template-columns: minmax(0, 1fr) auto auto; gap: 5px; }
.quick-comment-select { min-height: 34px; padding: 5px 7px; font-size: 11px; }
.quick-comment-add, .quick-comment-delete { min-height: 34px; padding: 4px 7px; border-radius: 8px; }
.quick-comment-delete { color: var(--danger); }
.save-row {
  position: sticky;
  bottom: -20px;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
  margin: 3px -13px -20px;
  padding: 10px 13px 14px;
  border-top: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(248,250,247,.93), #f8faf7 24%);
}
.save-status {
  grid-column: 1 / -1;
  min-height: 17px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  text-align: center;
}
.save-status:empty { display: none; }
.save-status[data-state="success"] { color: var(--primary-strong); }
.save-status[data-state="error"] { color: var(--danger); font-weight: 650; }
.save-row #btn-save { grid-column: 1 / -1; min-height: 48px; }
.save-row #btn-export-long { border: 1px solid var(--primary); background: #fff; color: var(--primary); box-shadow: none; }
.save-row #btn-export-long:hover { background: var(--primary-soft); }
.save-row #btn-export-long, .save-row #btn-export-landscape { min-height: 40px; padding-inline: 7px; font-size: 10px; }

/* 我的资料 */
.profile-view, .stats-view, .admin-view { padding: 30px 24px 44px; }
.profile-shell { max-width: 900px; }
.profile-card {
  display: grid;
  grid-template-columns: 280px 1fr;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
  box-shadow: var(--sh-2);
}
.profile-preview-panel {
  display: flex;
  min-height: 360px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 34px;
  background:
    radial-gradient(circle at 20% 20%, rgba(137,169,98,.48), transparent 34%),
    var(--primary-strong);
  color: #fff;
  text-align: center;
}
.profile-preview-panel > span { color: #c9dcb4; font-size: 11px; font-weight: 750; letter-spacing: .14em; }
.profile-preview-panel p { max-width: 190px; margin: 16px 0 0; color: rgba(255,255,255,.72); font-size: 12px; line-height: 1.7; }
.avatar-preview { width: 96px; height: 96px; margin-top: 18px; }
.avatar-preview .avatar, .avatar-preview .avatar img { width: 96px !important; height: 96px !important; }
.profile-form { padding: 38px 42px; }
.profile-row { align-items: flex-start; flex-direction: column; gap: 8px; margin-bottom: 19px; }
.profile-row > label, .profile-fieldset legend { flex-basis: auto; color: var(--text); font-size: 12px; font-weight: 750; }
.profile-row input[type="text"] { width: 100%; }
.profile-fieldset { min-width: 0; padding: 0; border: 0; }
.avatar-modes label { min-height: 40px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-warm); }
.color-sw { width: 30px; height: 30px; }
.color-sw.sel { box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--primary); border-color: transparent; }
.profile-actions { padding-top: 5px; }

/* 月度统计 */
.stats-shell { max-width: 820px; }
.stats-card { max-width: none; padding: 24px 28px 30px; border-radius: 20px; box-shadow: var(--sh-1); }
.stats-head { margin: 0 0 24px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.stats-head .ghost-btn { background: var(--surface-warm); }
.stats-month { color: var(--primary); font-size: 20px; }
.stats-total { padding: 6px 11px; border-radius: 999px; background: var(--primary-soft); color: var(--primary-strong); font-weight: 700; }
.stats-list { gap: 8px; }
.stats-row { min-height: 58px; padding: 10px 12px; border: 1px solid transparent; }
.stats-row.me { border-color: var(--border); background: var(--surface-warm); }
.stats-bar { height: 10px; border: 0; background: #e5ece2; }
.stats-bar-fill { background: linear-gradient(90deg, var(--primary), var(--leaf)); }

/* 账号管理 */
.admin-shell { max-width: 980px; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.admin-head h1 { margin-bottom: 5px; }
.admin-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.admin-card { max-width: none; margin: 0; padding: 12px 20px 20px; border-radius: 20px; box-shadow: var(--sh-1); overflow: hidden; }
.admin-list-head, .admin-row { min-height: 58px; grid-template-columns: 48px 1.4fr 1.2fr 1fr auto; padding: 9px 10px; }
.admin-list-head { min-height: 44px; }
.admin-row:last-child { border-bottom: 0; }
.admin-row:hover { background: var(--surface-warm); }
.admin-role { color: var(--primary-strong); background: var(--primary-soft); }
.admin-ops .ghost-btn { min-height: 36px; background: #fff; color: var(--primary); }
.admin-ops .danger-btn { min-height: 36px; }
.admin-empty {
  grid-column: 1 / -1;
  display: grid;
  min-height: 170px;
  place-content: center;
  gap: 5px;
  color: var(--muted);
  text-align: center;
}
.admin-empty strong { color: var(--text); font-size: 16px; }
.admin-empty span { font-size: 12px; }
.stats-empty {
  display: grid;
  min-height: 170px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

/* 已批改作文数据库 */
.records-view { padding: 30px 24px 44px; overflow-y: auto; }
.records-shell { max-width: 1180px; }
.records-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; }
.records-heading > div:first-child { min-width: 0; }
.records-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  min-width: 310px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--sh-1);
}
.records-summary > div { display: grid; gap: 3px; padding: 13px 16px; border-right: 1px solid var(--border); }
.records-summary > div:last-child { border-right: 0; }
.records-summary strong { color: var(--primary); font: 800 23px/1 var(--sans); }
.records-summary span { color: var(--faint); font-size: 10px; }
.records-filter-card {
  display: grid;
  grid-template-columns: minmax(210px, 1.7fr) repeat(5, minmax(118px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255,255,255,.86);
  box-shadow: var(--sh-1);
}
.records-filter-card label { display: grid; min-width: 0; gap: 6px; }
.records-filter-card label > span { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .05em; }
.records-filter-card input, .records-filter-card select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface-warm);
  color: var(--text);
  font: inherit;
}
.records-filter-card input:focus, .records-filter-card select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.records-filter-card input:focus-visible, .records-filter-card select:focus-visible,
.star-widget .star:focus-visible, .star-widget .star-clear:focus-visible {
  outline: 3px solid #0b3d2e;
  outline-offset: 2px;
  box-shadow: none;
}
.records-filter-card .ghost-btn { min-height: 42px; white-space: nowrap; }
.records-filter-card .ghost-btn:disabled { cursor: not-allowed; opacity: .45; }
.records-table-card {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--sh-1);
}
.records-table-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 20px 22px 16px; border-bottom: 1px solid var(--border); }
.records-table-head h2 { margin: 3px 0 0; color: var(--text); font-family: var(--font-display); font-size: 21px; }
.records-table-head p { margin: 0; color: var(--muted); font-size: 12px; }
.records-table-wrap { overflow-x: auto; }
.records-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.records-table th { padding: 11px 12px; background: var(--surface-warm); color: var(--muted); font-size: 11px; font-weight: 750; text-align: left; }
.records-table td { padding: 14px 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; vertical-align: middle; }
.records-table tbody tr:first-child td { border-top: 0; }
.records-table tbody tr:hover { background: #fbfcf9; }
.records-table th:nth-child(1) { width: 145px; }
.records-table th:nth-child(2) { width: 135px; }
.records-table th:nth-child(3) { width: 165px; }
.records-table th:nth-child(4) { width: 72px; }
.records-table th:nth-child(5) { width: 120px; }
.records-table th:nth-child(6) { width: 108px; }
.records-table th:nth-child(7) { width: 104px; }
.records-table th:nth-child(8) { width: 76px; }
.record-student { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.record-student-initial { display: inline-flex; width: 34px; height: 34px; flex: 0 0 34px; align-items: center; justify-content: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; }
.record-student strong { overflow: hidden; color: var(--text); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.record-lesson { color: var(--text) !important; font-weight: 650; }
.record-rating { display: inline-flex; min-width: 42px; min-height: 32px; align-items: center; justify-content: center; padding: 5px 8px; border-radius: 9px; background: var(--primary); color: #fff; font-weight: 800; }
.record-rating.muted { background: #edf0eb; color: var(--faint); font-size: 10px; }
.record-size { color: var(--faint) !important; font-variant-numeric: tabular-nums; }
.record-view { min-width: 58px; min-height: 38px; padding: 7px 10px; background: var(--primary-soft); color: var(--primary); }
.records-empty { min-height: 250px; }
.records-table-wrap.is-empty .records-table { display: none; }

/* 图片裁剪与查看记录弹窗 */
.modal { padding: 24px; background: rgba(22, 35, 28, .72); backdrop-filter: blur(7px); }
.modal-open { overflow: hidden; }
.modal-open > .topbar,
.modal-open > .help-panel,
.modal-open > section:not(.view-login) {
  filter: blur(4px) saturate(.82);
  pointer-events: none;
  user-select: none;
}
.app-dialog { z-index: 1300; align-items: center; justify-content: center; }
.app-dialog-card {
  width: min(500px, calc(100vw - 36px));
  max-height: calc(100vh - 40px);
  padding: 30px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,.36);
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 32px 90px rgba(10,30,20,.38);
}
.app-dialog-card h2 { margin: 5px 0 8px; color: var(--text); font-family: var(--font-display); font-size: 26px; }
.app-dialog-message { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75; white-space: pre-line; }
.app-dialog-fields { display: grid; gap: 13px; margin-top: 18px; }
.app-dialog-field { display: grid; gap: 7px; }
.app-dialog-field > span { color: var(--text); font-size: 11px; font-weight: 750; }
.app-dialog-field input, .app-dialog-field textarea, .app-dialog-field select { width: 100%; min-height: 45px; background: var(--surface-warm); }
.app-dialog-field textarea { min-height: 104px; resize: vertical; }
.app-dialog-error { min-height: 18px; margin: 8px 0 0; color: var(--danger); font-size: 11px; }
.app-dialog-error:empty { visibility: hidden; }
.app-dialog-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 9px; padding-top: 7px; }
.app-dialog-actions button { min-height: 46px; }
.app-dialog-actions #app-dialog-cancel[hidden] ~ #app-dialog-confirm { grid-column: 1 / -1; }
.app-dialog-card.has-secondary-action .app-dialog-actions { grid-template-columns: .8fr 1fr 1.35fr; }
.app-dialog[data-variant="save-success"] .app-dialog-card { width: min(620px, calc(100vw - 36px)); }
.app-dialog[data-variant="save-success"] .app-dialog-actions { margin-top: 22px; }
.modal-box { max-width: 1120px; border: 1px solid rgba(255,255,255,.22); border-radius: 22px; box-shadow: 0 30px 80px rgba(10,30,20,.32); }
.modal-close {
  top: 12px;
  right: 12px;
  display: inline-flex;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--text);
  font-size: 24px;
  box-shadow: var(--sh-1);
}
.crop-modal-box {
  width: min(960px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  padding: 30px;
  overflow-y: auto;
  background: #fff;
}
.crop-heading { padding-right: 48px; }
.crop-heading h2 { margin: 4px 0 6px; color: var(--text); font-size: 26px; }
.crop-heading p { margin: 0; color: var(--muted); font-size: 13px; }
.crop-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, .75fr);
  gap: 24px;
  margin-top: 22px;
}
.crop-preview-wrap {
  display: flex;
  min-width: 0;
  min-height: 350px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 16px;
  background: #26362e;
}
#crop-preview {
  display: block;
  max-width: 100%;
  max-height: 430px;
  width: auto;
  height: auto;
  background: #fff;
  box-shadow: 0 12px 28px rgba(0,0,0,.24);
}
.crop-preview-wrap p { margin: 0; color: rgba(255,255,255,.84); font-size: 12px; text-align: center; }
.crop-controls { display: flex; min-width: 0; flex-direction: column; gap: 12px; }
.crop-control-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 9px;
}
.crop-control-row label {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.crop-controls output { color: var(--primary); font-variant-numeric: tabular-nums; text-align: right; }
.crop-result {
  min-height: 48px;
  margin: 4px 0 0;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  line-height: 1.5;
}
.crop-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; padding-top: 8px; }
.crop-actions #crop-apply { grid-column: 1 / -1; min-height: 48px; }
.modal-body { min-height: 620px; }
.modal-img-wrap { background: #1e2e26; padding: 24px; }
.modal-img-wrap img { border-radius: 5px; box-shadow: 0 12px 34px rgba(0,0,0,.25); }
.modal-info { flex-basis: 380px; padding: 34px 32px 30px; }
.modal-info h2 { margin: 4px 0 14px; font-size: 27px; }
.modal-rating-big {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 22px;
  padding: 14px 17px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--primary-soft);
}
.modal-rating-big small { color: var(--muted); font: 700 12px/1 var(--sans); }
.modal-rating-big span { color: var(--primary); font-size: 30px; }
.modal-info h4 { padding-bottom: 9px; border-bottom: 1px solid var(--border); }
.cmt-dim { padding: 11px 0; border-bottom: 1px solid var(--border); }
.cmt-label { color: var(--primary-strong); }
.modal-actions { position: sticky; bottom: -30px; padding: 16px 0 4px; background: linear-gradient(transparent, #fff 20%); }

/* 教务系统首页：稿纸边线承接批改场景，四个系统入口保持一眼可达 */
.home-view {
  overflow-y: auto;
  padding: 28px;
  background:
    radial-gradient(circle at 12% 4%, rgba(137, 169, 98, .16), transparent 30%),
    transparent;
}
.home-shell {
  width: min(1320px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 26px;
}
.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(440px, 1.1fr);
  min-height: 316px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--sh-2);
}
.home-hero::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 30px;
  bottom: 30px;
  left: 28px;
  width: 2px;
  border-radius: 2px;
  background: rgba(199, 79, 61, .7);
}
.home-hero-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 34px 32px 32px 52px;
  background:
    repeating-linear-gradient(180deg, transparent 0, transparent 35px, rgba(21, 91, 69, .045) 36px),
    #fff;
}
.home-greeting {
  margin: 12px 0 2px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.home-hero h1 {
  max-width: 520px;
  margin: 0;
  font-size: clamp(32px, 3vw, 44px);
  line-height: 1.18;
  letter-spacing: -.05em;
}
.home-hero h1 em { color: var(--primary); font-style: normal; }
.home-lead {
  max-width: 560px;
  margin: 16px 0 20px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.8;
}
.home-motto {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .08em;
}
.home-motto span { display: inline-flex; align-items: center; }
.home-motto span:not(:last-child)::after {
  content: "";
  width: 18px;
  height: 1px;
  margin: 0 10px;
  background: var(--accent);
}
.home-hero-art { position: relative; min-width: 0; overflow: hidden; background: var(--surface-warm); }
.home-hero-art::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0 auto 0 0;
  width: 18%;
  background: linear-gradient(90deg, #fff, transparent);
  pointer-events: none;
}
.home-hero-art img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 316px;
  object-fit: cover;
  object-position: center;
}
.home-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
}
.home-section-heading h2 { margin: 4px 0 0; font-size: 24px; }
.home-section-heading p { max-width: 440px; margin: 0; color: var(--muted); text-align: right; }
.system-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.system-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-width: 0;
  min-height: 180px;
  padding: 20px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  color: var(--text);
  text-align: left;
  box-shadow: var(--sh-1);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease;
}
.system-card:hover {
  transform: translateY(-2px);
  border-color: #9db699;
  box-shadow: var(--sh-2);
}
.system-card:focus-visible, .brand:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
  box-shadow: 0 0 0 6px #0b3d2e, var(--sh-2);
}
.system-card-primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}
.system-card-primary:hover { border-color: var(--primary-strong); background: var(--primary-strong); }
.system-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  margin-bottom: 15px;
  border-radius: 14px;
  background: var(--primary-soft);
  color: var(--primary);
}
.system-card-icon .icon { width: 23px; height: 23px; }
.system-card-primary .system-card-icon { background: rgba(255,255,255,.14); color: #fff; }
.system-card-copy { display: grid; gap: 5px; }
.system-card-copy strong { color: inherit; font-size: 21px; line-height: 1.25; }
.system-card-copy small { color: var(--muted); font-size: 12px; line-height: 1.65; }
.system-card-primary .system-card-copy small { color: rgba(255,255,255,.78); }
.system-card-action {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  padding-top: 16px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}
.system-card-action .icon { width: 16px; height: 16px; transition: transform .18s ease; }
.system-card:hover .system-card-action .icon { transform: translateX(3px); }
.system-card-primary .system-card-action { color: #fff; }
.system-status {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 10px;
  letter-spacing: .04em;
}

.coming-soon-view {
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 28px;
}
.coming-soon-card {
  width: min(560px, 100%);
  padding: 44px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: #fff;
  text-align: center;
  box-shadow: var(--sh-2);
}
.coming-soon-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 68px;
  margin-bottom: 18px;
  border-radius: 20px;
  background: var(--primary-soft);
  color: var(--primary);
}
.coming-soon-mark .icon { width: 30px; height: 30px; }
.coming-soon-card h1 { margin: 8px 0; font-size: 30px; }
.coming-soon-card p { margin: 0 auto 24px; color: var(--muted); font-size: 15px; line-height: 1.8; }

/* 响应式：优先保证功能可达，再压缩装饰 */
@media (max-width: 1240px) {
  .topbar { gap: 12px; }
  .brand { min-width: 158px; }
  #brand-logo { width: 52px; }
  .brand-copy small { display: none; }
  .nav-btn { padding-inline: 9px; }
  .grader-view { grid-template-columns: 204px minmax(0, 1fr) 350px; }
  .canvas-shortcut { display: none; }
  .records-filter-card { grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(130px, 1fr)); }
}

@media (max-width: 1020px) {
  .topbar { padding-inline: 12px; }
  .brand { min-width: 48px; }
  #brand-logo { width: 50px; }
  .brand-copy { display: none; }
  .nav-btn span { display: none; }
  .nav-btn { width: 44px; padding: 0; }
  .nav-btn.active::after { left: 10px; right: 10px; }
  .current-teacher { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grader-view { grid-template-columns: 190px minmax(0, 1fr) 330px; }
  .grade-card { padding: 11px; }
  .quick-comment-row { grid-template-columns: 1fr 1fr; }
  .quick-comment-select { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  body { height: auto; min-height: 100vh; }
  .topbar { position: sticky; top: 0; }
  .topbar-right #btn-help, .current-teacher { display: none; }
  .view { min-height: calc(100vh - 72px); }
  .home-view { padding: 20px; }
  .home-hero { grid-template-columns: minmax(0, 1fr); }
  .home-hero-art::before { inset: 0 0 auto; width: auto; height: 20%; background: linear-gradient(180deg, #fff, transparent); }
  .home-hero-art img { height: 260px; min-height: 260px; object-position: center 48%; }
  .home-section-heading { align-items: flex-start; flex-direction: column; gap: 6px; }
  .home-section-heading p { text-align: left; }
  .system-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .login-shell { grid-template-columns: 1fr; width: min(520px, 100%); min-height: 0; }
  .login-card { padding: 46px 42px 38px; }
  .login-visual { display: none; }
  #view-students { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; overflow-y: auto; }
  .student-panel { min-height: 560px; overflow: visible; }
  .detail-panel { min-height: 520px; }
  .grader-view {
    grid-template-columns: minmax(0, 1fr);
    overflow-y: auto;
  }
  .canvas-area { order: 1; min-height: 68vh; }
  .tools { order: 2; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; border-top: 1px solid var(--border); }
  .tools-heading { grid-column: 1 / -1; }
  .grade-side { order: 3; overflow: visible; border-top: 1px solid var(--border); }
  .profile-card { grid-template-columns: 230px 1fr; }
  .admin-card { overflow-x: auto; }
  .admin-list-head, .admin-row { min-width: 760px; }
  .modal-body { flex-direction: column; overflow-y: auto; }
  .crop-layout { grid-template-columns: 1fr; }
  .crop-preview-wrap { min-height: 300px; }
  .modal-img-wrap { min-height: 52vh; }
  .modal-info { flex-basis: auto; overflow: visible; }
  .records-heading { align-items: stretch; flex-direction: column; }
  .records-summary { min-width: 0; }
  .records-filter-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .records-search-field { grid-column: 1 / -1; }
  .records-table, .records-table tbody, .records-table tr, .records-table td { display: block; width: 100%; }
  .records-table thead { display: none; }
  .records-table tbody { display: grid; gap: 10px; padding: 12px; }
  .records-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: #fff; }
  .records-table td { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 8px; min-height: 42px; padding: 8px 12px; border-top: 1px solid var(--border); }
  .records-table td::before { content: attr(data-label); color: var(--faint); font-size: 10px; font-weight: 750; }
  .records-table .record-student-cell { grid-column: 1 / -1; border-top: 0; }
  .records-table .record-action { display: block; grid-column: 1 / -1; padding: 10px 12px 12px; }
  .record-action::before { display: none; }
  .record-view { width: 100%; min-height: 44px; }
}

@media (max-width: 620px) {
  .topbar { gap: 6px; height: 64px; min-height: 64px; }
  #brand-logo { width: 46px; height: 42px; }
  .nav { flex: 1; justify-content: center; }
  .topbar-right { margin-left: 0; }
  #btn-logout { width: 44px; overflow: hidden; color: transparent; }
  #btn-logout::after { content: "退出"; color: var(--muted); }
  .nav-btn.active::after { bottom: -10px; }
  .view-login { padding: 18px; }
  .home-view { padding: 12px; }
  .home-shell { gap: 20px; }
  .home-hero { border-radius: 18px; }
  .home-hero::before { top: 24px; bottom: auto; left: 18px; height: 235px; }
  .home-hero-copy { padding: 28px 22px 26px 34px; }
  .home-hero h1 { font-size: 31px; }
  .home-lead { margin-block: 13px 17px; font-size: 14px; }
  .home-motto { font-size: 11px; letter-spacing: .04em; }
  .home-motto span:not(:last-child)::after { width: 10px; margin-inline: 7px; }
  .home-hero-art img { height: 220px; min-height: 220px; }
  .home-section-heading { margin-bottom: 11px; }
  .home-section-heading h2 { font-size: 22px; }
  .system-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .system-card { min-height: 166px; padding: 18px; }
  .coming-soon-view { padding: 12px; }
  .coming-soon-card { padding: 34px 24px; border-radius: 18px; }
  .login-card { padding: 38px 26px 30px; }
  .login-card h1 { font-size: 31px; }
  #view-students, .profile-view, .stats-view, .admin-view, .records-view { padding: 12px; }
  .detail-head { align-items: flex-start; flex-wrap: wrap; }
  .detail-head .primary-btn { width: 100%; margin-left: 0; }
  .tools { grid-template-columns: 1fr; }
  .tools-heading { grid-column: 1; }
  .canvas-scroll { padding: 14px; }
  .profile-card { grid-template-columns: 1fr; }
  .profile-preview-panel { min-height: 230px; }
  .profile-form { padding: 28px 24px; }
  .stats-head { flex-wrap: wrap; justify-content: center; }
  .stats-total { width: 100%; margin-left: 0; text-align: center; }
  .stats-row { flex-wrap: wrap; }
  .stats-bar { order: 4; flex-basis: 100%; }
  .help-inner { grid-template-columns: 1fr; }
  .help-panel ol { columns: 1; }
  .modal { padding: 0; }
  .modal-box { max-height: 100vh; border-radius: 0; }
  .app-dialog-card.has-secondary-action .app-dialog-actions { grid-template-columns: 1fr; }
  .crop-modal-box { width: 100%; padding: 24px 18px; }
  .records-summary { grid-template-columns: 1fr; }
  .records-summary > div { grid-template-columns: auto 1fr; align-items: baseline; gap: 10px; border-right: 0; border-bottom: 1px solid var(--border); }
  .records-summary > div:last-child { border-bottom: 0; }
  .records-filter-card { grid-template-columns: 1fr; padding: 13px; }
  .records-search-field { grid-column: 1; }
  .records-table tr { grid-template-columns: 1fr; }
  .records-table .record-student-cell, .records-table .record-action { grid-column: 1; }
}

@media (max-height: 700px) and (min-width: 901px) {
  .view-login { padding: 14px 24px; }
  .login-shell { height: 100%; min-height: 0; }
  .login-card { padding: 22px 42px 18px; gap: 7px; }
  .login-brand { margin-bottom: 7px; }
  .login-brand .eyebrow { margin-bottom: 6px; }
  .login-card h1 { font-size: 31px; line-height: 1.18; }
  .login-sub { margin-top: 8px; font-size: 12px; line-height: 1.5; }
  .login-field { gap: 3px; }
  .login-field label { font-size: 11px; }
  .login-card input { min-height: 42px; padding-block: 8px; }
  .login-error { min-height: 14px; font-size: 11px; }
  .login-actions { gap: 6px; }
  .login-actions .primary-btn, .login-actions .ghost-btn { min-height: 42px; }
  .login-note { display: none; }
  .login-visual-caption { right: 26px; bottom: 22px; left: 26px; padding: 12px 15px; }
  .login-visual-caption strong { font-size: 15px; }
  .home-view { padding-block: 18px; }
  .home-shell { gap: 14px; }
  .home-hero { min-height: 210px; }
  .home-hero::before { top: 22px; bottom: 22px; }
  .home-hero-copy { padding: 18px 26px 18px 46px; }
  .home-greeting { margin-top: 6px; }
  .home-hero h1 { font-size: 30px; }
  .home-lead { margin: 8px 0 10px; font-size: 13px; line-height: 1.5; }
  .home-motto { font-size: 11px; }
  .home-hero-art img { height: 210px; min-height: 210px; }
  .home-section-heading { margin-bottom: 8px; }
  .home-section-heading h2 { font-size: 20px; }
  .home-section-heading p { font-size: 12px; }
  .system-grid { gap: 12px; }
  .system-card { min-height: 146px; padding: 15px; }
  .system-card-icon { width: 38px; height: 38px; margin-bottom: 9px; border-radius: 11px; }
  .system-card-icon .icon { width: 20px; height: 20px; }
  .system-card-copy strong { font-size: 18px; }
  .system-card-copy small { font-size: 11px; line-height: 1.45; }
  .system-card-action { padding-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
