/* 课堂 Kids 后台设计系统：参照 Untitled UI 的克制风格（白底、细边框、很淡的阴影、清楚的字号层级），
   加品牌点缀（橙色的“开始上课/接着上”、课型颜色和孩子大屏一致）。
   间距只用 8 像素体系：4 / 8 / 12 / 16 / 24 / 32 / 48（--s1 … --s7）。 */
:root {
  --bg: #F9FAFB;          /* 浅灰：悬停、标签、输入框底色（页面本身是白色） */
  --panel: #FFFFFF;
  --line: #EAECF0;
  --line-strong: #D0D5DD;
  --ink: #101828;
  --muted: #475467;
  --faint: #667085;
  --blue: #2457C5;
  --blue-hover: #1D4BAE;
  --blue-soft: #EFF4FF;
  --cta: #E8630A;         /* 品牌橙：开课这类最重要的动作 */
  --cta-hover: #C9540A;
  --green: #067647;
  --green-soft: #ECFDF3;
  --amber: #B54708;
  --amber-soft: #FFFAEB;
  --red: #D92D20;
  --red-soft: #FEF3F2;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --ring: 0 0 0 4px rgba(36, 87, 197, 0.16);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Noto Sans Khmer", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: #FFFFFF;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); }

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

/* ---------- 侧边栏 ---------- */
.sidebar {
  width: 240px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: var(--s5) var(--s4);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2) var(--s5); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: var(--blue) center / 22px no-repeat url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7.9 20A9 9 0 1 0 4 16.1L2 22Z'/%3E%3Cpath d='m12 7.5 1.3 2.7 2.9.4-2.1 2 .5 2.9-2.6-1.4-2.6 1.4.5-2.9-2.1-2 2.9-.4Z' fill='%23FFC845' stroke='%23FFC845' stroke-width='1'/%3E%3C/svg%3E");
  color: transparent; font-size: 0;
}
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.brand-sub { color: var(--faint); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: var(--s1); }
.nav-item {
  display: flex; align-items: center; gap: var(--s3);
  padding: var(--s2) var(--s3); border-radius: var(--radius-sm);
  text-decoration: none; color: #344054; font-weight: 600;
}
.nav-item svg { width: 20px; height: 20px; flex: none; color: var(--faint); }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item.is-active { background: var(--bg); color: var(--ink); }
.nav-item.is-active svg { color: var(--blue); }
.nav-item.is-disabled { opacity: 0.55; cursor: default; }
.nav-item.is-disabled:hover { background: none; color: #344054; }
.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: var(--s2); }

/* ---------- 主区域 ---------- */
.main { flex: 1; min-width: 0; padding: var(--s6) 40px var(--s7); max-width: 1320px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s6);
  padding-bottom: var(--s5); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 28px; font-weight: 600; letter-spacing: -0.2px; line-height: 1.25; }
.page-head p { margin: var(--s2) 0 0; color: var(--faint); font-size: 14px; }
.date-chip { color: var(--muted); font-size: 13px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: var(--s1) var(--s3); }

.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); margin-bottom: var(--s6); }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s5); display: flex; align-items: center; gap: var(--s4); box-shadow: var(--shadow);
}
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: #fff !important; border: 1px solid var(--line); box-shadow: var(--shadow); }
.stat-icon svg { width: 22px; height: 22px; }
.stat-num { font-size: 28px; font-weight: 600; line-height: 1.2; }
.stat-label { color: var(--faint); font-size: 13px; }

.section-title { display: flex; align-items: baseline; gap: var(--s3); margin: 0 0 var(--s4); }
.section-title h2 { margin: 0; font-size: 16px; font-weight: 600; }
.section-title span { color: var(--faint); font-size: 13px; }

/* ---------- 课型卡片 ---------- */
.class-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); }
.class-card {
  text-align: left; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s5); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: var(--s3); min-height: 160px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.class-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.class-top { display: flex; align-items: center; gap: var(--s3); }
