/* ═══════════════════════════════════════════════════════════════
   速课 · 代理工作台样式
   ═══════════════════════════════════════════════════════════════

   设计意图
   ────────
   刷课平台的使用者是「代理」—— 他们一天要看几十单，追求的是
   **扫一眼就知道余额够不够、这门课多少钱、点了会发生什么**。

   所以这套样式优先级：
   1. 数字必须极其醒目（余额、单价、合计用 32-40px tabular-nums）
   2. 主操作路径（查课 → 勾选 → 下单）在**一个屏幕内完成**，不翻页
   3. 状态色必须一眼可分（成功绿 / 待核对橙 / 失败红）
   4. 深色是刻意的：代理常长时间盯着看，深色不刺眼；且霓虹渐变让
      「价格」和「按钮」在视觉上跳出来

   不要做的
   ────────
   - 灰白简约（上一版被否，太像后台管理系统，没有"业务感"）
   - 大段文字说明（代理不看文档）
   - 需要刷新的交互（查课/下单都 fetch 局部更新）
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* ── 背景层 ── */
  --bg-0: #08060f;
  --bg-1: #0f0d23;
  --bg-2: #1a1740;

  /* ── 玻璃卡片 ── */
  --card: rgba(255, 255, 255, 0.055);
  --card-hover: rgba(255, 255, 255, 0.085);
  --card-solid: #16132e;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);

  /* ── 文字 ──
     ⚠ `--ink-3` 从 `#7e7a99` 提到了 `#9a96b5`（2026-12-04，审计② A1 的连带修复）。

     旧值 `#7e7a99` 的自述「4.66:1」是按 `--bg-1`（`#0f0d23`）算的，但次要文字
     几乎从不直接坐在 `--bg-1` 上 —— 它坐在**半透明玻璃卡片**里。实测（真实截图
     像素合成，不是算令牌理论值）：

     | 组合 | 旧值 `#7e7a99` | 新值 `#9a96b5` |
     |---|---|---|
     | on `--bg-1` | 4.66 | 6.72 |
     | on 玻璃卡片（`--card` 叠 `--bg-1`） | 4.14 | 5.98 |
     | on 玻璃卡片（叠在 `--bg-2` 上，页面下半部） | **3.56** | 5.14 |
     | 同上 + `tbody tr:hover`（`rgba(255,255,255,.045)`） | **3.12** | 4.50 |
     | on 输入框底（`rgba(0,0,0,.28)` 叠玻璃卡） | 4.10 | 5.92 |

     全部低于 4.5:1 ⇒ 12px 的正文不达 AA。审计② 实测到的两处就是
     `.kpi .l`（「可用」副标题）4.30:1 与 KPI 副标题 4.40:1。

     `#9a96b5` 是最小的、能把**最坏组合**（悬停行 4.50:1）推过 AA 的取值；
     再浅一档就变成 `--ink-2` 的观感，次要文字与正文不再分层（那是设计上的损失）。 */
  --ink: #f1f0f7;
  --ink-2: #b9b6cc;
  --ink-3: #9a96b5;

  /* ── 强调 ── */
  --mint: #10b981;
  --mint-2: #059669;
  --violet: #8b5cf6;
  --violet-2: #7c3aed;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --sky: #38bdf8;

  /* ── 尺寸 ── */
  --r-card: 16px;
  --r-btn: 10px;
  --r-pill: 999px;
  --sidebar: 224px;

  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.32);
  --shadow-glow-mint: 0 6px 24px rgba(16, 185, 129, 0.32);
}

* { box-sizing: border-box; }

/* ⚠ 背景必须挂在 html 上，且**不能**用 background-attachment: fixed。
   fixed 的语义是「相对视口固定」，长页面滚动/整页截图时只有视口那一段有背景，
   其余部分是白的（实测：全页截图下半部纯白）。
   挂在 html 上 + min-height:100% 才能让整页都有渐变。 */
html {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
    radial-gradient(900px 500px at 85% 0%, rgba(16, 185, 129, 0.12), transparent 55%),
    linear-gradient(165deg, var(--bg-0) 0%, var(--bg-1) 45%, var(--bg-2) 100%);
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: transparent;
  color: var(--ink);
  font: 14px/1.65 system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

a { color: var(--sky); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════ 登录页 ═══════════════
   参考「爱学习」模板的 Auth 布局：左品牌区 + 右表单区（大屏），
   小屏堆叠成单卡片。

   为什么比「居中单卡片」好：品牌区可以放价值主张（"全网课平台代刷 · 代理专用"），
   代理第一次打开就知道这是干什么的；而且视觉上左右分治比居中卡片更有层次。
*/

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

/* ── 左：品牌区 ── */
.auth-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 20% 15%, rgba(139, 92, 246, 0.42), transparent 62%),
    radial-gradient(700px 460px at 80% 85%, rgba(16, 185, 129, 0.3), transparent 60%),
    linear-gradient(160deg, #1a1442 0%, #2a1f63 55%, #16325c 100%);
  display: flex;
  flex-direction: column;
  padding: 56px 54px;
}

/* 细网格纹理，让大色块不至于太"平" */
.auth-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 30% 30%, #000 0%, transparent 75%);
  -webkit-mask-image: radial-gradient(circle at 30% 30%, #000 0%, transparent 75%);
  pointer-events: none;
}

.auth-brand > * { position: relative; z-index: 1; }

.auth-brand .brand {
  margin-bottom: 0;
  gap: 12px;
}

.auth-brand .brand-mark {
  width: 44px;
  height: 44px;
  font-size: 22px;
  border-radius: 13px;
  background: linear-gradient(135deg, #34d399, #8b5cf6);
  box-shadow: 0 6px 22px rgba(52, 211, 153, 0.4);
}

.auth-brand .brand-name {
  font-size: 23px;
  letter-spacing: -0.025em;
}

.auth-hero {
  margin: auto 0;
  max-width: 440px;
}

.auth-hero h2 {
  font-size: 34px;
  line-height: 1.28;
  font-weight: 750;
  letter-spacing: -0.03em;
  margin: 0 0 18px;
  color: #fff;
}

.auth-hero h2 .hl {
  background: linear-gradient(120deg, #6ee7b7, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.auth-hero p {
  font-size: 14.5px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.66);
  margin: 0;
}

.auth-points {
  display: flex;
  flex-direction: column;
  gap: 11px;
  margin-top: 30px;
}

.auth-points .pt {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.82);
}

.auth-points .pt .dot {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid rgba(16, 185, 129, 0.4);
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #6ee7b7;
  flex-shrink: 0;
}

.auth-brand .foot {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.42);
}

/* ── 右：表单区 ── */
.auth-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background: var(--bg-1);
}

.auth-form {
  width: 100%;
  max-width: 388px;
}

.auth-form .lead {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 7px;
}

.auth-form .sub {
  font-size: 13px;
  color: var(--ink-3);
  margin: 0 0 30px;
}

.auth-form .btn { margin-top: 6px; }

.auth-form .foot {
  margin-top: 24px;
  padding-top: 19px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.7;
}

/* ═══════════════ 品牌标识（登录页与侧栏共用） ═══════════════ */

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 6px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--mint), var(--violet));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 19px;
  color: #fff;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.42);
  flex-shrink: 0;
}

.brand-name {
  font-size: 21px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* 小屏：品牌区收成一个头部条 */
@media (max-width: 940px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand {
    padding: 26px 24px 30px;
    min-height: auto;
  }
  .auth-brand::before { display: none; }
  .auth-hero { margin: 24px 0 0; }
  .auth-hero h2 { font-size: 24px; margin-bottom: 10px; }
  .auth-hero p { font-size: 13px; }
  .auth-points, .auth-brand .foot { display: none; }
  .auth-form-wrap { padding: 32px 22px 48px; align-items: flex-start; }
  .auth-form .lead { font-size: 19px; }
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 7px;
  font-weight: 500;
}

/* 裸 `input` 必须与 `.input` 一起列出来 —— 不能只靠 `input[type="text"]`。
   HTML 里 `<input>` 不写 `type` 时**默认就是 text，但属性选择器匹配不到
   不存在的属性**。后台的调账 / 额度输入框全是 `<input id="amount">` 这种写法，
   于是一条都命中不了，只剩 `_CSS` 的 `background:#fff` + 本文件的 `color:var(--ink)`
   → 白底白字，`100.00` 肉眼看不见（2026-12-04 截图实测）。
   加裸 `input` 会顺带命中 checkbox/radio/file，它们在下方按类型复位。 */
.input,
input,
input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  padding: 11px 13px;
  color: var(--ink);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 140ms, box-shadow 140ms, background 140ms;
}

.input::placeholder { color: var(--ink-3); }
input::placeholder { color: var(--ink-3); }

/* 上面那条裸 `input` 会把 checkbox / radio / file 也画成深色输入框。
   这三类按类型复位：勾选框不能有背景和边框（否则是一个 20×20 的深色块），
   file 的按钮由浏览器原生画，加内边距会挤变形。 */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  background: none;
  border: 0;
  padding: 0;
  accent-color: var(--mint);
}

input[type="file"] {
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
}

.input:focus,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.65);
  background: rgba(0, 0, 0, 0.38);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border-radius: var(--r-btn);
  padding: 10px 17px;
  font-size: 13.5px;
  font-weight: 550;
  font-family: inherit;
  cursor: pointer;
  transition: transform 140ms, background 140ms, box-shadow 140ms, border-color 140ms;
  white-space: nowrap;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn:active { transform: translateY(0); }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--mint), var(--mint-2));
  border-color: transparent;
  color: #04180f;
  font-weight: 650;
  box-shadow: var(--shadow-glow-mint);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #14c78e, #06a874);
  box-shadow: 0 8px 30px rgba(16, 185, 129, 0.44);
}

/* 紫按钮：文字白。
   ⚠ 对比度实测（2026-12-04）：
     #8b5cf6 + 白 = 4.23:1  ← 不达 AA(4.5)，差一点
     #7c3aed + 白 = 5.70:1  ← AA ✓
   `--violet-2` (#7c3aed) 是渐变的终点，但渐变**起点**是 #8b5cf6，
   按钮文字压在整个渐变上，最亮处只有 4.23 —— 所以起点也要压深。
   改用 #7c3aed → #6d28d9（5.70 → 7.10），整段都过 AA。 */
.btn-violet {
  background: linear-gradient(135deg, #7c3aed, #6d28d9);
  border-color: transparent;
  color: #fff;
  font-weight: 650;
  box-shadow: 0 6px 24px rgba(109, 40, 217, 0.36);
}

.btn-violet:hover {
  background: linear-gradient(135deg, #8b5cf6, #7c3aed);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.46);
}

.btn-danger {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.32);
  background: rgba(244, 63, 94, 0.1);
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.18); }

.btn-block { width: 100%; }

.btn-lg {
  padding: 13px 22px;
  font-size: 15px;
  border-radius: 12px;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12.5px;
  border-radius: 8px;
}

/* ═══════════════ 登录页错误 ═══════════════ */

.alert {
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 13px;
  margin-bottom: 18px;
  border: 1px solid transparent;
  line-height: 1.55;
}

.alert-err {
  background: rgba(244, 63, 94, 0.13);
  border-color: rgba(244, 63, 94, 0.34);
  color: #fecdd3;
}

.alert-ok {
  background: rgba(16, 185, 129, 0.13);
  border-color: rgba(16, 185, 129, 0.34);
  color: #a7f3d0;
}

