/* ============================================================
   NeuChinese Academy — 设计系统 v3
   视觉语言：克制的暖中性底 + 单一朱砂强调色，扁平层级、发丝级描边、
   统一 8px 间距栅格。不使用 emoji、不使用彩虹渐变、不使用多重彩色阴影。

   —— 字体：Aptos（拉丁） + 中文黑体回退 ——
   本机已安装 Aptos 时浏览器直接启用；未安装则回退 src/fonts/aptos.ttf 自托管。
   Aptos 为 Microsoft 商用字体，请使用你已获授权的版本。
============================================================ */
@font-face {
  font-family: "Aptos (Body)";
  src: url("./fonts/aptos.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Aptos";
  src: url("./fonts/aptos.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ====================== 设计令牌 ====================== */
:root {
  /* 品牌：朱砂（单一强调色，克制使用） */
  --accent: #b23a26;
  --accent-hover: #972f1e;
  --accent-soft: #fbede9;
  --accent-line: #e8c7bd;
  /* 辅助：青瓷 / 描金（仅用于状态与数据，不作装饰） */
  --jade: #1f6b58;
  --jade-soft: #e8f2ef;
  --gold: #9c7218;
  --gold-soft: #f6efdc;
  --info: #2f5fa8;
  --info-soft: #e9f0fa;

  /* 中性色（浅色） */
  --bg: #f5f4f2;
  --surface: #ffffff;
  --surface-2: #faf9f7;
  --surface-3: #f1efec;
  --border: #e4e1db;
  --border-strong: #d0ccc4;
  --text: #191c1f;
  --text-2: #5b6167;
  --text-3: #8a9098;

  /* 语义色 */
  --success: #1f7a4d;
  --success-soft: #e6f3ec;
  --warning: #a5670a;
  --warning-soft: #faf0da;
  --danger: #b23a26;
  --danger-soft: #fbe9e5;

  /* 尺寸 */
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;
  --r-lg: 14px;
  --r: 10px;
  --r-sm: 8px;
  --r-xs: 6px;
  --gap: 20px;

  /* 阴影：单层、低饱和，配合发丝描边 */
  --shadow: 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 4px 14px rgba(16, 24, 40, .07);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .16);

  --font: "Aptos (Body)", "Aptos", -apple-system, "Segoe UI", "PingFang SC",
          "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei",
          "Source Han Sans SC", "Noto Sans SC", sans-serif;
  --font-num: "Aptos (Body)", "Aptos", "SF Mono", ui-monospace, "Cascadia Mono", monospace;
}

[data-theme="dark"] {
  --accent: #e0715b;
  --accent-hover: #ef8871;
  --accent-soft: #33201b;
  --accent-line: #4d2c23;
  --jade: #58b39c;
  --jade-soft: #16302a;
  --gold: #d3a63f;
  --gold-soft: #2e2711;
  --info: #7ba3e0;
  --info-soft: #16233a;

  --bg: #101214;
  --surface: #171a1d;
  --surface-2: #1c2024;
  --surface-3: #22272c;
  --border: #272c32;
  --border-strong: #363d45;
  --text: #e8eaec;
  --text-2: #a3aab2;
  --text-3: #6f767e;

  --success: #5cb98a; --success-soft: #132b21;
  --warning: #d8a53c; --warning-soft: #2e2611;
  --danger: #e0715b;  --danger-soft: #33201b;

  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .4);
  --shadow-lg: 0 22px 56px rgba(0, 0, 0, .6);
}

/* ====================== 基础 ====================== */
* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 14px;
  line-height: 1.6;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
::selection { background: var(--accent-soft); color: var(--text); }

/* 线性图标（SVG）：与文字对齐、不收缩、继承 currentColor */
.icon { flex: 0 0 auto; vertical-align: middle; display: inline-block; }
.icon.spin { animation: icon-spin .9s linear infinite; }
@keyframes icon-spin { to { transform: rotate(360deg) } }
.nav-item .ico .icon, .stat .ico .icon { display: block; }

/* ====================== 布局 ====================== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width .2s ease, flex-basis .2s ease;
  z-index: 40;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); flex-basis: var(--sidebar-w-collapsed); }

.brand {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  display: flex; align-items: center; gap: 11px;
  padding: 0 16px; border-bottom: 1px solid var(--border); overflow: hidden;
}
.brand .logo {
  width: 32px; height: 32px; flex: 0 0 32px; border-radius: var(--r-sm);
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px; letter-spacing: 0;
}
.brand .name { font-weight: 650; font-size: 14.5px; white-space: nowrap; letter-spacing: .005em; line-height: 1.2; }
.brand .sub { font-size: 11px; color: var(--text-3); white-space: nowrap; line-height: 1.3; }
.sidebar.collapsed .brand .name, .sidebar.collapsed .brand .sub { display: none; }

.nav { padding: 14px 12px; flex: 1; overflow-y: auto; }
.nav-group-label {
  font-size: 11px; color: var(--text-3); padding: 14px 10px 6px;
  letter-spacing: .06em; white-space: nowrap; font-weight: 600;
}
.nav-group-label:first-child { padding-top: 0; }
.sidebar.collapsed .nav-group-label { opacity: 0; height: 10px; padding: 4px; }

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm); color: var(--text-2);
  white-space: nowrap; margin-bottom: 1px; position: relative;
  font-size: 13.5px; font-weight: 500;
  transition: background .14s ease, color .14s ease;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-item.active::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2.5px; height: 16px; border-radius: 0 2px 2px 0; background: var(--accent);
}
.nav-item .ico { width: 18px; flex: 0 0 18px; display: inline-flex; justify-content: center; color: var(--text-3); }
.nav-item:hover .ico { color: var(--text-2); }
.nav-item.active .ico { color: var(--accent); }
.sidebar.collapsed .nav-item span.label { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; }

.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: var(--r-sm); }
.user-chip .avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3);
  color: var(--text-2); display: grid; place-items: center; font-weight: 600; font-size: 12px;
  flex: 0 0 30px; border: 1px solid var(--border);
}
.user-chip .meta { overflow: hidden; }
.user-chip .meta b { font-size: 13px; display: block; white-space: nowrap; font-weight: 600; }
.user-chip .meta small { color: var(--text-3); font-size: 11px; }
.sidebar.collapsed .user-chip .meta { display: none; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ====================== 顶栏 ====================== */
.topbar {
  height: var(--topbar-h); flex: 0 0 var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .title { font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.topbar .crumb { color: var(--text-3); font-size: 11.5px; line-height: 1.3; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn { width: 32px; height: 32px; }
.topbar .divider-v { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

/* ====================== 内容区 ====================== */
.content {
  padding: 26px 28px 44px; flex: 1;
  width: 100%; max-width: 1440px; margin: 0 auto;
}
.content-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 22px; flex-wrap: wrap;
}
.content-head h1 { font-size: 22px; letter-spacing: -.015em; }
.content-head p { margin-top: 5px; color: var(--text-2); font-size: 13px; max-width: 68ch; line-height: 1.65; }

/* ====================== 栅格 / 卡片 ====================== */
.grid { display: grid; gap: var(--gap); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-auto { grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow);
}
.card.tight { padding: 14px; }
.card.flat { box-shadow: none; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; min-height: 24px;
}
.card-head h3 { font-size: 14.5px; letter-spacing: -.005em; }
.card-head .sub { font-size: 12px; color: var(--text-3); }
.card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }

/* 统计卡 */
.stat { gap: 10px; }
.stat .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.stat .label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.stat .ico {
  width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); flex: 0 0 34px;
}
.stat .val {
  font-size: 28px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1;
  font-variant-numeric: tabular-nums; font-family: var(--font-num);
}
.stat .delta { font-size: 12px; color: var(--text-3); display: inline-flex; align-items: center; gap: 4px; }
.delta .icon { color: var(--text-3); }
.delta.up { color: var(--success); }
.delta.up .icon { color: var(--success); }
.delta.down { color: var(--danger); }
.delta.down .icon { color: var(--danger); }

/* ====================== 按钮 ====================== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  height: 34px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 600; letter-spacing: -.005em;
  transition: background .14s, border-color .14s, box-shadow .14s, color .14s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { background: var(--surface-3); }
.btn.primary {
  background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .12);
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.jade { background: var(--jade); border-color: var(--jade); color: #fff; }
.btn.jade:hover { filter: brightness(1.08); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-xs); gap: 5px; }
.btn.danger { color: var(--danger); border-color: var(--accent-line); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--surface); border-color: var(--border); }
/* 进行中：禁用态基础上再加一层「忙碌」指示（不用 Emoji） */
.btn.loading { position: relative; }
.btn.loading::after { content: ''; position: absolute; right: 10px; top: 50%; width: 10px; height: 10px; margin-top: -5px; border: 1.5px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: btn-spin .7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn.block { width: 100%; }

.icon-btn {
  width: 32px; height: 32px; border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  display: inline-grid; place-items: center; transition: background .14s, color .14s, border-color .14s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); border-color: var(--accent-line); }

/* ====================== 表格 ====================== */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--border);
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow);
}
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
.tbl th, .tbl td {
  padding: 12px 16px; text-align: left;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
.tbl th {
  color: var(--text-3); font-weight: 600; font-size: 12px;
  background: var(--surface-2); white-space: nowrap; letter-spacing: .01em;
}
.tbl thead th:first-child { border-top-left-radius: var(--r-lg); }
.tbl thead th:last-child { border-top-right-radius: var(--r-lg); }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl .cell-main { font-weight: 600; color: var(--text); }
.tbl .cell-sub { color: var(--text-3); font-size: 12px; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ====================== 徽章 / 标签 ====================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: var(--r-xs);
  font-size: 11.5px; font-weight: 600; line-height: 1.6; white-space: nowrap;
}
.badge.gray { background: var(--surface-3); color: var(--text-2); }
.badge.green { background: var(--success-soft); color: var(--success); }
.badge.red { background: var(--danger-soft); color: var(--danger); }
.badge.jade { background: var(--jade-soft); color: var(--jade); }
.badge.gold { background: var(--gold-soft); color: var(--gold); }

/* 降级提示：模板结果冒充“AI 生成”是最坏的体验，必须明说 */
.ai-degraded {
  display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px;
  padding: 12px 14px; background: var(--gold-soft); border: 1px solid var(--accent-line);
  border-radius: var(--r-sm); font-size: 12.5px; line-height: 1.65; color: var(--text-2);
}
.ai-degraded svg { color: var(--gold); flex: 0 0 auto; margin-top: 2px; }
.ai-degraded b { display: block; color: var(--text); margin-bottom: 2px; }
.ai-degraded p { margin: 0; }

/* 教材智能成课 */
.material-builder { grid-template-columns: minmax(360px, .9fr) minmax(440px, 1.1fr); }
.material-onboarding {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  margin-bottom: 18px; padding: 18px 20px; border: 1px solid var(--accent-line);
  border-left: 4px solid var(--accent); border-radius: var(--r); background: var(--accent-soft);
}
.material-onboarding b { display: block; margin-bottom: 4px; font-size: 15px; }
.material-onboarding p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.65; }
.material-course-picker { align-items: end; }
.material-course-picker .field { margin-bottom: 0; }
.material-upload-progress { height: 7px; margin-top: 12px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.material-upload-progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .18s ease; }
.material-ai-ok { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; padding: 11px 13px; border: 1px solid color-mix(in srgb, var(--jade) 28%, var(--border)); border-radius: var(--r-sm); background: color-mix(in srgb, var(--jade) 8%, var(--surface)); color: var(--jade); font-size: 13px; font-weight: 600; }
.material-extract-summary { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px; }
.material-extract-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.material-extract-row svg { flex: 0 0 auto; color: var(--jade); }
.material-module-preview { max-height: 490px; overflow: auto; padding-right: 4px; }
.material-module-row { margin-bottom: 9px; padding: 11px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); }
.material-order { display: grid; flex: 0 0 25px; width: 25px; height: 25px; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }

