:root {
  --sidebar-width: 280px;
  --bg: #f3f4f6;
  --sidebar-bg: #0f172a;        /* dark brand color — reused as fg elsewhere (buttons, headings, clock) */
  --sidebar-surface: #e8f1fb;   /* the actual sidebar panel background (light blue) */
  --sidebar-hover: rgba(14, 165, 233, 0.10);
  --sidebar-text: #1e293b;
  --sidebar-text-muted: #64748b;
  --sidebar-line: rgba(15, 23, 42, 0.08);
  --sidebar-overlay: rgba(15, 23, 42, 0.04);
  --accent: #6366f1;
  --accent-light: #c7d2fe;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
  --radius: 16px;
  --border-width: 1px;

  /* ── Typography Scale ── */
  --text-xs:   11px;   /* meta、timestamp、badge label */
  --text-sm:   13px;   /* table cell、副标题、input */
  --text-base: 14px;   /* 正文、nav item */
  --text-md:   16px;   /* card 标题 */
  --text-lg:   20px;   /* section 标题 */
  --text-xl:   24px;   /* page 标题 */
  --text-2xl:  32px;   /* stat 大数字 */

  /* ── Font Weights ── */
  --fw-normal:  500;
  --fw-semi:    600;
  --fw-bold:    700;
  --fw-black:   800;
  --fw-900:     900;

  /* ── Spacing Scale ── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;

  /* ── Badge / Pill ── */
  --badge-radius: 6px;
  --badge-px: 8px;
  --badge-py: 3px;
  --badge-fs: var(--text-xs);
  --badge-fw: var(--fw-black);
}

/* ======================================================================
   共用部件（ui-）— 学员档案、学生权限管理、课堂排班等页共用，改这里各页一起变
   · 颜色 token、按钮、状态小标签、双语主标签。JS 端的配套在 js/ui-kit.js（UIKit / UI_ICONS）。
   · 双语：Jonas 默认语言是「双语」，t() 拼成「中文 (English)」长度翻倍；页面模板用
     UIKit.txt(this)：t() 输出 .ui-t（中文一行 + .ui-en 英文小字一行），C() 小标注单语。
   ====================================================================== */
:root {
  --ui-ink: #0f172a;
  --ui-ink-2: #334155;
  --ui-muted: #64748b;
  --ui-faint: #94a3b8;
  --ui-line: #e2e8f0;
  --ui-line-2: #f1f5f9;
  --ui-surface: #fff;
  --ui-sunken: #f8fafc;
  --ui-pay: #0f9488;
}

/* 双语主标签（模板的 t()）：中文一行，英文小字第二行。zh / en 单语模式不会输出这层结构 */
.ui-t { display: inline-flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.2; }
.ui-en { font-size: max(10px, .74em); font-weight: 650; letter-spacing: 0; opacity: .72; }

