/* 自律养成系统 - 全局样式 */

/* ---------- 分页懒加载与筛选条 ---------- */
.list-more {
  text-align: center; padding: 12px; margin: 10px 0 4px;
  color: var(--text-light); font-size: 13px; cursor: pointer;
  border-radius: 10px; transition: background .15s;
}
.list-more:hover { background: var(--primary-light); color: var(--primary-dark); }
.list-more[data-done="1"] { cursor: default; }
.list-more[data-done="1"]:hover { background: transparent; color: var(--text-light); }

.filter-bar {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 6px;
  display: flex; flex-direction: column; gap: 8px;
}
.filter-bar .fb-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar .fb-label { font-size: 12px; color: var(--text-light); font-weight: 600; flex-shrink: 0; }
.filter-bar .fb-period { padding: 4px 10px; font-size: 12px; }
.filter-bar .fb-period.active { background: var(--primary); color: #fff; }
.filter-bar input[type="date"], .filter-bar select {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: #fff; color: var(--text);
}
.filter-bar .fb-sep { color: var(--text-light); font-size: 12px; }

.honor-bar .honor-ops { margin-left: auto; display: flex; gap: 8px; }

:root {
  --primary: #ff7a59;
  --primary-dark: #f05a3c;
  --primary-light: #ffe8e0;
  --accent: #6c5ce7;
  --success: #2ecc71;
  --danger: #e74c3c;
  --warning: #f39c12;
  --info: #3498db;
  --bg: #f6f4fb;
  --card: #ffffff;
  --text: #2d3436;
  --text-light: #7f8c8d;
  --border: #ece7f5;
  --shadow: 0 4px 20px rgba(108, 92, 231, 0.08);
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: linear-gradient(160deg, #fdf3ee 0%, var(--bg) 40%, #f0ecfb 100%);
  min-height: 100vh;
  color: var(--text);
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  background: #fbfaff;
  box-shadow: inset 0 2px 4px rgba(70, 55, 110, .06);
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: inset 0 2px 4px rgba(70, 55, 110, .04), 0 0 0 3px rgba(255, 122, 89, .15);
}
textarea { resize: vertical; min-height: 72px; }
img { max-width: 100%; }

/* ---------- 布局 ---------- */
.app { max-width: 1080px; margin: 0 auto; padding: 16px 20px 60px; }
/* 一体式头部：标题栏 + 导航菜单合并为一个整体 */
.header {
  position: sticky; top: 10px; z-index: 20;
  background: rgba(255,255,255,.85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  margin-bottom: 20px;
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; }
.brand .logo {
  width: 32px; height: 32px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), #ffb347);
  color: #fff; box-shadow: 0 3px 10px rgba(255, 122, 89, .35);
  flex-shrink: 0;
}
.brand .logo .nav-ic { width: 20px; height: 20px; }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.topbar .user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--primary-light); color: var(--primary-dark);
  border-radius: 999px; padding: 6px 14px; font-weight: 600;
}
.nav {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 4px 10px 12px;
  border-top: 1px solid var(--border);
}
.nav button {
  border: none; background: transparent; color: var(--text-light);
  padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
  transition: all .2s;
  display: inline-flex; align-items: center; gap: 7px;
  cursor: pointer;
}
.nav button .nav-ic { width: 17px; height: 17px; }
.nav button:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav button.active { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(255,122,89,.3); }

