/* ============================================================
   成长陪练 · 设计系统（移动优先）
   ------------------------------------------------------------
   气质：暖奶油纸面 + 松绿墨色 + 杏色强调 + 金色奖励，克制、有体温。

   【配色】暖奶油纸面，松绿落墨，杏色点睛，金色记功
     纸        --bg #f6f4ee / --paper #ffffff     页面与卡面
     墨        --ink #16241f / --ink-2 #3e4c46    标题与正文
     铅灰      --muted #77837d / --muted-2        次要信息
     松绿      --pencil #0f5c48                   主色：导航、主按钮、链接
     杏色      --mark #dd8f3f                     强调：当前任务、待办、提示
     金        --sticker #c39a46                  奖励：勋章、奖状、成就
     赭红      --rose #b25a52                     危险与驳回
     （--pine/--apricot/--gold/--leaf 等别名跟随上面三组，改一处全站生效）

   【字体】衬线做标题（有书卷气），黑体做正文（屏幕好读）
     --font-serif Noto Serif SC / Songti SC       标题、品牌、数字
     --font-sans  Inter / PingFang SC             正文与界面
     --font-doc   仅奖状使用宋体，保留「证书」的仪式感

   【尺度】令牌随断点放大，组件不写死数值
     --gutter 14 → 20 → 24      页面左右留白
     --gap    12 → 14 → 18      区块间距
     --pad-card 16 → 18 → 24    卡片内边距
     --fs-body 15 → 14.5        手机上正文更大
     --tap 44px                 最小可点区域（pointer: coarse 生效）
     --safe-b / --safe-t        iPhone 安全区

   【交互】
     手机是基准，宽屏用 min-width 逐级增强；hover 只在真鼠标上发生；
     弹窗在手机上是底部抽屉；主操作固定在拇指区；动效尊重 reduced-motion。
   ============================================================ */
:root {
  /* 暖奶油纸 · 松绿墨 · 杏色点 · 金色功 */
  --bg: #f6f4ee;
  --bg-deep: #efece3;
  --paper: #ffffff;
  --paper-2: #fbfaf6;
  --ink: #16241f;
  --ink-2: #3e4c46;
  --muted: #77837d;
  --muted-2: #9aa49e;
  --line: #e7e2d6;
  --line-strong: #d8d2c3;

  /* 三组语义色：松绿（主）/ 杏色（强调）/ 金（奖励），赭红只管危险 */
  --pencil: #0f5c48;
  --pencil-deep: #0a3f32;
  --pencil-soft: #e8f1ec;
  --pencil-mist: #f1f7f3;
  --mark: #dd8f3f;
  --mark-deep: #b96f28;
  --mark-soft: #fbf0e2;
  --sticker: #c39a46;
  --sticker-deep: #8a641e;
  --sticker-soft: #fbf4e2;
  --sky: #3e6fa3;
  --sky-soft: #eaf1f8;
  --rose: #b25a52;
  --rose-soft: #f9ecea;

  /* 语义别名：换上面三组，全站跟着走 */
  --pine: var(--pencil);
  --pine-deep: var(--pencil-deep);
  --pine-soft: var(--pencil-soft);
  --pine-mist: var(--pencil-mist);
  --leaf: #2f8a6b;
  --apricot: var(--mark);
  --apricot-deep: var(--mark-deep);
  --apricot-soft: var(--mark-soft);
  --gold: var(--sticker);
  --gold-soft: var(--sticker-soft);

  /* 圆角：卡片走大圆角，控件走胶囊 */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 24px;
  --radius-xl: 30px;

  --shadow-xs: 0 1px 2px rgba(22, 36, 31, 0.05);
  --shadow-sm: 0 2px 6px rgba(22, 36, 31, 0.05), 0 12px 26px -22px rgba(22, 36, 31, 0.35);
  --shadow-md: 0 4px 12px rgba(22, 36, 31, 0.06), 0 24px 48px -32px rgba(22, 36, 31, 0.4);
  --shadow-lg: 0 30px 70px -30px rgba(10, 63, 50, 0.35);

  --font-sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --font-en: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Consolas, monospace;
  --font-doc: "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;

  /* 状态色：成功 / 提醒 / 危险 / 提示 */
  --ok: #2f8a6b;        --ok-soft: #e8f1ec;
  --warn: #b96f28;      --warn-soft: #fbf0e2;
  --danger: var(--rose);      --danger-soft: var(--rose-soft);
  --info: var(--pencil);      --info-soft: var(--pencil-soft);

  /* ---------- 移动优先：尺度令牌 ----------
     基准值 = 手机；宽屏用 min-width 逐级放大，不再靠 max-width 打补丁。 */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --gutter: 14px;      /* 页面左右留白 */
  --gap: 12px;         /* 区块/卡片间距 */
  --pad-card: 16px;    /* 卡片内边距 */
  --fs-body: 15px;     /* 手机上正文要大一点 */
  --fs-sm: 12.5px;
  --fs-xs: 11.5px;
  --lh: 1.65;

  /* 触控与导航 */
  --tap: 44px;                                  /* 最小可点区域 */
  --nav-h: 56px;                                /* 顶栏高度（手机） */
  --bottom-nav-h: 56px;                         /* 底部标签栏高度 */
  --safe-b: env(safe-area-inset-bottom, 0px);   /* iPhone 底部安全区 */
  --safe-t: env(safe-area-inset-top, 0px);

  /* 焦点环 */
  --ring: 0 0 0 3px rgba(15, 92, 72, .14);

  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --rule: var(--line);
}

