/* ==========================================================================
   校本智慧教学资源学情平台 · 全站样式
   风格：简约校园蓝白 · 干净清爽 · 教学严肃
   ========================================================================== */

:root {
  --blue-900: #12333d;
  --blue-800: #164b58;
  --blue-700: #176777;
  --blue-600: #1f8591;
  --blue-500: #47aab0;
  --blue-100: #e1f2f1;
  --blue-50: #f1f9f8;

  --ink-900: #141a24;
  --ink-700: #38414f;
  --ink-500: #6b7686;
  --ink-400: #98a2b3;
  --line: #e4e9f0;
  --line-soft: #eef2f7;
  --bg: #f4f7f6;
  --card: #ffffff;

  --green: #15803d;
  --green-bg: #e7f6ec;
  --amber: #b45309;
  --amber-bg: #fff5e6;
  --red: #c0392b;
  --red-bg: #fdecea;
  --purple: #6d47c9;
  --purple-bg: #f2ecff;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 32, 64, .05), 0 4px 14px rgba(16, 32, 64, .05);
  --shadow-lg: 0 8px 30px rgba(16, 32, 64, .12);
  --sidebar-w: 216px;
  --topbar-h: 58px;
}

/* 主题方案：默认青绿仅作为候选，用户选择会保存在当前浏览器。 */
html[data-theme="ocean"] {
  --blue-900: #0f3d63;
  --blue-800: #145681;
  --blue-700: #176b96;
  --blue-600: #1f82ad;
  --blue-500: #53a9c5;
  --blue-100: #e4f3f8;
  --blue-50: #f1f9fc;
  --bg: #f3f7fa;
  --line: #dfe8ee;
  --line-soft: #edf3f6;
  --amber: #c8752d;
  --amber-bg: #fff3e7;
}
html[data-theme="paper"] {
  --blue-900: #5c3330;
  --blue-800: #754139;
  --blue-700: #95503f;
  --blue-600: #ad654a;
  --blue-500: #d08a65;
  --blue-100: #f8e9df;
  --blue-50: #fdf5f0;
  --bg: #faf7f2;
  --line: #e9ded2;
  --line-soft: #f2e9e1;
  --amber: #c26e32;
  --amber-bg: #fff0e3;
}
html[data-theme="indigo"] {
  --blue-900: #292747;
  --blue-800: #3a3764;
  --blue-700: #4f4b89;
  --blue-600: #655db0;
  --blue-500: #8982c7;
  --blue-100: #eeedfa;
  --blue-50: #f7f6fd;
  --bg: #f5f5fa;
  --line: #e2e1ee;
  --line-soft: #efeff7;
  --amber: #b78a2f;
  --amber-bg: #fff8e7;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink-900);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 600; color: var(--ink-900); line-height: 1.35; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
img { max-width: 100%; }
code, pre { font-family: "Cascadia Mono", Consolas, "Courier New", monospace; }

/* ------------------------------ 布局骨架 ------------------------------ */
.layout { min-height: 100vh; display: flex; flex-direction: column; }
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 20px; }
.container-narrow { max-width: 900px; }

