/* =============================================================
   ZSYF-KMS 前端样式 —— 浅色主题、后台/学员端共用
   ============================================================= */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #fafbfe;
  --ink: #1f2430;
  --ink-2: #5b6472;
  --ink-3: #8b94a3;
  --line: #e7eaf1;
  --line-2: #eef1f7;
  --brand: #2f6bff;
  --brand-d: #1f53d6;
  --brand-soft: #eaf1ff;
  --green: #18a058;
  --green-soft: #e7f6ee;
  --red: #e5484d;
  --red-soft: #fdecec;
  --orange: #f08c2e;
  --orange-soft: #fdf0e1;
  --purple: #7c5cff;
  --shadow: 0 6px 24px rgba(31, 36, 48, .08);
  --radius: 12px;
  --radius-s: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #cdd4e0; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #b6bfce; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.side {
  width: 232px; flex: 0 0 232px; background: var(--panel);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; z-index: 20;
}
.side .logo {
  height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 18px;
  border-bottom: 1px solid var(--line); font-weight: 700; font-size: 16px; color: var(--ink);
}
.side .logo .dot { width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--brand), var(--purple)); color: #fff; display: grid; place-items: center; font-size: 15px; }
.menu { flex: 1; overflow: auto; padding: 10px 8px; }
.menu .group { font-size: 12px; color: var(--ink-3); padding: 12px 12px 6px; }
.menu a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius-s);
  color: var(--ink-2); cursor: pointer; margin-bottom: 2px; font-size: 14px; user-select: none;
}
.menu a:hover { background: var(--panel-2); color: var(--ink); }
.menu a.active { background: var(--brand-soft); color: var(--brand-d); font-weight: 600; }
.menu a .ic { width: 18px; text-align: center; opacity: .85; }
.ic-svg { display: inline-block; vertical-align: middle; }
/* 子目录树选择 */
.tree { max-height: 62vh; overflow: auto; padding: 4px 0; }
.ts-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: var(--radius-s); }
.ts-row:hover { background: var(--panel-2); }
.ts-caret { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--ink-3); flex: 0 0 auto; }
.ts-caret.empty { visibility: hidden; }
.ts-caret svg { transition: transform .15s ease; }
.ts-caret.open svg { transform: rotate(90deg); }
.ts-cb { flex: 0 0 auto; width: 15px; height: 15px; accent-color: var(--brand); }
.ts-label { cursor: pointer; user-select: none; }
.ts-children.collapsed { display: none; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-s); overflow: hidden; }
.seg button { border: 0; background: var(--panel); color: var(--ink-2); padding: 6px 14px; cursor: pointer; font-size: 13px; }
.seg button.on { background: var(--brand); color: #fff; }
.menu a .sub { padding-left: 28px; font-size: 13px; }
.menu .child-wrap { margin-left: 0; }
.side .foot { padding: 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px; position: sticky; top: 0; z-index: 15;
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.topbar .who { text-align: right; line-height: 1.2; }
.topbar .who b { font-size: 13px; }
.topbar .who span { display: block; font-size: 11px; color: var(--ink-3); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-d); display: grid; place-items: center; font-weight: 700; }
.content { padding: 22px; flex: 1; }
.content.full { max-width: 1180px; margin: 0 auto; }

/* ---------- 卡片 ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .hd { padding: 14px 18px; border-bottom: 1px solid var(--line-2); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card .hd h3 { margin: 0; font-size: 15px; }
.card .bd { padding: 18px; }
.card .bd.tight { padding: 0; }

.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 760px) { .cols-4, .cols-3, .cols-2 { grid-template-columns: 1fr; } }

.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.stat .label { color: var(--ink-3); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.stat .num { font-size: 26px; font-weight: 800; margin-top: 6px; letter-spacing: .5px; }
.stat .sub { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.stat .pill { position: absolute; right: 14px; top: 14px; font-size: 18px; opacity: .12; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink); padding: 8px 14px; border-radius: var(--radius-s); cursor: pointer; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: #cdd4e0; background: var(--panel-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover { filter: brightness(.95); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn.xs { padding: 3px 9px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.field .req { color: var(--red); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; color: var(--ink); outline: none; transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { resize: vertical; min-height: 76px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { width: auto; }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.help-tip { font-size: 12px; color: var(--ink-3); }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th, .table td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line-2); }
.table th { color: var(--ink-3); font-weight: 600; background: var(--panel-2); position: sticky; top: 0; font-size: 12.5px; }
.table tbody tr:hover { background: var(--panel-2); }
.table .num { font-variant-numeric: tabular-nums; }
.table .ops { white-space: nowrap; display: flex; gap: 6px; }
.empty { padding: 44px; text-align: center; color: var(--ink-3); }

/* ---------- 标签 ---------- */
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }
.tag.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.tag.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.tag.orange { background: var(--orange-soft); color: var(--orange); border-color: transparent; }
.tag.blue { background: var(--brand-soft); color: var(--brand-d); border-color: transparent; }
.tag.purple { background: #f0ebff; color: var(--purple); border-color: transparent; }
.badge-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.badge-dot.on { background: var(--green); }
.badge-dot.off { background: var(--ink-3); }

/* ---------- 工具条 / 筛选 ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.search { position: relative; }
.search input { padding-left: 32px; }
.search .si { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 16px; }
.pager button { min-width: 34px; padding: 6px 10px; }
.pager .cur { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------- 模态 ---------- */
.mask { position: fixed; inset: 0; background: rgba(20, 26, 38, .42); display: none; align-items: flex-start; justify-content: center; z-index: 50; padding: 40px 16px; overflow: auto; }
.mask.show { display: flex; }
.modal { background: var(--panel); border-radius: var(--radius); box-shadow: 0 18px 60px rgba(0,0,0,.22); width: 100%; max-width: 620px; animation: pop .18s ease; }
.modal.wide { max-width: 900px; }
.modal.lg { max-width: 1040px; }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal .mhd { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal .mhd h3 { margin: 0; font-size: 16px; }
.modal .mbd { padding: 20px; max-height: 72vh; overflow: auto; }
.modal .mft { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.x { cursor: pointer; color: var(--ink-3); font-size: 20px; line-height: 1; border: none; background: none; }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 80; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--brand); padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); min-width: 240px; animation: slidein .2s; font-size: 13.5px; }
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.warn { border-left-color: var(--orange); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 登录 ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, #e8eefe, var(--bg)); padding: 20px; }
.auth .box { width: 380px; max-width: 100%; }
.auth .brand { text-align: center; margin-bottom: 22px; }
.auth .brand .dot { width: 54px; height: 54px; border-radius: 14px; background: linear-gradient(135deg, var(--brand), var(--purple)); color: #fff; display: inline-grid; place-items: center; font-size: 26px; box-shadow: var(--shadow); }
.auth .brand h2 { margin: 14px 0 4px; font-size: 20px; }
.auth .brand p { margin: 0; color: var(--ink-3); font-size: 13px; }

/* ---------- 上传 ---------- */
.upzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--ink-3); cursor: pointer; transition: .15s; background: var(--panel-2); }
.upzone:hover { border-color: var(--brand); color: var(--brand); }
.upzone.busy { pointer-events: none; }
.upfile { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-s); background: #fff; }
.upfile .bar { flex: 1; height: 6px; background: var(--line-2); border-radius: 4px; overflow: hidden; }
.upfile .bar i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }
.upfile .pct { font-size: 12px; color: var(--ink-2); width: 42px; text-align: right; }