.class-icon { width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: #fff !important; border: 1px solid var(--line); box-shadow: var(--shadow); }
.class-icon svg { width: 22px; height: 22px; }
.class-name { font-weight: 600; font-size: 16px; }
.class-skill { color: var(--faint); font-size: 13px; }
.pill { margin-left: auto; font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.pill-done { background: var(--green-soft); color: var(--green); border-color: #ABEFC6; }
.pill-todo { background: var(--bg); color: #344054; border-color: var(--line); }
.pill-warn { background: var(--amber-soft); color: var(--amber); border-color: #FEDF89; }
.class-desc { color: var(--muted); line-height: 1.65; flex: 1; }
.class-foot { display: flex; align-items: center; justify-content: space-between; color: var(--faint); font-size: 13px; }
.chev { width: 24px; height: 24px; display: grid; place-items: center; color: var(--faint); }
.class-card.is-placeholder { border-style: dashed; box-shadow: none; cursor: default; background: transparent; }
.class-card.is-placeholder:hover { border-color: var(--line); }

/* 每种课型一个颜色（和孩子大屏一致），图标是彩色线条、底是白色 */
.tone-listen { color: #E2662B; }
.tone-read { color: #2457C5; }
.tone-stroke { color: #079455; }
.tone-memory { color: #C11574; }
.tone-sentence { color: #B54708; }
.tone-spell { color: #6941C6; }
.tone-shadow { color: #0E7090; }
.tone-battle { color: #DC6803; }
.tone-plain { color: var(--faint); }

/* ---------- 按钮 ---------- */
.btn {
  height: 40px; padding: 0 var(--s4); border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--panel); color: #344054;
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  box-shadow: var(--shadow); white-space: nowrap; transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--bg); }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); }
.btn-cta { background: var(--cta); border-color: var(--cta); color: #fff; }
.btn-cta:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-lg { height: 48px; padding: 0 var(--s5); font-size: 16px; }
.btn-danger { color: var(--red); }
.btn-text { border: 0; background: none; box-shadow: none; height: auto; padding: var(--s1) var(--s2); color: var(--muted); }
.btn-text:hover { color: var(--ink); background: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.icon-btn { border: 0; background: none; cursor: pointer; width: 32px; height: 32px; border-radius: var(--radius-sm); color: var(--faint); }
.icon-btn:hover { background: var(--bg); color: var(--ink); }

/* ---------- 知识库 ---------- */
.drop {
  border: 1px dashed var(--line-strong); border-radius: var(--radius); background: var(--panel);
  padding: var(--s6); text-align: center; color: var(--faint); cursor: pointer; margin-bottom: var(--s6);
  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; font-weight: 600; display: block; margin: var(--s3) 0 var(--s1); }
.drop-icon { font-size: 28px; }
.drop.is-busy { pointer-events: none; opacity: 0.7; }

.tb-list { display: flex; flex-direction: column; gap: var(--s3); }
.tb-row {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: var(--s4) var(--s5); display: flex; align-items: center; gap: var(--s4); box-shadow: var(--shadow);
}
.tb-icon { width: 40px; height: 48px; border-radius: var(--radius-sm); 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: 600; font-size: 15px; }
.tb-meta { color: var(--faint); font-size: 13px; 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(--faint); padding: var(--s7) 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: var(--s5); align-items: start; }
.unit-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2); position: sticky; top: var(--s4); box-shadow: var(--shadow); }
.unit-item { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); border-radius: var(--radius-sm); 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: var(--s4) var(--s5); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: var(--s3); }
.editor-head input { flex: 1; font-size: 16px; font-weight: 600; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: var(--s2) var(--s3); }
.editor-section { padding: var(--s5); border-bottom: 1px solid var(--line); }
.editor-section h3 { margin: 0 0 var(--s3); font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: var(--s2); }
.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-strong); border-radius: var(--radius-sm); padding: var(--s2) var(--s3); }
.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: var(--s4) var(--s5); border-top: 1px solid var(--line); 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(52, 64, 84, 0.6); backdrop-filter: blur(4px); }
.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 24px -4px rgba(16, 24, 40, 0.08), 0 8px 8px -4px rgba(16, 24, 40, 0.03);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s5) var(--s5) var(--s3); }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 600; }
.modal-body { padding: var(--s1) var(--s5) var(--s4); overflow: auto; }
.modal-foot { padding: var(--s4) var(--s5) var(--s5); display: flex; justify-content: flex-end; gap: var(--s3); border-top: 1px solid var(--line); }
.unit-choice {
  display: flex; gap: var(--s3); align-items: flex-start; padding: var(--s3) var(--s4); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: var(--s2); 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: 600; }
.unit-choice-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.group-label { color: var(--faint); font-size: 13px; font-weight: 500; margin: var(--s4) 0 var(--s2); }
.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: var(--s4); }
.field label { color: #344054; font-size: 14px; font-weight: 500; }
.field input { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 16px; box-shadow: var(--shadow); background: #fff; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: #84ADFF; box-shadow: var(--shadow), var(--ring); }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0;
  background: #101828; color: #fff; padding: var(--s3) var(--s4); border-radius: var(--radius-sm); z-index: 60; box-shadow: var(--shadow-md);
  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: var(--s5) var(--s4); }
  .page-head h1 { font-size: 24px; }
  .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; padding: var(--s4); overflow: auto;
  background: radial-gradient(circle at 15% 10%, #EFF4FF 0, transparent 45%), radial-gradient(circle at 90% 90%, #FFF4EC 0, transparent 40%), #FFFFFF; }
.gate[hidden], .shell[hidden] { display: none; }
.gate-card { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 12px 16px -4px rgba(16, 24, 40, 0.08), 0 4px 6px -2px rgba(16, 24, 40, 0.03); padding: var(--s6); display: flex; flex-direction: column; }
.gate-card .brand { padding: 0 0 var(--s5); }
.gate-card h1 { margin: 0 0 var(--s5); font-size: 24px; font-weight: 600; }
.gate-card .field input { font-size: 15px; }
.gate-btn { width: 100%; height: 44px; font-size: 16px; margin-top: var(--s1); }
.gate-error { color: var(--red); min-height: 1.2em; margin: 0 0 6px; font-size: 13px; }
.gate-hint { color: var(--faint); font-size: 13px; margin: var(--s2) 0 var(--s3); line-height: 1.6; }
.field select { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 15px; background: #fff; box-shadow: var(--shadow); }

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

/* ---------- 列表页（班级、账号、机构） ---------- */
.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: var(--s3) var(--s4); background: var(--bg); border-bottom: 1px solid var(--line); white-space: nowrap; }
table.list td { padding: var(--s4); border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tbody tr:hover td { background: #FCFCFD; }
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); font-weight: 600; }
.faint { color: var(--faint); font-size: 13px; }
.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: var(--s2); }
.class-chip { display: flex; align-items: flex-start; gap: var(--s2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s2) var(--s3); 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: var(--s3) 40px; 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: var(--s4); }
.field-row .field { flex: 1; min-width: 0; }
.field textarea { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 14px; font: inherit; resize: vertical; box-shadow: var(--shadow); }
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; }

/* 课程语言 */
.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: var(--s2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: var(--s2) var(--s3); 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: var(--radius); padding: var(--s4); margin-top: var(--s3); }
.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(52, 64, 84, 0.6); backdrop-filter: blur(4px); }
.confirm-card { position: relative; background: var(--panel); border-radius: 16px; width: min(440px, calc(100vw - 32px)); padding: var(--s5); box-shadow: 0 20px 24px -4px rgba(16, 24, 40, 0.08); }
.confirm-card p { margin: 0 0 var(--s5); line-height: 1.6; font-size: 15px; }
.confirm-foot { display: flex; justify-content: flex-end; gap: var(--s3); }