/* ── 按钮 ── */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  color: var(--ui-ink-2);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  font: inherit;
  min-width: 0;          /* 当 grid/flex 子项时允许收窄，字自己换行 */
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.ui-btn svg { flex: 0 0 auto; }
.ui-btn--lg { min-height: 48px; padding: 0 18px; border-radius: 12px; font-size: 14px; }
.ui-btn--sm { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12px; white-space: nowrap; }
.ui-btn--pay     { color: #fff; background: var(--ui-pay); border-color: var(--ui-pay); box-shadow: 0 4px 12px rgba(15, 148, 136, .25); }
.ui-btn--primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.ui-btn--ok      { color: #fff; background: #16a34a; border-color: #16a34a; }
.ui-btn--danger  { color: #fff; background: #dc2626; border-color: #dc2626; }
.ui-btn--warn    { color: #fff; background: #d97706; border-color: #d97706; }
.ui-btn--bill    { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
.ui-btn--book    { color: #047857; background: #ecfdf5; border-color: #a7f3d0; }
.ui-btn--bad     { color: #dc2626; background: #fff; border-color: #fecaca; }
.ui-btn--quiet   { color: var(--ui-muted); }
.ui-btn--dashed  { color: var(--ui-muted); border-style: dashed; }
.ui-btn--dashed.ui-btn--info { color: #0284c7; }

/* ── 状态小标签 ── */
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
  white-space: nowrap;
}
.ui-chip--ok     { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.ui-chip--warn   { color: #9a3412; background: #fff7ed; border-color: #fdba74; }
.ui-chip--bad    { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.ui-chip--info   { color: #0369a1; background: #f0f9ff; border-color: #bae6fd; }
.ui-chip--muted  { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.ui-chip--accent { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
.ui-chip--gold   { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.ui-chip--teal   { color: #0f766e; background: #f0fdfa; border-color: #99f6e4; }

.ui-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .ui-btn:hover { filter: brightness(.96); }
}

/* ── 页面骨架部件：工具条 / 卡片 / 搜索 / 筛选胶囊 / 带标题下拉 / 图标按钮 / 空状态 ── */
/* 工具条：手机一行横滑，平板起换行排开 */
.ui-tools { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.ui-tools::-webkit-scrollbar { display: none; }
.ui-tools .ui-btn { flex: 0 0 auto; }

.ui-card {
  min-width: 0;
  padding: 14px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
}

.ui-searchbar { display: flex; gap: 8px; }
.ui-searchbar .ui-search { flex: 1 1 auto; min-width: 0; }

.ui-search { position: relative; display: flex; align-items: center; color: var(--ui-faint); }
.ui-search svg { position: absolute; left: 13px; pointer-events: none; }
.ui-search input {
  width: 100%;
  min-height: 44px;
  padding: 0 14px 0 40px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  outline: none;
}
.ui-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }

/* 快捷筛选：一行横滑；有人数的才上色，0 人的灰掉 */
.ui-fchips { display: flex; gap: 6px; margin: 0 -14px; padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.ui-fchips::-webkit-scrollbar { display: none; }
.ui-fchip {
  --chip-ink: #334155; --chip-bg: #fff; --chip-line: #cbd5e1; --chip-on: #1e1b4b;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 6px 0 12px;
  color: var(--chip-ink);
  background: var(--chip-bg);
  border: 1px solid var(--chip-line);
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.ui-fchip b {
  min-width: 24px;
  padding: 1px 7px;
  background: rgba(15, 23, 42, .06);
  border-radius: 99px;
  font-weight: 900;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ui-fchip--bad  { --chip-ink: #b91c1c; --chip-bg: #fef2f2; --chip-line: #fecaca; --chip-on: #dc2626; }
.ui-fchip--warn { --chip-ink: #b45309; --chip-bg: #fffbeb; --chip-line: #fde68a; --chip-on: #d97706; }
.ui-fchip--gold { --chip-ink: #854d0e; --chip-bg: #fefce8; --chip-line: #fde68a; --chip-on: #ca8a04; }
.ui-fchip--ok   { --chip-ink: #15803d; --chip-bg: #f0fdf4; --chip-line: #86efac; --chip-on: #16a34a; }
.ui-fchip.is-zero { --chip-ink: var(--ui-faint); --chip-bg: #fff; --chip-line: var(--ui-line); }
.ui-fchip.is-active { color: #fff; background: var(--chip-on); border-color: var(--chip-on); }
.ui-fchip.is-active b { background: rgba(255, 255, 255, .22); }

.ui-select { display: grid; gap: 4px; min-width: 0; }
.ui-select > span { color: var(--ui-muted); font-size: 11.5px; font-weight: 800; }
.ui-select select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 10px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  cursor: pointer;
}

.ui-icon {
  --icon-ink: #475569; --icon-bg: #f1f5f9; --icon-line: var(--ui-line);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--icon-ink);
  background: var(--icon-bg);
  border: 1px solid var(--icon-line);
  border-radius: 10px;
  cursor: pointer;
}
.ui-icon--ok     { --icon-ink: #059669; --icon-bg: #ecfdf5; --icon-line: #a7f3d0; }
.ui-icon--bad    { --icon-ink: #dc2626; --icon-bg: #fef2f2; --icon-line: #fecaca; }
.ui-icon--accent { --icon-ink: #4f46e5; --icon-bg: #eef2ff; --icon-line: #c7d2fe; }

.ui-empty { padding: 40px 12px; color: var(--ui-faint); font-size: 13px; font-weight: 700; text-align: center; }

/* 日期小块：大号日期 + 「月 星期」；待批的再加一颗「今天/明天/N 天后」药丸，--hot 今天/明天、--warn 3 天内、默认灰 */
.ui-datetile {
  --t-ink: #475569; --t-bg: #f1f5f9; --t-line: #e2e8f0;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 1px;
  min-width: 0;
  padding: 5px 2px;
  color: var(--t-ink);
  background: var(--t-bg);
  border: 1px solid var(--t-line);
  border-radius: 12px;
  text-align: center;
}
.ui-datetile--hot  { --t-ink: #b91c1c; --t-bg: #fef2f2; --t-line: #fecaca; }
.ui-datetile--warn { --t-ink: #b45309; --t-bg: #fffbeb; --t-line: #fde68a; }
.ui-datetile b { font-size: 18px; font-weight: 900; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ui-datetile span { font-size: 10px; font-weight: 800; white-space: nowrap; }
.ui-datetile em { margin-top: 4px; padding: 1px 7px; color: #fff; background: var(--t-ink); border-radius: 99px; font-size: 10.5px; font-style: normal; font-weight: 900; white-space: nowrap; }

.ui-fchip:focus-visible, .ui-icon:focus-visible, .ui-select select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .ui-fchip:hover, .ui-icon:hover { filter: brightness(.96); }
}
@media (min-width: 768px) {
  .ui-tools { flex-wrap: wrap; overflow: visible; }
  .ui-card { padding: 20px; }
  .ui-fchips { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
}

/* ======================================================================
   CONFIRM (uc-) — 共用确认弹层（js/ui-kit.js UIKit.confirm，取代浏览器自带 confirm()）
   · 手机：贴底的面板（拇指够得着、按钮整行）；≥768：居中小卡。
   · 按钮沿用 ui-btn：取消在左、确认在右，危险操作确认键为红色。
   · z-index 高过 ah- / 各种内联弹窗，能叠在它们上面。
   ====================================================================== */
html.uc-lock { overflow: hidden; }
/* z-index 要高过点名窗口（手机/平板上它被抬到 2147483000，从点名里弹出的确认/提示不能被盖住），仍低于 toast(2147483647) */
.uc { position: fixed; inset: 0; z-index: 2147483200; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 23, 42, .55); }
.uc-card {
  display: grid;
  gap: 12px;
  width: 100%;
  max-height: 90vh;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  overflow-y: auto;
  color: var(--ui-ink);
  background: var(--ui-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 40px rgba(15, 23, 42, .25);
}
.uc-title { margin: 0; font-size: 17px; font-weight: 900; line-height: 1.3; overflow-wrap: anywhere; }
.uc-lead { margin: 0; color: var(--ui-ink-2); font-size: 13.5px; font-weight: 700; overflow-wrap: anywhere; }
.uc-facts { display: grid; margin: 0; padding: 4px 12px; background: var(--ui-sunken); border: 1px solid var(--ui-line); border-radius: 12px; }
.uc-facts > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--ui-line-2); }
.uc-facts > div:first-child { border-top: 0; }
.uc-facts dt { margin: 0; color: var(--ui-muted); font-size: 12.5px; font-weight: 800; }
.uc-facts dd { margin: 0; font-size: 14px; font-weight: 900; text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.uc-note { margin: 0; color: var(--ui-muted); font-size: 12.5px; font-weight: 600; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.uc-act { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 4px; }
.uc-act .ui-btn { justify-content: center; text-align: center; }
.uc-fields { display: grid; gap: 12px; }
.uc-field { display: grid; gap: 6px; min-width: 0; }
.uc-flabel { color: var(--ui-ink-2); font-size: 12.5px; font-weight: 800; }
.uc-req { color: #dc2626; }
.uc-input {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  font: inherit;
  font-size: 16px;   /* ≥16px：iOS 聚焦时不会自动放大页面 */
  line-height: 1.4;
}
textarea.uc-input { resize: vertical; min-height: 84px; }
.uc-input:focus { outline: 2px solid var(--ui-pay); outline-offset: 1px; border-color: var(--ui-pay); }
.uc-input.is-bad { border-color: #dc2626; outline-color: #dc2626; }
.uc-hint { margin: 0; color: var(--ui-muted); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.uc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.uc-chip {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ui-ink-2);
  background: var(--ui-sunken);
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.uc-act .ui-btn[disabled] { opacity: .45; cursor: not-allowed; }
/* 提示弹层（UIKit.notice）：一颗按钮；标题按严重程度上色；多条提示并在一个弹层里 */
.uc-act--one { grid-template-columns: minmax(0, 1fr); }
.uc--danger .uc-title { color: #b91c1c; }
.uc--warn .uc-title { color: #b45309; }
.uc--ok .uc-title { color: #15803d; }
.uc-msgs { display: grid; gap: 8px; }
.uc-msg { margin: 0; color: var(--ui-ink); font-size: 14px; font-weight: 600; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.uc-msg + .uc-msg { padding-top: 8px; border-top: 1px solid var(--ui-line-2); }

@media (min-width: 768px) {
  .uc { align-items: center; padding: 24px; }
  .uc-card { max-width: 420px; padding: 22px 22px 20px; border-radius: 18px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
}

/* ======================================================================
   STUDENT PROFILE (pf-) — 学员档案页（ui-students.js renderStudentProfilePage）
   · 一套 HTML，移动优先：基础样式就是手机排版，min-width 断点往上加列。
   · 只有一层卡片：资料卡 + 明细卡；面板里的分块用分隔线，不再卡套卡。
   · 记录列表（台账/考勤/作业/兑换）同一批格子：≥1024 排成表格（平板横屏照旧是表格），
     以下靠 grid-template-areas 排成卡片。
   · 模板里没有内联样式，所以这里不需要 !important。
   · 触控兜底 `#content-body button { min-height:44px }`（pointer: coarse）直接接受：
     这页的按钮本来就按 ≥40px 设计，不跟它对着干。
   ====================================================================== */
.pf {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* 列宽锁在容器内：内容再长也只能换行，不能把页面撑宽 */
  gap: 12px;
  margin-bottom: 40px;
  color: var(--ui-ink);
}
.pf-num { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* ── 顶部导航：返回 + 上一位/下一位 ── */
.pf-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pf-nav-back,
.pf-stepper button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px;
  color: var(--ui-ink-2);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.pf-stepper { display: flex; align-items: center; gap: 6px; }
.pf-stepper button { width: 40px; padding: 0; }
.pf-stepper button > span { display: none; }    /* 手机只留箭头，aria-label 照读；只管直接子层，别碰双语结构 */
.pf-stepper button:disabled { color: #cbd5e1; cursor: default; }
.pf-stepper-pos { min-width: 48px; color: var(--ui-muted); font-size: 12px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }

/* ── 卡片 ── */
.pf-card {
  min-width: 0;
  padding: 16px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, .035);
}

/* ── 资料卡：手机按「是谁 → 欠多少 → 能做什么 → 数据 → 账号」排 ── */
.pf-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "id" "bal" "act" "stats" "facts";
  gap: 14px;
}
.pf-identity { grid-area: id; }
.pf-balance  { grid-area: bal; }
.pf-actions  { grid-area: act; }
.pf-stats    { grid-area: stats; }
.pf-facts    { grid-area: facts; }

.pf-identity { display: flex; align-items: center; gap: 14px; min-width: 0; }
.pf-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 56px;
  height: 56px;
  color: #fff;
  background: linear-gradient(145deg, #5865f2, #3b82f6);
  border-radius: 16px;
  font-size: 24px;
  font-weight: 900;
}
.pf-identity-text { min-width: 0; }
.pf-name {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -.02em;
}
.pf-name-cn { color: #4f46e5; font-size: 17px; font-weight: 800; letter-spacing: 0; }
.pf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 7px 0 0;
  color: var(--ui-muted);
  font-size: 12.5px;
  font-weight: 750;
}
.pf-meta > span:not(.ui-chip) { display: inline-flex; align-items: center; gap: 5px; }

/* 余额带：全页唯一的重点。看到欠款的地方就能收款 */
/* 放得下就「金额 | 按钮」并排；放不下（窄屏、双语长字）按钮自己换到下一行占满 */
.pf-balance {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 16px;
  border: 1px solid;
  border-radius: 14px;
}
.pf-balance.is-owing { --ui-bal: #dc2626; --ui-bal-ink: #991b1b; background: #fef2f2; border-color: #fecaca; }
.pf-balance.is-clear { --ui-bal: #15803d; --ui-bal-ink: #166534; background: #f0fdf4; border-color: #bbf7d0; }
/* 同一行时文字吃掉几乎全部余宽（999:1），按钮保持原宽；按钮单独换行时 grow 让它占满 */
.pf-balance-text { display: grid; flex: 999 1 170px; gap: 2px; min-width: 0; }
.pf-balance-label,
.pf-balance-note { color: var(--ui-bal-ink); font-size: 12px; font-weight: 800; }
.pf-balance-note { font-weight: 700; line-height: 1.4; }
.pf-balance-amount {
  color: var(--ui-bal);
  font-size: 28px;
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.pf-balance.is-clear .pf-balance-amount { font-size: 22px; }
.pf-balance-amount small { margin-right: 3px; font-size: .55em; font-weight: 800; }
.pf-balance .ui-btn { flex: 1 0 auto; }
.pf-balance.is-clear .ui-btn--pay { color: var(--ui-pay); background: #fff; border-color: #99f6e4; box-shadow: none; }

.pf-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

/* 数据格：整格是按钮；颜色只落在数字和动作字上，格子本身保持安静 */
/* 手机两列：模板顺序两两一组（押金|预收、金币|补课、级别|出勤），一行正好一组 */
.pf-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pf-stat {
  --ui-stat: var(--ui-ink);
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 2px;
  min-width: 0;
  padding: 11px 12px;
  color: var(--ui-ink);
  background: var(--ui-sunken);
  border: 1px solid var(--ui-line-2);
  border-radius: 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.pf-stat--deposit    { --ui-stat: #b45309; }
.pf-stat--prepaid    { --ui-stat: #0f766e; }
.pf-stat--points     { --ui-stat: #4f46e5; }
.pf-stat--makeup     { --ui-stat: #0369a1; }
.pf-stat--grade      { --ui-stat: var(--accent); }
.pf-stat--attendance { --ui-stat: #059669; }
.pf-stat-label { color: var(--ui-muted); font-size: 11.5px; font-weight: 800; }
.pf-stat-value {
  color: var(--ui-stat);
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.01em;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pf-stat-value small { margin: 0 2px; color: var(--ui-muted); font-size: .58em; font-weight: 800; }
.pf-stat-value i {
  display: inline-block;
  width: 1px;
  height: .8em;
  margin: 0 7px 0 5px;
  vertical-align: -1px;
  background: var(--ui-line);
}
.pf-stat-act { color: var(--ui-stat); font-size: 11.5px; font-weight: 800; }

.pf-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin: 0;
  padding: 14px;
  background: var(--ui-sunken);
  border: 1px solid var(--ui-line-2);
  border-radius: 14px;
}
.pf-fact { display: grid; gap: 3px; min-width: 0; }
.pf-fact--login { grid-column: 1 / -1; }
.pf-fact dt { color: var(--ui-faint); font-size: 11px; font-weight: 800; }
.pf-fact dd { margin: 0; color: var(--ui-ink-2); font-size: 13.5px; font-weight: 800; overflow-wrap: anywhere; }
.pf-fact--login dd { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; }

/* ── 明细卡：tab + 面板 ── */
.pf-detail { padding: 0; overflow: hidden; }
.pf-tabs {
  display: flex;
  gap: 2px;
  padding: 4px 8px 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--ui-line);
  scrollbar-width: none;
}
.pf-tabs::-webkit-scrollbar { display: none; }
.pf-tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 46px;
  margin-bottom: -1px;
  padding: 0 12px;
  color: var(--ui-muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.pf-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.pf-tab-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  color: #fff;
  background: #dc2626;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 900;
}
.pf-panel { padding: 16px; }
.pf-panel[hidden] { display: none; }

.pf-section + .pf-section { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--ui-line); }
.pf-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  margin-bottom: 14px;
}
.pf-section-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--ui-ink); font-size: 15px; font-weight: 900; }
.pf-section-note { margin: 4px 0 0; color: var(--ui-muted); font-size: 12px; font-weight: 600; line-height: 1.5; }
.pf-section-tools { display: flex; gap: 8px; width: 100%; }
.pf-section-tools .ui-btn { flex: 1 1 0; }
.pf-empty { padding: 28px 12px; color: var(--ui-faint); font-size: 12.5px; font-weight: 700; text-align: center; }
.pf-empty small { display: block; margin-top: 4px; color: #cbd5e1; font-weight: 600; }

/* 月费格：手机 4 列 → 平板 6 列 → 宽屏 12 列一行一年 */
.pf-months { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: start; gap: 6px; }
.pf-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 10px 4px;
  border: 1px solid;
  border-radius: 10px;
  text-align: center;
}
.pf-month b { font-size: 14px; font-weight: 900; }
.pf-month span { font-size: 11.5px; font-weight: 800; }
.pf-month small { color: var(--ui-muted); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pf-month .ui-btn { width: 100%; min-height: 30px; margin-top: 6px; padding: 0 4px; font-size: 11.5px; }
.pf-month.is-paid     { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.pf-month.is-unpaid   { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.pf-month.is-unbilled { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.pf-month.is-future   { color: #cbd5e1; background: var(--ui-sunken); border-color: var(--ui-line-2); }

/* 台账筛选 */
.pf-filter { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; }
.pf-filter::-webkit-scrollbar { display: none; }
.pf-filter button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 14px;
  color: var(--ui-muted);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
}
.pf-filter button.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ── 记录列表：手机是卡片 ── */
.pf-rows { display: grid; gap: 8px; }
.pf-row {
  display: grid;
  align-items: center;
  gap: 6px 12px;
  min-width: 0;
  padding: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 12px;
  font-size: 13px;
}
.pf-row > * { min-width: 0; }
.pf-row--head { display: none; }
.pf-row.is-voided { opacity: .55; }
.pf-row.is-voided .pf-c-desc { text-decoration: line-through; }
.pf-label { margin-right: 4px; color: var(--ui-faint); font-weight: 700; }
.pf-c-act { display: flex; gap: 6px; margin-top: 4px; padding-top: 10px; border-top: 1px dashed var(--ui-line); }
.pf-c-act .ui-btn { flex: 1 1 0; }

/* 每种列表的格子在卡片里怎么摆（area 名 = 格子的 pf-c-xxx） */
.pf-c-desc { grid-area: desc; } .pf-c-no { grid-area: no; } .pf-c-amount { grid-area: amount; }
.pf-c-due { grid-area: due; } .pf-c-paid { grid-area: paid; } .pf-c-status { grid-area: status; }
.pf-c-act { grid-area: act; } .pf-c-item { grid-area: item; } .pf-c-points { grid-area: points; }
.pf-c-qty { grid-area: qty; } .pf-c-date { grid-area: date; } .pf-c-class { grid-area: class; }
.pf-c-uniform { grid-area: uniform; } .pf-c-coins { grid-area: coins; } .pf-c-type { grid-area: type; }
.pf-c-title { grid-area: title; } .pf-c-progress { grid-area: progress; } .pf-c-mood { grid-area: mood; }
.pf-c-review { grid-area: review; }

/* 台账卡：日期两行靠左，操作收成小按钮靠右——一笔账三四行高，几十笔也翻得动 */
.pf-ledger .pf-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "desc amount" "no status" "due act" "paid act"; }
.pf-ledger .pf-c-act { align-self: end; justify-content: flex-end; margin: 0; padding: 0; border: 0; }
.pf-ledger .pf-c-act .ui-btn { flex: none; }
.pf-ledger .pf-c-desc { font-size: 14px; font-weight: 800; line-height: 1.35; }
.pf-ledger .pf-c-no span { display: block; font-weight: 800; }
.pf-ledger .pf-c-no small { display: block; color: var(--ui-faint); font-size: 10.5px; font-weight: 700; }
.pf-ledger .pf-c-no small.is-receipt { color: #059669; }
.pf-ledger .pf-c-amount { font-size: 15px; font-weight: 900; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pf-ledger .pf-c-due { color: var(--ui-muted); font-size: 12px; font-weight: 600; white-space: nowrap; }
.pf-ledger .pf-c-paid { color: var(--ui-faint); font-size: 12px; font-weight: 800; white-space: nowrap; }
.pf-ledger .pf-c-paid.is-paid { color: #16a34a; }
.pf-ledger .pf-c-status { justify-self: end; }

.pf-redeem .pf-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "item points" "date qty"; }
.pf-redeem .pf-c-item { font-size: 14px; font-weight: 800; }
.pf-redeem .pf-c-points { color: #ef4444; font-weight: 800; white-space: nowrap; }
.pf-redeem .pf-c-date { color: var(--ui-muted); font-size: 12px; }
.pf-redeem .pf-c-qty { justify-self: end; font-weight: 800; }

.pf-attendance .pf-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "date type" "class coins" "status uniform"; }
.pf-attendance .pf-c-date { font-size: 14px; font-weight: 800; }
.pf-attendance .pf-c-class { color: var(--ui-ink-2); font-weight: 800; }
.pf-attendance .pf-c-status { display: flex; flex-wrap: wrap; gap: 4px; }
.pf-attendance .pf-c-type,
.pf-attendance .pf-c-coins,
.pf-attendance .pf-c-uniform { justify-self: end; white-space: nowrap; }
.pf-attendance .pf-c-coins { font-weight: 800; color: var(--ui-muted); }
.pf-attendance .pf-c-coins.is-up { color: #10b981; }
.pf-attendance .pf-c-coins.is-down { color: #ef4444; }
.pf-attendance .pf-c-uniform.is-yes { color: #10b981; font-weight: 800; }
.pf-attendance .pf-c-uniform.is-no { color: var(--ui-faint); }

.pf-homework .pf-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "title title" "progress review" "mood mood" "act act"; align-items: start; }
.pf-homework .pf-label { display: block; margin: 0 0 3px; font-size: 10.5px; font-weight: 800; }
.pf-homework .pf-c-title b { display: block; font-size: 14px; font-weight: 800; }
.pf-homework .pf-c-title small { display: block; margin-top: 2px; color: var(--ui-faint); font-size: 11px; font-weight: 600; }
.pf-homework .pf-c-progress b { font-weight: 800; }
.pf-homework .pf-c-progress b.is-done { color: #10b981; }
.pf-bar { display: block; height: 5px; margin-top: 4px; overflow: hidden; background: var(--ui-line); border-radius: 3px; }
.pf-bar i { display: block; height: 100%; background: var(--accent); }
.pf-bar.is-done i { background: #10b981; }
.pf-results { margin: 6px 0 0; padding: 4px 8px; color: #15803d; background: #ecfdf5; border-radius: 8px; font-size: 10.5px; font-weight: 700; list-style: none; }
.pf-homework .pf-c-mood { color: var(--ui-ink-2); font-weight: 700; }
.pf-homework .pf-c-mood q { display: block; margin-top: 4px; padding: 4px 8px; color: #475569; background: var(--ui-sunken); border-left: 3px solid var(--ui-line); border-radius: 4px; font-size: 12px; font-weight: 600; }
.pf-homework .pf-c-review { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.pf-homework .pf-c-review .pf-label { width: 100%; }

/* 考勤汇总 */
.pf-tally { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pf-tally span { padding: 4px 10px; color: var(--ui-muted); background: var(--ui-sunken); border: 1px solid var(--ui-line-2); border-radius: 999px; font-size: 12px; font-weight: 700; }
.pf-tally b { color: var(--ui-ink); font-weight: 900; font-variant-numeric: tabular-nums; }

/* 教材：多栏排版保持「从上往下」的阅读顺序，栏数随宽度自动增减 */
.pf-books { columns: 280px; column-gap: 16px; }
.pf-book {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  padding: 6px 6px 6px 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line-2);
  border-radius: 10px;
  break-inside: avoid;
}
.pf-book-name { min-width: 0; color: var(--ui-ink-2); font-size: 13px; font-weight: 750; }
.pf-book-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.pf-claim {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid;
  border-radius: 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.pf-claim-count { opacity: .7; }
.pf-claim--paid       { color: #15803d; background: #f0fdf4; border-color: #86efac; }
.pf-claim--billed     { color: #0f766e; background: #f0fdfa; border-color: #99f6e4; }
.pf-claim--historical { color: #4338ca; background: #eef2ff; border-color: #c7d2fe; }
.pf-claim--pending    { color: #b45309; background: #fffbeb; border-color: #fcd34d; }
.pf-claim--unpaid     { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }

/* 交互态 */
.pf :is(.pf-stat, .pf-tab, .pf-claim, .pf-nav-back, .pf-stepper button, .pf-filter button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
@media (hover: hover) {
  .pf :is(.pf-claim, .pf-nav-back, .pf-filter button):hover,
  .pf-stepper button:not(:disabled):hover { filter: brightness(.96); }
  .pf-stat:hover { background: #f1f5f9; border-color: var(--ui-line); }
  .pf-tab:not(.is-active):hover { color: var(--ui-ink-2); }
}

/* ── ≥560：主操作一行四个 ── */
@media (min-width: 560px) {
  .pf-actions { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ── ≥768：平板竖屏 ── */
@media (min-width: 768px) {
  .pf-card { padding: 20px; }
  .pf-detail { padding: 0; }
  .pf-panel { padding: 20px; }
  .pf-stepper button { width: auto; padding: 0 12px; }
  .pf-stepper button > span { display: inline-flex; }
  .pf-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pf-fact--login { grid-column: 1 / -1; }
  .pf-months { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  /* 数据格改两行、按列排：同一组（钱 / 金币·时数 / 学业）上下叠成一列，
     4~6 格都排得整齐（6 格 3×2、4 格 2×2），不会剩一格孤零零掉到下一行 */
  .pf-stats { grid-template-columns: none; grid-template-rows: repeat(2, auto); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .pf-section-tools { width: auto; }
  .pf-section-tools .ui-btn { flex: none; }
  .pf-tab { padding: 0 14px; }
}

/* ── ≥1024：资料卡左右两栏，记录列表变真表格 ── */
@media (min-width: 1024px) {
  .pf-profile {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    grid-template-areas: "id bal" "facts act" "facts stats";
    align-items: start;
    gap: 16px 28px;
  }
  .pf-identity { align-self: center; }
  .pf-avatar { flex-basis: 64px; height: 64px; font-size: 26px; border-radius: 18px; }
  .pf-name { font-size: 22px; }
  .pf-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-actions { display: flex; flex-wrap: wrap; }

  .pf-rows { gap: 0; overflow: hidden; border: 1px solid var(--ui-line); border-radius: 12px; }
  .pf-row { gap: 12px; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--ui-line-2); border-radius: 0; }
  .pf-row:last-child { border-bottom: 0; }
  .pf-row--head {
    display: grid;
    padding-block: 10px;
    color: #475569;
    background: var(--ui-sunken);
    border-bottom: 1px solid var(--ui-line);
    font-size: 11.5px;
    font-weight: 800;
  }
  /* 表头格沿用表头的字体：(0,3,0) 压过 .pf-ledger .pf-c-xxx 这类 (0,2,0) 的单元格样式 */
  .pf .pf-rows .pf-row--head > * { color: inherit; font-size: inherit; font-weight: inherit; }
  .pf-label,
  .pf-homework .pf-label { display: none; }
  .pf-c-act { justify-content: flex-end; margin-top: 0; padding-top: 0; border-top: 0; }
  .pf-c-act .ui-btn { flex: none; }

  /* 每行是独立的 grid：列宽必须每行算出来都一样（固定值或 fr），表头才对得齐。
     操作列按最多三个按钮（收款/查看/作废）定宽，不能用 max-content。 */
  .pf-ledger .pf-row {
    grid-template-columns: minmax(140px, 1.6fr) minmax(110px, 1.1fr) 96px 100px 104px 76px 176px;
    grid-template-areas: "desc no amount due paid status act";
  }
  .pf-ledger .pf-c-desc { font-size: 13px; }
  .pf-ledger .pf-c-amount { font-size: 13px; text-align: left; }
  .pf-ledger .pf-c-status { justify-self: start; }
  .pf-ledger .pf-c-act { align-self: center; }

  .pf-redeem .pf-row { grid-template-columns: minmax(0, 2fr) 120px 80px 120px; grid-template-areas: "item points qty date"; }
  .pf-redeem .pf-c-item { font-size: 13px; }
  .pf-redeem .pf-c-qty { justify-self: start; }

  .pf-attendance .pf-row {
    grid-template-columns: 120px minmax(0, 1.3fr) minmax(0, 1.6fr) 84px 96px 96px;
    grid-template-areas: "date class status uniform coins type";
  }
  .pf-attendance .pf-c-date { font-size: 13px; }
  .pf-attendance .pf-c-type,
  .pf-attendance .pf-c-coins,
  .pf-attendance .pf-c-uniform { justify-self: start; }

  .pf-homework .pf-row {
    grid-template-columns: minmax(0, 1.5fr) 150px minmax(0, 1.3fr) minmax(0, 1.4fr) 112px;
    grid-template-areas: "title progress mood review act";
    align-items: center;
  }
  .pf-homework .pf-c-title b { font-size: 13px; }
}

/* ── ≥1280：月费一行十二格 ── */
@media (min-width: 1280px) {
  .pf-months { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}

/* ======================================================================
   STUDENTS LIST (sl-) — 学生权限管理页（ui-students.js renderStudents / getStudentTableHTML）
   · 跟学员档案页同一套做法：移动优先、一层卡片；按钮/状态标签用上面的共用 ui-*。
   · 名单一行一个 .sl-row：手机是卡片，768~1023 两栏卡片，≥1024 同一批格子排成表格。
   · 不用全站 .data-table（那套手机卡片规则是员工/班级等页共用的），这页自己管排版，不靠 !important。
   ====================================================================== */
.sl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 40px;
  color: var(--ui-ink);
}

/* ── 搜索 + 快捷筛选 + 下拉 ── */
.sl-filters { display: grid; gap: 10px; margin-bottom: 14px; }
/* 手机：四个下拉收在「筛选」里（.sl-filters.is-open 才显示）；≥768 一直显示、按钮藏起来 */
.sl-more {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ui-ink-2);
  background: var(--ui-surface);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.sl-more b {
  min-width: 20px;
  padding: 1px 6px;
  color: #fff;
  background: var(--accent);
  border-radius: 99px;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}
.sl-filters.is-open .sl-more { color: var(--accent); background: #eef2ff; border-color: #c7d2fe; }

.sl-selects { display: none; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sl-filters.is-open .sl-selects { display: grid; }

/* ── 名单：手机一人一张卡，固定三行（每张卡同一版式，不随内容乱跳）──
     头像 姓名/中文名/账号·更新日期        金币
     会员标签 期限                     学费状态     ← .sl-status
     导师下拉                          操作图标     ← .sl-foot
   第二、三行各包一层：右栏只跟金币一样宽，不会被图标撑宽、把姓名挤窄。
   <420 窄屏：导师、图标各占一整行（见下方断点）。格子内部可换行，不会撑破卡片。 */
.sl-rows { display: grid; gap: 8px; }
.sl-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "who coins" "status status" "foot foot";
  align-items: center;
  gap: 10px 8px;
  min-width: 0;
  padding: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 14px;
}
.sl-row > * { min-width: 0; }
.sl-row.is-expired { background: #fffafa; border-color: #fecaca; }
.sl-row--head { display: none; }
.sl-c-who     { grid-area: who; }
.sl-c-coins   { grid-area: coins; align-self: start; justify-self: end; }
.sl-c-member  { grid-area: member; }
.sl-c-tuition { grid-area: tuition; }
.sl-c-teacher { grid-area: teacher; }
.sl-c-act     { grid-area: act; }
.sl-status { grid-area: status; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.sl-status .sl-c-tuition { margin-left: auto; }
.sl-foot { grid-area: foot; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.sl-foot .sl-c-teacher { flex: 1 1 120px; max-width: 200px; }
.sl-foot .sl-c-act { margin-left: auto; }
.sl-c-teacher .sl-teacher { width: 100%; max-width: none; }

.sl-who {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 0;
  color: inherit;
  background: none;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sl-avatar {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  height: 40px;
  color: #3b82f6;
  background: #eff6ff;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 900;
}
.sl-row.is-expired .sl-avatar { color: #dc2626; background: #fee2e2; }
.sl-who-text { display: grid; flex: 1 1 auto; gap: 1px; min-width: 0; }
.sl-name { color: var(--ui-ink); font-size: 14.5px; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; }
.sl-cn { color: #4f46e5; font-size: 13px; font-weight: 800; }
.sl-login { color: var(--ui-faint); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.sl-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.sl-cohort { color: #c2410c; background: #ffedd5; border-color: #fdba74; }

.sl-c-member { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sl-expiry { color: #059669; font-size: 12px; font-weight: 700; white-space: nowrap; }
.sl-expiry.is-expired { color: #dc2626; font-weight: 800; }
.sl-expiry.is-lifetime { color: #4f46e5; }

.sl-fee {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  min-height: 32px;
  max-width: 100%;
  padding: 5px 10px;
  border: 1px solid;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  align-content: center;   /* 触控兜底把按钮撑到 44px 时，文字仍垂直居中 */
  cursor: pointer;
}
.sl-fee b { font-weight: 900; font-variant-numeric: tabular-nums; }
.sl-fee--bad   { color: #991b1b; background: #fef2f2; border-color: #fecaca; }
.sl-fee--ok    { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.sl-fee--muted { color: #475569; background: #f1f5f9; border-color: var(--ui-line); }

.sl-c-coins { white-space: nowrap; }
.sl-c-coins b { color: var(--ui-ink-2); font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.sl-c-coins small { margin-left: 3px; color: var(--ui-faint); font-size: 10px; font-weight: 800; }
.sl-teacher {
  max-width: 150px;
  min-height: 34px;
  padding: 0 8px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.sl-updated { margin-left: 8px; color: #cbd5e1; font-size: 11px; font-weight: 600; white-space: nowrap; }
.sl-icons { display: flex; justify-content: flex-end; gap: 6px; }

.sl-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  color: var(--ui-muted);
  border-top: 1px solid var(--ui-line);
  font-size: 12.5px;
  font-weight: 700;
}
.sl-pager-btns { display: flex; gap: 8px; margin-left: auto; }

/* 交互态 */
.sl :is(.sl-who, .sl-fee, .sl-teacher):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .sl-fee:hover { filter: brightness(.96); }
  .sl-who:hover .sl-name { color: var(--accent); }
}

/* ── <420 窄屏：第三行放不下「导师 + 5 个图标」，各占一整行，图标平均铺满 ── */
@media (max-width: 419px) {
  .sl-foot .sl-c-teacher { flex-basis: 100%; max-width: none; }
  .sl-foot .sl-c-act { flex: 1 1 100%; margin-left: 0; }
  .sl-icons .ui-icon { flex: 1 1 0; }
}

/* ── ≥768：下拉一行排满；名单两栏卡片 ── */
@media (min-width: 768px) {
  .sl-more { display: none; }
  .sl-selects { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
  .sl-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── ≥1024：名单变表格（每行独立 grid，列宽只用固定值或 fr，表头才对得齐） ── */
@media (min-width: 1024px) {
  .sl-rows { grid-template-columns: none; gap: 0; overflow: hidden; border: 1px solid var(--ui-line); border-radius: 12px; }
  /* 金币和导师在同一列上下叠：模板两行，其余格跨两行 */
  .sl-row {
    display: grid;
    grid-template-columns: minmax(160px, 2fr) 150px minmax(130px, 1.4fr) 150px 204px;   /* 操作列 = 5 个 36px 图标 + 间距 */
    grid-template-areas: "who member tuition coins act" "who member tuition teacher act";
    gap: 6px 12px;
    padding: 12px 14px;
    border: 0;
    border-bottom: 1px solid var(--ui-line-2);
    border-radius: 0;
  }
  .sl-row:last-child { border-bottom: 0; }
  .sl-row.is-expired { background: #fff8f8; }
  .sl-row--head {
    display: grid;
    padding-block: 10px;
    color: #475569;
    background: var(--ui-sunken);
    border-bottom: 1px solid var(--ui-line);
    font-size: 11.5px;
    font-weight: 800;
  }
  /* 表头格只是文字：(0,2,0) 压过 .sl-c-xxx 的 flex/虚线等单元格样式 */
  .sl-row--head > * { display: block; padding: 0; border: 0; }
  .sl-row--head > .sl-c-act { text-align: right; }
  .sl-row--head { row-gap: 0; }
  .sl-status, .sl-foot { display: contents; }   /* 拆掉手机用的两层包装，格子各进各的列 */
  .sl-status .sl-c-tuition { margin-left: 0; }
  .sl-avatar { flex-basis: 36px; height: 36px; border-radius: 10px; font-size: 14px; }
  .sl-c-member { flex-direction: column; align-items: flex-start; }
  .sl-c-coins { align-self: end; justify-self: start; }
  .sl-c-tuition { justify-self: start; }
  .sl-c-teacher { align-self: start; }
}
@media (min-width: 1024px) and (hover: hover) {
  .sl-row:not(.sl-row--head):hover { background: #fbfdff; }
}

/* ======================================================================
   CLASS SCHEDULE (sc-) — 课堂排班分页（ui-classroom.js _renderScheduleTab / _renderScheduleCardView / _renderScheduleTimetableMatrix）
   · 同一套设计语言：移动优先、一层卡片、共用 ui-*（工具条/搜索/星期胶囊/按钮/图标按钮）。
   · 全页唯一的重点 = 今日点名列表；班级卡片里「点名」是主按钮，其余收成图标。
   · 周课表矩阵只在 ≥768 提供（手机上 JS 直接给卡片，7 栏表格在手机上看不了）。
   ====================================================================== */
.sc {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 40px;
  color: var(--ui-ink);
}

/* ── 今日点名 ──
     手机：时段在上、班名/老师·人数在下，点名按钮靠右；≥560 三栏一行 */
.sc-today { display: grid; gap: 10px; padding: 14px; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 16px; }
.sc-today-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sc-today-head h3 { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; color: #065f46; font-size: 15px; font-weight: 900; }
.sc-today-head p { margin: 4px 0 0; color: #047857; font-size: 12px; font-weight: 700; }
.sc-today-head .ui-btn { flex: 0 0 auto; }
.sc-today-list { display: grid; gap: 6px; }
.sc-today-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "time act" "info act";
  align-items: center;
  gap: 2px 10px;
  padding: 8px 8px 8px 12px;
  background: #fff;
  border: 1px solid #d1fae5;
  border-left: 4px solid var(--tc, #94a3b8);
  border-radius: 12px;
}
.sc-today-row > .sc-time { grid-area: time; }
.sc-today-row > .sc-today-info { grid-area: info; }
.sc-today-row > .ui-btn { grid-area: act; }
.sc-today-row.is-done { background: var(--ui-sunken); border-color: var(--ui-line); border-left-color: #cbd5e1; }
.sc-today-row.is-done .sc-time,
.sc-today-row.is-done .sc-today-info b { color: var(--ui-faint); }
.sc-time { display: inline-flex; align-items: center; gap: 4px; color: #4338ca; font-size: 12.5px; font-weight: 900; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sc-today-info { display: grid; min-width: 0; }
.sc-today-info b,
.sc-today-info small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-today-info b { font-size: 15px; font-weight: 900; }
.sc-today-info small { color: var(--ui-muted); font-size: 11.5px; font-weight: 700; }
.sc-rollcall { box-shadow: 0 3px 10px rgba(22, 163, 74, .25); }
.sc-done { color: var(--ui-muted); }

/* ── 搜索 + 老师 + 视图切换 + 星期 ── */
.sc-filters { display: grid; gap: 10px; }
.sc-filters .ui-searchbar { flex-wrap: wrap; }
.sc-filters .ui-search { flex: 1 1 220px; }
.sc-teacher,
.rq-teacher {
  flex: 1 1 130px;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}
.sc-views { display: none; gap: 2px; padding: 3px; background: #f1f5f9; border: 1px solid var(--ui-line); border-radius: 12px; }
.sc-views button {
  min-height: 36px;
  padding: 0 12px;
  color: var(--ui-muted);
  background: none;
  border: 0;
  border-radius: 9px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.sc-views button.is-active { color: var(--accent); background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .08); }

/* ── 卡片视图：星期 → 时段 → 班级卡片 ── */
.sc-days { display: grid; gap: 12px; }
.sc-day { display: grid; gap: 14px; }
.sc-day-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; padding-bottom: 10px; border-bottom: 1px solid var(--ui-line); }
.sc-day-head h3 { margin: 0; color: var(--ui-ink); font-size: 18px; font-weight: 900; }
.sc-day-head span { color: var(--ui-muted); font-size: 12px; font-weight: 700; }
.sc-slot { display: grid; gap: 8px; }
.sc-slot-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.sc-slot-head small { color: var(--ui-faint); font-size: 11.5px; font-weight: 700; }
.sc-classes { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 10px; }

/* 班级卡片：左边色条 = 任课老师；学员小标签；一行操作（点名占满 + 图标） */
.sc-class {
  display: grid;
  align-content: start;   /* 同一行的卡片被撑高时，多出的高度留在底部，不分给点名按钮 */
  gap: 10px;
  min-width: 0;
  padding: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 4px solid var(--tc, #94a3b8);
  border-radius: 12px;
}
.sc-class-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.sc-class-name { font-size: 16px; font-weight: 900; }
.sc-class-teacher { flex: 1 1 auto; min-width: 0; color: var(--ui-muted); font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-roster { display: flex; flex-wrap: wrap; gap: 5px; max-height: 220px; overflow-y: auto; }
.sc-roster-empty { color: var(--ui-faint); font-size: 12px; font-weight: 600; }
.sc-stu {
  display: inline-flex;
  align-items: stretch;
  max-width: 100%;
  overflow: hidden;
  background: var(--ui-sunken);
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.3;
}
.sc-stu.is-multi { background: #fffbeb; border-color: #fcd34d; }
.sc-stu-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 5px; min-width: 0; padding: 5px 8px; color: var(--ui-ink-2); font-weight: 700; cursor: pointer; }
.sc-stu-name em { color: #4f46e5; font-style: normal; font-weight: 800; }
.sc-stu-name i { padding: 0 4px; color: #fff; background: #f59e0b; border-radius: 4px; font-size: 10px; font-style: normal; font-weight: 900; }
.sc-stu-act { display: inline-grid; place-items: center; min-width: 28px; padding: 0 6px; color: #6366f1; border-left: 1px solid var(--ui-line); font-weight: 900; cursor: pointer; }
.sc-stu-act.is-bad { color: #ef4444; }
.sc-class-act { display: flex; gap: 6px; }
.sc-class-act .sc-rollcall { flex: 1 1 auto; }

/* ── 周课表（≥768） ── */
.sc-matrix-wrap { padding: 0; overflow-x: auto; }
.sc-matrix { width: 100%; min-width: 720px; table-layout: fixed; border-collapse: separate; border-spacing: 0; text-align: left; }   /* fixed：7 天等宽，不随内容忽宽忽窄 */
.sc-matrix th,
.sc-matrix td { padding: 10px; border-right: 1px solid var(--ui-line-2); border-bottom: 1px solid var(--ui-line-2); vertical-align: top; }
.sc-matrix thead th { color: var(--ui-ink-2); background: var(--ui-sunken); border-bottom: 1px solid var(--ui-line); font-size: 12.5px; font-weight: 900; text-align: center; white-space: nowrap; }
.sc-matrix thead th.is-today { color: #065f46; background: #ecfdf5; box-shadow: inset 0 -2px 0 #10b981; }
.sc-matrix-corner,
.sc-matrix-time { position: sticky; left: 0; z-index: 1; width: 110px; background: var(--ui-sunken); }
.sc-matrix thead .sc-matrix-corner { z-index: 2; text-align: left; }
.sc-matrix-time { color: #4338ca; font-size: 12.5px; font-weight: 900; white-space: nowrap; vertical-align: middle; }
.sc-matrix td.is-today { background: #fafffd; }
.sc-mcell { display: grid; gap: 4px; margin-bottom: 6px; padding: 8px; background: #fff; border: 1px solid var(--ui-line); border-left: 3px solid var(--tc, #94a3b8); border-radius: 10px; }
.sc-mcell:last-child { margin-bottom: 0; }
.sc-mcell-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.sc-mcell-head b { font-size: 13.5px; font-weight: 900; }
.sc-mcell-head span { padding: 0 6px; color: var(--ui-muted); background: #f1f5f9; border-radius: 4px; font-size: 10.5px; font-weight: 800; }
.sc-mcell small { color: var(--ui-muted); font-size: 11px; font-weight: 600; }
.sc-mcell-act { display: flex; gap: 4px; }
.sc-mcell-act .ui-btn { flex: 1 1 auto; }
.sc-mcell-act .ui-icon { width: 32px; height: 32px; }
.sc-mempty { display: block; padding: 12px 0; color: #cbd5e1; text-align: center; }

/* 交互态 */
.sc :is(.sc-stu-name, .sc-stu-act, .sc-views button, .sc-teacher):focus-visible,
.rq-teacher:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .sc-stu-name:hover { color: var(--accent); }
  .sc-stu-act:hover { background: #eef2ff; }
}

/* ── ≥560：今日点名一行三栏 ── */
@media (min-width: 560px) {
  .sc-today-row { grid-template-columns: 110px minmax(0, 1fr) auto; grid-template-areas: "time info act"; gap: 10px; }
}

/* ── ≥768：显示卡片 / 周课表切换 ── */
@media (min-width: 768px) {
  .sc-today { padding: 16px 20px; }
  .sc-filters .ui-searchbar { flex-wrap: nowrap; }
  .sc-teacher, .rq-teacher { flex: 0 0 170px; }
  .sc-views { display: inline-flex; flex: 0 0 auto; }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', 'Noto Sans TC', sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;   /* real mobile Chrome's URL bar makes 100vh taller than
                        what's actually visible — with overflow:hidden below,
                        anything past the real (shorter) visible height was
                        unreachable, not just scrolled off. dvh tracks the
                        real visible viewport; vh above is the fallback for
                        browsers that don't support dvh. */
  overflow: hidden;
}

#console-app {
  display: flex;
  height: 100vh;
  height: 100dvh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--sidebar-surface);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 32px 0 24px;
  z-index: 100;
  box-shadow: 10px 0 30px rgba(0,0,0,0.06);
  position: relative;
  border-right: 1px solid var(--sidebar-line);
}

.brand {
  display: flex;
  flex-direction: column;
  padding: 0 24px;
  margin-bottom: 32px;
  gap: 16px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.4);
  border: 2px solid rgba(255,255,255,0.1);
}

.brand-name {
  font-weight: 900;
  font-size: 20px;
  background: linear-gradient(to right, #0f172a, #475569);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.brand-tag {
  font-size: 10px;
  font-weight: 800;
  color: #6366f1;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 2px;
}

.nav-menu {
  flex: 1;
  padding: 0 12px;
  overflow-y: auto;
}

/* Sleek Scrollbar for Sidebar */
.nav-menu::-webkit-scrollbar {
  width: 4px;
}
.nav-menu::-webkit-scrollbar-thumb {
  background: rgba(15,23,42,0.15);
  border-radius: 10px;
}

.nav-section-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #64748b;
  text-transform: uppercase;
  padding: 24px 20px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s ease;
}

.nav-section-label:hover {
  color: #0f172a;
}

.nav-section-chevron {
  font-size: 12px;
  transition: transform 0.25s ease;
  opacity: 0.7;
}

.nav-section-label.collapsed .nav-section-chevron {
  transform: rotate(-90deg);
}

.nav-section {
  overflow: hidden;
  max-height: 1000px;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  opacity: 1;
}

.nav-section.collapsed {
  max-height: 0;
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  margin: 2px 12px;
  color: var(--sidebar-text-muted);
  position: relative;
  border: 1px solid transparent;
}

.nav-item:hover {
  background-color: var(--sidebar-hover);
  color: #0369a1;
  transform: translateX(4px);
}

.nav-item.active {
  background: linear-gradient(135deg, #38bdf8 0%, #0ea5e9 100%);
  color: white;
  box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.35);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 20%;
  height: 60%;
  width: 4px;
  background: white;
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  font-size: 18px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(15,23,42,0.05);
  transition: all 0.2s;
}

.nav-item:hover .nav-icon {
  background: rgba(14,165,233,0.12);
}

.nav-item.active .nav-icon {
  background: rgba(255,255,255,0.2);
}

.nav-text {
  font-weight: 700;
  font-size: 13.5px;
}

.sidebar-footer {
  padding: 24px 16px;
  border-top: 1px solid var(--sidebar-line);
  background: rgba(15,23,42,0.03);
}

.user-profile-card {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--sidebar-line);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 12px;
}

.user-profile-card:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(14, 165, 233, 0.3);
  transform: translateY(-2px);
}

.user-profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.user-info {
  min-width: 0;
}

.user-name-wrapper {
  margin-bottom: 2px;
}

.user-display-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.user-role-badge {
  font-size: 9px;
  font-weight: 900;
  color: #6366f1;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.user-org-badge {
  font-size: 11px;
  color: var(--sidebar-text-muted);
  background: rgba(15,23,42,0.05);
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid var(--sidebar-line);
}

.footer-actions {
  display: flex;
  gap: 8px;
}

.footer-btn {
  flex: 1;
  padding: 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.6);
  border: 1px solid var(--sidebar-line);
  color: var(--sidebar-text-muted);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.footer-btn:hover {
  background: rgba(14,165,233,0.12);
  color: #0369a1;
  border-color: rgba(14,165,233,0.3);
}

.footer-btn.logout:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border-color: rgba(239, 68, 68, 0.3);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ======================================================================
   REQUEST LIST (rq-) — 请假申请、补课记录共用的申请列表
   （ui-classroom.js renderLeaveRequests / renderMakeupRequests）
   · 同一套设计语言：移动优先、一层卡片、共用 ui-*（工具条/搜索/筛选胶囊/状态标签/按钮/日期小块）。
   · 视觉重点 = 待批卡的日期小块（离那天越近越红）；已处理的收成紧凑两行，不跟待批抢注意力。
   · ≥1024：同一批格子排成表格，列宽只用固定值或 fr。
   ====================================================================== */
.rq { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 40px; color: var(--ui-ink); }
.rq-card { display: grid; gap: 12px; }
.rq-search { flex-wrap: wrap; }
.rq-search .ui-search { flex: 1 1 220px; }

/* 说明：收成一行，点开看全文 */
.rq-note { color: var(--ui-muted); font-size: 12px; font-weight: 700; }
.rq-note summary { cursor: pointer; list-style: none; }
.rq-note summary::-webkit-details-marker { display: none; }
.rq-note summary::before { content: "ⓘ "; color: var(--accent); }
.rq-note p { margin: 6px 0 0; font-weight: 600; line-height: 1.5; }

.rq-head { display: none; }
.rq-rows { display: grid; gap: 8px; }

/* 一张申请：默认是紧凑版式（已处理）；.is-open（待批）更大、琥珀色；.has-act 多一行操作按钮 */
.rq-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  grid-template-areas: "tile who stat" "tile why why";
  align-items: start;
  gap: 4px 10px;
  padding: 10px 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 4px solid #cbd5e1;
  border-radius: 12px;
}
.rq-row[hidden] { display: none; }
.rq-row.has-act { grid-template-areas: "tile who stat" "tile why why" "act act act"; }
.rq-row.is-open {
  grid-template-columns: 72px minmax(0, 1fr) auto;
  gap: 6px 10px;
  padding: 12px;
  background: #fffdf7;
  border-color: #fde68a;
  border-left-color: #d97706;
}
.rq-row > .ui-datetile { grid-area: tile; }
.rq-row.is-open > .ui-datetile { padding: 8px 2px; }
.rq-row.is-open > .ui-datetile b { font-size: 26px; }

.rq-who { grid-area: who; display: grid; min-width: 0; }
.rq-who b { font-size: 14.5px; font-weight: 900; overflow-wrap: anywhere; }
.rq-who em { margin-left: 6px; color: #6366f1; font-style: normal; font-weight: 800; white-space: nowrap; }
.rq-who small { color: var(--ui-muted); font-size: 11.5px; font-weight: 700; overflow-wrap: anywhere; }
.rq-why { grid-area: why; display: grid; gap: 4px; min-width: 0; color: var(--ui-ink-2); font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.rq-why:empty { display: none; }
.rq-why small { color: var(--ui-muted); font-size: 12px; }
.rq-none { color: var(--ui-faint); font-style: italic; }
.rq-plan { display: inline-flex; align-items: center; gap: 6px; color: #4338ca; font-size: 12.5px; font-weight: 800; }
.rq-plan svg { flex: 0 0 auto; }
.rq-tag { justify-self: start; }
.rq-stat { grid-area: stat; justify-self: end; }
/* 批准是主操作（2/3 宽），拒绝是次操作（1/3 宽、白底红字）；只有一个小按钮时靠右 */
.rq-act { grid-area: act; display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 4px; }
.rq-act--solo { grid-template-columns: auto; justify-content: end; margin-top: 0; }
.rq-wait { grid-column: 1 / -1; color: var(--ui-muted); font-size: 12px; font-weight: 700; }

/* ── ≥768：两栏卡片 ── */
@media (min-width: 768px) {
  .rq-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── ≥1024：表格（每行独立 grid，列宽固定/fr，表头才对得齐） ── */
@media (min-width: 1024px) {
  .rq-head, .rq-row, .rq-row.has-act, .rq-row.is-open {
    grid-template-columns: 210px minmax(0, 1.2fr) minmax(0, 2fr) 110px 190px;
    grid-template-areas: none;
    align-items: center;
    gap: 12px;
  }
  .rq-head {
    display: grid;
    padding: 0 12px 6px 16px;
    color: var(--ui-muted);
    border-bottom: 1px solid var(--ui-line);
    font-size: 11.5px;
    font-weight: 800;
  }
  .rq-rows { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .rq-row, .rq-row.is-open { padding: 10px 12px; }
  .rq-row > .ui-datetile, .rq-who, .rq-why, .rq-stat, .rq-act { grid-area: auto; }
  /* 日期小块在表格里横着排：「28  11月 周二  [明天]」 */
  .rq-row > .ui-datetile, .rq-row.is-open > .ui-datetile { grid-auto-flow: column; justify-content: start; align-content: center; align-items: center; justify-self: start; gap: 8px; padding: 4px 10px; }
  .rq-row > .ui-datetile b, .rq-row.is-open > .ui-datetile b { font-size: 20px; }
  .rq-row > .ui-datetile em { margin-top: 0; }
  .rq-stat { justify-self: start; }
  .rq-act, .rq-act--solo { grid-column: 5; margin-top: 0; }
  .rq-act--solo { justify-content: start; }
  .rq-act .ui-btn { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
}

/* ======================================================================
   OWED LIST (ow-) — 欠课未补（ui-classroom.js renderLeaveOwedTab）
   · 骨架沿用 rq-（.rq / .rq-card / .rq-note / .rq-search / .rq-teacher / .rq-who / .rq-why / .rq-empty）和共用 ui-datetile。
   · 视觉重点 = 左边「欠 N 堂」数字块（3 堂以上红、2 堂琥珀、1 堂灰）；能用时数池抵扣的行多一颗蓝色主按钮。
   · ≥1024：同一批格子排成表格，列宽固定/fr，表头才对得齐。
   ====================================================================== */
.ow-sum, .hd-sum { margin: 0; color: var(--ui-muted); font-size: 12.5px; font-weight: 700; }
.ow-sum b, .hd-sum b { color: var(--ui-ink); font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }

.ow-head { display: none; }
.ow-rows { display: grid; gap: 8px; align-items: start; }

.ow-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  grid-template-areas: "tile who" "tile why" "act act" "more more";
  align-items: start;
  gap: 4px 10px;
  padding: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 4px solid #cbd5e1;
  border-radius: 12px;
}
.ow-row[hidden] { display: none; }
.ow-row.is-some { border-left-color: #d97706; }
.ow-row.is-many { border-left-color: #dc2626; }
.ow-row > .ui-datetile { grid-area: tile; padding: 8px 2px; }
.ow-row > .ui-datetile b { font-size: 26px; }

/* 学员名：整块是按钮（点开档案），去掉按钮默认外观 */
.ow-who em { white-space: normal; }
.ow-who { grid-area: who; justify-items: start; padding: 0; color: inherit; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.ow-row > .rq-why { grid-area: why; }
.ow-row > .rq-why .ui-chip { justify-self: start; }
.ow-pool-text { color: var(--ui-faint); font-size: 12px; font-weight: 700; }

/* 操作：抵扣（主）独占一行，安排补课 2/3 + 全部消课 1/3 */
.ow-act { grid-area: act; display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 4px; }
.ow-pool-btn { grid-column: 1 / -1; }

/* 欠课明细：原生 <details>，一堂一行，多了自己滚 */
.ow-more { grid-area: more; margin-top: 4px; border-top: 1px solid var(--ui-line-2); }
.ow-more summary { display: flex; align-items: center; gap: 6px; min-height: 36px; color: #c2410c; font-size: 12.5px; font-weight: 800; list-style: none; cursor: pointer; }
.ow-more summary::-webkit-details-marker { display: none; }
.ow-more summary::after { content: "▾"; font-size: 10px; }
.ow-more[open] summary::after { content: "▴"; }
.ow-list { display: grid; gap: 6px; max-height: 240px; margin: 4px 0 0; padding: 0; list-style: none; overflow-y: auto; }
.ow-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 8px; padding: 6px 8px; color: #9a3412; background: #fff7ed; border: 1px solid #fed7aa; border-radius: 8px; font-size: 12.5px; font-weight: 700; }
.ow-entry-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; overflow-wrap: anywhere; }
.ow-entry-main b { font-weight: 900; }
.ow-entry-main small { color: var(--ui-muted); font-size: 12px; font-weight: 700; }

/* ── ≥768：两栏卡片 ── */
@media (min-width: 768px) {
  .ow-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── ≥1024：表格 ── */
@media (min-width: 1024px) {
  .ow-head, .ow-row {
    grid-template-columns: 96px minmax(0, 1.3fr) minmax(0, 1.2fr) 400px;
    grid-template-areas: none;
    align-items: center;
    gap: 12px;
  }
  .ow-head {
    display: grid;
    padding: 0 12px 6px 16px;
    color: var(--ui-muted);
    border-bottom: 1px solid var(--ui-line);
    font-size: 11.5px;
    font-weight: 800;
  }
  .ow--nopool .ow-head, .ow--nopool .ow-row { grid-template-columns: 96px minmax(0, 1fr) 400px; }
  .ow-rows { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .ow-row > .ui-datetile, .ow-who, .ow-row > .rq-why, .ow-act, .ow-more { grid-area: auto; }
  .ow-row > .ui-datetile { grid-auto-flow: column; justify-content: center; align-items: baseline; justify-self: start; gap: 4px; padding: 4px 12px; }
  .ow-row > .ui-datetile b { font-size: 22px; }
  .ow-act { display: flex; justify-content: flex-end; margin-top: 0; }
  .ow-act .ui-btn { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
  .ow-more { grid-column: 1 / -1; margin-top: 0; }
}

/* ======================================================================
   HOLIDAYS (hd-) — 假期管理（ui-classroom.js renderHolidaysTab / _paintHolidays）
   · 骨架沿用共用层：ui-card / ui-fchips（年份）/ ui-btn / ui-chip / ui-icon / ui-datetile / ui-select；
     「这年放了几天」一行沿用 ow-sum 的样式。
   · 新增表单、导入公共假期各收进一个 <details>，默认收起，列表才是主角（按月分组，日期小块）。
   ====================================================================== */
.hd { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 40px; color: var(--ui-ink); }
.hd-card { display: grid; gap: 12px; }
#hd-body { display: grid; gap: 12px; }

/* 展开面板：summary 长得像按钮，手机整行宽 */
.hd-panel > summary { display: flex; justify-content: center; list-style: none; cursor: pointer; }
.hd-panel > summary::-webkit-details-marker { display: none; }
.hd-panel[open] > summary { box-shadow: none; }
.hd-form, .hd-imp { display: grid; gap: 10px; padding: 12px 0 2px; }
.hd-f { display: grid; gap: 4px; min-width: 0; }
.hd-f > span { color: var(--ui-muted); font-size: 11.5px; font-weight: 800; }
.hd-f input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  color: var(--ui-ink);
  background: var(--ui-surface);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  font: inherit;
  font-size: 16px;          /* 16px 防 iOS 聚焦时缩放 */
  font-weight: 700;
  outline: none;
}
.hd-f input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.hd-hint { margin: 0; color: var(--ui-muted); font-size: 12px; font-weight: 600; line-height: 1.5; }

/* 导入公共假期：一行一个，勾选；已添加的灰掉 */
.hd-pubs { display: grid; gap: 4px; max-height: 360px; margin: 0; padding: 0; list-style: none; overflow-y: auto; }
.hd-pub { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 2px 8px; background: var(--ui-sunken); border: 1px solid var(--ui-line-2); border-radius: 8px; }
.hd-pub label { display: flex; align-items: center; flex: 1 1 auto; gap: 8px; min-width: 0; min-height: 40px; font-size: 13px; font-weight: 700; cursor: pointer; }
.hd-pub input { flex: 0 0 auto; width: 20px; height: 20px; accent-color: var(--accent); }
.hd-pub b { min-width: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.hd-pub small { min-width: 26px; white-space: nowrap; color: var(--ui-muted); font-size: 11.5px; font-weight: 700; }
.hd-pub span { min-width: 0; overflow-wrap: anywhere; }
.hd-pub .ui-chip { flex: 0 0 auto; }
.hd-pub.is-done { opacity: .6; }
.hd-imp .ui-btn[disabled] { opacity: .5; cursor: not-allowed; }
.hd-imp .ui-btn b { margin-left: 4px; font-variant-numeric: tabular-nums; }

/* 分月列表 */
.hd-month h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--ui-ink-2); font-size: 13px; font-weight: 900; }
.hd-month h3 small { padding: 0 7px; color: var(--ui-muted); background: var(--ui-line-2); border-radius: 99px; font-size: 11px; font-weight: 800; }
.hd-rows { display: grid; gap: 6px; }
.hd-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
}
.hd-row.is-past { border-left-color: #cbd5e1; opacity: .7; }
.hd-name { min-width: 0; }
.hd-name b { font-size: 14.5px; font-weight: 900; overflow-wrap: anywhere; }

@media (min-width: 768px) {
  .hd-panel > summary { display: inline-flex; width: auto; }
  .hd-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hd-f--wide, .hd-form .ui-btn { grid-column: 1 / -1; }
  .hd-form .ui-btn { justify-self: start; }
  .hd-imp .ui-select { max-width: 260px; }
  .hd-imp > .ui-btn { justify-self: start; }
  .hd-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .hd-rows { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ======================================================================
   ATTENDANCE HISTORY (ah-) — 班级考勤记录（ui-classroom.js openClassAttendanceHistory / _paintAttHistory）
   · 手机：全屏面板（返回键 + 班名）；≥768：居中弹窗。
   · 骨架沿用共用层：ui-card / ui-fchip（分页、月份）/ ui-chip（状态）/ ui-datetile / ui-search / ui-icon / ui-empty。
   · 每个学生一行，同一份 HTML：手机用 grid-template-areas 排成两行小卡，≥768 排成带表头的整行。
   ====================================================================== */
html.ah-lock { overflow: hidden; }
.ah { position: fixed; inset: 0; z-index: 9999; display: flex; justify-content: center; background: rgba(15, 23, 42, .55); }
.ah-sheet { display: flex; flex-direction: column; width: 100%; min-width: 0; color: var(--ui-ink); background: var(--ui-sunken); }
.ah-head { display: flex; align-items: center; gap: 10px; padding: max(10px, env(safe-area-inset-top)) 14px 10px; background: var(--ui-surface); border-bottom: 1px solid var(--ui-line); }
.ah-head .ui-icon { flex: 0 0 auto; width: 40px; height: 40px; }
.ah-title { min-width: 0; }
.ah-title h3 { margin: 0; font-size: 16px; font-weight: 900; }
.ah-title p { margin: 0; overflow: hidden; color: var(--accent); font-size: 12.5px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.ah-body { display: grid; flex: 1; grid-auto-rows: max-content; align-content: start; gap: 12px; padding: 12px 14px calc(24px + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain; }
.ah-body > * { min-width: 0; }
.ah-days { display: grid; gap: 12px; }

/* 一天一张卡：日期小块 + 各状态人数 */
.ah-day { display: grid; gap: 10px; padding: 12px; }
.ah-day-head { display: flex; align-items: center; gap: 10px; }
.ah-day-head .ui-datetile { flex: 0 0 64px; }
.ah-day-sum { display: flex; flex-wrap: wrap; gap: 4px; min-width: 0; }
.ah-rows { display: grid; }

/* 学生行（手机） */
.ah-row, .ah-sr {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  grid-template-areas: "who who who pts" "st un . pts";
  align-items: center;
  gap: 6px 8px;
  padding: 9px 0;
  border-top: 1px solid var(--ui-line-2);
}
.ah-row--head, .ah-sr--head { display: none; }
.ah-who { grid-area: who; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.ah-who b { font-weight: 800; }
.ah-who em { color: var(--accent); font-size: 12.5px; font-style: normal; font-weight: 800; }
.ah-st { grid-area: st; }
.ah-un { grid-area: un; }
.ah-dash { color: var(--ui-faint); font-weight: 800; }
.ah-pts { grid-area: pts; justify-self: end; color: var(--ui-faint); font-size: 14px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ah-pts.is-pos { color: #059669; }
.ah-pts.is-neg { color: #dc2626; }
.ah-row--head > span, .ah-sr--head > span { color: var(--ui-muted); font-size: 11px; font-weight: 800; }

/* 汇总行（手机）：姓名 + 金币 + 出勤率一行，四个数字一行 */
.ah-sum { padding-top: 4px; padding-bottom: 4px; }
.ah-sr { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: "who who pts rate" "p l v a"; }
.ah-sr[hidden], .ah-none[hidden] { display: none; }
.ah-rate { grid-area: rate; justify-self: end; }
.ah-n { display: grid; justify-items: center; gap: 1px; padding: 4px 2px; background: var(--ui-sunken); border-radius: 8px; }
.ah-n i { color: var(--ui-muted); font-size: 10.5px; font-style: normal; font-weight: 800; }
.ah-n b { font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.ah-n--present { grid-area: p; } .ah-n--late { grid-area: l; } .ah-n--leave { grid-area: v; } .ah-n--absent { grid-area: a; }
.ah-n--present b { color: #15803d; } .ah-n--late b { color: #854d0e; } .ah-n--leave b { color: #1e40af; } .ah-n--absent b { color: #991b1b; }
.ah-n.is-zero b { color: #cbd5e1; }
.ah-note { margin: 0; color: var(--ui-faint); font-size: 11.5px; font-weight: 600; text-align: center; }

@media (min-width: 768px) {
  .ah { align-items: center; padding: 24px; }
  .ah-sheet { max-width: 760px; max-height: 88vh; overflow: hidden; border-radius: 20px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
  .ah-body { padding: 16px 20px 24px; }
  .ah-row, .ah-row--head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px 84px 64px;
    grid-template-areas: "who st un pts";
    gap: 8px;
    padding: 8px 0;
  }
  .ah-row--head { padding-top: 0; border-top: 0; }
  .ah-row--head > span:last-child, .ah-sr--head > span:nth-child(2) { justify-self: end; }
  .ah-sr, .ah-sr--head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px 70px repeat(4, 52px);
    grid-template-areas: "who pts rate p l v a";
    gap: 8px;
    padding: 8px 0;
  }
  .ah-sr--head { padding-top: 0; border-top: 0; }
  .ah-sr--head > span:nth-child(n + 3) { justify-self: center; }
  .ah-rate { justify-self: center; }
  .ah-n { padding: 0; background: none; }
  .ah-n i { display: none; }
}

/* ======================================================================
   APP HEADER — 顶栏（index.html <header class="content-header">）
   · 顶栏 HTML 不写内联样式，所有尺寸都在这里；平板/桌面窄屏的调整在后面各自的断点里，
     手机（≤767）是一行式 app bar，见本文件「APP HEADER — phone」一节。
   · 标题/按钮的英文在 .hdr-en 里（console-ui.js setPageTitle / updateSidebarLanguage）：
     桌面显示成「中文 (English)」，手机标题排成两行、按钮只留图标。
   · #hdr-more（新生登记 / 登记链接 / 刷新）：≥768 用 display:contents 拆开照旧排在顶栏，手机是「⋯」下拉。
   ====================================================================== */
.content-header {
  height: 80px;
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  flex-shrink: 0;
  overflow: visible;
}
.content-header-main {
  display: flex;
  align-items: center;
  gap: 15px;
  height: 100%;
  min-width: 0;
  flex: 1 1 auto;
  overflow: visible;
}
.content-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
  white-space: nowrap;
  flex-shrink: 0;
}
.mobile-logo { display: none; width: 32px; height: 32px; border-radius: 8px; }
#org-switcher-container { flex-shrink: 0; }
.hdr-en::before { content: " ("; }
.hdr-en::after { content: ")"; }

.header-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
  flex-wrap: nowrap;
}
#current-time {
  flex-shrink: 0;
  padding: 6px 12px;
  color: #0f172a;
  background: #f1f5f9;
  border-radius: 8px;
  font-family: monospace;
  font-weight: bold;
  white-space: nowrap;
}
.header-action-btn {
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  color: #475569;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}
.header-action-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.header-action-btn--primary { color: white; background: #0f172a; border: none; }
.header-action-btn--primary:hover { background: #0f172a; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15); }
.header-action-btn:active { transform: scale(0.98); }
.header-action-btn:focus-visible,
.header-reload:focus-visible,
.hdr-more-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.header-action-icon { display: inline-flex; align-items: center; }
#reg-invite-badge {
  display: none;                /* console.js loadPendingRegistrations 写行内 display:flex/none */
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  align-items: center;
  justify-content: center;
  color: white;
  background: #ef4444;
  border-radius: 9px;
  font-size: 10px;
  font-weight: 900;
}
.header-reload {
  order: 1;                     /* 在 #hdr-more 里，但桌面/平板要排在最右边（快速开单之后） */
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: #f1f5f9;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
}
.header-reload:active { transform: scale(0.9); }
.header-reload-label { display: none; }
/* ≥768：「更多」整组拆开，按钮直接当 .header-tools 的 flex 子项 */
.hdr-more,
.hdr-more-menu { display: contents; }
.hdr-more-btn { display: none; }

/* Header nav tabs absorb the squeeze and scroll instead of pushing the toolbar.
   Hide the scrollbar chrome (functionality kept). */
#header-tabs { scrollbar-width: none; -ms-overflow-style: none; }
#header-tabs::-webkit-scrollbar { display: none; }

/* Mid-width desktop: when space gets tight, collapse the header action
   buttons to icon-only (keep tooltip via title=) so labels never wrap/stack.
   Starts at 1025px — at/below 1024px the tablet layout takes over with its
   own full-width action row, so this desktop-header rule must not overlap it. */
@media screen and (min-width: 1025px) and (max-width: 1200px) {
  .header-action-btn .header-action-label { display: none; }
  .header-action-btn { padding: 10px 12px !important; gap: 0 !important; }
  .header-action-btn .header-action-icon { font-size: 16px; line-height: 1; }
}

#content-body {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

/* ── Global Badge / Pill System ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: var(--badge-py) var(--badge-px);
  border-radius: var(--badge-radius);
  font-size: var(--badge-fs);
  font-weight: var(--badge-fw);
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-green  { color: #065f46; background: #d1fae5; border-color: #86efac; }
.badge-red    { color: #991b1b; background: #fee2e2; border-color: #fca5a5; }
.badge-yellow { color: #92400e; background: #fef3c7; border-color: #fde68a; }
.badge-blue   { color: #1e40af; background: #dbeafe; border-color: #93c5fd; }
.badge-gray   { color: #475569; background: #f1f5f9; border-color: #e2e8f0; }
.badge-purple { color: #3730a3; background: #ede9fe; border-color: #c4b5fd; }

/* ── Table Header Consistent ── */
.th-label {
  font-size: var(--text-xs);
  font-weight: var(--fw-black);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ── Card Section Title ── */
.section-title {
  font-size: var(--text-md);
  font-weight: var(--fw-black);
  color: var(--text-main);
  margin: 0 0 var(--sp-4);
}

/* ── Meta Text (timestamp, secondary info) ── */
.text-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: var(--fw-semi);
}

/* Common Components */
.card {
  background: var(--card-bg);
  border: var(--border-width) solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0,0,0,0.05);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 24px;
  background: white;
  border-radius: var(--radius);
  border: var(--border-width) solid var(--border);
}

.stat-val {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

.btn-icon {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: #f1f5f9;
}

.btn-icon:active {
  transform: scale(0.9);
}

/* Rule Chips (出题模块选择器) */
.rule-chip {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: border-color 0.15s, background 0.15s, color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.rule-chip:hover {
  border-color: var(--accent);
  background: #eef2ff;
  color: var(--accent);
}

.rule-chip.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.rule-chip.selected:hover {
  background: #4f46e5;
  border-color: #4f46e5;
}

.rule-chip:active {
  transform: scale(0.95);
}

/* Generator UI Specifics */
.gen-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.control-group {
  margin-bottom: 20px;
}

.control-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text-main);
}

select, input {
  width: 100%;
  padding: 12px 16px;
  border: var(--border-width) solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s;
}

select:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

select:focus, input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.primary-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, opacity 0.2s;
}

.primary-btn:active {
  transform: scale(0.98);
}

.primary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.primary-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.secondary-btn {
  background: white;
  color: var(--text-muted);
  border: 2px solid var(--border);
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.2s, color 0.2s;
}

.secondary-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
  background: #f8fafc;
}

.secondary-btn:active {
  transform: scale(0.98);
}

.secondary-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn:focus-visible {
  outline: 2px solid var(--text-muted);
  outline-offset: 3px;
}

.danger-btn {
  background: #ef4444;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s, background-color 0.2s, opacity 0.2s;
}

.danger-btn:hover {
  background-color: #dc2626;
}

.danger-btn:active {
  transform: scale(0.98);
}

.danger-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.danger-btn:focus-visible {
  outline: 2px solid #ef4444;
  outline-offset: 3px;
}

/* Table Enhancements */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.table-row-hover:hover {
  background-color: #f8fafc !important;
}

.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 12px;
  border-bottom: 2px solid #e2e8f0;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  padding: 32px;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.9; }
}

@keyframes popUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes skeletonShimmer {
  0% { opacity: 1; }
  50% { opacity: 0.45; }
  100% { opacity: 1; }
}

.skeleton-pulse {
  animation: skeletonShimmer 1.4s ease-in-out infinite;
}

/* Top-level two-column page layouts (Reward Center, Homework, Classroom,
   Announcements, etc.). min-width:0 lets grid tracks shrink instead of
   forcing horizontal overflow. */
.reward-two-col > *,
.page-two-col > * { min-width: 0; }

/* Mobile Responsiveness */
/* Phone + portrait-tablet base. Touch tablets share these touch-target and
   card fallbacks up to 1500px; the final landscape-tablet block restores the
   rail/header/table presentation for landscape. A single 1500px upper bound
   prevents the old 1366–1500px hybrid from becoming a third tablet layout. */
@media screen and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1500px) and (pointer: coarse) {
  :root {
    --sidebar-width: 100%;
  }

  #console-app {
    flex-direction: column;
    overflow: auto;
  }

  .sidebar {
    width: 100%;
    position: fixed;
    top: 0;
    left: -100%;
    height: 100vh;
    height: 100dvh;   /* see body{} above — matters even more here since the
                          footer (profile card, 改密/登出) sits at the bottom
                          of this box; a too-tall 100vh pushed it past the
                          real visible area on real devices. */
    transition: left 0.3s ease;
    padding-top: 80px;
    box-shadow: 10px 0 30px rgba(0,0,0,0.2);
    overflow-y: auto;
  }

  .sidebar.mobile-active {
    left: 0;
  }

  .sidebar .brand {
    display: none; /* Hide brand in mobile sidebar as it's in header */
  }

  .main-content {
    /* Fixed header is now two rows on mobile: title row + the restored
       quick-action toolbar row (~52px each). Clear both so page content
       never tucks under the header. */
    margin-top: 118px;
    height: auto;
    overflow: visible;
  }

  /* Tabs now live in their own in-document sub-nav row (#header-tabs-bar)
     below the fixed header, so they flow normally and need no extra header
     offset. Give the bar compact mobile padding aligned to the content gutter. */
  #header-tabs-bar {
    padding: 8px 12px;
  }

  .content-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 101;
    padding: 0 12px;
    min-height: 64px;        /* grow when the tab strip wraps to a 2nd row */
    height: auto;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-bottom: none;
    flex-wrap: wrap;         /* let the quick-action toolbar drop to its own row */
    padding-bottom: 6px;
  }

  .mobile-logo {
    display: block;
  }

  .content-header h1 {
    font-size: 16px;
    font-weight: 900;
  }

  .mobile-menu-btn {
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    border: none;
    width: 44px;
    min-width: 44px;      /* 横屏标题长时 flex 会把它压到 32~39px */
    flex-shrink: 0;
    height: 44px;
    border-radius: 12px;
    font-size: 18px;
    cursor: pointer;
    color: #0f172a;
  }

  .header-tools {
    display: none !important; /* Hide tools in header on mobile to save space */
  }

  #content-body {
    padding: 16px;
    overflow-y: visible;
    margin-top: 10px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .gen-controls {
    grid-template-columns: 1fr;
  }

  /* Reward Center: stack the students list and change history vertically on
     phones instead of two side-by-side columns (prevents horizontal overflow). */
  .reward-two-col,
  .page-two-col,
  .worksheet-grid,
  .responsive-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }

  /* Let the search input flow to full card width on phones. */
  .reward-search-wrap {
    width: 100%;
  }
  .reward-search-input {
    width: 100% !important;
  }

  .modal {
    width: 95%;
    padding: 20px;
  }

  .header-tools {
    gap: 10px;
    font-size: 12px;
  }

  /* Responsive Table to Card View */
  .data-table, .data-table thead, .data-table tbody, .data-table th, .data-table td, .data-table tr {
    display: block;
  }
  .data-table thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }
  .data-table tr {
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
    border-radius: 14px;
    background: white;
    padding: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
  }
  .data-table td {
    border: none;
    position: relative;
    padding-left: 50% !important;
    text-align: right !important;
    padding-top: 10px !important;
    padding-bottom: 10px !important;
    min-height: 40px;
  }
  .data-table td:before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: 800;
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
  }
  .data-table td:first-child {
    padding-left: 12px !important;
    text-align: left !important;
    background: #f8fafc;
    border-radius: 10px;
    margin-bottom: 10px;
  }
  .data-table td:first-child:before {
    content: none;
  }

  /* Sidebar Overlay Logic */
  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 99; /* Just below sidebar */
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }

  .sidebar.mobile-active ~ .sidebar-overlay {
    display: block;
    opacity: 1;
  }

  /* ----------------------------------------------------------------
     Mobile Header Tabs - Segmented Pill Control
     ----------------------------------------------------------------
     On phone width the desktop underline tabs were crammed beside the
     title and clipped off-screen. We restyle them as a touch-first
     segmented control: an inset track on its own full-width row beneath
     the title, with a raised brand-indigo pill on the active tab,
     comfortable 40px tap targets, momentum scroll + scroll-snap, and a
     right-edge fade hinting there's more to swipe.
     ---------------------------------------------------------------- */
  .content-header > div:first-child {
    flex-wrap: wrap;          /* let the tab strip drop to its own line */
    gap: 8px 10px;
    min-width: 0;
    flex: 1 1 100%;
    height: auto;
    padding: 8px 0 10px;
  }

  .content-header h1#page-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* The strip: full-width inset track, horizontally scrollable.
     A two-sided edge fade signals "this scrolls" rather than "this is
     clipped": content dissolves into the track on whichever side has more
     to reveal. We animate the mask via a CSS var the strip can't set
     itself, so we use a symmetric fade that reads as a scroller. */
  #header-tabs {
    margin-left: 0 !important;
    gap: 2px !important;                      /* tighter so more peeks through */
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    height: auto !important;
    padding: 4px !important;
    background: #eef2f7 !important;           /* inset track */
    border-radius: 14px !important;
    box-shadow: inset 0 1px 2px rgba(15,23,42,0.07) !important;
    overflow-x: auto !important;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;       /* iOS momentum */
    scroll-snap-type: x proximity;
    scrollbar-width: none;                   /* Firefox */
    /* Symmetric edge fade — wider on the right (36px) where the next tab
       peeks in, slim on the left (14px). Strongly hints horizontal scroll. */
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 36px), transparent 100%);
            mask-image: linear-gradient(to right, transparent 0, #000 14px, #000 calc(100% - 36px), transparent 100%);
  }
  #header-tabs::-webkit-scrollbar {
    display: none;                           /* Chrome/Safari */
  }

  /* Each tab becomes a pill segment */
  #header-tabs button {
    flex: 0 0 auto;
    scroll-snap-align: start;
    height: 40px !important;
    min-height: 40px;
    padding: 0 13px !important;              /* compact so the next tab shows */
    border-radius: 11px !important;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    background: transparent !important;
    transition: color .2s ease, background .25s ease, box-shadow .25s ease, transform .12s ease;
  }

  #header-tabs button:active {
    transform: scale(0.96);
  }

  /* Active segment: raised white pill with brand-indigo label */
  #header-tabs button.active {
    color: var(--accent) !important;
    font-weight: 800;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(15,23,42,0.10),
                0 0 0 1px rgba(99,102,241,0.10) !important;
  }

  /* Kill the desktop underline indicator on mobile - pill replaces it */
  #header-tabs button::after,
  #header-tabs button.active::after {
    display: none !important;
  }

  /* ================================================================
     MOBILE OPTIMIZATION PASS (CSS-only) — three friction fixes:
       1. Restore the top quick-action toolbar (点名/新生登记/快速开单/刷新)
       2. Comfortable 44px touch targets for in-table action buttons
       3. Cleaner card-transform readability for data tables
     Layered as overrides on the existing mobile base; no markup change.
     ================================================================ */

  /* ── 1. Restore header quick-actions as a swipeable action row ──
     Desktop hides .header-tools to save space; phones need 点名/开单/
     登记 daily. Re-show it as its own full-width horizontally-scroll
     row beneath the title — mirrors the tab-strip pattern so it reads
     as native. The live clock is dropped (noise on a phone). */
  .header-tools {
    display: flex !important;
    flex: 1 1 100%;
    width: 100%;
    order: 3;                      /* title row, tab strip, then tools */
    gap: 8px !important;
    margin-top: 2px;
    padding: 2px 0 4px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    flex-wrap: nowrap !important;
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
            mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent 100%);
  }
  .header-tools::-webkit-scrollbar { display: none; }

  /* Live clock is dead weight on a phone — hide it, keep the buttons. */
  #current-time { display: none !important; }

  /* Each quick-action: touch-first pill, full label kept for clarity. */
  .header-tools .header-action-btn {
    flex: 0 0 auto;
    scroll-snap-align: start;
    height: 44px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    font-size: 13px;
    white-space: nowrap;
  }
  .header-tools .header-action-btn:active { transform: scale(0.97); }

  /* Reload icon button: keep it square + thumb-sized, not stretched. */
  .header-tools .header-reload {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    scroll-snap-align: start;
  }

  /* ── 2. Bigger tap targets inside the card-transformed tables ──
     In-row action buttons are 11px/5px on desktop — fine with a mouse,
     a miss-fest with a thumb. Bump every button that lands in a table
     cell to a 40px tall, comfortably-padded pill, and let the action
     cluster wrap full-width and left-align (the cell is right-aligned
     by the card transform, which crushes a button row). */
  .data-table td button {
    min-height: 44px !important;
    padding: 9px 16px !important;
    font-size: 13px !important;
    border-radius: 10px !important;
  }
  /* The action cell holds a flex cluster of buttons — give it room. */
  .data-table td[data-label] > div {
    justify-content: flex-end;
    gap: 8px !important;
    flex-wrap: wrap;
  }
  /* Action cell: drop the 50% label gutter so buttons get full width. */
  .data-table td:last-child {
    padding-left: 12px !important;
    padding-top: 12px !important;
    text-align: left !important;
  }
  .data-table td:last-child:before {
    position: static;
    display: block;
    width: auto;
    margin-bottom: 8px;
  }

  /* ── 3. Card-transform readability polish ──
     More breathing room between label/value, a soft divider per field,
     and a stronger header row so each card reads as a tidy record. */
  .data-table tr {
    padding: 14px !important;
    margin-bottom: 16px !important;
    box-shadow: 0 4px 14px rgba(15,23,42,0.05) !important;
    border: 1px solid #e9eef4 !important;
  }
  .data-table td {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 4px !important;
    padding-left: 4px !important;
    text-align: right !important;
    border-bottom: 1px solid #f1f5f9 !important;
    min-height: 44px;
  }
  .data-table td:last-child { border-bottom: none !important; }
  .data-table td:before {
    position: static !important;
    width: auto !important;
    flex: 0 0 auto;
    padding-right: 0 !important;
    font-size: 11px;
  }
  .data-table td:first-child {
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    padding: 12px 12px !important;
    margin-bottom: 6px;
    border-bottom: none !important;
    justify-content: flex-start;
  }

  /* ================================================================
     MOBILE FORM PASS (CSS-only) — the modals (编辑学生/开班/开单…) are
     dense desktop grids that never reflow on a phone. Fixes:
       1. Collapse every inline `1fr 1fr(…)` form grid to a single column
       2. 16px input font (kills Android/iOS tap-zoom) + roomier tap height
       3. Stack the side-by-side time-select pairs in class modals
       4. Single-column student checklist (was cramped 2-col)
     Selectors target inline-styled markup by attribute, not :has() — old
     Android webviews silently drop :has() (see css_has_webview_pitfall).
     ================================================================ */

  /* ── 1. Collapse dense two/three-column form grids ──
     These are inline `grid-template-columns: 1fr 1fr` on .form-group / plain
     divs inside modals; attribute match + !important beats the inline value. */
  .modal [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  /* ── 2. Bigger, tap-friendly inputs; 16px stops mobile focus-zoom ──
     Covers both class-styled inputs and the many inline-styled ones. */
  .modal input,
  .modal select,
  .modal textarea {
    font-size: 16px !important;
    padding: 12px 14px !important;
    border-radius: 12px !important;
    min-height: 48px;
    box-sizing: border-box;
  }
  .modal input[type="radio"],
  .modal input[type="checkbox"] {
    min-height: 0;                 /* don't inflate hidden/radio inputs */
    padding: 0 !important;         /* ...and don't pad them either — a visually
                                      hidden radio (.exam-seg) would otherwise
                                      grow into an invisible block over the label */
  }
  .modal label {
    font-size: 13px;
  }
  /* Roomy title/close spacing on a phone-sized modal. */
  .modal h2 {
    font-size: 18px !important;
    line-height: 1.3;
  }

  /* ── 3. Stack the time-start / "-" / time-end row (add/edit class) ──
     It's an inline `display:flex` wrapper holding two selects + a dash. */
  #ac-time-start, #ac-time-end,
  #ec-time-start, #ec-time-end {
    width: 100% !important;
    flex: 1 1 100% !important;
  }
  .modal .form-group > div[style*="display:flex"],
  .modal .form-group > div[style*="display: flex"] {
    flex-wrap: wrap;
    gap: 8px !important;
  }

  /* ── 4. Student pick-lists: one column, taller scroll area ──
     #ac-student-list / #ec-student-list are inline 2-col grids. */
  #ac-student-list,
  #ec-student-list {
    grid-template-columns: 1fr !important;
    max-height: 44vh !important;
  }

  /* Sticky modal action bar so 取消/保存 stay reachable without scrolling
     to the very bottom of a long form. */
  .modal .modal-actions {
    position: sticky;
    bottom: -20px;                 /* modal has 20px mobile padding */
    background: white;
    margin: 20px -20px -20px;
    padding: 14px 20px;
    border-top: 1px solid #eef2f7;
    box-shadow: 0 -6px 18px rgba(15,23,42,0.06);
    z-index: 2;
  }
  .modal .modal-actions button {
    min-height: 48px;
    flex: 1 1 auto;                /* full-width, easy-to-hit action buttons */
  }

  /* ================================================================
     JS-BUILT INVOICE MODAL (渐进式学生账单) — this one isn't a `.modal`;
     ui-invoices.js hand-builds the overlay + a fixed-width inner card
     with inline styles, so the rules above don't reach it. Its one real
     phone breakage is the line-item row: an inline 6-column grid
     (140px 1fr 70px 100px 90px 40px ≈ 440px of fixed track) that
     overflows a 390px screen and drags the whole modal off the left
     edge. Reflow that row to a 2-column mini-grid; label the cells so
     they read stacked. Class hooks already exist — no JS change.
     ================================================================ */
  .stubill-item-row {
    grid-template-columns: 1fr 1fr !important;  /* was 140px 1fr 70px… */
    gap: 10px !important;
    row-gap: 8px !important;
    padding: 12px !important;
  }
  /* Source-type picker + the item/preset picker each span the full row. */
  .stubill-item-row > div:nth-child(1),
  .stubill-item-row > div:nth-child(2) {
    grid-column: 1 / -1;
  }
  /* Qty / unit-price / subtotal / delete share the two columns below. */
  .stubill-item-row select,
  .stubill-item-row input {
    font-size: 16px !important;                 /* no focus-zoom, bigger tap */
    padding: 11px 10px !important;
    min-height: 46px;
    box-sizing: border-box;
  }
  /* Delete (✕) cell: keep it compact, don't let it stretch a whole row. */
  .stubill-item-row > div:last-child {
    display: flex;
    justify-content: flex-end;
  }
  /* Year+month sub-picker inside the item cell already grids 2-up — fine. */

  /* ── 学校账单开单页的明细行（ui-school-billing.js）────────────────
     同 .stubill-item-row 的毛病：内联 5 栏 grid
     (1.6fr 110px 1.4fr 110px 36px ≈ 256px 固定轨) 在手机上挤成一条。
     改 2 栏：学生占满一行，项目/说明/金额/删除在下面分摊。表头在窄屏
     没意义（列对不上了），直接藏掉 —— 每格自己有 placeholder。 */
  .sb-line-head { display: none !important; }
  #sb-lines > div {
    grid-template-columns: 1fr 1fr !important;
    row-gap: 8px !important;
    padding: 12px !important;
  }
  #sb-lines > div > div:first-child {
    grid-column: 1 / -1;                        /* 学生姓名独占一行 */
  }
  #sb-lines > div select,
  #sb-lines > div input {
    font-size: 16px !important;                 /* 避免 iOS 聚焦缩放 */
    padding: 11px 10px !important;
    min-height: 46px;
    box-sizing: border-box;
  }
  #sb-lines > div > button:last-child {
    justify-self: end !important;
  }

  /* Hard stop any accidental horizontal overflow from a hand-built modal:
     the JS overlays use inline `display:flex` centering; clamp their inner
     card so nothing can bleed past the viewport on a phone. */
  #student-invoice-modal-overlay > div,
  #digital-invoice-overlay > div,
  #deposit-roster-overlay > div {
    width: 95vw !important;
    max-width: 95vw !important;
  }
  /* And prevent the payment sub-grid (support inline grid-template) collapsing
     weirdly — stack method + reference on their own rows. */
  #add-stubill-payment-container {
    grid-template-columns: 1fr !important;
  }

  /* ── 5. Touch-target backstop for in-page (non-modal, non-table) controls ──
     The passes above cover modals, header actions and in-table buttons. The
     remaining thumb-misses live in the page body: the small search boxes and
     filter selects that sit in a card header (e.g. the 7px-tall 搜索学生 input),
     and standalone icon buttons. Give every such control a comfortable tap
     height + 16px font (no iOS focus-zoom). Scoped to #content-body so it can't
     touch the header/tab/modal controls that already have bespoke sizing, and
     radio/checkbox are exempted so they don't inflate.
     (Applies across the whole phone+tablet range via the 1024px breakpoint.) */
  #content-body input:not([type="radio"]):not([type="checkbox"]),
  #content-body select,
  #content-body textarea {
    min-height: 44px;
    font-size: 16px;
    box-sizing: border-box;
  }
  /* Standalone icon buttons in the page body (not the ones already sized in a
     table cell or the header toolbar). */
  #content-body .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }
}

.mobile-menu-btn {
  display: none;
}

/* Header Tabs Underline Styles */
/* ── Desktop header tabs: segmented "inset track + raised white pill" ──
   Unifies with the mobile pill strip. A subtle inset track groups the tabs;
   the active tab is a raised white pill with an indigo label. The track is
   shrinkable + horizontally scrollable with a right-edge fade that signals
   "more tabs this way", so a long bilingual row never collides with the
   right-hand toolbar. (ui-ux-pro-max: nav-state-active, scroll-behavior,
   state-clarity, elevation-consistent, layout-shift-avoid) */
/* Full-width sub-nav row that hosts the tab track on its own line below the
   header. Aligns its left edge with the header content (40px gutter). */
#header-tabs-bar {
  flex-shrink: 0;
  padding: 10px 24px;
  background: white;
  border-bottom: 1px solid var(--border);
  /* 桌面窄屏时 tab 放不下 → 整条横向滚动，绝不裁切/挤爆（配 #header-tabs 内部滚动兜底）*/
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;       /* Firefox 隐藏滚动条 */
  -ms-overflow-style: none;
}
#header-tabs-bar::-webkit-scrollbar { display: none; }

#header-tabs {
  height: auto;
  display: inline-flex;        /* track 只跟 tab 一样宽；放不下时由父层 #header-tabs-bar 横向滚动 */
  align-items: center;
  gap: 4px;
  padding: 5px !important;
  background: #eef2f7 !important;            /* inset track */
  border: none !important;
  border-radius: 14px !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06) !important;
  white-space: nowrap;         /* tab 绝不换行 */
  scroll-snap-type: x proximity;
}

#header-tabs button {
  flex: 0 0 auto;
  scroll-snap-align: start;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 16px !important;
  height: 38px;
  font-size: 13.5px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  white-space: nowrap;
  border-radius: 10px !important;
  /* Animate color/background/shadow only — no layout-shifting transforms. */
  transition: color 0.2s ease, background 0.22s ease, box-shadow 0.22s ease;
}

#header-tabs button:hover {
  color: #1e293b !important;
  background: rgba(255, 255, 255, 0.6) !important;
  box-shadow: none !important;
  transform: none !important;
}

#header-tabs button.active,
#header-tabs button.active:hover {
  color: var(--accent) !important;
  font-weight: 800;
  background: #ffffff !important;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.10),
              0 0 0 1px rgba(99, 102, 241, 0.12) !important;
}

#header-tabs button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Retire the old underline indicator — the pill is the active affordance. */
#header-tabs button::after,
#header-tabs button.active::after {
  display: none !important;
}

#header-tabs::-webkit-scrollbar { display: none; }

@media (prefers-reduced-motion: reduce) {
  #header-tabs button { transition: none; }
}

/* ======================================================================
   INVENTORY (inv-) — 教具库存页（ui-inventory.js renderInventory）
   · 同一套设计语言：移动优先、一层卡片、共用 ui-*（工具条/搜索/筛选胶囊/下拉/按钮/状态标签）。
   · 视觉重点 = 缺货/待入库的筛选胶囊 + 每张卡上的库存数量格（− 数量 +）；其余安静。
   · 库存台账：手机一物品一张卡，≥768 两栏卡片，≥1280 同一批格子排成表格（列多，1024~1279 仍用卡片）。
     入库单记录 / 异动记录：≥1024 表格。每行独立 grid，列宽只用固定值或 fr，表头才对得齐。
   · 成本相关（采购价/利润/库房估值）只在 .inv--cost（owner / super_admin）里出现。
   ====================================================================== */
.inv { --inv-money-cols: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-bottom: 40px; color: var(--ui-ink); }
.inv--cost { --inv-money-cols: 3; }
.inv-pane { display: grid; gap: 12px; min-width: 0; }
.inv-pane[hidden] { display: none; }
.inv-card { display: grid; gap: 12px; }

/* 数字条 */
.inv-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.inv--cost .inv-kpi:first-child { grid-column: 1 / -1; }
.inv-kpi { display: grid; gap: 2px; min-width: 0; padding: 10px 12px; background: var(--ui-surface); border: 1px solid var(--ui-line); border-radius: 12px; }
.inv-kpi span { color: var(--ui-muted); font-size: 11.5px; font-weight: 800; }
.inv-kpi b { font-size: 18px; font-weight: 900; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.inv-kpi small { margin-left: 4px; color: var(--ui-faint); font-size: 12px; font-weight: 700; }

/* 搜索 + 登记按钮 + 下拉 */
.inv-add { flex: 0 0 auto; min-width: 44px; padding: 0 12px; }
.inv-add > span { display: none; }
.inv-selects { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }

.inv-head, .inv-po-head, .inv-mv-head { display: none; }
.inv-rows, .inv-po-rows, .inv-mv-rows { display: grid; gap: 8px; align-items: start; }

/* ── 库存台账：一物品一张卡，固定四行（名称 / 库存 / 价格 / 操作）── */
.inv-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "nm pts" "stock stock" "money money" "act act";
  align-items: start;
  gap: 8px 10px;
  padding: 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 4px solid #cbd5e1;
  border-radius: 12px;
}
.inv-row[hidden] { display: none; }
.inv-row[data-low="1"]  { border-left-color: #ef4444; }
.inv-row[data-owed="1"] { border-left-color: #d97706; }

.inv-nm { grid-area: nm; display: grid; gap: 4px; justify-items: start; min-width: 0; }
.inv-cat { --c: #64748b; display: inline-block; padding: 2px 8px; color: #fff; background: var(--c); border-radius: 6px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.inv-cat--Tuition     { --c: #2563eb; }
.inv-cat--Book        { --c: #f97316; }
.inv-cat--Assessment  { --c: #16a34a; }
.inv-cat--MockPaper   { --c: #dc2626; }
.inv-cat--Abacus      { --c: #9333ea; }
.inv-cat--Stationery  { --c: #a16207; }
.inv-cat--Uniform     { --c: #db2777; }
.inv-cat--Merchandise { --c: #64748b; }
.inv-cat--Gift        { --c: #0d9488; }
.inv-name { color: var(--ui-ink); font-size: 14.5px; font-weight: 800; overflow-wrap: anywhere; }
/* 名称本身就是「查领用 / 流水」的入口（跟下面的「领用/流水」按钮同一处），用虚线下划线提示可点 */
.inv-name--link { padding: 0; color: var(--ui-ink); background: none; border: 0; font: inherit; font-size: 14.5px; font-weight: 800; text-align: left; text-decoration: underline dotted #94a3b8; text-underline-offset: 4px; cursor: pointer; }
/* 手机/触控上 #content-body button 会把所有按钮撑到 44px；名称这类纯文字按钮不需要那么高 */
#content-body .inv-name--link, #content-body .inv-mv-item, #content-body .inv-mv-stu { min-height: 32px; }
.inv-name--link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.inv-pts { grid-area: pts; }

/* 库存数量格：− 数量 + ｜ 自定义数量 ｜ 入库 */
.inv-stock { grid-area: stock; display: grid; gap: 4px; min-width: 0; }
.inv-stock-ctrl { display: grid; grid-template-columns: auto auto auto minmax(44px, 1fr) auto; align-items: center; gap: 5px; }
.inv-step {
  display: grid;
  place-items: center;
  width: 38px;
  height: 40px;
  padding: 0;
  background: var(--ui-surface);
  border: 1px solid;
  border-radius: 10px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}
.inv-step--minus { color: #dc2626; border-color: #fca5a5; }
.inv-step--plus  { color: #059669; border-color: #6ee7b7; }
.inv-qty-badge { display: grid; place-items: center; min-width: 38px; height: 40px; padding: 0 8px; box-sizing: border-box; color: #16a34a; background: #f0fdf4; border: 1px solid #86efac; border-radius: 10px; font-size: 16px; font-weight: 900; font-variant-numeric: tabular-nums; }
.inv-qty-badge.low { color: #dc2626; background: #fef2f2; border-color: #fca5a5; }
/* 负库存 = 已发出但还没入库的欠账。用琥珀色跟「低库存」的红区分开。 */
.inv-qty-badge.negative { color: #b45309; background: #fffbeb; border-color: #fcd34d; }
.inv-qty-input { width: 100%; min-width: 0; height: 40px; padding: 0 4px; box-sizing: border-box; color: var(--ui-ink); background: var(--ui-surface); border: 1px solid #cbd5e1; border-radius: 10px; font: inherit; font-size: 16px; font-weight: 700; text-align: center; }
.inv-qty-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(99, 102, 241, .15); }
.inv-flag { font-size: 12px; font-weight: 800; }
.inv-flag:empty { display: none; }
.inv-flag--low  { color: #dc2626; }
.inv-flag--owed { color: #b45309; }

/* 价格格：手机一行三格（带小标签），≥1280 拆成表格列 */
.inv-money { grid-area: money; display: grid; grid-template-columns: repeat(var(--inv-money-cols), minmax(0, 1fr)); gap: 8px; padding-top: 8px; border-top: 1px solid var(--ui-line-2); }
.inv-cell { display: grid; gap: 1px; min-width: 0; }
.inv-cell small { color: var(--ui-muted); font-size: 11px; font-weight: 700; }
.inv-cell b { color: var(--ui-ink-2); font-size: 13px; white-space: nowrap; font-weight: 800; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.inv-cell--price b { color: var(--ui-ink); font-weight: 900; }
.inv-profit { color: #16a34a; }
.inv-margin { display: block; width: max-content; margin-top: 2px; padding: 0 5px; color: #16a34a; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 4px; font-size: 11px; font-style: normal; font-weight: 800; }

.inv-act { grid-area: act; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.inv-act .ui-btn { padding: 0 6px; }

/* ── 入库单记录 / 异动记录的说明条 ── */
.inv-banner { display: grid; gap: 10px; }
.inv-banner h3 { margin: 0; font-size: 15px; font-weight: 900; }
/* 说明文字手机上收起（占地方，且是常识），≥768 才显示 */
.inv-banner p { display: none; margin: 4px 0 0; color: var(--ui-muted); font-size: 12.5px; font-weight: 600; line-height: 1.5; }
.inv-skel { display: grid; gap: 8px; }
.inv-skel i { display: block; height: 56px; background: var(--ui-line-2); border-radius: 12px; }
.inv-card .ui-empty small { display: block; margin-top: 6px; font-weight: 600; line-height: 1.6; }

/* ── 入库单：一张单一张卡 ── */
.inv-po-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "no total" "sup date" "items items";
  gap: 4px 10px;
  width: 100%;
  padding: 12px;
  color: inherit;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 4px solid #6366f1;
  border-radius: 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.inv-po-no    { grid-area: no; color: #6366f1; font-family: monospace; font-size: 13px; font-weight: 800; overflow-wrap: anywhere; }
.inv-po-total { grid-area: total; color: #059669; font-family: monospace; font-size: 14px; font-weight: 900; text-align: right; }
.inv-po-sup   { grid-area: sup; font-size: 13.5px; font-weight: 800; overflow-wrap: anywhere; }
.inv-po-date  { grid-area: date; color: var(--ui-faint); font-size: 12px; font-weight: 700; text-align: right; white-space: nowrap; }
.inv-po-items { grid-area: items; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ui-muted); font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }

/* ── 异动记录：一笔一张卡 ── */
.inv-mv-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "item chg" "ref ba" "why why" "when by";
  align-items: start;
  gap: 4px 10px;
  padding: 10px 12px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-left: 4px solid #cbd5e1;
  border-radius: 12px;
}
.inv-mv-row[hidden] { display: none; }
.inv-mv-item { grid-area: item; justify-self: start; padding: 0; color: var(--ui-ink); background: none; border: 0; font: inherit; font-size: 14px; font-weight: 800; text-align: left; overflow-wrap: anywhere; cursor: pointer; }
.inv-mv-chg { grid-area: chg; justify-self: end; font-family: monospace; font-size: 18px; font-weight: 900; }
.inv-mv-chg.is-up { color: #059669; }
.inv-mv-chg.is-down { color: #dc2626; }
.inv-mv-ba { grid-area: ba; justify-self: end; color: var(--ui-ink-2); font-family: monospace; font-size: 13px; white-space: nowrap; }
.inv-mv-ba i { color: #cbd5e1; font-style: normal; }
.inv-mv-ba b { font-weight: 800; }
.inv-mv-ba b.is-neg { color: #b45309; }
.inv-mv-ref { grid-area: ref; display: grid; gap: 2px; justify-items: start; min-width: 0; }
.inv-mv-ref:empty { display: none; }
.inv-mv-stu { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 0; color: inherit; background: none; border: 0; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.inv-mv-stu b { font-weight: 800; text-decoration: underline; text-decoration-color: #cbd5e1; }
.inv-mv-stu em { color: #6366f1; font-size: 12px; font-style: normal; font-weight: 800; }
.inv-mv-none { color: #cbd5e1; }
.inv-mv-no { color: var(--ui-muted); font-family: monospace; font-size: 11.5px; font-weight: 700; }
.inv-mv-why { grid-area: why; display: grid; gap: 2px; justify-items: start; min-width: 0; }
.inv-mv-why small { color: var(--ui-faint); font-size: 11.5px; overflow-wrap: anywhere; }
.inv-mv-when, .inv-mv-by { color: var(--ui-muted); font-size: 12px; font-weight: 700; }
.inv-mv-when { grid-area: when; }
.inv-mv-by { grid-area: by; justify-self: end; overflow-wrap: anywhere; text-align: right; }

.inv-add:focus-visible, .inv-step:focus-visible, .inv-po-row:focus-visible, .inv-mv-item:focus-visible, .inv-mv-stu:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (hover: hover) {
  .inv-name--link:hover, .inv-mv-item:hover { color: var(--accent); }
  .inv-po-row:hover { background: var(--ui-sunken); }
}

/* ── ≥560：数字条一行三格；登记按钮露出字 ── */
@media (min-width: 560px) {
  .inv--cost .inv-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .inv--cost .inv-kpi:first-child { grid-column: auto; }
  .inv-add > span { display: inline-flex; }
  .inv-add { padding: 0 16px; }
}

/* ── ≥768：两栏卡片 ── */
@media (min-width: 768px) {
  .inv-rows, .inv-po-rows, .inv-mv-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inv-selects { grid-template-columns: repeat(2, minmax(0, 260px)); }
  .inv-banner { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 16px; }
  .inv-banner p { display: block; }
}

/* ── ≥1024：入库单、异动记录变表格 ── */
@media (min-width: 1024px) {
  .inv-po-head, .inv-po-row, .inv-mv-head, .inv-mv-row {
    align-items: center;
    gap: 12px;
  }
  .inv-po-head, .inv-po-row { grid-template-columns: 170px minmax(0, 1fr) minmax(0, 2fr) 120px 110px; grid-template-areas: none; }
  .inv-mv-head, .inv-mv-row { grid-template-columns: 150px minmax(0, 1.2fr) 70px 100px minmax(0, 1.4fr) minmax(0, 1fr) 110px; grid-template-areas: none; }
  .inv-po-head, .inv-mv-head {
    display: grid;
    padding: 0 12px 6px 16px;
    color: var(--ui-muted);
    border-bottom: 1px solid var(--ui-line);
    font-size: 11.5px;
    font-weight: 800;
  }
  .inv-po-rows, .inv-mv-rows { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .inv-po-no, .inv-po-total, .inv-po-sup, .inv-po-date, .inv-po-items,
  .inv-mv-item, .inv-mv-chg, .inv-mv-ba, .inv-mv-ref, .inv-mv-why, .inv-mv-when, .inv-mv-by { grid-area: auto; }
  .inv-po-total, .inv-po-date, .inv-mv-by { text-align: left; justify-self: start; }
  .inv-mv-chg, .inv-mv-ba { justify-self: center; }
  .inv-po-items { -webkit-line-clamp: 1; }
}

/* ── ≥1280：库存台账变表格（列最多，1280 以下用卡片，触控平板也更好点） ── */
@media (min-width: 1280px) {
  .inv-head, .inv-row {
    grid-template-columns: minmax(0, 1.5fr) 262px 96px 76px 210px;
    grid-template-areas: none;
    align-items: center;
    gap: 12px;
  }
  .inv--cost .inv-head, .inv--cost .inv-row { grid-template-columns: minmax(0, 1.5fr) 262px 90px 96px 104px 76px 210px; }
  .inv-head {
    display: grid;
    padding: 0 12px 6px 16px;
    color: var(--ui-muted);
    border-bottom: 1px solid var(--ui-line);
    font-size: 11.5px;
    font-weight: 800;
  }
  .inv-rows { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .inv-row { padding: 10px 12px; }
  .inv-nm, .inv-stock, .inv-pts, .inv-act { grid-area: auto; }
  .inv-money { display: contents; }
  .inv-cell small { display: none; }
  .inv-pts { justify-self: start; }
  .inv-act { justify-content: end; grid-auto-columns: auto; }
}

/* ── 宽表格桌面窄屏兜底 ──────────────────────────────────────────
   桌面(≥1025px 鼠标笔记本)不触发「表格→card」响应式，宽表列多时原本
   width:100% 会把列挤压/最后一列被切。给 .data-table 套一层 .table-scroll
   容器(渲染时包裹)即可横向滚动；这里只定义容器与最小宽度，绝不改全局 .card。
   触控平板/手机(≤1366 coarse / ≤1024)走 card 布局，min-width 在那里被重置。 */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
@media screen and (min-width: 1025px) {
  .table-scroll > .data-table { min-width: 780px; }
}
@media screen and (max-width: 1024px), screen and (min-width: 1025px) and (max-width: 1500px) and (pointer: coarse) {
  .table-scroll > .data-table { min-width: 0; }  /* card 布局区间：取消最小宽度 */
}

/* ── 班级卡操作条 ─────────────────────────────────────────────
   原本 5 个按钮各自内联硬编码一种颜色(绿/紫/蓝/靛/红)且全 flex:1 平分，
   彩虹一排、主次不分，窄屏还会把文字挤断行。改为按重要性分级：
   「点名」是老师每天要按的 → 唯一实心主色；加学生/考勤/编辑 → 统一描边；
   解散是危险操作 → 淡红描边(不抢眼但可辨识)并用 margin-left:auto 推到右侧，
   与常用操作拉开距离，避免误点。颜色一律取自既有 token，不新造色值。 */
.cls-actions      { display: flex; gap: 6px; padding-top: 10px; flex-wrap: wrap; align-items: center; }
.cls-btn          { font-size: 11px; font-weight: 700; padding: 7px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; transition: background-color .18s, border-color .18s, color .18s; }
.cls-btn.is-main  { background: var(--accent); color: #fff; border: 1px solid var(--accent); }
.cls-btn.is-main:hover  { filter: brightness(1.08); }
.cls-btn.is-sub   { background: #fff; color: #475569; border: 1px solid #cbd5e1; }
.cls-btn.is-sub:hover   { background: #f8fafc; border-color: #94a3b8; color: #1e293b; }
/* 用固定留白而非 margin-left:auto 与常用键拉开：auto 在按钮换行后会失效，
   反而把「解散」甩到下一行最左边（比不分离更糟）。固定留白换不换行都成立。 */
.cls-btn.is-danger      { background: #fff; color: #ef4444; border: 1px solid #fecaca; margin-left: 14px; }
.cls-btn.is-danger:hover{ background: #fef2f2; border-color: #ef4444; }
.cls-btn:active   { transform: scale(0.97); }
/* 手机窄屏：两个一行均分。min-width:0 必须给 —— flex 项默认 min-width:auto，
   配上按钮里的 nowrap 文字会拒绝收缩，导致按钮撑破卡片被切掉右边。
   解散在窄屏取消左留白，否则它那一行会被挤出容器。 */
@media screen and (max-width: 560px) {
  .cls-btn            { flex: 1 1 calc(50% - 3px); min-width: 0; justify-content: center; overflow: hidden; text-overflow: ellipsis; }
  .cls-btn.is-danger  { margin-left: 0; }
}

/* ── 点名弹窗：手机紧凑布局 ─────────────────────────────────────
   点名表是 .data-table，手机上被全局「表格→card」规则拆成每个 td 独占一行
   （姓名/制服/状态/换班 共 4 段），一个学生就撑满整屏，老师要滚很久才点得完
   一个班。这里只针对 .attendance-table 覆写。
   目标是「一屏约 3 个学生」——不是塞得越多越好：留足行距与 44px 触控区，
   老师单手点名不会误触，比硬塞 4 个人更好用。
   ⚠️ 全局 card 规则大量使用 !important（display/padding/td:before 等），
   所以下面的覆写必须同样带 !important 才生效，别删。
   断点沿用本文件既有的「手机或触控平板」条件，勿改成纯宽度判断。 */
@media screen and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1500px) and (pointer: coarse) {
  #attendance-modal-overlay {
    box-sizing: border-box;
    height: 100dvh !important;
    padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
    z-index: 2147483000 !important;
  }
  /* 从点名窗口里再开的「提前补课」「调班/补课」：点名窗口在平板上被抬到 2147483000，
     它们原本只有 10011，打开了却被压在后面（按了没反应）。必须比点名窗口更高。 */
  #early-makeup-modal-overlay,
  #schedule-makeup-modal-overlay {
    z-index: 2147483001 !important;
  }
  .attendance-table tr { padding: 12px !important; margin-bottom: 12px !important; position: relative; overflow: hidden; }
  /* card 布局给每格加的「学生姓名:」等前缀标签，在点名表里纯属噪音 */
  .attendance-table td:before { display: none !important; }
  .attendance-table td { padding: 6px 0 !important; border-bottom: none !important; min-height: 0 !important; text-align: left !important; min-width: 0 !important; }
  /* 姓名行：长名字（如 JADEN WONG ZI XING）在窄屏会折行多吃一行高度，
     略收字号并压紧行高，绝大多数名字能一行放下；真的太长仍可折行不截断。 */
  .attendance-table td:nth-child(1) { display: block !important; padding: 2px 108px 10px 0 !important; margin-bottom: 0 !important; font-size: 14px !important; line-height: 1.3 !important; background: transparent !important; }
  .attendance-table .attendance-student-name { min-width: 0; flex-wrap: wrap; gap: 3px 6px !important; }
  .attendance-table .attendance-student-name-text { min-width: 0; overflow-wrap: anywhere; }
  .attendance-table .attendance-student-points { display: block; margin-top: 4px !important; white-space: nowrap; }
  .attendance-table tr.is-makeup td:nth-child(1) { padding-right: 156px !important; }
  /* 制服 + 换班：浮到右上角与姓名同排。card 规则把 td 设成 display:flex，
     无法用 inline-flex 让两个 td 并排，绝对定位是这里唯一稳的做法。
     各 44px 触控区 + 8px 间距，符合 Apple HIG / Material 最小触控标准。 */
  .attendance-table td:nth-child(2),
  .attendance-table td:nth-child(4) { position: absolute !important; top: 10px !important; width: auto !important; padding: 0 !important; min-height: 0 !important; display: block !important; }
  .attendance-table td:nth-child(2) { right: 60px !important; }
  .attendance-table td:nth-child(4) { right: 8px !important; }
  .attendance-table tr.is-makeup td:nth-child(2) { right: 108px !important; }
  .attendance-table td:nth-child(4) { display: flex !important; gap: 12px; white-space: nowrap; }
  .attendance-table td:nth-child(2) label { width: 44px !important; height: 44px !important; }
  .attendance-table td:nth-child(4) button { width: 44px; height: 44px; min-height: 44px !important; padding: 0 !important; margin-left: 0 !important; justify-content: center; }
  .attendance-table td:nth-child(4) .mk-label { display: none; }
  /* 状态键：等分一行，高度拉到 44px 满足触控，行距放松 */
  .attendance-table td:nth-child(3) { display: block !important; padding: 2px 0 0 !important; }
  .attendance-table td:nth-child(3) > div { display: flex !important; gap: 6px !important; }
  /* 注：label 的 flex:1 1 0 + min-width:0 已写在 ui-classroom.js 的内联样式里
     （flex 项默认 min-width:auto 会拒绝收缩，导致状态键撑破卡片被切掉右边）。 */
  .attendance-table .status-btn { box-sizing: border-box; padding: 8px 2px !important; font-size: 11.5px !important; line-height: 1.2; min-height: 48px; display: flex !important; flex-direction: column; gap: 3px; align-items: center; justify-content: center; }
  .attendance-table .status-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(255,255,255,.45); }
  .attendance-table .present .status-dot { background: #22c55e; }
  .attendance-table .late .status-dot { background: #eab308; }
  .attendance-table .leave .status-dot { background: #3b82f6; }
  .attendance-table .absent .status-dot { background: #ef4444; }
  .attendance-table .cancelled .status-dot { background: #64748b; }
}
/* 极窄屏(≤400)：状态键改两个一行，四个并排会挤到看不清 */
@media screen and (max-width: 400px) {
  .attendance-table td:nth-child(3) > div { flex-wrap: wrap !important; }
  .attendance-table td:nth-child(3) > div > label { flex: 1 1 calc(50% - 3px) !important; }
}

/* ── 点名弹窗：手机版头尾精简 ───────────────────────────────────
   问题(见真机截图)：标题「课堂考勤点名 (Class Attendance Roll Call)」双语下
   占满 4 行、日期与「提前补课」各占一行，一屏三分之一还没看到学生；底部
   提示文字吃掉 60% 宽度，把「保存点名记录」挤成 4 行窄条，很难点中。
   对策(遵循 content-priority 与 touch-target≥44px)：
     • 标题在手机上只显示短版「点名」，长版仅桌面显示；
     • 头部改上下两段：标题一行、日期+提前补课并排一行；
     • 底部提示在手机隐藏(不是关键信息，桌面保留)，取消/保存变成等宽大按钮；
     • 底部吸底常驻，滚动长名单时「保存」始终可点。 */
@media screen and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1500px) and (pointer: coarse) {
  .attendance-modal { box-sizing: border-box; padding: 14px !important; width: 100% !important; max-width: 100% !important; max-height: 100% !important; border-radius: 18px !important; }
  /* 头部：标题一行 + 工具一行，去掉左右分栏造成的窄柱换行 */
  .attendance-modal .att-head { flex-direction: column !important; align-items: stretch !important; gap: 10px; padding-bottom: 12px !important; margin-bottom: 12px !important; }
  .attendance-modal .att-head h2 { font-size: 16px !important; }
  .attendance-modal .att-head p  { font-size: 12px !important; overflow-wrap: anywhere; }
  .attendance-modal .att-head-tools { flex-direction: row !important; align-items: center !important; justify-content: space-between !important; gap: 8px !important; }
  .attendance-modal .att-date-row { flex: 1 1 auto; gap: 6px !important; min-width: 0; }
  .attendance-modal .att-date-label { display: none !important; }  /* 日期框本身已自解释 */
  .attendance-modal .att-date-field { width: 100% !important; min-width: 0; }
  .attendance-modal .att-early-btn { flex: 0 0 auto; min-height: 44px; padding-inline: 10px !important; }
  .attendance-modal #attendance-students-container { min-height: 0; margin-bottom: 0 !important; padding-right: 2px !important; overscroll-behavior: contain; scrollbar-gutter: stable; }
  /* 底部：提示让位，按钮等宽撑满，满足 44px 触控高度 */
  .attendance-modal .att-foot { flex: 0 0 auto; padding-top: 12px !important; padding-bottom: env(safe-area-inset-bottom); margin-top: 0 !important; gap: 8px; background: #fff; }
  .attendance-modal .att-foot-tip { display: none !important; }
  .attendance-modal .att-foot-btns { flex: 1 1 auto; gap: 8px !important; }
  .attendance-modal .att-foot-btns > button { flex: 1 1 0; min-width: 0; min-height: 46px; padding: 10px 8px !important; font-size: 14px !important; white-space: nowrap; }
  .attendance-modal .att-cancel-btn { flex: 0 0 34% !important; }
}
/* 手机：头部多了「整班停课」，日期 + 两个按钮一行放不下 → 日期独占一行，两个按钮下一行对半 */
@media screen and (max-width: 600px) {
  .attendance-modal .att-head-tools { flex-wrap: wrap !important; }
  .attendance-modal .att-date-row { flex: 1 1 100% !important; }
  .attendance-modal .att-early-btn { flex: 1 1 0 !important; min-width: 0; justify-content: center; white-space: normal !important; text-align: center; line-height: 1.25; }
}
@media screen and (max-width: 380px) {
  .attendance-modal { padding: 12px !important; }
  .attendance-modal .att-head-tools { flex-wrap: wrap; }
  .attendance-modal .att-date-row,
  .attendance-modal .att-early-btn { flex: 1 1 100% !important; width: 100%; justify-content: center; }
  .attendance-table td:nth-child(1) { padding-right: 100px !important; }
  .attendance-table tr.is-makeup td:nth-child(1) { padding: 54px 0 10px !important; }
}
/* 标题长/短版切换：手机只留短版，桌面只留长版 */
.att-title-short { display: none; }
@media screen and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1500px) and (pointer: coarse) {
  .att-title-full  { display: none !important; }
  .att-title-short { display: inline !important; }
}
/* 保存按钮文案同理：手机「保存」，桌面「保存点名记录」 */
.att-save-short { display: none; }
@media screen and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1500px) and (pointer: coarse) {
  .att-save-full  { display: none !important; }
  .att-save-short { display: inline !important; }
}

/* ── Compact desktop header ───────────────────────────────────────
   A 1025–1500px viewport still uses the desktop sidebar, leaving much less
   room for the page title and bilingual quick actions. Keep both regions in
   their own flex bounds so browser zoom, split-screen and small laptops can
   never make them overlap. */
@media screen and (min-width: 1025px) and (max-width: 1500px) {
  .content-header {
    padding-inline: 20px !important;
    gap: 14px;
  }

  /* 标题按内容宽度（封顶 26%，超出省略号），其余空间全给右侧快捷按钮，
     否则短标题白占 30% 而 5 个双语按钮被挤出屏幕（刷新钮被裁）。 */
  .content-header > div:first-child {
    flex: 0 1 auto !important;
    min-width: 120px;
    max-width: 26%;
    overflow: hidden !important;
  }

  .content-header h1#page-title {
    flex: 1 1 auto !important;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 21px !important;
  }

  .content-header .header-tools {
    flex: 1 1 0 !important;
    min-width: 0;
    max-width: none;
    justify-content: flex-end;
    justify-content: safe flex-end;  /* 放不下时从左边开始滚，左侧按钮不至于点不到 */
    gap: 8px !important;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .content-header .header-tools::-webkit-scrollbar {
    display: none;
  }

  .content-header #current-time {
    display: none !important;
  }

  .content-header .header-action-btn {
    padding-inline: 13px !important;
  }
}

/* ── Student billing history: compact-screen invoice cards ───────
   Eight columns become unreadable once the sidebar leaves less than a full
   desktop canvas. At that width each invoice becomes a structured card:
   identity first, supporting dates second, actions in a stable 2×2 grid. */
@media screen and (max-width: 1400px) {
  .student-billing-card {
    padding: 18px !important;
  }

  .student-billing-head {
    align-items: flex-start !important;
  }

  .student-billing-tools {
    width: 100%;
  }

  .student-billing-tools > button {
    flex: 0 0 auto;
    min-height: 42px;
  }

  /* 搜索框/状态下拉已移到独立的 .student-billing-filters 栏（版式对齐「学生权限管理」）。 */
  .student-billing-filters > div {
    min-height: 42px;
  }

  .student-billing-filters input,
  .student-billing-filters select {
    min-height: 42px;
    box-sizing: border-box;
  }

  .table-scroll > .student-billing-table,
  .student-billing-table,
  .student-billing-table tbody {
    display: block !important;
    min-width: 0 !important;
    width: 100%;
  }

  .student-billing-table thead {
    display: none !important;
  }

  .student-billing-table .student-invoice-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "invoice status"
      "student amount"
      "description description"
      "date date"
      "actions actions";
    gap: 0 18px;
    margin: 0 0 14px !important;
    padding: 14px !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05) !important;
  }

  .student-billing-table .student-invoice-row > td {
    display: block !important;
    position: static !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 10px 0 !important;
    border: 0 !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 0 !important;
    background: transparent !important;
    text-align: left !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  .student-billing-table .student-invoice-row > td::before {
    content: attr(data-label) !important;
    display: block !important;
    position: static !important;
    width: auto !important;
    margin: 0 0 4px !important;
    padding: 0 !important;
    color: #94a3b8;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.2;
    text-transform: uppercase;
    white-space: normal;
  }

  .student-billing-table .billing-invoice-no { grid-area: invoice; font-size: 15px; }
  .student-billing-table .billing-status { grid-area: status; justify-self: end; }
  .student-billing-table .billing-student { grid-area: student; }
  .student-billing-table .billing-amount {
    grid-area: amount;
    justify-self: end;
    align-self: stretch;
    min-width: 92px !important;
  }
  .student-billing-table .billing-description { grid-area: description; }
  .student-billing-table .billing-date { grid-area: date; }
  .student-billing-table .billing-actions {
    grid-area: actions;
    padding: 12px 0 0 !important;
    border-bottom: 0 !important;
  }

  .student-billing-table .billing-status::before,
  .student-billing-table .billing-amount::before {
    text-align: right;
  }

  .student-billing-table .billing-actions > div {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px !important;
  }

  .student-billing-table .billing-actions button {
    width: 100%;
    min-height: 42px !important;
    margin: 0;
    padding: 8px 10px !important;
    justify-content: center;
    text-align: center;
  }
}

@media screen and (max-width: 520px) {
  .student-billing-tools > button {
    flex: 1 1 100%;
    width: 100% !important;
  }

  /* 手机：搜索框与状态下拉各占一整行，避免挤成两个窄条 */
  .student-billing-filters > div {
    flex: 1 1 100% !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .student-billing-table .student-invoice-row {
    gap: 0 12px;
    padding: 12px !important;
  }
}

/* ================================================================
   🏆 考级管理弹窗 (exam records modal)
   Class-based so the markup stays free of inline styles — the old
   version built every rule inline, which fights the token system and
   bloats each re-render of the timeline.
   Subject colour is carried by [data-subject] tokens, never passed in
   as an inline colour (see theme_inline_style_pitfall).
   ================================================================ */

.exam-modal {
  --exam-abacus: #4f46e5;
  --exam-mental: #0891b2;
  padding: 0;
  max-width: 520px;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: min(88vh, 860px);
}

.exam-modal__head {
  background: var(--accent-gradient);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: none;
}
.exam-modal__who {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.exam-modal__name {
  font-size: var(--text-md);
  font-weight: var(--fw-black);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.exam-modal__sub {
  font-size: var(--text-xs);
  opacity: 0.85;
  margin-top: 1px;
}
.exam-modal__x {
  flex: none;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.exam-modal__x:hover { background: rgba(255, 255, 255, 0.3); }

.exam-modal__body {
  padding: 16px 20px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* ── 当前等级：本窗最重要的信息，给它真正的份量 ── */
.exam-now {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 8px;
}
.exam-now__card {
  border: var(--border-width) solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--card-bg);
  border-top: 3px solid var(--exam-abacus);
}
.exam-now__card[data-subject="mental"] { border-top-color: var(--exam-mental); }
.exam-now__label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}
.exam-now__value {
  font-size: 26px;
  font-weight: var(--fw-black);
  color: var(--text-main);
  line-height: 1.15;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.exam-now__value--empty {
  font-size: var(--text-base);
  font-weight: var(--fw-bold);
  color: #94a3b8;
}
.exam-now__hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 18px;
}

/* ── 分区标题 ── */
.exam-h {
  font-size: var(--text-sm);
  font-weight: var(--fw-black);
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.exam-h__count {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
}

/* ── 录入表单 ── */
.exam-form {
  background: #f8fafc;
  border: var(--border-width) solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
}
.exam-form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
.exam-field { min-width: 0; }
.exam-field > label {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}
.exam-field input {
  width: 100%;
  padding: 9px 11px;
  border: var(--border-width) solid #cbd5e1;
  border-radius: 9px;
  font-size: var(--text-sm);
  box-sizing: border-box;
  font-family: inherit;
}
.exam-field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* Segmented 科目选择 —— 取代又小又难点的原生 radio。
   真 radio 留在 DOM 里(仅视觉隐藏)，键盘与表单语义不变。 */
.exam-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: #eef2f7;
  border-radius: 11px;
  padding: 4px;
}
.exam-seg__opt {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 8px;
  border-radius: 8px;
  font-size: var(--text-sm);
  font-weight: var(--fw-black);
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s, color 0.15s;
}
.exam-seg__opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}
.exam-seg__opt.is-on {
  background: var(--card-bg);
  color: var(--exam-abacus);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.exam-seg__opt.is-on[data-subject="mental"] { color: var(--exam-mental); }
.exam-seg__opt input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.exam-save {
  width: 100%;
  padding: 11px;
  background: var(--accent);
  color: #fff;
  font-size: var(--text-sm);
  font-weight: var(--fw-black);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
.exam-save:hover:not(:disabled) { background: #4338ca; }
.exam-save:disabled { opacity: 0.6; cursor: default; }

/* ── 时间轴：真的有一条轴 ── */
.exam-tl { position: relative; }
.exam-tl__year {
  font-size: var(--text-xs);
  font-weight: var(--fw-black);
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  padding-left: 26px;
  position: relative;
}
.exam-tl__year:not(:first-child) { margin-top: 16px; }
.exam-tl__year::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-light);
  border: 2px solid var(--card-bg);
  transform: translateY(-50%);
}

.exam-tl__item {
  position: relative;
  padding-left: 26px;
  margin-bottom: 8px;
}
/* the spine */
.exam-tl__item::before {
  content: "";
  position: absolute;
  left: 9px;
  top: -8px;
  bottom: -8px;
  width: 2px;
  background: var(--border);
}
.exam-tl__item:last-child::before { bottom: 50%; }

.exam-tl__card {
  background: var(--card-bg);
  border: var(--border-width) solid var(--border);
  border-left: 3px solid var(--exam-abacus);
  border-radius: 10px;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.exam-tl__card[data-subject="mental"] { border-left-color: var(--exam-mental); }

.exam-tl__main { min-width: 0; }
.exam-tl__lv {
  font-size: var(--text-sm);
  font-weight: var(--fw-black);
  color: var(--text-main);
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
}
.exam-tl__meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.exam-tl__scores {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.exam-tl__tag {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: #15803d;
  background: #f0fdf4;
  padding: 1px 6px;
  border-radius: 6px;
}

/* 删除降级为次要动作：平时低调，hover/focus 才转红 */
.exam-tl__del {
  flex: none;
  width: 28px;
  height: 28px;
  border: var(--border-width) solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #94a3b8;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.exam-tl__del:hover,
.exam-tl__del:focus-visible {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.exam-empty {
  color: #94a3b8;
  font-size: var(--text-sm);
  text-align: center;
  padding: 22px 12px;
  border: 1px dashed var(--border);
  border-radius: 12px;
}
.exam-error {
  color: #b91c1c;
  font-size: var(--text-sm);
  background: #fef2f2;
  border: var(--border-width) solid #fecaca;
  border-radius: 10px;
  padding: 10px 12px;
}

.exam-modal__foot {
  padding: 12px 20px;
  background: #f8fafc;
  border-top: var(--border-width) solid var(--border);
  text-align: right;
  flex: none;
}

/* 手机 / 触屏平板：单列 + 大点击区。
   断点跟项目统一口径 (jonas_responsive_breakpoints)。 */
@media screen and (max-width: 1024px),
       screen and (min-width: 1025px) and (max-width: 1500px) and (pointer: coarse) {
  .exam-modal { max-height: 92vh; }
  .exam-form__row { grid-template-columns: 1fr; }
  .exam-now__value { font-size: 24px; }
  /* 科目选择保持并排 —— 只有两项，堆叠反而更难扫视。
     (全局单列规则只打内联 grid-template-columns，class 写法碰不到；
      这条是给将来万一有人改成内联时兜底。) */
  .exam-modal .exam-seg { grid-template-columns: 1fr 1fr !important; }
  .exam-tl__del { width: 34px; height: 34px; }
}

@media screen and (max-width: 380px) {
  .exam-now { grid-template-columns: 1fr; }
}

/* ===== 学费追踪工具栏 (Tuition Tracker toolbar) =====
   原本整排 select 用 flex 排，窄屏时每个都被拉成整行，非常难看。
   改成自动换行的 grid：每个控件有自己的宽度上限，排不下就整齐地掉到下一行。 */
.trk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f1f5f9;
}
.trk-bar__spacer { flex: 1 1 auto; }

/* 嵌在卡片里用（待收款清单）：不要底线，只留间距 */
.trk-bar--flush { padding-bottom: 0; border-bottom: none; margin-bottom: 16px; }

.trk-bar__ctrl {
  flex: 0 1 auto;
  width: 168px;
  min-width: 0;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1.5px solid #cbd5e1;
  background: white;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 700;
  outline: none;
  cursor: pointer;
  text-overflow: ellipsis;
}
.trk-bar__ctrl:focus-visible { border-color: #6366f1; }
.trk-bar__ctrl--wide { width: 200px; }

/* 年份：带图标的小胶囊，比整条 select 好看 */
.trk-bar__year {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  padding: 2px 10px;
}
.trk-bar__year > span { font-size: 13px; }
.trk-bar__year > select {
  border: none;
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  color: #1e293b;
  outline: none;
  cursor: pointer;
  padding: 6px 0;
}

.trk-bar__search { position: relative; flex: 0 1 auto; }
.trk-bar__search > span {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: #94a3b8;
  pointer-events: none;
}
.trk-bar__search > input {
  width: 190px;
  max-width: 100%;
  box-sizing: border-box;
  padding: 7px 12px 7px 30px;
  border-radius: 9px;
  border: 1.5px solid #cbd5e1;
  font-size: 12.5px;
  font-weight: 700;
  outline: none;
}
.trk-bar__search > input:focus-visible { border-color: #6366f1; }

.trk-bar__btn {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.trk-bar__btn--excel { background: #ecfdf5; border: 1.5px solid #6ee7b7; color: #047857; }
.trk-bar__btn--excel:hover { background: #d1fae5; }
.trk-bar__btn--bulk { background: #eef2ff; border: 1.5px solid #c7d2fe; color: #4338ca; }
.trk-bar__btn--bulk:hover { background: #e0e7ff; }

/* 窄屏：控件两列平分，不再一个一整行 */
@media (max-width: 700px) {
  .trk-bar__spacer { display: none; }
  .trk-bar__ctrl,
  .trk-bar__ctrl--wide { flex: 1 1 calc(50% - 4px); width: auto; }
  .trk-bar__search { flex: 1 1 100%; }
  .trk-bar__search > input { width: 100%; }
  .trk-bar__btn { flex: 1 1 calc(50% - 4px); justify-content: center; }
}

/* ===== 账单屏组内子切换条 (invoice sub-tabs) =====
   顶部大 tab 收成 4 组后，组内的细分放这里。做成低调的胶囊条，
   跟顶部主 tab 拉开层级 —— 主 tab 是「去哪个区」，这条是「区里看哪张表」。 */
.inv-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  background: #f1f5f9;
  border-radius: 11px;
}
.inv-subtab {
  flex: 0 1 auto;
  padding: 7px 14px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 12.5px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.inv-subtab:hover { background: #e2e8f0; color: #334155; }
.inv-subtab.is-on {
  background: white;
  color: #1e293b;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.inv-subtab__n {
  display: inline-block;
  min-width: 17px;
  padding: 0 5px;
  margin-left: 3px;
  border-radius: 999px;
  background: #ef4444;
  color: white;
  font-size: 10.5px;
  line-height: 17px;
  text-align: center;
}
.inv-subtab.is-on .inv-subtab__n { background: #dc2626; }

@media (max-width: 700px) {
  .inv-subtab { flex: 1 1 auto; text-align: center; }
}

/* ================================================================
   LANDSCAPE TABLET — persistent icon rail sidebar + flattened header
   (Phase 1 of the tablet UX pass). Teachers mostly run Jonas on a
   tablet propped up landscape on a stand/desk, not portrait in-hand —
   that's this whole breakpoint's reason to exist separately from the
   phone/portrait block earlier in this file. On a 1025-1500px
   landscape screen there's no need to hide the whole nav behind a
   full-screen drawer like a 390px phone; a narrow always-visible icon
   rail costs ~76px and saves a tap on every navigation. Tapping the
   existing hamburger button still expands it into a labeled flyout
   (reuses ConsoleUI.toggleMobileMenu / .mobile-active — no JS change
   needed).
   Upper bound is 1500px, not 1366px: 1366 only covers ~10-11" tablets
   (iPad Pro 11/12.9, common 16:10 Android tablets). 12"+ devices with a
   wider aspect ratio — Surface-style 3:2 (~1368px+), bigger 16:9/16:10
   Android tablets — were landing just past 1366 and silently falling
   back to the fixed-280px desktop sidebar instead of the rail. 1500
   catches those while pointer:coarse still keeps real mouse laptops on
   the real desktop UI regardless of width.
   Lower bound is 1024px, matching the phone/portrait block's own
   max-width:1024 exactly (no gap, no overlap) — this is deliberately
   NOT lower than that. A 900px floor would also catch the widest
   landscape phones (iPhone Pro Max/S-Ultra land around 915-932px),
   handing them a permanent 76px rail sidebar meant for a device sitting
   on a stand, not one someone's holding sideways for a second.
   Deliberately placed at the very END of the file: this same
   `.content-header`/`.sidebar` selector set is also touched by the
   phone block AND an unrelated "narrow desktop" query
   (`min-width:1025px and max-width:1500px`, not gated on pointer type)
   earlier in this file — first shipping this block mid-file caused a
   real bug where that later desktop query won ties on equal-specificity
   `!important` declarations (e.g. #page-title font-size) by pure source
   order, undoing this block's overrides. Living last in the cascade
   sidesteps that regardless of what gets added earlier in the file
   later. The rules at the bottom also restore compact semantic tables, while
   touch-sized controls and tablet-friendly modals remain shared with the
   portrait base. ================================================================ */
@media screen and (min-width: 1024px) and (max-width: 1500px) and (pointer: coarse) and (orientation: landscape) {
  .sidebar:not(.mobile-active) {
    left: 0 !important;
    width: 76px !important;
    align-items: center;
  }
  .sidebar:not(.mobile-active) .nav-menu {
    width: 100%;
    padding: 0 6px;
  }
  .sidebar:not(.mobile-active) .nav-section-label {
    justify-content: center;
    padding: 16px 0 6px;
    pointer-events: none;           /* no text left to toggle; keep tap-transparent */
  }
  .sidebar:not(.mobile-active) .nav-section-text,
  .sidebar:not(.mobile-active) .nav-section-chevron {
    display: none;
  }
  /* Force every group open — collapsing a section would hide icons with
     no label left to explain why, so ignore any stored .collapsed state. */
  .sidebar:not(.mobile-active) .nav-section[data-section-body] {
    max-height: none !important;
    opacity: 1 !important;
  }
  .sidebar:not(.mobile-active) .nav-item {
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    padding: 10px 2px;
    margin: 3px 8px;
    min-height: 48px;               /* ≥44px touch target */
  }
  .sidebar:not(.mobile-active) .nav-item:hover {
    transform: none;                /* the translateX(4px) hover has nowhere to go at 76px */
  }
  .sidebar:not(.mobile-active) .nav-item.active::before {
    display: none;                  /* the left accent bar assumes a wide row layout */
  }
  .sidebar:not(.mobile-active) .nav-text {
    display: none;
    font-size: 9px;
  }
  .sidebar:not(.mobile-active) .sidebar-footer {
    padding: 12px 6px;
  }
  .sidebar:not(.mobile-active) .sidebar-footer > div:first-child {
    display: none !important;       /* "User Profile" label row + info icon — inline style="display:flex" on this node needs beating */
  }
  .sidebar:not(.mobile-active) .user-profile-card {
    padding: 8px;
  }
  .sidebar:not(.mobile-active) .user-profile-header {
    flex-direction: column;
    gap: 0;
    margin-bottom: 0;
  }
  .sidebar:not(.mobile-active) .user-info {
    display: none;
  }
  .sidebar:not(.mobile-active) .user-org-badge {
    display: none !important;       /* inline style="display:flex" on this node needs beating */
  }
  /* 改密/登出 aren't frequent-enough actions to earn permanent rail space —
     drop them from the collapsed state entirely. The avatar card above is
     still tappable (opens the profile modal), and both buttons come back
     once expanded via the hamburger. */
  .sidebar:not(.mobile-active) .footer-actions {
    display: none;
  }

  /* Expanded flyout (tap the hamburger): a modest 320px labeled panel,
     not the phone's 100%-width takeover — there's no need to hide the
     page behind the whole screen on a tablet. */
  .sidebar.mobile-active {
    width: 320px !important;
    box-shadow: 10px 0 30px rgba(0,0,0,0.22);
  }

  /* Real-device feedback: on a shorter tablet viewport the nav list is
     taller than the space left after the header, and a flex child with
     `overflow-y:auto` won't shrink to make room for it without
     `min-height:0` — the footer (profile card + 改密/登出) got pushed
     below the screen, and because .nav-menu already had its own scroll,
     touch never bubbled up to reveal it. Make the footer sticky so it's
     always reachable regardless of how tall the nav list scrolls, in
     both the collapsed rail and the expanded flyout. */
  .sidebar .nav-menu {
    min-height: 0;
  }
  .sidebar .sidebar-footer {
    flex: 0 0 auto;
    position: sticky;
    bottom: 0;
    background: var(--sidebar-surface);
    z-index: 2;
  }

  .main-content {
    margin-left: 76px !important;   /* permanent offset for the rail; the
                                        expanded flyout is an overlay on top,
                                        so this doesn't need to change with it */
    margin-top: 0 !important;       /* header below is a single static row now,
                                        not the phone's fixed two-row bar */
    overflow: hidden !important;
  }

  /* Real-device feedback: the phone's fixed two-row header (title row +
     wrapped quick-action row) ate close to a third of the screen on a
     landscape tablet, on top of the rail already saving space. Flatten it
     back to a single static row like desktop — the rail means we don't
     need the hamburger to open a full-screen takeover, so there's no
     reason to reserve all that height for it. */
  .content-header {
    position: static !important;
    height: 62px !important;
    min-height: 62px !important;
    padding: 0 20px !important;
    flex-wrap: nowrap !important;
    box-shadow: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .content-header > div:first-child {
    flex: 1 1 auto !important;
    flex-wrap: nowrap !important;   /* the phone block's `wrap` (meant for its
                                        own two-row title+tabs layout) was still
                                        in effect here — at the narrower end of
                                        this tier's width range the title had
                                        nowhere to fit and wrapped to a second
                                        line that spilled below the fixed-height
                                        header, reading as "the title vanished". */
    height: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    gap: 12px !important;
  }
  .content-header h1#page-title {
    font-size: 17px !important;
    min-width: 60px;                /* always show *something*, even squeezed —
                                        never let a wide sibling shrink it to 0 */
  }
  /* super_admin accounts get an org-switcher <select> here (owner accounts
     don't) — it has `flex-shrink:0` inline, so on a narrower tablet it was
     eating the title's entire flex-basis instead of giving up any of its
     own width first. Let it shrink too and cap how wide it can get. */
  #org-switcher-container {
    flex-shrink: 1 !important;
    max-width: 160px;
    min-width: 0;
    overflow: hidden;
  }
  #org-switcher-container select {
    max-width: 100%;
  }
  /* The rail already carries the brand icon; showing it again in the
     header next to the hamburger is redundant on this tier. */
  .mobile-logo {
    display: none !important;
  }
  #header-tabs-bar {
    padding: 6px 20px !important;
  }
  /* Selector matches `.content-header .header-tools` (not just `.header-tools`)
     on purpose: the unrelated "narrow desktop 1025-1500" query earlier in this
     file (not gated on pointer type, so it also matches this tier) sets
     `.content-header .header-tools { flex: 0 1 70% !important; ... }` — that
     two-class selector outranks a bare `.header-tools`, so being later in the
     file wasn't enough to win here; matching its specificity was required.
     Without this the quick-action icons stopped at ~70% width instead of
     reaching the header's right edge. */
  .content-header .header-tools {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    order: 0 !important;
    margin-top: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    -webkit-mask-image: none !important;
            mask-image: none !important;
    flex-wrap: nowrap !important;
  }
  #content-body {
    margin-top: 0 !important;
    padding: 20px !important;
    overflow-y: auto !important;
  }

  /* Landscape tablets use a compact real table. The shared touch base above
     turns every table row into a phone card; undo only that presentation here
     while retaining the larger touch targets. Wide tables remain swipeable
     through their .table-scroll wrapper.
     Attendance remains excluded because its modal uses an intentionally
     specialised tap-first roster. Normal management and billing tables,
     including student billing, all use this landscape-tablet system. */
  .data-table:not(.attendance-table) { display: table !important; }
  .data-table:not(.attendance-table) thead { display: table-header-group !important; }
  .data-table:not(.attendance-table) tbody { display: table-row-group !important; }
  .data-table:not(.attendance-table) tr {
    display: table-row !important;
    position: static !important;
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }
  .data-table:not(.attendance-table) th,
  .data-table:not(.attendance-table) td {
    display: table-cell !important;
  }
  .data-table:not(.attendance-table) td,
  .data-table:not(.attendance-table) td:first-child,
  .data-table:not(.attendance-table) td:last-child {
    position: static !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 11px 12px !important;
    border-bottom: 1px solid #f1f5f9 !important;
    border-radius: 0 !important;
    background: transparent;
    text-align: left !important;
  }
  .data-table:not(.attendance-table) td::before { display: none !important; }
  /* The phone card-mode rule `.data-table td[data-label] > div { justify-content:
     flex-end }` (line ~1133) was meant only for right-packing the ACTIONS button
     cluster in a narrow card — but its selector is generic enough to also match
     the student-name cell's avatar+name wrapper. In a real, much-wider table
     column that right-packs the avatar based on how much space the name text
     *doesn't* fill, so every row's avatar lands at a different X depending on
     name length. Real desktop CSS never sets justify-content here at all
     (browser default is flex-start) — restore that default instead of the
     mobile-card override. */
  .data-table:not(.attendance-table) td[data-label] > div {
    flex-wrap: nowrap;
    justify-content: flex-start !important;
  }
  .table-scroll > .data-table:not(.attendance-table) { min-width: 720px; }

  /* The phone-card touch-target rule `.data-table td button {padding: 9px
     16px !important}` (line ~1126) assumed buttons were free to grow — a
     full-width wrapped pill in a card. Most `.data-table` action cells
     (students, school-billing, invoices) instead use fixed 30x30px icon
     squares (`width:30px;height:30px` inline + flex-centered svg). With
     box-sizing:border-box, 16px of horizontal padding alone doesn't fit in
     a 30px box — it squeezed the icon down to near-zero rendered width,
     i.e. every action button in a real table looked blank. Small, still
     touch-comfortable padding instead of a size that can exceed the
     button's own fixed dimensions. */
  .data-table:not(.attendance-table) td button {
    padding: 6px !important;
  }

  /* Student billing has its own <=1400px card component. Remove the remaining
     named-grid/action-card treatment so it uses the same landscape tablet
     table rhythm as Students, Invoices and School Billing. */
  .student-billing-table .student-invoice-row > td {
    white-space: normal !important;
    overflow: visible !important;
  }
  .student-billing-table .billing-actions > div {
    display: flex !important;
    grid-template-columns: none !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
  }
  .student-billing-table .billing-actions button {
    width: auto !important;
    min-height: 44px !important;
    padding: 6px 12px !important;
  }

  /* ================================================================
     PHASE 3 — attendance roll-call table becomes a real table too, and
     the modal stops stretching edge-to-edge.
     .attendance-table was deliberately excluded from the Phase 2 generic
     conversion above: its phone-card treatment doesn't just hide labels
     like the plain .data-table cards do, it absolute-positions the
     uniform/make-up columns on top of the name column and stacks the
     four status buttons vertically — all real per-column overrides
     (style.css ~1554-1595) that a blanket `display:table` would collide
     with. Undo them individually here instead, matching each selector's
     shape so specificity ties resolve in this later block's favor. */
  .attendance-table { display: table !important; }
  .attendance-table thead { display: table-header-group !important; }
  .attendance-table thead tr {
    position: static !important;
    top: auto !important;
    left: auto !important;
  }
  .attendance-table th { display: table-cell !important; }
  .attendance-table tbody { display: table-row-group !important; }
  .attendance-table tr {
    display: table-row !important;
    position: static !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
  }
  .attendance-table td {
    display: table-cell !important;
    position: static !important;
    padding: 12px 10px !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    text-align: left !important;
    vertical-align: middle !important;
  }
  .attendance-table td:nth-child(1) {
    display: table-cell !important;
    position: static !important;
    padding: 12px 10px !important;
    margin-bottom: 0 !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    background: transparent !important;
  }
  .attendance-table tr.is-makeup td:nth-child(1) { padding-right: 10px !important; }

  /* Uniform + make-up columns: back to normal table cells, no more
     absolute-positioning them into the name column's reserved margin. */
  .attendance-table td:nth-child(2),
  .attendance-table td:nth-child(4) {
    display: table-cell !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    width: auto !important;
    padding: 12px 10px !important;
    min-height: 0 !important;
  }
  .attendance-table td:nth-child(2) { text-align: center !important; width: 70px !important; }
  .attendance-table tr.is-makeup td:nth-child(2) { right: auto !important; }
  .attendance-table td:nth-child(4) {
    text-align: right !important;
    white-space: nowrap;
  }
  .attendance-table td:nth-child(4) button {
    width: auto !important;
    height: auto !important;
    min-height: 44px !important;
    min-width: 44px !important;
    padding: 6px 12px !important;
    margin-left: 14px !important;      /* 删除键会退积分，别跟「调班/补课」挨着 */
  }
  .attendance-table td:nth-child(4) button:first-child { margin-left: 0 !important; }

  /* Status buttons: a real table row has room for all four side by side —
     row layout (icon + label inline) instead of the phone's stacked
     icon-over-label squares, matching how the badge reads on desktop. */
  .attendance-table td:nth-child(3) {
    display: table-cell !important;
    padding: 12px 10px !important;
  }
  .attendance-table td:nth-child(3) > div {
    display: flex !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    justify-content: flex-start !important;
  }
  .attendance-table .status-btn {
    flex-direction: row !important;
    gap: 6px !important;
    padding: 9px 12px !important;
    min-height: 46px !important;
    font-size: 13px !important;
  }

  /* Modal: a bounded width like a real dialog, not the phone's 100vw
     takeover — there's no need to hide the whole screen behind it on a
     tablet. Everything already tuned for phones inside it (sticky footer,
     short/full title swap) is untouched — only the outer box changes. */
  .attendance-modal {
    width: min(90vw, 860px) !important;
    max-width: 860px !important;
    max-height: 88vh !important;
  }

  /* ================================================================
     PHASE 4 — form grids get width back on landscape tablets instead of
     the phone's forced single column. The "MOBILE FORM PASS" block
     (style.css ~1189-1346) collapses every inline `grid-template-columns`
     to `1fr` — correct for a 390px phone, wasteful on ≥1024px landscape.
     Using `repeat(auto-fit, minmax(...))` instead of a hardcoded column
     count: each modal's original inline value (1fr 1fr, 1fr 1fr 1fr, a
     mixed px/fr track...) was already overridden away by the phone rule,
     so there's no single "restore the original" move — auto-fit adapts
     to whatever fields each modal actually has instead of guessing a
     column count per modal. Touch sizing (16px input font, 48px height)
     from the same phone pass is untouched — only column layout changes. */
  .modal [style*="grid-template-columns"] {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
  }
  #ac-student-list,
  #ec-student-list {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  }
  /* Time-start / "-" / time-end: let the pair sit inline again — the
     phone-only reason to stack them full-width (no horizontal room)
     doesn't apply here. */
  #ac-time-start, #ac-time-end,
  #ec-time-start, #ec-time-end {
    width: auto !important;
    flex: 1 1 0 !important;
  }
  /* JS-built invoice/school-billing line-item rows: same auto-fit
     treatment as the .modal grids above, for the same reason. */
  .stubill-item-row,
  #sb-lines > div {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
  }
  .stubill-item-row > div:nth-child(1),
  .stubill-item-row > div:nth-child(2),
  #sb-lines > div > div:first-child {
    grid-column: 1 / -1;               /* these two still want the full row */
  }
  /* Modal action buttons: comfortable tap size without stretching to
     100% width in a much wider dialog — sticky footer bar stays. */
  .modal .modal-actions button {
    flex: 0 1 auto !important;
    min-width: 140px;
  }
}

/* ==========================================================================
   Touch floor（平板 / 手机，pointer: coarse）
   中心现在用平板上班：所有可点区域 ≥44px、输入框 16px（iOS 不会点一下就放大页面）、
   弹窗不超出可视高度。只放「通用兜底」，各页面专属的排版仍在上面各自的块里。
   弹窗一律是 body 下 id 以 overlay 结尾的 <div>（内联样式拼出来的，吃不到 .modal 规则）。
   ========================================================================== */
@media (pointer: coarse) {
  /* 遮罩：iOS 的 100vh 含地址栏，用 dvh；软键盘缩放由 console.js 的 visualViewport 接管 */
  div[id*="overlay"],
  div[id$="-picker-modal"] {
    height: 100dvh;
    overscroll-behavior: contain;
  }
  /* 弹窗卡片：最高不超过遮罩（遮罩被键盘压矮时跟着矮），超出就在卡片内滚动 */
  div[id*="overlay"] > div,
  div[id$="-picker-modal"] > div {
    max-height: calc(100% - 24px) !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }

  /* 输入框：16px + 46px 高 */
  div[id*="overlay"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]),
  div[id*="overlay"] select,
  div[id$="-picker-modal"] input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]),
  div[id$="-picker-modal"] select {
    font-size: 16px !important;
    min-height: 46px !important;
    box-sizing: border-box;
  }
  div[id*="overlay"] textarea { font-size: 16px !important; min-height: 90px; }

  /* 按钮 ≥44px（min-height 压得过内联的 height） */
  div[id*="overlay"] button,
  div[id$="-picker-modal"] button { min-height: 44px; min-width: 44px; }

  /* 裸 span 做的关闭 ✕：给 44px 点击区 */
  div[id*="overlay"] span[onclick*=".style.display='none'"],
  div[id*="overlay"] span[onclick*="closeAddInventoryModal"],
  div[id*="overlay"] span[onclick*=".remove()"] {
    min-width: 44px; min-height: 44px;
    display: inline-flex !important; align-items: center; justify-content: center;
  }

  /* 勾选框 / 单选：原来 15~18px，手指点不准 */
  input[type="checkbox"], input[type="radio"] {
    width: 24px !important; height: 24px !important; flex-shrink: 0;
  }

  /* 内容区里没被 .data-table 规则管到的按钮（周课表「点名」「+」、学生档案操作、排班等） */
  #content-body button { min-height: 44px; }
}

/* ==========================================================================
   Bento 菜单（平板/手机，≤1024px）
   原先点 ☰ 滑出整屏侧栏列表：顶部固定栏(~118px)盖住前几项、底部用户资料占了半屏，
   小平板(800×480)上只剩一两个菜单项可见。改成「大图块网格」：每项一块 ≥96px 的图块，
   分组标题不可折叠(全部展开)，用户资料/改密/登出收成底部一排。仍是同一批 .nav-item，
   权限/授权隐藏照旧；点图块 → showScreen 会自动收起。≥1024 横屏的 rail 不受影响。
   ========================================================================== */
@media screen and (max-width: 1024px) {
  .sidebar {
    top: 118px;                             /* 固定标题栏之下，别再被它盖住 */
    height: calc(100vh - 118px);
    height: calc(100dvh - 118px);
    padding: 12px 14px calc(18px + env(safe-area-inset-bottom));
    background: #eef4fb;
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }
  .sidebar .nav-menu { flex: none; padding: 0; overflow: visible; }

  .nav-section-label {
    padding: 14px 4px 8px;
    font-size: 12px;
    pointer-events: none;                   /* 不再折叠：全部展开 */
    cursor: default;
  }
  .nav-section-label:first-child { padding-top: 2px; }
  .nav-section-chevron { display: none; }

  .nav-section,
  .nav-section.collapsed {
    max-height: none !important;
    opacity: 1 !important;
    overflow: visible;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .nav-item {
    flex-direction: column;
    justify-content: center;
    text-align: center;
    gap: 8px;
    margin: 0;
    padding: 14px 8px;
    min-height: 96px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    transform: none;
  }
  .nav-item:hover { transform: none; }
  .nav-item:active { transform: scale(0.97); }
  .nav-item.active::before { display: none; }
  .nav-item .nav-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #eef2ff;
    color: #4f46e5;
  }
  .nav-item .nav-icon svg { width: 24px; height: 24px; }
  .nav-item.active .nav-icon { background: rgba(255, 255, 255, 0.22); color: #fff; }
  .nav-item .nav-text { font-size: 14px; line-height: 1.25; }

  /* 最常用的两块做成宽图块（bento 的大小错落） */
  #nav-classroom, #nav-invoices { grid-column: span 2; }

  /* 底部：资料卡 + 改密/登出 收成一排，不再占半屏 */
  .sidebar .sidebar-footer {
    position: static;
    margin-top: 14px;
    padding: 12px;
    border-radius: 20px;
    background: #fff;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }
  .sidebar .sidebar-footer > div:first-child { order: 3; margin: 0 !important; padding: 0 !important; }
  .sidebar .sidebar-footer > div:first-child > span:first-child { display: none; }  /* "USER PROFILE" 标题 */
  .sidebar .user-profile-card { flex: 1 1 220px; margin: 0; min-height: 44px; }
  .sidebar .footer-actions { display: flex; gap: 8px; margin: 0; flex: 0 0 auto; }
  .sidebar .footer-btn { min-height: 44px; min-width: 88px; }
}

/* ==========================================================================
   紧凑顶栏（平板，601–1024px）
   原先手机式两行固定栏（标题行 + 快捷按钮行）≈118px，在 800×480 的小平板上占了四分之一屏。
   平板宽度放得下，压成一行 56px：☰ 标题 | 点名 新生登记 登记链接 快速开单 刷新。
   <760px 时快捷按钮只留图标。手机（≤600）保持两行。侧栏抽屉/正文偏移跟着 --hdr-h 走。
   ========================================================================== */
@media screen and (min-width: 601px) and (max-width: 1024px) {
  :root { --hdr-h: 56px; }

  .content-header {
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 12px !important;
    flex-wrap: nowrap !important;
    align-items: center;
  }
  .content-header > div:first-child {
    flex: 1 1 auto !important;
    flex-wrap: nowrap !important;
    height: 100% !important;
    min-width: 0 !important;
    gap: 10px !important;
  }
  .content-header h1#page-title {
    font-size: 16px !important;
    min-width: 60px;
    flex-shrink: 1 !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-logo { display: none !important; }
  #org-switcher-container { flex-shrink: 1 !important; max-width: 140px; min-width: 0; overflow: hidden; }

  .content-header .header-tools {
    display: flex !important;
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
    order: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 6px !important;
    overflow: visible !important;
    -webkit-mask-image: none !important;
            mask-image: none !important;
    flex-wrap: nowrap !important;
  }
  .content-header .header-tools #current-time { display: none; }
  .content-header .header-tools .header-action-btn { padding: 0 12px !important; min-height: 44px; }

  .main-content { margin-top: var(--hdr-h); }
  .sidebar {
    top: var(--hdr-h);
    height: calc(100vh - var(--hdr-h));
    height: calc(100dvh - var(--hdr-h));
  }
}
/* 平板顶栏放不下四个带字按钮（合计 ~725px，会把 ☰ 和标题挤出屏幕）：
   只有最常用的「点名」「快速开单」保留文字，其余只留图标（title 仍有提示）。 */
@media screen and (min-width: 601px) and (max-width: 1024px) {
  #btn-enroll .header-action-label,
  #btn-reg-invite .header-action-label { display: none; }
  #btn-enroll, #btn-reg-invite { padding: 0 !important; width: 44px; justify-content: center; }
}
/* 更窄的平板（601–759）：连这两个也只留图标 */
@media screen and (min-width: 601px) and (max-width: 759px) {
  .content-header .header-tools .header-action-label { display: none; }
  .content-header .header-tools .header-action-btn { padding: 0 !important; width: 44px; justify-content: center; }
}

/* 平板/手机分页签栏压扁：外框 padding 与轨道内边距收小，tab 本身保持 44px 触控高度
   （原来 8+5 的留白让整条 ≈71px，现在 ≈56px）。 */
@media screen and (max-width: 1024px) {
  #header-tabs-bar { padding: 4px 12px !important; }
  #header-tabs { padding: 2px !important; }
  #header-tabs button { height: 44px !important; min-height: 44px; }
}

/* ==========================================================================
   APP HEADER — phone（≤767，一行式 app bar，约 56px）
     ☰  课堂排班管理            [点名] [开单] [⋯]
        Classroom Schedule
   · 原来三行（☰+logo / 标题 / 五个快捷按钮），约 146px，还压住了下面的分页签栏。
   · 每天用的「点名」「快速开单」留在顶栏（只留图标，title/aria-label 是双语全名）；
     新生登记 / 登记链接 / 刷新收进「⋯」下拉；有待处理登记时「⋯」上亮红点。
   · logo 拿掉（☰ 已是菜单入口）；分页签栏照旧在下面（只有有分页的页面才出现）。
   · 这一节在所有平板/窄屏顶栏规则之后，同等或更高的选择器即可覆盖，不用 !important。
   ========================================================================== */
@media screen and (max-width: 767px) {
  .main-content { margin-top: 56px; }

  .content-header {
    flex-wrap: nowrap;
    gap: 6px;
    height: 56px;
    min-height: 56px;
    padding: 0 8px 0 10px;
  }
  .content-header > .content-header-main {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    gap: 8px;
    min-width: 0;
    padding: 0;
  }
  .content-header .mobile-logo { display: none; }
  .content-header .mobile-menu-btn { width: 40px; min-width: 40px; height: 40px; font-size: 17px; }
  .content-header h1#page-title {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    overflow: hidden;
    font-size: 16px;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: nowrap;
  }
  #page-title .hdr-en {
    overflow: hidden;
    color: var(--ui-muted);
    font-size: 11px;
    font-weight: 700;
    text-overflow: ellipsis;
  }
  #page-title .hdr-en::before,
  #page-title .hdr-en::after { content: none; }
  #org-switcher-container { flex: 0 1 auto; max-width: 110px; min-width: 0; overflow: hidden; }

  /* 右侧：点名、快速开单（图标）+「⋯」 */
  .header-tools {
    flex: 0 0 auto;
    order: 0;
    width: auto;
    gap: 6px;
    margin: 0;
    padding: 0;
    overflow: visible;           /* 不能裁切：「⋯」下拉要从这里伸出来 */
    -webkit-mask-image: none;
            mask-image: none;
  }
  .header-tools .header-action-btn {
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    padding: 0;
    border-radius: 12px;
  }
  .header-tools .header-action-btn .header-action-label { display: none; }
  .header-tools .header-action-icon svg { width: 18px; height: 18px; }

  .hdr-more { display: block; position: relative; order: 2; }
  .hdr-more-btn {
    position: relative;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    color: #475569;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
  }
  .hdr-more.is-open .hdr-more-btn { color: var(--accent); background: #eef2ff; border-color: #c7d2fe; }
  .hdr-more-btn.has-badge::after {
    content: "";
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 50%;
  }

  /* 下拉菜单：一行一个，图标 + 双语两行标签 */
  .hdr-more-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 200;
    flex-direction: column;
    gap: 2px;
    min-width: 210px;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--ui-line);
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, .16);
  }
  .hdr-more.is-open .hdr-more-menu { display: flex; }
  .hdr-more-menu .header-action-btn,
  .hdr-more-menu .header-reload {
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    height: auto;
    min-height: 48px;
    padding: 6px 12px;
    color: var(--ui-ink-2);
    background: none;
    border: 0;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    text-align: left;
  }
  .hdr-more-menu .header-action-btn:hover,
  .hdr-more-menu .header-reload:hover { background: var(--ui-sunken); }
  /* (0,3,0)：压过上面「顶栏按钮只留图标」的 .header-tools .header-action-btn .header-action-label */
  .hdr-more-menu .header-action-btn .header-action-label,
  .hdr-more-menu .header-reload .header-reload-label { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
  .hdr-more-menu .hdr-en { color: var(--ui-muted); font-size: 11px; font-weight: 700; }
  .hdr-more-menu .hdr-en::before,
  .hdr-more-menu .hdr-en::after { content: none; }
  .hdr-more-menu #reg-invite-badge { position: static; margin-left: auto; }

}

/* ==========================================================================
   点名窗口 · 小平板（720–1024px，触屏）
   真机照片：这个宽度沿用手机的「卡片布局」，每个学生占 ~190px（姓名行 + 状态键行），
   加上头部（标题/班级/日期/提前补课）占掉一大截，480px 高的屏幕一次只看得到 1 个学生。
   改成真表格：一个学生一行（姓名 | 制服 | 出席/迟到/请假/缺席 | 调班），头部压成一行，
   内边距收小。横屏 ≥1024 的 Phase 3 表格规则同款，这里补上 720–1024。
   ========================================================================== */
@media screen and (min-width: 720px) and (max-width: 1024px) and (pointer: coarse) {
  #attendance-modal-overlay { padding: 6px !important; }
  .attendance-modal {
    width: min(98vw, 940px) !important;
    max-width: 940px !important;
    max-height: 100% !important;
    padding: 12px 16px !important;
  }
  /* 头部：标题/班级 在左，日期 + 提前补课 同排在右 */
  .attendance-modal .att-head { padding-bottom: 8px !important; margin-bottom: 8px !important; align-items: center !important; }
  .attendance-modal .att-head-tools { flex-direction: row !important; align-items: center !important; gap: 8px !important; }
  .attendance-modal .att-date-label { display: none; }
  .attendance-modal .att-date-field { width: 150px !important; }
  .attendance-modal #attendance-students-container { margin-bottom: 6px !important; }
  .attendance-modal .att-foot { padding-top: 8px !important; margin-top: 4px !important; }

  /* 表格：一个学生一行 */
  .attendance-table { display: table !important; width: 100%; }
  .attendance-table thead { display: table-header-group !important; }
  .attendance-table thead tr { position: static !important; top: auto !important; left: auto !important; }
  .attendance-table th { display: table-cell !important; padding: 6px 8px !important; font-size: 11px !important; }
  .attendance-table tbody { display: table-row-group !important; }
  .attendance-table tr {
    display: table-row !important;
    position: static !important;
    padding: 0 !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
  }
  .attendance-table td {
    display: table-cell !important;
    position: static !important;
    padding: 6px 8px !important;
    min-height: 0 !important;
    min-width: 0 !important;
    width: auto !important;
    text-align: left !important;
    vertical-align: middle !important;
    border-bottom: 1px solid #f1f5f9 !important;
  }
  .attendance-table td:nth-child(1) {
    display: table-cell !important;
    position: static !important;
    padding: 6px 8px !important;
    margin-bottom: 0 !important;
    font-size: 13.5px !important;
    line-height: 1.25 !important;
    background: transparent !important;
    width: 28% !important;
  }
  .attendance-table tr.is-makeup td:nth-child(1) { padding-right: 8px !important; }
  .attendance-table td:nth-child(2),
  .attendance-table td:nth-child(4) {
    display: table-cell !important;
    position: static !important;
    top: auto !important;
    right: auto !important;
    width: auto !important;
    padding: 6px 8px !important;
    min-height: 0 !important;
  }
  .attendance-table td:nth-child(2) { text-align: center !important; width: 64px !important; }
  .attendance-table tr.is-makeup td:nth-child(2) { right: auto !important; }
  .attendance-table td:nth-child(4) { text-align: right !important; white-space: nowrap; display: table-cell !important; gap: 0; }
  .attendance-table td:nth-child(4) button {
    width: 44px !important; height: 44px !important; min-height: 44px !important; min-width: 44px !important;
    padding: 0 !important; margin-left: 12px !important; justify-content: center;
  }
  .attendance-table td:nth-child(4) button:first-child { margin-left: 0 !important; }
  .attendance-table td:nth-child(4) .mk-label { display: none; }
  .attendance-table td:nth-child(3) { display: table-cell !important; padding: 6px 8px !important; }
  .attendance-table td:nth-child(3) > div { display: flex !important; gap: 6px !important; flex-wrap: nowrap !important; justify-content: flex-start !important; }
  .attendance-table .status-btn {
    flex-direction: row !important;
    gap: 5px !important;
    padding: 8px 6px !important;
    min-height: 44px !important;
    font-size: 12.5px !important;
    white-space: nowrap;
  }
}

/* 点名 · 小平板：再压一轮（头部一行、姓名区两行；矮屏隐藏表头，按钮本身已带文字） */
@media screen and (min-width: 720px) and (max-width: 1024px) and (pointer: coarse) {
  .attendance-modal .att-head { flex-direction: row !important; justify-content: space-between !important; text-align: left !important; }
  .attendance-modal .att-head-title { text-align: left !important; }
  .attendance-modal .att-title-full { display: none !important; }
  .attendance-modal .att-title-short { display: inline !important; }
  .attendance-modal .att-head h2 { font-size: 17px !important; }
  .attendance-modal .att-head p { margin-top: 2px !important; font-size: 12px !important; }
  .attendance-table .attendance-student-points { display: inline-block !important; margin: 0 0 0 8px !important; }
  .attendance-table td:nth-child(1) { line-height: 1.2 !important; }
}
@media screen and (min-width: 720px) and (max-width: 1024px) and (max-height: 700px) and (pointer: coarse) {
  .attendance-table thead { display: none !important; }
}