/* 宽屏逐级放大：只改令牌，不重写组件 */
@media (min-width: 760px) {
  :root {
    --gutter: 20px; --gap: 14px; --pad-card: 18px;
    --fs-body: 14.5px; --lh: 1.6; --nav-h: 68px;
  }
}
@media (min-width: 1180px) {
  :root { --gutter: 24px; --gap: 18px; --pad-card: 24px; }
}

* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 锚点/键盘滚动时避开吸顶栏与底栏 */
  scroll-padding-top: calc(var(--nav-h) + 12px);
  scroll-padding-bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 12px);
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
/* 触摸设备：去掉点击高亮与双击缩放延迟 */
button, a, .chip, .tag, .opt, [role="button"] { touch-action: manipulation; }
body.locked { overflow: hidden; }
::selection { background: var(--sticker-soft); color: var(--ink); }

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
img, svg { display: block; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: 2px solid var(--leaf); outline-offset: 2px; border-radius: 2px; }
:focus:not(:focus-visible) { outline: none; }

/* ---------- typography ---------- */
.serif, h1, h2, h3 { font-family: var(--font-serif); }
.h1 { font-size: clamp(30px, 3.6vw, 46px); line-height: 1.24; font-weight: 600; letter-spacing: -0.01em; }
.h2 { font-size: clamp(23px, 2.3vw, 30px); line-height: 1.3; font-weight: 600; }
.h3 { font-size: 19px; line-height: 1.4; font-weight: 600; }
.h4 { font-size: 15.5px; font-weight: 600; font-family: var(--font-sans); }
.display { font-family: var(--font-serif); font-size: clamp(36px, 5vw, 64px); line-height: 1.08; font-weight: 600; letter-spacing: -0.02em; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  font-weight: 600; color: var(--muted);
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: currentColor; opacity: .55; }
.muted { color: var(--muted); }
.ink-2 { color: var(--ink-2); }
.tiny { font-size: 11.5px; }
.sm { font-size: 12.5px; }
.lg { font-size: 16px; }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.en { font-family: var(--font-en); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.right { text-align: right; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mono { font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }

/* ---------- layout（移动优先） ---------- */
.page {
  width: calc(100% - var(--gutter) * 2);
  margin: 0 auto;
  /* 底部留出底栏 + 安全区，最后一张卡不会被压住 */
  padding: 18px 0 calc(var(--bottom-nav-h) + var(--safe-b) + 40px);
}
.page.narrow { width: calc(100% - var(--gutter) * 2); }
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row-top { display: flex; align-items: flex-start; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.center-x { justify-content: center; }
.gap-4 { gap: 4px; } .gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; } .gap-24 { gap: 24px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: var(--gap); }
/* 手机上一律单列，宽屏再展开 */
.g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; } .mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; } .mb-24 { margin-bottom: 24px; }

