/* ==========================================================================
   Baby Star · 多孩子「学习 + 生活」激励系统
   亮色主题 / 卡片式布局 / 响应式（桌面侧边栏，移动端底部标签栏）
   视觉刷新：渐变背景纵深、毛玻璃顶栏、渐变按钮、立体卡片、强调条标题
   ========================================================================== */

@import url('./tokens.css');

:root {
  /* 以下变量统一映射自 tokens.css（单一事实来源），保持视觉完全不变 */
  --bg: var(--c-bg);
  --card: var(--c-card);
  --ink: var(--c-ink);
  --ink-2: var(--c-ink-2);
  --muted: var(--c-muted);
  --line: var(--c-line);
  --line-2: var(--c-line-2);

  --primary: var(--c-primary);
  --primary-600: var(--c-primary-600);
  --primary-soft: var(--c-primary-soft);

  --study: var(--c-study);
  --study-soft: var(--c-study-soft);
  --life: var(--c-life);
  --life-soft: var(--c-life-soft);

  --success: var(--c-success);
  --success-soft: var(--c-success-soft);
  --danger: var(--c-danger);
  --danger-soft: var(--c-danger-soft);
  --warn: var(--c-warn);
  --warn-soft: var(--c-warn-soft);
  --purple: var(--c-purple);
  --purple-soft: var(--c-purple-soft);

  --radius: var(--r-lg);
  --radius-sm: var(--r-sm);
  --shadow: var(--sh-sm);
  --shadow-lg: var(--sh-lg);
  --sidebar-w: 236px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--c-bg-grad);
  background-attachment: fixed;
  color: var(--ink);
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; }
p { margin: 0; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d7deed; border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- 布局 */

/* 100vh 在移动浏览器里是「地址栏收起时」的高度，地址栏展开时会多出一段可滚动空白；
   100dvh 跟随动态视口。旧浏览器不认识 100dvh 会忽略该行、回落到上一行的 100vh。 */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-star {
  font-size: 22px;
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--grad-primary);
  box-shadow: 0 6px 16px rgba(91, 124, 250, .35);
}
.brand-text strong { display: block; font-size: 17px; letter-spacing: .3px; }
.brand-text small { color: var(--muted); font-size: 12px; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 13px;
  border-radius: 12px;
  color: var(--ink-2);
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  transition: background .16s, color .16s;
}
.nav-item:hover { background: #eef3ff; color: var(--ink); }
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-600);
  font-weight: 700;
  position: relative;
}
.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 4px; border-radius: 4px; background: var(--primary);
}
.nav-item .ni-icon { font-size: 17px; width: 22px; text-align: center; }

.side-foot {
  display: flex; gap: 9px; align-items: center;
  padding: 12px; border-radius: 12px;
  background: var(--success-soft); color: #0d8b6c;
  font-size: 12px; line-height: 1.45;
}
.side-foot .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
  box-shadow: 0 0 0 4px rgba(31, 184, 148, .16);
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  /* 顶部内边距跟随安全区：PWA 独立模式（viewport-fit=cover）下状态栏/刘海会盖住顶栏 */
  gap: 16px; padding: calc(16px + env(safe-area-inset-top)) 28px 14px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 20;
  background: rgba(247, 249, 254, .82);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar h1 { font-size: 21px; }
.topbar p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.view { padding: 6px 28px 40px; flex: 1; }

.tabbar { display: none; }

