/* ============================================================
   训练观察台 · 设计系统（v2.6「墨蓝 + 荧光笔」）
   - 墨蓝：顶栏、标题、主要文字，像老师批改用的钢笔墨水
   - 荧光黄：只用来标记「你在哪里」（当前导航、当前子页）
   - 判题色：通过 / 答案错误 / 其他，全站图表统一，已做色觉辨识校验
   - 数字：成绩、排名、计数统一用窄体数字字体，像赛场计分板
   页面级 CSS 只负责布局细节，不再重复定义按钮/表格/卡片。
   ============================================================ */

:root {
  /* 画布与表面：偏冷的纸面 */
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #edf0f4;

  /* 墨色 */
  --ink-deep: #14233f;
  --ink: #1b2b47;
  --ink-2: #3b4a5e;
  --muted: #66748a;
  --faint: #97a3b4;

  /* 线条 */
  --line: #dce2ea;
  --line-soft: #e9edf2;
  --line-strong: #c7d0dc;

  /* 钢笔蓝（操作与链接） */
  --accent: #2350d8;
  --accent-strong: #1a3db0;
  --accent-soft: #eaf0ff;
  --accent-line: #c6d4fa;

  /* 荧光笔 */
  --hl: #ffd43b;
  --hl-soft: #ffe98a;

  /* 文字语义色（涨跌、状态） */
  --up: #157a52;
  --up-soft: #e6f4ee;
  --down: #c8382e;
  --down-soft: #fcecea;
  --warn: #9a5a00;
  --warn-soft: #fdf3dd;
  --violet: #5b45d6;
  --violet-soft: #efecfe;
  --info: #1d63b8;
  --info-soft: #e8f1fc;

  /* 判题色：浅色表面 / 墨蓝表面各一套（CVD ΔE ≥ 9） */
  --v-ac: #167c8a;
  --v-wa: #e0554a;
  --v-other: #efaa3a;
  --v-ac-on-ink: #3dbfae;
  --v-wa-on-ink: #ff6f6a;
  --v-other-on-ink: #f5be4a;

  /* 兼容旧变量名 */
  --fg: var(--ink);
  --border: var(--line);
  --first: var(--accent);
  --zero: var(--muted);
  --na: var(--faint);
  --header-bg: var(--ink-deep);
  --header-fg: #fff;

  /* 形状：大块 12 / 卡片 8 / 控件 6 / 标签 4 */
  --radius-lg: 12px;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --shadow-xs: none;
  --shadow-sm: 0 1px 0 rgba(20, 35, 63, 0.04);
  --shadow-md: 0 24px 64px rgba(20, 35, 63, 0.24);
  --ring: 0 0 0 3px rgba(35, 80, 216, 0.22);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", "Segoe UI", sans-serif;
  --num: "DIN Alternate", "Bahnschrift", "D-DIN", "Roboto Condensed",
    "Arial Narrow", var(--font);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* hidden 属性始终生效，不被 display:flex 等组件样式覆盖 */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 {
  color: var(--ink);
  letter-spacing: -0.01em;
  line-height: 1.3;
}

code, .mono { font-family: var(--mono); font-size: 0.92em; }

/* 所有成绩/计数数字 */
.num, .col-total, .col-rank, .col-delta, .score-cell .base, .score-cell .delta,
.stat-card .num, .summary-card .num, .status-items strong, .data-table td.num {
  font-family: var(--num);
  font-variant-numeric: tabular-nums;
}

/* ---------------- 顶栏（墨蓝） ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ink-deep);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 58px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  min-width: 0;
}
.brand:hover { color: #fff; text-decoration: none; }
/* 品牌标记：一行判题结果小方块 */
.brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(5, 6px);
  gap: 2px;
  padding: 7px 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  flex: none;
}
.brand-mark i { display: block; width: 6px; height: 14px; border-radius: 1.5px; }
.brand-mark .m-ac { background: var(--v-ac-on-ink); }
.brand-mark .m-wa { background: var(--v-wa-on-ink); }
.brand-mark .m-other { background: var(--v-other-on-ink); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.brand-text strong {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.brand-text small {
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topnav { display: flex; align-items: stretch; gap: 6px; align-self: stretch; }
.topnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13.5px;
  font-weight: 550;
  padding: 0 12px;
  white-space: nowrap;
  transition: color 0.15s;
}
.topnav a:hover { color: #fff; text-decoration: none; }
.topnav a.active { color: #fff; }
/* 荧光笔：当前位置 */
.topnav a.active::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 4px;
  border-radius: 3px 3px 0 0;
  background: var(--hl);
}

.tz {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}
.tz::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--v-ac-on-ink);
}

/* 退出登录（仅启用访问密码时出现） */
.logout-form { margin: 0 0 0 -16px; }
.logout-form button {
  padding: 4px 10px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
}
.logout-form button:hover { color: #fff; background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.4); }

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--ink-deep);
}
.login-card {
  width: min(360px, 100%);
  padding: 28px 28px 24px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-brand .brand-mark { background: var(--ink-deep); }
.login-brand .brand-text small { color: var(--muted); }
.login-form { display: grid; gap: 8px; }
.login-form label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.login-form button { margin-top: 8px; padding: 9px 14px; font-size: 14px; }
.login-error { margin: 0; font-size: 12.5px; color: var(--down); }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 26px 28px 80px;
}

