/* ============================================================
   新生准备清单 · 全局样式
   设计系统（Design Tokens）：
   - 主色：青绿 TEAL（清新、新生、青春），深浅模式各一套
   - 字体：系统 UI 栈；数字统一 tabular-nums（价格/进度不跳动）
   - Shape 规则（全站一致）：
       · 按钮 / 徽章 / 进度条 / chips = 全圆角 pill
       · 卡片 = 16px（--radius-card）
       · 输入框 / 下拉 / 物品行 = 12px（--radius-input）
       · 弹窗 = 20px（--radius-pop）
   - 阴影分层：card（静止）/ raised（悬浮）/ pop（toast·弹窗）
   - 图标：统一 1.75 线性 stroke 的 SVG（见 assets/js/icons.js）
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  /* 主色（青绿 teal） */
  --primary: #14b8a6;
  --primary-strong: #0d9488;
  --primary-soft: #ccfbf1;
  --primary-tint: #ecfdf9;
  --on-primary: #052e2b;

  /* 中性 */
  --bg: #f4f7f6;
  --bg-grad: radial-gradient(900px 420px at 50% -8%, #e6f7f2 0%, var(--bg) 62%);
  --card: #ffffff;
  --text: #16211f;
  --text-2: #5d6b68;
  --muted: #96a49f;
  --border: #e6eeeb;

  /* 语义色 */
  --success: #0f9d58;
  --success-soft: #e5f6ec;
  --danger: #e5484d;
  --danger-soft: #fdebeb;
  --warn: #e58b00;
  --warn-soft: #fdf3e3;

  /* 阴影（分层） */
  --shadow-card: 0 1px 2px rgba(22, 49, 43, 0.05), 0 6px 20px rgba(22, 49, 43, 0.06);
  --shadow-raised: 0 8px 28px rgba(22, 49, 43, 0.12);
  --shadow-pop: 0 24px 56px rgba(22, 49, 43, 0.20);

  /* 圆角 */
  --radius-pill: 999px;
  --radius-card: 16px;
  --radius-input: 12px;
  --radius-pop: 20px;

  /* 布局 */
  --header-h: 58px;
  --nav-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --max-w: 720px;

  /* 字体 */
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-num: "SFMono-Regular", "SF Mono", "Menlo", "Consolas", "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --primary: #2dd4bf;
  --primary-strong: #14b8a6;
  --primary-soft: #134e4a;
  --primary-tint: #0f3d3a;
  --on-primary: #062a27;

  --bg: #0e1614;
  --bg-grad: radial-gradient(900px 420px at 50% -8%, #12241f 0%, var(--bg) 62%);
  --card: #141d1b;
  --text: #e6f0ec;
  --text-2: #9fb2ab;
  --muted: #6a7d76;
  --border: #27332f;

  --success: #34d399;
  --success-soft: #123327;
  --danger: #f98080;
  --danger-soft: #3a2021;
  --warn: #f5b83d;
  --warn-soft: #382b12;

  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-raised: 0 8px 28px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 24px 56px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   基础
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button { font-family: var(--font-ui); cursor: pointer; }
input, select, textarea { font-family: var(--font-ui); font-size: 1rem; color: var(--text); }

/* 数字统一等宽数字对齐 */
.num, .ring-percent, .stat-value, .item-qty, .item-subtotal,
.chart-value, .detail-amount, .progress-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* ============================================================
   图标基础（统一线性 SVG，见 icons.js）
   尺寸统一用固定 px，避免 em 跟随父级字号漂移导致各处不一致。
   ============================================================ */
.icon {
  width: 1.1em;
  height: 1.1em;
  display: inline-block;
  flex-shrink: 0;
  vertical-align: -0.22em;
}

/* 顶部品牌标志 */
.brand-ico { width: 26px; height: 26px; color: var(--primary); display: block; }
.brand-logo { font-size: 1.6rem; }

/* 卡片标题图标 */
.card-title .icon { color: var(--primary); }
.card-ico { width: 18px; height: 18px; }

/* 底部导航图标 */
.nav-ico { width: 24px; height: 24px; }

/* 分类图标（chip / 明细 / 分组） */
.chip .chip-ico,
.cat-ico .icon,
.chip-ico,
.cat-icon { width: 15px; height: 15px; color: var(--primary); }
.chip .cat-ico { display: inline-flex; align-items: center; }

/* 搜索图标 */
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--muted); }