/* 课程视频：独立于教材成课，清楚呈现课程归属与已上传资源 */
.video-upload-layout { display: grid; grid-template-columns: minmax(340px, .78fr) minmax(440px, 1.22fr); gap: 18px; align-items: start; }
.video-upload-panel { border-top: 3px solid var(--accent); }
.video-library-panel { min-height: 440px; }
.video-dropzone .small { display: block; margin-top: 5px; line-height: 1.65; }
.video-course-note { display: flex; align-items: center; gap: 10px; margin-top: -5px; padding: 10px 12px; border: 1px solid var(--border); background: var(--surface-2); }
.video-course-note b, .video-course-note span { display: block; }
.video-course-note span { margin-top: 2px; color: var(--text-3); font-size: 12px; }
.video-count { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border-strong); color: var(--accent); font-family: var(--font-num); font-weight: 700; }
.video-library { border-top: 1px solid var(--border); }
.video-record { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto 32px; gap: 12px; align-items: center; padding: 15px 2px; border-bottom: 1px solid var(--border); }
.video-record:last-child { border-bottom: 0; }
.video-record-mark { height: 48px; display: flex; align-items: center; justify-content: space-evenly; color: var(--gold); background: #27231d; }
.video-record-mark span { font-family: var(--font-num); font-size: 11px; color: #d7c59c; }
.video-record-main { min-width: 0; }
.video-record-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.video-record-main .small { margin-top: 4px; }
.video-empty { min-height: 310px; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--text-3); }
.video-empty > span { display: grid; place-items: center; width: 58px; height: 42px; margin-bottom: 13px; background: #27231d; color: var(--gold); }
.video-empty b { color: var(--text-2); }
.video-empty p { max-width: 36ch; margin: 7px 0 0; font-size: 12.5px; line-height: 1.7; }

@media (max-width: 1050px) {
  .material-builder, .video-upload-layout { grid-template-columns: 1fr; }
}
.badge.blue { background: var(--info-soft); color: var(--info); }
.badge.purple { background: var(--accent-soft); color: var(--accent); }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; flex: 0 0 6px; }
.dot.green { background: var(--success); } .dot.red { background: var(--danger); }
.dot.gold { background: var(--gold); } .dot.blue { background: var(--info); }
.dot.gray { background: var(--text-3); }

/* ====================== 表单 ====================== */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-2);
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 6px; line-height: 1.55; }
.input, .select, .textarea {
  width: 100%; min-height: 36px; padding: 8px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color .14s, box-shadow .14s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 88px; resize: vertical; line-height: 1.65; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
select.select { appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a9098' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; cursor: pointer;
}

/* ====================== 弹窗 ====================== */
.overlay {
  position: fixed; inset: 0; background: rgba(16, 20, 24, .38);
  display: grid; place-items: center; z-index: 100; padding: 24px;
  animation: fade .14s ease;
}
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--border); animation: pop .16s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.99); opacity: 0 } to { transform: none; opacity: 1 } }
.modal.wide { width: min(840px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; background: var(--surface-2); }
.x-btn { border: none; background: transparent; color: var(--text-3); padding: 6px; border-radius: var(--r-xs); display: grid; place-items: center; }
.x-btn:hover { background: var(--surface-2); color: var(--text); }

/* ====================== Toast ====================== */
#toast-root {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
#toast-root > div { animation: toast-in .18s ease; pointer-events: auto; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ====================== 图表 ====================== */
.chart-svg { width: 100%; display: block; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; font-size: 12px; color: var(--text-2); }
.legend .li { display: flex; align-items: center; gap: 6px; }

/* ====================== 进度条 ====================== */
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > span, .progress > .bar { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .4s ease; }

/* ====================== 工具类 ====================== */
.flex { display: flex; } .items-center { align-items: center; } .gap-6 { gap: 6px; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; }
.between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.flex-1 { flex: 1 1 0; min-width: 0; }
.muted { color: var(--text-3); } .small { font-size: 12px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }

/* 筛选标签组（学生端课程/测评筛选） */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 500;
  font-family: inherit; cursor: pointer; transition: border-color .14s, color .14s, background .14s;
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.link { color: var(--accent); font-size: 13px; font-weight: 500; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.pill-tabs { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px; gap: 2px; }
.pill-tabs .tab { padding: 5px 12px; border-radius: var(--r-xs); font-size: 12.5px; color: var(--text-2); border: none; background: transparent; font-weight: 600; }
.pill-tabs .tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .grow { flex: 1; min-width: 200px; }
.inp-search {
  display: flex; align-items: center; gap: 8px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 0 12px; min-height: 36px; color: var(--text-3);
}
.inp-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inp-search input { border: none; outline: none; background: transparent; color: var(--text); width: 100%; font-size: 13.5px; }
.inp-search select { border: none; background: transparent; outline: none; color: var(--text); font-size: 13.5px; width: 100%; }

.empty { text-align: center; color: var(--text-3); padding: 40px 16px; }
.empty .big {
  width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; color: var(--text-3);
}
.empty .big .icon { display: block; }
.empty p, .empty div { font-size: 13px; line-height: 1.6; }

.pagination { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: 16px; }
.pagination button {
  min-width: 30px; height: 30px; border-radius: var(--r-xs); border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); display: grid; place-items: center; font-size: 12.5px; font-weight: 600;
}
.pagination button:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination button:disabled { opacity: .4; cursor: default; }

/* 评分维度 */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 12px; }
.score-box { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 14px 12px; text-align: center; background: var(--surface-2); }
.score-box .n { font-size: 24px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; font-family: var(--font-num); }
.score-box .l { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* 上传区 */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--r);
  padding: 26px 20px; text-align: center; color: var(--text-3);
  background: var(--surface-2); display: block; cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.dropzone .dz-icon { color: var(--text-3); margin-bottom: 10px; }
