/* ==========================================================================
   记作业 · 视觉规范
   设计取向：纸张 / 铅字 / 红笔批改的“练习本”质感
   —— 暖白纸底、墨黑正文、墨蓝为唯一主色、朱砂为批注色
   —— 直角细线、极轻阴影、衬线标题、等宽数字，避免塑料感与渐变堆砌
   ========================================================================== */

:root {
  /* 纸与墨 */
  --paper: #f3f1ea;
  --paper-2: #eae6dc;
  --surface: #fffefb;
  --surface-2: #faf8f2;
  --ink: #1b1a17;
  --ink-2: #56534b;
  --ink-3: #8c877c;
  --rule: #e1dccf;
  --rule-2: #cec7b6;

  /* 主色：墨蓝；批注色：朱砂 */
  --primary: #23496b;
  --primary-2: #193751;
  --primary-soft: #e9eef3;
  --accent: #b0452c;
  --accent-soft: #f6eae6;

  --ok: #3d6a4b;
  --ok-soft: #e9f0ea;
  --warn: #93651c;
  --warn-soft: #f7efe0;
  --danger: #a3312a;
  --danger-soft: #f8e9e7;

  --font-serif: "Songti SC", "STSong", "Source Han Serif SC", "Noto Serif SC", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --r: 3px;
  --r-lg: 5px;
  --nav-h: 58px;
  --shadow: 0 18px 48px rgba(27, 26, 23, 0.16);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  background-color: var(--paper);
  /* 极淡的横格纸纹路 */
  background-image: repeating-linear-gradient(
    to bottom,
    rgba(27, 26, 23, 0.028) 0,
    rgba(27, 26, 23, 0.028) 1px,
    transparent 1px,
    transparent 30px
  );
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; font-family: var(--font-serif); letter-spacing: 0.01em; }
::selection { background: #dfe7ef; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }

/* 通用图标 */
.ic { flex: none; vertical-align: -2px; }

/* --------------------------------- 滚动条 -------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d6d0c2; border: 2px solid var(--paper); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #c3bcaa; }
::-webkit-scrollbar-track { background: transparent; }

/* --------------------------------- 顶栏 ---------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--rule-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
}
.nav-inner {
  max-width: 1180px;
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; flex-shrink: 0; }
.brand-logo {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: #fff8f4;
  font-family: var(--font-serif);
  font-size: 17px;
  font-weight: 700;
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-family: var(--font-serif); font-size: 16px; font-weight: 700; letter-spacing: 0.06em; }
.brand-sub {
  font-size: 10px; color: var(--ink-3);
  letter-spacing: 0.16em; text-transform: uppercase;
  font-family: var(--font-mono);
}

.nav-links { display: flex; align-items: center; gap: 2px; flex: 1; }
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: none; background: none;
  color: var(--ink-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.nav-link:hover { color: var(--primary); }
.nav-link.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.nav-badge {
  font-family: var(--font-mono); font-size: 10px; line-height: 16px;
  min-width: 16px; padding: 0 4px; text-align: center;
  background: var(--accent); color: #fff; border-radius: 2px;
  white-space: nowrap;
}
.nav-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.nav-toggle {
  display: none; background: none; border: 1px solid var(--rule-2); border-radius: var(--r);
  padding: 4px 7px; cursor: pointer; color: var(--ink-2);
}

/* --------------------------------- 用户区 -------------------------------- */
.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 9px 4px 4px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.12s;
}
.user-chip:hover { border-color: var(--ink-3); }
.avatar {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary);
  color: #fff; font-family: var(--font-serif); font-weight: 700; font-size: 13px;
  border-radius: 2px;
  flex-shrink: 0;
}
.avatar.lg { width: 60px; height: 60px; font-size: 26px; border-radius: 3px; }
.user-chip-name { font-weight: 600; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 186px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 4px;
  display: none;
  z-index: 200;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left;
  padding: 8px 10px;
  border: none; background: none; border-radius: var(--r);
  color: var(--ink-2); cursor: pointer;
}
.dropdown-item:hover { background: var(--primary-soft); color: var(--primary); }
.dropdown-item.danger:hover { background: var(--danger-soft); color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--rule); margin: 4px 6px; }

/* --------------------------------- 标签 ---------------------------------- */
.role-tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 6px; height: 19px;
  font-size: 11px; font-weight: 600;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  /* 固定行高的小标签一律不换行，否则“超级管理员”会被折成两行 */
  white-space: nowrap;
  flex: none;
  line-height: 1;
}
.role-super_admin { color: var(--accent); background: var(--accent-soft); }
.role-admin { color: var(--primary); background: var(--primary-soft); }
.role-user { color: var(--ink-3); background: var(--surface-2); }

.tag {
  display: inline-block;
  padding: 0 6px; margin-right: 5px;
  font-size: 12px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  color: var(--ink-2);
  background: var(--surface-2);
  white-space: nowrap;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 6px; height: 19px;
  font-size: 11.5px;
  border: 1px solid currentColor;
  border-radius: 2px;
  white-space: nowrap;
  flex: none;
  line-height: 1;
}
.st-todo { color: var(--ink-3); background: var(--surface-2); }
.st-doing { color: var(--primary); background: var(--primary-soft); }
.st-done { color: var(--ok); background: var(--ok-soft); }
.st-overdue { color: var(--accent); background: var(--accent-soft); }