/* 警示 banner 图标 */
.warn-ico { width: 15px; height: 15px; vertical-align: -0.2em; }

/* 性别/恢复弹窗顶部大图标 */
.gender-hd-ico { text-align: center; margin-bottom: 10px; }
.hd-ico { width: 34px; height: 34px; color: var(--primary); }

/* 主题选项图标 */
.opt-ico .icon { width: 22px; height: 22px; color: var(--primary); }
.opt-ico { display: inline-flex; }

/* 空状态 */
.empty-ico { text-align: center; margin-bottom: 8px; }
.empty-ico-svg { width: 44px; height: 44px; color: var(--muted); }

/* ============================================================
   布局
   ============================================================ */
.app {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 16px calc(var(--nav-h) + var(--safe-bottom) + 28px);
  padding-top: calc(var(--header-h) + 20px);
}

.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: color-mix(in srgb, var(--card) 80%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  height: 100%;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand { display: flex; align-items: center; min-width: 0; }

.icon-btn {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
  color: var(--text-2);
  transition: transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn .icon { width: 20px; height: 20px; }
.icon-btn:active { transform: scale(0.92); }
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }

/* ---------- 视图切换 ---------- */
.view { animation: fadeIn 0.22s ease; }
.view[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 18px;
  margin-bottom: 14px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.1px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.muted { color: var(--text-2); font-size: 0.85rem; margin: 4px 0; line-height: 1.7; }
small { color: var(--muted); display: block; font-size: 0.75rem; }

/* ---------- 首页 ---------- */
.hero { padding: 6px 2px 16px; }
.hero h2 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 6px;
}
.hero p { color: var(--text-2); font-size: 0.95rem; }
.hero .hero-acc { display: inline-block; background: var(--primary-soft); color: var(--primary-strong); border-radius: var(--radius-pill); padding: 2px 10px; font-size: 0.72rem; font-weight: 600; margin-bottom: 10px; }

.disclaimer-banner {
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 26%, transparent);
  border-radius: var(--radius-input);
  padding: 11px 14px;
  font-size: 0.82rem;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.6;
}

/* 进度卡片 */
.progress-card {
  display: flex;
  align-items: center;
  gap: 20px;
  background:
    linear-gradient(160deg, color-mix(in srgb, var(--primary-tint) 60%, var(--card)), var(--card) 55%);
}

.ring-wrap { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.ring { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--border); stroke-width: 10; }
.ring-fg {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset 0.6s ease;
}
@media (prefers-reduced-motion: reduce) { .ring-fg { transition: none; } }

.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.ring-percent { font-size: 1.3rem; font-weight: 800; color: var(--primary); }
.ring-label { font-size: 0.7rem; color: var(--text-2); }

.progress-info { flex: 1; min-width: 0; }
.progress-num { font-size: 1.05rem; font-weight: 700; margin-bottom: 10px; }
.progress-num b { color: var(--primary); }

.progress-line {
  height: 8px;
  background: var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.progress-line.big { height: 12px; }
.progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), #14b8a6);
  border-radius: var(--radius-pill);
  transition: width 0.6s ease;
}
@media (prefers-reduced-motion: reduce) { .progress-fill { transition: none; } }

.progress-meta {
  display: flex; justify-content: space-between;
  margin-top: 12px;
  font-size: 0.85rem; color: var(--text-2);
}
.progress-meta b { color: var(--text); font-variant-numeric: tabular-nums; }

/* 迷你列表（首页"继续准备"） */
.mini-list { display: flex; flex-direction: column; gap: 8px; }
.mini-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.mini-item:hover { background: var(--primary-tint); border-color: var(--border); }
.mini-item:active { transform: scale(0.99); }
.mini-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.mini-item .mini-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.9rem; }
.mini-item .mini-cat { font-size: 0.74rem; color: var(--text-2); display: inline-flex; align-items: center; gap: 4px; }
.mini-item .mini-price { font-size: 0.85rem; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }

.empty-mini { color: var(--muted); font-size: 0.85rem; text-align: center; padding: 12px 0; }

/* 分类 chips */
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  color: var(--text-2);
  transition: all 0.15s ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary-strong); }
.chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--on-primary);
  font-weight: 600;
}
.chip.active .chip-ico { color: var(--on-primary); }
.chip:active { transform: scale(0.96); }
.chip .chip-count { font-size: 0.68rem; background: var(--border); border-radius: var(--radius-pill); padding: 0 7px; margin-left: 2px; font-variant-numeric: tabular-nums; }
.chip.active .chip-count { background: rgba(255, 255, 255, 0.25); color: var(--on-primary); }

/* 快速操作 */
.quick-actions { display: flex; flex-direction: column; gap: 10px; }

/* ============================================================
   按钮
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none;
  border-radius: var(--radius-pill);   /* 按钮一律全圆角 */
  padding: 12px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  min-height: 44px;
  transition: transform 0.12s ease, opacity 0.12s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn .icon { width: 18px; height: 18px; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--primary) 32%, transparent);
}
.btn-primary:active { background: var(--primary-strong); }

.btn-soft { background: var(--primary-soft); color: var(--primary-strong); }
.btn-soft .icon { color: var(--primary); }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-danger-soft .icon { color: var(--danger); }

.btn-block { width: 100%; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }
.btn-col { display: flex; flex-direction: column; gap: 10px; }
.btn-col .btn { width: 100%; }

/* ============================================================
   清单页工具条
   ============================================================ */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }

.search-wrap { position: relative; }
.search-input {
  width: 100%;
  padding: 12px 14px 12px 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.search-input:focus {
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.search-input::placeholder { color: var(--muted); }

.toolbar-row { display: flex; gap: 8px; }
.select {
  flex: 1;
  padding: 10px 30px 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--bg);
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
  min-height: 40px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2396a49f' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color 0.15s ease;
}
.select:focus { border-color: var(--primary); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }
.chips .chip {
  white-space: nowrap;
  flex-shrink: 0; /* 关键：避免被 flex 压缩，确保可横向滚动 */
}

.list-summary { font-size: 0.82rem; color: var(--text-2); margin-bottom: 10px; }

/* 物品分组 */
.item-group { margin-bottom: 14px; }
.item-group-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.8rem; font-weight: 700;
  color: var(--text-2);
  margin: 2px 0 8px;
  letter-spacing: 0.2px;
  text-transform: none;
}
.item-group-head .icon { color: var(--primary); width: 15px; height: 15px; }
.item-group-head .group-bar { flex: 1; height: 1px; background: var(--border); }
.item-group-head > span:last-child { font-variant-numeric: tabular-nums; }

.item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  margin-bottom: 8px;
  background: var(--card);
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.item:hover { border-color: color-mix(in srgb, var(--border) 60%, var(--primary)); }

.item.done { opacity: 0.55; }
.item.done .item-name { text-decoration: line-through; color: var(--muted); }

.item-check { width: 22px; height: 22px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }

.item-main { flex: 1; min-width: 0; }
.item-name { font-size: 0.92rem; font-weight: 600; word-break: break-word; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.item-note { font-size: 0.74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.item-nums { text-align: right; flex-shrink: 0; }
.item-qty { font-size: 0.72rem; color: var(--text-2); }
.item-subtotal { font-size: 0.92rem; font-weight: 700; }

.item-btns { display: flex; gap: 4px; flex-shrink: 0; }
.mini-btn {
  width: 34px; height: 34px;
  border: none;
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.mini-btn .icon { width: 17px; height: 17px; }
.mini-btn.edit:hover { background: var(--primary-soft); color: var(--primary-strong); }
.mini-btn.del:hover { background: var(--danger-soft); color: var(--danger); }

/* 优先级徽章 */
.badge {
  display: inline-block;
  font-size: 0.66rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  flex-shrink: 0;
  vertical-align: middle;
  letter-spacing: 0.2px;
}
.badge-must { background: var(--danger-soft); color: var(--danger); }
.badge-suggest { background: var(--primary-soft); color: var(--primary-strong); }
.badge-optional { background: var(--border); color: var(--text-2); }
.badge-school { background: var(--warn-soft); color: var(--warn); }

/* 空状态 */
.empty-state { text-align: center; padding: 34px 0; color: var(--muted); }
.empty-state p { font-size: 0.9rem; }

.sticky-actions { position: sticky; bottom: calc(var(--nav-h) + var(--safe-bottom) + 8px); z-index: 10; }

/* ============================================================
   预算页
   ============================================================ */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 14px 10px;
  text-align: center;
}
.stat-card .stat-label { font-size: 0.72rem; color: var(--text-2); display: block; }
.stat-card .stat-value { font-size: 1.1rem; font-weight: 800; margin-top: 3px; display: block; font-variant-numeric: tabular-nums; }
.stat-card.total .stat-value { color: var(--primary); }
.stat-card.done .stat-value { color: var(--success); }
.stat-card.pending .stat-value { color: var(--warn); }

.budget-progress-block { margin-top: 6px; }
.budget-progress-head { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--text-2); margin-bottom: 8px; }
.budget-progress-head #budget-percent { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }

/* 分类预算条形图 */
.chart-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.chart-label {
  width: 96px; font-size: 0.78rem; color: var(--text-2); flex-shrink: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.chart-label .cat-ico { display: inline-flex; }
.chart-track { flex: 1; height: 10px; background: var(--border); border-radius: var(--radius-pill); overflow: hidden; }
.chart-fill { height: 100%; border-radius: var(--radius-pill); transition: width 0.5s ease; }
.chart-value {
  width: 74px; text-align: right; font-size: 0.8rem; font-weight: 700;
  font-variant-numeric: tabular-nums; flex-shrink: 0;
}

/* 预算明细 */
.detail-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--border);
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.12s ease;
}
.detail-row:last-child { border-bottom: none; }
.detail-row:hover { background: var(--primary-tint); }
.detail-row .detail-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.detail-row .cat-ico { display: inline-flex; color: var(--primary); width: 20px; height: 20px; }
.detail-row .cat-ico .icon { width: 18px; height: 18px; }
.detail-row .detail-name { font-weight: 600; }
.detail-row .detail-sub { font-size: 0.72rem; color: var(--muted); }
.detail-row .detail-amount { font-weight: 700; flex-shrink: 0; font-variant-numeric: tabular-nums; }

/* 报告预览 */
#report-preview { margin-top: 12px; }
.report-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 14px;
  font-size: 0.84rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
  line-height: 1.8;
  font-family: var(--font-ui);
}

/* ============================================================
   设置页
   ============================================================ */