.dropzone:hover .dz-icon { color: var(--accent); }
.dropzone .dz-main { font-size: 13.5px; color: var(--text-2); font-weight: 600; }
.dropzone:hover .dz-main { color: var(--accent); }

/* 文件列表 */
.file-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.file-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px;
}
.file-row .fr-icon { color: var(--text-3); display: inline-flex; }
.file-row .fr-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.file-row .fr-size { color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }

/* 步骤指示 */
.step-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--text-3);
}
.step-chip .n {
  width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}

/* 课程封面（由标题生成的字形封面，替代 emoji 占位） */
.cover {
  display: grid; place-items: center; border-radius: var(--r-sm);
  color: #fff; font-weight: 600; letter-spacing: 0; flex: 0 0 auto;
  width: 36px; height: 36px; font-size: 15px; line-height: 1; overflow: hidden;
  user-select: none;
}
.cover.sm { width: 28px; height: 28px; font-size: 12.5px; border-radius: var(--r-xs); }
.cover.lg { width: 56px; height: 56px; font-size: 22px; border-radius: var(--r); }
.cover.xl { width: 88px; height: 88px; font-size: 34px; border-radius: 14px; }

/* AI 标记 */
.ai-tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  color: var(--jade); background: var(--jade-soft); padding: 2px 8px; border-radius: var(--r-xs);
  letter-spacing: .02em;
}