/* --------------------------------- 布局 ---------------------------------- */
.page { max-width: 1120px; margin: 0 auto; padding: 26px 22px 72px; }
.card {
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
}
.card-pad { padding: 20px 22px; }
.card-title {
  font-family: var(--font-serif);
  font-size: 15.5px; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 13px 20px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 26px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hidden { display: none !important; }
.grid { display: grid; gap: 18px; }

/* 区块标题（小字距大写的“栏目名”） */
.kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ------------------------------- 报头 Masthead ---------------------------- */
.hero {
  position: relative;
  padding: 4px 0 22px;
  border-bottom: 1px solid var(--rule-2);
}
.hero h1 {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin-top: 6px;
}
.hero p { margin: 8px 0 0; color: var(--ink-2); font-size: 14.5px; }
.hero strong, .hero b { color: var(--accent); font-family: var(--font-mono); font-size: 1.05em; }
.hero-actions { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; }
.hero .stamp {
  position: absolute; right: 2px; top: 10px;
  width: 62px; height: 62px;
  border: 2px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 19px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  line-height: 1.05;
  letter-spacing: 0.08em;
  transform: rotate(-5deg);
  opacity: 0.5;
  padding: 4px;
}
@media (max-width: 640px) { .hero .stamp { display: none; } }

/* --------------------------------- 数据条 -------------------------------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.stat {
  padding: 15px 18px;
  border-right: 1px solid var(--rule);
  background: var(--surface);
  transition: background 0.12s;
}
.stat:last-child { border-right: none; }
.stat:hover { background: var(--surface-2); }
.stat-label {
  font-size: 11px; color: var(--ink-3);
  letter-spacing: 0.12em; text-transform: uppercase;
  font-family: var(--font-mono);
  display: flex; align-items: center; gap: 6px;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 27px; font-weight: 600;
  line-height: 1.25;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.stat-hint { font-size: 11.5px; color: var(--ink-3); margin-top: 1px; }
.c-primary { color: var(--primary); } .c-danger { color: var(--accent); }
.c-success { color: var(--ok); } .c-warning { color: var(--warn); } .c-info { color: var(--ink-2); }

/* --------------------------------- 按钮 ---------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.5;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { border-color: var(--ink-3); background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); border-color: var(--primary-2); color: #fff; }
.btn-danger { background: var(--surface); border-color: var(--rule-2); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: 3px 9px; font-size: 12.5px; }
.btn-lg { padding: 9px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--primary); cursor: pointer; padding: 2px 4px; }
.btn-link:hover { text-decoration: underline; }
.btn-link.danger { color: var(--danger); }
.btn-group { display: inline-flex; gap: 6px; }
.btn-white, .btn-ghost { background: var(--surface); border-color: var(--rule-2); color: var(--ink); }
.btn-white:hover, .btn-ghost:hover { background: var(--surface-2); color: var(--primary); }

/* --------------------------------- 表单 ---------------------------------- */
.field { margin-bottom: 15px; }
.label {
  display: block; margin-bottom: 5px;
  font-size: 11.5px; color: var(--ink-2);
  letter-spacing: 0.1em; text-transform: uppercase;
  font-family: var(--font-mono);
}
.label .req { color: var(--accent); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: #fff;
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.textarea { resize: vertical; min-height: 88px; line-height: 1.7; }
.select { cursor: pointer; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 15px) 51%, calc(100% - 10px) 51%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.form-hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox input { width: 15px; height: 15px; accent-color: var(--primary); cursor: pointer; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 190px; }
.search-box .input { padding-left: 30px; }
.search-box::before {
  content: ""; position: absolute; left: 10px; top: 50%; width: 13px; height: 13px;
  transform: translateY(-50%); pointer-events: none;
  background: currentColor; color: var(--ink-3);
  -webkit-mask: var(--search-mask) center/contain no-repeat;
  mask: var(--search-mask) center/contain no-repeat;
}
:root {
  --search-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4-4'/%3E%3C/svg%3E");
}

/* --------------------------------- 作业列表 ------------------------------ */
.task-list { display: flex; flex-direction: column; }
.task {
  display: flex; gap: 13px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--rule);
  transition: background 0.12s;
}
.task:last-child { border-bottom: none; }
.task:hover { background: var(--surface-2); }
.task.done { opacity: 0.55; }
.task.done .task-title { text-decoration: line-through; text-decoration-thickness: 1px; color: var(--ink-3); }
.task-check {
  width: 17px; height: 17px; margin-top: 3px; flex-shrink: 0;
  border: 1.5px solid var(--rule-2);
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: transparent;
  transition: all 0.12s;
}
.task-check:hover { border-color: var(--primary); color: var(--primary); }
.task-check.checked { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14.5px; word-break: break-word; }
.task-meta {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  margin-top: 6px; font-size: 11.5px; color: var(--ink-3);
  font-family: var(--font-mono);
}
.subject-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 0 6px; height: 19px;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  white-space: nowrap;
  flex: none;
  line-height: 1;
}
.task-detail {
  margin-top: 9px; padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-2);
  border-radius: 0 var(--r) var(--r) 0;
  color: var(--ink-2); font-size: 13px;
  white-space: pre-wrap; word-break: break-word;
}
.task-actions { display: flex; align-items: flex-start; gap: 5px; flex-shrink: 0; }
.pri-bar { width: 2px; border-radius: 0; align-self: stretch; flex-shrink: 0; }

/* --------------------------------- 空状态 -------------------------------- */
.empty { padding: 48px 20px; text-align: center; color: var(--ink-3); }
.empty-icon { color: var(--rule-2); display: flex; justify-content: center; }
.empty-title { margin-top: 10px; font-size: 14.5px; color: var(--ink-2); font-family: var(--font-serif); }
.empty-desc { font-size: 12.5px; margin-top: 3px; }

/* --------------------------------- 科目卡 -------------------------------- */
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 14px; }
.subject-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  padding: 16px;
  transition: border-color 0.12s, background 0.12s;
}
.subject-card:hover { border-color: var(--ink-3); background: var(--surface-2); }
.subject-icon {
  width: 38px; height: 38px; border-radius: 2px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  border: 1px solid currentColor;
}
.subject-name { font-family: var(--font-serif); font-size: 16px; font-weight: 700; margin-top: 11px; }
.subject-count { color: var(--ink-3); font-size: 12px; font-family: var(--font-mono); }
.subject-actions { position: absolute; top: 10px; right: 10px; display: none; gap: 4px; }
.subject-card:hover .subject-actions { display: flex; }
.subject-card .mini-btn {
  width: 24px; height: 24px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-2);
}
.subject-card .mini-btn:hover { border-color: var(--primary); color: var(--primary); }
.subject-card .mini-btn.danger:hover { border-color: var(--danger); color: var(--danger); }
.mini-tag {
  position: absolute; left: 0; top: 0;
  padding: 1px 8px;
  background: var(--primary); color: #fff;
  font-size: 10px; font-family: var(--font-mono);
  letter-spacing: 0.08em;
  border-radius: var(--r-lg) 0 3px 0;
}