.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.option-item.active { border-color: var(--primary); background: var(--primary-tint); }
.option-item input[type="radio"] { accent-color: var(--primary); width: 18px; height: 18px; flex-shrink: 0; }
.option-item .option-label { font-size: 0.9rem; font-weight: 600; flex: 1; }
.option-item small { margin-top: 0; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch-row span { flex: 1; }
.switch-row b { font-size: 0.9rem; display: block; }
.switch-row small { margin-top: 2px; }
.switch { width: 46px; height: 27px; accent-color: var(--primary); flex-shrink: 0; cursor: pointer; }

/* ============================================================
   底部导航
   ============================================================ */
.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: calc(var(--nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: color-mix(in srgb, var(--card) 90%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 50;
}
.bottom-nav .nav-item {
  flex: 1;
  border: none;
  background: transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px;
  color: var(--text-2);
  font-size: 0.7rem;
  min-height: 50px;
  padding: 6px 0 4px;
  transition: color 0.15s ease;
}
.bottom-nav .nav-item .icon { color: var(--text-2); transition: color 0.15s ease; }
.bottom-nav .nav-item.active { color: var(--primary); font-weight: 700; }
.bottom-nav .nav-item.active .icon { color: var(--primary); }
.bottom-nav .nav-text { font-variant-numeric: tabular-nums; }

/* ============================================================
   弹窗
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(10, 20, 17, 0.46);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 100;
  padding: 0;
}
.modal {
  background: var(--card);
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  border-radius: var(--radius-pop) var(--radius-pop) 0 0;
  box-shadow: var(--shadow-pop);
  padding: 22px 18px calc(22px + var(--safe-bottom));
  animation: slideUp 0.24s ease;
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0.6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .modal { animation: none; } }

@media (min-width: 600px) {
  .modal-mask { align-items: center; padding: 16px; }
  .modal { border-radius: var(--radius-pop); }
}

.modal-title {
  font-size: 1.05rem; font-weight: 800; margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.modal-title .icon { color: var(--primary); width: 20px; height: 20px; }

/* 性别选择 / 恢复弹窗 */
.gender-options { display: flex; gap: 14px; margin: 20px 0 14px; }
.gender-options button { flex: 1; }
.gender-card {
  border: 2px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--card);
  padding: 22px 10px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.gender-card:hover { border-color: var(--primary); background: var(--primary-tint); transform: translateY(-2px); }
.gender-card:active { transform: scale(0.97); }
.gender-card .g-ico { width: 40px; height: 40px; }
.gender-card .gender-name { font-size: 1rem; font-weight: 700; color: var(--text); }
.gender-male .g-ico { color: var(--primary); }
.gender-female .g-ico { color: var(--danger); }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  background: var(--card);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--muted); }
.form-textarea { min-height: 64px; resize: vertical; }
.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

.form-check-row { display: flex; align-items: center; gap: 8px; font-size: 0.88rem; }
.form-check-row input[type="checkbox"] { accent-color: var(--primary); width: 18px; height: 18px; }

.form-error { color: var(--danger); font-size: 0.8rem; margin: 4px 0 0; min-height: 1em; }

.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* 分类管理列表 */
.cat-manage-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.cat-manage-item:last-child { border-bottom: none; }
.cat-manage-item .cat-info { flex: 1; min-width: 0; }
.cat-manage-item .cat-ico { display: inline-flex; color: var(--primary); }
.cat-manage-item .cat-ico .icon { width: 20px; height: 20px; }
.cat-manage-item .cat-name { font-weight: 600; font-size: 0.9rem; }
.cat-manage-item .cat-count { font-size: 0.72rem; color: var(--muted); }
.cat-manage-item .mini-btn { background: var(--bg); }

/* ============================================================
   Toast
   ============================================================ */
#toast-root {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 16px; right: 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: var(--card);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  box-shadow: var(--shadow-pop);
  animation: toastIn 0.25s ease;
  max-width: 92%;
  text-align: center;
}
.toast.success { background: var(--success); color: #ffffff; }
.toast.warn { background: var(--bg); color: var(--text); border: 1px solid var(--warn); }
.toast.error { background: var(--danger); color: #ffffff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

/* ============================================================
   打印
   ============================================================ */
#print-area { display: none; }
@media print {
  body { background: #fff !important; background-image: none !important; }
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area {
    display: block !important;
    position: absolute; left: 0; top: 0;
    width: 100%;
    padding: 20px;
    color: #000;
    font-size: 12px;
    line-height: 1.7;
  }
  #print-area .print-title { font-size: 18px; font-weight: 800; margin-bottom: 10px; }
  #print-area .print-head { color: #444; margin-bottom: 8px; }
  #print-area .print-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dotted #ccc; }
  #print-area .print-total { font-weight: 800; margin-top: 10px; }
  #print-area .print-note { color: #666; margin-top: 10px; font-size: 11px; }
}

/* ============================================================
   Toast warn 用中性底（区别于 danger/success 强背景）
   ============================================================ */

/* ============================================================
   桌面端微调
   ============================================================ */
@media (min-width: 760px) {
  .app { padding-left: 20px; padding-right: 20px; }
  .card { padding: 22px; }
  .modal { padding: 26px; }
  .item { padding: 13px 14px; }
  /* 桌面端屏幕宽，分类筛选直接换行全部显示，无需横向滑动 */
  .chips { flex-wrap: wrap; overflow-x: visible; }
}