/* ---------- surfaces ---------- */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card.flat { box-shadow: none; }
.card-pad { padding: var(--pad-card); }
.card-pad-sm { padding: var(--pad-card); }
.card-hover { transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s; }
.card-hover:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.tint { background: var(--pine-mist); border-color: #d9e8df; }
.tint-apricot { background: var(--apricot-soft); border-color: #f0ddc3; }
.divider { height: 1px; background: var(--line); border: 0; margin: 18px 0; }
.section { margin-top: 34px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.section-head h2 { font-size: 22px; font-weight: 600; font-family: var(--font-serif); }
.section-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.link-more { font-size: 12.5px; color: var(--pine); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link-more:hover { gap: 8px; }
.link-more::after { content: "→"; transition: transform .2s; }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--pine); --btn-fg: #fff; --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px;
  border-radius: 999px; border: 1px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg);
  font-size: 13.5px; font-weight: 600; letter-spacing: .01em;
  transition: transform .2s var(--ease), box-shadow .2s, background .2s, color .2s, opacity .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 18px -12px rgba(10, 63, 50, .55); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .42; cursor: not-allowed; transform: none; box-shadow: none; }
.btn-lg { min-height: 50px; padding: 0 26px; font-size: 15px; }
.btn-sm { min-height: 32px; padding: 0 13px; font-size: 12px; }
.btn-xs { min-height: 26px; padding: 0 10px; font-size: 11.5px; border-radius: 999px; }
.btn-block { width: 100%; }
.btn-ghost { --btn-bg: transparent; --btn-fg: var(--ink-2); --btn-bd: var(--line-strong); }
.btn-ghost:hover { background: var(--paper-2); border-color: var(--muted-2); }
.btn-soft { --btn-bg: var(--pine-soft); --btn-fg: var(--pine); --btn-bd: transparent; }
.btn-soft:hover { background: #dcece3; }
.btn-apricot { --btn-bg: var(--apricot-soft); --btn-fg: var(--apricot-deep); }
.btn-light { --btn-bg: #fff; --btn-fg: var(--pine-deep); }
.btn-danger-soft { --btn-bg: var(--rose-soft); --btn-fg: var(--rose); }
.btn-dark { --btn-bg: var(--pine-deep); }
.btn[aria-busy="true"] { pointer-events: none; opacity: .7; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink-2); border: 1px solid transparent;
  transition: background .2s, border-color .2s, color .2s;
  position: relative;
}
.icon-btn:hover { background: rgba(15, 92, 72, .07); color: var(--pine); }
.text-btn { color: var(--pine); font-weight: 600; font-size: 12.5px; padding: 4px 2px; }
.text-btn:hover { text-decoration: underline; }
.text-btn.danger { color: var(--rose); }

/* ---------- chips / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--paper-2);
  color: var(--ink-2); font-size: 12px; font-weight: 500;
  transition: all .2s;
}
.chip:hover { border-color: var(--line-strong); background: #fff; }
.chip.on { background: var(--pine); border-color: var(--pine); color: #fff; }
.chip.apricot.on { background: var(--apricot-deep); border-color: var(--apricot-deep); }
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: var(--bg-deep); color: var(--ink-2);
}
.tag.pine { background: var(--pine-soft); color: var(--pine); }
.tag.apricot { background: var(--apricot-soft); color: var(--apricot-deep); }
.tag.rose { background: var(--rose-soft); color: var(--rose); }
.tag.sky { background: var(--sky-soft); color: var(--sky); }
.tag.gold { background: var(--gold-soft); color: #8a641e; }
.tag.plain { background: transparent; border: 1px solid var(--line); }
.tag.soft { background: var(--paper-2, #f3f1ea); color: var(--ink-2, #55514a); border: 1px solid var(--line, #e6e2d8); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--rose); color: #fff; font-size: 10px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.kbd { font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; background: #fff; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--rose); font-weight: 700; }
.hint { font-size: 11.5px; color: var(--muted); line-height: 1.5; }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line-strong); background: var(--paper);
  border-radius: var(--radius-sm); padding: 10px 13px; font-size: 14px;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--muted-2); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--leaf); box-shadow: 0 0 0 3px rgba(47, 138, 107, .12);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { resize: vertical; min-height: 92px; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2377837d' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.input-lg { height: 52px; font-size: 18px; }
.field-error .input, .field-error .textarea { border-color: var(--rose); box-shadow: 0 0 0 3px rgba(178, 90, 82, .1); }
.error-text { font-size: 12px; color: var(--rose); display: flex; align-items: center; gap: 5px; }
.counter { font-size: 11px; color: var(--muted-2); text-align: right; }
.counter.over { color: var(--rose); }

.switch { position: relative; width: 42px; height: 24px; flex: none; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: #d9d5ca;
  transition: background .25s;
}
.switch span::after {
  content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.18);
  transition: transform .25s var(--ease);
}
.switch input:checked + span { background: var(--pine); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:disabled + span { opacity: .45; }

.seg { display: inline-flex; padding: 3px; background: var(--bg-deep); border-radius: 999px; gap: 2px; }
.seg button { padding: 6px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--muted); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-xs); }

.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; margin: 3px 0 0; accent-color: var(--pine); flex: none; }

/* ---------- avatar ---------- */
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 600; color: #fff;
  background: linear-gradient(140deg, #4c9c7a, #0f5c48);
  flex: none; font-size: 15px; letter-spacing: 0;
  box-shadow: inset 0 -6px 14px rgba(0, 0, 0, .12);
}
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.avatar.lg { width: 52px; height: 52px; font-size: 20px; }
.avatar.xl { width: 68px; height: 68px; font-size: 26px; }
.avatar.ap { background: linear-gradient(140deg, #e9b36f, #b96f28); }
.avatar.sky { background: linear-gradient(140deg, #7aa5cc, #3e6fa3); }
.avatar.rose { background: linear-gradient(140deg, #d4938d, #a24b44); }
.avatar.olive { background: linear-gradient(140deg, #a3ad72, #6a7541); }
.avatar.gold { background: linear-gradient(140deg, #ddc07a, #9c7727); }

/* 自定义头像（图案）：emoji 自带颜色，底色改浅，免得深色渐变把图案吃掉 */
.avatar.emoji {
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-weight: 400; font-size: 19px; box-shadow: inset 0 0 0 1px rgba(15, 92, 72, .06);
}
.avatar.emoji.sm { font-size: 15px; }
.avatar.emoji.lg { font-size: 27px; }
.avatar.emoji.xl { font-size: 36px; }
.avatar.emoji.pine { background: #e6f1ec; }
.avatar.emoji.sky { background: #e6eff6; }
.avatar.emoji.rose { background: #fbeceb; }
.avatar.emoji.olive { background: #eef1e2; }
.avatar.emoji.gold { background: #fbf2dc; }

/* 编辑孩子页：头像可点更换，右下角挂一个小相机角标提示可操作 */
.avatar-pick { position: relative; border: 0; padding: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; line-height: 0; }
.avatar-pick:focus-visible { outline: 2px solid var(--pine); outline-offset: 3px; }
.avatar-pick::after {
  content: "✎"; position: absolute; right: -2px; bottom: -2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--pine); color: #fff; font-size: 11px; line-height: 20px; text-align: center;
  box-shadow: 0 0 0 2px #fff; font-family: var(--font-sans, sans-serif);
}
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-top: 4px; }
.avatar-opt {
  display: grid; place-items: center; gap: 4px; padding: 8px 0 6px;
  border-radius: 14px; border: 1px solid transparent; background: var(--tint, #f6f7f5);
  cursor: pointer; transition: border-color .15s, transform .15s;
}
.avatar-opt:hover { transform: translateY(-1px); }
.avatar-opt.on { border-color: var(--pine); background: var(--pine-soft, #e6f1ec); }
.avatar-opt .avatar { width: 42px; height: 42px; }
.avatar-opt small { font-size: 11px; color: var(--muted); }

/* ---------- progress ---------- */
/* 进度 = 实心渐变条：走过的部分不断裂 */
.bar { height: 8px; border-radius: 999px; background: rgba(15, 92, 72, .1); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f8a6b, #0f5c48); transition: width .7s var(--ease); }
.bar.thin { height: 5px; }
.bar.apricot > i { background: linear-gradient(90deg, #edb26f, #dd8f3f); }
.bar.light { background: rgba(255, 255, 255, .2); }
.bar.light > i { background: #fff; }
.ring { position: relative; display: inline-grid; place-items: center; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.ring .ring-num { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.tbl-wrap { overflow: auto; border-radius: var(--radius); }
.tbl { font-size: 13px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted);
  letter-spacing: .04em; padding: 11px 14px; background: var(--paper-2);
  border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; z-index: 1;
}
.tbl td { padding: 13px 14px; border-bottom: 1px solid #f0ece2; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: var(--paper-2); }
.tbl .t-main { font-weight: 600; color: var(--ink); }
.tbl .t-sub { font-size: 11.5px; color: var(--muted); }
.tbl .actions { display: flex; gap: 8px; justify-content: flex-end; }
.tbl-compact td { padding: 9px 12px; }
.tbl-compact th { padding: 8px 12px; }

/* ---------- misc ---------- */
.empty { padding: 46px 20px; text-align: center; color: var(--muted); }
.empty .em-icon { width: 52px; height: 52px; border-radius: var(--radius); margin: 0 auto 14px; display: grid; place-items: center; background: var(--bg-deep); color: var(--muted); }
.empty h3 { font-size: 16px; color: var(--ink-2); margin-bottom: 4px; font-family: var(--font-sans); }
.empty p { font-size: 12.5px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll-x { overflow-x: auto; scrollbar-width: none; }
.scroll-x::-webkit-scrollbar { display: none; }
.hide { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.hr-dot { color: var(--line-strong); }

/* skeleton / loading */
.skeleton { background: linear-gradient(90deg, #efece3 25%, #f7f5ef 37%, #efece3 63%); background-size: 400% 100%; animation: shimmer 1.4s infinite; border-radius: 12px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }

/* toast */
.toast-root { position: fixed; z-index: 200; left: 50%; bottom: 34px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 9px;
  background: #12332a; color: #f3f7f4; border-radius: 999px;
  padding: 10px 18px 10px 14px; font-size: 13px; font-weight: 500;
  box-shadow: 0 18px 40px -18px rgba(10, 63, 50, .7);
  animation: toast-in .3s var(--ease);
  max-width: min(90vw, 520px);
}
.toast.out { animation: toast-out .25s var(--ease) forwards; }
.toast .t-ic { width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 11px; flex: none; }
.toast.warn { background: #6b3b1d; }
.toast.err { background: #6b2b27; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px) scale(.98); } }

/* modal */
.modal-mask {
  position: fixed; inset: 0; z-index: 150; background: rgba(18, 32, 27, .46);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  padding: 22px; animation: fade .2s;
}
.modal {
  background: var(--paper); border-radius: var(--radius-lg); width: min(560px, 100%);
  max-height: calc(100vh - 44px); display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in .32s var(--ease);
}
.modal.wide { width: min(840px, 100%); }
.modal.narrow { width: min(440px, 100%); }
.modal-head { padding: 22px 24px 12px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.modal-head-main { min-width: 0; flex: 1 1 auto; }
.modal-head h3 { font-size: 20px; font-weight: 600; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 8px 24px 20px; overflow: auto; }
.modal-foot { padding: 14px 24px 20px; display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); background: var(--paper-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.modal-close { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); font-size: 18px; line-height: 1; }
.modal-close:hover { background: var(--bg-deep); color: var(--ink); }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }

/* drawer */
.drawer-mask { position: fixed; inset: 0; z-index: 140; background: rgba(18, 32, 27, .4); backdrop-filter: blur(3px); animation: fade .2s; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 141;
  width: min(560px, 100%); background: var(--paper); box-shadow: -30px 0 80px -40px rgba(0,0,0,.4);
  display: flex; flex-direction: column; animation: drawer-in .32s var(--ease);
}
.drawer.wide { width: min(680px, 100%); }
.drawer-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-body { padding: 20px 24px; overflow: auto; flex: 1; }
.drawer-foot { padding: 14px 24px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--paper-2); }
@keyframes drawer-in { from { transform: translateX(40px); opacity: .6; } to { transform: none; opacity: 1; } }

/* popover */
.popover {
  position: absolute; z-index: 120; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 7px; min-width: 200px;
  animation: modal-in .18s var(--ease);
}
.popover .pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border-radius: var(--radius-xs); font-size: 13px; text-align: left; color: var(--ink-2); }
.popover .pop-item:hover { background: var(--pine-mist); color: var(--pine); }
.popover .pop-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.popover .pop-label { font-size: 10.5px; letter-spacing: .04em; color: var(--muted-2); padding: 8px 11px 4px; font-weight: 700; }

/* charts */
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 118px; }
.chart-bars .cb { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.chart-bars .cb-bar { width: 100%; max-width: 34px; border-radius: 3px 3px 2px 2px; background: linear-gradient(180deg, #7b8ea8, var(--pencil)); position: relative; transition: height .7s var(--ease); min-height: 3px; }
.chart-bars .cb-bar.soft { background: var(--bg-deep); }
.chart-bars .cb-bar.acc { background: linear-gradient(180deg, #edc47a, var(--sticker)); }
.chart-bars .cb-label { font-size: 10px; color: var(--muted-2); white-space: nowrap; }
.chart-bars .cb-value { font-size: 10px; color: var(--muted); font-weight: 600; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.spark { width: 100%; height: 54px; overflow: visible; }
.trend-svg { width: 100%; height: 170px; overflow: visible; }

/* code / copy field */
.code-box { display: flex; align-items: center; gap: 10px; background: var(--pine-mist); border: 1px dashed #b9d6c7; border-radius: var(--radius-sm); padding: 10px 13px; }
.code-box code { font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 18px; font-weight: 700; letter-spacing: .22em; color: var(--pine); }

/* cover art */
.cover-art {
  position: relative; overflow: hidden; border-radius: var(--radius);
  background: linear-gradient(145deg, #e2e7ec, #b6c2ce);
  color: #1b2733; display: flex; align-items: flex-end;
  isolation: isolate;
}
.cover-art::before {
  content: ""; position: absolute; width: 150%; height: 150%; left: -30%; top: -60%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.65), transparent 55%);
}
.cover-art::after {
  content: ""; position: absolute; inset: auto -20% -50% -20%; height: 90%;
  border-radius: 50%; background: rgba(255,255,255,.18);
}
.cover-art .ca-body { position: relative; z-index: 2; padding: 18px; width: 100%; background: linear-gradient(0deg, rgba(10,40,30,.55), transparent); color: #fff; }
.cover-art .ca-kicker { font-size: 9.5px; letter-spacing: .18em; text-transform: uppercase; opacity: .8; }
.cover-art .ca-title { font-family: var(--font-en); font-size: 22px; line-height: 1.15; margin-top: 3px; }
.cover-art .ca-mark { position: absolute; z-index: 1; right: 12px; top: 10px; font-family: var(--font-en); font-size: 46px; opacity: .22; }
.cover-art.bridge { background: linear-gradient(145deg, #e7ded2, #c3b09b); color: #463524; }
.cover-art.early { background: linear-gradient(145deg, #d8e3e8, #a2b8c4); color: #1e3440; }
.cover-art.middle { background: linear-gradient(145deg, #dde3ee, #a8b4cc); color: #24304a; }
.cover-art.high { background: linear-gradient(145deg, #e3dfec, #b3aacb); color: #312a48; }
.cover-art.raz { background: linear-gradient(145deg, #f0e2c9, #d9b57e); color: #54401c; }
.cover-art.rose { background: linear-gradient(145deg, #ecdcda, #c8a49f); color: #4d2f2b; }
.cover-art.pine { background: linear-gradient(145deg, #d8e4dd, #9db6ab); color: #1c3a30; }

/* ============================================================
   交互层：节奏 / 反馈 / 状态 / 可达性
   ------------------------------------------------------------
   四条原则
     ① 动效只有三档时长：快 .14s（按压）、中 .24s（浮层/卡片）、慢 .38s（页面/抽屉）
     ② 每次操作都有回执：按下有形变、进行中有忙碌、结果有 toast、破坏性操作可撤销
     ③ 状态一律可见：加载=骨架、空=空态带行动、错=就地红字、成=绿色确认
     ④ 键盘与读屏可用：焦点看得见、弹窗关得住、变化会播报
   ============================================================ */
:root {
  --dur-fast: .14s;   /* 按压、微反馈 */
  --dur: .24s;        /* 浮层、卡片 */
  --dur-slow: .38s;   /* 页面转场、抽屉 */
}

/* ---- ① 按压：手指落下的那一瞬间要有形变 ---- */
.btn, .chip, .icon-btn, .seg button, .opt, .pop-item { position: relative; }
.btn:active { transform: scale(.985); }
.chip:active, .seg button:active, .opt:active { transform: scale(.972); }
.icon-btn:active { transform: scale(.93); }
.modal-close:active { transform: scale(.9); }
@media (pointer: coarse) {
  /* 手机上按压要更快，慢了像卡顿 */
  .btn:active, .chip:active, .icon-btn:active { transition-duration: .06s; }
}

/* ---- 墨点：点击处晕开一小片墨，像笔尖落到纸上 ---- */
.ink {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: currentColor; opacity: .16; z-index: 0;
  transform: translate(-50%, -50%) scale(0);
  animation: inkOut .5s var(--ease-out) forwards;
}
@keyframes inkOut { to { transform: translate(-50%, -50%) scale(1); opacity: 0; } }

/* ---- ② 忙碌：顶部进度条 + 按钮内转圈 ---- */
.busy-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 300;
  overflow: hidden; pointer-events: none; background: transparent;
}
.busy-bar::after {
  content: ""; display: block; height: 100%; width: 34%;
  background: var(--pencil);
  animation: busySlide 1.05s var(--ease) infinite;
}
@keyframes busySlide { from { transform: translateX(-110%); } to { transform: translateX(320%); } }
.sp {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .42); border-top-color: #fff;
  animation: spin .68s linear infinite;
}
.btn-ghost .sp, .btn-soft .sp, .btn-light .sp, .btn-danger-soft .sp {
  border-color: rgba(15, 92, 72, .22); border-top-color: var(--pencil);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- ③ toast：分类型、可撤销、鼠标悬停时停住 ---- */
.toast { position: relative; overflow: hidden; pointer-events: auto; }
.toast.info { background: #12332a; }
.toast.ok { background: #0f5c48; }
.toast.warn { background: #6b3b1d; }
.toast.err { background: #6b2b27; }
.toast .t-ic { flex: none; }
.toast .t-body { min-width: 0; }
.toast .t-act {
  flex: none; margin-left: 2px; padding: 5px 11px; border-radius: 999px;
  background: rgba(255, 255, 255, .17); color: #fff; font-size: 12px; font-weight: 700;
}
.toast .t-act:hover { background: rgba(255, 255, 255, .3); }
.toast .t-prog {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: rgba(255, 255, 255, .38);
  animation: tProg linear forwards;
}
@keyframes tProg { from { width: 100%; } to { width: 0%; } }
.toast:hover .t-prog, .toast:focus-within .t-prog { animation-play-state: paused; }

/* ---- ④ 骨架：加载中先给出形状，不跳版 ---- */
.sk { position: relative; overflow: hidden; height: 14px; border-radius: 6px; background: #efece3; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .72), transparent);
  animation: skMove 1.25s infinite;
}
@keyframes skMove { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sk-t { height: 17px; width: 44%; }
.sk-l { height: 12px; }
.sk-l.short { width: 62%; }
.sk-card { height: 96px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--paper); }
.sk-stack { display: grid; gap: 10px; }

/* ---- ⑤ 空态：讲清楚「为什么空」并给一个动作 ---- */
.empty.compact { padding: 30px 16px; }
.empty .btn { margin-top: 14px; }
.empty .em-icon svg { width: 22px; height: 22px; }

/* ---- ⑥ 表单：校验就地发生，不用等提交 ---- */
.input[aria-invalid="true"], .textarea[aria-invalid="true"],
.field.invalid .input, .field.invalid .textarea {
  border-color: var(--rose); background: #fffafa;
}
.input[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(178, 90, 82, .12);
}
.field .msg { font-size: 12px; line-height: 1.45; display: flex; align-items: center; gap: 5px; }
.field .msg.err { color: var(--rose); }
.field .msg.ok { color: var(--ok); }
.field .msg:empty { display: none; }
.field .msg svg { width: 13px; height: 13px; flex: none; }
.shake { animation: shake .34s var(--ease); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-3px); }
  40%, 60% { transform: translateX(3px); }
}

/* ---- ⑦ 可达性：跳到主内容 / 忙碌光标 / 屏幕阅读播报 ---- */
.skip-link {
  position: fixed; top: 10px; left: 50%; z-index: 400;
  transform: translate(-50%, -190%);
  background: var(--paper); border: 1px solid var(--pencil); color: var(--pencil);
  font-size: 13px; font-weight: 700; padding: 10px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-md); transition: transform var(--dur) var(--ease);
}
.skip-link:focus { transform: translate(-50%, 0); }
[aria-busy="true"] { cursor: progress; }

/* ============================================================
   响应式：移动优先，逐级增强（只加规则，不打补丁）
   ============================================================ */

/* ---- ① 栅格展开：手机单列 → 平板两列 → 桌面多列 ---- */
@media (min-width: 560px) {
  .g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 760px) {
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section { margin-top: 30px; }
  .section-head { margin-bottom: 16px; }
}
@media (min-width: 1024px) {
  .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- ② 页面容器：宽屏收窄居中 ---- */
@media (min-width: 900px) {
  .page { width: min(1180px, calc(100% - var(--gutter) * 2)); padding: 28px 0 80px; }
  .page.narrow { width: min(900px, calc(100% - var(--gutter) * 2)); }
}

/* ---- ③ 悬停只在真鼠标上发生：手机不再「点完还留着 hover」 ---- */
@media (hover: none), (pointer: coarse) {
  .btn:hover { filter: none; }
  .card-hover:hover { border-color: var(--line); box-shadow: none; transform: none; }
  .chip:hover { border-color: var(--line); background: var(--paper-2); }
  .icon-btn:hover { background: none; color: var(--ink-2); }
  .text-btn:hover { text-decoration: none; }
  .popover .pop-item:hover, .pop-child:hover { background: none; }
  .tbl tbody tr:hover { background: none; }
  .link-more:hover { gap: 4px; }
  .side-link:hover { background: none; color: var(--ink-2); }
  .side-user:hover, .at-user:hover { background: none; }
  .modal-close:hover { background: none; color: var(--muted); }
  .opt:hover { border-color: var(--line); background: var(--paper); }
  .cover-art::before { opacity: .5; }
}

/* ---- ④ 触控目标：手机上所有可点区域 ≥44px ---- */
@media (pointer: coarse) {
  .btn { min-height: var(--tap); padding: 0 18px; }
  .btn-sm { min-height: 38px; }
  .btn-xs { min-height: 34px; padding: 0 12px; }
  .icon-btn { width: var(--tap); height: var(--tap); }
  .chip { height: 38px; padding: 0 14px; }
  .seg button { padding: 10px 16px; }
  .check input { width: 20px; height: 20px; }
  .switch { width: 50px; height: 30px; }
  .switch span::after { width: 24px; height: 24px; }
  .switch input:checked + span::after { transform: translateX(20px); }
  .tbl .actions .btn { min-height: 38px; }
}

/* ---- ⑤ 手机：输入 16px，避免 iOS 聚焦时整页放大 ---- */
@media (max-width: 760px) {
  .input, .select, .textarea { font-size: 16px; padding: 12px 14px; }
  .input-lg { height: 54px; font-size: 20px; }
  .textarea { min-height: 104px; }
}

/* ---- ⑥ 手机：弹窗即底部抽屉 ---- */
@media (max-width: 720px) {
  .modal-mask { padding: 0; align-items: flex-end; justify-content: stretch; }
  .modal {
    width: 100%; max-width: none;
    max-height: 92vh; max-height: 92dvh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: sheet-in .3s var(--ease-out);
    box-shadow: 0 -20px 60px -30px rgba(10, 63, 50, .45);
  }
  .modal::before {
    content: ""; flex: none; width: 38px; height: 4px; margin: 9px auto 0;
    border-radius: 2px; background: var(--line-strong);
  }
  .modal-head { padding: 12px 18px 10px; }
  .modal-head h3 { font-size: 17px; }
  .modal-body { padding: 6px 18px 18px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .modal-foot {
    border-radius: 0; padding: 12px 18px calc(14px + var(--safe-b));
    flex-wrap: wrap; gap: 8px;
  }
  .modal-foot .btn { flex: 1 1 44%; min-width: 130px; }
  .modal-close { width: var(--tap); height: var(--tap); }
  /* 抽屉同样从底部升起 */
  .drawer {
    top: auto; left: 0; right: 0; width: auto; max-height: 90vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: sheet-in .3s var(--ease-out);
    padding-bottom: var(--safe-b);
  }
  .drawer-head { padding: 14px 18px 12px; }
  .drawer-body { padding: 16px 18px; }
  .drawer-foot { padding: 12px 18px calc(14px + var(--safe-b)); flex-wrap: wrap; }
  .drawer-foot .btn { flex: 1 1 44%; min-width: 130px; }
}
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* ---- ⑦ 手机：筛选/分段控件横向滚动吸附，不换行占两行 ---- */
@media (max-width: 760px) {
  .seg {
    display: flex; width: 100%; overflow-x: auto; scroll-snap-type: x proximity;
    scrollbar-width: none; border-radius: var(--radius);
  }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { flex: none; scroll-snap-align: start; white-space: nowrap; }
  .filter-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-bar > * { flex: none; }
}

/* ---- ⑧ 手机：toast 抬到底栏之上 ---- */
@media (max-width: 900px) {
  .toast-root { bottom: calc(var(--bottom-nav-h) + var(--safe-b) + 16px); }
}

/* ---- ⑨ 无障碍：尊重减弱动效 ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- 打卡佐证：图片 / 视频 / 音频的真实预览 ---- */
.ev-block { display: flex; flex-direction: column; gap: 10px; }
.ev-imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.ev-img { width: 76px; height: 76px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--line); background: var(--paper-2); display: block; }
.ev-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ev-img:hover { border-color: var(--pine); }
.ev-img.ev-none { display: grid; place-items: center; color: var(--muted); font-size: 10.5px; }
.ev-media video { width: 100%; max-width: 440px; border-radius: var(--radius-sm); background: #0f1512; display: block; }
.ev-media audio { width: 100%; max-width: 440px; height: 36px; display: block; }

/* ---- ⑩ 高对比度偏好：加深描边与正文 ---- */
@media (prefers-contrast: more) {
  :root { --line: #b9c0c8; --line-strong: #8d959f; --muted: #5a626d; --ink-2: #2a3037; }
}