/* --------------------------------- 进度条 -------------------------------- */
.progress { height: 6px; background: var(--paper-2); border-radius: 0; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); transition: width 0.4s; }
.bar-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px dotted var(--rule); }
.bar-row:last-child { border-bottom: none; }
.bar-name { width: 92px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 6px; background: var(--paper-2); overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); transition: width 0.5s; min-width: 2px; }
.bar-val { width: 70px; text-align: right; font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 132px; padding-top: 8px; justify-content: flex-start; border-bottom: 1px solid var(--rule); }
.chart-col { flex: 1 1 0; max-width: 54px; min-width: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bar { width: 100%; max-width: 28px; background: var(--primary); opacity: 0.85; min-height: 2px; transition: height 0.5s; }
.chart-bar:hover { opacity: 1; }
.chart-label { font-size: 10.5px; color: var(--ink-3); white-space: nowrap; font-family: var(--font-mono); }

/* --------------------------------- 表格 ---------------------------------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; padding: 10px 14px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-weight: 500; font-size: 11px;
  letter-spacing: 0.12em; text-transform: uppercase;
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--rule-2);
  white-space: nowrap;
}
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.mono { font-family: var(--font-mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* --------------------------------- 分页 ---------------------------------- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 5px; margin-top: 18px; flex-wrap: wrap; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 8px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  background: var(--surface);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12.5px;
}
.page-btn:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-info { color: var(--ink-3); font-size: 12px; margin: 0 6px; font-family: var(--font-mono); }

/* --------------------------------- 标签页 -------------------------------- */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule-2); padding: 0 20px; flex-wrap: wrap; }
.tab {
  padding: 12px 15px;
  cursor: pointer;
  color: var(--ink-3);
  border: none; background: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }

/* --------------------------------- 提示 ---------------------------------- */
.toast-wrap {
  position: fixed; top: 72px; left: 50%; transform: translateX(-50%);
  z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--ink-3);
  border-radius: var(--r);
  padding: 10px 18px;
  box-shadow: var(--shadow);
  max-width: 90vw;
}
.toast.success { border-left-color: var(--ok); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--primary); }

/* --------------------------------- 弹窗 ---------------------------------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(27, 26, 23, 0.42);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000; padding: 20px; overflow-y: auto;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  width: 100%; max-width: 540px;
  box-shadow: var(--shadow);
  margin: auto;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--rule-2);
  background: var(--surface-2);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.modal-title { font-family: var(--font-serif); font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--ink-3); padding: 2px; display: flex; }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 20px 22px; }
.modal-foot { padding: 0 22px 20px; display: flex; justify-content: flex-end; gap: 8px; }

/* --------------------------------- 认证页 -------------------------------- */
.auth-wrap {
  min-height: calc(100vh - var(--nav-h));
  display: flex; align-items: center; justify-content: center;
  padding: 34px 20px;
}
.auth-card {
  display: grid; grid-template-columns: 0.9fr 1.1fr;
  width: 100%; max-width: 820px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.auth-side {
  padding: 38px 34px;
  background: var(--primary);
  color: #eef2f6;
  display: flex; flex-direction: column; justify-content: space-between;
  border-right: 1px solid var(--primary-2);
}
.auth-side h2 { font-size: 22px; color: #fff; letter-spacing: 0.04em; }
.auth-side p { opacity: 0.82; margin-top: 10px; font-size: 13px; }
.auth-side ul { list-style: none; padding: 0; margin: 26px 0 0; font-size: 13px; }
.auth-side li { margin-bottom: 11px; display: flex; gap: 9px; align-items: flex-start; opacity: 0.92; }
.auth-side li::before { content: "—"; color: rgba(255, 255, 255, 0.5); }
.auth-form { padding: 38px 40px; }
.auth-form h2 { font-size: 20px; }
.auth-form .sub { margin-top: 6px; font-size: 13.5px; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 13px; color: var(--ink-2); }

/* --------------------------------- 管理员 -------------------------------- */
.admin-banner {
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.admin-banner h1 { font-size: 20px; }
.admin-banner p { margin: 6px 0 0; color: var(--ink-3); font-size: 13px; }
.kv {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 8px 0; border-bottom: 1px dotted var(--rule);
  font-size: 13.5px;
}
.kv:last-child { border-bottom: none; }
.kv span:first-child { color: var(--ink-3); }
.kv span:last-child { font-family: var(--font-mono); font-size: 12.5px; text-align: right; word-break: break-all; }

.alert {
  padding: 11px 15px;
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--warn);
  border-radius: var(--r);
  background: var(--warn-soft);
  color: var(--ink);
  font-size: 13.5px;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert.info { border-left-color: var(--primary); background: var(--primary-soft); }
.alert.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.alert.success { border-left-color: var(--ok); background: var(--ok-soft); }

/* ------------------------------- 个人主页 -------------------------------- */
.bio-box {
  margin-top: 6px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-left: 2px solid var(--rule-2);
  border-radius: 0 var(--r) var(--r) 0;
  color: var(--ink-2);
  line-height: 1.9;
  min-height: 52px;
  word-break: break-word;
}
.user-link { color: var(--ink); font-weight: 600; cursor: pointer; border-bottom: 1px solid var(--rule-2); }
.user-link:hover { color: var(--primary); border-bottom-color: var(--primary); }

/* ------------------------------ 全站作业卡片 ------------------------------ */
.asg-list { display: flex; flex-direction: column; }
.asg {
  display: flex; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  transition: background 0.12s;
}
.asg:last-child { border-bottom: none; }
.asg:hover { background: var(--surface-2); }
.asg.done .asg-title { color: var(--ink-3); }
.asg-flag {
  flex: none; width: 54px;
  font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.06em; text-transform: uppercase;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
  padding-top: 2px;
}
.asg-flag span {
  padding: 1px 5px; border: 1px solid currentColor; border-radius: 2px;
}
.flag-public { color: var(--primary); }
.flag-selected { color: var(--warn); }
.flag-private { color: var(--ink-3); }
.asg-main { flex: 1; min-width: 0; }
.asg-title { font-family: var(--font-serif); font-size: 16px; font-weight: 700; word-break: break-word; }
.asg-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 7px; font-size: 11.5px; color: var(--ink-3);
  font-family: var(--font-mono);
}
.asg-body {
  margin-top: 10px; padding: 10px 13px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  color: var(--ink-2); font-size: 13.5px;
  white-space: pre-wrap; word-break: break-word;
}
.asg-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex-shrink: 0; }

/* 人员选择器 */
.picker {
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  max-height: 230px;
  overflow-y: auto;
  background: var(--surface);
}
.picker-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: var(--surface-2); }
.picker-item input { accent-color: var(--primary); width: 15px; height: 15px; }
.picker-item .who { flex: 1; min-width: 0; }
.picker-empty { padding: 22px; text-align: center; color: var(--ink-3); font-size: 13px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 1px 4px 1px 8px; height: 22px;
  border: 1px solid var(--rule-2);
  border-radius: 2px;
  background: var(--surface-2);
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: nowrap;
}
.chip button { border: none; background: none; cursor: pointer; color: var(--ink-3); display: flex; padding: 0; }
.chip button:hover { color: var(--danger); }