/* ---------- 播放器/阅读器 ---------- */
.player { background: #0f1117; border-radius: var(--radius); overflow: hidden; }
.player video, .player audio { width: 100%; display: block; }
.player .wm { position: absolute; pointer-events: none; color: rgba(255,255,255,.7); font-size: 13px; text-shadow: 0 1px 3px #000; }
.reader { max-height: 60vh; overflow: auto; padding: 22px 26px; line-height: 1.9; font-size: 15px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.reader h4 { margin: 18px 0 8px; }
.reader .locked { color: var(--ink-3); background: repeating-linear-gradient(45deg, #f6f7fb, #f6f7fb 12px, #eef1f7 12px, #eef1f7 24px); padding: 16px; border-radius: 8px; text-align: center; margin-top: 14px; }
.reader .blk { transition: background .3s; }
.reader .blk.seen { background: rgba(47,107,255,.06); }

/* ---------- 封面 ---------- */
.cover { width: 64px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--line-2); display: inline-block; }
.cover.lg { width: 160px; height: 110px; }
.cover-text { width: 64px; height: 44px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-d); display: inline-grid; place-items: center; font-size: 11px; }

/* ---------- 杂项 ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.right-txt { text-align: right; }
.cnt { font-weight: 700; }
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap8 { gap: 8px; } .gap12 { gap: 12px; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb12 { margin-bottom: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; cursor: pointer; color: var(--ink-2); border-bottom: 2px solid transparent; font-size: 14px; }
.tabs a.active { color: var(--brand-d); border-bottom-color: var(--brand); font-weight: 600; }
.section-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.progress { height: 8px; background: var(--line-2); border-radius: 6px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--brand); }
.heatmap { display: flex; gap: 3px; align-items: flex-end; height: 60px; }
.heatmap i { flex: 1; background: var(--brand); border-radius: 2px 2px 0 0; min-height: 3px; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .hamb { display: inline-grid !important; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 18; display: none; }
  .scrim.show { display: block; }
  .content { padding: 14px; }
  .row2, .row3 { grid-template-columns: 1fr; }
}
.hamb { display: none; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font-size: 18px; }
