/* 账本管家 · 移动端样式 */
:root {
  --exp: #f45a52;
  --inc: #2fa97a;
  --ink: #1f2937;
  --muted: #9aa3b2;
  --line: #edf0f5;
  --bg: #f5f6fa;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[v-cloak] { display: none; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px;
  max-width: 640px; margin: 0 auto; padding-bottom: 72px;
}
button { border: none; background: none; font-family: inherit; cursor: pointer; color: inherit; }
input, select { font-family: inherit; }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.c-exp { color: var(--exp); }
.c-inc { color: var(--inc); }
.spacer { flex: 1; }
.emoji { font-style: normal; }

/* ---------- 顶部 ---------- */
.m-header {
  background: linear-gradient(135deg, #3b6ef6, #5b8cff);
  color: #fff; padding: 16px 18px 18px; border-radius: 0 0 20px 20px;
  position: sticky; top: 0; z-index: 30;
}
.month-switch { display: flex; align-items: center; justify-content: center; gap: 18px; font-size: 16px; }
.month-switch a { font-size: 22px; line-height: 1; opacity: .85; padding: 0 8px; }
.month-sum { display: flex; margin-top: 14px; }
.ms { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.ms span { font-size: 12px; opacity: .82; }
.ms b { font-size: 18px; letter-spacing: -.3px; }
.ms b.c-exp { color: #ffe1df; }
.ms b.c-inc { color: #d6f7e8; }

/* ---------- 主体 ---------- */
.m-body { padding: 14px 14px 20px; }

.kind-switch { display: flex; background: #e9edf5; border-radius: 10px; padding: 4px; margin-bottom: 14px; }
.kind-switch button { flex: 1; padding: 10px 0; border-radius: 8px; font-size: 16px; font-weight: 600; color: #74809a; }
.kind-switch button.on { background: #fff; box-shadow: 0 2px 8px rgba(30,50,100,.1); color: var(--ink); }
.kind-switch button.on:first-child { color: var(--exp); }
.kind-switch button.on:last-child { color: var(--inc); }

.amount-box {
  background: #fff; border-radius: 14px; padding: 20px 18px;
  display: flex; align-items: baseline; gap: 6px; margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(20,40,90,.05);
}
.amount-box .cny { font-size: 26px; font-weight: 700; }
.amount-input {
  flex: 1; border: none; outline: none; font-size: 40px; font-weight: 700;
  width: 100%; color: var(--ink); background: transparent;
}

.cat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px;
}
.cat-grid button {
  background: #fff; border-radius: 13px; padding: 12px 4px 10px; font-size: 13px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  color: #5a6478; box-shadow: 0 2px 10px rgba(20,40,90,.04);
  border: 2px solid transparent;
}
.cat-grid button .emoji { font-size: 23px; }
.cat-grid button.on { border-color: var(--primary, #3b6ef6); color: #3b6ef6; background: #f2f6ff; font-weight: 600; }

.sub-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 10px; margin-bottom: 6px; }
.sub-row button {
  flex-shrink: 0; background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 7px 14px; font-size: 13px; color: #5a6478;
}
.sub-row button.on { background: #3b6ef6; border-color: #3b6ef6; color: #fff; }

.quick-row { display: flex; gap: 8px; margin: 8px 0; }
.quick-row label {
  flex: 1; background: #fff; border-radius: 10px; padding: 8px 10px;
  font-size: 12px; color: var(--muted); display: flex; flex-direction: column; gap: 2px;
}
.mini-input { border: none; outline: none; font-size: 14px; color: var(--ink); background: transparent; width: 100%; }
.note-input {
  width: 100%; border: none; background: #fff; border-radius: 12px;
  padding: 14px 16px; font-size: 15px; outline: none; margin-bottom: 16px;
  box-shadow: 0 2px 12px rgba(20,40,90,.05);
}
.btn-save {
  width: 100%; padding: 15px 0; border-radius: 14px; font-size: 17px; font-weight: 700;
  color: #fff; background: var(--exp); box-shadow: 0 8px 20px rgba(244,90,82,.3);
}
.btn-save.income { background: var(--inc); box-shadow: 0 8px 20px rgba(47,169,122,.3); }

/* ---------- 明细 ---------- */
.day-group { margin-bottom: 14px; }
.day-head {
  display: flex; align-items: center; gap: 8px; padding: 6px 4px 8px; font-size: 13px; color: #475066;
}
.tx-row {
  background: #fff; border-radius: 12px; padding: 13px 14px; display: flex; align-items: center; gap: 12px;
  margin-bottom: 8px; box-shadow: 0 1px 8px rgba(20,40,90,.04);
}
.tx-row .emoji {
  width: 40px; height: 40px; border-radius: 11px; background: #f1f4fb;
  display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0;
}
.tx-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.tx-main b { font-size: 15px; }
.tx-main span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-amt { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.tx-amt b { font-size: 16px; }
.load-more { text-align: center; padding: 16px; }
.load-more button { color: #3b6ef6; font-size: 14px; }

/* ---------- 统计 ---------- */
.card-mini {
  background: #fff; border-radius: 14px; padding: 16px; margin-bottom: 14px;
  box-shadow: 0 2px 12px rgba(20,40,90,.05);
}
.block-title { display: block; margin-bottom: 12px; font-size: 15px; }
.seg2 { display: flex; background: #eef1f7; border-radius: 9px; padding: 3px; margin-bottom: 8px; }
.seg2 button { flex: 1; padding: 8px 0; border-radius: 7px; font-size: 14px; color: #74809a; }
.seg2 button.on { background: #fff; color: #3b6ef6; font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.m-pie { height: 260px; }
.m-trend { height: 220px; }
.rank-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.rank-name { width: 74px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-bar { flex: 1; height: 8px; background: #f0f2f7; border-radius: 4px; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 4px; }
.rank-amt { width: 86px; text-align: right; font-size: 12px; color: #475066; }

/* ---------- 底部 tab ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 640px; background: #fff;
  display: flex; border-top: 1px solid var(--line); z-index: 40;
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; text-align: center; padding: 8px 0 6px; font-size: 19px;
  color: #a3acc0; display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar a span { font-size: 11px; }
.tabbar a.on { color: #3b6ef6; }

/* ---------- 弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(16,26,46,.45); z-index: 100;
  display: flex; align-items: flex-end; justify-content: center;
}
.token-sheet { align-items: stretch; }
.sheet {
  background: #fff; width: 100%; max-width: 640px; border-radius: 18px 18px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
}
.token-sheet { margin: auto; border-radius: 18px; width: 88%; max-width: 420px; padding: 26px 22px; }
.sheet h3 { margin-bottom: 14px; font-size: 17px; text-align: center; }
.sheet input, .token-sheet input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-size: 15px; margin-bottom: 12px; outline: none;
}
.edit-amount { font-size: 22px !important; font-weight: 700; }
.btn-primary {
  background: #3b6ef6; color: #fff; border-radius: 10px; padding: 12px;
  font-size: 16px; font-weight: 600;
}
.btn-primary.block { width: 100%; }
.sheet-btns { display: flex; gap: 10px; }
.sheet-btns button { flex: 1; padding: 12px 0; border-radius: 10px; font-size: 15px; background: #f0f2f7; }
.sheet-btns .btn-primary { flex: 1.4; }
.sheet-btns .danger { color: var(--exp); }

.toast {
  position: fixed; bottom: 96px; left: 50%; transform: translateX(-50%);
  background: rgba(16,26,46,.92); color: #fff; padding: 10px 22px;
  border-radius: 22px; z-index: 200; font-size: 14px;
}