/* ---------------- 页面标题与页内导航 ---------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 24px;
  flex-wrap: wrap;
  margin: 2px 0 14px;
}
.page-head-main { min-width: 0; flex: 1 1 420px; }
.page-head h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink-deep);
}
.page-head .page-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12.5px;
}
.page-head .page-meta .sep-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.page-actions form { margin: 0; }

.subtabs {
  position: relative;
  z-index: 0;
  display: flex;
  align-items: center;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  overflow-x: auto;
  scrollbar-width: none;
}
.subtabs::-webkit-scrollbar { display: none; }
.subtabs a {
  position: relative;
  padding: 10px 4px 12px;
  margin-right: 22px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--muted);
  white-space: nowrap;
}
.subtabs a:hover { color: var(--ink); text-decoration: none; }
.subtabs a.active { color: var(--ink-deep); font-weight: 650; }
/* 荧光笔划过当前子页 */
.subtabs a.active::before {
  content: "";
  position: absolute;
  left: -3px;
  right: -3px;
  top: 52%;
  height: 0.62em;
  border-radius: 2px;
  background: var(--hl-soft);
  z-index: -1;
}
.subtabs a.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--ink-deep);
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
}
.back:hover { color: var(--accent); }

/* ---------------- 按钮 ---------------- */

button,
.btn,
a.btn-primary,
a.btn-outline {
  font-family: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  padding: 7px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  box-shadow: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s,
    box-shadow 0.15s, transform 0.05s;
  white-space: nowrap;
}
a.btn-primary, a.btn-outline { display:inline-flex; align-items:center; justify-content:center; gap:7px; text-decoration:none; }
button:hover,
.btn:hover {
  background: var(--surface-2);
  border-color: #aab6c6;
  color: var(--ink);
}
button:active,
.btn:active { transform: translateY(1px); }
button:focus-visible,
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--ring);
}
button:disabled,
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary,
a.btn-primary,
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover,
a.btn-primary:hover,
button.primary:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.btn-ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: var(--muted);
}
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; color: var(--ink); }
.btn-outline { background: var(--surface); color: var(--ink-2); }
.btn-outline:hover { background: var(--surface-2); color: var(--ink); }
.btn-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 550;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: none;
  text-decoration: none;
  cursor: pointer;
}
.btn-sm:hover { background: var(--surface-2); color: var(--ink); border-color: #aab6c6; text-decoration: none; }
.btn-danger {
  background: var(--down-soft);
  border-color: #f2c9c4;
  color: var(--down);
}
.btn-danger:hover { background: #f9e2df; border-color: #e9afa8; color: var(--down); }

/* ---------------- 表单控件 ---------------- */

input:not([type]),
input[type="text"],
input[type="email"],
input[type="url"],
input[type="tel"],
input[type="time"],
input[type="search"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="password"],
select,
textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-height: 34px;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--ring);
}
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 50%, calc(100% - 10px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 28px;
}
label { color: var(--ink-2); }
.hint { color: var(--muted); font-size: 12px; }
.muted { color: var(--muted); }
.inline { display: inline; }