/* 机构管理：管理员行、删除按钮、修改记录、试用勾选 */
.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: var(--s2); align-items: center; margin-bottom: var(--s4); }
.log-filter label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.log-filter input, .log-filter select { height: 40px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 0 var(--s3); background: #fff; box-shadow: var(--shadow); }
.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 { height: 32px; padding: 0 var(--s3); 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: var(--radius-sm); padding: var(--s3) var(--s4); margin-bottom: var(--s4); 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-strong); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow); }
.seg-btn { border: 0; border-right: 1px solid var(--line-strong); background: #fff; height: 40px; padding: 0 var(--s4); font: inherit; font-weight: 600; cursor: pointer; color: #344054; }
.seg-btn:last-child { border-right: 0; }
.seg-btn.is-on { background: var(--bg); color: var(--ink); }
.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: 240px; 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; } }

/* 线条图标 */
.ico { width: 20px; height: 20px; flex: none; }
.ico-inline { width: 16px; height: 16px; vertical-align: -3px; color: var(--faint); }
.drop-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); color: var(--muted); }
.drop-icon .ico { width: 24px; height: 24px; }
.drop-icon.is-bad { color: var(--red); }
.icon-btn { display: inline-grid; place-items: center; }
.icon-btn .ico { width: 18px; height: 18px; }