/* 单选组（可见范围） */
.radio-row { display: flex; flex-direction: column; gap: 8px; }
.radio-card {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.12s, background 0.12s;
}
.radio-card:hover { border-color: var(--ink-3); }
.radio-card.on { border-color: var(--primary); background: var(--primary-soft); }
.radio-card input { margin-top: 4px; accent-color: var(--primary); }
.radio-card .t { font-weight: 600; }
.radio-card .d { font-size: 12.5px; color: var(--ink-3); }

/* --------------------------------- 404 ---------------------------------- */
.nf-wrap {
  min-height: calc(100vh - var(--nav-h) - 120px);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.nf {
  max-width: 620px; width: 100%;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  padding: 44px 46px;
  position: relative;
  overflow: hidden;
}
.nf-code {
  font-family: var(--font-mono);
  font-size: 13px; letter-spacing: 0.3em;
  color: var(--ink-3);
}
.nf h1 { font-size: 30px; margin-top: 6px; }
.nf p { color: var(--ink-2); margin: 12px 0 0; font-size: 14px; }
.nf .nf-path {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--rule);
  padding: 7px 10px; border-radius: var(--r);
  margin-top: 14px; word-break: break-all; color: var(--ink-2);
}
.nf-actions { margin-top: 22px; display: flex; gap: 8px; flex-wrap: wrap; }
.nf-stamp {
  position: absolute; right: 28px; top: 32px;
  width: 74px; height: 74px;
  border: 2px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-family: var(--font-serif);
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; text-align: center;
  line-height: 1.1; padding: 5px;
  transform: rotate(-7deg);
  opacity: 0.42;
}
@media (max-width: 640px) { .nf { padding: 30px 22px; } .nf-stamp { width: 58px; height: 58px; font-size: 16px; right: 16px; top: 20px; } }

/* --------------------------------- 页脚 ---------------------------------- */
.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 22px 46px;
  border-top: 1px solid var(--rule);
  color: var(--ink-3);
  font-size: 12px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-family: var(--font-mono);
}
.footer a { color: var(--ink-2); }

/* --------------------------------- 加载 ---------------------------------- */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--rule-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 56px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: var(--paper-2); border-radius: var(--r); }