/* 时间线 */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.tl-item:last-child { border-bottom: none; }
.tl-item .tl-dot { margin-top: 6px; }
.tl-item .tl-t { font-size: 13px; line-height: 1.5; }
.tl-item .tl-s { font-size: 12px; color: var(--text-3); margin-top: 1px; }

/* ====================== 登录页 ====================== */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-hero {
  background: #1a1512; color: #f2ece7; position: relative; overflow: hidden;
  padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between;
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(900px 520px at 88% 8%, rgba(178, 58, 38, .30), transparent 62%);
  pointer-events: none;
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-hero .h-brand { display: flex; align-items: center; gap: 12px; }
.auth-hero .h-logo {
  width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--accent);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px;
}
.auth-hero .h-name { font-weight: 650; font-size: 15px; letter-spacing: .01em; }
.auth-hero .h-sub2 { font-size: 11.5px; color: rgba(242, 236, 231, .6); }
.auth-hero .h-title { font-size: 32px; font-weight: 600; letter-spacing: -.02em; line-height: 1.25; margin-top: 40px; }
.auth-hero .h-sub { color: rgba(242, 236, 231, .65); margin-top: 14px; max-width: 44ch; line-height: 1.75; font-size: 13.5px; }
.auth-hero .h-feat { display: flex; flex-direction: column; gap: 16px; margin: 36px 0; }
.auth-hero .h-feat .f { display: flex; gap: 12px; align-items: flex-start; }
.auth-hero .h-feat .fi {
  width: 30px; height: 30px; border-radius: var(--r-xs); background: rgba(255, 255, 255, .07);
  display: grid; place-items: center; color: #e0715b; flex: 0 0 30px;
}
.auth-hero .h-feat .ft { font-size: 13.5px; line-height: 1.55; color: rgba(242, 236, 231, .9); }
.auth-hero .h-foot { font-size: 11.5px; color: rgba(242, 236, 231, .4); }