/* ------------------------------ 顶部导航 ------------------------------ */
.topbar {
  height: var(--topbar-h);
  background: var(--blue-900);
  color: #fff;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(11, 43, 85, .18);
}
.topbar .container { display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-size: 16px; font-weight: 600; white-space: nowrap; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-mark {
  width: 31px; height: 31px; border-radius: 8px; background: var(--amber);
  border: 1px solid rgba(255, 255, 255, .36); box-shadow: inset 0 0 0 2px rgba(255,255,255,.1);
  display: grid; place-items: center; font-size: 15px;
}
.brand small { display: block; font-size: 11px; font-weight: 400; opacity: .78; line-height: 1.2; }

.topnav { display: flex; align-items: center; gap: 2px; margin-left: 22px; flex: 1; overflow-x: auto; }
.topnav a {
  color: rgba(255, 255, 255, .88);
  padding: 7px 13px; border-radius: 7px; font-size: 13.5px; white-space: nowrap;
}
.topnav a:hover { background: rgba(255, 255, 255, .14); color: #fff; text-decoration: none; }
.topnav a.active { background: rgba(255, 255, 255, .22); color: #fff; font-weight: 600; }

/* ------------------------------ 主题选择器 ------------------------------ */
.theme-picker { position: relative; flex: 0 0 auto; }
.theme-trigger {
  display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border: 1px solid rgba(255,255,255,.22);
  border-radius: 7px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.92); font: inherit; font-size: 12.5px; cursor: pointer;
}
.theme-trigger:hover, .theme-trigger[aria-expanded="true"] { background: rgba(255,255,255,.18); color: #fff; }
.main-head .theme-trigger { border-color: var(--line); background: #fff; color: var(--ink-700); }
.main-head .theme-trigger:hover, .main-head .theme-trigger[aria-expanded="true"] { border-color: var(--blue-500); background: var(--blue-50); color: var(--blue-700); }
.theme-trigger-icon { font-size: 16px; line-height: 1; }
.theme-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 168px; padding: 7px; z-index: 120;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.theme-menu[hidden] { display: none; }
.theme-menu-title { padding: 5px 8px 7px; color: var(--ink-400); font-size: 11px; }
.theme-option {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-700); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.theme-option:hover, .theme-option[aria-checked="true"] { background: var(--blue-50); color: var(--blue-700); }
.theme-option[aria-checked="true"]::after { content: '✓'; margin-left: auto; color: var(--blue-600); font-weight: 700; }
.theme-swatch { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.12); flex: 0 0 auto; }
.theme-swatch-teal { background: linear-gradient(135deg, #12333d 0 60%, #b45309 60%); }
.theme-swatch-ocean { background: linear-gradient(135deg, #0f3d63 0 60%, #c8752d 60%); }
.theme-swatch-paper { background: linear-gradient(135deg, #5c3330 0 60%, #c26e32 60%); }
.theme-swatch-indigo { background: linear-gradient(135deg, #292747 0 60%, #b78a2f 60%); }

/* ------------------------------ 公开首页 / 教学汇 ------------------------------ */
.public-home { padding-top: 4px; }
.public-hero {
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 28px; align-items: stretch; padding: 32px 34px; margin-bottom: 18px;
  background: var(--blue-900); color: #fff; border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 28px rgba(18, 51, 61, .16);
}
.public-hero h1 { color: #fff; font-size: 34px; letter-spacing: .02em; margin-bottom: 8px; }
.public-hero p { color: rgba(255,255,255,.78); max-width: 650px; font-size: 15px; margin-bottom: 20px; }
.public-kicker { color: #f5c76f; font-size: 12px; font-weight: 700; letter-spacing: .16em; margin-bottom: 9px; }
.public-hero .btn { border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.08); color: #fff; }
.public-hero .btn:hover { background: rgba(255,255,255,.16); border-color: rgba(255,255,255,.5); color: #fff; }
.public-hero .btn-primary { background: var(--amber); border-color: var(--amber); color: #fff; }
.public-hero .btn-primary:hover { background: #d48735; border-color: #d48735; }
.public-hero-aside { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 1px; min-height: 112px; border-left: 1px solid rgba(255,255,255,.15); padding-left: 24px; }
.public-stat { padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.22); }
.public-stat .label { color: rgba(255,255,255,.64); font-size: 12px; }
.public-stat .value { margin-top: 4px; font-size: 25px; font-weight: 700; line-height: 1.1; color: #fff; }
.public-section { margin-top: 22px; }
.public-section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.public-section-head h2 { margin: 0; font-size: 18px; }
.public-section-head .sub { color: var(--ink-500); font-size: 12.5px; }
.public-directory { display: grid; grid-template-columns: repeat(auto-fill, minmax(188px, 1fr)); gap: 10px; }
.public-subject { display: flex; align-items: center; gap: 10px; padding: 13px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--ink-900); transition: border-color .15s, box-shadow .15s, transform .15s; }
.public-subject:hover { border-color: var(--blue-500); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; color: inherit; }
.public-subject .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.public-subject .name { font-weight: 600; }
.public-subject .count { margin-left: auto; color: var(--ink-400); font-size: 12px; }
.public-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; align-items: start; }
.public-panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.public-panel-head { padding: 14px 18px; border-bottom: 1px solid var(--line-soft); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.public-panel-head h2 { margin: 0; font-size: 15.5px; }
.public-panel-body { padding: 6px 14px; }
.public-panel .res-item { border-bottom: 1px solid var(--line-soft); }
.public-panel .res-item:last-child { border-bottom: 0; }
.public-note { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-left: 3px solid var(--amber); background: var(--amber-bg); color: var(--ink-700); border-radius: var(--radius-sm); }
.public-note strong { color: var(--ink-900); }
.public-join { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 22px; padding: 17px 20px; background: var(--blue-100); border: 1px solid #c5e3e1; border-radius: var(--radius); }
.public-join p { margin: 2px 0 0; color: var(--ink-500); font-size: 12.5px; }
@media (max-width: 820px) {
  .public-hero, .public-columns { grid-template-columns: 1fr; }
  .public-hero { padding: 26px 22px; }
  .public-hero-aside { border-left: 0; border-top: 1px solid rgba(255,255,255,.15); padding: 16px 0 0; }
}
@media (max-width: 520px) {
  .public-hero h1 { font-size: 27px; }
  .public-hero-aside { grid-template-columns: 1fr; gap: 8px; }
  .public-stat { border-top: 0; padding: 5px 0; display: flex; justify-content: space-between; align-items: center; }
  .public-stat .value { margin-top: 0; font-size: 20px; }
  .public-join { align-items: flex-start; flex-direction: column; }
}

.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; white-space: nowrap; }
.topbar-user .who { opacity: .92; }
.topbar-user .role-chip { background: rgba(255,255,255,.2); border-radius: 20px; padding: 2px 10px; font-size: 12px; }
.topbar-user a { color: rgba(255,255,255,.9); }
.topbar-user a:hover { color: #fff; }

/* ------------------------------ 网站备案信息 ------------------------------ */
.site-footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 16px 0;
}
.site-footer-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 18px;
}
.site-records {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  width: 100%;
  color: var(--ink-400);
  font-size: 12px;
}
.site-records a {
  color: var(--ink-500);
  white-space: nowrap;
}
.site-records a:hover { color: var(--blue-700); }
.site-records-badge {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-right: 3px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
}
.admin-site-footer {
  flex-shrink: 0;
  padding: 12px 22px 16px;
  background: var(--bg);
}
.admin-site-footer .site-footer-main {
  justify-content: center;
  color: var(--ink-400);
  font-size: 12px;
  text-align: center;
}
.login-foot .site-records {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

/* ------------------------------ 教学工具箱 ------------------------------ */
.toolbox-page, .tool-page { padding-top: 4px; }
.toolbox-hero {
  display: flex; align-items: stretch; justify-content: space-between; gap: 24px;
  padding: 30px 32px; margin-bottom: 24px; border-radius: 14px;
  background: var(--blue-900); color: #fff; box-shadow: 0 10px 28px rgba(18, 51, 61, .16);
}
.toolbox-hero h1 { max-width: 720px; color: #fff; font-size: 30px; margin: 7px 0 9px; }
.toolbox-hero p { max-width: 720px; margin: 0; color: rgba(255,255,255,.78); font-size: 14px; }
.toolbox-kicker, .tool-kicker, .tool-section-kicker { color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: .14em; }
.toolbox-hero .toolbox-kicker { color: #f5c76f; }
.toolbox-hero-note { min-width: 190px; align-self: center; display: flex; flex-direction: column; gap: 5px; padding: 17px; border-left: 1px solid rgba(255,255,255,.24); color: rgba(255,255,255,.72); font-size: 12px; }
.toolbox-hero-note strong { color: #fff; font-size: 16px; }
.toolbox-hero-icon { color: #f5c76f; font-size: 25px; line-height: 1; }
.toolbox-section-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.toolbox-section-head h2, .toolbox-section-head p { margin: 0; }
.toolbox-section-head p { color: var(--ink-500); font-size: 12.5px; }
.toolbox-count { color: var(--ink-500); font-size: 12px; }
.toolbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 14px; }
.tool-card { display: flex; flex-direction: column; align-items: flex-start; min-height: 218px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.tool-card-top { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-bottom: 15px; }
.tool-card-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: var(--blue-100); color: var(--blue-700); font-size: 19px; font-weight: 700; }
.tool-card-subject { color: var(--ink-400); font-size: 12px; }
.tool-card h3 { margin-bottom: 8px; font-size: 16px; }
.tool-card p { flex: 1; margin-bottom: 16px; color: var(--ink-500); font-size: 13px; }
.tool-card.is-planned { background: var(--bg); box-shadow: none; }
.tool-card.is-planned .tool-card-icon { background: var(--line-soft); color: var(--ink-500); }
.tool-planned-label { color: var(--ink-400); font-size: 12px; }
.toolbox-principles { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(0, 1.3fr); gap: 20px; align-items: center; margin-top: 22px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--blue-50); }
.toolbox-principles h2 { margin: 5px 0 0; font-size: 17px; }
.toolbox-principle-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.toolbox-principle-list div { display: flex; flex-direction: column; gap: 2px; padding-left: 12px; border-left: 2px solid var(--blue-500); }
.toolbox-principle-list b { color: var(--ink-900); font-size: 13px; }
.toolbox-principle-list span { color: var(--ink-500); font-size: 12px; }
.tool-page-head { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.tool-page-head h1 { margin: 5px 0 7px; font-size: 26px; }
.tool-page-head p { max-width: 700px; margin: 0; color: var(--ink-500); }
.tool-back { display: inline-block; margin-bottom: 6px; color: var(--ink-500); font-size: 12.5px; }
.tool-back:hover { color: var(--blue-700); }
.tool-page-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.tool-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; align-items: start; }
.tool-config-panel, .tool-sheet, .tool-answer-panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.tool-config-panel { padding: 17px; position: sticky; top: 78px; }
.tool-panel-title h2 { margin: 4px 0 15px; font-size: 16px; }
.tool-form .form-row { margin-bottom: 13px; }
.tool-form label, .tool-fieldset legend { display: block; margin-bottom: 5px; color: var(--ink-700); font-size: 12.5px; font-weight: 600; }
.tool-form input, .tool-form select, .tool-form textarea { width: 100%; }
.tool-form textarea { min-height: 132px; resize: vertical; line-height: 1.6; }
.tool-form .form-hint { margin-top: 4px; color: var(--ink-400); font-size: 11.5px; }
.tool-fieldset { margin: 0 0 13px; padding: 0; border: 0; }
.tool-check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.tool-check-grid label { display: flex; align-items: center; gap: 6px; margin: 0; padding: 7px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); font-weight: 400; cursor: pointer; }
.tool-check-grid input { width: auto; }
.tool-note { margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); color: var(--ink-400); font-size: 11.5px; line-height: 1.6; }
.tool-workbench { min-width: 0; }
.tool-sheet { padding: 24px 26px 28px; min-height: 420px; }
.tool-sheet-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 2px solid var(--ink-900); }
.tool-sheet-head h2 { margin: 0 0 4px; font-size: 20px; }
.tool-sheet-head p { margin: 0; color: var(--ink-500); font-size: 12px; }
.tool-sheet-meta { color: var(--ink-400); font-size: 11px; white-space: nowrap; }
.math-sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 21px 28px; padding: 25px 6px 4px; }
.math-sheet-item, .operation-sheet-item { display: flex; align-items: end; gap: 7px; min-width: 0; min-height: 30px; border-bottom: 1px solid var(--line-soft); }
.math-sheet-item > span, .dictation-item > span, .operation-sheet-item > span { color: var(--ink-400); font-size: 12px; }
.math-sheet-item b { font-size: 16px; font-weight: 500; letter-spacing: .04em; white-space: nowrap; }
.math-sheet-item i, .operation-sheet-item i { flex: 1; min-width: 16px; border-bottom: 1px solid var(--ink-400); }
.operations-sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 36px; padding: 28px 6px 4px; }
.operation-sheet-item { min-height: 38px; }
.operation-sheet-item b { min-width: 0; font-size: 16px; font-weight: 500; white-space: normal; overflow-wrap: anywhere; }
.math-practice-page .tool-answer-grid { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.math-practice-page .tool-answer-grid > span { overflow-wrap: anywhere; }
.vertical-sheet-grid { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 34px 38px; padding: 30px 8px 8px; }
.vertical-problem { position: relative; min-height: 118px; padding-left: 24px; font-variant-numeric: tabular-nums; }
.vertical-no { position: absolute; top: 4px; left: 0; color: var(--ink-400); font-size: 12px; }
.vertical-stack { width: max-content; min-width: 76px; margin: 0 auto; color: var(--ink-900); font-size: 20px; line-height: 1.35; text-align: right; }
.vertical-operand { display: flex; justify-content: space-between; gap: 12px; }
.vertical-operand span { font-weight: 600; }
.vertical-operand b { font-weight: 500; }
.vertical-result { min-height: 32px; padding-top: 4px; border-top: 2px solid var(--ink-900); text-align: center; }
.long-division { width: max-content; min-width: 92px; margin: 0 auto; color: var(--ink-900); font-size: 19px; }
.long-quotient { min-height: 31px; padding: 0 4px 2px 30px; text-align: center; }
.long-body { display: flex; align-items: flex-start; }
.long-body b { padding: 4px 7px 0 0; font-weight: 500; }
.long-body span { min-width: 60px; padding: 4px 8px 0; border-top: 2px solid var(--ink-900); border-left: 2px solid var(--ink-900); border-radius: 10px 0 0; text-align: center; }
.dictation-sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 30px; padding: 25px 6px 4px; }
.dictation-item { min-width: 0; break-inside: avoid; page-break-inside: avoid; }
.dictation-item-wide { grid-column: 1 / -1; }
.dictation-prompt { display: flex; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.dictation-prompt > span { flex: 0 0 22px; color: var(--ink-400); font-size: 12px; }
.dictation-prompt b { font-size: 14px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.dictation-writing-area { position: relative; margin-left: 30px; }
.dictation-writing-row { height: 12mm; }
.dictation-writing-ruled .dictation-writing-row { display: flex; flex-direction: column; justify-content: space-between; height: 9mm; margin-bottom: 4mm; }
.dictation-writing-lined .dictation-writing-row { display: flex; align-items: flex-end; height: 9mm; margin-bottom: 3mm; }
.dictation-underline { display: block; width: 100%; border-top: .2mm solid #888; }
.dictation-rule { display: block; flex: 0 0 0; border-top: .2mm solid #aaa; }
.dictation-rule:first-child, .dictation-rule:last-child { border-color: #777; }
.dictation-writing-area .sheet-answer { position: absolute; inset: 0; font-style: normal; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; color: #222; }
.dictation-print-help { margin: 0 0 12px; color: var(--ink-500); font-size: 12px; line-height: 1.7; }
.dictation-saved .dictation-sheet-grid { padding-left: 0; padding-right: 0; }
.article .dictation-prompt span { font-size: 12px; }
.tool-answer-panel { margin-top: 14px; box-shadow: none; }
.tool-answer-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; }
.tool-answer-head h2 { margin: 3px 0 0; font-size: 15px; }
.tool-answer-grid, .dictation-answer-list { display: none; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px 14px; padding: 0 16px 16px; color: var(--ink-500); font-size: 12px; }
.dictation-answer-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tool-answer-panel.is-open .tool-answer-grid, .tool-answer-panel.is-open .dictation-answer-list { display: grid; }
.tool-answer-panel.is-open .tool-answer-head { border-bottom: 1px solid var(--line-soft); }
.tool-student-info { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 6px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line-soft); color: var(--ink-500); font-size: 12px; }
.tool-student-info span { min-width: 130px; }
.tool-sheet-edition { display: inline-block; margin-left: 7px; padding: 2px 7px; border: 1px solid var(--blue-200); border-radius: 999px; color: var(--blue-700); font-size: 11px; vertical-align: middle; }
.sheet-answer { display: none; color: var(--blue-700); font-style: normal; font-weight: 700; }
.tool-variant-bar { display: flex; align-items: center; gap: 7px; margin-top: 15px; padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink-500); font-size: 12px; }
.tool-variant-bar a { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink-700); }
.tool-variant-bar a:hover { border-color: var(--blue-500); color: var(--blue-700); text-decoration: none; }
.tool-save-panel { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--blue-50); }
.tool-save-form { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; }
.tool-save-row { display: flex; align-items: center; gap: 8px; flex: 1 1 360px; }
.tool-save-row input { flex: 1; min-width: 0; }
.tool-save-form .form-row { flex: 1 1 220px; margin: 0; }
.tool-save-form .btn { flex: 0 0 auto; }
.tool-save-form label { display: block; margin-bottom: 5px; color: var(--ink-700); font-size: 12px; font-weight: 600; }
.tool-save-form input { width: 100%; }
.tool-save-hint, .tool-login-note { margin: 8px 0 0; color: var(--ink-500); font-size: 12px; }
.tool-template-link { color: var(--blue-700); font-size: 12px; }
.tool-save-success { margin-bottom: 10px; padding: 8px 10px; border: 1px solid #c4e5d1; border-radius: var(--radius-sm); background: var(--green-bg); color: var(--green); font-size: 12px; }
.tool-source-fields { margin-bottom: 13px; padding: 11px; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--bg); }
.tool-source-fields .form-row:last-child { margin-bottom: 0; }
.tool-output-panel { margin-top: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.tool-output-form { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.tool-output-form h2 { margin: 3px 0 4px; font-size: 15px; }
.tool-output-form p { margin: 0; color: var(--ink-500); font-size: 11.5px; }
.tool-output-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.vocabulary-page { padding-top: 4px; }
.vocabulary-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.vocabulary-import-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-top: 14px; align-items: start; }
.vocabulary-import textarea { min-height: 220px; resize: vertical; }
.vocabulary-list-wrap { min-width: 0; }
.vocabulary-list-wrap { scroll-margin-top: 84px; }
.vocabulary-import-details { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; scroll-margin-top: 84px; }
.vocabulary-import-details > summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.vocabulary-import-details > summary span { margin-left: 8px; font-weight: 400; font-size: 12px; }
.vocabulary-list-heading, .vocabulary-pagination, .vocabulary-bulk-bar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.vocabulary-list-heading .sub { margin-top: 4px; display: block; }
.vocabulary-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; border-bottom: 1px solid var(--line-soft); }
.vocabulary-filters label { display: grid; gap: 5px; font-size: 12px; color: var(--ink-500); flex: 1 1 125px; min-width: 0; }
.vocabulary-filters .vocabulary-keyword { flex: 2 1 210px; }
.vocabulary-filters input, .vocabulary-filters select { width: 100%; min-width: 0; }
.vocabulary-filters .btn-row { padding-bottom: 1px; }
.vocabulary-bulk-bar { justify-content: flex-start; background: var(--bg); padding: 12px 18px; font-size: 12px; }
.vocabulary-bulk-bar [role="status"] { font-weight: 600; margin-right: 2px; }
.vocabulary-data-table { max-height: 680px; }
.vocabulary-data-table table { min-width: 980px; table-layout: fixed; }
.vocabulary-data-table thead { position: sticky; top: 0; z-index: 1; background: var(--bg); }
.vocabulary-data-table th { vertical-align: top; }
.vocabulary-data-table td { overflow-wrap: anywhere; }
.vocabulary-data-table th:nth-child(2) { width: 19%; }
.vocabulary-data-table th:nth-child(3) { width: 23%; }
.vocabulary-data-table th:nth-child(4) { width: 24%; }
.vocabulary-data-table th:nth-child(5) { width: 16%; }
.vocabulary-data-table th:nth-child(6) { width: 130px; }
.vocabulary-check-cell { width: 42px; text-align: center; }
.vocabulary-check-cell input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--blue-700); }
.vocabulary-check-cell input:disabled { cursor: default; }
.vocabulary-sort { display: inline-flex; gap: 6px; align-items: center; color: inherit; text-decoration: none; }
.vocabulary-sort span { color: var(--ink-400); }
.vocabulary-data-table .vocabulary-column-filters th { padding-top: 0; padding-bottom: 10px; }
.vocabulary-column-filters input, .vocabulary-column-filters select { display: block; width: 100%; min-width: 0; font-size: 12px; padding: 7px 8px; font-weight: 400; }
.vocabulary-column-filters select + select { margin-top: 5px; }
.vocabulary-data-table tr.is-selected { background: var(--blue-50); }
.vocabulary-unassigned { display: inline-block; margin-top: 3px; color: var(--ink-500); background: var(--bg); border: 1px dashed var(--line); border-radius: 4px; padding: 1px 5px; }
.vocabulary-row-note { font-size: 11px; margin-top: 4px; }
.vocabulary-empty { padding: 40px 15px !important; text-align: center; color: var(--ink-500); }
.vocabulary-pagination { border-top: 1px solid var(--line-soft); padding: 14px 18px; }
.vocabulary-bulk-preview { max-width: 960px; margin: 0 auto; }
.vocabulary-bulk-examples { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 14px 0; }
.vocabulary-bulk-examples span { padding: 6px 0; font-size: 13px; }
.vocabulary-confirm-actions { justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.vocabulary-template-links { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.vocabulary-preview { margin-bottom: 18px; }
.vocabulary-preview .card-head .sub { overflow-wrap: anywhere; }
.vocabulary-preview-stats { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 8px; margin-bottom: 14px; }
.vocabulary-preview-stats span { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg); color: var(--ink-500); font-size: 11.5px; }
.vocabulary-preview-stats b { display: block; color: var(--ink-900); font-size: 18px; }
.vocabulary-preview-stats .is-new b { color: var(--green); }
.vocabulary-preview-stats .is-update b { color: var(--blue-700); }
.vocabulary-preview-stats .is-error b, .text-error { color: var(--red); }
.text-warn { color: var(--amber); }
.vocabulary-preview-table { max-height: 430px; border: 1px solid var(--line-soft); }
.vocabulary-preview-table thead { position: sticky; top: 0; z-index: 1; background: #fff; }
.vocabulary-preview-table tr.preview-error { background: var(--red-bg); }
.vocabulary-preview-actions { justify-content: space-between; }
.vocabulary-preview-actions form { margin: 0; }
.vocabulary-edit-page { max-width: 920px; margin: 0 auto; }
.vocabulary-edit-form .card-foot { justify-content: flex-end; }
.vocabulary-sheet-picker, .dictation-unit-picker { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin: 0 0 14px; min-width: 0; }
.vocabulary-sheet-picker legend, .dictation-unit-picker legend { padding: 0 5px; font-weight: 600; }
.vocabulary-sheet-picker label, .dictation-unit-picker label { display: flex; align-items: center; gap: 7px; padding: 7px 0; font-size: 13px; cursor: pointer; }
.dictation-unit-picker label[hidden], .dictation-unit-picker[hidden] { display: none; }
.vocabulary-sheet-picker input, .dictation-unit-picker input { width: 17px; height: 17px; flex: 0 0 auto; }
.vocabulary-unit-mapping select { min-width: 200px; max-width: 100%; }
.vocabulary-review-toolbar, .dictation-unit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 12px; }
.dictation-unit-picker { max-height: 340px; overflow-y: auto; }
.form-grid.compact { gap: 8px; }
.toolbox-recent { margin-top: 25px; }
.toolbox-recent-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.toolbox-recent-grid > a { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.toolbox-recent-grid > a:hover { border-color: var(--blue-500); box-shadow: var(--shadow); text-decoration: none; }
.toolbox-recent-grid > a b, .toolbox-recent-grid > a span { display: block; }
.toolbox-recent-grid > a b { overflow: hidden; color: var(--ink-900); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.toolbox-recent-grid > a span { margin-top: 3px; color: var(--ink-500); font-size: 11px; }
.toolbox-template-entry { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.toolbox-template-entry:hover { border-color: var(--blue-500); box-shadow: var(--shadow); }
.toolbox-template-entry b { display: block; overflow: hidden; color: var(--ink-900); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.toolbox-template-entry small { display: block; margin-top: 3px; color: var(--ink-500); font-size: 11px; }
.tool-templates-page { padding-top: 4px; }
.template-list { display: grid; gap: 10px; }
.template-item { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); }
.template-item-icon { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 38px; border-radius: 10px; background: var(--blue-100); color: var(--blue-700); font-size: 17px; }
.template-item-main { min-width: 0; flex: 1; }
.template-item-head { display: flex; align-items: center; gap: 8px; }
.template-item-head h2 { overflow: hidden; margin: 0; color: var(--ink-900); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.template-summary, .template-date { margin-top: 4px; color: var(--ink-500); font-size: 12px; }
.template-date { color: var(--ink-400); font-size: 11px; }
.template-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.template-actions form { margin: 0; }
@media print {
  .tool-page-head, .tool-config-panel, .tool-answer-panel, .site-footer { display: none !important; }
  .tool-variant-bar, .tool-save-panel, .tool-output-panel { display: none !important; }
  .tool-layout { display: block; }
  .tool-sheet { border: 0; box-shadow: none; padding: 0; }
  .tool-sheet-head { padding-top: 0; }
  .tool-sheet-meta { display: none; }
  .math-sheet-grid { padding-top: 35px; }
  .vertical-sheet-grid, .operations-sheet-grid { padding-top: 35px; }
  body.print-answer .sheet-answer { display: inline; }
  body.print-answer .math-sheet-item i,
  body.print-answer .dictation-item i,
  body.print-answer .operation-sheet-item i { border-bottom-color: transparent; }
}
@media (max-width: 760px) {
  .toolbox-hero { flex-direction: column; padding: 24px 22px; }
  .toolbox-hero h1 { font-size: 25px; }
  .toolbox-hero-note { min-width: 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.24); padding: 15px 0 0; }
  .toolbox-principles { grid-template-columns: 1fr; }
  .toolbox-principle-list { grid-template-columns: 1fr; }
  .tool-page-head { align-items: flex-start; flex-direction: column; }
  .tool-layout { grid-template-columns: 1fr; }
  .tool-config-panel { position: static; }
  .math-sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px 15px; }
  .vertical-sheet-grid { grid-template-columns: repeat(2, minmax(115px, 1fr)); gap: 28px 14px; }
  .operations-sheet-grid { grid-template-columns: 1fr; gap: 18px; }
  .dictation-sheet-grid { grid-template-columns: 1fr; gap: 15px; }
  .tool-answer-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .template-item { align-items: flex-start; flex-wrap: wrap; }
  .template-actions { width: 100%; padding-left: 51px; }
  .tool-output-form { align-items: flex-start; flex-direction: column; }
  .tool-output-actions { justify-content: flex-start; width: 100%; }
  .vocabulary-layout { grid-template-columns: 1fr; }
  .vocabulary-import-column { grid-template-columns: 1fr; }
  .vocabulary-filters { padding: 14px; }
  .vocabulary-filters label { flex-basis: calc(50% - 10px); }
  .vocabulary-bulk-bar, .vocabulary-pagination { padding: 12px 14px; }
  .vocabulary-pagination nav { flex-wrap: wrap; }
  .vocabulary-preview-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ------------------------------ 后台侧边栏 ------------------------------ */
@page dictation { size: A4 portrait; margin: 14mm; }
@media print {
  #dictationSheet { page: dictation; }
  .english-dictation-page .tool-workbench > :not(#dictationSheet) { display: none !important; }
  .english-dictation-page .tool-sheet-head, .english-dictation-page .tool-student-info { break-inside: avoid; }
  .dictation-sheet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6mm 9mm; padding: 7mm 0 0; }
  .dictation-item-wide { grid-column: 1 / -1; }
  .dictation-prompt { margin-bottom: 3mm; }
  .dictation-prompt b { color: #111; font-size: 11pt; }
  .dictation-rule { border-top-color: #999; }
  .dictation-rule:first-child, .dictation-rule:last-child { border-top-color: #666; }
  body.print-answer .dictation-writing-area .sheet-answer { display: block; }
  body.print-answer .dictation-rule, body.print-answer .dictation-underline { visibility: hidden; }
  .dictation-saved-answers { display: none; }
}

.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: #fff; border-right: 1px solid var(--line);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-brand {
  height: var(--topbar-h); display: flex; align-items: center; gap: 9px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
  background: var(--blue-900); color: #fff;
}
.sidebar-brand .brand-mark { width: 26px; height: 26px; font-size: 13px; }
.sidebar-brand b { font-size: 14.5px; font-weight: 600; }
.sidebar nav { padding: 10px 8px; flex: 1; }
.nav-group { margin: 12px 0 4px; padding: 0 10px; font-size: 11px; letter-spacing: .08em; color: var(--ink-400); }
.sidebar nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8.5px 11px; margin-bottom: 1px; border-radius: var(--radius-sm);
  color: var(--ink-700); font-size: 13.5px;
}
.sidebar nav a:hover { background: var(--blue-50); color: var(--blue-700); text-decoration: none; }
.sidebar nav a.active { background: var(--blue-100); color: var(--blue-700); font-weight: 600; }
.sidebar nav a .ico { width: 18px; text-align: center; font-size: 14px; }
.sidebar-foot { padding: 12px 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-400); }
.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main-head {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 40;
}
.main-head h1 { margin: 0; font-size: 17px; }
.main-head .breadcrumb { font-size: 12.5px; color: var(--ink-500); }
.main-body { flex: 1; padding: 20px 22px 48px; }

/* ------------------------------ 卡片 / 面板 ------------------------------ */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 18px;
}
.card-head {
  padding: 14px 18px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; font-size: 15.5px; }
.card-head .sub { font-size: 12.5px; color: var(--ink-500); }
.card-body { padding: 18px; }
.card-body.tight { padding: 12px 14px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); background: var(--blue-50); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ------------------------------ 统计卡 ------------------------------ */
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--blue-600);
}
.stat.green::after { background: var(--green); }
.stat.amber::after { background: var(--amber); }
.stat.red::after { background: var(--red); }
.stat.purple::after { background: var(--purple); }
.stat .label { font-size: 12.5px; color: var(--ink-500); margin-bottom: 4px; }
.stat .value { font-size: 26px; font-weight: 700; color: var(--ink-900); line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--ink-500); margin-left: 3px; }
.stat .hint { font-size: 12px; color: var(--ink-400); margin-top: 3px; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #fff; color: var(--ink-700); font-size: 13.5px; cursor: pointer;
  font-family: inherit; line-height: 1.4; transition: all .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--blue-500); color: var(--blue-700); text-decoration: none; background: var(--blue-50); }
.btn-primary { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.btn-danger { color: var(--red); border-color: #f3c9c4; background: #fff; }
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-500); }
.btn-ghost:hover { background: var(--blue-50); }
.btn-sm { padding: 5px 11px; font-size: 12.5px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ------------------------------ 表单 ------------------------------ */
.form-row { margin-bottom: 15px; }
.form-row > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-700); margin-bottom: 5px; }
.form-row .tip { font-size: 12px; color: var(--ink-400); margin-top: 4px; }
.req::after { content: ' *'; color: var(--red); }
input[type="text"], input[type="password"], input[type="number"], input[type="email"],
input[type="date"], input[type="datetime-local"], input[type="search"], select, textarea {
  width: 100%; padding: 8.5px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; color: var(--ink-900); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59, 130, 224, .14);
}
textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
select { cursor: pointer; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check-list label { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--blue-600); cursor: pointer; }

/* ------------------------------ 筛选条 ------------------------------ */
.filter-bar {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow);
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.filter-bar .field { display: flex; flex-direction: column; gap: 4px; }
.filter-bar .field > span { font-size: 11.5px; color: var(--ink-500); }
.filter-bar select, .filter-bar input { min-width: 132px; padding: 7px 10px; font-size: 13px; }
.filter-bar .grow { flex: 1; min-width: 180px; }
.filter-bar .grow input { width: 100%; }

/* ------------------------------ 表格 ------------------------------ */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.tbl th { background: #f8fafc; font-weight: 600; color: var(--ink-700); font-size: 12.5px; white-space: nowrap; }
table.tbl tbody tr:hover { background: var(--blue-50); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.center, table.tbl th.center { text-align: center; }
table.tbl .wrap { max-width: 460px; }

/* ------------------------------ 标签 / 徽章 ------------------------------ */
.tag {
  display: inline-block; padding: 1.5px 9px; border-radius: 20px; font-size: 12px;
  background: var(--blue-50); color: var(--blue-700); border: 1px solid #d6e4f7; white-space: nowrap;
}
.tag.green { background: var(--green-bg); color: var(--green); border-color: #cbe9d6; }
.tag.amber { background: var(--amber-bg); color: var(--amber); border-color: #f6e0bd; }
.tag.red { background: var(--red-bg); color: var(--red); border-color: #f3c9c4; }
.tag.purple { background: var(--purple-bg); color: var(--purple); border-color: #ddd0f7; }
.tag.gray { background: #f1f3f6; color: var(--ink-500); border-color: var(--line); }
.tag.sm { font-size: 11px; padding: 1px 7px; }

.chip {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-sm);
  background: var(--blue-50); color: var(--blue-700); font-size: 12.5px; margin: 0 6px 6px 0;
  border: 1px solid #dbe7f8;
}

/* ------------------------------ 提示条 ------------------------------ */
.alert { padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 15px; font-size: 13.5px; border: 1px solid transparent; }
.alert-info { background: var(--blue-50); border-color: #cfe2f8; color: var(--blue-800); }
.alert-ok { background: var(--green-bg); border-color: #c4e5d1; color: var(--green); }
.alert-warn { background: var(--amber-bg); border-color: #f2ddb8; color: var(--amber); }
.alert-error { background: var(--red-bg); border-color: #f2c7c1; color: var(--red); }
.alert strong { font-weight: 700; }

/* ------------------------------ 进度条 / 掌握度 ------------------------------ */
.bar { height: 8px; background: #eef2f7; border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue-600); border-radius: 6px; transition: width .4s; }
.bar > i.strong { background: var(--green); }
.bar > i.normal { background: #e2a03c; }
.bar > i.weak { background: var(--red); }
.bar-lg { height: 11px; }

.mastery-row { display: grid; grid-template-columns: 1fr 64px; gap: 10px; align-items: center; margin-bottom: 9px; }
.mastery-row .name { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mastery-row .pct { text-align: right; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ------------------------------ 热力图 ------------------------------ */
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(122px, 1fr)); gap: 8px; }
.heat-cell {
  border-radius: var(--radius-sm); padding: 10px 11px; border: 1px solid;
  display: flex; flex-direction: column; gap: 3px; min-height: 76px;
}
.heat-cell .k { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.heat-cell .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.heat-cell .n { font-size: 11px; opacity: .72; }
.heat-cell.strong { background: var(--green-bg); border-color: #c4e5d1; color: var(--green); }
.heat-cell.normal { background: var(--amber-bg); border-color: #f2ddb8; color: var(--amber); }
.heat-cell.weak { background: var(--red-bg); border-color: #f2c7c1; color: var(--red); }

/* ------------------------------ 纯 CSS 图表 ------------------------------ */
.chart { width: 100%; }
.chart-bars { display: flex; align-items: flex-end; gap: 4px; height: 150px; padding-top: 8px; }
.chart-bars .cb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.chart-bars .cb .v { font-size: 10.5px; color: var(--ink-500); font-variant-numeric: tabular-nums; }
.chart-bars .cb .b { width: 100%; max-width: 34px; background: linear-gradient(180deg, var(--blue-500), var(--blue-700)); border-radius: 4px 4px 0 0; min-height: 2px; }
.chart-bars .cb .b.low { background: linear-gradient(180deg, #e08b8b, var(--red)); }
.chart-bars .cb .l { font-size: 10.5px; color: var(--ink-400); white-space: nowrap; }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 56px; }
.spark i { flex: 1; background: var(--blue-500); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }

/* ------------------------------ 学科入口卡 ------------------------------ */
.subject-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.subject-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; text-align: center; box-shadow: var(--shadow);
  transition: transform .16s, box-shadow .16s, border-color .16s; position: relative; display: block; color: inherit;
}
.subject-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--blue-500); text-decoration: none; color: inherit; }
.subject-card .ico {
  width: 46px; height: 46px; border-radius: 12px; margin: 0 auto 9px; display: grid; place-items: center;
  font-size: 19px; font-weight: 700; color: #fff;
}
.subject-card .nm { font-size: 15px; font-weight: 600; }
.subject-card .meta { font-size: 12px; color: var(--ink-400); margin-top: 4px; }
.subject-card.empty { opacity: .62; background: #fbfcfe; }
.subject-card.empty .ico { background: #c7d0dc !important; }
.subject-card .badge-new {
  position: absolute; top: 9px; right: 9px; font-size: 10.5px; padding: 1px 7px;
  border-radius: 20px; background: var(--green-bg); color: var(--green); border: 1px solid #c4e5d1;
}

/* ------------------------------ 资源卡 ------------------------------ */
.res-item {
  display: flex; gap: 13px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
  align-items: flex-start;
}
.res-item:last-child { border-bottom: none; }
.res-item:hover { background: var(--blue-50); }
.res-ico {
  width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center;
  font-size: 17px; flex: 0 0 40px;
}
.res-main { flex: 1; min-width: 0; }
.res-title { font-size: 14.5px; font-weight: 600; margin-bottom: 3px; }
.res-title a { color: var(--ink-900); }
.res-title a:hover { color: var(--blue-600); }
.res-meta { font-size: 12px; color: var(--ink-400); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.res-desc { font-size: 12.5px; color: var(--ink-500); margin-top: 5px; }

/* ------------------------------ 题目 ------------------------------ */
.q-item { padding: 15px 0; border-bottom: 1px solid var(--line-soft); }
.q-item:last-child { border-bottom: none; }
.q-head { display: flex; gap: 9px; align-items: flex-start; margin-bottom: 9px; }
.q-no {
  flex: 0 0 26px; height: 26px; border-radius: 50%; background: var(--blue-100); color: var(--blue-700);
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
}
.q-stem { font-size: 14.5px; line-height: 1.7; flex: 1; }
.q-opts { display: flex; flex-direction: column; gap: 7px; margin: 9px 0 0 35px; }
.opt {
  display: flex; gap: 9px; align-items: flex-start; padding: 8px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); cursor: pointer; background: #fff; transition: all .13s; font-size: 13.5px;
}
.opt:hover { border-color: var(--blue-500); background: var(--blue-50); }
.opt.selected { border-color: var(--blue-600); background: var(--blue-100); }
.opt.correct { border-color: var(--green); background: var(--green-bg); }
.opt.wrong { border-color: var(--red); background: var(--red-bg); }
.opt input { margin-top: 3px; }
.opt .k { font-weight: 700; color: var(--ink-700); flex: 0 0 16px; }
.q-actions { margin: 10px 0 0 35px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.q-feedback { margin: 9px 0 0 35px; font-size: 13px; padding: 10px 13px; border-radius: var(--radius-sm); }
.q-feedback.ok { background: var(--green-bg); color: var(--green); border: 1px solid #c4e5d1; }
.q-feedback.bad { background: var(--red-bg); color: var(--red); border: 1px solid #f2c7c1; }
.q-feedback .ana { color: var(--ink-700); margin-top: 5px; padding-top: 5px; border-top: 1px dashed rgba(0,0,0,.1); }

/* ------------------------------ 答题卡 ------------------------------ */
.answer-sheet { position: sticky; top: 74px; }
.sheet-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; }
.sheet-cell {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff;
  display: grid; place-items: center; font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums;
}
.sheet-cell.done { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 600; }
.sheet-cell.flag { background: var(--amber-bg); border-color: var(--amber); color: var(--amber); }
.sheet-cell:hover { border-color: var(--blue-600); }

.exam-timer {
  font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--blue-700);
  letter-spacing: .5px;
}
.exam-timer.danger { color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .45; } }

/* ------------------------------ 登录页 ------------------------------ */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 14px;
  box-shadow: 0 18px 50px rgba(16, 40, 80, .13); padding: 34px 32px 28px; border: 1px solid #e6ecf5;
}
.login-card .logo { text-align: center; margin-bottom: 22px; }
.login-card .logo .m {
  width: 54px; height: 54px; border-radius: 15px; margin: 0 auto 12px;
  background: var(--blue-700);
  display: grid; place-items: center; color: #fff; font-size: 24px;
  box-shadow: 0 6px 18px rgba(37, 99, 201, .3);
}
.login-card .logo h1 { font-size: 19px; margin-bottom: 4px; }
.login-card .logo p { font-size: 12.5px; color: var(--ink-400); margin: 0; }
.login-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--ink-400); }

/* ------------------------------ 分页 ------------------------------ */
.pager { display: flex; gap: 5px; align-items: center; justify-content: center; padding: 16px 0 4px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 10px; display: inline-grid; place-items: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px; background: #fff; color: var(--ink-700);
}
.pager a:hover { border-color: var(--blue-500); color: var(--blue-700); text-decoration: none; background: var(--blue-50); }
.pager .cur { background: var(--blue-600); border-color: var(--blue-600); color: #fff; font-weight: 600; }
.pager .info { border: none; background: none; color: var(--ink-400); font-size: 12.5px; }

/* ------------------------------ 空状态 ------------------------------ */
.empty-state { text-align: center; padding: 44px 20px; color: var(--ink-400); }
.empty-state .ic { font-size: 38px; margin-bottom: 10px; opacity: .5; }
.empty-state p { font-size: 13.5px; margin-bottom: 14px; }

/* ------------------------------ 详情描述列表 ------------------------------ */
.dl { display: grid; grid-template-columns: 92px 1fr; gap: 7px 14px; font-size: 13.5px; }
.dl dt { color: var(--ink-500); font-size: 13px; }
.dl dd { margin: 0; color: var(--ink-900); }

/* ------------------------------ 正文渲染 ------------------------------ */
.article { font-size: 15px; line-height: 1.85; color: var(--ink-900); word-wrap: break-word; }
.article h1 { font-size: 21px; margin: 22px 0 12px; }
.article h2 { font-size: 18px; margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line-soft); }
.article h3 { font-size: 16px; margin: 18px 0 8px; }
.article p { margin: 0 0 12px; }
.article ul, .article ol { padding-left: 24px; margin: 0 0 12px; }
.article li { margin-bottom: 5px; }
.article table { border-collapse: collapse; width: 100%; margin: 12px 0; font-size: 13.5px; }
.article th, .article td { border: 1px solid var(--line); padding: 7px 10px; }
.article th { background: #f8fafc; }
.article blockquote { margin: 12px 0; padding: 9px 15px; border-left: 3px solid var(--blue-500); background: var(--blue-50); color: var(--ink-700); }
.article img { max-width: 100%; border-radius: var(--radius-sm); }
.article code { background: #f1f4f9; padding: 1.5px 5px; border-radius: 4px; font-size: 13px; }
.article pre { background: #f6f8fb; border: 1px solid var(--line); padding: 13px; border-radius: var(--radius-sm); overflow-x: auto; font-size: 13px; }
.article pre.plain-text { white-space: pre-wrap; font-size: 14px; line-height: 1.8; }

/* ------------------------------ 其它 ------------------------------ */
.text-muted { color: var(--ink-400); }
.text-sm { font-size: 12.5px; }
.mt-0 { margin-top: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .between { justify-content: space-between; } .center-v { align-items: center; }
.gap-8 { gap: 8px; } .gap-16 { gap: 16px; }
.nowrap { white-space: nowrap; }
.hr { height: 1px; background: var(--line-soft); margin: 16px 0; border: 0; }
.hidden { display: none !important; }

.rank-1 { color: #c9971f; font-weight: 700; }
.rank-2 { color: #8892a4; font-weight: 700; }
.rank-3 { color: #b1743c; font-weight: 700; }

.print-only { display: none; }
@media print {
  .topbar, .sidebar, .filter-bar, .btn, .pager, .main-head { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #ddd; break-inside: avoid; }
  .print-only { display: block; }
}

@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .container { padding: 0 13px; }
  .main-body { padding: 14px 13px 40px; }
  .brand { font-size: 14px; }
  .brand small { display: none; }
  .topnav { display: none; }
  .topbar { height: auto; min-height: var(--topbar-h); }
  .topbar .container { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .topbar .brand { flex: 1 0 180px; min-width: 0; }
  .topbar .brand > span:last-child { white-space: nowrap; }
  .topbar-user { margin-left: auto; max-width: 100%; flex-wrap: wrap; justify-content: flex-end; }
}
