:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --primary: #2f6fed;
  --primary-d: #1f56c4;
  --text: #1f2a3d;
  --muted: #6b7785;
  --line: #e4e9f0;
  --ok: #1f9d55;
  --warn: #e08a00;
  --danger: #d8453b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }

/* 开关 toggle */
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: #cbd3df; border-radius: 24px; transition: .2s; }
.switch .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2f6fed, #6aa0ff); }
.login-card { background: #fff; padding: 36px 32px; border-radius: 14px; width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,.18); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 13px; }
.login-card input { width: 100%; padding: 11px 12px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.login-card button { width: 100%; padding: 12px; background: var(--primary); color: #fff; border: 0; border-radius: 8px; font-size: 15px; cursor: pointer; }
.login-card button:hover { background: var(--primary-d); }
.login-card .err { color: var(--danger); min-height: 18px; font-size: 13px; margin: 8px 0 0; }
.login-card .hint { color: var(--muted); font-size: 12px; margin-top: 14px; }

/* 框架 */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #1f2a3d; color: #cdd6e4; display: flex; flex-direction: column; }
.sidebar .logo { padding: 18px 20px; font-weight: 700; font-size: 16px; color: #fff; border-bottom: 1px solid #2c3a52; }
.sidebar nav { flex: 1; padding: 10px 0; }
.sidebar nav a { display: block; padding: 11px 20px; color: #b9c4d6; cursor: pointer; font-size: 14px; border-left: 3px solid transparent; }
.sidebar nav a:hover { background: #28354b; color: #fff; }
.sidebar nav a.active { background: #28354b; color: #fff; border-left-color: var(--primary); }
.sidebar .me { padding: 14px 20px; border-top: 1px solid #2c3a52; font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.sidebar .me button { background: transparent; border: 1px solid #44546e; color: #cdd6e4; border-radius: 6px; padding: 4px 10px; cursor: pointer; }

.main { flex: 1; padding: 24px 28px; overflow: auto; }
.main header { font-size: 20px; font-weight: 700; margin-bottom: 18px; }

/* 卡片 / 表格 */
.cards { display: flex; flex-wrap: wrap; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; min-width: 130px; flex: 1; }
.card .num { font-size: 26px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 14px; font-size: 15px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; background: #fafbfc; }
tr:hover td { background: #f9fbff; }
.wk-edit th:first-child, .wk-edit td:first-child { width: 92px; }
.wk-edit input[type=time] { width: 132px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.wk-edit td { vertical-align: middle; }

button.btn { background: var(--primary); color: #fff; border: 0; border-radius: 7px; padding: 8px 14px; cursor: pointer; font-size: 13px; }
button.btn:hover { background: var(--primary-d); }
button.btn.sm { padding: 5px 10px; font-size: 12px; }
button.ghost { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
button.danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
input, select, textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; font-family: inherit; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.row > * { margin-bottom: 0; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #eef3ff; color: var(--primary); }
.tag.s0 { background: #eef3ff; color: var(--primary); }
.tag.s1 { background: #f0f0f0; color: #888; }
.tag.s2 { background: #fff3e0; color: var(--warn); }
.tag.s3 { background: #e8f5ee; color: var(--ok); }
.tag.s4 { background: #e6f7ec; color: var(--ok); }
.pager { color: var(--muted); font-size: 12px; margin-top: 8px; }
.toast { position: fixed; top: 20px; right: 20px; background: #1f2a3d; color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13px; z-index: 99; opacity: 0; transition: .25s; }
.toast.show { opacity: 1; }
.toast.err { background: var(--danger); }
.toast.ok { background: var(--ok); }
.muted { color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media(max-width:900px){ .split{ grid-template-columns:1fr; } }
/* 老师管理：上下两张卡片（添加 / 列表）改为整屏纵向堆叠，各自占满宽度 */
.stack-v { display: flex; flex-direction: column; gap: 18px; }

/* 老师表单字段标签 & 复选组 & 编辑弹层 */
.flabel { min-width: 64px; color: var(--muted); font-size: 13px; display: inline-flex; align-items: center; }
/* 协议管理：协议正文多行编辑器（纯文本，\n 分段） */
.ag-area { flex: 1; min-width: 0; min-height: 480px; padding: 12px 14px; font-size: 13px; line-height: 1.8; resize: vertical; white-space: pre-wrap; word-break: break-word; }
.price-grid { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 6px 0; }
.price-grid .pg-title { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.price-grid .pg-row { display: flex; align-items: flex-start; flex-wrap: nowrap; gap: 10px; margin-bottom: 6px; }
.price-grid .pg-h { font-size: 13px; font-weight: 600; min-width: 84px; }
.price-grid .pg-cell { display: inline-flex; flex-direction: column; font-size: 12px; color: var(--muted); }
.price-grid .pg-cell input { width: 84px; margin-top: 3px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; }
.td-price { font-variant-numeric: tabular-nums; font-weight: 600; color: #2563eb; white-space: nowrap; }
.ro-val { font-size: 13px; color: var(--text); font-family: ui-monospace, Menlo, Consolas, monospace; }
.chk-group { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.chk-group label { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text); cursor: pointer; }
/* 老师可教课程：大类→课程 树形勾选 */
.tree { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tree-branch { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.tree-parent { font-weight: 600; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.tree-leaves { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 6px 0 0 24px; }
.tree-leaf { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); cursor: pointer; }
.tree-leaf input, .tree-parent input { cursor: pointer; }
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; z-index: 80; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 12px; padding: 22px 24px; width: 720px; max-width: 92vw; max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-box h3 { margin: 0 0 16px; font-size: 16px; }
.td-intro { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.td-courses { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 课件选择弹层（EEO 云盘） */
.cw-disp { font-size: 13px; color: var(--primary); align-self: center; }
.cw-path { font-size: 13px; color: var(--text); background: #f3f6fb; padding: 4px 10px; border-radius: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.cw-panes { display: flex; gap: 12px; margin-bottom: 10px; }
.cw-pane { flex: 1 1 0; min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #fafbfc; display: flex; flex-direction: column; max-height: 360px; }
.cw-pane-t { font-size: 12px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f3f6fb; border-radius: 8px 8px 0 0; }
.cw-tree, .cw-files { overflow: auto; padding: 6px; flex: 1; }
.cw-node { user-select: none; }
.cw-node-row { display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-radius: 6px; font-size: 13px; line-height: 1.3; }
.cw-node-row:hover { background: #f0f4fb; }
.cw-node-row.sel { background: #e3ecff; }
.cw-arrow { width: 16px; text-align: center; cursor: pointer; color: var(--muted); flex: 0 0 auto; }
.cw-arrow:hover { color: var(--primary); }
.cw-node-name { cursor: pointer; color: var(--text); flex: 1; }
.cw-node-name:hover { color: var(--primary); }
.cw-children.hidden { display: none; }
.cw-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; font-size: 13px; }
.cw-item:hover { background: #f3f6fb; }
.cw-file { cursor: pointer; }
.cw-file input { margin: 0; }
.cw-size { margin-left: auto; color: var(--muted); font-size: 12px; }

/* ===== 课程弹层：多选老师 / 封面 / 图文 ===== */
.chkbox { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.chkbox .cb { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); cursor: pointer; }
.stu-chk { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text); cursor: pointer; padding: 2px 6px; border: 1px solid #e5e9f2; border-radius: 6px; }
.cover-prev { max-width: 160px; max-height: 120px; border-radius: 8px; margin-top: 8px; border: 1px solid var(--line); }

/* ===== 老师头像上传 ===== */
.avatar-upload { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.avatar-prev { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); background: #f3f4f6; }
.avatar-btns { display: flex; gap: 8px; align-items: center; }
.t-list-ava { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: inline-block; }
.t-list-ava.ph { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px; background: #f3f4f6; }
.rte { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; background: #f6f7f9; border-bottom: 1px solid var(--line); }
.rte-btn { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; line-height: 28px; }
.rte-btn:hover { background: #eef2ff; border-color: #c7d2fe; }
.rte-area { min-height: 160px; max-height: 360px; overflow-y: auto; padding: 10px 12px; font-size: 14px; line-height: 1.7; outline: none; }
.rte-area:empty::before { content: attr(data-ph); color: #9aa0a6; }
.rte-area img { max-width: 100%; height: auto; border-radius: 6px; margin: 4px 0; }
.rte-area p { margin: 0 0 8px; }
.cb-block { position: relative; display: inline-block; margin: 6px 10px 6px 0; vertical-align: top; }
.cb-img { max-width: 200px; max-height: 140px; border-radius: 8px; border: 1px solid var(--line); display: block; }
.cb-text { width: 320px; min-height: 64px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 13px; font-family: inherit; resize: vertical; display: block; }
.cb-del { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; line-height: 20px; text-align: center; border-radius: 50%; background: #ef4444; color: #fff; border: none; cursor: pointer; font-size: 14px; }
.cb-del:hover { background: #dc2626; }
.cw-selected { font-size: 13px; color: var(--text); min-height: 18px; line-height: 1.5; }
.cw-none { color: var(--muted); }
.cw-hint { color: var(--muted); font-size: 12px; margin: 8px 0; line-height: 1.5; }
.cw-empty { color: var(--muted); font-size: 13px; padding: 10px; }
.cw-empty.err { color: var(--danger); }