/* --------------------------------- 响应式 -------------------------------- */
@media (max-width: 1000px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: none; }
  .stat:nth-child(-n + 2) { border-bottom: 1px solid var(--rule); }
  .auth-card { grid-template-columns: 1fr; max-width: 440px; }
  .auth-side { display: none; }
}
@media (max-width: 760px) {
  .nav-inner { gap: 10px; padding: 0 14px; }
  .brand-sub { display: none; }
  .nav-links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    background: var(--surface);
    flex-direction: column; align-items: stretch;
    padding: 8px 14px 14px; gap: 0;
    border-bottom: 1px solid var(--rule-2);
    box-shadow: var(--shadow);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-link { border-bottom: none; border-left: 2px solid transparent; margin: 0; padding: 10px 8px; }
  .nav-link.active { border-left-color: var(--accent); border-bottom: none; background: var(--surface-2); }
  .nav-toggle { display: block; }
  .nav-right { margin-left: auto; }
  .user-chip-name { display: none; }
  .page { padding: 18px 14px 56px; }
  .hero h1 { font-size: 22px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat { padding: 13px 14px; }
  .stat-value { font-size: 22px; }
  .card-pad { padding: 16px; }
  .auth-form { padding: 26px 20px; }
  .task { padding: 13px 14px; gap: 10px; }
  .task-actions { flex-direction: column; }
  /* 作业卡片：手机上必须整体竖排。
     之前只把 flag 设成 100% 宽、主体仍和大排按钮挤在一行，
     按钮一多（拍照交作业 + 标记完成 + 投稿 + 编辑…）标题就被压成一字一行。 */
  .asg { padding: 14px; gap: 10px; flex-direction: column; align-items: stretch; }
  .asg-flag { width: 100%; flex-direction: row; }
  .asg-main { width: 100%; }
  .asg-actions { flex-direction: row; align-items: center; justify-content: flex-start; flex-wrap: wrap; width: 100%; }
  .asg-actions .btn { flex: 0 1 auto; }
  .tabs { padding: 0 10px; }
  .tab { padding: 10px 11px; font-size: 13px; }
  .grid { grid-template-columns: 1fr !important; }
  .subject-grid { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 12px; }
  .admin-banner { padding: 16px 18px; }
  .modal-body, .modal-head, .modal-foot { padding-left: 16px; padding-right: 16px; }
  table.tbl th, table.tbl td { padding: 9px 10px; }
  .footer { flex-direction: column; }
}

/* 打印：便于把作业清单打出来 */
@media print {
  .nav, .footer, .task-actions, .toast-wrap, .btn { display: none !important; }
  body { background: #fff; }
  .card { border-color: #999; }
}

/* ============================ 名字颜色制度 ============================= */
.nc { font-weight: 600; }
.nc-gray { color: #8c877c; }
.nc-blue { color: #2b5578; }
.nc-green { color: #3d6a4b; }
.nc-orange { color: #b26a1f; }
.nc-red { color: #a3312a; }
/* 自定义色号由 nameSpan 走内联 style 给，这里不定义颜色。
   留一条规则只是为了让 .nc-custom 在样式表里有个明确的落点，
   顺便说明「没有 background 是有意的」。 */
.nc-custom { /* color 来自内联 style */ }
/* 称号：挂在名字旁边的小标签。用 currentColor 让它跟着名字颜色走 ——
   红名的人称号也是红的，视觉上是一体的，不用再配一套颜色 */
.name-tag {
  display: inline-block; margin-left: 5px; padding: 1px 7px;
  font-size: 11px; font-weight: 700; line-height: 1.6; vertical-align: 1px;
  border: 1.5px solid currentColor; border-radius: 999px;
  opacity: .85; white-space: nowrap;
}
.nc-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-right: 6px; vertical-align: 1px;
}
.legend-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 0; border-bottom: 1px dotted var(--rule); font-size: 13px;
}
.legend-row:last-child { border-bottom: none; }
.legend-row .lv-score {
  margin-left: auto; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3);
}

/* ============================== 题解列表 =============================== */
.sol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.sol-card {
  display: flex; flex-direction: column; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.sol-card:hover { border-color: var(--ink-3); background: var(--surface-2); }
.sol-title { font-family: var(--font-serif); font-size: 16.5px; font-weight: 700; line-height: 1.45; }
.sol-summary { color: var(--ink-2); font-size: 13px; line-height: 1.8; flex: 1; }
.sol-meta {
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono);
}
.sol-body {
  white-space: pre-wrap; word-break: break-word;
  line-height: 2; font-size: 14.5px; color: var(--ink);
}
.st-pending { color: var(--warn); background: var(--warn-soft); }
.st-approved { color: var(--ok); background: var(--ok-soft); }
.st-rejected { color: var(--danger); background: var(--danger-soft); }

/* 审核条 */
.review-bar {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 13px 16px;
  background: var(--warn-soft);
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--warn);
  border-radius: var(--r);
}
.review-bar.ok { background: var(--ok-soft); border-left-color: var(--ok); }
.review-bar.no { background: var(--danger-soft); border-left-color: var(--danger); }

/* 关联作业的展示条 */
.work-links { display: flex; flex-wrap: wrap; gap: 6px; }
.work-link {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1px 7px; max-width: 100%;
  border: 1px dashed var(--rule-2);
  border-radius: 2px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-family: var(--font-mono);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.work-link[data-goto-assignment], .work-link[data-asg-solutions] { cursor: pointer; border-style: solid; }
.work-link[data-goto-assignment]:hover, .work-link[data-asg-solutions]:hover { border-color: var(--primary); color: var(--primary); }

/* ============================== 判题记录 =============================== */
table.tbl td .status-pill { vertical-align: middle; }
.judg-kind { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }

/* =============================== 站务版 ================================ */
.post-list { display: flex; flex-direction: column; }
.post-row {
  display: flex; gap: 14px; padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer; transition: background 0.12s;
}
.post-row:last-child { border-bottom: none; }
.post-row:hover { background: var(--surface-2); }
.post-flag {
  flex: none; width: 62px; padding-top: 2px;
  display: flex; flex-direction: column; gap: 4px; align-items: flex-start;
}
.post-flag span, .post-flag-inline {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.06em;
  padding: 1px 5px; border: 1px solid currentColor; border-radius: 2px; white-space: nowrap;
}
.cat-notice { color: var(--primary); }
.cat-changelog { color: var(--ok); }
.cat-rule { color: var(--warn); }
.cat-pin { color: var(--accent); }
.cat-hide { color: var(--ink-3); }
.cat-sys { color: var(--ink-2); }
.post-main { flex: 1; min-width: 0; }
.post-title { font-family: var(--font-serif); font-size: 16.5px; font-weight: 700; }
.post-summary { color: var(--ink-2); font-size: 13px; line-height: 1.8; margin-top: 6px; }

.comment { padding: 12px 0; border-bottom: 1px dotted var(--rule); }
.comment:last-of-type { border-bottom: none; }
.comment-body { margin-top: 7px; font-size: 13.5px; color: var(--ink); white-space: pre-wrap; word-break: break-word; }

@media (max-width: 760px) {
  .post-row { padding: 14px; gap: 10px; }
  .post-flag { width: 100%; flex-direction: row; }
}

/* ============================== 陶片放逐 =============================== */
.perm-cell { display: flex; flex-wrap: wrap; gap: 4px; }
.perm-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 6px; border: 1px solid currentColor; border-radius: 2px;
  font-family: var(--font-mono); font-size: 11px; white-space: nowrap;
  color: var(--ink-2);
}
.perm-tag.revoke { color: var(--accent); background: var(--accent-soft); }
.perm-tag.restore { color: var(--ok); background: var(--ok-soft); }
.cat-lock { color: var(--danger); }

/* 站务列表行尾的锁帖按钮 */
.post-lock-btn { align-self: flex-start; flex: none; }
.post-row { align-items: flex-start; }

/* ============================ Markdown 正文 ============================= */
.md-body { line-height: 1.95; word-break: break-word; }
.md-body > *:first-child { margin-top: 0; }
.md-body > *:last-child { margin-bottom: 0; }
.md-p { margin: 0 0 12px; }
.md-h {
  font-family: var(--font-serif);
  margin: 20px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--rule);
  line-height: 1.5;
}
h2.md-h { font-size: 19px; }
h3.md-h { font-size: 17px; }
h4.md-h { font-size: 15.5px; }
h5.md-h, h6.md-h { font-size: 14.5px; color: var(--ink-2); }
.md-ul, .md-ol { margin: 0 0 12px; padding-left: 22px; }
.md-ul li, .md-ol li { margin: 4px 0; }
.md-ul { list-style: none; padding-left: 18px; }
.md-ul li::before { content: "·"; font-weight: 700; color: var(--ink-3); display: inline-block; width: 12px; margin-left: -12px; }
.md-quote {
  margin: 0 0 12px; padding: 8px 14px;
  background: var(--surface-2);
  border-left: 3px solid var(--rule-2);
  border-radius: 0 var(--r) var(--r) 0;
  color: var(--ink-2);
}
.md-quote .md-p { margin: 0; }
.md-hr { border: none; border-top: 1px solid var(--rule-2); margin: 20px 0; }
.md-code {
  font-family: var(--font-mono); font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--rule);
  padding: 1px 5px; border-radius: 2px;
}
.md-pre {
  margin: 0 0 12px; padding: 12px 14px; overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--rule-2);
  border-radius: 0 var(--r) var(--r) 0;
}
.md-pre code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.75; white-space: pre; }
.md-table-wrap { overflow-x: auto; margin: 0 0 12px; }
.md-table { border-collapse: collapse; font-size: 13.5px; min-width: 60%; }
.md-table th, .md-table td { border: 1px solid var(--rule); padding: 6px 11px; text-align: left; }
.md-table th { background: var(--surface-2); font-weight: 600; }
.md-img { max-width: 100%; border: 1px solid var(--rule); border-radius: var(--r); display: block; margin: 8px 0; }
.md-body a { border-bottom: 1px solid var(--rule-2); }
.md-body a:hover { border-bottom-color: var(--primary); text-decoration: none; }
.md-body del { color: var(--ink-3); }
.md-body strong { font-weight: 700; }

