:root {
  --bg: #F6F7F9;
  --panel: #FFFFFF;
  --line: #E7EAF0;
  --ink: #1E2A3B;
  --muted: #6B778A;
  --faint: #9AA4B2;
  --blue: #2457C5;
  --blue-soft: #EAF0FC;
  --green: #22A06B;
  --green-soft: #E6F6EE;
  --amber: #C27A00;
  --amber-soft: #FFF4DE;
  --red: #D64545;
  --red-soft: #FDECEC;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 42, 59, 0.05), 0 4px 16px rgba(30, 42, 59, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

.shell { display: flex; min-height: 100vh; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 216px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--blue); color: #fff; font-weight: 800;
  display: grid; place-items: center;
}
.brand-name { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 10px;
  text-decoration: none; color: var(--muted); font-weight: 600;
}
.nav-item svg { width: 18px; height: 18px; flex: none; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.is-active { background: var(--green-soft); color: var(--green); }
.nav-item.is-disabled { opacity: 0.55; cursor: default; }
.nav-item.is-disabled:hover { background: none; color: var(--muted); }
.soon { margin-left: auto; font-size: 11px; font-weight: 500; color: var(--faint); }
.sidebar-foot { margin-top: auto; color: var(--faint); font-size: 12px; padding: 8px; }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; padding: 22px 28px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.date-chip { color: var(--muted); font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow);
}
.stat-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; }
.stat-num { font-size: 22px; font-weight: 800; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 12px; }