.auth-form-side { display: grid; place-items: center; padding: 40px 32px; background: var(--bg); }
.auth-card { width: min(360px, 100%); }
.auth-card h2 { font-size: 22px; letter-spacing: -.015em; }
.auth-card .sub { color: var(--text-2); margin: 6px 0 26px; font-size: 13px; }
.auth-card .card { padding: 0; border: none; background: transparent; box-shadow: none; }
.demo-hint {
  font-size: 11.5px; color: var(--text-3); margin-top: 18px; text-align: center; line-height: 1.6;
}
.auth-err {
  color: var(--danger); font-size: 12.5px; background: var(--danger-soft);
  border: 1px solid var(--accent-line); border-radius: var(--r-xs);
  padding: 8px 12px; margin-bottom: 14px;
}

/* ====================== 响应式 ====================== */
@media (max-width: 1180px) {
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .auth-form-side { background: var(--surface); }
  .sidebar {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    box-shadow: var(--shadow-lg); transition: transform .24s ease;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.collapsed { width: var(--sidebar-w); flex-basis: var(--sidebar-w); }
  .sidebar.collapsed .nav-item span.label { display: inline; }
  .sidebar.collapsed .brand .name, .sidebar.collapsed .brand .sub { display: block; }
  .sidebar.collapsed .user-chip .meta { display: block; }
  .sidebar.collapsed .nav-item { justify-content: flex-start; }
  .scrim { position: fixed; inset: 0; background: rgba(16, 20, 24, .45); z-index: 35; }
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .material-onboarding { align-items: stretch; flex-direction: column; }
  .content { padding: 20px 16px 40px; }
  #btn-menu { display: grid !important; }
  .topbar > .icon-btn[aria-label="折叠"], .topbar .divider-v { display: none; }
}
@media (max-width: 560px) {
  .stat .val { font-size: 24px; }
  .content-head { align-items: flex-start; }
  .video-record { grid-template-columns: 44px minmax(0, 1fr) 32px; gap: 8px; }
  .video-record > .btn { grid-column: 2; justify-self: start; }
}

/* ---------- 无障碍 ---------- */
.draft-content { margin-top: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.material-source-picker { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 18px; }
.material-source-list { display: grid; gap: 10px; }
.material-builder > .card, .material-builder .field, .material-module-row, .material-source-list > .card { min-width: 0; }
.material-source-list .flex { flex-wrap: wrap; }
.material-source-list .fr-size { white-space: nowrap; }
.material-builder .dropzone { min-width: 0; }
@media(max-width:560px) {
  .material-builder.grid { grid-template-columns: minmax(0,1fr); }
  .material-builder .card-head { flex-wrap: wrap; gap: 8px; }
  .material-builder > .card > .flex.gap-8 { flex-direction: column; }
  .material-module-row > .flex > .input { width: 0; min-width: 0; flex: 1; }
}
.material-source-picker input[type=checkbox] { accent-color: var(--accent); width: 17px; height: 17px; flex: 0 0 auto; }
.draft-content summary { cursor: pointer; font-weight: 600; }
.draft-item { margin: 14px 0; padding: 14px; border: 1px solid var(--border); display: grid; gap: 12px; min-width: 0; }
.draft-item legend { padding: 0 6px; font-weight: 600; }
.draft-item label { display: grid; gap: 5px; font-size: 12px; }
.draft-item textarea { width: 100%; resize: vertical; }
.draft-approval { display: flex; gap: 8px; align-items: flex-start; margin-top: 14px; font-size: 13px; line-height: 1.6; }
.draft-approval input { margin-top: 5px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