/* 公式 */
.md-math-block { display: block; margin: 12px 0; overflow-x: auto; overflow-y: hidden; padding: 2px 0; }
.md-math-inline { white-space: nowrap; }
.katex { font-size: 1.04em; }
.katex-display { margin: 12px 0; }
.katex-display > .katex { white-space: normal; }

/* 预览框 */
.md-preview {
  margin-top: 8px; padding: 12px 14px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--r);
  background: var(--surface-2);
  max-height: 340px; overflow-y: auto;
}

/* ================================ 工单 ================================= */
.staff-reply {
  background: var(--primary-soft);
  border-left: 3px solid var(--primary);
  padding: 12px 14px;
  border-radius: 0 var(--r) var(--r) 0;
  margin: 10px 0;
}


/* 页脚备案信息 */
.footer-beian { display: flex; gap: 14px; flex-wrap: wrap; }
.footer-beian a { color: var(--ink-3); font-size: 11.5px; }
.footer-beian a:hover { color: var(--primary); }

/* =============================== 文档界面 =============================== */
.docs-page { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: start; }
.docs-nav {
  position: sticky; top: calc(var(--nav-h) + 20px);
  border-right: 1px solid var(--rule);
  padding-right: 18px;
}
.docs-nav-title { font-family: var(--font-serif); font-size: 19px; font-weight: 700; margin: 4px 0 14px; }
.docs-nav nav { display: flex; flex-direction: column; gap: 2px; }
.docs-link {
  display: block; padding: 7px 10px;
  border-left: 2px solid transparent;
  color: var(--ink-2); font-size: 13.5px;
  border-radius: 0 var(--r) var(--r) 0;
  cursor: pointer;
}
.docs-link:hover { background: var(--surface-2); color: var(--primary); text-decoration: none; }
.docs-link.active { border-left-color: var(--accent); background: var(--surface-2); color: var(--ink); font-weight: 600; }

.docs-body {
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  padding: 28px 34px 34px;
  min-width: 0;
}
.docs-h1 { font-size: 26px; margin-top: 4px; }
.docs-content { font-size: 14.5px; }
.docs-content .md-h:first-child { margin-top: 0; }
.docs-pager {
  display: flex; justify-content: space-between; gap: 10px;
  margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--rule);
}
.docs-pager .btn { max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 860px) {
  .docs-page { grid-template-columns: 1fr; gap: 18px; }
  .docs-nav { position: static; border-right: none; border-bottom: 1px solid var(--rule); padding: 0 0 14px; }
  .docs-nav nav { flex-direction: row; flex-wrap: wrap; }
  .docs-link { border-left: none; border-bottom: 2px solid transparent; border-radius: 0; }
  .docs-link.active { border-left: none; border-bottom-color: var(--accent); }
  .docs-body { padding: 20px 18px 26px; }
}

/* ======================= v1.11 头像 / 社交平台 / 私信 / 团队 ======================= */

