/* =====================================================================
 * app.css · 网络在线教学与学习系统 统一设计系统
 * 零依赖 / 零构建 / 移动优先断点 / 支持浅色与深色主题
 * 断点：>=1200 双栏侧边导航；900~1199 窄侧栏；<900 抽屉 + 底部标签栏
 * ===================================================================== */

:root {
  --brand: #3355e6;
  --brand-deep: #233bb8;
  --brand-2: #7a5af8;
  --brand-soft: #eef2ff;
  --teal: #0e9f8a;
  --teal-soft: #e6f7f3;
  --amber: #e08a08;
  --amber-soft: #fff5e4;
  --rose: #dc3f63;
  --rose-soft: #ffedf1;
  --blue-soft: #e8f1ff;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafd;
  --surface-3: #f0f3f9;
  --line: #e5e9f2;
  --line-strong: #d6dceb;
  --text: #172033;
  --text-2: #3f4b60;
  --muted: #6b778f;
  --faint: #98a3b7;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 26px rgba(16, 24, 40, .055);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, .16);
  --sidebar-w: 236px;
  --topbar-h: 66px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

html[data-theme="dark"] {
  --brand: #7d93ff;
  --brand-deep: #6480ff;
  --brand-2: #a78bfa;
  --brand-soft: #232c4d;
  --teal: #38c9b0;
  --teal-soft: #143b38;
  --amber: #f0b04a;
  --amber-soft: #403017;
  --rose: #ff7d9c;
  --rose-soft: #452130;
  --blue-soft: #1d314f;
  --bg: #0e1422;
  --surface: #171f30;
  --surface-2: #1c2639;
  --surface-3: #222e44;
  --line: #2a3650;
  --line-strong: #384663;
  --text: #eef2fb;
  --text-2: #cbd5e8;
  --muted: #94a1bb;
  --faint: #6d7b96;
  --shadow: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 28px rgba(0, 0, 0, .22);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, .45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.62 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-deep); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img, video, svg { max-width: 100%; }
h1, h2, h3, h4, p { margin-top: 0; }
ul { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--brand-soft); color: var(--brand-deep); }

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 图标 ---------- */
.ico { width: 18px; height: 18px; display: inline-block; vertical-align: -.28em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ico.sm { width: 15px; height: 15px; }
.ico.lg { width: 22px; height: 22px; }
.ico.fill { fill: currentColor; stroke: none; }

/* =====================================================================
 * 布局骨架
 * ===================================================================== */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 60;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 6px 16px rgba(51, 85, 230, .32);
}
.brand-mark .ico { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text b { font-size: 15px; letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text .brand-short { display: none; }
.brand-text small { color: var(--faint); font-size: 11px; letter-spacing: .6px; white-space: nowrap; }

.topbar-spacer { flex: 1; }
.top-search {
  display: flex; align-items: center; gap: 8px; width: min(320px, 32vw);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 14px; color: var(--muted);
}
.top-search input { border: 0; outline: 0; background: transparent; color: var(--text); width: 100%; min-width: 0; }
.top-search input::placeholder { color: var(--faint); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); display: grid; place-items: center; flex: none;
  transition: .18s;
}
.icon-btn:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-soft); }
.user-chip {
  display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text);
}
.user-chip:hover { border-color: var(--brand); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
}
.avatar.lg { width: 54px; height: 54px; font-size: 20px; border-radius: 18px; }
.avatar.sm { width: 26px; height: 26px; font-size: 11px; }
.user-chip .u-name { font-size: 13px; font-weight: 600; white-space: nowrap; }

.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 50;
  background: var(--surface); border-right: 1px solid var(--line);
  padding: 18px 12px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.nav-group-title { font-size: 11px; color: var(--faint); letter-spacing: 1.4px; padding: 16px 14px 6px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 11px;
  color: var(--text-2); font-size: 14px; font-weight: 500; border: 0; background: transparent;
  width: 100%; text-align: left; transition: .16s; position: relative;
}
.nav-item:hover { background: var(--surface-3); color: var(--text); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--brand); }
.nav-item .ico { color: var(--muted); }
.nav-item.active .ico { color: var(--brand); }
.nav-item .nav-badge { margin-left: auto; }
.sidebar-foot { margin-top: auto; padding: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 11px; line-height: 1.7; }