/* ---------- 互动课堂：班级优先 ---------- */
.cr-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: var(--s6); align-items: start; }
.class-row { display: flex; justify-content: space-between; align-items: center; gap: var(--s5);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: var(--s5); margin-bottom: var(--s4); }
.cr-title { display: flex; align-items: center; gap: var(--s2); font-size: 18px; }
.cr-title b { font-weight: 600; }
.cr-title .pill { margin-left: 0; }
.cr-meta { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); color: var(--faint); font-size: 13px; margin: var(--s2) 0 var(--s3); }
.cr-last { color: var(--muted); }
.cr-last b { color: var(--ink); font-weight: 600; }
.cr-actions { display: flex; flex-direction: column; gap: var(--s2); min-width: 168px; }
.warn-text { color: var(--amber); }
.empty-card { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: var(--s6); color: var(--faint); text-align: center; line-height: 1.7; }
.type-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s2); }
.type-row { width: 100%; display: flex; align-items: center; gap: var(--s3); padding: var(--s3); border: 0; border-radius: var(--radius-sm);
  background: none; text-align: left; cursor: pointer; font: inherit; color: inherit; }
.type-row:hover { background: var(--bg); }
.type-row .class-icon { width: 40px; height: 40px; }
.type-row .class-icon svg { width: 20px; height: 20px; }
.tr-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.tr-text b { font-weight: 600; }
.tr-text small { color: var(--faint); font-size: 13px; }
.tr-desc { color: var(--muted); font-size: 13px; margin-top: var(--s1); line-height: 1.6; }
.tr-n { color: var(--faint); font-size: 12px; white-space: nowrap; }
.tr-chev { width: 18px; height: 18px; color: var(--line-strong); }
.type-pick { display: flex; flex-direction: column; gap: var(--s1); }
.type-pick .type-row { border: 1px solid var(--line); align-items: flex-start; padding: var(--s4); }
@media (max-width: 1080px) { .cr-grid { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .class-row { flex-direction: column; align-items: stretch; } .cr-actions { min-width: 0; } }
table.list th:first-child, table.list td:first-child { padding-left: var(--s5); }
table.list th:last-child, table.list td:last-child { padding-right: var(--s5); }

/* ---------- 手机宽度：侧边栏变成顶部一条（品牌图标 + 可横向滑动的菜单 + 改密码/退出），表格横向滑动 ---------- */
@media (max-width: 720px) {
  .shell { flex-direction: column; }
  .sidebar { display: flex; flex-direction: row; align-items: center; gap: var(--s3); width: auto; height: auto;
    padding: var(--s2) var(--s4); border-right: 0; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; overflow-x: auto; }
  .brand { padding: 0; }
  .brand > div:last-child { display: none; }
  .nav { flex-direction: row; gap: var(--s1); }
  .nav-item { padding: var(--s2) var(--s3); white-space: nowrap; }
  .nav-item .soon { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; border: 0; padding: 0; white-space: nowrap; }
  .sidebar-foot .user-name, .sidebar-foot .user-role { display: none; }
  .sidebar-foot .user-actions { margin: 0; }
  table.list td, table.list th { white-space: nowrap; }
}

/* 登录页右上角的语言切换 */
.gate-lang { position: absolute; top: var(--s5); right: var(--s5); height: 36px; }
/* 英文的“Change password / Sign out”比中文长：放不下就换行，不挤成竖条 */
.user-actions { flex-wrap: wrap; row-gap: var(--s1); }
.user-actions .btn-text { white-space: nowrap; }
/* 平台：现场演示弹窗、体验线索 */
.copy-row { display: flex; gap: var(--s2); }
.copy-row input { flex: 1; }
.seg-btn .nav-badge { margin-left: 6px; display: inline-flex; vertical-align: middle; }
.seg-btn .nav-badge[hidden] { display: none; }
tr.lead-new td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
#demo-btn svg { width: 18px; height: 18px; }
/* 平台课程：单元内容（只读） */
.course-view { display: flex; flex-direction: column; gap: var(--s4); }
.course-unit { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s4) var(--s5); box-shadow: var(--shadow); }
.modal .course-unit { box-shadow: none; padding: var(--s3) var(--s4); margin-bottom: var(--s3); }
.course-unit h3 { margin: 0 0 var(--s3); font-size: 16px; }
.course-words { display: flex; flex-wrap: wrap; gap: var(--s2); }
.course-word { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 92px; padding: var(--s2); border: 1px solid var(--line); border-radius: var(--radius-sm); text-align: center; }
.course-word img { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; }
.course-emoji { font-size: 32px; line-height: 48px; }
.course-word b { font-size: 15px; }
.course-word small { color: var(--faint); font-size: 12px; }
.course-sents { margin: var(--s3) 0 0; padding-left: 20px; color: var(--muted); }
.course-try { display: flex; justify-content: flex-end; }
.row-actions { white-space: nowrap; }
.row-actions .btn + .btn { margin-left: var(--s1); }
/* 家长周报窗口 */
.rp-weeks { margin-bottom: var(--s3); }
.rp-sum { margin: 0 0 var(--s2); font-weight: 600; }
.rp-units { margin: 0 0 var(--s4); padding-left: 20px; }
.rp-units li { margin: var(--s1) 0; }
.rp-share { display: flex; gap: var(--s4); align-items: flex-start; }
.rp-qr { width: 160px; height: 160px; border: 1px solid var(--line); border-radius: var(--radius-sm); flex: none; }
.rp-share-text { flex: 1; min-width: 0; }
.rp-share-text textarea { width: 100%; resize: vertical; }
@media (max-width: 640px) { .rp-share { flex-direction: column; } }
/* 新手清单 */
.onboard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: var(--s5); margin-bottom: var(--s6); }
.onboard-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); margin-bottom: var(--s4); }
.onboard-head h2 { margin: 0; font-size: 18px; }
.onboard-head p { margin: var(--s1) 0 0; color: var(--muted); }
.onboard-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); }
.onboard-step { display: flex; flex-direction: column; gap: var(--s3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s4); }
.onboard-step > div b { display: block; margin-bottom: var(--s1); }
.onboard-step > div p { margin: 0; color: var(--muted); font-size: 14px; }
.onboard-step .btn { align-self: flex-start; margin-top: auto; }
.onboard-step.is-next { border-color: var(--blue); box-shadow: var(--ring); }
.onboard-step.is-done { background: var(--bg); }
.onboard-step.is-done b { color: var(--muted); text-decoration: line-through; }
.onboard-num { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700;
  background: var(--blue-soft); color: var(--blue); }
.onboard-num svg { width: 16px; height: 16px; }
.is-done .onboard-num { background: #ECFDF3; color: #067647; }
@media (max-width: 900px) { .onboard-steps { grid-template-columns: 1fr; } }
/* 右下角面板：这一页怎么用 */
.page-help { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: var(--s3); margin-bottom: var(--s4); background: var(--bg); }
.page-help summary { cursor: pointer; font-weight: 600; }
.page-help ol { margin: var(--s2) 0 var(--s2); padding-left: 20px; }
.page-help li { margin-bottom: var(--s1); font-size: 14px; }
.page-help-shot { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; }
/* 合规文件链接、同意步骤 */
.gate-legal { margin: var(--s3) 0 0; font-size: 13px; color: var(--faint); text-align: center; }
.gate-legal a, .user-legal a { color: var(--muted); }
.user-legal { margin-top: var(--s2); font-size: 12px; color: var(--faint); }
.legal-card { max-width: 480px; }
.legal-list { margin: var(--s2) 0 var(--s4); padding-left: 20px; }
.legal-list li { margin: var(--s1) 0; }
.legal-list a { color: var(--blue); font-weight: 600; }

/* 链接做成的按钮不要下划线 */
a.btn { text-decoration: none; }