.section-title { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.section-title h2 { margin: 0; font-size: 15px; }
.section-title span { color: var(--faint); font-size: 12px; }

/* ---------- 课型卡片 ---------- */
.class-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.class-card {
  text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 8px; min-height: 150px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.class-card:hover { border-color: #C9D3E6; transform: translateY(-2px); }
.class-card:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.class-top { display: flex; align-items: center; gap: 10px; }
.class-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex: none; }
.class-name { font-weight: 700; font-size: 15px; }
.class-skill { color: var(--muted); font-size: 12px; }
.pill { margin-left: auto; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; }
.pill-done { background: var(--green-soft); color: var(--green); }
.pill-todo { background: var(--bg); color: var(--faint); }
.pill-warn { background: var(--amber-soft); color: var(--amber); }
.class-desc { color: var(--muted); line-height: 1.6; flex: 1; }
.class-foot { display: flex; align-items: center; justify-content: space-between; color: var(--faint); font-size: 12px; }
.chev { width: 22px; height: 22px; border-radius: 50%; background: var(--bg); display: grid; place-items: center; color: var(--muted); }
.class-card.is-placeholder { border-style: dashed; box-shadow: none; cursor: default; background: transparent; }
.class-card.is-placeholder:hover { transform: none; border-color: var(--line); }

/* 每种课型一个颜色 */
.tone-listen { background: #FFEFE5; color: #E2662B; }
.tone-read { background: #EAF0FC; color: #2457C5; }
.tone-stroke { background: #E6F6EE; color: #22A06B; }
.tone-memory { background: #F2ECFC; color: #7A4FC9; }
.tone-sentence { background: #FFF4DE; color: #C27A00; }
.tone-plain { background: var(--bg); color: var(--faint); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid transparent; border-radius: 10px; padding: 8px 14px;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border-color: var(--line);
}
.btn:hover { border-color: #C9D3E6; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: #1D4BAE; border-color: #1D4BAE; }
.btn-danger { color: var(--red); }
.btn-text { border: 0; background: none; padding: 6px 8px; color: var(--muted); }
.btn-text:hover { color: var(--ink); }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { border: 0; background: none; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; color: var(--muted); }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ---------- 知识库 ---------- */
.drop {
  border: 2px dashed #C9D3E6; border-radius: var(--radius); background: var(--panel);
  padding: 26px; text-align: center; color: var(--muted); cursor: pointer; margin-bottom: 22px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drop:hover, .drop.is-over { border-color: var(--blue); background: var(--blue-soft); }
.drop strong { color: var(--ink); font-size: 15px; display: block; margin: 8px 0 4px; }
.drop-icon { font-size: 28px; }
.drop.is-busy { pointer-events: none; opacity: 0.7; }

.tb-list { display: flex; flex-direction: column; gap: 10px; }
.tb-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow);
}
.tb-icon { width: 40px; height: 48px; border-radius: 6px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 800; flex: none; }
.tb-info { flex: 1; min-width: 0; }
.tb-title { font-weight: 700; font-size: 15px; }
.tb-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.progress { height: 6px; border-radius: 999px; background: var(--bg); overflow: hidden; margin-top: 8px; max-width: 280px; }
.progress span { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

/* ---------- 备课页 ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; margin-bottom: 10px; }
.back:hover { color: var(--ink); }
.tb-title-input { font-size: 20px; font-weight: 700; border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; margin-left: -6px; background: transparent; width: min(560px, 100%); }
.tb-title-input:hover, .tb-title-input:focus { border-color: var(--line); background: var(--panel); outline: none; }
.prep { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.unit-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; position: sticky; top: 16px; }
.unit-item { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-radius: 10px; text-decoration: none; }
.unit-item:hover { background: var(--bg); }
.unit-item.is-active { background: var(--blue-soft); }
.unit-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.editor { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.editor-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.editor-head input { flex: 1; font-size: 16px; font-weight: 700; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.editor-section { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.editor-section h3 { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.editor-section h3 small { color: var(--faint); font-weight: 400; }

.words { width: 100%; border-collapse: collapse; }
.words th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; padding: 0 6px 6px; }
.words td { padding: 4px 6px; border-top: 1px solid var(--line); vertical-align: middle; }
.words tr.is-off td:not(:first-child) { opacity: 0.45; }
.words input[type=text] { width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; background: transparent; }
.words input[type=text]:hover, .words input[type=text]:focus { border-color: var(--line); background: #fff; outline: none; }
.words .hanzi-in { font-size: 16px; font-weight: 700; }
.pic-btn {
  width: 40px; height: 40px; border-radius: 10px; border: 1px dashed #C9D3E6; background: var(--bg);
  cursor: pointer; display: grid; place-items: center; font-size: 22px; overflow: hidden; padding: 0;
}
.pic-btn img { width: 100%; height: 100%; object-fit: contain; }
.pic-btn.has-pic { border-style: solid; border-color: var(--line); background: #fff; }
.add-row { margin-top: 8px; }
.sentences { display: flex; flex-direction: column; gap: 6px; }
.sentence-row { display: flex; align-items: center; gap: 8px; }
.sentence-row input[type=text] { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
.sentence-row.is-off input[type=text] { opacity: 0.45; }
details.source summary { cursor: pointer; color: var(--muted); }
details.source pre { white-space: pre-wrap; background: var(--bg); border-radius: 10px; padding: 12px; max-height: 320px; overflow: auto; font-family: inherit; color: var(--muted); }
.editor-foot { padding: 14px 18px; display: flex; align-items: center; gap: 10px; justify-content: flex-end; position: sticky; bottom: 0; background: var(--panel); border-radius: 0 0 var(--radius) var(--radius); }
.editor-foot .hint { margin-right: auto; color: var(--muted); font-size: 12px; }
.dirty { color: var(--amber); }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20, 28, 40, 0.38); }
.modal-card {
  position: relative; background: var(--panel); border-radius: 16px; width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 48px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(20, 28, 40, 0.25);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 8px; }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 4px 18px 12px; overflow: auto; }
.modal-foot { padding: 12px 18px 16px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line); }
.unit-choice {
  display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 12px; margin-bottom: 8px; cursor: pointer;
}
.unit-choice:hover { border-color: #C9D3E6; }
.unit-choice.is-selected { border-color: var(--blue); background: var(--blue-soft); }
.unit-choice.is-disabled { opacity: 0.5; cursor: default; }
.unit-choice input { margin-top: 4px; }
.unit-choice-title { font-weight: 700; }
.unit-choice-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.group-label { color: var(--faint); font-size: 12px; margin: 10px 0 6px; }
.pic-preview { width: 120px; height: 120px; border-radius: 16px; background: var(--bg); display: grid; place-items: center; font-size: 64px; margin: 4px auto 14px; overflow: hidden; }
.pic-preview img { width: 100%; height: 100%; object-fit: contain; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 12px; }
.field input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 18px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0;
  background: #1E2A3B; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 60;
  transition: opacity 0.2s ease, transform 0.2s ease; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--red); }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255, 255, 255, 0.5); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 960px) {
  .class-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prep { grid-template-columns: 1fr; }
  .unit-list { position: static; }
}
@media (max-width: 720px) {
  .sidebar { display: none; }
  .main { padding: 16px; }
  .stats, .class-grid { grid-template-columns: 1fr; }
}

/* ---------- 扫描版教材：页面缩略图、看大图、框选插图 ---------- */
.page-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.page-thumb { flex: none; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 4px 4px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--muted); font-size: 12px; }
.page-thumb:hover { border-color: var(--blue); }
.page-thumb img { width: 84px; height: 118px; object-fit: cover; border-radius: 6px; }
.modal-card.is-wide { width: min(980px, calc(100vw - 32px)); }
.page-full { display: block; max-width: 100%; max-height: 72vh; margin: 0 auto; border-radius: 8px; }
.crop-pages { display: flex; gap: 6px; flex-wrap: wrap; }
.crop-stage { position: relative; overflow: hidden; display: flex; justify-content: center; user-select: none; touch-action: none; cursor: crosshair; background: var(--bg); border-radius: 10px; padding: 8px; }
.crop-stage img { max-width: 100%; max-height: 62vh; display: block; pointer-events: none; }
.crop-box { position: absolute; border: 3px solid var(--blue); background: rgba(36, 87, 197, 0.12); border-radius: 4px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(20, 28, 40, 0.25); }
/* 网格里的内容不能把列撑宽（缩略图条要在自己里面横向滚动） */
.prep > * { min-width: 0; }

/* ---------- 登录页 ---------- */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); padding: 16px; overflow: auto; }
.gate[hidden], .shell[hidden] { display: none; }
.gate-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 26px 26px 20px; display: flex; flex-direction: column; }
.gate-card .brand { padding: 0 0 14px; }
.gate-card h1 { margin: 0 0 14px; font-size: 20px; }
.gate-card .field input { font-size: 15px; }
.gate-btn { justify-content: center; padding: 10px; font-size: 15px; margin-top: 4px; }
.gate-error { color: var(--red); min-height: 1.2em; margin: 0 0 6px; font-size: 13px; }
.gate-hint { color: var(--muted); font-size: 12px; margin: 6px 0 10px; line-height: 1.6; }
.field select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 15px; background: #fff; }

/* ---------- 侧边栏底部的账号信息 ---------- */
.sidebar-foot { border-top: 1px solid var(--line); padding: 12px 8px 4px; }
.user-name { font-weight: 700; color: var(--ink); font-size: 13px; }
.user-role { color: var(--faint); font-size: 12px; margin-top: 2px; word-break: break-all; }
.user-actions { display: flex; gap: 10px; margin-top: 6px; }
.user-actions .btn-text { border: 0; background: none; padding: 0; color: var(--blue); cursor: pointer; font-size: 12px; }

/* ---------- 列表页（班级、账号、机构） ---------- */
.table-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; min-width: 640px; }
table.list th { text-align: left; color: var(--faint); font-weight: 500; font-size: 12px; padding: 12px 14px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.is-off td { color: var(--faint); }
.row-actions { text-align: right; white-space: nowrap; }
.row-actions .btn-text { color: var(--blue); }
.faint { color: var(--faint); font-size: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.check { display: inline-flex; align-items: center; gap: 6px; }

/* 临时密码 */
.secret { background: var(--bg); border-radius: 12px; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.secret div { display: flex; gap: 12px; align-items: baseline; }
.secret span { color: var(--muted); width: 70px; font-size: 13px; }
.secret b { font-size: 20px; letter-spacing: 0.04em; font-family: Consolas, "SFMono-Regular", monospace; }

/* 开课时选班级 */
.class-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.class-chip { display: flex; align-items: flex-start; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.class-chip:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.class-chip input { margin-top: 3px; }
.class-chip span { display: flex; flex-direction: column; }
.class-chip small { color: var(--muted); font-size: 12px; }
.group-sub { color: var(--muted); font-size: 12px; margin: 6px 0 4px; }

/* ---------- P1：授权提醒、设备、学生名单 ---------- */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.license-bar { padding: 10px 28px; font-weight: 600; font-size: 13px; }
.license-bar[hidden] { display: none; }
.license-bar.is-warn { background: var(--amber-soft); color: var(--amber); }
.license-bar.is-bad { background: var(--red-soft); color: var(--red); }
.pill-bad { background: var(--red-soft); color: var(--red); }
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; min-width: 0; }
.field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; resize: vertical; }
table.list.compact th, table.list.compact td { padding: 6px 8px; font-size: 12px; }
table.list .center { text-align: center; }
.cell-in { width: 100%; min-width: 80px; border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; background: transparent; }
.cell-in:hover, .cell-in:focus { border-color: var(--line); background: #fff; outline: none; }
.push-note { margin: 8px 0 4px; color: var(--muted); font-size: 13px; }

/* 课程语言 */
.tone-spell { background: #F1EAFD; color: #7A4BD0; }
.tone-shadow { background: #E3F5F7; color: #0F8A97; }
.lang-tag { display: inline-block; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 6px; border-radius: 6px; vertical-align: 1px; }
.lang-tag.lang-zh { background: #FDECEC; color: #C23B3B; }
.lang-tag.lang-en { background: #EAF0FC; color: var(--blue); }
.pill-info { background: var(--blue-soft); color: var(--blue); }
.license-bar.is-info { background: var(--blue-soft); color: var(--blue); }
.lang-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-weight: 600; }
.lang-pick > span { color: var(--faint); font-size: 13px; }
.lang-opt { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; cursor: pointer; background: #fff; }
.lang-opt:has(input:checked) { border-color: var(--blue); background: var(--blue-soft); }
.lang-opt small { font-size: 11px; color: var(--amber); font-weight: 700; }
.trial-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 12px; }
.trial-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.trial-card p { margin: 6px 0 10px; font-size: 13px; }
.trial-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trial-actions input { width: 64px; }

/* 应用内确认框（代替浏览器自带的 confirm） */
.confirm { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; }
.confirm-backdrop { position: absolute; inset: 0; background: rgba(20, 28, 40, 0.38); }
.confirm-card { position: relative; background: var(--panel); border-radius: 14px; width: min(440px, calc(100vw - 32px)); padding: 18px 18px 14px; box-shadow: 0 20px 60px rgba(20, 28, 40, 0.3); }
.confirm-card p { margin: 0 0 14px; line-height: 1.6; }
.confirm-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* 机构管理：管理员行、删除按钮、修改记录、试用勾选 */
.admin-line { white-space: nowrap; }
.btn-text-danger { color: var(--red); }
.edit-log { white-space: pre-wrap; font: inherit; font-size: 12px; color: var(--faint); background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 0; }
.trial-give { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.trial-give input[type="number"] { width: 64px; }
.row-actions .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
#org-table td:first-child { min-width: 120px; }
#org-table td:nth-child(3), #org-table td:nth-child(4) { white-space: nowrap; }

/* 审批：菜单上的待审批数、顶部提醒、日志筛选 */
.nav-badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff;
  font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.nav-badge[hidden] { display: none; }
.license-bar.is-link a { color: inherit; font-weight: 700; margin-left: 6px; }
.ap-done { margin: 10px 0 4px; }
.ap-done summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.log-filter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.log-filter label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.log-filter input, .log-filter select { height: 34px; }
.log-filter #lf-q { flex: 1; min-width: 180px; }
.log-list .nowrap, .list .nowrap { white-space: nowrap; }
.log-list tr.is-bad td { color: var(--red); }
.log-detail { font-size: 12.5px; color: var(--muted); max-width: 360px; }
.log-more { display: flex; justify-content: center; margin: 10px 0 24px; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn[hidden] { display: none; }

/* 自带平板加入、名额申请 */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.join-box { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.join-qr { width: 200px; height: 200px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.join-code { font-size: 36px; font-weight: 800; letter-spacing: 0.12em; color: var(--blue); font-variant-numeric: tabular-nums; }
.join-box > div { flex: 1; min-width: 220px; }
.note-bar { border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; font-weight: 600; font-size: 13px; }
.note-bar.is-warn { background: var(--amber-soft); color: var(--amber); }

[hidden] { display: none !important; }
.note-bar .btn-sm { margin-left: 6px; }

/* 申诉 · 联系我们：右下角按钮和面板 */
.help-fab { position: fixed; right: 20px; bottom: 20px; z-index: 40; display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px; border: 0; border-radius: 999px; background: var(--blue); color: #fff; font: inherit; font-weight: 700;
  box-shadow: 0 8px 24px rgba(36, 87, 197, 0.35); cursor: pointer; }
.help-fab svg { width: 18px; height: 18px; }
.fab-dot { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 12px;
  display: inline-flex; align-items: center; justify-content: center; }
.help-panel { position: fixed; right: 20px; bottom: 78px; z-index: 41; width: min(400px, calc(100vw - 24px)); max-height: min(640px, calc(100vh - 110px));
  display: flex; flex-direction: column; background: var(--panel); border-radius: 16px; box-shadow: 0 20px 60px rgba(20, 28, 40, 0.28); overflow: hidden; }
.help-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.help-head b { flex: 1; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.help-body { padding: 12px 14px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.help-body .faint { margin: 0; font-size: 13px; }
.help-body textarea, #modal textarea { width: 100%; box-sizing: border-box; font: inherit; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; resize: vertical; }
.help-new { align-self: flex-start; }
.help-list { display: flex; flex-direction: column; gap: 8px; }
.help-item { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; background: #fff; font: inherit; cursor: pointer; }
.help-item:hover { border-color: var(--blue); }
.help-item-top { display: flex; align-items: center; gap: 6px; width: 100%; }
.dot-new { width: 8px; height: 8px; border-radius: 50%; background: var(--red); flex: none; }
.help-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chat { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; padding: 4px 2px; margin: 8px 0; }
.bubble { max-width: 85%; border-radius: 12px; padding: 8px 10px; }
.bubble.is-mine { align-self: flex-end; background: var(--blue-soft); }
.bubble.is-other { align-self: flex-start; background: var(--bg); }
.bubble-meta { font-size: 11.5px; color: var(--faint); margin-bottom: 2px; }
.bubble-text { white-space: pre-wrap; word-break: break-word; line-height: 1.55; }
/* 平台：客户消息列表 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg-btn { border: 0; background: #fff; padding: 7px 12px; font: inherit; cursor: pointer; color: var(--muted); }
.seg-btn.is-on { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.click-row { cursor: pointer; }
.click-row:hover td { background: var(--bg); }
.click-row.is-waiting td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

/* ---------- 共享图库 ---------- */
.lib-drop { border: 2px dashed var(--line); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; background: var(--card, #fff); margin-bottom: 16px; }
.lib-drop.is-over { border-color: var(--blue, #2457C5); background: #EAF0FC; }
.lib-drop span { color: var(--faint, #6B778A); font-size: 13px; }
.lib-drop code { background: #F1F3F7; padding: 1px 6px; border-radius: 6px; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.lib-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.lib-img { aspect-ratio: 1 / 1; display: grid; place-items: center; background: #F7F8FA; border-radius: 8px; overflow: hidden; }
.lib-img img { width: 100%; height: 100%; object-fit: contain; }
.lib-words { font-size: 14px; } .lib-words span { color: var(--faint, #6B778A); }
.lib-alias { font-size: 12px; }
.lib-actions { display: flex; gap: 6px; }
.lib-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-pick { width: 72px; height: 72px; padding: 4px; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.lib-pick img { width: 100%; height: 100%; object-fit: contain; }
.lib-pick.is-on { border-color: var(--blue, #2457C5); box-shadow: 0 0 0 3px #EAF0FC; }

/* 右下角“申诉 · 联系我们”按钮不压住任何东西：它坐在页面最下面一条底栏里，页面内容、备课页按钮栏、提示都停在底栏上面 */
.help-dock { position: fixed; left: 216px; right: 0; bottom: 0; height: 60px; z-index: 39; background: var(--bg); border-top: 1px solid var(--line); }
body.has-help .help-fab { bottom: 9px; }
body.has-help .help-panel { bottom: 70px; max-height: min(640px, calc(100vh - 100px)); }
body.has-help .main { padding-bottom: 84px; }
body.has-help .editor-foot { bottom: 60px; }
body.has-help .toast { bottom: 76px; }
@media (max-width: 720px) { .help-dock { left: 0; } }