/* --------------------------------- 头像 ---------------------------------- */
.avatar.has-img { padding: 0; overflow: hidden; background: var(--paper-2); }
.avatar.has-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.xl { width: 76px; height: 76px; }
.avatar.radius { border-radius: 20px; }
.chev { font-size: 10px; color: var(--ink-3); }
.dropdown-head { padding: 10px 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.avatar-edit { display: flex; flex-direction: column; align-items: center; padding: 8px 0 0; }
.avatar-preview { display: flex; justify-content: center; }

/* ------------------------------ 社交平台胶囊 ------------------------------ */
.social-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.social-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px 5px 8px;
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  text-decoration: none;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.social-pill:hover { border-color: var(--ink-3); color: var(--ink); background: var(--surface); text-decoration: none; }
.brand-ic { display: block; flex-shrink: 0; }
.social-fields { display: flex; flex-direction: column; gap: 8px; }
.social-field { display: flex; align-items: center; gap: 9px; }
.social-field-ic { display: flex; flex-shrink: 0; }
.social-field .input { width: 100%; }

/* --------------------------------- 页脚 ---------------------------------- */
.footer-main { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.footer-dot { color: var(--rule-2); }
.footer-beian { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.footer-beian a { color: var(--ink-3); font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; }
.footer-beian a:hover { color: var(--primary); }
.beian-badge { display: inline-block; flex-shrink: 0; }

/* ------------------------------ Markdown 扩展 ----------------------------- */
.md-fold {
  border: 1px solid var(--rule-2);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--r) var(--r) 0;
  background: var(--surface-2);
  margin: 12px 0;
  overflow: hidden;
}
.md-fold-sum {
  cursor: pointer;
  padding: 9px 14px;
  font-weight: 600;
  color: var(--primary);
  font-size: 13.5px;
  list-style: none;
  display: flex; align-items: center; gap: 8px;
  user-select: none;
}
.md-fold-sum::-webkit-details-marker { display: none; }
.md-fold-sum::before {
  content: '▸';
  font-size: 11px; color: var(--ink-3);
  transition: transform 0.15s;
}
.md-fold[open] > .md-fold-sum::before { transform: rotate(90deg); }
.md-fold[open] > .md-fold-sum { border-bottom: 1px solid var(--rule); }
.md-fold-body { padding: 4px 14px 2px; }
.md-fold-body > :last-child { margin-bottom: 8px; }

.md-video { display: block; margin: 14px 0; }
.md-video-title {
  display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; color: var(--ink-2);
}
.md-video-frame {
  display: block; position: relative; width: 100%; max-width: 720px;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--rule-2);
  border-radius: var(--r);
  overflow: hidden;
}
.md-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.md-video-bad {
  display: inline-block; padding: 4px 9px;
  background: var(--warn-soft); color: var(--warn);
  border: 1px solid var(--rule-2); border-radius: var(--r);
  font-size: 12.5px;
}
.md-img { max-width: 100%; height: auto; display: block; margin: 10px 0; border: 1px solid var(--rule); border-radius: var(--r); }
.md-img-link { display: inline-block; max-width: 100%; }
.md-img-link:hover .md-img { border-color: var(--ink-3); }

/* --------------------------------- 私信 ---------------------------------- */
.conv {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 13px 16px;
  border: none; border-bottom: 1px solid var(--rule);
  background: none; cursor: pointer;
}
.conv:last-child { border-bottom: none; }
.conv:hover { background: var(--surface-2); }
.conv-main { flex: 1; min-width: 0; }
.conv-name { font-weight: 600; display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.conv-preview {
  color: var(--ink-3); font-size: 12.5px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.conv-me { color: var(--ink-3); }
.conv-time { color: var(--ink-3); font-size: 11.5px; font-family: var(--font-mono); flex-shrink: 0; }
.conv-unread {
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--accent); color: #fff;
  border-radius: 999px; font-size: 11.5px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.chat-page { max-width: 820px; display: flex; flex-direction: column; min-height: calc(100vh - var(--nav-h) - 150px); }
.chat-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-bottom: none;
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}
.chat-body {
  flex: 1;
  min-height: 320px; max-height: 58vh;
  overflow-y: auto;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  display: flex; flex-direction: column; gap: 14px;
}
.chat-more { text-align: center; }
.chat-empty { text-align: center; margin: auto; font-size: 13px; }
.chat-foot {
  display: flex; gap: 10px; align-items: flex-end;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--rule-2); border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.chat-input { min-height: 62px; margin: 0; flex: 1; resize: vertical; }
.chat-tip { font-size: 11.5px; margin-top: 8px; text-align: right; }

.msg { display: flex; gap: 9px; align-items: flex-end; max-width: 100%; }
.msg.mine { flex-direction: row-reverse; }
.msg-bubble { max-width: min(560px, 76%); }
.msg-text {
  padding: 9px 13px;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1px solid var(--rule-2);
  word-break: break-word;
  overflow-wrap: anywhere;
}
.msg-text > :first-child { margin-top: 0; }
.msg-text > :last-child { margin-bottom: 0; }
.msg.mine .msg-text { background: var(--primary-soft); border-color: #cfdae4; }
.msg-meta {
  font-size: 11px; color: var(--ink-3); margin-top: 4px;
  font-family: var(--font-mono);
}
.msg.mine .msg-meta { text-align: right; }

/* ------------------------------ 班级 / 团队 ------------------------------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.team-card {
  display: flex; flex-direction: column; gap: 8px;
  text-align: left;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.team-card:hover { border-color: var(--ink-3); background: var(--surface-2); }
.team-card-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.team-name { font-weight: 600; font-size: 15.5px; }
.team-card-intro {
  color: var(--ink-2); font-size: 12.5px; min-height: 34px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.team-card-foot {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
  color: var(--ink-3); font-size: 11.5px; font-family: var(--font-mono);
  border-top: 1px dotted var(--rule); padding-top: 8px;
}
.team-myrole { margin-left: auto; color: var(--primary); font-family: var(--font-sans); }
.team-kind {
  display: inline-flex; align-items: center;
  padding: 0 6px; height: 19px;
  font-size: 11px; font-weight: 600;
  border: 1px solid currentColor; border-radius: 2px;
  white-space: nowrap; flex: none;
}
.kind-class { color: #2b5578; background: #2b557814; }
.kind-team { color: #4a6b45; background: #4a6b4514; }
.kind-club { color: #8a6a2f; background: #8a6a2f14; }
.team-hero { position: relative; }
.team-intro { color: var(--ink-2); font-size: 13.5px; margin-top: 10px; max-width: 60ch; }
.team-actions { gap: 8px; }
.invite-box {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 12px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--rule-2);
  border-radius: var(--r);
}
.invite-label { font-size: 11.5px; color: var(--ink-3); }
.invite-code { font-size: 19px; font-weight: 700; letter-spacing: 3px; color: var(--primary); }
.team-announce {
  margin-top: 16px; padding: 12px 14px;
  background: var(--warn-soft);
  border-left: 3px solid var(--warn);
  border-radius: 0 var(--r) var(--r) 0;
}
.team-announce-label { font-weight: 600; font-size: 12.5px; color: var(--warn); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.card-head-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 14px 18px; border-bottom: 1px solid var(--rule);
}
.card-head-row .card-title { margin: 0; }
.card-head-row .btn { margin-left: auto; }
.team-role {
  display: inline-flex; align-items: center;
  padding: 0 6px; height: 19px;
  font-size: 11px; font-weight: 600;
  border: 1px solid var(--rule-2); border-radius: 2px;
  color: var(--ink-2); background: var(--surface-2);
  white-space: nowrap; flex: none;
}
.team-role.role-owner { color: var(--accent); border-color: currentColor; background: var(--accent-soft); }
.team-role.role-manager { color: var(--primary); border-color: currentColor; background: var(--primary-soft); }
.tasg {
  display: flex; gap: 14px; align-items: flex-start; justify-content: space-between;
  padding: 14px 0; border-bottom: 1px dotted var(--rule);
  flex-wrap: wrap;
}
.tasg:last-child { border-bottom: none; padding-bottom: 0; }
.tasg-main { flex: 1; min-width: 220px; }
.tasg-title { font-weight: 600; font-size: 15px; }
.tasg-detail { color: var(--ink-2); font-size: 13px; margin-top: 8px; }
.tasg-side { display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.danger-zone { border-color: #e3cbc7; }
.picker-btn {
  display: flex; align-items: center; gap: 9px;
  width: 100%; text-align: left; cursor: pointer;
  padding: 8px 10px; border-radius: var(--r);
  border: 1px solid transparent; background: none;
  color: var(--ink-2); font: inherit;
}
.picker-btn:hover { background: var(--primary-soft); border-color: var(--primary-soft); color: var(--ink); }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.table th, table.table td { padding: 11px 16px; text-align: left; border-bottom: 1px solid var(--rule); }
table.table th { font-size: 11.5px; color: var(--ink-3); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
table.table tbody tr:last-child td { border-bottom: none; }
table.table td.right { text-align: right; }
.upper { text-transform: uppercase; letter-spacing: 2px; font-weight: 700; }

/* ============================== 移动端专项优化 ============================== */
/* 中等宽度（平板 / 小笔记本）：导航放不下 11 项带图标的按钮，
   去掉图标、收紧间距，保持一行可见；再窄（≤760px）才折叠成汉堡菜单 */
@media (max-width: 1220px) and (min-width: 761px) {
  .nav-inner { padding: 0 14px; gap: 8px; }
  .brand-sub { display: none; }
  .nav-link { padding: 0 7px; font-size: 13px; }
  .nav-link .ic { display: none; }
  .nav-badge { margin-left: 4px; }
  .user-chip-name { max-width: 78px; }
}

@media (max-width: 860px) {
  .msg-bubble { max-width: 84%; }
  .chat-body { max-height: none; min-height: 300px; }
}

@media (max-width: 760px) {
  /* 输入框字号 ≥16px，避免 iOS 自动放大页面 */
  .input, .select, .textarea, .chat-input { font-size: 16px; }
  .chat-input { min-height: 54px; }
  .docs-content, .md-body { font-size: 15px; }

  /* 触控目标不小于 40px */
  .btn { min-height: 36px; }
  .btn-sm { min-height: 32px; }
  .nav-toggle { padding: 8px 11px; }
  .task-check { width: 22px; height: 22px; }

  .page { padding: 16px 12px calc(48px + env(safe-area-inset-bottom)); }
  .card-pad { padding: 15px; }

  /* 页脚竖排、居中 */
  .footer { flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 14px calc(28px + env(safe-area-inset-bottom)); }
  .footer-main { flex-direction: column; align-items: flex-start; gap: 3px; }
  .footer-dot { display: none; }
  .footer-beian { flex-direction: column; align-items: flex-start; gap: 6px; }

  /* 团队 / 私信 */
  .team-grid { grid-template-columns: 1fr; }
  .team-actions .btn { flex: 1 1 auto; }
  .tasg { flex-direction: column; }
  .tasg-side { flex-direction: row; flex-wrap: wrap; }
  .chat-head { gap: 8px; padding: 10px 12px; }
  .chat-head .row { flex: 1 1 100%; order: 3; }
  .chat-foot { flex-direction: column; align-items: stretch; }
  .chat-foot .btn { width: 100%; }
  .conv { padding: 12px; gap: 10px; }
  .msg-bubble { max-width: 88%; }
  table.table th, table.table td { padding: 9px 10px; white-space: nowrap; }

  /* 编辑器工具栏换行 */
  .row-between > .row { flex-wrap: wrap; }
  .md-video-frame { max-width: 100%; }

  /* 个人主页操作按钮铺满 */
  .profile-actions { width: 100%; }
  .profile-actions .btn { flex: 1 1 auto; justify-content: center; }
  .social-row { gap: 6px; }
  .social-pill { font-size: 12px; padding: 5px 9px 5px 7px; }

  /* 弹窗接近全屏，方便手机上填写 */
  .modal { max-width: none !important; width: calc(100vw - 16px); max-height: 92vh; }
  .modal-mask { padding: 8px; align-items: flex-end; }
  .modal-body { padding: 14px 14px 18px; }
  .modal-foot { padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; justify-content: center; }
  .radio-row { grid-template-columns: 1fr !important; }
  .invite-code { font-size: 17px; letter-spacing: 2px; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 15px; }
  .nav-link { padding: 9px 7px; font-size: 13px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .msg-bubble { max-width: 92%; }
  .avatar.xl { width: 64px; height: 64px; }
  .social-pill span { display: none; }
  .social-pill { padding: 6px; }
}

/* 注销账号：删除清单 */
.del-list { border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; }
.del-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 8px 12px; font-size: 13px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
}
.del-row:last-child { border-bottom: none; }
.del-row b { font-family: var(--font-mono); color: var(--danger); }

/* ============================== 作业照片 ============================== */
.work-link.has-photos { color: var(--accent); }
.photo-group { margin-top: 18px; }
.photo-group-head {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding-bottom: 6px; border-bottom: 1px solid var(--rule);
}
.photo-group-head .user-link { font-weight: 600; cursor: pointer; }
.photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; margin-top: 10px;
}
.photo-thumb {
  margin: 0; border: 1px solid var(--rule-2); border-radius: var(--r);
  overflow: hidden; background: var(--surface-2);
}
.photo-thumb img {
  display: block; width: 100%; height: 110px; object-fit: cover;
  cursor: zoom-in; background: var(--paper-2);
}
.photo-thumb img:hover { opacity: 0.92; }
.photo-thumb figcaption {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 4px 7px; font-size: 11px; color: var(--ink-3);
  font-family: var(--font-mono);
}
.lightbox { text-align: center; background: var(--paper-2); border-radius: var(--r); padding: 8px; }
.lightbox img { max-width: 100%; max-height: 68vh; border-radius: var(--r); }
@media (max-width: 760px) {
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .photo-thumb img { height: 92px; }
}
