/* ===========================================================
   记账本 · 样式（移动端优先，桌面端居中窄栏）
   =========================================================== */

:root {
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #171a1f;
  --muted: #8b93a0;
  --line: #e8ebf0;
  --out: #e2504a;
  --in: #129d63;
  --accent: #2f6fed;
  --accent-soft: #eaf1ff;
  --radius: 14px;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.locked { overflow: hidden; }

button, input { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
.hidden { display: none !important; }

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 84px);
  position: relative;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 12px 12px;
  background: linear-gradient(180deg, #ffffff 0%, #ffffff 78%, rgba(255, 255, 255, 0) 100%);
  backdrop-filter: blur(8px);
}

.nav-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  color: var(--muted);
  flex: 0 0 auto;
  transition: background .15s;
}
.nav-btn:active { background: var(--line); }

.month-box { flex: 1; text-align: center; min-width: 0; }

.month-label {
  display: block;
  width: 100%;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 0;
}

.summary {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.summary b { font-weight: 700; font-variant-numeric: tabular-nums; }
.s-sep { margin: 0 5px; opacity: .5; }

.out { color: var(--out); }
.in  { color: var(--in); }
.neg { color: var(--out); }

/* ---------- 视图 ---------- */

.view { display: none; padding: 0 12px; }
.view.active { display: block; animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 明细 ---------- */

/* 日期只做分组小标题，不再是大白块 */
.day {
  margin-bottom: 18px;
}

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 2px 5px 9px;
  font-size: 12.5px;
  color: var(--muted);
}
.day-date { font-weight: 600; }
.day-sum { display: flex; gap: 8px; font-variant-numeric: tabular-nums; }

/* 每一笔各自一张独立卡片 */
.recs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rec {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(23, 26, 31, .05);
  transition: background .12s, transform .1s;
}
.rec:active { background: #f7f9fc; transform: scale(.995); }

.dot {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 19px;
  line-height: 1;
  background: #f0f3f8;
}

.dot.tiny {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  font-size: 13px;
}

/* ===== 一笔分成几项：外观就是一张普通卡，分项收在卡里 =====
   以前是「白卡里再套一块浅色清单」，跟旁边的单条卡完全不是一个气质。
   现在主行跟单条卡一模一样（图标 + 描述 + 徽章 + 金额），
   分项用一条虚线 + 左侧细竖线挂在下面，点「N 项」才露出来。 */
.rec.rec-group { display: block; padding: 0; }
.rec-main {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  border-radius: var(--radius);
  transition: background .12s;
}
.rec-main:active { background: #f7f9fc; }

/* 展开 / 收起的小胶囊 */
.rec-right {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}

.expand-chip {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #eef2f8;
  color: #5a6272;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.8;
  white-space: nowrap;
  transition: background .12s;
}
.expand-chip:active { background: #e1e8f3; }

.rec-items {
  margin: 0 14px 12px;
  padding: 9px 0 2px 11px;
  border-top: 1px dashed #dfe4ec;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rec-items::before {
  content: '';
  position: absolute;
  left: 1px;
  top: 12px;
  bottom: 6px;
  width: 2px;
  border-radius: 2px;
  background: #e6ebf3;
}
.rec-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 13px;
  transition: background .12s;
}
.rec-item:active { background: #f4f7fc; }
.rec-item-mid { flex: 1; min-width: 0; }
.rec-item-name {
  color: #414855;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-item-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rec-item-amt { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--muted); }
.rec-item-go { flex: 0 0 auto; color: #c6cedb; font-size: 15px; line-height: 1; }

.rec-mid { flex: 1; min-width: 0; }

/* 描述是主标题：最多两行，比原来的一行小灰字宽敞得多 */
.rec-desc {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* 没有描述时退回显示类别，主行不会空着 */
.rec-cat { font-size: 15px; font-weight: 500; }

/* 第二行：类别徽章 + 细分 / 商家 / 时间 */
.rec-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px 7px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  min-width: 0;
}
.chip {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  color: var(--c, #2f6fed);
  background: var(--bg, #eaf1ff);
  white-space: nowrap;
}
.meta-txt { color: var(--muted); }
.meta-time {
  font-variant-numeric: tabular-nums;
  color: #9aa3b2;
}
.meta-time::before { content: '🕐'; margin-right: 3px; font-size: 10px; }


.rec-amt {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 62vh;
  padding: 20px;
}
.empty-art {
  display: block;
  margin: 0 auto 14px;
  animation: floaty 3.4s ease-in-out infinite;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}
@media (prefers-reduced-motion: reduce) {
  .empty-art { animation: none; }
}
.empty-title {
  font-size: 15px;
  font-weight: 600;
  color: #4a5260;
  margin: 0 0 5px;
}
.empty-sub { font-size: 12.5px; color: var(--muted); }
.empty-sub b { color: var(--accent); font-weight: 700; }

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

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-bottom: 18px;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 10px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  box-shadow: 0 1px 2px rgba(23, 26, 31, .04);
}
.card-k { font-size: 11.5px; color: var(--muted); }
.card-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card-sub { font-size: 11px; color: var(--muted); }

.h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  margin: 18px 2px 8px;
  letter-spacing: .3px;
}

.bars {
  background: var(--card);
  border-radius: var(--radius);
  padding: 12px 14px 6px;
  box-shadow: 0 1px 2px rgba(23, 26, 31, .04);
}
.bar-item { margin-bottom: 10px; }
.bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}
.bar-name {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
}
.bar-ico { margin-right: 1px; }
.btn-ico { margin-right: 7px; }
.bar-caret {
  display: inline-block;
  font-size: 10px;
  color: #a8b1c0;
  transition: transform .18s;
}
.bar-name.open .bar-caret { transform: rotate(90deg); }

.bar-subs {
  display: none;
  margin: 6px 0 2px 21px;
  padding-left: 10px;
  border-left: 2px solid #eef1f6;
}
.bar-subs.open { display: block; }
.bar-sub {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--muted);
  padding: 3px 0;
}
.bar-sub-val { font-variant-numeric: tabular-nums; }
.bar-val { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.bar-track { height: 7px; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, #5b8bf5, var(--accent));
  transition: width .35s ease-out;
}

.muted { color: var(--muted); font-size: 13px; margin: 6px 0 12px; }

.trend-legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}
.trend-legend span { display: flex; align-items: center; gap: 5px; }
.sw { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.sw.out { background: var(--out); }
.sw.in  { background: var(--in); }

.trend-wrap {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 10px 8px;
  box-shadow: 0 1px 2px rgba(23, 26, 31, .04);
}
.trend { display: flex; gap: 6px; align-items: flex-end; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; }
.trend-bars {
  height: 92px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
}
.trend-bar { width: 9px; border-radius: 3px 3px 0 0; transition: height .3s; }
.trend-bar.out { background: var(--out); opacity: .85; }
.trend-bar.in  { background: var(--in); opacity: .85; }
.trend-col.now .trend-bar { opacity: 1; }
.trend-label { font-size: 11px; color: var(--muted); margin-top: 6px; }
.trend-label.now { color: var(--accent); font-weight: 700; }

/* ---------- 设置 ---------- */

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 4px 14px;
  box-shadow: 0 1px 2px rgba(23, 26, 31, .04);
}
.kv {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.kv:last-child { border-bottom: none; }
.kv b { font-variant-numeric: tabular-nums; }

.wide-btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 14px;
  margin-bottom: 9px;
  border-radius: 12px;
  background: var(--card);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(23, 26, 31, .04);
  transition: transform .1s, background .15s;
}
.wide-btn:active { transform: scale(.985); background: var(--accent-soft); }
.wide-btn.ghost { color: var(--text); }
.wide-btn.accent {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px rgba(47, 111, 237, .28);
}
.wide-btn.danger { color: var(--out); background: #fff6f6; }

/* 按钮下面的小字说明：解释这个按钮和旁边那个有什么区别 */
.hint {
  margin: -3px 4px 12px;
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--muted);
}
.hint b { color: #5a6272; }

.about {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 2px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f7f9fc;
}
.about-ico { font-size: 18px; line-height: 1; }
.about-text { display: flex; flex-direction: column; gap: 1px; }
.about-text b { font-size: 13px; }
.about-text span { font-size: 11.5px; color: var(--muted); }

.foot {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  margin: 22px 2px 8px;
}
.foot b { color: var(--text); }

/* ---------- 底部 tab ---------- */

.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 560px;
  height: calc(var(--tab-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  z-index: 30;
}
.tabbar button {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 500;
  transition: color .15s;
}
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button.on { color: var(--accent); font-weight: 700; }

/* ---------- 悬浮按钮 ---------- */

.fab {
  position: fixed;
  right: max(18px, calc(50% - 280px + 18px));
  bottom: calc(var(--tab-h) + var(--safe-b) + 18px);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 6px 18px rgba(47, 111, 237, .38);
  z-index: 25;
  transition: transform .12s;
}
.fab:active { transform: scale(.93); }

/* ---------- 记一笔面板 ---------- */

.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 20, 30, .42);
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: maskIn .18s ease-out;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }

.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--card);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(18px + var(--safe-b));
  max-height: 92vh;
  overflow-y: auto;
  animation: sheetUp .22s cubic-bezier(.22, .9, .3, 1);
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.sheet-title { font-size: 16px; font-weight: 700; flex: 0 0 auto; }

.seg {
  flex: 1;
  display: flex;
  background: #f0f3f8;
  border-radius: 10px;
  padding: 3px;
}
.seg button {
  flex: 1;
  padding: 7px 0;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  transition: background .15s, color .15s;
}
.seg button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(23, 26, 31, .1); }

.x {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: var(--muted);
  font-size: 15px;
  flex: 0 0 auto;
  background: #f0f3f8;
}

.sheet-top {
  display: flex;
  gap: 9px;
  margin-bottom: 12px;
}
#merchant {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fafbfd;
  font-size: 14px;
  outline: none;
}
#merchant:focus { border-color: var(--accent); background: #fff; }

.split-toggle {
  flex: 0 0 auto;
  padding: 0 16px;
  border-radius: 11px;
  background: #f2f5fa;
  color: #5a6272;
  font-size: 13.5px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.split-toggle.on { background: var(--accent); color: #fff; }

/* 整笔描述：左边固定一个 🧾，填了字以后也知道这格是干嘛的 */
.group-note-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  margin-bottom: 12px;
  border: 1.5px dashed #cdd8e8;
  border-radius: 11px;
  background: #f7faff;
  transition: border-color .15s, background .15s;
}
.group-note-wrap:focus-within { border-color: var(--accent); border-style: solid; background: #fff; }
.gn-ico { flex: 0 0 auto; font-size: 15px; line-height: 1; }
.group-note {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: none;
  background: transparent;
  font-size: 14px;
  outline: none;
}
.group-note::placeholder { color: #a8b4c6; }

.amount-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 4px 14px;
  border-bottom: 1.5px solid var(--line);
  margin-bottom: 14px;
}
.cur { font-size: 22px; font-weight: 600; color: var(--muted); }
#amount {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 34px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 0;
  min-width: 0;
}
#amount::placeholder { color: #ccd2dc; }

/* 分类面板横向分页：常用 8 个一页，剩下的左滑到第二页 */
.cat-wrap { margin-bottom: 10px; }
.cats {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  margin-bottom: 0;
}
.cats::-webkit-scrollbar { display: none; }
.cat-page {
  flex: 0 0 100%;
  scroll-snap-align: start;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: min-content;
  align-content: start;
  gap: 7px;
}

/* 只有 3~4 个分类的那一页：2 列 × 2 行大卡片，铺满同样高度，不留大白块 */
.cat-page.dense {
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: 1fr;
  align-content: stretch;
}
.cat-page.dense .cat { border-radius: 15px; }
.cat-page.dense .cat-icon { font-size: 24px; }
.cat-page.dense .cat-name { font-size: 12.5px; }
.cat-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin: 7px 0 6px;
}
.cat-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border-radius: 50%;
  background: #d6dde8;
  transition: background .15s, width .15s;
}
.cat-dot.on { width: 16px; border-radius: 3px; background: var(--accent); }
.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 2px 7px;
  border-radius: 13px;
  background: #f6f8fb;
  transition: background .13s, box-shadow .13s, transform .1s;
}
.cat:active { transform: scale(.94); }
.cat-icon { font-size: 21px; line-height: 1.2; }
.cat-name { font-size: 11.5px; color: #5a6272; font-weight: 500; }
.cat.on {
  background: var(--bg, #eaf1ff);
  box-shadow: inset 0 0 0 1.6px var(--c, #2f6fed);
}
.cat.on .cat-name { color: var(--c, #2f6fed); font-weight: 700; }

/* 算式实时结果条：整条是个按钮，点一下把结果填成金额 */
.calc-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  margin: -6px 0 10px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  text-align: left;
  box-shadow: inset 0 0 0 1px rgba(47, 111, 237, .14), 0 6px 14px -10px rgba(47, 111, 237, .6);
  transition: transform .1s, box-shadow .15s;
  animation: fade .15s ease-out;
}
.calc-bar:not(.bad):active { transform: scale(.985); box-shadow: inset 0 2px 4px rgba(47, 111, 237, .18); }
.calc-expr { color: #6b7a90; font-variant-numeric: tabular-nums; }
.calc-eq { opacity: .55; }
.calc-result {
  margin-left: auto;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.calc-use {
  flex: 0 0 auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 1px 4px rgba(47, 111, 237, .22);
}
.calc-bar.bad { background: #fff2f2; color: var(--out); }
.calc-bar.bad .calc-expr { color: var(--out); opacity: .7; }
.calc-bar.bad .calc-result { font-size: 12.5px; font-weight: 600; }
.calc-bar.bad .calc-use { display: none; }

/* 取用结果时金额框轻轻一跳，给个"填进去了"的反馈 */
@keyframes amtPop { 0% { transform: scale(1); } 40% { transform: scale(1.05); color: var(--accent); } 100% { transform: scale(1); } }
#amount.pop { animation: amtPop .34s ease-out; display: inline-block; }

/* 手机数字键盘没有乘除号，补一排运算符 */
.calc-pad {
  display: flex;
  gap: 6px;
  margin: -4px 0 12px;
}
.calc-pad .op {
  flex: 1;
  height: 36px;
  border-radius: 10px;
  background: #f2f5fa;
  color: #4a5260;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  transition: background .12s, transform .1s;
}
.calc-pad .op:active { background: #e3eaf5; transform: scale(.93); }
.calc-pad .back { color: #8b93a0; font-size: 14px; }

.subs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 14px;
  padding-top: 2px;
}
.sub {
  padding: 7px 15px;
  border-radius: 999px;
  background: #f2f5fa;
  font-size: 12.5px;
  color: #5a6272;
  font-weight: 500;
  transition: background .13s, color .13s, transform .1s;
}
.sub:active { transform: scale(.95); }
.sub.on {
  background: var(--c, #2f6fed);
  color: #fff;
  font-weight: 700;
}

/* 「改细分」胶囊：虚线无底色 —— 一眼看出它不是选项，而是入口 */
.sub-edit {
  background: transparent;
  border: 1.5px dashed #c9d4e4;
  color: #6b7a90;
  font-weight: 600;
  padding: 6px 12px;
  transition: background .13s, border-color .13s, color .13s, transform .1s;
}
.sub-edit:active {
  background: #eef4ff;
  border-color: var(--c, #2f6fed);
  color: var(--c, #2f6fed);
  transform: scale(.95);
}
.subs-empty {
  font-size: 12.5px;
  color: #9aa4b4;
  align-self: center;
  margin-right: 2px;
}

/* ---------- 二级细分管理弹层 ---------- */

.sub-card { max-width: 420px; }

.sub-tip {
  margin: -2px 0 12px;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.sub-tag-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 12px; }

.sub-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border-radius: 12px;
  background: #f5f8fd;
  border: 1px solid #e6edf7;
  animation: tagIn .16s ease-out;
}
@keyframes tagIn { from { transform: translateY(-3px); opacity: 0; } to { transform: none; opacity: 1; } }

.sub-tag-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sub-tag-use {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--muted);
  background: #eaeff7;
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}
.sub-tag-del {
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #eaeef5;
  color: #8b93a0;
  font-size: 12px;
  display: grid;
  place-items: center;
  transition: background .12s, color .12s, transform .1s;
}
.sub-tag-del:active { background: #ffe4e4; color: var(--out); transform: scale(.88); }

.sub-tag-empty {
  margin: 0;
  padding: 15px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  background: #f7f9fc;
  border: 1.5px dashed #d8e1ee;
  border-radius: 12px;
}

.sub-add { display: flex; gap: 8px; margin-bottom: 13px; }
#subInput {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fafbfd;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
}
#subInput:focus { border-color: var(--c, var(--accent)); background: #fff; }
#subInput::placeholder { color: #a8b4c6; }

.sub-add-btn {
  flex: 0 0 auto;
  padding: 0 18px;
  border-radius: 12px;
  background: var(--c, var(--accent));
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 12px -5px rgba(47, 111, 237, .65);
  transition: transform .1s;
}
.sub-add-btn:active { transform: scale(.94); }

.sub-foot { display: flex; align-items: center; gap: 9px; }
.sub-foot .pk-chip { flex: 0 0 auto; margin: 0; }
.sub-done {
  flex: 1;
  padding: 13px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 6px 16px -7px rgba(47, 111, 237, .7);
  transition: transform .1s;
}
.sub-done:active { transform: scale(.985); }

/* ---------- 挑分类改细分（设置页入口） ---------- */

.adm-card { max-width: 420px; }
.adm-list { display: flex; flex-direction: column; gap: 15px; }
.adm-group-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
  margin-bottom: 7px;
}
.adm-cat {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  text-align: left;
  padding: 9px 12px 9px 10px;
  margin-bottom: 7px;
  border-radius: 13px;
  background: var(--card);
  border: 1px solid var(--line);
  transition: background .12s, border-color .12s, transform .1s;
}
.adm-cat:last-child { margin-bottom: 0; }
.adm-cat:active { transform: scale(.985); background: #f6f9fd; border-color: #cfe0fb; }
.adm-cat-ico {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: var(--catbg, #f0f3f8);
  font-size: 16px;
  line-height: 1;
}
.adm-cat-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.adm-cat-name { font-size: 14.5px; font-weight: 700; }
.adm-cat-sub { font-size: 11.5px; color: var(--muted); }
.adm-cat-go { flex: 0 0 auto; color: #c2cad8; font-size: 17px; }

.cart {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px dashed #d6dee9;
  border-radius: 12px;
  background: #fbfcfe;
}
.cart-head {
  font-size: 12.5px;
  font-weight: 600;
  color: #6b7a90;
  margin-bottom: 8px;
}
.cart-list { display: flex; flex-direction: column; gap: 7px; }
.cart-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
}
.cart-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cart-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.cart-del {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef1f6;
  color: #8b93a0;
  font-size: 11px;
  display: grid;
  place-items: center;
}
.cart-sum {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid #e8ebf0;
  font-size: 13px;
  color: var(--muted);
}
.cart-total { font-size: 17px; color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- 日期 / 时间触发器（点开是自定义选择器） ---------- */

.form-row {
  display: grid;
  /* 日期文字比 "22:44" 长，多分一点宽度，值就不用挤 */
  grid-template-columns: 1.4fr 1fr;
  gap: 9px;
  margin-bottom: 9px;
}

.pick-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 9px 10px;
  border: 1.5px solid var(--line);
  border-radius: 13px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  box-shadow: 0 1px 2px rgba(23, 26, 31, .04), 0 6px 14px -10px rgba(23, 26, 31, .28);
  text-align: left;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.pick-btn:active {
  transform: scale(.975);
  background: #f7f9fd;
  box-shadow: 0 1px 2px rgba(23, 26, 31, .05) inset;
}
.pick-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.pick-ico {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-size: 15px;
  border-radius: 9px;
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 237, .12);
}
.pick-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.pick-k { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; }
.pick-v {
  font-size: 14.5px;
  letter-spacing: -.01em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pick-caret { flex: 0 0 auto; margin-left: auto; font-size: 10px; color: #b3bbc8; }

/* 描述（原「备注」）单独占一行，比原来宽 */
.desc-input {
  width: 100%;
  padding: 13px 12px;
  margin-bottom: 14px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fafbfd;
  font-size: 15px;
  outline: none;
}
.desc-input:focus { border-color: var(--accent); background: #fff; }
.desc-input::placeholder { color: #b3bbc8; }

.primary {
  width: 100%;
  padding: 15px;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 9px;
  box-shadow: 0 4px 14px rgba(47, 111, 237, .3);
  transition: transform .1s;
}
.primary:active { transform: scale(.985); }

/* ---------- 日期 / 时间选择器弹层 ---------- */

.picker-mask {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(12, 18, 28, .46);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: maskIn .16s ease-out;
}

.picker-card {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 24px);
  padding: 18px 18px 16px;
  border-radius: 24px;
  background: var(--card);
  /* 三层阴影：贴地的实影 + 散开的柔影 + 顶部内高光，卡片才"浮"得起来 */
  box-shadow:
    0 34px 68px -24px rgba(12, 20, 38, .52),
    0 14px 28px -14px rgba(12, 20, 38, .3),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  animation: cardIn .22s cubic-bezier(.2, .9, .3, 1);
  overflow-x: hidden;
  overflow-y: auto;
}
/* 卡片上沿一条彩色光带 */
.picker-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: linear-gradient(90deg, #6ea8ff, #2f6fed 42%, #8b6cf7 76%, #46c6a6);
}
@keyframes cardIn {
  from { transform: translateY(16px) scale(.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.pk-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; }
.pk-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pk-emoji { font-size: 17px; }
.pk-head .x { margin-left: auto; box-shadow: 0 1px 2px rgba(23, 26, 31, .06); }

/* 月份导航 */
.cal-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-bottom: 9px;
  padding: 4px;
  border-radius: 14px;
  background: #f4f7fc;
  box-shadow: inset 0 1px 2px rgba(23, 26, 31, .06);
}
.cal-title {
  flex: 1;
  text-align: center;
  font-size: 14.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.cal-step {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  color: #5a6272;
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
  transition: background .12s, transform .1s;
}
.cal-step:active { background: #e5ecfa; transform: scale(.9); }

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 5px;
}
.cal-week span {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.cal-week .wk { color: #dd7a75; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  margin-bottom: 13px;
}

/* 注意：这个类名必须叫 .cal-day。
   以前叫 .day，跟明细页的日期分组容器 .day（见第 110 行）撞名，
   结果每个日期分组被压成 38px 高，列表里的卡片全叠在一起。 */
.cal-day {
  position: relative;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 14.5px;
  font-weight: 600;
  color: #333b48;
  font-variant-numeric: tabular-nums;
  transition: background .12s, color .12s, transform .08s, box-shadow .15s;
}
.cal-day:active { transform: scale(.9); background: #eef2fa; }
.cal-day.we { color: #d4645f; }
.cal-day.out { color: #c9d0da; font-weight: 500; }
.cal-day.out.we { color: #e2c3c1; }
/* 今天：淡淡的圈 */
.cal-day.today { color: var(--accent); box-shadow: inset 0 0 0 1.5px rgba(47, 111, 237, .5); }
.cal-day.today::after {
  content: '';
  position: absolute;
  bottom: 5px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--accent);
}
/* 选中的那天：蓝紫渐变 + 投影，一眼看出选的是哪天 */
.cal-day.sel,
.cal-day.sel.we,
.cal-day.sel.out {
  color: #fff;
  font-weight: 700;
  background: linear-gradient(155deg, #6a9bff 0%, #2f6fed 55%, #2a58c9 100%);
  box-shadow: 0 9px 18px -7px rgba(47, 111, 237, .85), inset 0 1px 0 rgba(255, 255, 255, .4);
  transform: translateY(-1px);
}
.cal-day.sel::after { display: none; }  /* 选中日已经是蓝底，再点个白点像句号 */

/* 快捷选项 */
.pk-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: center;
}
.pk-chip {
  padding: 7px 8px;
  border-radius: 999px;
  background: #f2f5fa;
  color: #5a6272;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(23, 26, 31, .06);
  transition: background .12s, transform .1s;
}
.pk-chip:active { background: #e5ecfa; transform: scale(.94); }

/* ---------- 时间滚轮 ---------- */

.time-card { max-width: 400px; }
/* 日期读数：跟时间卡片的 22:44 一个位置，一眼看到"要确认的是哪天" */
.date-readout {
  text-align: center;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  margin: -2px 0 11px;
}
.time-readout {
  text-align: center;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  margin: 0 0 2px;
  text-shadow: 0 6px 18px rgba(47, 111, 237, .22);
}
.wheels {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  margin-bottom: 13px;
}
.wheel-wrap { position: relative; flex: 0 0 108px; height: 230px; }
/* 中间那条"选中带" */
.wheel-band {
  position: absolute;
  left: 0;
  right: 0;
  top: 92px;
  height: 46px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(47, 111, 237, .1), rgba(47, 111, 237, .045));
  box-shadow: inset 0 0 0 1.5px rgba(47, 111, 237, .26), 0 8px 18px -10px rgba(47, 111, 237, .6);
  pointer-events: none;
}
.wheel {
  position: relative;
  height: 230px;
  padding: 92px 0;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain; /* 滚到尽头别带着后面的面板一起滚 */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  outline: none;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 26%, #000 74%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 26%, #000 74%, transparent 100%);
}
.wheel::-webkit-scrollbar { display: none; }
.wheel-item {
  height: 46px;
  display: grid;
  place-items: center;
  scroll-snap-align: center;
  font-size: 19px;
  font-weight: 600;
  color: #b7bec9;
  font-variant-numeric: tabular-nums;
  transition: color .15s, font-size .15s;
}
.wheel-item.sel { color: var(--text); font-size: 22px; font-weight: 800; }
.wheel-colon {
  font-size: 22px;
  font-weight: 700;
  color: #c2c9d4;
  transform: translateY(-1px);
}
.time-quick { margin-bottom: 4px; }
.picker-card .primary { margin: 14px 0 0; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tab-h) + var(--safe-b) + 30px);
  transform: translate(-50%, 12px);
  background: rgba(23, 26, 31, .92);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 18px;
  border-radius: 22px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 90;
  max-width: 84vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 优惠 / 原价 ---------- */

.disc-row { margin: 0 0 12px; }

.disc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: #f2f5fa;
  color: #6b7a90;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px dashed transparent;
  transition: background .13s, color .13s, border-color .13s, transform .1s;
}
.disc-toggle:active { transform: scale(.95); }
.disc-toggle.on {
  background: #fff4e6;
  color: #b4712a;
  border-color: #f0c48a;
}
.dt-ico { font-size: 13px; line-height: 1; }

.disc-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #fffaf2;
  border: 1.5px solid #f4d9b4;
}
.disc-k { flex: 0 0 auto; font-size: 12px; color: #a97833; font-weight: 600; }
#original {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border: 1.5px solid #ecd2ae;
  border-radius: 9px;
  background: #fff;
  font-size: 15px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  outline: none;
}
#original:focus { border-color: #d99b4e; }
#original::placeholder { font-weight: 400; color: #c4b09a; }
.disc-saved {
  flex: 0 0 auto;
  font-size: 12.5px;
  font-weight: 700;
  color: #129d63;
  font-variant-numeric: tabular-nums;
}
.disc-saved.bad { color: var(--out); font-weight: 600; }

/* 明细里的小标记：省了多少 */
.save-tag {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  color: #129d63;
  background: #e7f7ef;
  border-radius: 999px;
  padding: 1px 7px;
  font-variant-numeric: tabular-nums;
}

/* 统计页：本月省下的钱 */
.saved-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -8px 0 6px;
  padding: 11px 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #eafaf1 0%, #e6f7f0 100%);
  box-shadow: inset 0 0 0 1px #cdeede;
}
.sb-ico { font-size: 17px; line-height: 1; }
.sb-mid { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.sb-val { font-size: 17px; font-weight: 800; color: #0f7f52; font-variant-numeric: tabular-nums; }
.sb-txt { font-size: 11.5px; color: #4b8a6f; }
.sb-count { font-size: 11px; color: #6aa389; flex: 0 0 auto; }

/* 统计页：常买的东西均价 */
.avg-list {
  background: var(--card);
  border-radius: var(--radius);
  padding: 4px 14px;
  box-shadow: 0 1px 2px rgba(23, 26, 31, .04);
}
.avg-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.avg-row:last-child { border-bottom: none; }
.avg-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.avg-mid { flex: 0 0 auto; font-size: 11.5px; color: var(--muted); }
.avg-val { flex: 0 0 auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.avg-range { flex: 0 0 auto; font-size: 10.5px; color: #a9b3c2; font-variant-numeric: tabular-nums; }

/* ---------- 一级分类管理 ---------- */

.cm-card { max-width: 440px; }
.cm-seg { margin-bottom: 10px; }

.cm-list {
  display: flex;
  flex-direction: column;
  max-height: 42vh;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 2px;
}
.cm-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--line);
}
.cm-row:last-child { border-bottom: none; }
.cm-ico {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 16px;
  line-height: 1;
}
.cm-mid { flex: 1; min-width: 0; }
.cm-name-line { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cm-name { font-size: 14.5px; font-weight: 700; }
.cm-tag {
  font-size: 9.5px;
  font-weight: 700;
  color: #2a6bd9;
  background: #e9f0fd;
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: .02em;
}
.cm-tag.rare { color: #8a6d1f; background: #fbf3e1; }
.cm-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.cm-acts { flex: 0 0 auto; display: flex; gap: 5px; }
.cm-btn {
  padding: 6px 10px;
  border-radius: 9px;
  background: #f2f5fa;
  color: #5a6272;
  font-size: 12px;
  font-weight: 600;
  transition: background .12s, color .12s, transform .1s;
}
.cm-btn:active { transform: scale(.93); background: #e5ecfa; }
.cm-btn.danger { color: var(--out); background: #fff3f3; }
.cm-btn.danger:active { background: #ffe6e6; }

.cm-add { margin-bottom: 8px; }
.cm-reset { width: 100%; padding: 9px; font-size: 12.5px; }

/* ---------- 新建分类表单 ---------- */

.cat-preview {
  --c: #76829A;
  --bg: #EDF0F5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 15px 10px;
  margin-bottom: 14px;
  border-radius: 16px;
  background: var(--bg);
  box-shadow: inset 0 0 0 1.6px var(--c);
}
.cat-preview .cat-icon { font-size: 26px; }
.cat-preview .cat-name { color: var(--c); font-weight: 700; font-size: 13px; }

.cf-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  margin: 0 2px 6px;
  letter-spacing: .03em;
}
.cf-input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: #fafbfd;
  font-size: 15px;
  font-weight: 600;
  outline: none;
}
.cf-input:focus { border-color: var(--accent); background: #fff; }
.cf-input:disabled { background: #f2f4f8; color: var(--muted); }
.cf-hint { margin: 5px 2px 14px; }
.cf-hint.bad { color: var(--out); }

.ico-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.ico-pick {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #f4f7fc;
  font-size: 18px;
  line-height: 1;
  transition: background .12s, transform .1s;
}
.ico-pick:active { transform: scale(.9); }
.ico-pick.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1.8px var(--accent); }

.col-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.col-pick {
  aspect-ratio: 1;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px #fff, 0 1px 3px rgba(23, 26, 31, .12);
  transition: transform .1s;
}
.col-pick:active { transform: scale(.9); }
.col-pick.on {
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 2.5px rgba(23, 26, 31, .45), 0 2px 5px rgba(23, 26, 31, .18);
}

.cf-check {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  margin-bottom: 14px;
  border-radius: 12px;
  background: #f7f9fc;
  font-size: 12.5px;
  color: #5a6272;
}
.cf-check input { width: 17px; height: 17px; accent-color: var(--accent); flex: 0 0 auto; }

/* ---------- 桌面端微调 ---------- */

@media (min-width: 600px) {
  .app { box-shadow: 0 0 0 1px var(--line); }
  .fab { right: calc(50% - 280px + 18px); }
}

/* 窄屏（老机型 / 分屏）下把两个选择按钮收一点，日期值不省略 */
@media (max-width: 360px) {
  .pick-btn { gap: 6px; padding: 8px 8px; }
  .pick-ico { width: 26px; height: 26px; font-size: 13px; }
  .pick-caret { display: none; }
  .pick-v { font-size: 13px; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --card: #1c1f25;
    --text: #e9ecf2;
    --muted: #8b94a3;
    --line: #2a2f38;
    --accent-soft: #1e2c4a;
  }
  .topbar { background: linear-gradient(180deg, #14161a 0%, #14161a 78%, rgba(20, 22, 26, 0) 100%); }
  .tabbar { background: rgba(28, 31, 37, .94); }
  .rec:active { background: #23272f; }
  .bar-track, .trend-wrap, .cats .cat, .seg, .x, .form-row input { background: #23272f; }
  .seg button.on { background: #313742; }
  .form-row input { background: #23272f; }
  .wide-btn { background: var(--card); }
  .wide-btn.danger { background: #2a1c1e; }
  .hint b { color: #a8b1c0; }
  .dot { background: #262b34; }
  .cat-name { color: #a8b1c0; }
  .sub { background: #262b34; color: #a8b1c0; }
  #merchant { background: #23272f; }
  .split-toggle { background: #23272f; color: #a8b1c0; }
  .cart { background: #1f232b; border-color: #333a45; }
  .cart-del { background: #2c323c; }
  .cart-sum { border-top-color: #2a2f38; }
  .rec-main:active { background: #23272f; }
  .rec-items { border-top-color: #2a2f38; }
  .rec-items::before { background: #2f3540; }
  .rec-item:active { background: #23272f; }
  .rec-item-name { color: #cdd4e0; }
  .expand-chip { background: #262b34; color: #a8b1c0; }
  .expand-chip:active { background: #313742; }
  .calc-bar { background: #1e2c4a; }
  .calc-bar.bad { background: #3a2224; }
  .calc-expr { color: #9fb0c9; }
  .calc-pad .op { background: #262b34; color: #cdd4e0; }
  .calc-pad .op:active { background: #313742; }
  .calc-pad .back { color: #8b94a3; }
  .cat-dot { background: #39404c; }
  .desc-input { background: #23272f; }
  .desc-input::placeholder { color: #5a6272; }
  .bar-subs { border-left-color: #2a2f38; }
  .empty-title { color: #cdd4e0; }
  .about { background: #23272f; }
  .empty-art { opacity: .82; }
  #amount::placeholder { color: #3d4450; }

  /* 日期 / 时间选择器 */
  .pick-btn { background: #23272f; border-color: #2f3540; box-shadow: 0 6px 14px -10px rgba(0, 0, 0, .8); }
  .pick-btn:active { background: #262b34; }
  .pick-ico { background: #26304a; box-shadow: inset 0 0 0 1px rgba(110, 168, 255, .18); }
  .pick-caret { color: #5a6272; }
  .picker-mask { background: rgba(4, 7, 12, .62); }
  .picker-card {
    box-shadow:
      0 34px 68px -24px rgba(0, 0, 0, .85),
      0 14px 28px -14px rgba(0, 0, 0, .6),
      inset 0 1px 0 rgba(255, 255, 255, .07);
  }
  .cal-nav { background: #23272f; }
  .cal-step { color: #a8b1c0; }
  .cal-step:active { background: #2c333e; }
  .cal-day { color: #d4dae4; }
  .cal-day:active { background: #262b34; }
  .cal-day.out { color: #555d6b; }
  .cal-day.out.we { color: #6b5153; }
  .cal-day.we { color: #e08d88; }
  .cal-week .wk { color: #c1746f; }
  .pk-chip { background: #23272f; color: #a8b1c0; }
  .pk-chip:active { background: #2c333e; }

  /* 二级细分管理 */
  .sub-edit { border-color: #39404c; color: #a8b1c0; }
  .sub-edit:active { background: #26304a; color: #9fb8ef; }
  .subs-empty { color: #6b7482; }
  .sub-tag { background: #23272f; border-color: #2f3540; }
  .sub-tag-use { background: #2c323c; }
  .sub-tag-del { background: #2c323c; }
  .sub-tag-del:active { background: #3a2224; }
  .sub-tag-empty { background: #23272f; border-color: #333a45; }
  #subInput { background: #23272f; }
  #subInput:focus { background: #262b34; }
  #subInput::placeholder { color: #5a6272; }
  .adm-cat { background: #23272f; border-color: #2f3540; }
  .adm-cat:active { background: #262b34; border-color: #3a4a68; }
  .adm-cat-go { color: #4a5260; }

  /* 优惠 / 原价 */
  .disc-toggle { background: #262b34; color: #a8b1c0; }
  .disc-toggle.on { background: #3a2e1e; color: #e0b071; border-color: #5a4526; }
  .disc-wrap { background: #2a2418; border-color: #4a3a22; }
  .disc-k { color: #c39a5f; }
  #original { background: #23272f; border-color: #4a3a22; color: var(--text); }
  #original::placeholder { color: #6b6152; }
  .disc-saved { color: #4ecf95; }
  .save-tag { color: #4ecf95; background: #1c3b2c; }

  /* 统计页 */
  .saved-bar { background: linear-gradient(135deg, #17332a 0%, #143028 100%); box-shadow: inset 0 0 0 1px #2b5240; }
  .sb-val { color: #4ecf95; }
  .sb-txt { color: #7fb59b; }
  .sb-count { color: #5f9079; }
  .avg-range { color: #5d6675; }

  /* 一级分类管理 */
  .cm-row { border-bottom-color: #2a2f38; }
  .cm-btn { background: #262b34; color: #a8b1c0; }
  .cm-btn:active { background: #313742; }
  .cm-btn.danger { background: #2f1d1f; }
  .cm-tag { color: #8fb4f5; background: #1e2c4a; }
  .cm-tag.rare { color: #d8b96a; background: #332a16; }
  .cf-input { background: #23272f; }
  .cf-input:focus { background: #262b34; }
  .cf-input:disabled { background: #262b34; }
  .ico-pick { background: #262b34; }
  .ico-pick.on { background: #1e2c4a; }
  /* 预览卡跟深色下的分类格子保持一致（浅色底色在深色里会跳出来） */
  .cat-preview { background: #262b34; }
  .col-pick { box-shadow: inset 0 0 0 2px #1c1f25, 0 1px 3px rgba(0, 0, 0, .5); }
  .col-pick.on { box-shadow: inset 0 0 0 2px #1c1f25, 0 0 0 2.5px rgba(233, 236, 242, .7); }
  .cf-check { background: #23272f; color: #a8b1c0; }
  .cf-input::placeholder { color: #5a6272; }
  .calc-use { background: #2b3a5c; color: #b9d0ff; box-shadow: none; }
  .wheel-band { background: rgba(47, 111, 237, .16); }
  .wheel-item { color: #5c6472; }
  .wheel-item.sel { color: #e9ecf2; }
  .wheel-colon { color: #4a5260; }
  .date-readout { color: #7aa6ff; }
}