/* 汉堡按钮：仅移动端显示 */
.menu-btn {
  display: none;
  border: none; background: var(--primary-light); color: var(--primary-dark);
  width: 40px; height: 40px;
  border-radius: 10px; flex-shrink: 0;
  align-items: center; justify-content: center;
  cursor: pointer;
}
.menu-btn:active { background: var(--primary); color: #fff; }

/* 侧边栏抽屉（移动端）：桌面默认隐藏 */
.sidebar, .sidebar-mask { display: none; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .75);
  padding: 20px; margin-bottom: 18px;
}
.card h2 { font-size: 17px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 { font-size: 15px; margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ---------- 统计卡片 ---------- */
.stat-card {
  position: relative;
  background: linear-gradient(160deg, #fff 0%, #fdf3ef 100%);
  border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; text-align: center;
  box-shadow: inset 0 2px 6px rgba(90, 70, 130, .05), 0 2px 10px rgba(108, 92, 231, .05);
}
.stat-card .num { font-size: 30px; font-weight: 800; color: var(--primary); }
.stat-card .label { color: var(--text-light); font-size: 13px; margin-top: 4px; }
.stat-card .ic { position: absolute; top: 10px; right: 12px; opacity: .16; pointer-events: none; }
.stat-card .ic .nav-ic { width: 30px; height: 30px; }
.stat-card.green .num { color: var(--success); }
.stat-card.purple .num { color: var(--accent); }
.stat-card.blue .num { color: var(--info); }

/* ---------- 按钮 ---------- */
.btn {
  border: none; border-radius: 10px; padding: 10px 18px;
  font-weight: 600; font-size: 14px; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(180deg, #ff9672 0%, var(--primary) 55%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 0 rgba(190, 70, 40, .5), 0 5px 14px rgba(255, 122, 89, .25), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn .nav-ic { width: 15px; height: 15px; }
.btn:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 rgba(190, 70, 40, .45), inset 0 2px 5px rgba(0, 0, 0, .18);
}
.btn.ghost {
  background: var(--primary-light); color: var(--primary-dark);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7), 0 1px 3px rgba(0, 0, 0, .05);
}
.btn.outline {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 1px 3px rgba(0, 0, 0, .05);
}
.btn.success {
  background: linear-gradient(180deg, #58e092 0%, #27c166 55%, #1ba054 100%);
  box-shadow: 0 2px 0 rgba(20, 140, 80, .5), 0 4px 12px rgba(46, 204, 113, .25), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn.danger {
  background: linear-gradient(180deg, #f06a5b 0%, #e0392b 55%, #c62f22 100%);
  box-shadow: 0 2px 0 rgba(160, 40, 30, .5), 0 4px 12px rgba(231, 76, 60, .25), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn.info {
  background: linear-gradient(180deg, #58b8f0 0%, #2f8fe0 55%, #2678c4 100%);
  box-shadow: 0 2px 0 rgba(30, 100, 170, .5), 0 4px 12px rgba(52, 152, 219, .25), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.badge.pending { background: #fff4e0; color: #b2740a; }
.badge.approved { background: #e4f9ec; color: #1d8a4f; }
.badge.fulfilled { background: #e3f2fd; color: #1565c0; }
.badge.rejected { background: #fde8e7; color: #c0392b; }
.badge.plus { background: #e4f9ec; color: #1d8a4f; }
.badge.minus { background: #fde8e7; color: #c0392b; }
.badge.penalty { background: #fde8e7; color: #c0392b; }
.badge.normal { background: #eef0f5; color: #7f8c8d; }
.badge.flame { background: #fff7e6; color: #d4380d; }

/* 行为等级徽章（普通/精良/稀有/史诗/传说） */
.rarity-badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 1px;
  color: #fff; background: var(--rc, #9D9D9D);
  box-shadow: 0 0 0 1px rgba(255,255,255,.35) inset;
  vertical-align: middle;
}
.rarity-badge[style*="--rc:#9D9D9D"] { color: #f5f5f5; }
.rarity-badge[style*="--rc:#1EFF00"] { color: #062d00; }
.rarity-badge[style*="--rc:#FF8000"] { color: #3a1e00; }

/* 品质小圆点：颜色即品质，名称放 tooltip（与彩色图标配合，减少重复文字） */
.rarity-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--rc, #9D9D9D);
  box-shadow: 0 0 0 2px rgba(255,255,255,.9), 0 1px 3px rgba(0,0,0,.25);
  vertical-align: middle; margin: 0 3px 1px 0; cursor: help;
}

/* 菜单/品牌 SVG 图标基础尺寸 */
.nav-ic { width: 18px; height: 18px; flex-shrink: 0; }

/* 通用 CSS Tooltip：data-tip="提示文字"，悬停/聚焦时显示（移动端点击元素聚焦也会触发） */
[data-tip] { position: relative; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: rgba(25, 25, 45, .95); color: #fff; font-size: 12px; line-height: 1.5;
  padding: 6px 10px; border-radius: 8px; z-index: 80;
  width: max-content; max-width: 72vw; white-space: normal; text-align: center;
  opacity: 0; visibility: hidden; transition: opacity .15s; pointer-events: none;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
}
[data-tip]::before {
  content: ""; position: absolute; bottom: calc(100% + 3px); left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: rgba(25, 25, 45, .95);
  opacity: 0; visibility: hidden; transition: opacity .15s; pointer-events: none; z-index: 80;
}
[data-tip]:hover::after, [data-tip]:focus::after,
[data-tip]:hover::before, [data-tip]:focus::before,
.tip-on::after, .tip-on::before { opacity: 1; visibility: visible; }

/* 连击进度 */
.streak-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.streak-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: linear-gradient(135deg, #fff7e6, #ffe8cc);
  border: 1px solid #ffd591; border-radius: 10px;
  padding: 6px 10px; font-size: 13px;
}
.streak-num { color: #d4380d; font-weight: 800; }
.streak-num .nav-ic { width: 14px; height: 14px; vertical-align: -2px; }
.streak-chip.penalty {
  background: linear-gradient(135deg, #fff1f0, #ffd8d5);
  border-color: #ffa39e;
}
.streak-chip.penalty .streak-num { color: #cf1322; }

/* ---------- 勋章墙（拟物化奖牌馆） ---------- */
.badge-wrap { background: linear-gradient(160deg, #fff 0%, #fbf7ec 100%); }
.badge-hero { display: flex; gap: 22px; flex-wrap: wrap; }

/* 荣誉馆票面 */
.medal-sheet {
  position: relative; flex: 1 1 340px; min-width: 300px;
  background: linear-gradient(170deg, #fffef9 0%, #fbf6e8 100%);
  border: 1px solid #ecdfc0; border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 10px 30px rgba(150, 120, 40, .14), inset 0 1px 0 #fff;
}
.medal-sheet::before,
.medal-sheet::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: repeating-linear-gradient(to bottom, transparent 0 6px, #e8d9b0 6px 12px);
}
.medal-sheet::before { left: 8px; }
.medal-sheet::after { right: 8px; }
.badge-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 900; color: #b8860b;
  letter-spacing: 1px;
}
.badge-cn { font-size: 10px; letter-spacing: 1.5px; color: #d9b96a; font-weight: 600; }
.badge-no {
  text-align: right; font-family: ui-monospace, monospace;
  font-size: 11px; color: #c9b489; margin-top: 2px;
}

/* 荣誉点金库展示（复用 vault-display 视觉） */
.medal-sheet .vault-display { margin: 12px 2px 10px; }

/* 票面底部统计 */
.medalbook-foot {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px;
  border-top: 2px dashed #e8d9b0; padding-top: 10px;
  font-size: 12px; color: var(--text-light);
}
.medalbook-foot b { color: #b8860b; }

/* 操作区 */
.medal-ops {
  flex: 1 1 240px; min-width: 220px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
}

/* 勋章网格 */
.badge-grid {
  display: grid; gap: 18px;
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 900px) { .badge-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .badge-grid { grid-template-columns: repeat(2, 1fr); } }

/* 勋章卡片：奖牌底座 + 缎带 */
.badge-card {
  position: relative; display: flex; flex-direction: column; gap: 8px;
  background: linear-gradient(165deg, #fff 0%, #fbfaf5 100%);
  border: 2px solid var(--rc, #e5e5e5); border-radius: 18px;
  padding: 18px 14px 16px; text-align: center; transition: all .2s;
  box-shadow: inset 0 2px 6px rgba(120, 100, 60, .04);
}
.badge-card:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(150, 120, 40, .18); }
.badge-card:not(.locked) { border-color: color-mix(in srgb, var(--rc, #9D9D9D) 60%, #fff); }

/* 奖牌底座 */
.badge-card .medal-face {
  position: relative; width: 104px; height: 104px; margin: 4px auto 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 32% 28%, #fffdf0 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, #ffe9a8 0%, #f5c84e 55%, #d99a13 100%);
  border: 4px solid #fff;
  box-shadow: 0 6px 16px rgba(217, 154, 19, .35), inset 0 -4px 10px rgba(120, 80, 0, .25), inset 0 3px 8px rgba(255, 255, 255, .6);
  outline: 3px solid color-mix(in srgb, var(--rc, #9D9D9D) 70%, #f5c84e);
  z-index: 1;
}
.badge-card .badge-icon {
  font-size: 44px; line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(120, 80, 0, .35));
}
.badge-card .badge-icon .ach-svg,
.badge-card .badge-icon .ach-img,
.badge-card .badge-icon .reward-emoji { width: 52px !important; height: 52px !important; font-size: 52px; }

/* 缎带 */
.badge-card .medal-ribbon {
  position: relative; height: 18px; width: 120px; margin: -8px auto 0;
  background: linear-gradient(90deg, var(--rc, #9D9D9D), color-mix(in srgb, var(--rc, #9D9D9D) 55%, #fff), var(--rc, #9D9D9D));
  clip-path: polygon(0 0, 100% 0, 86% 100%, 14% 100%);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .15));
  z-index: 0;
}

/* 佩戴中角标 */
.badge-card .medal-worn {
  position: absolute; top: -8px; right: -8px; z-index: 3;
  background: linear-gradient(180deg, #ffd34d, #f0b429); color: #5b3d00;
  font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 999px;
  box-shadow: 0 3px 8px rgba(240, 180, 41, .45); white-space: nowrap;
}

/* 锁定：挂锁 + 灰化 */
.badge-card .medal-lock {
  position: absolute; bottom: -4px; right: -6px; z-index: 3;
  font-size: 20px; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .3));
}
.badge-card.locked { background: #f6f6f4; }
.badge-card.locked .medal-face {
  background:
    radial-gradient(circle at 32% 28%, #fff 0%, transparent 45%),
    radial-gradient(circle at 50% 50%, #e9e9e6 0%, #c9c9c4 55%, #a9a9a2 100%);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .12), inset 0 -4px 10px rgba(0, 0, 0, .18);
  outline: 3px solid #c9c9c4;
}
.badge-card.locked .badge-icon { filter: grayscale(1) opacity(.55) drop-shadow(0 2px 3px rgba(0, 0, 0, .15)); }
.badge-card.locked .badge-name { color: #9a9a94; }

.badge-card .badge-name { font-weight: 800; font-size: 15px; color: #6b4d10; }
.badge-card .badge-desc { color: var(--text-light); font-size: 12px; flex: 1; }
.badge-card .badge-condition {
  font-size: 12px; color: #8a6d1f; background: #fdf9ec;
  border: 1px dashed #e6c95f; border-radius: 8px; padding: 5px 6px; line-height: 1.5;
}
.badge-card .progress {
  height: 8px; background: #efe6cd; border-radius: 999px; overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(150, 120, 40, .15);
}
.badge-card .progress .bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #f0b429, #ffd34d);
  transition: width .4s ease;
}
.badge-card .badge-progress { font-size: 12px; font-weight: 700; color: #b8860b; }
.badge-card .wear-btn { width: 100%; margin-top: 2px; }
.badge-card .redeem-btn {
  width: 100%; margin-top: 2px;
  background: linear-gradient(180deg, #ffd34d 0%, #f0b429 60%, #d99a13 100%);
  box-shadow: 0 2px 0 #a96f0a, 0 6px 14px rgba(240, 180, 41, .3);
  border: none; color: #5b3d00; font-weight: 800;
}
.badge-card .badge-redeem-need {
  font-size: 11px; font-weight: 700; color: #b8860b;
  background: #fdf6e3; border-radius: 8px; padding: 4px 6px;
}
.badge-card .badge-redeem { font-size: 12px; }
/* 佩戴次数提示 */
.badge-wear {
  font-size: 11px; font-weight: 600; color: #b8860b;
  background: #fdf6e3; border-radius: 8px; padding: 4px 6px;
}
.badge-wear b { color: #8a5a00; }
.badge-wear.wear-last { color: #c0392b; background: #fdf0ef; }
.badge-wear.wear-last b { color: #c0392b; }
/* 分解按钮 */
.decompose-btn { color: #c0392b; border-color: #f2c9c5; }
.decompose-btn:hover { background: #fde8e7; color: #c0392b; border-color: #c0392b; }
/* 荣誉商店 */
.honor-shop-card { border-style: dashed; }
.honor-shop-card .medal-ribbon {
  background: linear-gradient(90deg, #f0b429, #ffe9a8, #f0b429);
}
.honor-btn {
  width: 100%; margin-top: 2px;
  background: linear-gradient(180deg, #ffd34d 0%, #f0b429 60%, #d99a13 100%);
  box-shadow: 0 3px 0 #a96f0a, 0 8px 20px rgba(240, 180, 41, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
  border: none; color: #5b3d00; font-weight: 800;
}
.honor-btn:disabled { filter: grayscale(.7); }
/* 管理端徽章管理弹窗 */
.badge-manage-list { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow: auto; }
.badge-manage-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  background: #faf9ff;
}
.badge-manage-item .bmi-icon { flex-shrink: 0; }
.badge-manage-item .bmi-name { flex: 1; font-weight: 700; font-size: 14px; min-width: 0; }
.badge-manage-item .bmi-name .muted { font-weight: 400; }
.badge-manage-item .bmi-wear { flex-shrink: 0; }
/* 荣誉分解池设置 */
.honor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 16px; }
/* 行为卡片：加分/扣分视觉区分 */
.behavior-card.plus { border-color: #a8e6c3; box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 2px 10px rgba(46, 204, 113, .08); }
.behavior-card.minus { border-color: #ffb3ba; box-shadow: inset 0 1px 0 rgba(255,255,255,.8), 0 2px 10px rgba(255, 107, 129, .08); }
.behavior-card .cost { color: var(--text); }
.behavior-card.plus .cost { color: #27ae60; }
.behavior-card.minus .cost { color: #e74c3c; }
/* 成就卡片：稀有度图标渐变 + 突出加成 */
.ach-card .icon {
  height: 76px; font-size: 44px; border-radius: 16px;
  background: linear-gradient(180deg, #ffffff, color-mix(in srgb, var(--rc, #7c6cf6) 16%, #f4f2ff));
  border: 1px solid color-mix(in srgb, var(--rc, #7c6cf6) 30%, #fff);
}
.ach-card .icon .ach-svg { width: 46px !important; height: 46px !important; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .2)); }
.ach-card .icon .ach-img { width: 46px !important; height: 46px !important; }
.ach-card .icon .reward-emoji { font-size: 46px; }
.ach-bonus {
  display: flex; align-items: center; gap: 6px;
  border-radius: 10px; padding: 8px 10px;
  background: #f5f6fa; border: 1px dashed #d0d3e0; color: #a0a4b8;
}
.ach-bonus.active {
  background: linear-gradient(135deg, #fff7e6, #ffe9c7);
  border: 1px solid #ffd591; color: #8a5a00;
}
.ach-bonus .ab-label { font-size: 11px; font-weight: 700; opacity: .65; flex-shrink: 0; }
.ach-bonus b { font-size: 17px; margin-left: auto; letter-spacing: .5px; flex-shrink: 0; }
.ach-bonus em { font-style: normal; font-size: 11px; opacity: .8; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ach-bonus em.off { opacity: .45; }
/* 管理端儿童/审批人卡片 */
.kid-card.admin { cursor: default; }
.kid-card.admin .avatar { font-size: 30px; }
.kid-card.admin.off { opacity: .7; filter: grayscale(.4); }
.kid-card.approver .avatar { color: var(--primary); font-weight: 800; font-size: 24px; }
.kid-card.admin .unit { font-size: 12px; color: var(--text-light); font-weight: 400; margin-left: 2px; }
/* 惩罚规则卡片 */
.penalty-rule .icon { font-size: 36px; }
.penalty-rule .cond { border-color: #ffb3ba; background: rgba(255, 107, 129, .08); color: #c0392b; border-style: dashed; }
/* 惩罚记录列表 */
.penalty-list { display: flex; flex-direction: column; gap: 10px; }
.penalty-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff;
}
.penalty-item.active { border-color: #ffb3ba; background: #fff8f8; }
.penalty-item .pi-icon { font-size: 22px; flex-shrink: 0; }
.penalty-item .pi-main { flex: 1; min-width: 0; }
.penalty-item .pi-title { font-weight: 700; font-size: 14px; }
.penalty-item .pi-meta { font-size: 12px; color: var(--text-light); margin-top: 2px; }
/* 积分流水卡片列表 */
.ledger-list { display: flex; flex-direction: column; gap: 8px; }
.ledger-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: #fff;
  transition: all .15s;
}
.ledger-item:hover { border-color: var(--primary); box-shadow: 0 3px 10px rgba(108, 92, 231, .08); }
.ledger-item .li-icon { flex-shrink: 0; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: #f4f2ff; color: var(--primary); }
.ledger-item .li-main { flex: 1; min-width: 0; }
.ledger-item .li-title { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ledger-item .li-time { font-size: 11px; color: var(--text-light); font-weight: 400; }
.ledger-item .li-remark { font-size: 12px; color: var(--text-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-item .li-points { flex-shrink: 0; }
.ledger-item .li-bal { flex-shrink: 0; font-size: 12px; color: var(--text-light); min-width: 44px; text-align: right; }
/* 图片灯箱预览（悬浮查看大图） */
#lightbox {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center; padding: 24px;
}
#lightbox.show { display: flex; }
#lightbox .lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 12, 24, .78); backdrop-filter: blur(3px);
  animation: lbFade .18s ease;
}
#lightbox .lb-img {
  position: relative; max-width: 92vw; max-height: 88vh;
  border-radius: 12px; box-shadow: 0 24px 80px rgba(0, 0, 0, .55);
  object-fit: contain; animation: lbPop .2s ease;
}
#lightbox .lb-close {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, .16); color: #fff;
  font-size: 18px; cursor: pointer; transition: background .15s;
}
#lightbox .lb-close:hover { background: rgba(255, 255, 255, .32); }
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lbPop { from { transform: scale(.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* 勋章图标：离线 SVG 图标库 */
.ach-svg { display: inline-block; vertical-align: middle; }
.ach-img { display: inline-block; vertical-align: middle; object-fit: cover; border-radius: 8px; }
.badge-card .ach-svg { filter: drop-shadow(0 2px 6px rgba(0,0,0,.12)); }
/* 图标选择器 */
.icon-picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px;
  max-height: 176px; overflow: auto; padding: 10px;
  border: 1px solid var(--border); border-radius: 10px; background: #faf8ff;
}
.icon-picker .ip-item {
  width: 40px; height: 40px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; cursor: pointer; color: #8a7fb8;
  border: 1px solid transparent; transition: all .15s;
}
.icon-picker .ip-item svg { width: 24px; height: 24px; }
.icon-picker .ip-item img { width: 24px; height: 24px; object-fit: contain; }
.icon-picker .ip-item:hover { background: #f0ecff; border-color: #e2dcf8; }
.icon-picker .ip-item.sel { background: var(--primary); color: #fff; border-color: var(--primary); }
/* 图标选择器分组 */
.ip-group { margin-bottom: 12px; }
.ip-group-title { font-size: 12px; font-weight: 600; color: #8a7fb8; margin: 0 0 6px; }
.icon-picker { grid-template-columns: 1fr; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; color: var(--text-light); }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-inline .form-row { flex: 1; min-width: 150px; margin-bottom: 0; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--text-light); font-size: 12px; font-weight: 600; white-space: nowrap; }
tr:hover td { background: #faf8ff; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- 儿童卡片 ---------- */
.kid-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  cursor: pointer; transition: all .2s; background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 2px 10px rgba(108, 92, 231, .06);
}
.kid-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(108, 92, 231, .14); border-color: var(--primary); }
.kid-card .avatar {
  width: 60px; height: 60px; margin: 0 auto 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; line-height: 1; border-radius: 18px;
  background: linear-gradient(145deg, var(--primary-light), #fff);
  box-shadow: inset 0 2px 4px rgba(90, 70, 130, .08);
}
.kid-card .avatar .nav-ic { width: 32px; height: 32px; color: var(--primary); }
.kid-card .name { font-weight: 700; font-size: 16px; margin-bottom: 4px; }
.kid-card .meta { color: var(--text-light); font-size: 12px; }
.kid-card .balance { margin-top: 10px; font-weight: 800; color: var(--primary); font-size: 20px; }
.kid-card .cycle { font-size: 12px; color: var(--text-light); margin-top: 2px; }

/* ---------- 奖励卡片 ---------- */
.reward-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 16px;
  display: flex; flex-direction: column; gap: 8px; background: #fff;
  transition: all .2s;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 2px 10px rgba(108, 92, 231, .06);
}
.reward-card:hover { box-shadow: 0 8px 24px rgba(108, 92, 231, .14); transform: translateY(-2px); }
/* 奖励图标容器：浅色渐变底 + 内凹阴影，SVG/emoji 图标居中 */
.reward-card .icon {
  display: flex; align-items: center; justify-content: center;
  height: 64px; border-radius: 14px; font-size: 38px; line-height: 1;
  background: linear-gradient(180deg, #fbf8ff, #f0eafd);
  box-shadow: inset 0 2px 4px rgba(70, 55, 110, .08), 0 1px 0 rgba(255, 255, 255, .9);
  transition: transform .2s;
}
.reward-card:hover .icon { transform: scale(1.04); }
.reward-card .icon .ach-svg { filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .18)); }
.reward-card .icon .ach-img { width: 38px !important; height: 38px !important; }
.reward-card .icon .reward-emoji { text-shadow: 0 2px 6px rgba(0, 0, 0, .15); }
.reward-card.off { opacity: .72; filter: grayscale(.45); }
.reward-card .name { font-weight: 700; }
.reward-card .desc { color: var(--text-light); font-size: 12px; flex: 1; min-height: 32px; }
.reward-card .cost { color: var(--primary); font-weight: 800; font-size: 18px; }
.reward-card.wish { border-color: var(--accent); box-shadow: 0 2px 12px rgba(253, 203, 110, .18); }
.reward-card .tag {
  align-self: flex-start; font-size: 11px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), #e17055); color: #fff;
  padding: 3px 8px; border-radius: 20px;
}
.reward-card .tag em { font-style: normal; opacity: .85; margin-left: 4px; }
.reward-card .tag .nav-ic { width: 12px; height: 12px; }
.reward-card .cond {
  font-size: 12px; color: var(--warning); background: rgba(253, 203, 110, .12);
  border: 1px dashed var(--accent); border-radius: 8px; padding: 6px 8px; line-height: 1.5;
}

/* ---------- 提交卡片 ---------- */
.sub-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: #fff; margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 2px 10px rgba(108, 92, 231, .06);
}
.sub-card .head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.sub-card .title { font-weight: 700; font-size: 15px; }
.sub-card .points { font-weight: 800; font-size: 16px; }
.sub-card .note { color: var(--text-light); font-size: 13px; margin-bottom: 8px; }
.sub-card .photo { width: 100%; max-height: 260px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
/* 行为申请多图缩略图网格 */
.sub-card .photo-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px; margin-bottom: 10px;
}
.sub-card .photo-grid img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: 10px; cursor: zoom-in;
  transition: transform .15s, box-shadow .15s;
}
.sub-card .photo-grid img:hover { transform: scale(1.03); box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.sub-card .meta { color: var(--text-light); font-size: 12px; display: flex; gap: 14px; flex-wrap: wrap; }
.sub-card .review { margin-top: 8px; background: #faf8ff; border-radius: 8px; padding: 8px 10px; font-size: 12px; color: var(--text-light); }

/* ---------- 愿望卡片：状态色图标 + 左侧色条 ---------- */
.sub-card.wish { position: relative; overflow: hidden; }
.sub-card.wish::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--wc, #FFB74D);
}
.sub-card.wish .wish-ic {
  width: 40px; height: 40px; flex: none; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: var(--wc, #FFB74D); margin-right: 10px;
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--wc, #FFB74D) 16%, #fff));
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .06), 0 1px 0 rgba(255, 255, 255, .9);
}
.sub-card.wish .wish-ic .nav-ic { width: 22px; height: 22px; }

/* ---------- 惩罚横幅 ---------- */
.penalty-banner {
  background: linear-gradient(135deg, #e74c3c, #f39c12);
  color: #fff; border-radius: 14px; padding: 14px 18px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.penalty-banner .icon { font-size: 30px; }
.penalty-banner .txt { flex: 1; }
.penalty-banner .txt b { font-size: 16px; }

/* ---------- 余额卡 ---------- */
.balance-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #ff9a76 60%, var(--accent) 140%);
  color: #fff; border-radius: 18px; padding: 24px; margin-bottom: 18px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px;
  box-shadow: 0 8px 24px rgba(255, 122, 89, .3);
}
.balance-hero .big { font-size: 44px; font-weight: 900; line-height: 1; }
.balance-hero .sub { opacity: .9; font-size: 13px; margin-top: 6px; }
.balance-hero .ops { display: flex; gap: 10px; }
.balance-hero .btn {
  background: rgba(255, 255, 255, .22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 2px 8px rgba(0, 0, 0, .12);
}
.balance-hero .btn:hover { background: rgba(255, 255, 255, .34); transform: translateY(-1px); }
.balance-hero .btn:active { box-shadow: inset 0 2px 5px rgba(0, 0, 0, .2); transform: translateY(1px); }

/* ---------- 上传 ---------- */
.upload-box {
  border: 2px dashed var(--border); border-radius: 12px; padding: 18px;
  text-align: center; color: var(--text-light); cursor: pointer;
  transition: all .2s; background: #fbfaff;
}
.upload-box:hover { border-color: var(--primary); color: var(--primary); }
.upload-box img { max-height: 220px; border-radius: 10px; margin-top: 8px; }
.upload-box .hint { font-size: 12px; margin-top: 6px; }
.upload-box .hint .nav-ic { width: 20px; height: 20px; vertical-align: -5px; }
/* 提交表单多图预览 */
.upload-box .photo-preview { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.upload-box .photo-preview img {
  width: 84px; height: 84px; object-fit: cover;
  border-radius: 10px; cursor: zoom-in; margin-top: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .14);
  transition: transform .15s;
}
.upload-box .photo-preview img:hover { transform: scale(1.06); }

/* ---------- 模态框 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(30, 30, 50, .5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
  padding: 20px;
}
.modal {
  background: #fff; border-radius: 18px; padding: 24px; width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal h3 { margin-bottom: 16px; }
.modal .btns { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; }

/* ---------- Toast ---------- */
#toast-box { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border-radius: 12px; padding: 12px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.15); border-left: 4px solid var(--success);
  animation: slideIn .3s ease;
  max-width: 320px;
}
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 登录页 ---------- */
/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; position: relative; overflow: hidden;
  background: linear-gradient(150deg, #fdf3ee 0%, #f3ecfb 55%, #e8f2fd 100%);
}
.login-wrap::before, .login-wrap::after {
  content: ""; position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: .55; pointer-events: none;
}
.login-wrap::before {
  width: 380px; height: 380px; top: -120px; left: -100px;
  background: radial-gradient(circle, rgba(255, 122, 89, .4), transparent 70%);
}
.login-wrap::after {
  width: 420px; height: 420px; bottom: -140px; right: -120px;
  background: radial-gradient(circle, rgba(108, 92, 231, .4), transparent 70%);
}
.login-card {
  position: relative; width: 100%; max-width: 410px;
  background: rgba(255, 255, 255, .85); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 24px; padding: 42px 38px; text-align: center;
  box-shadow: 0 24px 70px rgba(108, 92, 231, .16);
}
.login-card.shake { animation: loginShake .4s ease; }
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-9px); }
  40% { transform: translateX(9px); }
  60% { transform: translateX(-5px); }
  80% { transform: translateX(5px); }
}
.login-card .logo {
  width: 76px; height: 76px; border-radius: 22px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; box-shadow: 0 10px 30px rgba(255, 122, 89, .35);
  margin: 0 auto; animation: loginLogoFloat 3.2s ease-in-out infinite;
}
@keyframes loginLogoFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.login-card .logo .nav-ic { width: 42px; height: 42px; }
.login-card h1 { margin: 12px 0 4px; font-size: 23px; letter-spacing: 1px; }
.login-card .slogan { color: var(--text-light); font-size: 13px; margin-bottom: 26px; }
.login-card .form-row { text-align: left; margin-bottom: 16px; }
.login-card .form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--text-light); margin-bottom: 6px; }
.login-card input {
  width: 100%; padding: 12px 14px; font-size: 15px;
  border: 1.5px solid var(--border); border-radius: 12px; outline: none;
  background: #fff; transition: border-color .2s, box-shadow .2s;
}
.login-card input:focus {
  border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-light);
}
.login-card .btn {
  width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), #ff9a5a);
  box-shadow: 0 8px 22px rgba(255, 122, 89, .3);
  transition: transform .15s, box-shadow .15s, opacity .2s;
}
.login-card .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(255, 122, 89, .4); }
.login-card .btn:active:not(:disabled) { transform: translateY(0); }
.login-card .btn:disabled { opacity: .65; cursor: wait; }
.login-tip { margin-top: 18px; font-size: 12px; color: var(--text-light); }

/* ---------- 其他 ---------- */
.muted { color: var(--text-light); font-size: 12px; }
.empty {
  text-align: center; color: var(--text-light); padding: 34px 12px; font-size: 13px;
  background: linear-gradient(160deg, rgba(108, 92, 231, .03), transparent);
  border-radius: 12px;
}
.section-title { font-size: 16px; font-weight: 800; margin: 20px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-title .nav-ic { width: 17px; height: 17px; }
h2 .nav-ic { vertical-align: -3px; }
.tabs { display: flex; gap: 6px; margin-bottom: 16px; }
.tabs button {
  border: none; background: #fff; padding: 9px 18px; border-radius: 10px;
  font-weight: 600; color: var(--text-light);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 2px 8px rgba(108, 92, 231, .08);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer; transition: all .15s;
}
.tabs button .nav-ic { width: 15px; height: 15px; }
.tabs button.active {
  background: linear-gradient(180deg, #ff9672 0%, var(--primary) 55%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 0 rgba(190, 70, 40, .4), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.photo-thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 10px; cursor: pointer; }

/* ---------- 审批任务与加签 ---------- */
.approval-tasks { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 6px; }
.approval-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #faf8ff; border: 1px solid #ede7fb; border-radius: 999px;
  padding: 3px 10px; font-size: 12px; color: var(--text-light);
}
.approval-chip b { color: var(--text); }
.check-list {
  display: flex; flex-direction: column; gap: 6px; max-height: 190px;
  overflow-y: auto; padding: 10px; border: 1px dashed var(--border);
  border-radius: 10px; background: #fbfaff;
}
.check-item { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.check-item input[type="checkbox"] { width: auto; margin: 0; }

/* 导航：中屏以下（平板竖屏/手机/窄窗口）改为左侧可折叠抽屉式侧边栏，
   顶部导航隐藏，汉堡按钮唤起 */
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; }
  .nav { display: none; }
  .menu-btn { display: inline-flex; }

  /* 遮罩层 */
  .sidebar-mask {
    display: block; position: fixed; inset: 0; z-index: 90;
    background: rgba(30, 30, 50, .5);
    opacity: 0; visibility: hidden; transition: opacity .25s;
  }
  .sidebar-mask.show { opacity: 1; visibility: visible; }

  /* 抽屉侧边栏 */
  .sidebar {
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    width: 264px; max-width: 82vw;
    background: #fff; box-shadow: 0 0 40px rgba(0, 0, 0, .18);
    transform: translateX(-100%); transition: transform .28s ease;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .sidebar.open { transform: translateX(0); }

  /* 侧边栏头部 */
  .sidebar-head {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 18px;
    background: linear-gradient(135deg, var(--primary-light) 0%, #fff 100%);
    border-bottom: 1px solid var(--border);
  }
  .sidebar-head .logo {
    width: 44px; height: 44px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary), #ffb347);
    color: #fff; box-shadow: 0 3px 10px rgba(255, 122, 89, .3);
    flex-shrink: 0;
  }
  .sidebar-head .logo .nav-ic { width: 26px; height: 26px; }
  .sidebar-user { min-width: 0; flex: 1; }
  .sidebar-name {
    font-weight: 700; font-size: 14px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .sidebar-logout { font-size: 12px; color: var(--text-light); margin-top: 2px; cursor: pointer; }
  .sidebar-logout:hover { color: var(--primary); }
  .sidebar-head .sidebar-avatar {
    width: 44px; height: 44px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--primary-light), #fff);
    box-shadow: 0 3px 10px rgba(255, 122, 89, .25);
    flex-shrink: 0; overflow: hidden;
  }
  .sidebar-head .sidebar-avatar img { width: 100% !important; height: 100% !important; object-fit: cover; }
  .sidebar-head .sidebar-avatar .nav-ic { width: 26px; height: 26px; }

  /* 侧边栏菜单 */
  .sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
  .sidebar-nav button {
    border: none; background: transparent; color: var(--text);
    text-align: left; padding: 13px 14px; border-radius: 10px;
    font-size: 14px; font-weight: 600; min-height: 44px;
    display: flex; align-items: center; gap: 10px; transition: all .15s;
  }
  .sidebar-nav button.active {
    background: var(--primary); color: #fff;
    box-shadow: 0 4px 12px rgba(255, 122, 89, .3);
  }
  .sidebar-nav button:not(.active):hover { background: var(--primary-light); color: var(--primary-dark); }
  .sidebar-nav button .nav-ic { width: 20px; height: 20px; }
}

/* ================= 移动端适配 ================= */

/* 防止 iOS Safari 输入时自动缩放 */
html { -webkit-text-size-adjust: 100%; }

/* 兜底：任何元素不得撑破整页产生横向滚动条（滚动由局部容器承担） */
body { overflow-x: hidden; }

/* 手机竖屏 */
@media (max-width: 640px) {
  .app { padding: 10px 12px calc(64px + env(safe-area-inset-bottom)); }

  /* 顶栏 */
  .header {
    top: 0; margin-bottom: 12px;
    border-radius: 0 0 var(--radius) var(--radius);
  }
  .topbar { padding: 10px 12px; }
  .brand { font-size: 15px; gap: 6px; }
  .brand .logo { width: 28px; height: 28px; border-radius: 9px; }
  .brand .logo .nav-ic { width: 17px; height: 17px; }
  .topbar .right { gap: 8px; }
  .user-chip {
    padding: 4px 10px; font-size: 12px;
    max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .topbar .btn.sm { min-height: 34px; padding: 8px 12px; }

  /* 导航：横向滑动 tab */
  .nav { padding: 6px 8px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { padding: 10px 14px; font-size: 13px; flex-shrink: 0; min-height: 42px; }

  /* 卡片与网格 */
  .card { padding: 14px; border-radius: 14px; margin-bottom: 14px; }
  .card h2 { font-size: 15px; margin-bottom: 12px; }
  .grid { gap: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .section-title { font-size: 15px; margin: 16px 0 10px; }

  /* 卡片标题行（标题 + 新增按钮）允许换行 */
  .card > div[style*="justify-content:space-between"] { flex-wrap: wrap !important; gap: 8px; }

  /* 统计卡片 */
  .stat-card { padding: 12px 8px; }
  .stat-card .num { font-size: 24px; }
  .stat-card .label { font-size: 12px; }
  .stat-card .ic .nav-ic { width: 24px; height: 24px; }

  /* 按钮：保证触控区域 */
  .btn { min-height: 44px; padding: 10px 16px; }
  .btn.sm { min-height: 38px; padding: 8px 12px; font-size: 13px; }

  /* 表格：触摸横向滚动，压缩内边距 */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  th, td { padding: 10px; font-size: 13px; }
  th { font-size: 11px; }

  /* 余额大卡 */
  .balance-hero { flex-direction: column; align-items: stretch; padding: 18px; }
  .balance-hero .big { font-size: 36px; }
  .balance-hero .ops { flex-wrap: wrap; }
  .balance-hero .ops .btn { flex: 1 1 auto; justify-content: center; min-height: 44px; }

  /* 表单 */
  .form-inline { flex-direction: column; align-items: stretch; }
  .form-inline .form-row { min-width: 0; }

  /* iOS 输入框聚焦时避免页面自动缩放（字号 <16px 会触发） */
  input, select, textarea { font-size: 16px; }

  /* 模态框内联双列输入在窄屏改为单列 */
  .modal .form-row[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* 模态框 → 底部抽屉 */
  .modal-mask { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%; border-radius: 18px 18px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    max-height: 92vh;
  }
  .modal .btns { position: sticky; bottom: 0; background: #fff; padding-top: 10px; }
  .modal .btns .btn { flex: 1; justify-content: center; }

  /* Toast 全宽 */
  #toast-box { left: 16px; right: 16px; top: 12px; align-items: stretch; }
  .toast { max-width: 100%; width: 100%; }

  /* 提交/兑换卡片 */
  .sub-card { padding: 12px; }
  .sub-card .head .title { flex: 1; min-width: 0; }
  .sub-card .photo { max-height: 200px; }
  .sub-card .photo-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
  .sub-card .meta { gap: 10px; }

  /* 奖励卡片 */
  .reward-card { padding: 12px; }
  .reward-card .icon { height: 56px; font-size: 32px; }
  .ach-card .icon { height: 62px; font-size: 38px; }
  .ach-card .icon .ach-svg, .ach-card .icon .ach-img { width: 38px !important; height: 38px !important; }
  .reward-card .desc { min-height: 0; }
  .sub-card.wish .wish-ic { width: 34px; height: 34px; border-radius: 10px; margin-right: 8px; }
  .sub-card.wish .wish-ic .nav-ic { width: 18px; height: 18px; }

  /* 勋章卡片 */
  .badge-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .badge-card { padding: 12px 10px; }
  .badge-card .badge-icon { font-size: 32px; }
  .badge-card .badge-name { font-size: 14px; }
  .badge-card .medal-face { width: 84px; height: 84px; }
  .badge-card .medal-face .ach-svg,
  .badge-card .medal-face .ach-img,
  .badge-card .medal-face .reward-emoji { width: 42px !important; height: 42px !important; font-size: 42px; }
  .badge-card .medal-ribbon { width: 96px; }

  /* 儿童卡片 */
  .kid-card { padding: 14px 12px; }
  .kid-card .avatar { font-size: 34px; }
  .kid-card .name { font-size: 15px; }
  .kid-card .balance { font-size: 18px; }

  /* 惩罚横幅 */
  .penalty-banner { padding: 12px 14px; }
  .penalty-banner .icon { font-size: 24px; }

  /* 登录页 */
  .login-card { padding: 28px 20px; border-radius: 20px; }
  .login-card .logo { width: 60px; height: 60px; border-radius: 18px; }
  .login-card .logo .nav-ic { width: 32px; height: 32px; }
  .login-card h1 { font-size: 20px; }

  /* Tab 横向滑动 */
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; flex-shrink: 0; min-height: 42px; }

  /* 其他小元素 */
  .photo-thumb { width: 52px; height: 52px; }
  .approval-chip { padding: 5px 8px; font-size: 11px; }
  .streak-chip { font-size: 12px; padding: 5px 8px; }
}

/* 超窄屏 */
@media (max-width: 420px) {
  .grid-3 { grid-template-columns: 1fr; }
  .stat-card .num { font-size: 20px; }
}

/* ================= 页脚 ================= */

.footer {
  text-align: center;
  padding: 24px 16px calc(28px + env(safe-area-inset-bottom));
  margin-top: 8px;
  color: var(--text-light);
  font-size: 12px;
  line-height: 1.7;
  word-break: break-word;
}

/* 登录页等无顶部导航的页面，页脚与内容自动撑满视口 */
.login-wrap + .footer { margin-top: 0; }

/* ---------- 儿童银行 ---------- */
.bank-term {
  background: #fdf6e3; color: #b8860b; border: 1px dashed #e6c95f;
}

/* ---------- 儿童银行（拟物化存折金库） ---------- */
.bank-wrap { background: linear-gradient(160deg, #fff 0%, #f6f9f4 100%); }
.bank-hero { display: flex; gap: 22px; flex-wrap: wrap; }

/* 存折票面 */
.bankbook-sheet {
  position: relative; flex: 1 1 340px; min-width: 300px;
  background: linear-gradient(170deg, #fffef9 0%, #fbf6e8 100%);
  border: 1px solid #ecdfc0; border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 10px 30px rgba(150, 120, 40, .14), inset 0 1px 0 #fff;
}
.bankbook-sheet::before,
.bankbook-sheet::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: repeating-linear-gradient(to bottom, transparent 0 6px, #e8d9b0 6px 12px);
}
.bankbook-sheet::before { left: 8px; }
.bankbook-sheet::after { right: 8px; }
.bank-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 18px; font-weight: 900; color: #b8860b;
  letter-spacing: 1px;
}
.bank-cn { font-size: 10px; letter-spacing: 1.5px; color: #d9b96a; font-weight: 600; }
.bank-no {
  text-align: right; font-family: ui-monospace, monospace;
  font-size: 11px; color: #c9b489; margin-top: 2px;
}

/* 金库余额展示 */
.vault-display {
  position: relative; overflow: hidden;
  margin: 12px 2px 10px; border-radius: 12px;
  background: linear-gradient(160deg, #5a5f6b 0%, #3c4049 60%, #2e3138 100%);
  box-shadow: 0 4px 16px rgba(40, 45, 55, .35), inset 0 2px 8px rgba(255, 255, 255, .08);
  color: #fff; text-align: center; padding: 16px 12px;
}
.vault-display::after {
  content: ""; position: absolute; top: -40%; bottom: -40%; width: 46px; left: -70px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .12), transparent);
  transform: rotate(18deg);
  animation: vaultShine 3.4s ease-in-out infinite;
}
@keyframes vaultShine {
  0% { left: -70px; }
  60%, 100% { left: 120%; }
}
.vault-label { font-size: 12px; letter-spacing: 2px; color: #f7d24a; font-weight: 700; }
.vault-balance {
  font-size: 40px; font-weight: 900; font-variant-numeric: tabular-nums;
  margin: 4px 0 2px; text-shadow: 0 2px 12px rgba(247, 210, 74, .35);
}
.vault-balance span { font-size: 16px; font-weight: 600; color: #f7d24a; margin-left: 2px; }
.vault-meta { font-size: 12px; color: rgba(255, 255, 255, .65); }
.vault-hint { margin-top: 8px; font-size: 12px; color: #ffd24a; opacity: .95; }
.bankbook-foot {
  display: flex; justify-content: space-between;
  border-top: 2px dashed #e8d9b0; padding-top: 10px;
  font-size: 12px; color: var(--text-light);
}
.bankbook-foot b { color: #b8860b; }

/* 操作区 */
.bank-ops {
  flex: 1 1 240px; min-width: 220px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
}

/* 金币大按钮 */
.coin-btn {
  border: none; border-radius: 14px; padding: 13px 16px;
  font-size: 15px; font-weight: 800; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #ffd34d 0%, #f0b429 60%, #d99a13 100%);
  box-shadow: 0 3px 0 #a96f0a, 0 8px 20px rgba(240, 180, 41, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: all .15s;
  position: relative; overflow: hidden;
}
.coin-btn.green {
  background: linear-gradient(180deg, #43d9a3 0%, #1dbd86 60%, #0f9d6c 100%);
  box-shadow: 0 3px 0 #0b7a52, 0 8px 20px rgba(29, 189, 134, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.coin-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40px; left: -60px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: scratchSheen 2.6s ease-in-out infinite;
}
.coin-btn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.coin-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #a96f0a, inset 0 2px 6px rgba(0, 0, 0, .2);
}
.coin-btn.big { padding: 15px 18px; font-size: 17px; }
.coin-btn.big .sb-emoji { font-size: 22px; }

/* 定期利率墙 */
.rate-wall {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.rate-card {
  position: relative; text-align: center; padding: 18px 10px 14px; cursor: pointer;
  border-radius: 16px; border: 2px solid var(--rc, #e5e5e5);
  background: linear-gradient(165deg, #fff 0%, #fbfaf5 100%);
  box-shadow: inset 0 2px 6px rgba(120, 100, 60, .04);
  transition: transform .15s;
}
.rate-card:hover { transform: translateY(-3px) scale(1.02); }
.rate-card .rc-term { font-weight: 800; font-size: 15px; color: #b8860b; }
.rate-card .rc-rate {
  font-size: 26px; font-weight: 900; color: #c0392b; margin: 4px 0;
  font-variant-numeric: tabular-nums;
}
.rate-card .rc-gain { font-size: 11px; color: var(--text-light); }
.rate-card .rc-gain b { color: #0f9d6c; }
.rate-card.hot {
  border-color: #f7d24a;
  background: linear-gradient(165deg, #fffdf3 0%, #fff7dd 100%);
  animation: prizeGlow 2s ease-in-out infinite;
}
.rate-card.hot .rc-rate { animation: prizeFloat 2.4s ease-in-out infinite; }
.rate-card .rate-tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #ff5f6d, #c0392b); color: #fff;
  font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: 999px;
  box-shadow: 0 3px 8px rgba(192, 57, 43, .35); letter-spacing: 1px; white-space: nowrap;
}

/* 存单票根 */
.bank-stub {
  display: flex; align-items: stretch; gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(90deg, #f8fcf9, #fff);
  border: 1px solid #d8ecd9; border-radius: 12px;
}
.bank-stub .stub-left {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0;
}
.bank-stub .stub-no {
  font-weight: 800; color: #0f9d6c;
  font-family: ui-monospace, monospace; font-size: 13px;
}
.bank-stub .stub-meta { font-size: 12px; color: var(--text-light); }
.bank-stub .stub-perf {
  width: 1px; margin: 2px 6px;
  background: repeating-linear-gradient(to bottom, transparent 0 5px, #cfe6d4 5px 9px);
}
.bank-stub .stub-right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.bank-stub .stub-emoji { font-size: 24px; }
.bank-stub .stub-info {
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; min-width: 0;
}
.bank-stub .stub-desc { font-size: 12px; color: var(--text-light); text-align: right; }
.bank-stub .stub-seal {
  border: 2px solid; border-radius: 999px; padding: 1px 10px;
  font-size: 12px; font-weight: 800; letter-spacing: 1px; transform: rotate(-3deg);
}
.bank-stub .stub-seal.act { color: #b8860b; border-color: #b8860b; background: rgba(184, 134, 11, .06); }
.bank-stub .stub-seal.mat { color: #0f9d6c; border-color: #0f9d6c; background: rgba(15, 157, 108, .06); }
.bank-stub .stub-seal.wdr { color: #8a8f98; border-color: #c3c9d1; background: rgba(0, 0, 0, .02); }
.bank-stub .stub-act { margin-top: 2px; }

/* 快捷金额 */
.quick-amt { display: flex; gap: 8px; margin: 4px 0 12px; flex-wrap: wrap; }
.quick-amt button {
  border: 1px solid #e6c95f; background: #fdf6e3; color: #b8860b;
  border-radius: 999px; padding: 5px 14px; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: all .15s;
}
.quick-amt button:hover { background: #fbeecb; transform: translateY(-1px); }
.quick-amt button:active { transform: translateY(0); }
.fixed-preview {
  background: #fdf6e3; border: 1px dashed #e6c95f; color: #b8860b;
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 4px;
}
.fixed-preview b { font-size: 15px; }

/* 金币飞入动画 */
.coin-burst { position: fixed; inset: 0; z-index: 9999; pointer-events: none; }
.coin-burst span {
  position: absolute; font-size: 34px;
  animation: coinFly .9s ease-out forwards;
}
@keyframes coinFly {
  0% { transform: translate(0, 0) scale(.4) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.1) rotate(360deg); opacity: 0; }
}

/* ---------- 幸运彩票（拟物化刮刮乐） ---------- */
.lottery-wrap {
  background: linear-gradient(160deg, #fff 0%, #fdf6e7 100%);
}
.lottery-hero { display: flex; gap: 22px; flex-wrap: wrap; }

/* 票面 */
.ticket-sheet {
  position: relative; flex: 1 1 340px; min-width: 300px;
  background: linear-gradient(170deg, #ffffff 0%, #fdfaf1 100%);
  border: 1px solid #f0e2c0;
  border-radius: 14px;
  padding: 14px 16px 16px;
  box-shadow: 0 10px 30px rgba(190, 140, 40, .12), inset 0 1px 0 #fff;
}
.ticket-sheet::before,
.ticket-sheet::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 1px;
  background: repeating-linear-gradient(to bottom, transparent 0 6px, #e8d9b0 6px 12px);
}
.ticket-sheet::before { left: 8px; }
.ticket-sheet::after { right: 8px; }
.ticket-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 19px; font-weight: 900; color: #b8860b;
  letter-spacing: 1px;
}
.ticket-brand .nav-ic { width: 20px; height: 20px; }
.ticket-cn { font-size: 11px; letter-spacing: 2px; color: #d9b96a; font-weight: 600; }
.ticket-no {
  text-align: right; font-family: ui-monospace, monospace;
  font-size: 11px; color: #c9b489; margin-top: 2px;
}
.ticket-stage {
  margin: 12px 2px 10px; border-radius: 12px; overflow: hidden;
  box-shadow: 0 4px 16px rgba(120, 100, 60, .15);
  background: #f3e7cf;
}
.ticket-stage canvas { display: block; width: 100%; height: 150px; cursor: pointer; touch-action: none; }
.ticket-foot {
  display: flex; justify-content: space-between; align-items: center;
  border-top: 2px dashed #e8d9b0; padding-top: 10px;
}
.ticket-price b { font-size: 20px; color: #c0392b; }
.ticket-stats { font-size: 12px; color: var(--text-light); }

/* 操作区 */
.ticket-ops {
  flex: 1 1 240px; min-width: 220px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
}
.ops-title {
  font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 6px;
  color: #b8860b;
}
.ops-title .nav-ic { width: 17px; height: 17px; }
.ops-hint { font-size: 13px; color: var(--text-light); line-height: 1.5; }
.ops-hint b { color: #e67e22; }
.ops-note { font-size: 12px; color: #b9a06a; background: #fdf6e3; border-radius: 8px; padding: 8px 10px; }

/* 金币大按钮 */
.scratch-btn {
  border: none; border-radius: 14px; padding: 13px 16px;
  font-size: 15px; font-weight: 800; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: linear-gradient(180deg, #ffb347 0%, #f39c12 60%, #d68910 100%);
  box-shadow: 0 3px 0 #a9640c, 0 8px 20px rgba(243, 156, 18, .35), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: all .15s;
  position: relative; overflow: hidden;
}
.scratch-btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 40px; left: -60px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: scratchSheen 2.6s ease-in-out infinite;
}
.scratch-btn:hover { filter: brightness(1.06); transform: translateY(-2px); }
.scratch-btn:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #a9640c, inset 0 2px 6px rgba(0, 0, 0, .2);
}
.scratch-btn.big { padding: 15px 18px; font-size: 17px; }
.scratch-btn.big .sb-emoji { font-size: 22px; }
.scratch-btn .sb-price { font-size: 12px; opacity: .85; font-weight: 600; }
@keyframes scratchSheen { 0% { left: -60px; } 60%, 100% { left: 110%; } }

/* 奖池：拟物奖品墙 */
.lottery-pool {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.pool-prize {
  position: relative; text-align: center; padding: 16px 10px 12px;
  border-radius: 16px; border: 2px solid var(--lc, #e5e5e5);
  background: linear-gradient(165deg, #fff 0%, #faf9ff 100%);
  box-shadow: inset 0 2px 6px rgba(90, 70, 130, .04);
  transition: transform .15s;
}
.pool-prize:hover { transform: translateY(-3px) scale(1.02); }
.pool-prize .prize-emoji { font-size: 34px; line-height: 1; }
.pool-prize .prize-name { font-weight: 800; font-size: 14px; margin-top: 8px; }
.pool-prize .prize-meta { font-size: 13px; color: var(--lc, #8a8f98); font-weight: 700; margin-top: 3px; }
.pool-prize .prize-prob { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.pool-prize.miss { opacity: .6; filter: grayscale(.5); }
.pool-prize.hot {
  border-color: #f7d24a;
  background: linear-gradient(165deg, #fffdf3 0%, #fff7dd 100%);
  animation: prizeGlow 2s ease-in-out infinite;
}
.pool-prize.hot .prize-emoji { animation: prizeFloat 2.4s ease-in-out infinite; }
.pool-prize .prize-tag {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(180deg, #ff5f6d, #c0392b); color: #fff;
  font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: 999px;
  box-shadow: 0 3px 8px rgba(192, 57, 43, .35); letter-spacing: 1px; white-space: nowrap;
}
@keyframes prizeGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(247, 210, 74, .45); }
  50% { box-shadow: 0 0 22px 4px rgba(247, 210, 74, .5); }
}
@keyframes prizeFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

/* 票根记录 */
.ticket-stub {
  display: flex; align-items: stretch;
  padding: 12px 14px;
  background: linear-gradient(90deg, #fdfcf8, #fff);
  border: 1px solid #eee5cf; border-radius: 12px;
}
.ticket-stub .stub-left {
  flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-width: 0;
}
.ticket-stub .stub-no {
  font-weight: 800; color: var(--wc, #7c3aed);
  font-family: ui-monospace, monospace; font-size: 13px;
}
.ticket-stub .stub-meta { font-size: 12px; color: var(--text-light); }
.ticket-stub .stub-perf {
  width: 1px; margin: 2px 14px;
  background: repeating-linear-gradient(to bottom, transparent 0 5px, #e6dcc0 5px 9px);
}
.ticket-stub .stub-right { display: flex; align-items: center; gap: 10px; }
.ticket-stub .stub-emoji { font-size: 26px; }
.ticket-stub .stub-info { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ticket-stub .stub-seal {
  border: 2px solid; border-radius: 999px; padding: 1px 10px;
  font-size: 12px; font-weight: 800; letter-spacing: 1px;
}
.ticket-stub .stub-seal.won {
  color: #c0392b; border-color: #c0392b; transform: rotate(-4deg);
  background: rgba(192, 57, 43, .05);
}
.ticket-stub .stub-seal.miss { color: #b0b7c0; border-color: #c3c9d1; }
.ticket-stub .stub-desc { font-size: 12px; color: var(--text-light); text-align: right; }

/* 刮刮乐开奖弹窗 */
.scratch-modal { max-width: 740px; }
.scratch-tip { color: var(--text-light); font-size: 13px; margin: -8px 0 12px; }
.scratch-cards {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
.scratch-card {
  border: 2px solid #eee5cf; border-radius: 12px; padding: 8px;
  background: #fffdf6;
}
.scratch-card.will-win { border-color: #f7d24a; }
.scratch-card .sc-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: #c9b489; font-family: ui-monospace, monospace;
  padding: 2px 4px 6px;
}
.scratch-card .sc-stage { position: relative; border-radius: 10px; overflow: hidden; background: #f3e7cf; }
.scratch-card .sc-canvas { display: block; width: 100%; height: 120px; cursor: crosshair; touch-action: none; }
.scratch-card .sc-result {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(160deg, #fffdf3, #fff6dd);
}
.scratch-card .sc-result .sc-emoji { font-size: 30px; }
.scratch-card .sc-result .sc-text { font-size: 14px; font-weight: 800; color: #8b93a1; }
.scratch-card .sc-result .sc-text.win { color: #c0392b; font-size: 15px; }
.scratch-card.opened .sc-result .sc-text.win { animation: prizePop .5s ease; }
.scratch-summary { margin-top: 12px; min-height: 40px; }
.scratch-win-banner {
  background: linear-gradient(90deg, #fff7dd, #ffefc2);
  border: 1px solid #f2d24a; color: #b8860b; font-weight: 800; text-align: center;
  border-radius: 12px; padding: 10px; animation: prizePop .4s ease;
}
.scratch-lose-banner {
  background: #f5f6f8; color: var(--text-light); text-align: center;
  border-radius: 12px; padding: 10px; font-size: 13px;
}
@keyframes prizePop {
  0% { transform: scale(.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}

/* ---------- 儿童头像：图片 / 图标 / emoji ---------- */
.kid-avatar-img { border-radius: 50%; object-fit: cover; display: block; }
.kid-avatar-emoji { line-height: 1; }
.avatar-edit { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; flex-wrap: wrap; }
.avatar-edit-preview {
  width: 60px; height: 60px; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  border-radius: 18px; background: linear-gradient(145deg, var(--primary-light), #fff);
  box-shadow: inset 0 2px 4px rgba(90, 70, 130, .08); overflow: hidden;
}
.avatar-edit-preview img { width: 100% !important; height: 100% !important; object-fit: cover; border-radius: 14px; }

/* ---------- 设置页：定期档位动态行 & 奖池表格 ---------- */
.row-wrap { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.row-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-line input {
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg, #fff); color: var(--text);
}
.pool-wrap { overflow-x: auto; }
.pool-table { width: 100%; min-width: 440px; border-collapse: collapse; }
.pool-table th {
  text-align: left; font-size: 12px; color: var(--text-light); font-weight: 600;
  padding: 6px 4px; border-bottom: 1px solid var(--border);
}
.pool-table td { padding: 5px 4px; vertical-align: middle; }
.pool-table input,
.pool-table select {
  width: 100%; box-sizing: border-box; padding: 7px 8px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--card-bg, #fff); color: var(--text);
}
.pool-table .btn { white-space: nowrap; }

/* ================= 儿童粉色主题（body.kid-theme） ================= */
/* 主色：粉色 #ff6fa5 · 蒂芙尼蓝 #5ecfc7 · 玫瑰金 #d14d84 */

body.kid-theme {
  --primary: #ff6fa5;
  --primary-dark: #e94e8f;
  --primary-light: #ffe9f2;
  --accent: #5ecfc7;
  --accent-dark: #2aa99f;
  --bg: #faf0f7;
  --border: #f0dfec;
  --shadow: 0 4px 20px rgba(255, 111, 165, .08);
  background: linear-gradient(160deg, #fdeef6 0%, #faf0f7 45%, #ecf4fb 100%);
}

/* ---------- 通用组件 ---------- */
body.kid-theme .brand .logo,
body.kid-theme .sidebar-head .logo {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 3px 10px rgba(255, 111, 165, .35);
}
body.kid-theme .sidebar-head .sidebar-avatar {
  background: linear-gradient(135deg, #ffd9ec 0%, #eafaf9 100%);
  box-shadow: 0 3px 10px rgba(255, 111, 165, .35);
}
body.kid-theme .nav button.active,
body.kid-theme .sidebar-nav button.active { box-shadow: 0 4px 12px rgba(255, 111, 165, .35); }
body.kid-theme .btn,
body.kid-theme .tabs button.active {
  background: linear-gradient(180deg, #ff9ecb 0%, var(--primary) 55%, var(--primary-dark) 100%);
  box-shadow: 0 2px 0 rgba(178, 58, 116, .5), 0 5px 14px rgba(255, 111, 165, .25), inset 0 1px 0 rgba(255, 255, 255, .4);
}
body.kid-theme .btn:active { box-shadow: 0 1px 0 rgba(178, 58, 116, .45), inset 0 2px 5px rgba(0, 0, 0, .18); }
body.kid-theme .tabs button.active { box-shadow: 0 2px 0 rgba(178, 58, 116, .4), inset 0 1px 0 rgba(255, 255, 255, .4); }
body.kid-theme input:focus,
body.kid-theme select:focus,
body.kid-theme textarea:focus { box-shadow: inset 0 2px 4px rgba(70, 55, 110, .04), 0 0 0 3px rgba(255, 111, 165, .18); }
body.kid-theme .stat-card {
  background: linear-gradient(160deg, #fff 0%, #ffeef6 100%);
  box-shadow: inset 0 2px 6px rgba(255, 120, 170, .05), 0 2px 10px rgba(255, 111, 165, .05);
}
body.kid-theme .balance-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #ff9ecb 60%, var(--accent) 140%);
  box-shadow: 0 8px 24px rgba(255, 111, 165, .3);
}
body.kid-theme .streak-chip {
  background: linear-gradient(135deg, #ffe9f2, #ffd6e8);
  border-color: #ffb3d4;
}
body.kid-theme .streak-num { color: #e0407f; }
body.kid-theme .ach-bonus.active {
  background: linear-gradient(135deg, #ffe9f2, #ffd6e8);
  border: 1px solid #ffb3d4; color: #b23a74;
}
body.kid-theme .ach-card .icon {
  background: linear-gradient(180deg, #fff, color-mix(in srgb, var(--rc, #ff6fa5) 16%, #fff0f6));
  border: 1px solid color-mix(in srgb, var(--rc, #ff6fa5) 30%, #fff);
}
body.kid-theme .ledger-item .li-icon { background: #ffe9f2; }
body.kid-theme .ledger-item:hover { box-shadow: 0 3px 10px rgba(255, 111, 165, .08); }
body.kid-theme .reward-card .tag { background: linear-gradient(135deg, var(--accent), var(--primary)); }
body.kid-theme .reward-card.wish { box-shadow: 0 2px 12px rgba(255, 111, 165, .15); }
body.kid-theme .reward-card .cond { background: rgba(255, 111, 165, .1); }
body.kid-theme .kid-card,
body.kid-theme .sub-card { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), 0 2px 10px rgba(255, 111, 165, .06); }
body.kid-theme .kid-card:hover,
body.kid-theme .reward-card:hover { box-shadow: 0 8px 24px rgba(255, 111, 165, .14); }

/* ---------- 勋章墙 ---------- */
body.kid-theme .badge-wrap { background: linear-gradient(160deg, #fff 0%, #fdf0f7 100%); }
body.kid-theme .medal-sheet {
  background: linear-gradient(170deg, #fffbfe 0%, #fdeef6 100%);
  border-color: #f0cfe4;
  box-shadow: 0 10px 30px rgba(224, 64, 127, .14), inset 0 1px 0 #fff;
}
body.kid-theme .medal-sheet::before,
body.kid-theme .medal-sheet::after { background: repeating-linear-gradient(to bottom, transparent 0 6px, #f3c9de 6px 12px); }
body.kid-theme .badge-brand { color: #d14d84; }
body.kid-theme .badge-cn { color: #ef9dc4; }
body.kid-theme .badge-no { color: #d9a8c3; }
body.kid-theme .medalbook-foot { border-top: 1px dashed #f3c9de; }
body.kid-theme .medalbook-foot b { color: #d14d84; }
body.kid-theme .badge-card {
  background: linear-gradient(180deg, #fff 0%, #fff6fa 100%);
  box-shadow: 0 2px 8px rgba(224, 64, 127, .04), inset 0 1px 0 #fff;
}
body.kid-theme .badge-card:hover { box-shadow: 0 8px 20px rgba(224, 64, 127, .2), inset 0 1px 0 #fff; }
body.kid-theme .badge-card .medal-face {
  background: radial-gradient(circle at 32% 28%, #fff 0%, transparent 45%), radial-gradient(circle at 50% 50%, #ffd1e8 0%, #ff8fc0 55%, #e94e8f 100%);
  box-shadow: 0 3px 8px rgba(233, 78, 143, .35), inset 0 -3px 6px rgba(140, 30, 80, .25), inset 0 2px 4px rgba(255, 255, 255, .8);
  outline: 2px solid color-mix(in srgb, var(--rc, #9D9D9D) 70%, #ff8fc0);
  outline-offset: 3px;
}
body.kid-theme .badge-card .badge-icon { filter: drop-shadow(0 3px 3px rgba(140, 30, 80, .35)); }
body.kid-theme .badge-card .medal-worn {
  background: linear-gradient(180deg, #ffb3d9, #ff6fa5);
  color: #fff;
  box-shadow: 0 2px 6px rgba(255, 111, 165, .5);
}
body.kid-theme .badge-card .badge-name { color: #8e2f56; }
body.kid-theme .badge-card .badge-condition {
  color: #c05a92; background: #fff2f9; border-color: #f0a8cc;
}
body.kid-theme .badge-card .progress {
  background: #f7d9e8;
  box-shadow: inset 0 1px 3px rgba(224, 64, 127, .15);
}
body.kid-theme .badge-card .progress .bar { background: linear-gradient(90deg, #ff8fc0, #ffc4dd); }
body.kid-theme .badge-card .badge-progress { color: #d14d84; }
body.kid-theme .badge-card .redeem-btn {
  background: linear-gradient(180deg, #ffb3d9 0%, #ff6fa5 60%, #e94e8f 100%);
  color: #fff;
  box-shadow: 0 2px 0 #b23a74;
}
body.kid-theme .badge-card .redeem-btn:active { box-shadow: 0 1px 0 #b23a74; }
body.kid-theme .badge-card .badge-redeem-need,
body.kid-theme .badge-card .badge-wear { color: #d14d84; background: #fff0f7; }
body.kid-theme .badge-wear b { color: #8e2f56; }
body.kid-theme .honor-shop-card .medal-ribbon {
  background: linear-gradient(90deg, #ff8fc0, #ffc4dd, #ff8fc0);
}
body.kid-theme .honor-btn {
  background: linear-gradient(180deg, #ffb3d9 0%, #ff6fa5 60%, #e94e8f 100%);
  color: #fff;
  box-shadow: 0 2px 0 #b23a74;
}
body.kid-theme .honor-btn:active { box-shadow: 0 1px 0 #b23a74; }

/* ---------- 儿童银行 ---------- */
body.kid-theme .bank-wrap { background: linear-gradient(160deg, #fff 0%, #f3f6fb 100%); }
body.kid-theme .bankbook-sheet {
  background: linear-gradient(170deg, #fffbfe 0%, #fdeef6 100%);
  border-color: #f0cfe4;
  box-shadow: 0 10px 30px rgba(224, 64, 127, .14), inset 0 1px 0 #fff;
}
body.kid-theme .bankbook-sheet::before,
body.kid-theme .bankbook-sheet::after { background: repeating-linear-gradient(to bottom, transparent 0 6px, #f3c9de 6px 12px); }
body.kid-theme .bank-brand { color: #d14d84; }
body.kid-theme .bank-cn { color: #ef9dc4; }
body.kid-theme .bank-no { color: #d9a8c3; }
body.kid-theme .bankbook-foot { border-top: 1px dashed #f3c9de; }
body.kid-theme .bankbook-foot b { color: #d14d84; }
body.kid-theme .vault-display {
  background: linear-gradient(160deg, #4d4a70 0%, #37345a 60%, #29274a 100%);
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, .35), 0 2px 6px rgba(35, 35, 70, .35);
}
body.kid-theme .vault-label { color: #ffb3d9; }
body.kid-theme .vault-balance { text-shadow: 0 0 18px rgba(255, 179, 217, .35); }
body.kid-theme .vault-balance span { color: #ffb3d9; }
body.kid-theme .vault-hint { color: #ffb3d9; }
body.kid-theme .coin-btn {
  background: linear-gradient(180deg, #ffb3d9 0%, #ff6fa5 60%, #e94e8f 100%);
  box-shadow: 0 3px 0 #b23a74, 0 6px 16px rgba(255, 111, 165, .35), inset 0 1px 0 rgba(255, 255, 255, .4);
}
body.kid-theme .coin-btn:active { box-shadow: 0 1px 0 #b23a74, inset 0 2px 5px rgba(0, 0, 0, .2); }
body.kid-theme .coin-btn.green {
  background: linear-gradient(180deg, #6fe0d6 0%, #3fc7bd 60%, #2aa99f 100%);
  box-shadow: 0 3px 0 #1d7f77, 0 6px 16px rgba(63, 199, 189, .35), inset 0 1px 0 rgba(255, 255, 255, .4);
}
body.kid-theme .rate-card .rc-term { color: #d14d84; }
body.kid-theme .rate-card.hot {
  border-color: #ff8fc0;
  background: linear-gradient(170deg, #fff6fa 0%, #ffe3f0 100%);
  animation: kidPrizeGlow 2s ease-in-out infinite;
}
body.kid-theme .rate-card .rate-tag {
  background: linear-gradient(180deg, #ff6fa5, #e0407f);
  box-shadow: 0 2px 0 rgba(224, 64, 127, .35);
}
body.kid-theme .bank-stub {
  background: linear-gradient(170deg, #f0f9fb 0%, #fff 100%);
  border-color: #c8eef0;
}
body.kid-theme .bank-stub .stub-no { color: #2aa99f; }
body.kid-theme .bank-stub .stub-perf { background: repeating-linear-gradient(to bottom, transparent 0 5px, #c8eef0 5px 10px); }
body.kid-theme .bank-stub .stub-seal.act {
  color: #d14d84; border-color: #d14d84; background: rgba(209, 77, 132, .06);
}
body.kid-theme .bank-stub .stub-seal.mat {
  color: #2aa99f; border-color: #2aa99f; background: rgba(42, 169, 159, .06);
}
body.kid-theme .quick-amt button,
body.kid-theme .bank-term {
  background: #fff0f7; border-color: #f0a8cc; color: #d14d84;
}
body.kid-theme .quick-amt button:hover,
body.kid-theme .bank-term:hover { background: #ffe3f0; }
body.kid-theme .fixed-preview { border-color: #f0a8cc; background: #fff0f7; color: #d14d84; }

/* ---------- 幸运彩票 ---------- */
body.kid-theme .lottery-wrap { background: linear-gradient(160deg, #fff 0%, #eef7f8 100%); }
body.kid-theme .ticket-sheet {
  background: linear-gradient(170deg, #ffffff 0%, #f4fbfb 100%);
  border-color: #cde8ea;
  box-shadow: 0 10px 30px rgba(63, 199, 189, .12), inset 0 1px 0 #fff;
}
body.kid-theme .ticket-sheet::before,
body.kid-theme .ticket-sheet::after { background: repeating-linear-gradient(to bottom, transparent 0 6px, #bfe4e6 6px 12px); }
body.kid-theme .ticket-brand { color: #2aa99f; }
body.kid-theme .ticket-cn { color: #7fd4cb; }
body.kid-theme .ticket-no { color: #a9d8d3; }
body.kid-theme .ticket-stage {
  background: #e2f4f2;
  box-shadow: inset 0 2px 6px rgba(63, 199, 189, .15);
}
body.kid-theme .ticket-foot { border-top: 1px dashed #bfe4e6; }
body.kid-theme .ticket-price b { color: #e0407f; }
body.kid-theme .ops-title { color: #2aa99f; }
body.kid-theme .ops-hint b { color: #3fc7bd; }
body.kid-theme .ops-note { color: #3f8f88; background: #eef9f8; border-color: #cde8ea; }
body.kid-theme .scratch-btn {
  background: linear-gradient(180deg, #6fe0d6 0%, #3fc7bd 60%, #2aa99f 100%);
  box-shadow: 0 3px 0 #1d7f77, 0 6px 16px rgba(63, 199, 189, .35), inset 0 1px 0 rgba(255, 255, 255, .4);
}
body.kid-theme .scratch-btn:active { box-shadow: 0 1px 0 #1d7f77, inset 0 2px 5px rgba(0, 0, 0, .2); }
body.kid-theme .pool-prize.hot {
  border-color: #4fd8c4;
  background: linear-gradient(170deg, #f0fbfa 0%, #e0f6f3 100%);
  animation: kidPrizeGlow 2s ease-in-out infinite;
}
body.kid-theme .pool-prize .prize-tag {
  background: linear-gradient(180deg, #ff6fa5, #e0407f);
  box-shadow: 0 2px 0 rgba(224, 64, 127, .35);
}
body.kid-theme .ticket-stub {
  background: linear-gradient(170deg, #f4fbfa 0%, #fff 100%);
  border-color: #cde8ea;
}
body.kid-theme .ticket-stub .stub-perf { background: repeating-linear-gradient(to bottom, transparent 0 5px, #bfe4e6 5px 10px); }
body.kid-theme .ticket-stub .stub-seal.won {
  color: #e0407f; border-color: #e0407f; background: rgba(224, 64, 127, .05);
}
body.kid-theme .scratch-card {
  border-color: #e8d4e2;
  background: linear-gradient(180deg, #fff8fc 0%, #fff 100%);
}
body.kid-theme .scratch-card.will-win { border-color: #ff8fc0; }
body.kid-theme .scratch-card .sc-head { color: #d9a8c3; }
body.kid-theme .scratch-card .sc-stage { background: #fbe4ef; }
body.kid-theme .scratch-card .sc-result {
  background: linear-gradient(170deg, #fff8fc 0%, #ffe3f0 100%);
}
body.kid-theme .scratch-card .sc-result .sc-text.win { color: #e0407f; }
body.kid-theme .scratch-win-banner {
  background: linear-gradient(90deg, #ffe9f2, #ffd6e8);
  border: 1px solid #ffa6cd; color: #d14d84;
}
@keyframes kidPrizeGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 216, 196, .45); }
  50% { box-shadow: 0 0 14px 3px rgba(79, 216, 196, .5); }
}