/* ---------------------------------------------------------------- 通用组件 */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card:hover { box-shadow: var(--shadow-lg); border-color: #e2e8f5; }

.section { margin-bottom: 18px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 12px; flex-wrap: wrap;
}
.section-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.section-title::before {
  content: ''; width: 5px; height: 17px; border-radius: 3px;
  background: var(--grad-primary); flex-shrink: 0;
}
.section-title .sub { color: var(--muted); font-weight: 400; font-size: 12.5px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.btn {
  border: 1px solid var(--line-2);
  background: #fff;
  color: var(--ink-2);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(30, 36, 51, .05);
}
.btn:hover { border-color: #c9d3e8; background: #fafbff; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--grad-primary); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(91, 124, 250, .30);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(91, 124, 250, .42); }
.btn-success {
  background: var(--grad-success); border-color: transparent; color: #fff;
  box-shadow: 0 6px 16px rgba(31, 184, 148, .28);
}
.btn-success:hover { filter: brightness(1.05); box-shadow: 0 8px 22px rgba(31, 184, 148, .40); }
.btn-danger { background: #fff; border-color: #f7c6ce; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
/* 表格里的图标按钮（报告 2.4：40+ 条任务时，四个文字按钮把「操作」列撑到 260px，
   把任务名挤成两行）。图标 + title 提示，列宽从 260 收到 132，行高也跟着降。 */
.btn-icon {
  width: 30px; height: 30px; padding: 0; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px; line-height: 1;
}
.btn-icon + .btn-icon { margin-left: 4px; }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: #f2f5fc; }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.chip {
  border: 1px solid var(--line-2);
  background: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.chip:hover { border-color: #c9d3e8; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.chip .emo { font-size: 15px; }

/* 状态标签（报告 2.4「状态标签区分度弱」）。
   原来只有浅底色 + 中等深度文字，四五个状态并排时几乎同色 ——
   尤其"待确认"和"已驳回"都是暖色系，扫一眼分不出哪个还没处理。
   现在：底色更饱和一档 + 同色系 1px 描边 + 更重的字重，
   同时把文字压到深色端，保证小字号下仍然过 WCAG AA（≥ 4.5:1）。 */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; line-height: 1.7;
  border: 1px solid transparent;
}
.tag-study { background: var(--study-soft); color: var(--primary-600); border-color: #cdd9ff; }
.tag-life { background: var(--life-soft); color: #b06400; border-color: #ffd9ae; }
.tag-gray { background: #f1f4fa; color: #6b7488; border-color: #e2e7f2; }
.tag-success { background: #dff8ee; color: #07735a; border-color: #a6ebd4; }
.tag-warn { background: #fff2dc; color: #9a5c00; border-color: #ffd28a; }
.tag-danger { background: #ffe7ec; color: #b3243f; border-color: #ffb8c6; }
.tag-purple { background: var(--purple-soft); color: #6a3cc0; border-color: #ddccff; }

/* 徽章「已获得」列：孩子名小胶囊。
   手动颁发的用紫色区分，并带一个 × 可当场收回（自动解锁的不给 ×）。 */
.badge-owners { display: flex; flex-wrap: wrap; gap: 4px; }
.owner-chip {
  display: inline-flex; align-items: center;
  padding: 1px 8px; border-radius: 999px;
  font-size: 11.5px; line-height: 1.7; white-space: nowrap;
  background: #f1f4fa; color: #4b5468; border: 1px solid var(--line-2);
}
.owner-chip.is-manual {
  background: var(--purple-soft); color: #6a3cc0; border-color: #ddccff;
}
.owner-x {
  border: 0; background: transparent; cursor: pointer;
  color: inherit; font-size: 13px; line-height: 1;
  padding: 0 0 0 3px; opacity: .55;
}
.owner-x:hover { opacity: 1; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.control {
  width: 100%; padding: 9px 12px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: #fff; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(91, 124, 250, .13); }
textarea.control { resize: vertical; min-height: 64px; }
select.control { cursor: pointer; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.empty {
  text-align: center; padding: 46px 20px; color: var(--muted);
}
.empty .emo {
  font-size: 34px; display: grid; place-items: center;
  width: 74px; height: 74px; margin: 0 auto 14px;
  border-radius: 50%; background: var(--primary-soft);
  box-shadow: 0 6px 16px rgba(91, 124, 250, .18);
}

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 今日打卡 */

.date-bar { display: flex; align-items: center; gap: 8px; }
.date-bar .control { width: 152px; }

.kid-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.kid-tab {
  border: 1px solid var(--line-2); background: #fff;
  border-radius: 14px; padding: 8px 14px;
  display: flex; align-items: center; gap: 9px;
  transition: all .16s;
}
.kid-tab:hover { border-color: #c9d3e8; transform: translateY(-1px); }
.kid-tab.active { border-color: transparent; box-shadow: 0 0 0 2px currentColor inset; }
.kid-tab .av {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 18px;
}
.kid-tab .nm { font-weight: 600; font-size: 13.5px; }
.kid-tab .pt { font-size: 11.5px; color: var(--muted); }

.hero {
  background: linear-gradient(120deg, #ffffff 0%, #f7f9ff 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 20px;
  flex-wrap: wrap; margin-bottom: 18px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; right: -60px; top: -60px;
  width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(91,124,250,.10), transparent 70%);
}
.hero-av {
  width: 68px; height: 68px; border-radius: 22px;
  display: grid; place-items: center; font-size: 36px;
  flex-shrink: 0; position: relative; z-index: 1;
}
.hero-info { flex: 1; min-width: 200px; position: relative; z-index: 1; }
.hero-name { font-size: 19px; font-weight: 700; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.hero-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.stat-pill {
  background: #fff; border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 16px; min-width: 88px; text-align: center;
  transition: transform .16s, box-shadow .16s;
}
.stat-pill:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-pill .v { font-size: 19px; font-weight: 700; line-height: 1.25; }
.stat-pill .l { font-size: 11.5px; color: var(--muted); }
.stat-pill.flame .v { color: #ff7a45; }
.stat-pill.coin .v { color: #f2a20c; }
.stat-pill.gem .v { color: var(--primary); }

.progress-ring { display: grid; place-items: center; position: relative; }
.progress-ring .txt {
  position: absolute; text-align: center; font-size: 12px; line-height: 1.25;
}
.progress-ring .txt b { font-size: 17px; display: block; }

.dim-block { margin-bottom: 20px; }
.dim-head {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 11px; font-weight: 600; font-size: 15px;
}
.dim-head .bar { width: 4px; height: 17px; border-radius: 3px; }
.dim-head.study .bar { background: var(--grad-primary); }
.dim-head.life .bar { background: var(--grad-life); }
.dim-head .cnt { color: var(--muted); font-weight: 400; font-size: 12.5px; }

.task-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 15px;
  display: flex; align-items: center; gap: 13px;
  transition: all .16s;
  position: relative; overflow: hidden;
}
.task-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent; transition: background .16s;
}
.task-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.task-card.done { background: #fbfdff; border-color: #d9e6ff; }
.task-card.done::before { background: var(--success); }
.task-icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: grid; place-items: center; font-size: 21px; flex-shrink: 0;
}
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.task-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.task-pts {
  font-size: 12px; color: var(--primary-600); font-weight: 600;
  background: var(--primary-soft); padding: 2px 8px; border-radius: 7px;
}
.task-card.done .task-pts { background: var(--success-soft); color: #0d8b6c; }
.task-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.task-qty { font-size: 12.5px; color: var(--muted); }
.done-mark { color: var(--success); font-size: 20px; }

.mini-progress { height: 5px; background: #eef1f8; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.mini-progress > i { display: block; height: 100%; border-radius: 99px; background: var(--primary); transition: width .4s; }
.mini-progress.life > i { background: var(--life); }

/* ---------------------------------------------------------------- 统计 */

.kpi {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; padding: 15px 17px; box-shadow: var(--shadow);
  transition: box-shadow .2s, transform .2s;
}
.kpi:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.kpi .l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 25px; font-weight: 700; margin-top: 5px; line-height: 1.2; }
.kpi .s { font-size: 11.5px; color: var(--muted); }

.rank-row {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line);
  margin-bottom: 9px; transition: box-shadow .16s, transform .16s;
}
.rank-row:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.rank-no {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: #f1f4fa; color: var(--muted); flex-shrink: 0;
}
.rank-no.top1 { background: linear-gradient(135deg, #ffd76a, #ffb020); color: #7a5000; }
.rank-no.top2 { background: linear-gradient(135deg, #dfe4ec, #c2cad8); color: #4b5364; }
.rank-no.top3 { background: linear-gradient(135deg, #ffc9a3, #ec9a68); color: #7a3f11; }
.rank-av { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; font-size: 21px; flex-shrink: 0; }
.rank-main { flex: 1; min-width: 0; }
.rank-name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rank-bar { height: 7px; background: #f0f3fa; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.rank-bar > i { display: block; height: 100%; border-radius: 99px; }
.rank-nums { display: flex; gap: 14px; flex-shrink: 0; text-align: right; }
.rank-nums div { font-size: 11.5px; color: var(--muted); }
.rank-nums b { display: block; font-size: 15px; color: var(--ink); }

.table-wrap { overflow-x: auto; }

/* 横向滚动的可见提示：只在触屏宽度出现。
   手机上没有可见的横向滚动条，审计表在 320px 下容器 250px / 内容 477px，
   用户不会知道右侧还有「对象 / 来源 IP」两列。其余表格列少、基本一屏放得下，
   所以只给审计表挂这个提示，避免在不需要滚动的表格上误导用户。 */
.tbl-hint { display: none; }
@media (max-width: 880px) {
  .tbl-hint {
    display: block; margin: 0 0 6px;
    font-size: 11.5px; color: var(--muted); text-align: right;
  }
}

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
/* 表头（报告 2.4）：浅灰底 + 深色文字。原来是 #f6f8fd + --ink-2，
   在亮度高的屏上表头几乎"消失"，长表格滚到中间就分不清哪行是哪列。 */
table.tbl th {
  text-align: left; padding: 11px 12px; color: #333;
  font-weight: 700; font-size: 12px; border-bottom: 1px solid var(--line-2);
  white-space: nowrap; background: #f5f7fa;
}
table.tbl td { padding: 11px 12px; border-bottom: 1px solid #f3f5fa; vertical-align: middle; }
table.tbl tbody tr:nth-child(even) { background: #fafbfe; }
table.tbl tbody tr:hover { background: #f1f5ff; }
table.tbl tbody tr:last-child td { border-bottom: none; }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; }

.heat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(15px, 1fr)); gap: 4px; }
.heat-cell { aspect-ratio: 1; border-radius: 4px; background: #eef1f7; }
.heat-cell.l1 { background: #cfe0ff; }
.heat-cell.l2 { background: #9dc0ff; }
.heat-cell.l3 { background: #6b9bfa; }
.heat-cell.l4 { background: #3f74ec; }

/* ---------------------------------------------------------------- 奖励 */

.reward-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 17px; text-align: center;
  box-shadow: var(--shadow); transition: all .18s;
  display: flex; flex-direction: column; gap: 9px; position: relative;
}
.reward-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.reward-card.disabled { opacity: .58; }
.reward-icon { font-size: 38px; }
.reward-name { font-weight: 600; font-size: 14px; }
.reward-desc { font-size: 12px; color: var(--muted); min-height: 20px; }
.reward-cost {
  font-weight: 700; color: #f2a20c; font-size: 17px;
  background: var(--warn-soft); border-radius: 9px; padding: 3px 0;
}

/* ------------------------------------- 「兑换梳理」：批量兑换（家长端与孩子端同构） */
/* 卡片底部两个动作：原来的「立即兑换」保持不变，旁边多一个清单入口 */
.reward-acts { display: flex; gap: 8px; margin-top: auto; }
.reward-acts .btn { flex: 1; padding-left: 6px; padding-right: 6px; font-size: 13px; }
.btn-cart { border: 1px dashed var(--line-2); background: var(--card); color: var(--muted); }
.btn-cart.in { border-style: solid; border-color: var(--success); color: var(--success); background: var(--success-soft, #eafaf3); }

/* 清单栏：只有挑了东西才出现（与孩子端同一个措辞规则） */
.cart-bar {
  display: flex; align-items: center; gap: 12px; margin-top: 14px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--warn-soft);
}
.cb-info { flex: 1; min-width: 0; }
.cb-info b { display: block; font-size: 14px; }
.cb-info span { font-size: 12px; color: var(--muted); }

/* 清单整理弹窗 */
.cart-list { display: flex; flex-direction: column; }
.cart-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px dashed var(--line-2);
}
.cart-row:last-child { border-bottom: none; }
.cart-row .ci { font-size: 24px; flex: none; }
.cart-row .cn { flex: 1; min-width: 0; }
.cart-row .cn b { display: block; font-size: 13.5px; }
.cart-row .cn small { font-size: 11.5px; color: var(--muted); }
.qty-edit { display: flex; align-items: center; gap: 6px; flex: none; }
.qty-edit .btn { min-width: 34px; padding: 4px 8px; }
.qty-edit b { min-width: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.cart-row .csub {
  flex: none; min-width: 74px; text-align: right;
  font-weight: 700; color: #f2a20c; font-variant-numeric: tabular-nums;
}
.cart-total {
  margin-top: 12px; padding: 11px 13px; border-radius: 14px;
  background: var(--warn-soft); font-size: 13.5px;
}
.cart-total b { font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* 行内「为什么加不了」+ 到上限的禁用态（与孩子端同一套语义，措辞来自 redeemBatch.js） */
.cart-row .cn em.cap {
  display: block; font-style: normal; font-size: 11.5px; font-weight: 600;
  color: #b4740a; margin-top: 2px;
}
.cart-row.over .cn em.cap { color: var(--danger); }
.cart-row.over .csub { color: var(--danger); }
.qty-edit .btn:disabled { opacity: .45; cursor: not-allowed; }
/* 预算条：与孩子端同一套语义（宽度 = min(100, 已用/可用)，超额钉 100% 并转橙红） */
.cart-budget {
  height: 8px; border-radius: 999px; background: #eef1f8;
  overflow: hidden; margin: -4px 0 10px;
}
.cart-budget i {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #7ee0b0, var(--ok, #2bc48a));
  transition: width .18s ease, background .18s ease;
}
.cart-budget.lack i { background: linear-gradient(90deg, #ffc46b, #f08a2c); }
.cart-cap-note {
  margin: 8px 0 0; font-size: 12px; font-weight: 600; color: #b4740a;
}

/* 「📜 兑换记录」里一次批量兑换的分组头 */
.batch-head td {
  background: var(--study-soft, #eef2ff); font-size: 12px; font-weight: 700;
  color: var(--ink); padding: 7px 12px; border-bottom: 1px solid var(--line-2);
}

/* ---------------------------------------------------------------- 选择器 */

.emoji-picker { display: flex; flex-wrap: wrap; gap: 5px; max-height: 168px; overflow-y: auto; padding: 4px; }
.emoji-picker .emo {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; font-size: 18px; line-height: 1; padding: 0;
}
.emoji-picker .emo:hover { background: #f4f7ff; }
.emoji-picker .emo.sel { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 2px rgba(91,124,250,.16); }

.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-picker .sw {
  width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line-2); padding: 0;
}
.color-picker .sw.sel { box-shadow: 0 0 0 2px var(--primary); }

/* ---------------------------------------------------------------- 弹窗 */

.modal-mask {
  position: fixed; inset: 0; background: rgba(24, 30, 45, .45);
  display: grid; place-items: center; z-index: 100; padding: 18px;
  animation: fade .16s ease;
}
.modal {
  background: #fff; border-radius: 20px; width: 100%; max-width: 520px;
  max-height: 88vh; overflow: auto; box-shadow: var(--shadow-lg);
  animation: pop .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal-head {
  padding: 18px 22px 12px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: #fff; z-index: 2;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 { font-size: 16.5px; }
.modal-body { padding: 18px 22px; }
.modal-foot {
  padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end;
  position: sticky; bottom: 0; background: #fff; border-top: 1px solid var(--line);
}
.x-btn { border: none; background: #f2f5fc; width: 30px; height: 30px; border-radius: 9px; color: var(--muted); font-size: 17px; line-height: 1; }
.x-btn:hover { background: #e8edf8; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- Toast */

.toast-box {
  position: fixed; top: calc(18px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 9px; align-items: center;
  pointer-events: none;
}
.toast {
  background: #fff; border: 1px solid var(--line);
  border-radius: 13px; padding: 11px 18px;
  box-shadow: var(--shadow-lg); font-size: 13.5px;
  display: flex; align-items: center; gap: 9px;
  animation: slideDown .22s cubic-bezier(.2, .9, .3, 1.2);
  max-width: 90vw;
}
.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }
.toast.levelup { border-left: 4px solid var(--warn); background: linear-gradient(100deg, #fffaef, #fff); }
@keyframes slideDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- 撒花 */

.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.confetti-piece { position: absolute; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall {
  0% { transform: translateY(-30px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(102vh) rotate(720deg); opacity: .1; }
}

/* ---------------------------------------------------------------- 登录门禁 */

.login-gate {
  position: fixed; inset: 0; z-index: 500;
  background: linear-gradient(140deg, #eef3ff 0%, #f7f5ff 55%, #fff7ec 100%);
  /* 用 flex + 卡片 margin:auto，而不是 grid + place-items:center。
     卡片是固定内容高（约 410px），视口一矮（手机横屏 320~375px）grid 会把上下同时裁掉，
     而且没有任何滚动条 —— 底部「孩子端入口」链接直接点不到。
     flex 的 auto 外边距在放得下时居中、放不下时自动退化为 0（靠上），配合 overflow-y 可滚动。 */
  display: flex; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: calc(20px + env(safe-area-inset-top)) 20px calc(20px + env(safe-area-inset-bottom));
}
.login-gate[hidden] { display: none; }

.login-card {
  background: #fff; border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: 30px 30px 24px; width: 100%; max-width: 380px;
  margin: auto;                    /* 高度足够时居中；放不下时靠上并允许滚动 */
  display: flex; flex-direction: column; gap: 15px;
  animation: pop .24s cubic-bezier(.2, .9, .3, 1.2);
  position: relative; overflow: hidden;
}
.login-card::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  height: 5px; background: var(--grad-primary);
}
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-star { font-size: 34px; }
.login-brand strong { display: block; font-size: 19px; }
.login-brand small { color: var(--muted); font-size: 12px; }

.login-tip { font-size: 13px; color: var(--muted); margin: 0; }
.login-tip.error { color: var(--danger); }

.login-field { display: flex; flex-direction: column; gap: 6px; }
.login-field > span { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }

.login-submit { justify-content: center; padding: 11px; font-size: 14.5px; border-radius: 12px; }

.login-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; font-size: 12.5px;
  border-top: 1px dashed var(--line); padding-top: 12px;
}
.login-foot a { color: var(--primary-600); text-decoration: none; }
.login-foot a:hover { text-decoration: underline; }

/* 手机横屏（视口高 ≤420px）：卡片内容高 410px 装不下，收紧内边距与间距让一屏能看全 */
@media (max-height: 420px) {
  .login-card { padding: 18px 20px 16px; gap: 10px; }
  .login-brand strong { font-size: 17px; }
  .login-star { font-size: 28px; }
}

/* ---------------------------------------------------------------- 审核 */

.review-group {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 12px;
}
.review-head { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.review-av {
  width: 38px; height: 38px; border-radius: 12px;
  display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
}
.review-who { flex: 1; min-width: 140px; }
.review-who b { font-size: 14.5px; }
.review-who span { display: block; font-size: 12px; color: var(--muted); }
.review-pts { font-size: 19px; font-weight: 700; color: var(--warn); }
.review-items { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.review-item {
  display: flex; align-items: center; gap: 10px;
  background: #fafbff; border: 1px solid var(--line);
  border-radius: 11px; padding: 9px 12px; font-size: 13px;
  transition: border-color .15s, background .15s;
}
.review-item:hover { border-color: #cfd9ee; background: #f6f8ff; }
.review-item.busy { opacity: .55; pointer-events: none; }
.review-item .ri-reason { flex: 1; min-width: 0; }
.review-item .ri-time { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.review-item .ri-pts { font-weight: 700; color: #1fb894; font-variant-numeric: tabular-nums; }
.review-item .ri-acts { display: flex; gap: 6px; flex-shrink: 0; }
.review-actions { display: flex; gap: 8px; margin-top: 13px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .sidebar { display: none; }
  .tabbar {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 60; justify-content: space-around;
  }
  .tab-item {
    flex: 1; border: none; background: transparent;
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 5px 2px; color: var(--muted); font-size: 11.5px; border-radius: 10px;
  }
  .tab-item.active { color: var(--primary); background: var(--primary-soft); }
  .tab-item .ti-icon { font-size: 19px; }
  .topbar { padding: calc(16px + env(safe-area-inset-top)) 16px 10px; }
  /* 底部让位量跟随安全区：标签栏自身是 calc(6px + inset-bottom)，
     带 home indicator 的机型上会高于固定值 96px，末行会被压住 */
  .view { padding: 4px 16px calc(96px + env(safe-area-inset-bottom)); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero { padding: 16px; gap: 14px; }
  .hero-stats { width: 100%; }
  .stat-pill { flex: 1; min-width: 74px; }
  .field-row { grid-template-columns: 1fr; }
  .topbar-right { width: 100%; }

  /* ---- 表单控件字号 ≥16px ----
     iOS Safari 在聚焦字号 < 16px 的 input/select/textarea 时会强制放大整页
     （约 1.14~1.33 倍），家长每点一次输入框页面就跳一下、布局错位。
     桌面端（>880px）保持 14px 不变，只影响触屏。 */
  .control, select.control, textarea.control { font-size: 16px; }

  /* ---- 触屏命中区：外观尺寸不变，把命中区扩到 ≥44×44 ----
     44×44 是 Apple HIG 的最小触控尺寸（Material 建议 48）。
     多数控件「宽度够、高度不够」，所以按钮类只做纵向外扩；
     横向也外扩会让相邻按钮的命中区互相重叠 —— 例如审核行的
     「✓ 通过 / ✕ 驳回」重叠区会落到后一个按钮上，所以横向一律不外扩。
     注意：.task-btn / .gift-btn 已经用 ::after 画高光扫过动画，不能加进来；
     .photo-del 自身是 position:absolute（叠在缩略图角上），也不能改成 relative。 */
  .btn-sm, .chip, .seg-ctl button, .x-btn, .tier-row-del { position: relative; }
  .btn-sm::after, .chip::after, .seg-ctl button::after {
    content: ''; position: absolute; inset: -9px 0;
  }
  .x-btn::after { content: ''; position: absolute; inset: -7px; }
  /* 分档行里的 × 只有 26×21：纵向可放心外扩 12px —— 行高约 46px、行间距 8px，
     外扩后距相邻行的命中区仍有约 9px 余量，不会误删相邻档位 */
  .tier-row-del::after { content: ''; position: absolute; inset: -12px -9px; }
  /* 日期翻页的 ‹ › 是本页最窄的按钮（26px），横向外扩会顶到旁边的日期输入框，
     所以改为直接把视觉宽度补到 44px —— 左右两侧各有 8px 间距，加宽后仍放得下 */
  .date-bar .btn-sm { min-width: 44px; justify-content: center; }
}

@media (max-width: 520px) {
  /* 清单行在 520px 以下放不下「图标 + 名称 + 加减器 + 小计 + 去掉」五个块，
     名称列会被压到 20px 左右、变成一字一行。两行网格：名称独占第一行，
     加减器落到名称下面，小计与「去掉」右侧通栏。
     桌面上（弹窗 520px）一行放得下，保持原来的 flex，不动。 */
  .cart-row {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto auto;
    grid-template-areas:
      "ci cn   sub del"
      "ci qty  sub del";
    column-gap: 10px; row-gap: 6px;
    align-items: center;
  }
  .cart-row .ci { grid-area: ci; align-self: center; }
  .cart-row .cn { grid-area: cn; }
  .cart-row .qty-edit { grid-area: qty; justify-self: start; }
  .cart-row .csub { grid-area: sub; min-width: 0; }
  .cart-row .btn-danger { grid-area: del; align-self: center; }

  .rank-nums { gap: 10px; }
  .rank-nums b { font-size: 13px; }
  .review-item { flex-wrap: wrap; row-gap: 8px; }
  .review-item > .tag { order: 1; }
  .review-item .ri-reason { order: 2; flex: 1 1 55%; }
  .review-item .ri-time { order: 3; }
  .review-item .ri-pts { order: 4; }
  .review-item .ri-acts { order: 5; margin-left: auto; }
  .review-item .ri-acts .btn { padding: 4px 9px; }
}

/* ≤420px：极窄屏（320~414px）的两个「挤爆」点 */
@media (max-width: 420px) {
  /* 排行榜行的数字块内容宽 191px 且 flex-shrink:0 —— 320px 下它与
     .rank-no(30) + .rank-av(40) + 三处 gap 相加超过可用宽度，
     把整行（连带底部标签栏）横向撑出 11px。
     让它可收缩 + 允许换行后，数字永远顶不破卡片。 */
  .rank-nums {
    flex-shrink: 1; min-width: 0; flex-wrap: wrap;
    justify-content: flex-end; gap: 6px 10px;
  }

  /* 顶栏右侧 4 个按钮（86 / 78 / 72 / 46px + 间距）在 320px 下换行成 2 行，
     顶栏从 131px 涨到 168px。这里收窄内边距、隐藏与底部「档案」标签完全
     重复的快捷入口、按钮只留图标，并让按钮组与标题并排（放不下会自动换行），
     把顶栏压回一行。 */
  .topbar { padding: calc(10px + env(safe-area-inset-top)) 14px 9px; gap: 8px 10px; }
  .topbar h1 { font-size: 18px; }
  .topbar p { display: none; }              /* 副标题让位给操作按钮 */
  #quickAdd { display: none; }              /* 与底部标签栏「档案」同一动作，手机上冗余 */
  #topbarRight { width: auto; flex-wrap: nowrap; gap: 8px; }
  #topbarRight .btn-t { display: none; }    /* 只留图标 */
  #topbarRight .tag { max-width: 96px; overflow: hidden; }
  #topbarRight .tag .tb-name {
    display: inline-block; max-width: 62px; vertical-align: bottom;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}

/* ---------------------------------------------------------------- 栅格防变形 */

/* 任意网格子项都可收缩，避免长文本 / 长数字把列撑破导致错位 */
.grid > * { min-width: 0; }

/* ================================================================ 补打卡弹窗 */

/* 任务勾选清单：可滚动，避免任务多时把弹窗撑到屏幕外 */
.bf-tasks {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--c-line); border-radius: var(--r-sm);
  padding: 6px; background: #fafbfe;
}
.bf-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--r-xs);
  cursor: pointer; border: 1px solid transparent;
}
.bf-row:hover { background: #f1f5ff; border-color: #dbe4fa; }
.bf-row input[type=checkbox] { width: 16px; height: 16px; flex-shrink: 0; }
.bf-row .bf-ico { font-size: 18px; flex-shrink: 0; }
.bf-row .bf-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bf-row .bf-main b { font-size: 13.5px; }
.bf-row .bf-pts {
  font-weight: 700; font-size: 13px; color: var(--c-success);
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.bf-tip {
  margin: 0; font-size: 12.5px; color: var(--c-warn); font-weight: 600; min-height: 18px;
}

/* ============================================================ 清空数据弹窗 */

.rs-scope { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 4px; }
.rs-col {
  border: 1px solid var(--c-line); border-radius: var(--r-sm);
  padding: 10px 12px; background: #fafbfe;
}
.rs-title { font-size: 12.5px; font-weight: 700; margin-bottom: 8px; }
.rs-title.danger { color: var(--c-danger); }
.rs-title.ok { color: var(--c-success); }
.rs-row {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 12.5px; padding: 4px 0; border-bottom: 1px dashed var(--c-line);
}
.rs-row:last-child { border-bottom: none; }
.rs-row b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ================================================================ 积分明细 */

.lg-types { display: flex; flex-wrap: wrap; gap: 10px; }
.lg-type {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--c-line); border-radius: var(--r-sm);
  padding: 8px 12px; background: #fafbfe;
}
.lg-type .lt-num {
  display: flex; align-items: baseline; gap: 8px;
  font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
}
/* 原因可能很长（补卡前缀 + 档位 + 数量），限宽省略，完整内容放 title 里 */
.lg-reason {
  max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 620px) {
  .rs-scope { grid-template-columns: 1fr; }
  .bf-tasks { max-height: 220px; }
  /* 原因列在窄屏改为正常换行。原来限宽 160px 会截断，而完整原因只放在
     title 属性里 —— 触屏没有 hover，手机上根本读不到全文。
     表格本身在 .table-wrap 里可以横向滚动，换行不会撑破页面。 */
  .lg-reason { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; }
}

/* 数字对齐：统计、积分、排名、待确认等数字使用等宽数字，避免抖动 */
.stat-pill .v, .kpi .v, .rank-nums b, .review-pts, .task-pts,
table.tbl td, .review-item .ri-pts { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- 关于页 */

.about-hero { display: flex; align-items: flex-start; gap: 14px; }
.about-hero .star { font-size: 34px; line-height: 1; }

/* 版本信息：左侧标签、右侧取值；移动端自动折行 */
.about-kv {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 9px 12px;
  margin: 0;
  font-size: 13px;
  align-items: baseline;
}
.about-kv dt { color: var(--muted); }
.about-kv dd { margin: 0; font-weight: 600; word-break: break-all; }

/* 功能模块条目 */
.guide-item {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px dashed var(--line);
}
.guide-item .g-icon { font-size: 16px; width: 22px; text-align: center; flex: none; }
.guide-item .g-name { font-weight: 600; font-size: 13.5px; }

/* 流程步骤 / 小贴士条目 */
.flow-step { display: flex; gap: 9px; padding: 5px 0; font-size: 13px; line-height: 1.65; }
.flow-step .n {
  flex: none;
  width: 20px; height: 20px;
  margin-top: 2px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-600);
  font-size: 11.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

@media (max-width: 900px) {
  .about-kv { grid-template-columns: 76px 1fr; }
}

/* ---------------------------------------------------------------- 打卡时间点分档（列表紧凑展示 + 编辑器） */

/* 任务列表里：把「时间点 → 分值」逐条列出来，一眼看清关联关系 */
.tier-mini { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tier-mini-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; line-height: 1.7;
  background: var(--primary-soft); color: var(--primary-600);
}
.tier-mini-item.deduct { background: var(--danger-soft); color: #cf3d59; }
.tier-mini-item.now { box-shadow: 0 0 0 2px var(--primary); }
.tier-mini-item b { font-weight: 700; }

/* ---------- 打卡前选择本次分值（家长端弹窗） ---------- */
.tier-pick { display: flex; flex-direction: column; gap: 7px; }
.tier-pick-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 13px; border-radius: 10px;
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  font-family: inherit; font-size: 13.5px; font-weight: 600;
  text-align: left; cursor: pointer; transition: all .15s;
}
.tier-pick-row:hover { border-color: var(--primary); }
.tier-pick-row .tpr-range { flex: 1; }
.tier-pick-row .tpr-pts { font-variant-numeric: tabular-nums; font-weight: 700; }
.tier-pick-row .tpr-now {
  padding: 2px 8px; border-radius: 999px;
  background: var(--primary-soft); color: var(--primary-600);
  font-size: 11px; font-weight: 600;
}
.tier-pick-row .tpr-sel { display: none; color: var(--primary); font-weight: 800; }
.tier-pick-row.sel {
  border-color: var(--primary); background: var(--primary-soft);
  box-shadow: 0 0 0 2px var(--primary-soft);
}
.tier-pick-row.sel .tpr-sel { display: inline; }
.tier-pick-row.deduct .tpr-pts { color: #cf3d59; }
.tier-pick-row.deduct.sel { border-color: var(--danger); background: var(--danger-soft); box-shadow: 0 0 0 2px var(--danger-soft); }
.tier-pick-row.deduct.sel .tpr-sel { color: var(--danger); }
.tier-pick-tip {
  margin: 10px 0 0; padding: 8px 11px; border-radius: 9px;
  background: var(--bg); color: var(--muted); font-size: 12.5px;
}

/* ---------- 打卡确认框：提交前把「这次记什么」摆出来再问一次 ----------
   内容与文案由 checkinConfirm.js 统一提供，孩子端用 .kc-* 同一套结构、
   只是壳不同（.kid-modal）。这里只管家长端的外观。 */
.ck-box {
  background: var(--bg); border-radius: 12px; padding: 12px 14px;
}
.ck-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: 13.5px; padding: 5px 0;
}
.ck-row > span { color: var(--muted); flex: none; }
.ck-row > b { font-weight: 700; text-align: right; word-break: break-word; font-variant-numeric: tabular-nums; }
/* 本次分值单独放大并用分隔线隔开：这是家长真正要看的那一行 */
.ck-pts {
  margin-top: 6px; padding-top: 11px;
  border-top: 1px dashed var(--line-2);
  align-items: center;
}
.ck-pts > span { font-size: 14px; font-weight: 600; }
.ck-pts > b { font-size: 22px; color: var(--success); }
.ck-pts.neg > b { color: var(--danger); }
.ck-tag {
  font-style: normal; font-size: 10.5px; font-weight: 700;
  margin-left: 6px; padding: 2px 7px; border-radius: 999px;
  background: var(--warn-soft, #fff4d6); color: #8a6100; vertical-align: middle;
}
.ck-notes { margin: 12px 0 0; padding: 0; list-style: none; }
.ck-notes li {
  font-size: 12.5px; line-height: 1.6; color: #8a6100;
  padding: 7px 11px; border-radius: 9px; background: #fff8e6;
}
.ck-notes li + li { margin-top: 6px; }

.tier-editor .tier-sec { margin-bottom: 18px; }
.tier-sec-title {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 9px;
}
.tier-sec-title .sub { font-size: 11.5px; font-weight: 400; color: var(--muted); }

.tier-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tier-chip {
  border: 1px solid var(--line-2); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 5px 11px; font-size: 12.5px;
  transition: all .15s;
}
.tier-chip:hover { border-color: #c9d3e8; }
.tier-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
.tier-chip.custom.on { background: var(--purple); border-color: var(--purple); }
.tier-chip.catch.on { background: var(--danger); border-color: var(--danger); }
.tier-chip.sm { padding: 3px 10px; font-size: 12px; }

.tier-custom { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.tier-custom .control { width: 136px; }

.tier-rows { display: flex; flex-direction: column; gap: 8px; }
.tier-row {
  display: grid;
  grid-template-columns: 62px 86px 92px 26px 1fr;
  align-items: center; gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fbfcff;
  transition: border-color .15s, box-shadow .15s;
}
.tier-row.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.tier-row-time { font-weight: 700; font-size: 13.5px; color: var(--primary-600); }
.tier-row-time.catch { color: #cf3d59; }
.tier-row-kind, .tier-row-points { padding: 5px 8px; font-size: 13px; }
.tier-row-del {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-size: 17px; line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.tier-row-del:hover { color: var(--danger); background: var(--danger-soft); }
.tier-row-range { font-size: 12px; color: var(--muted); }

.tier-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.tier-presets-label { font-size: 12px; color: var(--muted); margin-right: 2px; }

.tier-preview {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 12px; border-radius: var(--radius-sm);
  background: var(--primary-soft); min-height: 46px;
}
.tier-pv {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: #fff; font-size: 12.5px; color: var(--ink-2);
}
.tier-pv em { font-style: normal; color: var(--muted); }
.tier-pv b { font-weight: 700; color: #0d8b6c; }
.tier-pv.deduct { background: var(--danger-soft); }
.tier-pv.deduct b { color: #cf3d59; }
.tier-pv-sep { font-style: normal; color: var(--muted); }
.tier-pv-empty { font-size: 12.5px; color: var(--muted); }

.tier-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 20px; }
.tier-foot .btn-danger { margin-right: auto; }

@media (max-width: 560px) {
  .tier-row { grid-template-columns: 54px 1fr 1fr 26px; }
  .tier-row-range { grid-column: 1 / -1; }
  .tier-custom { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- 成长统计（首页核心指标 + 7 天图表） */

.growth-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.growth-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.growth-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.growth-tile .gt-v {
  font-size: 21px; font-weight: 700; line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.growth-tile .gt-l { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.growth-tile .gt-s { font-size: 11px; color: var(--muted); margin-top: 3px; }
.growth-tile.k-study .gt-v { color: var(--study); }
.growth-tile.k-gold .gt-v { color: #f2a20c; }
.growth-tile.k-life .gt-v { color: var(--life); }
.growth-tile.k-success .gt-v { color: var(--success); }
.growth-tile.k-flame .gt-v { color: #ff7a45; }
.growth-tile.k-purple .gt-v { color: var(--purple); }

.growth-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}

/* 分段控件（柱状图 / 折线图切换） */
.seg-ctl {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--c-bg); border: 1px solid var(--line); border-radius: 999px;
}
.seg-ctl button {
  border: none; background: transparent; cursor: pointer;
  font: inherit; font-size: 12.5px; color: var(--muted);
  padding: 4px 13px; border-radius: 999px;
  transition: background .15s, color .15s;
}
.seg-ctl button:hover { color: var(--ink-2); }
.seg-ctl button.active {
  background: var(--card); color: var(--primary-600);
  font-weight: 600; box-shadow: 0 1px 3px rgba(30, 36, 51, .1);
}

.growth-chart { min-height: 120px; }
.growth-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.growth-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.growth-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* 必打卡项未完成 / 奖励扣减提示条 */
.req-alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--c-danger-soft); background: #fff7f9;
  margin-bottom: 14px;
}
.req-alert.ok { border-color: var(--c-success-soft); background: #f2fdf9; }
.req-alert.off { border-color: var(--line); background: var(--c-bg); }
.req-alert .ra-ico { font-size: 19px; line-height: 1.3; }
.req-alert .ra-body { flex: 1; min-width: 0; }
.req-alert .ra-title { font-weight: 600; font-size: 13.5px; color: #cf3d59; }
.req-alert.ok .ra-title { color: #0d8b6c; }
.req-alert.off .ra-title { color: var(--ink-2); }
.req-alert .ra-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.req-alert .ra-sub b { color: #cf3d59; font-variant-numeric: tabular-nums; }
.req-alert.ok .ra-sub b { color: #0d8b6c; }
.req-missing { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.req-missing-item {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  background: #fff; border: 1px solid var(--c-danger-soft);
  font-size: 12px; color: var(--ink-2);
}
.req-alert.ok .req-missing-item { border-color: var(--c-success-soft); }
.req-bar { height: 5px; border-radius: 999px; background: #f1e3e7; overflow: hidden; margin-top: 9px; }
.req-bar i { display: block; height: 100%; background: var(--danger); border-radius: 999px; transition: width .3s; }
.req-alert.ok .req-bar i { background: var(--success); }

@media (max-width: 1080px) {
  .growth-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .growth-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .growth-tile .gt-v { font-size: 18px; }
  .growth-head { align-items: flex-start; }
}

/* ---------------------------------------------------------------- 筛选行 / 分页 / 键值表 / 审计 */

/* 筛选行：一行里放若干「标签 + 控件」，窄屏自动换行。
   与 .field-row（固定两列）的区别：这里列数不定、每列宽度由控件内容决定。 */
.filter-row {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px;
  margin-bottom: 14px;
}
.filter-row > label {
  display: flex; flex-direction: column; gap: 5px;
  font-size: 12.5px; color: var(--ink-2); font-weight: 500;
  min-width: 130px; flex: 0 1 auto;
}
.filter-row > label > .control { width: 100%; }
.filter-row > .btn { margin-bottom: 1px; }

/* 分页条：说明文字靠左，按钮靠右 */
.pager {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  margin-top: 12px; flex-wrap: wrap;
}
.pager > .muted { margin-right: auto; }

/* 键值表（详情弹窗）：列宽自适应，窄屏自动收成一列 */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 12px; }
.kv > div {
  display: flex; gap: 8px; align-items: baseline;
  padding: 7px 11px; background: #f7f9fe; border-radius: var(--radius-sm);
  font-size: 12.5px; min-width: 0;
}
.kv > div > b { color: var(--muted); font-weight: 500; flex-shrink: 0; }
.kv > div > span { color: var(--ink); word-break: break-all; }

/* 等宽字体：时间 / IP / ID 这类需要对齐的字段 */
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

/* 审计详情里的 JSON 原文 */
.audit-json {
  margin: 12px 0 0; padding: 12px 14px;
  background: #f7f9fe; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12px; line-height: 1.65; max-height: 320px; overflow: auto;
  white-space: pre-wrap; word-break: break-all; color: var(--ink-2);
}

/* 可点开详情的审计行（覆盖表格默认 hover，提示"这行能点"） */
.audit-row[data-detail]:hover { background: var(--primary-soft); }

/* ---------------------------------------------------------------- 备份 / 恢复 / 导出 */

/* 备份状态条：左边图标 + 中间说明 + 右边按钮 */
.bk-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: #f7f9fe; border: 1px solid var(--line);
}
.bk-row + .bk-row { margin-top: 10px; }
.bk-row .bk-ico { font-size: 22px; flex-shrink: 0; }
.bk-row .bk-main { flex: 1 1 240px; min-width: 0; }
.bk-row .bk-main .t { font-weight: 600; font-size: 13.5px; }
.bk-row .bk-main .s { font-size: 12px; color: var(--muted); word-break: break-all; }
.bk-row .bk-acts { display: flex; gap: 8px; flex-wrap: wrap; }

/* 上传说明行（按钮下方的补充说明） */
.bk-upload-note {
  margin: 10px 0 0; padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: #f7f9fe; border: 1px dashed var(--line);
  font-size: 11.5px; color: var(--muted); line-height: 1.7;
}
.bk-upload-note b { color: var(--ink); }

/* 备份提醒条（超过 48 小时没备份时出现） */
.bk-alert {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 14px; border-radius: var(--radius-sm);
  background: var(--warn-soft); border: 1px solid #f4dfb0;
  font-size: 12.5px; color: #8a6206; margin-bottom: 12px;
}

/* 备份文件列表 */
.bk-list { display: flex; flex-direction: column; gap: 8px; }
.bk-item {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-size: 12.5px; background: #fff;
}
.bk-item:hover { border-color: #dfe6f5; }
.bk-item .bk-name { font-weight: 600; flex: 1 1 220px; min-width: 0; word-break: break-all; }
.bk-item .bk-meta { color: var(--muted); font-size: 11.5px; }
.bk-item .bk-acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* 说明块（触发方式 / 备份范围 / 存储位置 / 恢复流程） */
.doc-block { display: grid; gap: 10px; }
.doc-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 11px 13px; background: #f7f9fe; border-radius: var(--radius-sm);
  border: 1px solid var(--line); font-size: 12.5px; line-height: 1.7;
}
.doc-item .di-ico { font-size: 17px; flex-shrink: 0; line-height: 1.5; }
.doc-item .di-body { min-width: 0; }
.doc-item .di-body b { display: block; font-size: 13px; margin-bottom: 2px; }
.doc-item .di-body span { color: var(--ink-2); }

@media (max-width: 620px) {
  .filter-row > label { flex: 1 1 130px; }
  .pager { justify-content: space-between; }
  .kv { grid-template-columns: 1fr; }
  .bk-row .bk-acts, .bk-item .bk-acts { width: 100%; }
}

/* ---------------------------------------------------------------- 打卡照片（家长端查看 / 删除） */

/* 与孩子端 kid.css 的 .photo-strip 是同名同构的两套（各自用本端的颜色令牌）。
   这里只读查看 + 家长可删；孩子端多一个"添加"按钮。 */
.photo-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.photo-wrap { position: relative; display: inline-flex; }

.photo-thumb {
  width: 52px; height: 52px; object-fit: cover; border-radius: 10px;
  border: 2px solid var(--line); box-shadow: var(--shadow);
  cursor: pointer; background: var(--study-soft);
  transition: transform .15s, border-color .15s;
}
.photo-thumb:hover { transform: scale(1.06); border-color: var(--primary); }

/* 删除按钮：叠在缩略图右上角。家长端才有 —— 孩子端只能加不能删 */
.photo-del {
  position: absolute; top: -7px; right: -7px;
  width: 20px; height: 20px; border-radius: 50%; border: none; padding: 0;
  cursor: pointer; font-size: 11px; line-height: 1;
  background: var(--danger); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .22);
}

/* 触屏：删除照片原来只有 20×20，是全局最小的点击区（也是最危险的一个 —— 但删除
   有二次确认弹窗，放大命中区不会造成误删）。把视觉尺寸提到 26px，再靠 ::after 补到
   44×44。锚点同步外移，使它与缩略图的重叠面积保持不变，不会额外吃掉「点缩略图看大图」
   的区域。
   注意：这条必须写在上面 .photo-del 基础规则**之后** —— 同特异度下后写的才生效。 */
@media (max-width: 880px) {
  .photo-del { width: 26px; height: 26px; top: -13px; right: -13px; font-size: 14px; }
  .photo-del::after { content: ''; position: absolute; inset: -9px; }
}

/* 大图查看：铺满屏幕，点任意位置关闭 */
.photo-viewer {
  position: fixed; inset: 0; z-index: 999; cursor: zoom-out;
  background: rgba(20, 24, 40, .82); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.photo-viewer img {
  max-width: 100%; max-height: 100%; border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45); background: #fff;
}

/* ---------------------------------------------------------------- 无障碍：尊重"减少动态效果"偏好 */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .confetti-layer { display: none !important; }
}

/* ------------------------------------------------------------ 孩子端密码
   「🎲 帮我生成」或手工设置之后，把 4 位数字用大字摆出来让家长抄走。
   库里存的是 scrypt 哈希，服务端取不回明文 —— 关掉弹窗就真的看不到了，
   所以这一块的视觉优先级要足够高，不能被当成普通提示文字划过去。 */
.pin-show {
  border: 1px solid var(--c-primary);
  background: var(--c-primary-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.pin-show-label {
  font-size: 12px;
  color: var(--c-ink-2);
  margin-bottom: 6px;
}
.pin-show-digits {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 10px;
  line-height: 1.2;
  color: var(--c-primary-600);
  padding-left: 10px;
  user-select: all;
}
.pin-show-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
  font-size: 12px;
  color: var(--c-ink-2);
}