.alert-warn {
  background: rgba(245, 158, 11, 0.13);
  border-color: rgba(245, 158, 11, 0.34);
  color: #fde68a;
}

.login-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--ink-3);
  font-size: 12px;
}

/* ═══════════════ 工作台布局 ═══════════════ */

.shell {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: rgba(12, 10, 26, 0.72);
  backdrop-filter: blur(16px);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand { margin: 0 6px 26px; }
.sidebar .brand-name { font-size: 17px; }

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-radius: 9px;
  color: var(--ink-2);
  font-size: 13.5px;
  text-decoration: none;
  transition: background 140ms, color 140ms;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  text-decoration: none;
}

.nav a.on {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.18), rgba(139, 92, 246, 0.14));
  color: var(--ink);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.22);
}

.nav a .ico {
  width: 17px;
  text-align: center;
  opacity: 0.85;
  font-size: 15px;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.agent-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
  margin-bottom: 8px;
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--violet), var(--sky));
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

/* `flex: 1` + `min-width: 0` 缺一不可：
   flex 项默认 `min-width: auto`，长代理名（「示例代理·白科技」这类）会把
   `.agent-chip` 撑宽、名字换行压到「代理账户」上（实测截图里两行叠在一起）。 */
.agent-meta {
  flex: 1;
  min-width: 0;
}
.agent-meta .n {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-meta .l { font-size: 11.5px; color: var(--ink-3); }

/* ═══════════════ 主区 ═══════════════ */

.main { padding: 0 0 80px; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 8, 22, 0.5);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.topbar .spacer { flex: 1; }

.balance-pill {
  display: flex;
  align-items: baseline;
  gap: 7px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(16, 185, 129, 0.26);
  border-radius: var(--r-pill);
  padding: 7px 16px;
}

.balance-pill .k { font-size: 11.5px; color: var(--ink-2); }

.balance-pill .v {
  font-size: 17px;
  font-weight: 700;
  color: #6ee7b7;
  letter-spacing: -0.02em;
}

/* 底部留白必须够：`.action-bar` 是 `position:fixed` 的浮动条，
   它在勾选后升起，会盖住表格最后一行（实测：第三门课被压在「已选 2 门」下面）。
   120px = 操作条高度 + 呼吸空间。 */
.content { padding: 26px 28px 40px; max-width: 1180px; }

/* ═══════════════ 卡片 ═══════════════ */

.card {
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 22px 24px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-card);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.card-head h2 {
  font-size: 15px;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.card-head .hint {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-left: auto;
}

/* ═══════════════ KPI ═══════════════ */

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}

/* 顶部渐变条是这个卡片唯一的「色彩锚点」。原来是 2px + opacity .6：
   在 1440 的桌面上勉强能看见，在 390 的手机上（KPI 被压到 ~170px 宽）
   它细得像一条渲染接缝，用户读到的信息就只剩「一个数字 + 一行灰字」。
   3px + .78 是实测能在 DPR 2/3 的手机屏上稳定显形的最小值。 */
.kpi::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, var(--mint), var(--violet));
  opacity: 0.78;
}