/* ---------------- 卡片 / 分组 ---------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
}
.panel-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 18px 12px;
}
.panel-head h2 {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--ink-deep);
}
.panel-head p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.panel-head .spacer { flex: 1; }

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 650;
}

/* ---------------- 统计卡 ---------------- */

.stat-cards,
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card,
.summary-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 13px;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.stat-card::before,
.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--line-strong);
}
.stat-card .num,
.summary-card .num {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.stat-card .lbl,
.summary-card .lbl {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
}
.stat-card .sub,
.summary-card .sub {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--faint);
}
/* v2：标签在上、一个主数字、说明在下 */
.stat-card-v2 .lbl { margin: 0 0 4px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.stat-card-v2 .num small {
  margin-left: 5px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.stat-card-v2 .sub { margin-top: 6px; font-size: 12px; color: var(--muted); }
.attn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; }
.attn-list li { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.attn-list b { font-family: var(--num); color: var(--ink); font-size: 13px; }
.attn-list .sd { width: 7px; height: 7px; box-shadow: none; }

.c-blue::before { background: var(--accent); }
.c-green::before { background: var(--v-ac); }
.c-orange::before { background: var(--v-other); }
.c-red::before { background: var(--v-wa); }
.c-purple::before { background: var(--violet); }

/* ---------------- 徽标 / 标签 ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  background: var(--surface-3);
  color: var(--muted);
}
.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.9;
}
.badge.active, .badge.ok { background: var(--up-soft); color: var(--up); }
.badge.done, .badge.none { background: var(--surface-3); color: var(--muted); }
.badge.bad { background: var(--down-soft); color: var(--down); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

.tag,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  white-space: nowrap;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #f1ddb6;
}
.pill-idle { background: var(--violet-soft); color: var(--violet); border-color: #ddd4fb; }
.pill-more { background: var(--surface-3); color: var(--muted); border-color: var(--line); }

/* ---------------- 工具栏 / 控制条 ---------------- */

.view-toolbar,
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.controls { gap: 12px; }
.controls .grp,
.view-toolbar .grp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.controls label,
.view-toolbar label { font-size: 12.5px; color: var(--muted); }
.controls .sep,
.view-toolbar .sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 2px;
  flex: none;
}
.controls input[type="number"],
.controls input[type="search"],
.controls select,
.view-toolbar input[type="number"] {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 12.5px;
}
.view-toolbar button,
.controls .win-btns button,
.controls .view-btns button {
  padding: 5px 11px;
  font-size: 12.5px;
  border-radius: 7px;
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  box-shadow: none;
}
.view-toolbar button:hover,
.controls .win-btns button:hover,
.controls .view-btns button:hover {
  border-color: var(--accent-line);
  color: var(--accent);
  background: var(--accent-soft);
}
.view-toolbar button.active,
.controls .win-btns button.active,
.controls .view-btns button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.view-toolbar button.active:hover,
.controls .win-btns button.active:hover,
.controls .view-btns button.active:hover { color: #fff; background: var(--accent-strong); }

/* 筛选条 */
.search-bar,
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  align-items: center;
}
.search-bar input,
.filter-bar input {
  flex: 1 1 220px;
  min-width: 160px;
}
.filter-bar { font-size: 13px; color: var(--muted); }
.filter-bar select { flex: 0 0 auto; }
.filter-bar #count-info { margin-left: auto; font-size: 12px; color: var(--faint); }

/* ---------------- 状态条 ---------------- */

.status-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.status-items {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  flex: 1;
}
.status-items > * {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 2px 14px;
  font-size: 12.5px;
  color: var(--muted);
  border-right: 1px solid var(--line-soft);
}
.status-items > *:first-child { padding-left: 2px; }
.status-items > *:last-child { border-right: none; }
.status-items strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.status-items .ok { color: var(--up); font-weight: 600; }
.status-items .err { color: var(--down); }
.status-items .warn { color: var(--warn); }
.status-items .na { color: var(--faint); }
.status-bar form { margin: 0; }
.status-bar > a.inline { font-size: 13px; }

.stale-banner,
.special-banner,
.collect-failures {
  width: 100%;
  margin-top: 8px;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.55;
}
.stale-banner {
  background: var(--warn-soft);
  border: 1px solid #f0ddb5;
  color: #7a4c00;
}

.baseline-info {
  background: var(--accent-soft);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  margin-bottom: 12px;
  font-size: 12.5px;
  color: #23408f;
}
.baseline-info .warn { color: var(--warn); font-weight: 600; }

/* ---------------- 表格 ---------------- */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: auto;
  margin-bottom: 20px;
  box-shadow: var(--shadow-xs);
}
.table-wrap h2 {
  margin: 0;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 650;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky;
  left: 0;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 9px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  vertical-align: middle;
}
.data-table thead th {
  background: #f3f5f9;
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 650;
  border-bottom: 1px solid var(--line-strong);
  position: sticky;
  top: 0;
  z-index: 2;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: #f5f8fd; }
.data-table th.col-section,
.data-table td.col-section { text-align: center; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.row-clickable { cursor: pointer; }
.row-clickable:hover { background: #eef3ff !important; }
.col-rank {
  width: 64px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
.col-rank.rank-top {
  color: var(--ink-deep);
  font-weight: 700;
  font-size: 14px;
}
.col-rank.rank-top::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 14px;
  margin-right: 8px;
  vertical-align: -2px;
  border-radius: 2px;
  background: var(--hl);
}
.col-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 550;
}
.col-total {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: var(--ink-deep);
}
.col-delta { text-align: right; font-variant-numeric: tabular-nums; }

.sort-main { cursor: pointer; user-select: none; }
.sort-main:hover { color: var(--accent); }
.sort-hint {
  display: block;
  font-size: 10px;
  color: var(--faint);
  font-weight: 400;
  cursor: pointer;
  margin-top: 1px;
}
.sort-hint:hover { color: var(--accent); }
.sort-asc::after { content: " ▲"; color: var(--accent); font-size: 9px; }
.sort-desc::after { content: " ▼"; color: var(--accent); font-size: 9px; }

.score-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1.15;
}
.score-cell .base { font-size: 13.5px; font-weight: 550; }
.score-cell .delta { font-size: 11px; }
.delta-pos { color: var(--up); font-weight: 600; }
.delta-neg { color: var(--down); font-weight: 600; }

.col-section.full-mark { background: var(--up-soft); }
.col-section.full-mark .base { color: var(--up); }
.full-mark-check { color: var(--up); margin-left: 4px; font-weight: 700; }

.delta-up { color: var(--up); font-weight: 600; }
.delta-down { color: var(--down); font-weight: 600; }
.delta-zero { color: var(--faint); }
.delta-na { color: var(--faint); }
.delta-first { color: var(--accent); }
.delta-approx { font-style: italic; opacity: 0.9; }
.delta-approx::after { content: " *"; font-size: 0.7em; opacity: 0.6; }
.empty { text-align: center; color: var(--muted); padding: 36px 20px; font-size: 13px; }

/* 年级 / 备注列 */
.col-meta { min-width: 72px; max-width: 220px; color: var(--ink-2); }
.col-notes { min-width: 130px; }
.col-meta.editable {
  cursor: text;
  border-left: 2px solid transparent;
  transition: background 0.12s, border-color 0.12s;
}
.col-meta.editable:hover { background: #fffbeb; border-left-color: var(--hl); }
.col-meta.editing { background: #fffbeb; }
.col-meta.saving { background: #fdf3d7; opacity: 0.7; }
.cell-placeholder { color: #c9d1dc; }
.cell-edit {
  width: 100%;
  min-width: 60px;
  padding: 3px 5px;
  border: 1px solid #e7b64a;
  background: #fff;
  font-size: 12.5px;
  border-radius: 4px;
}
.meta-toggle {
  font-size: 12.5px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.meta-toggle input { margin: 0; accent-color: var(--accent); }

body.hide-grade .col-grade { display: none !important; }
body.hide-notes .col-notes { display: none !important; }

/* ---------------- 学生详情 ---------------- */

.student-head {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.student-avatar {
  width: 58px;
  height: 58px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: var(--ink-deep);
  color: var(--hl);
  font-size: 24px;
  font-weight: 650;
}
.student-info { min-width: 0; }
.student-head h1 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 650;
}
.student-head .meta {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12.5px;
}
.student-head .meta strong {
  color: var(--ink);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.student-head .warn { color: var(--warn); }

.chart-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.chart-wrap h2 { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.chart { width: 100%; height: 320px; }
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 8px 0;
  font-size: 12px;
  color: var(--muted);
}
.legend label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.error-page { text-align: center; padding: 80px 20px; }

/* ---------------- 提交分时统计 ---------------- */

.submission-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.submission-controls #submission-custom-range span {
  font-size: 12.5px;
  color: var(--muted);
}
#submission-chart { overflow-x: auto; }
#submission-chart svg { display: block; }
.struggling-problem {
  margin-bottom: 12px;
  padding: 10px 13px;
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  border-radius: 6px;
}
.struggling-problem h4 { margin: 0 0 6px; font-size: 13.5px; }
.struggling-problem h4 a { color: var(--accent); }
.struggling-problem h4 a:hover { text-decoration: underline; }
.bucket-problem-table a { color: var(--accent); }
.bucket-problem-table a:hover { text-decoration: underline; }
.btn-secondary {
  padding: 7px 15px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  margin-bottom: 8px;
}
.btn-secondary:hover { background: var(--accent-strong); }
.btn-secondary:disabled { background: #9fb3ee; cursor: wait; }
.bucket-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.bucket-detail h3 { margin: 0 0 6px; font-size: 13.5px; }
.bucket-detail p { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.bucket-problem-table { width: auto; min-width: 300px; }
.bucket-problem-table th, .bucket-problem-table td { padding: 5px 12px; font-size: 12.5px; }
.bar-seg:hover { opacity: 0.8; }

/* ---------------- 窄屏 ---------------- */

@media (max-width: 860px) {
  .topbar-inner {
    padding: 0 14px;
    gap: 12px;
    min-height: 56px;
  }
  .brand-text small { display: none; }
  .topnav { gap: 0; }
  .topnav a { padding: 6px 9px; }
  .tz { display: none; }
  .logout-form { margin-left: auto; }
  .container { padding: 16px 14px 56px; }
  .page-head { gap: 12px; }
  .page-actions { width: 100%; }
  .status-items > * { padding: 2px 10px; }
  .data-table th, .data-table td { padding: 8px 10px; }
  .stat-cards, .summary-cards { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
  .stat-card .num, .summary-card .num { font-size: 22px; }
  .controls, .view-toolbar { padding: 8px 10px; gap: 8px; }
  .controls .sep, .view-toolbar .sep { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
/* 全站控件一致性：链接按钮、长文本、窄屏布局与键盘焦点。 */
a.btn-ghost {display:inline-flex;align-items:center;justify-content:center;font-family:inherit;font-size:13px;line-height:1.3;font-weight:550;padding:7px 14px;border:1px solid transparent;border-radius:var(--radius-sm);text-decoration:none}
a.btn-sm {display:inline-flex;align-items:center;justify-content:center;text-decoration:none}
button,input,select,textarea {max-width:100%}
.page-head-main,.page-head>div {min-width:0}
.page-head h1 {overflow-wrap:anywhere}
.page-meta {flex-wrap:wrap;line-height:1.8}
.subtabs {overflow-x:auto;scrollbar-width:thin}
.subtabs a {flex-shrink:0}
.controls .grp {max-width:100%;flex-wrap:wrap}
.table-wrap {overscroll-behavior-x:contain}
.data-table .sub {display:block;line-height:1.6;margin-top:4px}
input[type=checkbox],input[type=radio] {accent-color:var(--accent)}
@media(max-width:600px){.page-actions{display:flex;flex-wrap:wrap;gap:8px}.controls>input,.controls>.grp>input[type=search]{min-width:0}.stat-cards,.summary-cards{grid-template-columns:repeat(2,minmax(0,1fr))}.topbar-inner{flex-wrap:wrap}.topnav{flex-wrap:wrap}.page-head h1{font-size:23px}.section-detail-stats{grid-template-columns:repeat(2,minmax(0,1fr))}.subtabs{flex-wrap:nowrap;white-space:nowrap}.controls input[type=search]{width:100%;min-width:0}}