.main { margin-left: var(--sidebar-w); padding: calc(var(--topbar-h) + 26px) 30px 60px; min-height: 100vh; }
.container { max-width: 1280px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 25px; line-height: 1.3; margin: 0 0 4px; letter-spacing: -.4px; }
.page-head p { color: var(--muted); margin: 0; font-size: 13px; }
.crumb { display: flex; align-items: center; gap: 7px; color: var(--faint); font-size: 12px; margin-bottom: 8px; }
.crumb a { color: var(--muted); }

.bottom-nav { display: none; }
.drawer-mask { display: none; }

/* =====================================================================
 * 通用组件
 * ===================================================================== */
/* 溢出硬化：宽表格、JSON 代码块、长无空格串一律在自身容器内消化，
 * 不允许把 grid / flex 轨道撑破导致整页出现横向滚动条（手机端尤其明显）。 */
.card, .stack, .row, .grid, .split, .split-even, .modal-body, .card-head, .alert-note { min-width: 0; max-width: 100%; }
.card > *, .stack > *, .row > *, .grid > *, .split > *, .split-even > *, .modal-body > * { min-width: 0; }
.card, .stack, .row, .card-head, .muted, .small, .alert-note, .kv b, .prose { overflow-wrap: anywhere; word-break: break-word; }
pre, code, .mono {
  max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere;
  word-break: break-word; font-variant-numeric: tabular-nums;
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.pad-0 { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; letter-spacing: -.2px; display: flex; align-items: center; gap: 9px; }
.card-head .ico { color: var(--brand); }
.card-head .sub { color: var(--muted); font-size: 12px; font-weight: 400; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.g-auto-lg { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.split-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row.tight { gap: 6px; }
.row.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.divider { height: 1px; background: var(--line); margin: 16px 0; }
.mt-0 { margin-top: 0; } .mb-0 { margin-bottom: 0; } .mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-16 { margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text-2); font-size: 13px; font-weight: 600;
  transition: .16s; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--brand); color: var(--brand); }
.btn:active { transform: none; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 5px 14px rgba(51, 85, 230, .22); }
.btn.primary:hover { background: var(--brand-deep); color: #fff; }
.btn.ghost { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.btn.soft { background: var(--surface-2); }
.btn.danger { color: var(--rose); border-color: var(--rose); background: var(--rose-soft); }
.btn.success { color: var(--teal); border-color: var(--teal); background: var(--teal-soft); }
.btn.warn { color: var(--amber); border-color: var(--amber); background: var(--amber-soft); }
.btn.sm { min-height: 31px; padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn.lg { min-height: 46px; padding: 11px 22px; font-size: 15px; border-radius: 12px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn-group { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 12px; }
.btn-group .btn { border: 0; background: transparent; box-shadow: none; min-height: 32px; padding: 5px 13px; }
.btn-group .btn.on { background: var(--surface); color: var(--brand); box-shadow: 0 2px 8px rgba(16,24,40,.08); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); color: var(--text); outline: none; transition: .16s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--brand); }

.badge, .tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: var(--surface-3); color: var(--muted); white-space: nowrap;
}
.tag.brand, .badge.brand { background: var(--brand-soft); color: var(--brand); }
.tag.teal, .badge.teal { background: var(--teal-soft); color: var(--teal); }
.tag.amber, .badge.amber { background: var(--amber-soft); color: var(--amber); }
.tag.rose, .badge.rose { background: var(--rose-soft); color: var(--rose); }
.tag.blue { background: var(--blue-soft); color: #2f6fd0; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: currentColor; flex: none; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 18px; box-shadow: var(--shadow); display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.stat-icon.brand { background: var(--brand-soft); color: var(--brand); }
.stat-icon.teal { background: var(--teal-soft); color: var(--teal); }
.stat-icon.amber { background: var(--amber-soft); color: var(--amber); }
.stat-icon.rose { background: var(--rose-soft); color: var(--rose); }
.stat b { display: block; font-size: 24px; line-height: 1.2; letter-spacing: -.6px; }
.stat small { color: var(--muted); font-size: 12px; }

.progress { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .5s; }
.progress.thin { height: 5px; }
.progress.teal > i { background: linear-gradient(90deg, var(--teal), #4fd1b5); }
.progress.amber > i { background: linear-gradient(90deg, var(--amber), #f5bd4f); }
.progress.rose > i { background: linear-gradient(90deg, var(--rose), #fb8ba5); }
.ring { --p: 0; width: 108px; height: 108px; border-radius: 50%; display: grid; place-items: center; position: relative; flex: none;
  background: conic-gradient(var(--brand) calc(var(--p) * 1%), var(--surface-3) 0); }
.ring::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; background: var(--surface); }
.ring > span { position: relative; font-size: 21px; font-weight: 800; letter-spacing: -.5px; }
.ring > small { position: absolute; bottom: 20px; font-size: 10px; color: var(--muted); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: 18px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; padding: 11px 15px; color: var(--muted); font-size: 13px;
  font-weight: 600; white-space: nowrap; border-bottom: 2px solid transparent; transition: .16s;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs.pill { border: 0; gap: 6px; margin-bottom: 16px; }
.tabs.pill button { border-radius: 999px; padding: 7px 15px; background: var(--surface-2); }
.tabs.pill button.on { background: var(--brand); color: #fff; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; min-width: 0; max-width: 100%; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 560px; }
.tbl th { text-align: left; padding: 12px 14px; color: var(--muted); font-size: 12px; font-weight: 700; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { font-variant-numeric: tabular-nums; }
.table-hint { display: none; color: var(--faint); font-size: 11.5px; align-items: center; gap: 5px; margin: 0 0 7px; }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 13px; padding: 13px 4px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 600; font-size: 13.5px; margin-bottom: 2px; }
.list-item .li-sub { color: var(--muted); font-size: 12px; }
.list-num { width: 26px; height: 26px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); font-size: 12px; font-weight: 800; flex: none; }
.list-num.top { background: var(--brand); color: #fff; }

.empty { padding: 42px 20px; text-align: center; color: var(--faint); }
.empty .ico { width: 40px; height: 40px; stroke-width: 1.3; margin-bottom: 10px; color: var(--line-strong); }
.empty p { margin: 0; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; height: 14px; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.toast-box { position: fixed; top: calc(var(--topbar-h) + 14px); right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: min(380px, calc(100vw - 32px)); }
.toast { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--brand); box-shadow: var(--shadow-lg); border-radius: 12px; padding: 12px 16px; font-size: 13px; animation: tin .25s ease; }
.toast.ok { border-left-color: var(--teal); } .toast.err { border-left-color: var(--rose); } .toast.warn { border-left-color: var(--amber); }
@keyframes tin { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

.modal-mask { position: fixed; inset: 0; z-index: 150; background: rgba(12, 18, 32, .5); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { width: min(560px, 100%); max-height: min(86vh, 900px); overflow: auto; background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); animation: min .22s ease; }
.modal.wide { width: min(820px, 100%); }
@keyframes min { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text-2); font-size: 12px; font-weight: 600; transition: .16s; }
.chip:hover, .chip.on { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* =====================================================================
 * 门户 / 首页
 * ===================================================================== */
.hero {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); padding: 44px 46px;
  background: linear-gradient(120deg, #1f3aa8 0%, #3355e6 46%, #7a5af8 100%);
  color: #fff; box-shadow: 0 18px 40px rgba(35, 59, 184, .22); margin-bottom: 22px;
}
.hero::before { content: ""; position: absolute; width: 480px; height: 480px; right: -110px; top: -220px; border-radius: 50%; background: rgba(255,255,255,.09); }
.hero::after { content: ""; position: absolute; width: 300px; height: 300px; right: 130px; bottom: -210px; border-radius: 50%; background: rgba(255,255,255,.07); }
.hero-grid-bg { position: absolute; inset: 0; opacity: .13; background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.5) 1px, transparent 1px); background-size: 34px 34px; mask-image: linear-gradient(90deg, transparent, #000); }
.hero > * { position: relative; z-index: 1; }
.hero h1 { font-size: clamp(25px, 3.4vw, 38px); line-height: 1.25; margin-bottom: 12px; letter-spacing: -1px; font-weight: 800; }
.hero p { color: rgba(255,255,255,.86); font-size: 14px; max-width: 620px; margin-bottom: 24px; }
.hero .btn { background: #fff; color: var(--brand-deep); border-color: #fff; }
.hero .btn.outline { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(255,255,255,.5); }
.hero-stats { display: flex; gap: 34px; flex-wrap: wrap; margin-top: 30px; }
.hero-stats div b { display: block; font-size: 26px; line-height: 1.2; font-weight: 800; }
.hero-stats div span { font-size: 12px; color: rgba(255,255,255,.75); }
.hero-badge { display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px; border-radius: 999px; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.24); font-size: 12px; margin-bottom: 18px; }

.cover { height: 132px; border-radius: 13px; position: relative; overflow: hidden; display: flex; align-items: flex-end; padding: 14px; color: #fff; }
.cover::before { content: ""; position: absolute; width: 190px; height: 190px; border-radius: 50%; right: -60px; top: -100px; background: rgba(255,255,255,.14); }
.cover::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 26px; right: 28px; bottom: -60px; transform: rotate(24deg); background: rgba(255,255,255,.1); }
.cover span { position: relative; z-index: 1; font-size: 13px; font-weight: 700; letter-spacing: .5px; text-shadow: 0 1px 4px rgba(0,0,0,.18); }
.cover .cover-ico { position: absolute; right: 18px; top: 16px; width: 38px; height: 38px; opacity: .85; z-index: 1; }
.cover-1 { background: linear-gradient(135deg, #3b5bdb, #748ffc); }
.cover-2 { background: linear-gradient(135deg, #0b7285, #38d9a9); }
.cover-3 { background: linear-gradient(135deg, #9c36b5, #e599f7); }
.cover-4 { background: linear-gradient(135deg, #c92a2a, #ff922b); }
.cover-5 { background: linear-gradient(135deg, #1864ab, #4dabf7); }
.cover-6 { background: linear-gradient(135deg, #087f5b, #63e6be); }
.cover-7 { background: linear-gradient(135deg, #5f3dc4, #b197fc); }
.cover-8 { background: linear-gradient(135deg, #a61e4d, #f783ac); }

.course-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: .2s; cursor: pointer; display: flex; flex-direction: column; }
.course-card:hover { transform: translateY(-4px); box-shadow: 0 16px 36px rgba(16,24,40,.13); border-color: var(--line-strong); }
.course-card .cover { border-radius: 0; height: 128px; }
.course-card .cc-body { padding: 15px 16px 16px; flex: 1; display: flex; flex-direction: column; }
.course-card .cc-title { font-size: 15px; font-weight: 700; line-height: 1.45; margin-bottom: 6px; }
.course-card .cc-meta { color: var(--muted); font-size: 12px; display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.course-card .cc-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; color: var(--muted); }

.rank-item { display: flex; align-items: center; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.rank-item:last-child { border-bottom: 0; }
.rank-no { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 13px; background: var(--surface-3); color: var(--muted); flex: none; }
.rank-no.r1 { background: #fff2d6; color: #b26b00; } .rank-no.r2 { background: #eef1f6; color: #5a6b8c; } .rank-no.r3 { background: #fbe9dd; color: #a05a34; }
html[data-theme="dark"] .rank-no.r1 { background: #4a3714; color: #f0b04a; }
html[data-theme="dark"] .rank-no.r2 { background: #2c3750; color: #cbd5e8; }
html[data-theme="dark"] .rank-no.r3 { background: #462c20; color: #e6a07a; }

.notice-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.notice-item:last-child { border-bottom: 0; }
.notice-date { width: 46px; height: 46px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; line-height: 1.1; text-align: center; }
.notice-date b { font-size: 17px; } .notice-date small { font-size: 10px; }

.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 14px; }
.section-title h2 { font-size: 19px; margin: 0; letter-spacing: -.4px; display: flex; align-items: center; gap: 9px; }
.section-title h2::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: linear-gradient(var(--brand), var(--brand-2)); }
.section-title .more { font-size: 12px; color: var(--muted); }

.portal-hero { background: linear-gradient(120deg, #17275c, #3355e6 60%, #7048e8); color: #fff; border-radius: var(--radius-lg); padding: 34px 38px; margin-bottom: 20px; position: relative; overflow: hidden; }
.portal-hero::after { content: ""; position: absolute; width: 360px; height: 360px; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; right: -80px; top: -170px; }
.portal-hero h1 { font-size: clamp(22px, 3vw, 30px); margin-bottom: 8px; }
.portal-hero p { color: rgba(255,255,255,.82); margin: 0; }
.portal-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 16px; box-shadow: var(--shadow); }
.portal-section h2 { font-size: 17px; margin-bottom: 12px; padding-left: 12px; border-left: 3px solid var(--brand); }
.portal-section .prose { color: var(--text-2); line-height: 1.85; font-size: 14px; }
.portal-section .prose p { margin-bottom: 10px; }

/* =====================================================================
 * 课程空间
 * ===================================================================== */
.course-hero { display: flex; gap: 20px; align-items: center; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; }
.course-hero .cover { width: 180px; height: 112px; flex: none; }
.course-hero .ch-main { flex: 1; min-width: 0; }
.course-hero h1 { font-size: 21px; margin: 0 0 6px; }
.course-hero .ch-meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.course-hero .ch-desc { color: var(--text-2); font-size: 13px; margin-bottom: 12px; }

.chapter { border: 1px solid var(--line); border-radius: 13px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.chapter-head { display: flex; align-items: center; gap: 11px; padding: 13px 16px; cursor: pointer; transition: .16s; }
.chapter-head:hover { background: var(--surface-2); }
.chapter-head .ch-ico { width: 32px; height: 32px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.chapter-head b { font-size: 14px; flex: 1; min-width: 0; }
.chapter-body { padding: 2px 16px 14px 58px; border-top: 1px solid var(--line); }
.taskpoint { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.taskpoint:last-child { border-bottom: 0; }
.tp-state { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: var(--faint); flex: none; }
.tp-state.done { background: var(--teal); border-color: var(--teal); color: #fff; }
.tp-state.doing { border-color: var(--amber); color: var(--amber); }
.tp-title { flex: 1; min-width: 0; font-size: 13.5px; }
.tp-type { font-size: 11px; color: var(--muted); background: var(--surface-3); padding: 2px 8px; border-radius: 6px; }

.player { background: #0e1422; border-radius: 13px; overflow: hidden; position: relative; aspect-ratio: 16 / 9; display: grid; place-items: center; color: #fff; }
.player video { width: 100%; height: 100%; background: #000; display: block; }
.player-placeholder { text-align: center; padding: 20px; }
.player-placeholder .ico { width: 54px; height: 54px; opacity: .5; stroke-width: 1.2; }
.player-bar { position: absolute; left: 0; right: 0; bottom: 0; padding: 12px 16px; background: linear-gradient(transparent, rgba(0,0,0,.72)); display: flex; align-items: center; gap: 12px; font-size: 12px; }
.player-bar .progress { flex: 1; background: rgba(255,255,255,.25); }
.player-bar .progress > i { background: #fff; }

.res-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 10px; }
.res-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.res-ico.doc { background: var(--amber-soft); color: var(--amber); }
.res-ico.image { background: var(--teal-soft); color: var(--teal); }
.res-ico.link { background: var(--blue-soft); color: #2f6fd0; }
.res-main { flex: 1; min-width: 0; }

.q-card { border: 1px solid var(--line); border-radius: 13px; padding: 18px; background: var(--surface); margin-bottom: 14px; }
.q-stem { font-size: 14.5px; font-weight: 600; line-height: 1.7; margin-bottom: 14px; }
.q-opt { display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; cursor: pointer; transition: .15s; }
.q-opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.q-opt.sel { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.q-opt .k { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.q-opt.sel .k { background: var(--brand); color: #fff; }
.exam-bar { position: sticky; top: calc(var(--topbar-h) + 8px); z-index: 20; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; padding: 12px 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.timer { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--brand); }
.timer.danger { color: var(--rose); }

.comment { display: flex; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment .c-body { flex: 1; min-width: 0; }
.comment .c-head { display: flex; align-items: center; gap: 9px; margin-bottom: 5px; }
.comment .c-text { color: var(--text-2); font-size: 13.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-word; }

.bars { display: flex; align-items: flex-end; gap: 8px; height: 172px; padding-top: 10px; }
.bars .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.bars .bar-col i { width: 100%; max-width: 42px; border-radius: 7px 7px 2px 2px; background: linear-gradient(var(--brand), var(--brand-2)); min-height: 3px; display: block; transition: height .5s; }
.bars .bar-col small { font-size: 10px; color: var(--muted); white-space: nowrap; }
.bars .bar-col b { font-size: 11px; font-weight: 700; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before { content: ""; position: absolute; left: -20px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.timeline-item .t-title { font-size: 13px; font-weight: 600; }
.timeline-item .t-sub { font-size: 11.5px; color: var(--muted); }

.kv { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); min-width: 0; }
.kv b { font-variant-numeric: tabular-nums; min-width: 0; max-width: 100%; text-align: right; }

.alert-note { border-radius: 12px; padding: 12px 15px; font-size: 13px; line-height: 1.7; background: var(--brand-soft); color: var(--brand-deep); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent); }
.alert-note.warn { background: var(--amber-soft); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 25%, transparent); }
.alert-note.rose { background: var(--rose-soft); color: var(--rose); border-color: color-mix(in srgb, var(--rose) 25%, transparent); }
.alert-note.teal { background: var(--teal-soft); color: var(--teal); border-color: color-mix(in srgb, var(--teal) 25%, transparent); }
html[data-theme="dark"] .alert-note { color: var(--text); }

/* =====================================================================
 * 登录卡片
 * ===================================================================== */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, var(--brand-soft), transparent 45%), radial-gradient(circle at 85% 85%, var(--teal-soft), transparent 42%), var(--bg); }
.login-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px; }
.login-card h1 { font-size: 21px; margin-bottom: 6px; }
.login-card .brand-mark { width: 48px; height: 48px; border-radius: 15px; margin-bottom: 20px; }

/* =====================================================================
 * 响应式
 * ===================================================================== */
@media (max-width: 1199px) {
  :root { --sidebar-w: 200px; }
  .main { padding-left: 22px; padding-right: 22px; }
  .top-search { width: min(240px, 26vw); }
  .split { grid-template-columns: minmax(0, 1.4fr) minmax(250px, 1fr); }
}

@media (max-width: 899px) {
  :root { --topbar-h: 58px; }
  .topbar { padding: 0 14px; gap: 9px; }
  .brand-text small { display: none; }
  .brand-text b { font-size: 14px; max-width: 46vw; }
  /* 完整站名在手机顶栏必然截断成「网络在线教学与…」，改用短名更干净 */
  .brand-text .brand-full { display: none; }
  .brand-text .brand-short { display: block; font-size: 15px; max-width: none; }
  .top-search { display: none; }
  .user-chip .u-name { display: none; }
  .user-chip { padding: 4px; border: 0; background: transparent; }
  .sidebar { transform: translateX(-101%); transition: transform .25s ease; width: 262px; top: 0; z-index: 120; padding-top: 18px; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .drawer-mask { display: block; position: fixed; inset: 0; background: rgba(12,18,32,.45); z-index: 110; opacity: 0; pointer-events: none; transition: opacity .25s; }
  .drawer-mask.on { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid !important; }
  .main { margin-left: 0; padding: calc(var(--topbar-h) + 18px) 16px 92px; }
  .split, .split-even { grid-template-columns: minmax(0, 1fr); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* 宽表格在容器内横向滚动，显式告知用户可滑动，避免误以为内容被截断 */
  .table-hint { display: flex; }
  .hero { padding: 30px 26px; }
  .hero-stats { gap: 22px; }
  .hero-stats div b { font-size: 21px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(14px); border-top: 1px solid var(--line);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .bottom-nav button { flex: 1; border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; padding: 6px 2px; min-height: 50px; border-radius: 10px; }
  .bottom-nav button .ico { width: 20px; height: 20px; }
  .bottom-nav button.on { color: var(--brand); font-weight: 700; }
  .exam-bar { top: calc(var(--topbar-h) + 4px); }
}
.menu-btn { display: none; }

@media (max-width: 639px) {
  body { font-size: 13.5px; }
  .main { padding-left: 12px; padding-right: 12px; padding-bottom: 96px; }
  .card { padding: 16px; border-radius: 14px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 21px; }
  .g2, .g3, .g4, .g-auto, .g-auto-lg, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px; gap: 10px; }
  .stat-icon { width: 34px; height: 34px; border-radius: 10px; }
  .stat b { font-size: 19px; }
  .hero { padding: 26px 20px; border-radius: 18px; }
  .hero h1 { font-size: 24px; }
  .hero-stats { gap: 16px; margin-top: 22px; }
  .hero-stats div b { font-size: 18px; }
  .hero-stats div span { font-size: 11px; }
  .course-hero { flex-direction: column; align-items: stretch; padding: 16px; }
  .course-hero .cover { width: 100%; height: 120px; }
  .course-hero h1 { font-size: 18px; }
  .chapter-body { padding-left: 16px; }
  .tabs button { padding: 10px 12px; font-size: 12.5px; }
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: 100%; border-radius: 20px 20px 0 0; max-height: 90vh; }
  .modal-head { padding: 16px 18px; }
  .modal-body { padding: 18px; }
  .modal-foot { padding: 14px 18px; }
  .toast-box { top: calc(var(--topbar-h) + 8px); right: 12px; left: 12px; max-width: none; }
  .portal-hero { padding: 24px 20px; }
  .portal-section { padding: 18px; }
  .section-title { margin: 22px 0 12px; }
  .section-title h2 { font-size: 17px; }
  .btn { min-height: 36px; padding: 7px 13px; }
  .btn.lg { min-height: 44px; }
  .bars { height: 140px; }
  .ring { width: 88px; height: 88px; }
  .ring > span { font-size: 18px; }
  .ring > small { bottom: 15px; }
}

@media print {
  .topbar, .sidebar, .bottom-nav, .btn, .toast-box { display: none !important; }
  .main { margin: 0; padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
}