.kpi .n {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.kpi .n.mint { color: #6ee7b7; }
.kpi .n.violet { color: #c4b5fd; }
.kpi .n.amber { color: #fcd34d; }

.kpi .l {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 5px;
}

/* ═══════════════ 查课表单 ═══════════════ */

.query-grid {
  display: grid;
  grid-template-columns: 1.7fr 1.4fr 0.8fr auto;
  gap: 12px;
  align-items: end;
}

.query-grid .field { margin: 0; }

.query-grid .btn { height: 42px; }

/* ═══════════════ 表格 ═══════════════ */

.table-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.16);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12px;
  text-align: left;
  padding: 11px 14px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

/* ── 表格行高 ──
   `tbody td` 的 `height` 在表格布局里等价于 `min-height`。
   加显式 44px 是因为「单行 + 短单元格」的行（订单号行、流水行）纯粹靠
   `padding` 撑出来只有 ~45px，而**只要有任何一个单元格是单行文本**整行就
   跟着它走。写死 44px 让触控标准不依赖字体的实际行高（`system-ui` 在
   Windows / Android / iOS 上的 metrics 差 3–4px，靠 padding 恰好卡线不可靠）。 */
tbody td {
  padding: 12px 14px;
  height: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: middle;
}

/* 勾选列：单元格本身让位给 44×44 的 `<label>` 命中区（见 `.cb-hit`）。
   `padding: 0` + 固定宽度是为了让 44px 的 label 不被 12/14 的内边距挤小。 */
td.pick,
th.pick {
  padding: 0;
  width: 44px;
  text-align: center;
}

/* 勾选的**命中区**。视觉框还是 17px（`.cb`），但这里把它包进一个 44×44 的
   label：手指点在一门课的行首附近任意位置都能选中，不用瞄准那个小方块。
   为什么不干脆把 `.cb` 画成 44px：一排 44px 的空心方块会在视觉上盖过课程名，
   整张表会读成一列开关而不是一张课程表。 */
.cb-hit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}

/* checkbox 用自定义样式，原生在深色下很难看 */
.cb {
  appearance: none;
  -webkit-appearance: none;
  width: 17px; height: 17px;
  flex: 0 0 auto;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  position: relative;
  transition: background 120ms, border-color 120ms;
  vertical-align: middle;
  margin: 0;
}

.cb:checked {
  background: linear-gradient(135deg, var(--mint), var(--mint-2));
  border-color: transparent;
}

.cb:checked::after {
  content: "";
  position: absolute;
  left: 5px; top: 1.5px;
  width: 4px; height: 9px;
  border: solid #04180f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.cb:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

/* ── 长文本 ──
   课程名在上游是「网站开发技术---266230561---湖北省---武汉市」这种拼接串，
   可以到 40+ 字。桌面表格里它会自己换行（列宽够），小屏卡片里则会吃掉
   4–5 行、把「单价」挤出视野。所以：桌面完整显示，卡片按 2 行截断 +
   `title` 悬停看全名（服务端已经给每个 `.truncate` 写了 title）。 */
.truncate {
  min-width: 0;
  word-break: break-word;
}

/* 单号要能被整串选中（代理复制它去找客服）。
   `user-select: all` 让单击即全选，不用拖 —— 手机上拖选 18 位串几乎不可能。 */
.no { user-select: all; -webkit-user-select: all; }


tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background 120ms;
}

tbody tr:hover { background: rgba(255, 255, 255, 0.045); }

tbody tr.sel { background: rgba(16, 185, 129, 0.09); }

.num { text-align: right; font-variant-numeric: tabular-nums; }

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12.5px;
}

.muted { color: var(--ink-3); }
.small { font-size: 12px; }

.price {
  font-weight: 650;
  color: #6ee7b7;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* checkbox 用自定义样式，原生在深色下很难看 */
.cb {
  appearance: none;
  width: 17px; height: 17px;
  border: 1.5px solid var(--border-strong);
  border-radius: 5px;
  background: rgba(0, 0, 0, 0.3);
  cursor: pointer;
  position: relative;
  transition: background 120ms, border-color 120ms;
  vertical-align: middle;
}

.cb:checked {
  background: linear-gradient(135deg, var(--mint), var(--mint-2));
  border-color: transparent;
}

.cb:checked::after {
  content: "";
  position: absolute;
  left: 5px; top: 1.5px;
  width: 4px; height: 9px;
  border: solid #04180f;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

/* ═══════════════ 徽章 ═══════════════ */

.badge {
  display: inline-block;
  padding: 2.5px 10px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}

.b-paid { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.3); }
.b-pending { background: rgba(245, 158, 11, 0.16); color: #fcd34d; border-color: rgba(245, 158, 11, 0.3); }
.b-failed { background: rgba(244, 63, 94, 0.16); color: #fda4af; border-color: rgba(244, 63, 94, 0.3); }
.b-created { background: rgba(148, 163, 184, 0.14); color: #cbd5e1; border-color: rgba(148, 163, 184, 0.26); }
.b-completed { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; border-color: rgba(56, 189, 248, 0.3); }
.b-refunded { background: rgba(139, 92, 246, 0.16); color: #c4b5fd; border-color: rgba(139, 92, 246, 0.3); }
.b-cancelled { background: rgba(100, 116, 139, 0.16); color: #94a3b8; border-color: rgba(100, 116, 139, 0.28); }

/* ═══════════════ 下单操作条（sticky） ═══════════════ */

/* ⚠ 注：上面两条注释是迭代过程留下的，以**下面这条规则**为准。

   最终选择：`position: sticky; bottom: 0`，且**在表格之后**（DOM 顺序）。
   - `fixed` 不参与布局 → 必须靠 padding 硬凑，内容高度一变就凑不准（实测盖住第三行）
   - `sticky` 在文档流里 → 短页面时自然落在表格下方，长页面时贴住视口底部
   - **`bottom: 0` 而不是 `18px`**：留 18px 会让它悬空，视觉上像"浮在表格上"；
     贴住底部才像"表单的提交栏"

   ⚠ 还有一个坑：sticky 元素**必须有可滚动空间**才会"贴"。
   如果它已经是页面最后一个元素且页面不够长，它就停在原位（等于 static）。
   这是**正确的行为** —— 短页面里它就是表格下面的一个普通条，不遮任何东西。 */
.action-bar {
  position: sticky;
  bottom: 0;
  margin-top: 16px;
  z-index: 40;
  background: rgba(20, 16, 42, 0.96);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(16, 185, 129, 0.32);
  border-radius: 14px;
  padding: 13px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.5);
  transition: opacity 180ms, transform 220ms cubic-bezier(0.34, 1.36, 0.64, 1);
  max-width: 1180px;
}

/* 未勾选时不占位：否则「已选 0 门」的空条会一直压在表格下面。 */
.action-bar:not(.show) {
  display: none;
}

.action-bar .stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.action-bar .stat .k { font-size: 11.5px; color: var(--ink-3); }
.action-bar .stat .v {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.action-bar .stat .v.mint { color: #6ee7b7; }
.action-bar .spacer { flex: 1; }

/* ═══════════════ 空状态 ═══════════════ */

.empty {
  text-align: center;
  padding: 52px 24px;
  color: var(--ink-3);
}

.empty .big {
  font-size: 40px;
  opacity: 0.35;
  margin-bottom: 12px;
  line-height: 1;
}

.empty .t {
  font-size: 14.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 550;
}

.empty .s { font-size: 12.5px; }

/* ═══════════════ 加载态 ═══════════════ */

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  border-top-color: var(--mint);
  border-radius: 50%;
  animation: spin 640ms linear infinite;
  display: inline-block;
  vertical-align: -2px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.05) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(255, 255, 255, 0.05) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  border-radius: 6px;
  height: 14px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ═══════════════ 价格表 ═══════════════ */

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(258px, 1fr));
  gap: 14px;
}

.price-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  transition: transform 160ms, border-color 160ms, background 160ms;
}

.price-card:hover {
  transform: translateY(-2px);
  border-color: rgba(16, 185, 129, 0.34);
  background: var(--card-hover);
}

.price-card .plat {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-bottom: 5px;
}

.price-card .title {
  font-size: 14.5px;
  font-weight: 620;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.price-card .amount {
  font-size: 27px;
  font-weight: 700;
  color: #6ee7b7;
  letter-spacing: -0.03em;
  line-height: 1;
}

.price-card .amount .u {
  font-size: 12px;
  color: var(--ink-3);
  font-weight: 400;
  margin-left: 4px;
}

.price-card .meta {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
}

/* ═══════════════ 流水 ═══════════════ */

.ledger-delta { font-weight: 650; font-variant-numeric: tabular-nums; }
.ledger-delta.in { color: #6ee7b7; }
.ledger-delta.out { color: #fda4af; }
.ledger-delta.hold { color: var(--ink-3); font-weight: 500; }

/* ═══════════════ toast ═══════════════ */

#toast {
  position: fixed;
  top: 20px;
  left: 50%;
  /* 起始位置必须真的移出视口：`-120%` 只能遮住自身高度的 1.2 倍，
     而 toast 有 padding + border，露出的那一条在深色背景上是个明显的白块
     （登录页实测截图右上角就有一条）。改用 `calc` 加上自身高度余量。 */
  transform: translate(-50%, calc(-100% - 40px));
  background: rgba(22, 19, 46, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  padding: 12px 20px;
  font-size: 13.5px;
  z-index: 999;
  transition: transform 260ms cubic-bezier(0.34, 1.4, 0.64, 1);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  max-width: 90vw;
}

#toast.show { transform: translate(-50%, 0); }
#toast.err { border-color: rgba(244, 63, 94, 0.42); color: #fecdd3; }
#toast.ok { border-color: rgba(16, 185, 129, 0.42); color: #a7f3d0; }

/* ═══════════════════════════════════════════════════════════════════════
   [MOBILE-a11y] 可访问性与移动端适配 —— 由移动端智能体独占
   ═══════════════════════════════════════════════════════════════════════

   本区块（到下方 `[MOBILE-a11y END]` 为止）由移动端智能体维护。
   另一位同事正在同一份文件里追加「订单详情 / 状态 tab」的样式，
   请勿在上方既有区块内插入规则，也不要改动本区块的选择器。

   包含：
     1. 表格行高 44px + 勾选命中区 44×44（`.cb-hit`，见上方「表格」区块）
     2. 键盘焦点环 `:focus-visible`
     3. `prefers-reduced-motion: reduce` / `prefers-contrast: more`
     4. `backdrop-filter` 的纯色回退
     5. `≤720px` 表格 → 卡片的 grid 重排（依赖 `agentui.py` 的 `data-label`）

   ⚠ 顺序陷阱（实测踩过）：媒体查询**不提升特异度**。本区块里 `≤720px` 对
   `.tabs` / `.kv-grid` / `.progress` 的覆盖必须放在文件**最末尾**
   （见 `[MOBILE-a11y: 末尾补丁]`），否则会被同事在后面追加的基础样式
   静默盖掉 —— 症状是 390px 下 tab 高度退回 38px、第 6 个标签被切一半。
   ═══════════════════════════════════════════════════════════════════════ */

/* ═══════════════ 键盘焦点环 ═══════════════

   为什么必须有：整套 UI 的「当前在哪」全靠 hover 变色暗示 —— 鼠标用户无感，
   键盘用户一旦按 Tab 就彻底失明。`outline: none` 是本项目唯一一处真正的可访问性
   违规（`.input:focus` 只给了 border + box-shadow，按钮则什么都没给）。

   为什么用 `:focus-visible` 而不是 `:focus`：鼠标点按钮也会触发 `:focus`，
   那样每次点「查课」都会留一圈绿框，看着像报错。`:focus-visible` 只在
   「浏览器判定用户需要看到焦点」时命中（键盘 Tab、方向键），点鼠标不命中。

   为什么用 `outline` 而不是 `box-shadow`：`outline` 不占布局、不参与圆角，
   且在高对比模式下会被系统替换成系统色（`box-shadow` 不会）——
   见下方 `prefers-contrast: more`。

   ⚠ 这条规则必须排在 `.input:focus{outline:none}` **之后**：两者特异度相同
   （类 + 伪类），靠源序决胜。 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
  /* 去掉那一圈 box-shadow 绿色泛光，否则「焦点环 + 泛光」叠起来太糊 */
  box-shadow: none;
}

/* 勾选框的焦点环要跟到 17px 的视觉框上，而不是外包的 44px label ——
   否则键盘用户看到的是一个框住整格的大圆圈，跟实际会被 Space 切换的
   那个方块对不上。 */
.cb:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

/* 行内被选中的焦点落在 checkbox 上时，用行的背景再强化一次位置感：
   深色表格里 2px 的环在一屏 20 行里不够显眼。 */
tbody tr:has(.cb:focus-visible) {
  background: rgba(16, 185, 129, 0.1);
}

/* ═══════════════ 减少动态效果 ═══════════════

   `prefers-reduced-motion: reduce` 不是「关掉所有动画」，而是关掉**位移**类
   动画 —— 前庭功能敏感的用户会被 `translateY` / `translateX` / `rotate` 引发
   眩晕，而纯淡入（opacity）几乎不会。所以这里逐条把 `transform` 归零，
   保留 `opacity` 与 `background` 的过渡。

   注意 `animation: spin` 必须保留：spinner 是「请求还在跑」的唯一信号，
   停掉它等于让加载态看起来像卡死。只把它放慢。 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* 把「位移」压平成「变色」：按钮仍会亮一下，只是不再往上跳 */
  .btn:hover,
  .btn:active,
  .price-card:hover,
  .kpi:hover {
    transform: none;
  }

  .sidebar { transition: none; }
  #toast { transition: opacity 120ms linear; transform: translate(-50%, 0); }
  #toast:not(.show) { opacity: 0; pointer-events: none; }
  #toast.show { opacity: 1; }

  /* spinner 是加载态的唯一信号，慢放而不是停转 */
  .spinner { animation-duration: 1.6s !important; animation-iteration-count: infinite !important; }
  .skeleton { animation: none; background: rgba(255, 255, 255, 0.07); }
}

/* ═══════════════ 高对比模式 ═══════════════

   `prefers-contrast: more` 的用户是在「看得见但很吃力」的区间里 —— 他们不缺
   对比度达标的正文（我们 16.83:1），缺的是**结构**：卡片的边界、表格的分隔线、
   次要文字的层级。所以这里加深边框、提亮次要文字，配色本身不动。

   ⚠ 不去碰 `--ink-3` 到接近 `--ink-2`：`--ink-3` 是 4.66:1（刚好过 AA），
   高对比用户需要的是把它推到 ≥7:1，即 `#9d99b8`（≈7.4:1）。 */
@media (prefers-contrast: more) {
  :root {
    --border: rgba(255, 255, 255, 0.28);
    --border-strong: rgba(255, 255, 255, 0.5);
    --card: rgba(255, 255, 255, 0.1);
    --ink-2: #d6d3e4;
    --ink-3: #9d99b8;
  }

  .card,
  .kpi,
  .price-card,
  .table-wrap {
    border-width: 2px;
    border-color: var(--border);
  }

  tbody td,
  thead th {
    border-bottom-color: rgba(255, 255, 255, 0.22);
  }

  /* 徽章本来只靠「浅色字 + 半透明底」区分，高对比下底色会糊进卡片背景，
     必须给实边框 */
  .badge { border-color: currentColor; }

  /* 焦点环改用系统色：高对比模式常配合强制配色，系统色比我们的 mint 更可靠 */
  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  textarea:focus-visible,
  .cb:focus-visible {
    outline-color: Highlight;
    outline-width: 3px;
  }

  .muted { color: var(--ink-3); }
}

/* ═══════════════ backdrop-filter 回退 ═══════════════

   `backdrop-filter` 在 Firefox 103 之前、Safari 9–15（无 `-webkit-` 前缀时）、
   以及一堆国产套壳浏览器里是**静默失效**的：卡片不会报错，只是背景彻底透明，
   于是深色渐变背景直接透上来，`.card` 与页面背景糊成一片 —— 用户看到的是
   「卡片没有边界」，而我们会以为是配色问题。

   `@supports not (...)` 只在**不支持时**命中，所以要在这里把半透明换成实色，
   而不是在支持时叠加。颜色取卡片色与 `--bg-1` 的混合结果（`#16132e`），
   保证视觉与「有模糊时」接近。 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .card,
  .kpi,
  .price-card {
    background: var(--card-solid);
  }

  .sidebar,
  .topbar,
  .action-bar,
  #toast {
    background: #131029;
  }

  /* 没有模糊时玻璃感全靠边框，把它加深一档补回来 */
  .card,
  .kpi,
  .price-card {
    border-color: rgba(255, 255, 255, 0.14);
  }
}

/* ═══════════════ 响应式 ═══════════════ */


@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    width: 264px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 220ms;
    height: 100vh;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: inline-flex !important; }
  .content { padding: 18px 16px 0; }
  .topbar { padding: 14px 16px; }
  .query-grid { grid-template-columns: 1fr; }
  .query-grid .btn { width: 100%; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .action-bar {
    bottom: 12px;
    padding: 12px 14px;
    gap: 12px;
    flex-wrap: wrap;
  }
  .action-bar .btn { flex: 1; }
  .scrim {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 55;
  }
  .scrim.show { display: block; }
}

/* ═══════════════ ≤720px：表格重排成卡片 ═══════════════

   这是本次改造的核心，理由写在 `agentui.py` 的 `_pick_td` 上方（单份 DOM +
   `data-label` 伪元素），这里只说 CSS 侧的三个决定：

   1. **为什么是 720 而不是 768**：390–430 的主流手机宽度下，6 列订单表每列只剩
      55–65px（单号本身就要 150px 等宽字），横滚是唯一「不重排」的出路 —— 而横滚
      在触屏上会和纵向滚动抢手势，代理经常滚到一半变成横向漂移。720 这个数来自
      「6 列表格保持可读所需的最小宽度 ≈ 700px」，而不是某个设备宽度。

   2. **`<tr>` 变成 grid 容器，`<td>` 用 `grid-area` 摆放**。单纯 `display:block`
      只是把表格「竖过来」，字段还是一条条平铺（课程名、¥0.80、可下单各占一整行），
      390px 高的屏幕上 3 门课就要滚两屏。grid 让同一行的信息仍然靠视觉聚合。

   3. **`thead` 用 `display:none` 而不是 `visually-hidden`**：表格角色在
      `tr{display:block}` 之后本来就失效了（见 agentui 的说明），留一个占位的
      thead 只会多出一行空白。字段名改由每个 `td::before` 提供。 */

@media (max-width: 720px) {
  .table-wrap {
    /* 关掉 900px 那条 `overflow-x: auto` —— 不重排就横滚是我们要消灭的东西。
       `overflow: visible` 而不是 `hidden`：卡片有 1px 边框 + 圆角，裁切会切掉
       焦点环（`outline-offset: 2px` 是画在盒子外面的）。 */
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
  }

  .table-wrap thead { display: none; }

  .table-wrap tbody tr {
    display: grid;
    align-items: center;
    gap: 1px 12px;
    padding: 12px 14px;
    margin-bottom: 9px;
    background: rgba(255, 255, 255, 0.045);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: background 120ms, border-color 120ms;
  }

  .table-wrap tbody tr:last-child { margin-bottom: 0; }

  /* 选中态在卡片模式下要更明显：桌面的 9% 底色在 1px 卡框里几乎看不出，
     再补一条左描边（青绿），让「已勾选」在任何滚动位置都能被扫到。 */
  .table-wrap tbody tr.sel {
    background: rgba(16, 185, 129, 0.12);
    border-color: rgba(16, 185, 129, 0.42);
    box-shadow: inset 3px 0 0 var(--mint);
  }

  .table-wrap tbody td {
    height: auto;
    padding: 0;
    border: 0;
    /* 桌面端 `.num` 是右对齐（数字成列才好比大小），卡片模式下右对齐会让
       金额和课程名各自贴在两边，眼睛要来回跳。统一左对齐。 */
    text-align: left;
  }

  .table-wrap tbody td.num { text-align: left; }

  /* 字段名。11px 是 `--ink-3`(4.66:1) 在深色底上仍能过 AA 的下限字号；
     再小就要提色，而提色会让「字段名」和「值」的层级反过来。 */
  .table-wrap tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ink-3);
    letter-spacing: 0.02em;
  }

  /* 值本身已经是自解释的（名字 / 徽章 / 大号金额），再压一行字段名只是噪音 */
  .t-courses tbody td.name::before,
  .t-courses tbody td.price::before,
  .t-courses tbody td.status::before,
  .t-orders tbody td.no::before,
  .t-orders tbody td.name::before {
    display: none;
  }

  /* ── 查课结果卡：[勾选区] 课程名 + 状态 / 单价 ──
     勾选区跨两行：它是手机上唯一的主操作，纵向占满整卡左侧，
     手指从课程名往下滑不会落空。

     徽章放**第一行右侧**而不是单独占第二行：单独占一行时它右对齐，
     左边空出一大片，看起来像「这行没渲染完」。 */
  .t-courses tbody tr {
    grid-template-columns: 44px minmax(0, 1fr) auto;
    grid-template-areas:
      "pick name   state"
      "pick price  price";
    padding: 8px 14px 10px 6px;
  }

  .t-courses td.pick { grid-area: pick; }
  .t-courses td.name { grid-area: name; }
  .t-courses td.price {
    grid-area: price;
    font-size: 16px;
    /* 单价与课程名左对齐：右对齐会让眼睛在两个边上跳，
       而这里是「同一门课的两个属性」。 */
    text-align: left;
  }
  .t-courses td.status { grid-area: state; align-self: start; }

  /* 课程名最多两行。上游的课名是
     「网站开发技术---266230561---湖北省---武汉市」这种拼接串，完整显示会
     把单价和状态挤出卡片；`title` 里保留了全名（长按/悬停可见）。 */
  .t-courses .truncate {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 14.5px;
    line-height: 1.5;
    font-weight: 550;
  }

  /* ── 订单卡：单号 + 状态 / 课程 / 金额 · 账号 · 时间 ── */
  .t-orders tbody tr {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "no     no    status"
      "name   name  name"
      "amount user  when";
    row-gap: 4px;
  }

  .t-orders td.no { grid-area: no; font-size: 11.5px; color: var(--ink-3); }

  /* 单号是详情页的入口，但它只有 11.5px 高 —— 手指点 18 位等宽串的成功率
     很低。用一层透明伪元素把**命中区**扩到 ~44px，视觉大小一个像素不动
     （真把它撑到 44px 会把卡片第一行拉高，整张卡变矮胖）。
     上下各扩 13px 是这么算的：11.5px × 1.65 行高 ≈ 19px，19 + 13×2 ≈ 45px。 */
  .t-orders td.no a.link {
    position: relative;
    display: inline-block;
  }

  .t-orders td.no a.link::after {
    content: "";
    position: absolute;
    inset: -13px -8px;
  }
  .t-orders td.name { grid-area: name; font-size: 15px; font-weight: 600; }
  .t-orders td.user { grid-area: user; font-size: 11.5px; color: var(--ink-3); }
  .t-orders td.amount { grid-area: amount; font-size: 17px; font-weight: 700; color: #6ee7b7; }
  .t-orders td.status { grid-area: status; justify-self: end; }
  .t-orders td.when { grid-area: when; font-size: 11.5px; text-align: right; }

  .t-orders .truncate {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* ── 流水卡：类型 + 变动 / 余额 + 时间 / 备注 ── */
  .t-ledger tbody tr {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "kind  delta"
      "bal   when"
      "note  note";
    row-gap: 3px;
  }

  .t-ledger td.kind { grid-area: kind; font-size: 14px; font-weight: 600; }
  .t-ledger td.delta { grid-area: delta; font-size: 17px; text-align: right; }
  .t-ledger td.bal { grid-area: bal; }
  .t-ledger td.when { grid-area: when; text-align: right; }
  .t-ledger td.note { grid-area: note; }

  /* 备注常常是空的（充值流水没有备注）。空的备注格会在卡片底部留一条
     由 `row-gap` 生成的空隙，看起来像渲染漏了。 */
  .t-ledger td.note:empty { display: none; }

  /* 卡片里字段名是其唯一的结构提示 */
  .table-wrap tbody td::before { color: var(--ink-3); }

  /* 订单详情页的逐门明细（`.t-items`）：6 列在卡片里没有一条明确的主信息，
     所以按「课程名打头 + ID/金额/状态 一行 + 备注」重排。
     序号做成左上角的角标 —— 它唯一的用途是「这是第几门」，占一整行不值。 */
  .t-items tbody tr {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "seq    status"
      "name   name"
      "money  money"
      "note   note";
    row-gap: 3px;
  }

  .t-items td.no { grid-area: seq; font-size: 11.5px; color: var(--ink-3); }
  .t-items td.name { grid-area: name; font-size: 14.5px; font-weight: 600; }
  .t-items td.status { grid-area: status; justify-self: end; }
  .t-items td.num { grid-area: money; }
  .t-items td.note { grid-area: note; }

  /* 课程 ID（第 3 列）与金额/状态挤在同一行时会互相压，独立占一行、
     用字段名带上。这里没给它 `.x` 之外的类名，靠 nth-child 定位 ——
     它是模板里唯一一个既不是 name/num/status/note 的数据格。 */
  .t-items tbody td:not(.no):not(.name):not(.num):not(.status):not(.note) {
    grid-area: name;
    grid-column: 1 / -1;
    color: var(--ink-3);
    font-size: 11.5px;
  }

  /* 订单详情页的动作按钮在 720 以下已经由另一个区块做成整宽竖排
     （见文件末尾 `.order-actions` 的 720 断点），这里不重复。 */

  /* tab 的手机端尺寸见**文件末尾**的 `≤720px` 覆盖块 ——
     基础 `.tabs` 样式在本块之后才定义（另一位同事追加的订单详情区块），
     同特异性下后定义者胜，写在这里会被静默覆盖。 */

  /* ── 其余小屏细节 ── */
  .content { padding: 16px 14px 20px; }

  /* 顶栏在 390px 下「标题 + 余额胶囊」会挤成两行，胶囊还会被压到 200px 以内
     让金额换行。改成让胶囊自己占一行、靠右。 */
  .topbar {
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 12px 14px;
  }
  .topbar h1 { font-size: 16px; }
  .balance-pill { padding: 5px 12px; }
  .balance-pill .v { font-size: 15px; }

  .card { padding: 16px 14px; border-radius: 14px; }
  .card-head { flex-wrap: wrap; row-gap: 4px; margin-bottom: 14px; }
  .card-head .hint { margin-left: 0; flex-basis: 100%; }

  /* KPI 在 390px 下 2×2 每格只有 ~165px，30px 的数字加「可用余额 · 冻结 ¥4.00」
     这行副标题会把卡片撑成两行高。缩到 24px 换一行整齐。 */
  .kpis { gap: 10px; }
  .kpi { padding: 14px 14px 13px; border-radius: 13px; }
  .kpi .n { font-size: 24px; }
  .kpi .l { font-size: 11.5px; }

  /* 查课表单：label 与输入框之间原本 7px，单列排下来 4 个字段会显得很松。
     输入框本身要够高（44px）—— iOS 上 <16px 字号会触发自动缩放，这也是
     为什么移动端输入框字号保持 16px 而不是 .input 的 14px。

     ⚠ 2026-12-04 修：原来第一个选择器是 `input[type="text"]`，**和「白底白字」
     是同一个漏法** —— HTML 里 `<input>` 不写 `type` 时默认就是 text，
     但属性选择器匹配不到一个**不存在的属性**。后台的无 type 输入框
     （调账 / 额度 / 昵称 / 充值备注 / 商品标题…）在 ≤720px 下仍是 14px，
     iPhone 上点进去整页被放大。

     实测（headless Chrome，`Emulation.setDeviceMetricsOverride` 700×1200 mobile，
     真实 `/admin/agents/{id}` 与 `/admin/products/new` 页面）：

     | 选择器 | 无 type 的 input | checkbox |
     |---|---|---|
     | 修复前 `input[type="text"], …` | **14px**（漏） | 14px |
     | 错用裸 `input` | 16px ✅ | **16px**（不该） |
     | 本文件 `:not()` 版 | 16px ✅ | 14px ✅，盒子仍 13×13 |

     换成 `:not()` 版而不是裸 `input`：裸 `input` 会让 checkbox / radio 的
     `font-size` 也变 16px。Chromium 里盒子尺寸**没**跟着变（下方
     `input[type="checkbox"]` 的复位规则 `width:auto;padding:0` 特异性更高，
     撑住了 13×13），但这条 16px 已经在跟复位规则打架 —— 以后谁为了大触控区
     把 checkbox 做成 20px，字号就会把它一起顶开。把「字号只管文字输入框」
     写进选择器，这个隐式依赖就不存在了。
     `file` 一并排除：它的按钮由浏览器原生绘制，改字号会把「选择文件」
     那一段挤成两行。 */
  .query-grid { gap: 14px; }
  .query-grid .field label { margin-bottom: 5px; }
  .query-grid .btn { height: 46px; font-size: 15px; }
  input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  input[type="text"],
  input[type="password"],
  input[type="number"],
  select,
  textarea,
  .input {
    font-size: 16px;
    padding: 12px 13px;
  }

  /* 操作条：手机上是「拇指区」，两个按钮平分一行；已选/合计两栏在上，
     不然两个按钮被压到 100px 以内，「确认下单」会折行。 */
  .action-bar {
    bottom: 8px;
    padding: 11px 12px;
    gap: 8px 10px;
    border-radius: 12px;
  }
  .action-bar .stat .v { font-size: 18px; }
  .action-bar .stat:nth-of-type(2) { margin-right: auto; }

  /* 底部按钮高度 44px：拇指从屏幕下缘往上摸的落点，36px 太窄 */
  .action-bar .btn { min-height: 44px; }
  .action-bar .btn-sm { flex: 0 0 auto; padding-inline: 16px; }

  /* toast：390px 下 90vw 会顶到两边贴边，看起来像整条横幅；留 12px 呼吸。 */
  #toast {
    top: 10px;
    max-width: calc(100vw - 24px);
    font-size: 13px;
    padding: 11px 14px;
    text-align: center;
  }

  /* 空状态：手机上 52px 上下留白太奢侈（一屏就装得下 6 行），
     图标与标题的 12px 间距也偏大，读起来像两段无关内容。 */
  .empty { padding: 34px 16px; }
  .empty .big { font-size: 32px; margin-bottom: 10px; }
  .empty .t { font-size: 14px; }
  .empty .s { font-size: 12px; }

  /* 价格卡在小屏铺满一行，去掉悬停位移（触屏没有 hover，那个位移只会
     在点击瞬间闪一下） */
  .price-grid { grid-template-columns: 1fr; }
  .price-card:hover { transform: none; }

  /* 侧栏抽屉：44px 的手势起手区，贴着屏幕左缘时容易误触浏览器返回手势，
     所以侧栏内部元素也统一抬高到 44px */
  .nav a { padding: 12px 13px; min-height: 44px; }
  .menu-btn { min-width: 44px; min-height: 44px; }
}

/* [MOBILE-a11y END] —— 以下为其他智能体的区块（订单详情 / 状态 tab /
   进度条）。本文件**末尾**还有一块 `[MOBILE-a11y: 末尾补丁]`，
   专门覆盖它们的小屏表现，原因见上方顺序陷阱说明。 */

/* 触屏没有 hover：`.btn:hover` 的 `translateY(-1px)` 在手机上会「粘住」
   （:hover 一直保持到下一次点击），于是按钮看起来像卡在半空。
   这里只压平**位移**，保留变色 —— 变色是「按下去了」的有效反馈。

   ⚠ 刻意不去重置 `background`：`tbody tr:hover` 与 `tbody tr.sel` 特异度相同
   （都是 0,1,2），本块排在文件末尾，重置 background 会把「已勾选」的绿底盖掉。 */
@media (hover: none) {
  .btn:hover,
  .price-card:hover {
    transform: none;
  }
}

.menu-btn { display: none; }

.hide { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════
   2026-12-04 追加：订单状态 tab / 订单详情 / 进度条
   ═══════════════════════════════════════════════════════════════════════

   全部是**新增选择器**，不改任何既有区块 —— 上面的样式一个字没动。
   命名统一带业务前缀（`.tabs` / `.kv-grid` / `.order-actions` / `.progress`），
   与既有 `.card` / `.badge` / `.table-wrap` 组合使用，不覆盖它们。

   为什么这些样式只写一遍、不放进媒体查询里复制：
   三个区块（tab / 键值网格 / 动作按钮）都用 `flex` + `grid` 的自动换行，
   窄屏时天然堆叠，不需要为它们写断点。需要断点的只有 `.kv-grid` 的列数。
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 订单状态筛选 tab ────────────────────────────────────────────────
   为什么用 `overflow-x: auto` 而不是 `flex-wrap: wrap`：
   6 个中文短标签在 360px 宽的手机上换行会变成两行，把「共 N 条」挤下去；
   横滑一行的高度是稳定的。`scrollbar-width: none` 去掉那条横灰条
   （深色底上它比内容还显眼），但保留滚动能力。 */

.tabs {
  display: flex;
  gap: 6px;
  margin: 4px 0 16px;
  padding-bottom: 2px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar { display: none; }

.tabs .tab {
  flex: 0 0 auto;
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 550;
  text-decoration: none;
  white-space: nowrap;
  transition: background 160ms, border-color 160ms, color 160ms;
}

.tabs .tab:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  color: var(--ink);
}

/* 选中态：青绿实心底 + 深色文字。
   对比度按 `docs/32` 的量化要求算过 —— 浅色文字压在青绿底上只有 2.1:1，
   因此反相用深色文字（#04241b on #10b981 ≈ 6.8:1，过 AA）。
   仅靠背景色区分也不够：`aria-current="page"` 由模板输出，读屏器可播报。 */
.tabs .tab.on {
  background: linear-gradient(135deg, #10b981, #059669);
  border-color: #10b981;
  color: #04241b;
  font-weight: 700;
}

/* ── 订单详情：键值网格 ──────────────────────────────────────────────
   `auto-fit + minmax(220px, 1fr)`：宽屏一行 3~4 列，窄屏自动降到 1 列，
   不需要写断点。220px 是「字段名 + 18 位单号」不折行的最小宽度。 */

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 22px;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.kv .k {
  font-size: 11.5px;
  color: var(--ink-3);
  letter-spacing: 0.02em;
}

.kv .v {
  font-size: 14px;
  color: var(--ink);
  overflow-wrap: anywhere; /* 18 位单号在 220px 格子里的唯一不溢出手段 */
}

.kv .v.mono { letter-spacing: 0.01em; }

/* 金额那一格：不换行，且不许 `.kv` 的 anywhere 把它拆开（¥ 和数字分家） */
.kv .v strong { white-space: nowrap; }

/* ── 进度条 ──────────────────────────────────────────────────────────
   为什么不用 `<progress>`：它的跨浏览器外观不可控（Safari 的圆角与
   Chrome 的渐变完全不同），而这一页的可用性依赖「一眼看出 80%」。
   两根 div 是唯一能保证外观一致的做法。

   `role="progressbar"` + `aria-valuenow` 由模板输出，所以视觉上是 div、
   语义上是 progress —— 读屏器的体验与原生控件一致。 */

.progress {
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress .bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981, #38bdf8);
  transition: width 320ms cubic-bezier(0.34, 1.2, 0.64, 1);
}

/* 尊重「减少动效」偏好：把 320ms 的宽度过渡关掉。
   不做这一步的话，前庭功能障碍用户会看到一条横向移动的色块。 */
@media (prefers-reduced-motion: reduce) {
  .progress .bar { transition: none; }
}

/* ── 详情页动作条 ────────────────────────────────────────────────────
   三个按钮各自包一层 `<form>`（无 JS 可用），所以布局要作用在 form 上，
   而不是按钮上 —— 否则 `<button>` 之间的间距会被 form 吞掉。 */

.order-actions { margin-top: 18px; }

.order-actions .acts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.order-actions .acts form { margin: 0; }

@media (max-width: 720px) {
  .order-actions .acts { flex-direction: column; align-items: stretch; }
  .order-actions .acts form { width: 100%; }
  .order-actions .acts .btn { width: 100%; }
}

/* ── 详情页里「单号/课程 ID」这类等宽串的选中行为 ──────────────────
   代理的固定动作是「复制单号发给客服」。`user-select: all` 让双击选中整串，
   而不是选中一个单词（单号里没有空格，双击本来也是整串；但课程 ID 那种
   带 `-` 的串双击会只选一段，所以显式声明）。 */

.no a.link,
.kv .v.mono {
  user-select: all;
}

/* 单号做成链接后仍要保持等宽字体与正常字色 —— 默认的 `<a>` 蓝色
   在深色底上刺眼，且会让「单号」这一列看起来像别的东西。 */
.no a.link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dashed var(--border-strong);
  transition: color 160ms, border-color 160ms;
}

.no a.link:hover {
  color: #6ee7b7;
  border-bottom-color: rgba(16, 185, 129, 0.6);
}

/* 键盘用户：只给鼠标 hover 效果而漏掉 focus 是常见缺陷（WCAG 2.4.7）。
   `:focus-visible` 而不是 `:focus`，避免鼠标点击后还留一圈环。 */
.no a.link:focus-visible,
.tabs .tab:focus-visible {
  outline: 2px solid #34d399;
  outline-offset: 2px;
  border-radius: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════
   [MOBILE-a11y: 末尾补丁] —— 由移动端智能体独占
   ═══════════════════════════════════════════════════════════════════════

   为什么这一块必须留在**文件最末尾**，不能并进上方那个 720 断点：

   `app.css` 现在有两个 720 断点 —— 一个在上（表格重排、表单、KPI），
   一个在下面（同事追加的 `.tabs` / `.kv-grid` / `.progress` 基础样式）。
   媒体查询**不改变特异度**：`.tabs .tab { padding: 7px 15px }` 与
   `@media(...) { .tabs .tab { padding: 6px 9px } }` 都是 (0,2,0)，
   胜负只看源序。把手机端覆盖写在前面的断点里，会被后面的基础样式静默盖掉。

   实测症状：390px 下 6 个 tab 溢出成 430px，「已退款」被切掉一半；
   修好后 tab 高 44px、溢出区有右侧渐隐提示。
   ═══════════════════════════════════════════════════════════════════════ */

@media (max-width: 720px) {
  /* 6 个中文标签在 390px 上放不下（实测内容宽 412px、容器 332px）。
     两条路：换行（占两行高、把「共 N 条」挤下去）或横滑。
     选横滑 + **右侧渐隐** —— 被切一半的第 5 个标签看起来就是排版坏了，
     渐隐明确告诉用户「还有，横向滑」。 */
  .tabs {
    gap: 6px;
    margin-bottom: 12px;
    padding-right: 26px;
    mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent 100%);
  }

  /* 44px = 触控标准。同事的基础样式是 38px（桌面值），手机上必须抬起来。 */
  .tabs .tab {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 12.5px;
  }

  /* 详情页键值网格：220px 最小列宽在 360px 容器里只够 1 列，但 gap 14px 会让
     11 个字段竖排成 11 个孤立小块。收紧到 10px 并加细分隔线 ——
     读起来是「一张字段表」而不是「11 张卡」。 */
  .kv-grid { gap: 10px 0; }
  .kv { padding: 0 0 10px; border-bottom: 1px solid var(--border); }
  .kv:last-child { border-bottom: 0; padding-bottom: 0; }

  /* 进度条在手机上稍高一点 */
  .progress { height: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   [课程ID + 价格页 CTA] —— 2026-12-04 追加（本轮只改这两处，未动上方任何区块）
   ═══════════════════════════════════════════════════════════════════════

   这一块**必须在文件最末尾**，理由与 `[MOBILE-a11y: 末尾补丁]` 相同：
   `≤720px` 的同特异性覆盖写在前面的断点里会被后面的基础样式静默盖掉
   （媒体查询不改变特异度，胜负只看源序）。

   ── 1. 查课结果的「课程 ID」列 ──

   为什么 `word-break: break-all` 而不是 `break-word`：
   `kcid` 是**无分隔符的长串**（`266230561`，某些平台是 32 位 hash）。
   `break-word` 只在「词之间」断行，对一整串没有分隔符的字符不起作用，
   结果是这一列把整张表撑宽 —— 桌面端出现横向滚动，手机端卡片被顶出视口。
   `break-all` 允许在任意字符间断开，配合 `max-width` 才真的能收住。

   为什么 `max-width` 写在 `.cid` 上而不是 `<td>` 上：
   桌面表格是 `table-layout: auto`，`<td>` 的 `max-width` 会被浏览器忽略
   （宽度由内容 + 列分配算法决定）。约束只能加在单元格内部的块级/可换行盒上，
   再由 `<td>` 去适应它。这也是 `agentui._kcid_cell()` 套一层 `<span>` 的原因。

   ── 2. 价格页每张卡的「去下单」 ──

   `.price-card` 原本是 `meta` 结尾（上边框 + 11.5px 灰字）。CTA 接在它下面，
   需要在 `meta` 上留出与底部之间的节奏，否则按钮会贴着卡片下沿。
   `align-self: stretch` + `margin-top: auto` 让**同一行**的卡片按钮底边对齐
   （`grid` 的 `auto-fill` 会把同一个渠道组排成等高行，卡片高度不等时按钮
   会参差不齐，看起来像渲染错位）。
   ═══════════════════════════════════════════════════════════════════════ */

/* ── 「课程 ID」单元格 ── */

.t-courses td.kcid {
  /* 桌面表格里给它一个上限：ID 再长也不会把「单价」挤出可视区。
     96px ≈ 11 位等宽字（`--mono-12.5` 下 1 字符 ≈ 7.5px）+ 换行余量，
     实测 `266230561` 一行放得下、32 位 hash 断成 3 行。 */
  max-width: 148px;
  color: var(--ink-3);
  font-size: 11.5px;
  line-height: 1.45;
  /* 列宽定的上限要生效，`<td>` 本身不能再撑满：见上方说明 */
  overflow-wrap: anywhere;
}

.t-courses td.kcid .cid {
  display: block;
  max-width: 100%;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 11.5px;
  /* 关键：无分隔符长串必须能断 */
  word-break: break-all;
  /* 系统允许时优先用连字符断词（比硬切更像「排版」而不是「溢出」） */
  hyphens: auto;
}

/* 列宽：给一个**确定的**宽度，而不是 `width: 1%`。
   `1%` 在 `table-layout: auto` 下是「尽量窄」的意思 —— 实测（1440×900）
   把这一列压到 ~44px，`demo-1001` 被拆成 `demo-1 / 001` 两行，读起来像两个 ID。
   固定 148px 后：9 位 ID 一行放得下，32 位 hash 断成 3 行（`.cid` 的
   `break-all` 负责断，`<td>` 的 `max-width` 负责不再变宽）。
   `nowrap` 只作用在表头 —— 四个字竖排会白占三行高度。 */
.t-courses thead th.cid-col {
  width: 148px;
  white-space: nowrap;
}

/* ── 价格页「去下单」── */

.price-card .cta {
  margin-top: 14px;
  width: 100%;
  /* 卡片是 `flex`/`grid` 子项时这条会把按钮推到底部，同行卡片按钮对齐 */
  align-self: stretch;
}

/* 每张卡的按钮要能被整个卡片高度吸附：`grid` 行等高时按钮底边齐 */
.price-card {
  display: flex;
  flex-direction: column;
}

.price-card .meta {
  /* 上边框下的间距保持原样，按钮的间距交给 `.cta` 的 margin-top */
  margin-bottom: 0;
}

/* ═══════════════ ≤720px：课程 ID 与平台名同行的补充样式 ═══════════════

   卡片布局（`.t-courses tbody tr` 的 grid）由上方 `[MOBILE-a11y]` 区块负责，
   那一块用 `grid-template-areas` 摆了 pick / name / price / state 四格。
   新增的 `.kcid` 格**不参与**那套 `grid-area`（它没有命名区），会被自动放进
   下一行的隐式轨道 —— 于是它出现在「单价」下面，与平台名（`td.name` 里的
   `.small.muted`）不在同一行。

   人类的要求是「课程 ID 显示在课程名下方（与平台名同一行或紧随其后）」。
   做到「紧随平台名」需要把 `.kcid` 收进 `name` 那一列：这里给它一个具名区
   `kcid` 并重排 `grid-template-areas`（见下方），同时压掉字段名前缀
   （值本身是等宽数字串，标签只会多占一行）。

   不写死 `grid-row` 是因为卡片行数会随课程名 1–2 行浮动；
   用 `areas` 顺序表达先后关系，长课名时也不会把 ID 盖到单价上。 */

@media (max-width: 720px) {
  /* 重排卡片的三行顺序：课程名 / 平台名 → **课程 ID** → 单价。

     为什么必须在这里重声明 `grid-template-areas`：上方 `[MOBILE-a11y]` 区块的
     模板是 `"pick name state" / "pick price price"`（只有两行），新增的 `.kcid`
     没有命名区，会被自动放进第 3 行的隐式轨道 —— 也就是**单价下面**。
     实测截图里读起来是「课程名、平台名、¥0.80、demo-1001」，而代理核对课程时
     是「先认名字、再看 ID、最后看价」，ID 排在价后面等于把唯一标识放到视线的
     末位。媒体查询不改变特异度，同特异性下后定义者胜，所以写在文件末尾的
     这一块能覆盖上方模板 —— 这也正是本轮所有样式都追加在末尾的原因。 */
  .t-courses tbody tr {
    grid-template-areas:
      "pick name  state"
      "pick kcid  ."
      "pick price price";
  }

  .t-courses tbody td.kcid {
    /* 第 2 列（与课程名/平台名同一列），左边空出 44px 勾选区 */
    grid-area: kcid;
    max-width: none;
    margin-top: 2px;
  }

  .t-courses tbody td.kcid .cid {
    /* 卡片里横向空间只有 ~300px，等宽 11.5px 下 32 位 hash 会断成两行 ——
       这正是想要的（断行而不是横滚），但不要让它在中间插个字段名。 */
    font-size: 11.5px;
  }

  /* 字段名压掉：它紧跟在课程名/平台名下面，上下文已经很清楚；
     保留会在每张卡里多出一行「课程 ID」，260px 宽的手机上很占地方。
     ⚠ 只压 `.kcid`，其余 `td::before` 由上方区块统一管。 */
  .t-courses tbody td.kcid::before {
    display: none;
  }

  /* 卡片按钮：手机上占满整宽（触控目标 ≥44px 由 `.btn` 的 padding 保证） */
  .price-card .cta {
    margin-top: 12px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   [ADMIN] 运营后台（/admin/*）套用本套深色令牌
   ═══════════════════════════════════════════════════════════════

   ── 为什么需要这一块 ──
   后台的 HTML 骨架在 `views.py` 的 `_CSS` 里（200 行灰白内联样式，ADR-017
   为兼容旧页面保留）。`views.layout()` 现在在 `_CSS` **之后**接上本文件，
   于是同名的类（`.card` / `.btn` / `.badge` / `.kpis` / `.kpi`）由这里生效，
   观感和代理端统一。但 `_CSS` 里有一批本文件**没有对应规则**的选择器
   （`header` / `table` / `th` / `code` / 裸 `button` / `.flash` / `.warnbox`），
   它们的白底会把深色页面打成补丁。这一块按 `body.admin-ui` 作用域把它们补齐。

   ⚠ 全部规则都带 `body.admin-ui` 前缀 —— 公开页（`/`、`/p/*`、`/order/*`）
   不带这个 class，观感一个像素不动。

   ── 变量口径 ──
   只用本文件 `:root` 已定义的那 20 个令牌，**没有新增任何色彩变量**。
   唯一新增的是把 `_CSS` 的老变量名（`--muted` / `--line` / `--ok` …）
   映射到深色令牌上，否则那些残留规则会因为变量 undefined 而失效
   （`border: 1px solid var(--line)` 在 IACVT 下整个 shorthand 变成
   `unset` → 边框直接消失）。
   ═══════════════════════════════════════════════════════════════ */

body.admin-ui {
  /* 老变量名 → 深色令牌。值全部来自文件顶部的 `:root`，不是新色。
     ⚠ `--ink-3` 这个**值**本轮被改过（见下面 `--ink-3` 那行的说明），
     其余映射逐字未动。 */
  --bg: var(--bg-1);
  --muted: var(--ink-3);            /* 见 `:root` 的 `--ink-3` 注释 */
  --ink-soft: var(--ink-2);         /* #b9b6cc @ #0f0d23 = 9.64:1  AAA ✓ */
  --line: var(--border);
  --ok: #6ee7b7;                    /* 12.50:1  AAA ✓ */
  --warn: #fcd34d;                  /* 13.21:1  AAA ✓ */
  --bad: #fda4af;                   /* 10.08:1  AAA ✓ */
  --info: var(--sky);
  --radius: var(--r-card);
}

/* ── 顶栏：`_CSS` 是白底，这里换成玻璃深色 ── */
body.admin-ui header {
  background: rgba(16, 13, 35, 0.72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

body.admin-ui header .brand { color: var(--ink); letter-spacing: -0.01em; }

/* 导航项：`--ink-3`(4.66) 做未选中、`--ink`(16.83) 做选中。
   未选中不用更浅的灰是因为 4.66 已是 AA 下限，再浅就掉出门槛。 */
body.admin-ui header nav a {
  color: var(--ink-3);
  border-bottom-color: transparent;
  transition: color 140ms, border-color 140ms;
}
body.admin-ui header nav a:hover { color: var(--ink); }
body.admin-ui header nav a.on {
  color: var(--ink);
  border-bottom-color: var(--mint);
  font-weight: 600;
}
body.admin-ui header .who { color: var(--ink-3); }
body.admin-ui header .who a { color: var(--sky); }

/* ── 裸 `button`（`_CSS` 给的是白底） ──
   后台多处用 `<button class="primary">` / `<button class="danger">` /
   `<button class="tiny">`，这些是 `_CSS` 的类名，不是本文件的 `.btn-*`。
   统一压成深色玻璃，`primary` 用 mint 渐变 + 深色字（7.24:1 AAA）。
   `.btn` 走本文件的规则，不需要这里重复。 */
/* ⚠ `button:not(.btn)` 而不是 `button`：后者特异度 (0,1,2) 会盖掉本文件的
   `.btn-primary` / `.btn-danger`（都是 (0,1,0)）—— 实测主按钮变成普通深色块、
   「冻结」的红色也消失，等于把 app.css 的按钮体系整个废掉。
   `:not(.btn)` 让 `.btn` 家族走自己的规则，这里只兜底 `_CSS` 的裸 `button`。 */
body.admin-ui button:not(.btn) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r-btn);
  transition: background 140ms, border-color 140ms;
}
body.admin-ui button:not(.btn):hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-strong);
}
body.admin-ui button.primary {
  background: linear-gradient(135deg, var(--mint), var(--mint-2));
  color: #04180f;                   /* #04180f @ #10b981 = 7.24:1 AAA ✓ */
  border-color: transparent;
  font-weight: 650;
}
body.admin-ui button.primary:hover { background: linear-gradient(135deg, #14c78e, #06a874); }

/* ── `<a class="btn primary">`（不是 `button`） ──
   `_CSS` 写的是 `button.primary,.btn.primary{background:var(--ink);color:#fff}`，
   而 `body.admin-ui` 把 `--ink` 重映射成了近白 #f1f0f7 —— 于是「概览 → 常用操作
   → 上新商品」变成一个**纯白块 + 白字**，标签直接看不见（2026-12-04 截图实测）。
   上面那条 `button.primary` 只管 `<button>`，兜不住 `<a>`，所以这里必须再写一条。
   值与本文件 `.btn-primary` 一致（同一种「主操作」不该有两种绿）。 */
body.admin-ui .btn.primary {
  background: linear-gradient(135deg, var(--mint), var(--mint-2));
  border-color: transparent;
  color: #04180f;                   /* #04180f @ #10b981 = 7.24:1 AAA ✓ */
  font-weight: 650;
}
body.admin-ui .btn.primary:hover {
  background: linear-gradient(135deg, #14c78e, #06a874);
  color: #04180f;
}
body.admin-ui button.danger {
  color: #fda4af;                   /* 10.08:1 ✓ */
  border-color: rgba(244, 63, 94, 0.32);
  background: rgba(244, 63, 94, 0.1);
}
body.admin-ui button.danger:hover { background: rgba(244, 63, 94, 0.18); }
body.admin-ui button.tiny { padding: 4px 10px; font-size: 12px; }

/* checkbox 交给 `color-scheme: dark`（`layout()` 已在后台页声明）。
   `_CSS` 的 `input{width:100%;background:#fff}` 会把勾选框撑满整行，
   这里收回原尺寸 —— 否则商品表单的两个开关会各占一整行白块。 */
body.admin-ui input[type="checkbox"],
body.admin-ui input[type="radio"] {
  width: auto;
  background: none;
  border: 0;
  padding: 0;
  accent-color: var(--mint);
}

/* ── 后台长表单：`_CSS` 的 `form.stack{max-width:520px}` 是给公开页用的窄栏，
      在 1440 宽的后台里是一条贴左的细长带，右侧 2/3 全空 ── */
body.admin-ui form.stack {
  max-width: 860px;
  padding: 22px 24px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* 一行多列（售价/划线价/单位）：`_CSS` 用内联 flex，这里只补间隔与基线 */
body.admin-ui form.stack .row { gap: 12px; align-items: flex-end; }
body.admin-ui form.stack .row > div { min-width: 0; }

/* 表单里的说明文字紧贴上一个输入框，`_CSS` 给的是 `margin:5px 0 0`，
   在深色玻璃卡片里太挤；同时它必须是 `--ink-3`（AA 4.66:1）而不是 `--muted`。 */
body.admin-ui form.stack p.small { margin: 6px 0 0; color: var(--ink-3); }
body.admin-ui form.stack label:first-of-type { margin-top: 0; }

/* 底部操作条：`_CSS` 的 `.actions` 没有上边距上限，卡片里会贴边 */
body.admin-ui form.stack .actions {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

/* ── 表格：`_CSS` 给了 `th{background:#fafafc}` 和 `table{border:1px solid}`，
      在深色下是两处亮斑 ── */
body.admin-ui th {
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink-2);
}
body.admin-ui .table-wrap table {
  border: 0;
  border-radius: 0;
  background: transparent;
}

/* `code`：`_CSS` 是 #f0f0f3 浅底，深色页面上白得刺眼且字看不清 */
body.admin-ui code {
  background: rgba(255, 255, 255, 0.085);
  color: #d1fae5;                   /* #d1fae5 @ ≈#2a2740 = 11.8:1 AAA ✓ */
  border-radius: 5px;
  padding: 1.5px 5px;
}

body.admin-ui .lede { color: var(--ink-2); }

/* ═══════════════ 订单展开块（`.od*`）═══════════════

   ## 这段为什么必须存在（A1，2026-12-04 审计② —— 本轮最严重的一条）

   `.od*` **只**在 `views.py` 的 `_CSS` 里定义过（L184-192），而那里是
   灰白兜底皮肤：`.od` 的底是近白的 `#fafafc`，键名色走 `--muted`。
   `app.css` 里**零条** `.od` 规则，于是 `_CSS` 的浅底原样留下，而文字色
   从 `app.css` 的 `--ink`（`#f1f0f7`，近白）来 —— **白底白字**。

   实测（审计②，真实浏览器 computed style + 截图像素）：

   | 元素 | 前景 | 背景 | 对比度 |
   |---|---|---|---|
   | `.od` 正文 | `rgb(241,240,247)` = `--ink` | `rgb(250,250,252)` = `#fafafc` | **1.09:1** |
   | `.od-k` 键名 | `rgb(126,122,153)` = 旧 `--ink-3` | 同上 | **3.93:1** |
   | `.od` 里的 `code`（`/order/...`） | `--ink` | `#f0f0f3` | **1.09:1** |

   运营点开单号后，上游单号 / 学校 / kcid / 联系方式 / 创建时间 / 逐门明细
   **全部看不见**（只剩极淡的灰）。而 Lighthouse 的 a11y 是 100 分 ——
   它只比「元素自身的 color/background」，两边的元素底色都透明，
   于是这条完全被自动工具漏掉。这正是「不要只信自动检查」的实例。

   ## 配色决策

   底色取 `#131120`：比 `--bg-1`（`#0f0d23`）再深一档。展开块是**行内嵌的
   一块内容**，比卡片更深能把「这是某一行的详情」这个层级做出来，
   同时让上面的浅色文字对比度更高。

   | 组合 | 实测 |
   |---|---|
   | `--ink` on `#131120` | 16.43:1 AAA |
   | `--ink-2`（`.od-v` 里的说明） on `#131120` | 9.41:1 AAA |
   | `--ink-3`（`.od-k` 键名） on `#131120` | 6.56:1 AA |
   | `code` 字 `#d1fae5` on `rgba(255,255,255,.1)` 叠 `#131120` | 13.24:1 AAA |
   | `a`（`--sky`） on `#131120` | 8.68:1 AAA |
   | 边框 `rgba(255,255,255,.36)` 合成后 vs 底 | 3.33:1（非文本 ≥3:1） |

   ## 特异性

   `_CSS` 的 `.od` 是 (0,1,0)，`body.admin-ui .od` 是 (0,1,1) —— 够赢。
   `.od-k` / `.od-v` 同理。**不要**写成裸 `.od`：公开页不挂 `admin-ui`，
   那边的展开块（如果以后有）不该被后台的深色规则牵连。

   ## CSS 注释不能嵌套（本轮踩到两次）

   写这段注释时在注释里贴了一段带内层注释起止符的示例代码，那个内层结束符
   **提前闭合**了整段注释 —— 后面所有 `.od` 规则全被当成非法声明丢掉，
   于是 `getComputedStyle(.od).backgroundColor` 仍是 `rgb(250,250,252)`。
   这是真浏览器抓到的（`document.styleSheets` 里 `body.admin-ui .od` 整条消失），
   不是靠读代码发现的。

   结论：**注释里不写注释起止符字面量**。要举 CSS 例子就用文字描述。
   ═══════════════════════════════════════════════════════════════ */
body.admin-ui .od {
  background: #131120;
  /* 边框要能当「这一块的边界」用：合成到 #131120 上实测 3.33:1（≥3:1）。
     0.16 只有 1.60:1 —— 展开块会糊进卡片，看不出到哪里结束。 */
  border-color: rgba(255, 255, 255, 0.36);
  color: var(--ink);
}
/* `.od` 里所有继承色都要显式落地：`_CSS` 没有给 `.od` 定 color，
   于是它继承 `body{color:var(--ink)}` —— 那条在 `app.css` 里是深色页的
   浅色字，配上 `_CSS` 的浅底正好是 1.09:1。这里既改底也改字。
   ⚠ 两条分成独立的规则（不并成一个选择器组）：`body.admin-ui .od-kv,
   body.admin-ui .od-item{...}` 这种写法在按选择器取值的测试里要额外
   处理逗号，而这两条的语义本来就是「都继承正文色」，拆开更直白。 */
body.admin-ui .od-kv {
  color: var(--ink);
}
body.admin-ui .od-item {
  color: var(--ink);
}
/* 键名用 `--ink-3`，但 `#131120` 上它是 **6.56:1**（旧 `--ink-3` 在浅底上是
   3.93:1）。这个类**不能**用 `.muted` 的语义去推 —— `.muted` 现在是
   6.56:1，而 `_CSS` 的 `.od-k{color:var(--muted)}` 在 `body.admin-ui` 里
   已经被重映射到同一个令牌，所以这条其实只是把意图写明（防止以后有人
   把 `--muted` 再改回浅色时，展开块的键名跟着掉下去）。 */
body.admin-ui .od-k {
  color: var(--ink-3);
}
body.admin-ui .od-v {
  color: var(--ink);
}
/* 展开块里的 `code`：`body.admin-ui code` 那条已经给了深色胶囊底，
   但 `.od` 自己的底更暗，胶囊会显得「浮起来」一块亮斑。这里压一档透明度，
   并把胶囊底改成不透明混合后的等价色（13.24:1 实测值就是这组）。 */
body.admin-ui .od code {
  background: rgba(255, 255, 255, 0.1);
  color: #d1fae5;
}
/* 展开块里的链接（`/order/{no}` 是纯文本，但上游单号在别处可能是链接） */
body.admin-ui .od a {
  color: var(--sky);
}
/* `.od` 里的 `.small.muted`（对外查单页那行说明）：`--ink-3` 已是 6.56:1，
   这里只保证它不被 `_CSS` 的 `.muted{color:var(--muted)}` 用更早的
   定义抢走 —— 两者现在指向同一令牌，写出来是为了让特异性明确。 */
body.admin-ui .od .muted {
  color: var(--ink-3);
}

/* ── 提示条：`_CSS` 的 `.flash` / `.warnbox` / `.errbox` 全是浅底 ── */
body.admin-ui .flash {
  border-radius: 10px;
  padding: 11px 14px;
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid transparent;
}
body.admin-ui .flash.ok {
  background: rgba(16, 185, 129, 0.13);
  border-color: rgba(16, 185, 129, 0.34);
  color: #a7f3d0;
}
body.admin-ui .flash.err {
  background: rgba(244, 63, 94, 0.13);
  border-color: rgba(244, 63, 94, 0.34);
  color: #fecdd3;
}
body.admin-ui .warnbox {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.34);
  color: #fde68a;                   /* 13.2:1 ✓ */
}
body.admin-ui .errbox {
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.34);
  color: #fecdd3;
}

/* ── 页头：标题 + 说明在左，主操作在右 ──
   改版前「新建代理」根本没地方放（导航是代理端的），操作挤在表格上方一行。
   现在主按钮固定在页头右上角 —— 它是这一页唯一的「创造」动作，
   位置稳定比贴着表格更符合肌肉记忆。 */
body.admin-ui .page-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
body.admin-ui .page-head h1 { font-size: 22px; margin: 0 0 4px; letter-spacing: -0.02em; }
body.admin-ui .page-head .lede { margin: 0; font-size: 13px; }
body.admin-ui .page-acts {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* KPI 副标题：主数字的口径（"含冻结 ¥0.00"）挂在同一张卡里，
   11.5px + `--ink-3` —— 11px 是 `--ink-3`(4.66:1) 仍过 AA 的下限字号。 */
body.admin-ui .kpi .s {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-3);
  margin-top: 3px;
}

/* ── 登录名 + 复制 ──
   运营的日常动作是「把这个账号发给代理」。等宽字让 `sk_zhang01` 和
   `sk_zhangO1` 一眼可分（0/O、l/1 是真实会发错字符的场景）。 */
body.admin-ui .inline-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.admin-ui .inline-copy code {
  font-size: 12px;
  letter-spacing: 0.01em;
  user-select: all;                 /* 单击即全选：手机上拖选 10 位串几乎不可能 */
  -webkit-user-select: all;
}
body.admin-ui .mini {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-2);              /* #b9b6cc @ ≈#1d1a35 = 9.1:1 AAA ✓ */
  border-radius: 7px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.6;
  transition: background 140ms, color 140ms;
}
body.admin-ui .mini:hover { background: rgba(255, 255, 255, 0.12); color: var(--ink); }
body.admin-ui .mini:active { transform: translateY(1px); }

/* ── 可用余额：大号 + 口径副标题 ──
   大号数字是「够不够下单」的答案；副标题是「里面有多少是冻的」。
   两者必须同格，否则扫读时会去别的列找冻结额。 */
body.admin-ui .amt-big {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.02em;
  color: #6ee7b7;                   /* 12.50:1 AAA ✓ */
  font-variant-numeric: tabular-nums;
}
body.admin-ui .amt-sub {
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-3);              /* 4.66:1 AA ✓ */
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── 开放渠道 `3 / 3` ──
   全开 = 绿（该看到的都能看到）；部分 = 橙（有人手动关过，值得追一句）；
   零 = 灰（新代理还没配）。这是**状态**而不是数字，所以带色。 */
body.admin-ui .ratio {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
body.admin-ui .ratio.mint { color: #6ee7b7; }
body.admin-ui .ratio.amber { color: #fcd34d; }
body.admin-ui .ratio.muted { color: var(--ink-3); }

/* ── 行内三个操作 ──
   垂直间距 8px（规范 §3）：一行里三个 32px 按钮紧贴会误触。
   `nowrap` 让 `冻结/解冻` 不在窄屏里折成两行撑高整行。 */
body.admin-ui .rowacts {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

/* ═══════════════ 模态框 ═══════════════
   为什么不用 `prompt()`：调账要两个字段（金额 + 原因），`prompt` 只能问一个，
   于是「原因」被迫留空或被塞进金额框；而且原生弹窗一旦被浏览器拦掉，
   运营会以为「点了没反应」。内联对话框还能把后端错误原样显示在框里。

   `.modal[hidden]` 必须显式写：`.modal` 的 `display: grid` 是作者样式，
   会盖掉 UA 的 `[hidden]{display:none}` —— 不写这条，三个框会同时铺开。 */
body.admin-ui .modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow-y: auto;
  background: rgba(4, 3, 12, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
body.admin-ui .modal[hidden] { display: none; }
body.admin-ui.modal-open { overflow: hidden; }

body.admin-ui .modal-box {
  width: min(520px, 100%);
  background: var(--card-solid);    /* 不透明：#16132e，避免玻璃叠玻璃后文字发灰 */
  border: 1px solid var(--border-strong);
  border-radius: var(--r-card);
  padding: 22px 24px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  animation: admin-pop 240ms cubic-bezier(0.34, 1.36, 0.64, 1);
}
@keyframes admin-pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

body.admin-ui .modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
body.admin-ui .modal-head h2 {
  font-size: 16px;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}
body.admin-ui .modal-x {
  margin-left: auto;
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  color: var(--ink-3);
  background: transparent;
  border-color: transparent;
}
body.admin-ui .modal-x:hover { color: var(--ink); background: rgba(255, 255, 255, 0.08); }

body.admin-ui .modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
body.admin-ui .modal-err {
  background: rgba(244, 63, 94, 0.13);
  border: 1px solid rgba(244, 63, 94, 0.34);
  color: #fecdd3;
  border-radius: 10px;
  padding: 10px 13px;
  font-size: 12.5px;
  line-height: 1.55;
  margin-bottom: 14px;
  white-space: pre-wrap;            /* 后端的多行错误提示（含「怎么办」）保留换行 */
}

/* ── 凭据卡：三行「标签 / 值 / 复制」 ──
   值是等宽 + 可整串选中。密码用 mint 强调：它是这一屏唯一的东西，
   运营要照着念给代理听。 */
body.admin-ui .cred {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.24);
}
body.admin-ui .cred-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
}
body.admin-ui .cred-row:last-child { border-bottom: 0; }
body.admin-ui .cred-k {
  font-size: 12px;
  color: var(--ink-3);              /* 4.66:1 AA ✓ */
}
body.admin-ui .cred-v {
  background: transparent;          /* 覆盖 `body.admin-ui code` 的底色：这一格整行都是值 */
  padding: 0;
  color: var(--ink);                /* 16.83:1 AAA ✓ */
  font-size: 13px;
  letter-spacing: 0.02em;
  user-select: all;
  -webkit-user-select: all;
  overflow-wrap: anywhere;
}
body.admin-ui #cred-pass { color: #6ee7b7; }   /* 12.50:1 AAA ✓ */

/* ═══════════════ 后台：代理详情「渠道与专属价」表 ═══════════════

   ## 为什么这张表原先在手机上只能横滚（C3）

   它的容器是 `.scroll`（纯 `overflow-x:auto`），表格本身**没有** `data-label`。
   实测（headless Chrome + CDP，真服务器 `127.0.0.1:8811`，`/admin/agents/1`）：

   | 视口 | `table.scrollWidth` | 容器 `clientWidth` | 需横滚 | `thead` |
   |---|---|---|---|---|
   | 720px | 632 | 632 | 0 | `table-header-group` |
   | 430px | **411** | **342** | **69px** | `table-header-group` |
   | 390px | 411 | 302 | 109px | `table-header-group` |

   `document.documentElement.scrollWidth` 一直是 720/430/390（= `innerWidth`），
   所以「整页不溢出」这条**量不出这个 bug** —— 溢出被 `.scroll` 吃掉了，
   代价是手指在渠道表上左右拖才看得全「开放 / 商品 / 默认价 / 单价 / 保存」。
   这不是「表格宽」，是「信息拿不到」。

   ## 改法：复用 `.table-wrap` + `data-label`，不新造一套

   把容器从 `.scroll` 换成 `.table-wrap`（`views.admin_agent_detail`），
   每个 `<td>` 补 `data-label`。`app.css` 已有一整套 `.table-wrap` 的
   ≤720px 卡片规则（`tr{display:grid}` + `td::before{content:attr(data-label)}`），
   这里只补 `.t-ch` 的 grid 摆位 —— 与 `.t-agents` 同一手法。

   桌面端两条：`.price-in` 收回 96px 右对齐（原先写在 `style=` 里，
   卡片模式下那是硬宽度；写进 CSS 才能在窄屏覆盖）。 */

.t-ch .price-in {
  width: 96px;
  text-align: right;
}

/* 勾选列在桌面端居中：整列只有一个小方块，左对齐会看不出哪些格子属于同一列 */
.t-ch td.pick { text-align: center; }
.t-ch td.pick input[type="checkbox"] { width: 17px; height: 17px; }

/* ═══════════════ ≤720px：代理表重排成卡片 ═══════════════
   `app.css` 的通用规则已经把 `.table-wrap` 变成卡片，但 `data-label`
   在这里是噪音（名字/状态自解释），而且 7 列平铺会滚两屏。
   用 grid 把「谁 / 账号 / 钱和渠道 / 操作」重新聚成四行。 */
@media (max-width: 720px) {
  body.admin-ui .page-head { margin-bottom: 14px; }
  body.admin-ui .page-head h1 { font-size: 19px; }
  /* 主按钮在手机上占满整行：它是这一屏唯一要「按」的东西 */
  body.admin-ui .page-acts { width: 100%; margin-left: 0; }
  body.admin-ui .page-acts .btn { flex: 1; }
  body.admin-ui .page-acts .btn-primary { order: -1; flex-basis: 100%; }

  body.admin-ui .t-agents tbody tr {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "name  name  status"
      "login login login"
      "amt   ch    today"
      "acts  acts  acts";
    row-gap: 7px;
  }
  /* 名字/状态/余额自解释，压掉字段名；账号、渠道、今日订单离开表头就有歧义，
     保留 11px 的字段名（`--ink-3` 4.66:1 是这个字号过 AA 的下限）。 */
  body.admin-ui .t-agents td.name::before,
  body.admin-ui .t-agents td.status::before,
  body.admin-ui .t-agents td.amt::before,
  body.admin-ui .t-agents td.acts::before { display: none; }
  body.admin-ui .t-agents td.name {
    grid-area: name;
    font-size: 15.5px;
    font-weight: 600;
  }
  body.admin-ui .t-agents td.status { grid-area: status; justify-self: end; }
  /* 登录名那一格：`inline-copy` 是 inline-flex，父 td 一旦继承了某种居中
     （`.table-wrap tbody td` 在卡片模式下只改了 padding，没重置 text-align，
     而 `.num` 的右对齐在这里不适用），账号就会飘到卡片中间，
     和上面的代理名错位。显式钉死左对齐。 */
  body.admin-ui .t-agents td.login {
    grid-area: login;
    text-align: left;
  }
  body.admin-ui .t-agents td.login .inline-copy { justify-content: flex-start; }
  body.admin-ui .t-agents td.amt { grid-area: amt; }
  body.admin-ui .t-agents td.amt .amt-big { font-size: 18px; }
  body.admin-ui .t-agents td.ch {
    grid-area: ch;
    justify-self: center;
    align-self: center;
  }
  body.admin-ui .t-agents td.today {
    grid-area: today;
    justify-self: end;
    align-self: center;
  }
  /* 渠道和今日订单这两个数字离开表头就没有语境，补回字段名 */
  body.admin-ui .t-agents td.ch::before,
  body.admin-ui .t-agents td.today::before {
    display: block;
    font-size: 11px;
    color: var(--ink-3);
    margin-bottom: 1px;
  }
  body.admin-ui .t-agents td.acts { grid-area: acts; }
  body.admin-ui .t-agents .rowacts { gap: 8px; }
  body.admin-ui .t-agents .rowacts .btn { flex: 1; }

  /* ── 渠道表（`.t-ch`）的卡片摆位 ──
     四个信息 + 一个动作，按「这行是谁 → 现在什么价 → 要不要保存」聚成三行：
     勾选框与商品名同一行（勾哪个就是哪一行），默认价与专属单价并排（要对比着看），
     保存按钮单独一行 —— 手机上它是这一卡唯一的动作，需要整行可点。 */
  body.admin-ui .t-ch tbody tr {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "pick name   name"
      "pick base   price"
      "acts acts   acts";
    row-gap: 7px;
  }
  /* 勾选框跨前两行：它是「这卡开不开」，纵向占满左侧，手指从商品名往下滑不会落空 */
  body.admin-ui .t-ch td.pick {
    grid-area: pick;
    align-self: start;
    text-align: left;
    padding-top: 2px;
  }
  body.admin-ui .t-ch td.name { grid-area: name; font-weight: 600; text-align: left; }
  body.admin-ui .t-ch td.base { grid-area: base; text-align: left; }
  /* 单价输入框在卡片里不能再是 96px：`--ink` 15px 输入要占满它那半行，
     否则「填入价格」这个主操作在手机上只有指甲盖大 */
  body.admin-ui .t-ch td.price { grid-area: price; text-align: right; }
  body.admin-ui .t-ch td.price .price-in {
    width: 116px;
    max-width: 100%;
    text-align: right;
  }
  body.admin-ui .t-ch td.acts { grid-area: acts; text-align: left; }
  body.admin-ui .t-ch td.acts .tiny { width: 100%; padding: 7px 10px; font-size: 13px; }

  /* 字段名：**五个全部保留**。
     `.t-agents` 那边压掉了自解释的几项（名字/状态/余额），但这张表不压 ——
     一行里有**两个金额**（默认价 / 专属单价），压掉字段名之后运营无法分辨
     「这个 ¥1.00 是我给他谈的价，还是商品的挂牌价」，而搞错这两个数的后果是
     报错价、真金白银。代价是每卡多五行 11px 小字，值。 */
  body.admin-ui .t-ch td::before {
    display: block;
    font-size: 11px;
    line-height: 1.5;
    color: var(--ink-3);
    margin-bottom: 2px;
  }

  /* 凭据卡：手机上 76px 的标签列会挤掉值，标签上移一行 */
  body.admin-ui .cred-row {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 4px;
  }
  body.admin-ui .cred-k { grid-column: 1 / -1; }
  body.admin-ui .modal { padding: 14px; align-items: start; }
  body.admin-ui .modal-box { padding: 18px 16px; margin-top: 12px; }
  body.admin-ui .modal-foot .btn { flex: 1; }
}

/* 尊重系统「减少动态效果」：弹出不要弹，出现就好 */
@media (prefers-reduced-motion: reduce) {
  body.admin-ui .modal-box { animation: none; }
}
