/* ============ 设计令牌 ============ */
:root {
  --bg: #f5f5f7;
  --bg-2: #ececf0;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-hover: rgba(255, 255, 255, 0.9);
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --accent: #0071e3;
  --accent-soft: rgba(0, 113, 227, 0.1);
  --up: #34c759;
  --down: #ff453a;
  --warn: #ff9f0a;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.05), 0 12px 32px rgba(0, 0, 0, 0.07);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro SC", "SF Pro Text",
          "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0e0e11;
  --bg-2: #16161a;
  --surface: rgba(28, 28, 32, 0.76);
  --surface-solid: #1c1c20;
  --surface-hover: rgba(38, 38, 44, 0.88);
  --text: #f5f5f7;
  --text-2: #a0a0a8;
  --text-3: #6e6e78;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --accent: #4c9bff;
  --accent-soft: rgba(76, 155, 255, 0.14);
  --up: #30d158;
  --down: #ff6961;
  --warn: #ffb340;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.35), 0 14px 36px rgba(0, 0, 0, 0.45);
}

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

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

.aurora {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(680px 420px at 12% -8%, rgba(0, 113, 227, 0.16), transparent 62%),
    radial-gradient(560px 400px at 96% 4%, rgba(52, 199, 89, 0.13), transparent 60%),
    radial-gradient(720px 520px at 72% 102%, rgba(175, 82, 222, 0.12), transparent 62%);
}
[data-theme="dark"] .aurora {
  background:
    radial-gradient(680px 420px at 12% -8%, rgba(76, 155, 255, 0.2), transparent 62%),
    radial-gradient(560px 400px at 96% 4%, rgba(48, 209, 88, 0.15), transparent 60%),
    radial-gradient(720px 520px at 72% 102%, rgba(122, 87, 209, 0.18), transparent 62%);
}

.num { font-family: var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

/* ============ 登录 / 注册 ============ */
.gate {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}
.gate.is-hidden { display: none; }

.gate-card {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2.25rem 1.75rem;
  border-radius: var(--r-xl);
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(28px);
  -webkit-backdrop-filter: saturate(180%) blur(28px);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  animation: gateIn .5s cubic-bezier(.22,1,.36,1);
}
@keyframes gateIn { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .gate-card { animation: none; } }

.gate-brand { text-align: center; margin-bottom: 1.85rem; }
.gate-mark {
  width: 52px; height: 52px; margin: 0 auto 1.1rem;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(140deg, #0071e3, #5ac8fa 55%, #34c759);
  color: #fff;
  box-shadow: 0 8px 22px rgba(0, 113, 227, 0.3);
}
.gate-brand h1 { font-size: 20px; font-weight: 650; letter-spacing: -0.02em; }
.gate-brand p { font-size: 13px; color: var(--text-3); margin-top: 4px; }

.gate-form { display: flex; flex-direction: column; gap: 1.05rem; }
.gate-form.is-hidden { display: none; }
.gate-field { display: flex; flex-direction: column; gap: 6px; }
.gate-field label { font-size: 11.5px; font-weight: 550; color: var(--text-3); letter-spacing: .03em; }

.pass-wrap { position: relative; }
.pass-wrap .input { padding-right: 42px; }
.eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-3); cursor: pointer;
  display: grid; place-items: center;
  transition: color .18s, background .18s;
}
.eye:hover { color: var(--text-2); background: var(--bg-2); }
.eye.is-on { color: var(--accent); }

.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; color: var(--text-2); }
.check input { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; }

.gate-submit { width: 100%; padding: 11px 20px; margin-top: .25rem; }

.strength {
  height: 3px; border-radius: 999px;
  background: var(--bg-2); overflow: hidden; margin-top: 2px;
}
.strength span {
  display: block; height: 100%; width: 0;
  border-radius: 999px;
  transition: width .3s, background .3s;
}

.gate-hint { font-size: 12.5px; min-height: 18px; text-align: center; }
.gate-hint.is-err { color: var(--down); }
.gate-hint.is-ok { color: var(--up); }
.gate-tiny { font-size: 11px; color: var(--text-3); }

.gate-warn {
  margin-top: 1rem;
  padding: .7rem .85rem;
  border-radius: var(--r-sm);
  background: rgba(255,159,10,.12);
  border: 1px solid rgba(255,159,10,.3);
  color: var(--warn);
  font-size: 11.5px;
  line-height: 1.6;
}

.resend-btn {
  align-self: flex-start;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 400;
}
.resend-btn:disabled { opacity: .45; cursor: not-allowed; }

.gate-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 1.25rem 0;
  color: var(--text-3); font-size: 11.5px;
}
.gate-divider::before,
.gate-divider::after {
  content: ''; flex: 1; height: 1px;
  background: var(--line);
}

.btn-wx {
  width: 100%; padding: 11px 20px;
  background: #07c160; color: #fff;
  border: 0; border-radius: var(--r-sm);
  font-family: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .12s, filter .18s;
}
.btn-wx:hover { filter: brightness(1.06); }
.btn-wx:active { transform: scale(.98); }
.btn-wx:disabled { opacity: .5; cursor: not-allowed; }

.gate-switch { font-size: 12.5px; color: var(--text-3); text-align: center; }
.gate-switch button {
  border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 550;
  color: var(--accent); padding: 2px 4px; border-radius: 5px;
}
.gate-switch button:hover { background: var(--accent-soft); }

.gate-foot {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 1.5rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3);
}

.is-hidden { display: none !important; }

/* ============ 账本卡片 ============ */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.book-card {
  padding: 1rem 1.1rem;
  border-radius: var(--r-md);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-left: 3px solid var(--bc);
  display: flex; flex-direction: column; gap: 3px;
  transition: transform .18s, box-shadow .18s;
}
.book-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.bc-top { display: flex; align-items: center; gap: 7px; }
.bc-emoji { font-size: 16px; }
.bc-name { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.bc-amt {
  font-size: 19px; font-weight: 600; letter-spacing: -0.03em;
  margin-top: 4px; line-height: 1.15;
}
.bc-sub { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-3); }
.bc-sub .is-up { color: var(--up); font-family: var(--mono); }
.bc-sub .is-down { color: var(--down); font-family: var(--mono); }
.bc-date { margin-left: auto; font-family: var(--mono); }
.bc-first { font-style: italic; }

/* ============ 账本选择器 ============ */
.book-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
  gap: 8px;
  margin-bottom: 1.5rem;
}
.pick-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface-solid); cursor: pointer;
  font-family: inherit; text-align: left;
  transition: border-color .18s, background .18s, transform .12s;
  position: relative; overflow: hidden;
}
.pick-item::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--bc);
}
.pick-item:hover { border-color: var(--text-3); transform: translateY(-1px); }
.pick-item:active { transform: scale(.97); }
.pick-item.is-on {
  border-color: var(--bc); background: color-mix(in srgb, var(--bc) 8%, transparent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--bc) 22%, transparent);
}
.pick-emoji { font-size: 15px; }
.pick-name { font-size: 12.5px; font-weight: 500; color: var(--text); }
.pick-bal { font-size: 11px; color: var(--text-3); }

/* ============ 上次余额 / 差额 ============ */
.prev-box {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: var(--r-md);
  background: var(--bg-2);
  margin-bottom: 1.5rem;
}
.prev-row { display: flex; flex-direction: column; gap: 3px; }
.prev-row span { font-size: 11.5px; color: var(--text-3); }
.prev-row strong { font-size: 14px; font-weight: 600; }

.diff-box {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: .9rem 1.15rem;
  border-radius: var(--r-md);
  background: var(--bg-2);
  border: 1px solid transparent;
  margin-bottom: 1.5rem;
  transition: background .22s, border-color .22s;
}
.diff-label { font-size: 12px; color: var(--text-3); }
.diff-amount { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.diff-tag {
  font-size: 11px; font-weight: 550;
  padding: 2px 9px; border-radius: 999px;
  background: var(--surface-solid); color: var(--text-3);
}
.diff-box.is-up { background: rgba(52,199,89,.1); border-color: rgba(52,199,89,.24); }
.diff-box.is-up .diff-amount { color: var(--up); }
.diff-box.is-up .diff-tag { background: var(--up); color: #fff; }
.diff-box.is-down { background: rgba(255,69,58,.1); border-color: rgba(255,69,58,.24); }
.diff-box.is-down .diff-amount { color: var(--down); }
.diff-box.is-down .diff-tag { background: var(--down); color: #fff; }
.diff-box.is-first .diff-amount { color: var(--accent); }
.diff-box.is-same .diff-amount { font-size: 14px; color: var(--text-3); }

/* ============ 提示列表 ============ */
.tip-list { display: flex; flex-direction: column; gap: 1rem; }
.tip { display: flex; gap: 11px; align-items: flex-start; }
.tip-ico {
  width: 21px; height: 21px; flex-shrink: 0;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 600;
  display: grid; place-items: center;
  margin-top: 1px;
}
.tip p { font-size: 12.5px; color: var(--text-2); line-height: 1.6; }
.tip strong { color: var(--text); font-weight: 550; }

/* ============ 迷你列表 ============ */
.mini-list { list-style: none; display: flex; flex-direction: column; }
.mini-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
  font-size: 12.5px;
}
.mini-row:last-child { border-bottom: 0; }
.mini-date { color: var(--text-3); font-family: var(--mono); font-size: 11.5px; width: 42px; flex-shrink: 0; }
.mini-note {
  color: var(--text-2); flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.mini-bal { color: var(--text); font-weight: 550; font-size: 12px; }
.mini-delta { font-size: 11.5px; width: 82px; text-align: right; flex-shrink: 0; color: var(--text-3); }
.mini-delta.is-up { color: var(--up); }
.mini-delta.is-down { color: var(--down); }

/* ============ 转账 ============ */
.tf-arrow {
  display: grid; place-items: center;
  width: 34px; height: 34px; margin: -1.5rem 0;
  border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  transform: rotate(90deg);
}
.tf-preview {
  display: flex; flex-direction: column; gap: 10px;
}
.tf-line {
  display: flex; align-items: center; gap: 11px;
  padding: .85rem 1rem;
  border-radius: var(--r-md);
  background: var(--bg-2);
}
.tf-ico { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex-shrink: 0; }
.tf-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.tf-info strong { font-size: 13px; font-weight: 550; }
.tf-info .num { font-size: 11px; color: var(--text-3); }
.tf-amt { font-size: 14px; font-weight: 600; white-space: nowrap; }
.tf-amt.is-in { color: var(--up); }
.tf-amt.is-out { color: var(--down); }

/* ============ 账本管理列表 ============ */
.book-manage { display: flex; flex-direction: column; gap: 2px; }
.bm-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  border-left: 3px solid var(--bc);
  background: var(--surface-solid);
  transition: background .18s;
}
.bm-item:hover { background: var(--surface-hover); }
.bm-emoji { font-size: 20px; flex-shrink: 0; }
.bm-body { flex: 1; min-width: 0; }
.bm-name { font-size: 13.5px; font-weight: 550; }
.bm-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.bm-item .icon-btn.danger:hover { color: var(--down); border-color: rgba(255,69,58,.4); }

/* ============ 弹窗 ============ */
.modal { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 1.25rem; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.32); backdrop-filter: blur(4px); }
.modal-card {
  position: relative;
  width: 100%; max-width: 400px;
  max-height: 88vh; overflow-y: auto;
  padding: 1.5rem;
  border-radius: var(--r-xl);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  animation: gateIn .32s cubic-bezier(.22,1,.36,1);
}
.emoji-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr));
  gap: 5px; max-height: 148px; overflow-y: auto;
}
.emoji-item {
  aspect-ratio: 1; border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg-2); cursor: pointer;
  font-size: 17px; line-height: 1;
  display: grid; place-items: center;
  transition: border-color .16s, background .16s, transform .12s;
}
.emoji-item:hover { border-color: var(--text-3); }
.emoji-item:active { transform: scale(.9); }
.emoji-item.is-on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 2px var(--accent-soft); }
input[type="color"] {
  width: 100%; height: 40px; padding: 3px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-solid); cursor: pointer;
}

/* ============ 转账标记 ============ */
.tx-tag {
  display: inline-block; margin-left: 5px; padding: 1px 6px;
  border-radius: 4px; background: var(--accent-soft); color: var(--accent);
  font-size: 10px; font-weight: 550; vertical-align: 1px;
}

.account-box {
  display: flex; align-items: center; gap: 12px;
  padding: 1rem 1.15rem;
  border-radius: var(--r-md);
  background: var(--bg-2);
}
.acc-avatar {
  width: 42px; height: 42px; flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent); color: #fff;
  font-size: 17px; font-weight: 550;
  display: grid; place-items: center;
  text-transform: uppercase;
}
.acc-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acc-info strong { font-size: 14px; font-weight: 550; }
.acc-info span {
  font-size: 12px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ============ 布局 ============ */
.shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 1.75rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.brand-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: linear-gradient(140deg, #0071e3, #5ac8fa 55%, #34c759);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.28);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.brand-text strong { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand-text span { font-size: 11px; color: var(--text-3); }

.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border: 0; border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-family: inherit; font-size: 13.5px; font-weight: 450;
  text-align: left; cursor: pointer;
  transition: background .18s, color .18s, transform .12s;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item:active { transform: scale(.985); }
.nav-item.is-active {
  background: var(--surface-solid);
  color: var(--accent);
  font-weight: 550;
  box-shadow: var(--shadow-sm);
}
.nav-item svg { flex-shrink: 0; }

.sidebar-foot { padding: 0 4px; }
.net-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-2);
}
.net-badge .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--up);
  box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.18);
}
.net-badge.is-off .dot { background: var(--text-3); box-shadow: 0 0 0 3px rgba(0,0,0,.06); }

.content { padding: 2.25rem 2.75rem 3.5rem; min-width: 0; }

/* ============ 视图切换 ============ */
.view { display: none; animation: fade .32s cubic-bezier(.22,1,.36,1); }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
  * { transition-duration: .01ms !important; }
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1.5rem; margin-bottom: 1.75rem; flex-wrap: wrap;
}
.eyebrow {
  font-size: 12px; color: var(--text-3); letter-spacing: .04em;
  text-transform: uppercase; font-weight: 500; margin-bottom: 5px;
}
.page-head h1 { font-size: 27px; font-weight: 650; letter-spacing: -0.025em; }

/* ============ 卡片 ============ */
.card {
  background: var(--surface);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.15rem;
}
.card-label {
  font-size: 12px; font-weight: 550; color: var(--text-3);
  letter-spacing: .03em; margin-bottom: 1rem;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem;
}
.card-head .card-label { margin-bottom: 0; }
.card-note { font-size: 12.5px; color: var(--text-2); line-height: 1.65; margin-bottom: 1.15rem; }

.hero-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 1.15rem; }
.add-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.15rem; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.15rem; }
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.15rem; }
.span-2 { grid-column: span 2; }

/* ============ 总览 ============ */
.hero-amount {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(34px, 4.4vw, 46px);
  font-weight: 600; letter-spacing: -0.035em;
  margin: 0.35rem 0 1.6rem;
  line-height: 1.05;
}
.hero-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
  padding-top: 1.25rem; border-top: 1px solid var(--line);
}
.split-item { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.split-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.split-label { font-size: 12.5px; color: var(--text-2); }
.split-item strong { font-size: 14.5px; font-weight: 600; width: 100%; margin-top: 2px; }

.budget-block { margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.budget-meta {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--text-2); margin-bottom: .5rem;
}
.budget-meta .num { font-weight: 600; color: var(--text); font-size: 12.5px; }
.budget-track { height: 6px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.budget-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #34c759, #30d158);
  transition: width .55s cubic-bezier(.22,1,.36,1), background .3s;
}
.budget-fill.is-warn { background: linear-gradient(90deg, #ff9f0a, #ffb340); }
.budget-fill.is-over { background: linear-gradient(90deg, #ff453a, #ff6961); }

.pill {
  padding: 3px 10px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
  font-size: 11.5px; font-weight: 550;
}

.donut-wrap { position: relative; display: grid; place-items: center; margin-bottom: 1.25rem; }
.donut-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  pointer-events: none;
}
.donut-center strong { font-size: 21px; font-weight: 600; letter-spacing: -0.025em; }
.donut-center span { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }

.legend { list-style: none; display: flex; flex-direction: column; gap: 1px; }
.legend li {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 0; font-size: 13px;
}
.legend .lg-dot { width: 9px; height: 9px; border-radius: 3px; flex-shrink: 0; }
.legend .lg-name { color: var(--text-2); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend .lg-val { font-family: var(--mono); font-size: 12.5px; font-weight: 550; }
.legend .lg-pct { font-size: 11.5px; color: var(--text-3); width: 42px; text-align: right; font-family: var(--mono); }

/* ============ 流水列表 ============ */
.txn-list { list-style: none; }
.txn-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  animation: rowIn .3s ease;
}
.txn-row:last-child { border-bottom: 0; padding-bottom: 0; }
@keyframes rowIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

.txn-ico {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  font-size: 17px; flex-shrink: 0;
  background: var(--bg-2);
}
.txn-body { flex: 1; min-width: 0; }
.txn-name { font-size: 13.5px; font-weight: 500; }
.txn-sub {
  font-size: 11.5px; color: var(--text-3); margin-top: 1px;
  display: flex; gap: 6px; align-items: center;
}
.txn-amt { font-family: var(--mono); font-size: 14px; font-weight: 600; white-space: nowrap; letter-spacing: -0.02em; }
.txn-amt.is-out { color: var(--down); }
.txn-amt.is-in { color: var(--up); }
.txn-del {
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-3); padding: 5px; border-radius: 7px;
  opacity: 0; transition: opacity .18s, color .18s, background .18s;
  display: grid; place-items: center;
}
.txn-row:hover .txn-del { opacity: 1; }
.txn-del:hover { color: var(--down); background: rgba(255, 69, 58, 0.1); }

.day-head {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 1.1rem 0 .45rem;
  font-size: 12px; color: var(--text-3);
}
.day-head:first-child { padding-top: 0; }
.day-head .day-sum { font-family: var(--mono); font-size: 11.5px; }

.empty {
  padding: 3rem 1rem; text-align: center; color: var(--text-3);
  display: flex; flex-direction: column; align-items: center; gap: .65rem;
}
.empty svg { opacity: .35; }
.empty strong { font-size: 14px; color: var(--text-2); font-weight: 500; }
.empty span { font-size: 12.5px; }

/* ============ 分段控件 ============ */
.seg {
  position: relative;
  display: inline-grid; grid-template-columns: 1fr 1fr;
  background: var(--bg-2); border-radius: var(--r-sm);
  padding: 3px; margin-bottom: 1.5rem;
}
.seg-btn {
  position: relative; z-index: 1;
  border: 0; background: transparent; cursor: pointer;
  padding: 7px 22px; border-radius: 7px;
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text-2);
  transition: color .22s;
  min-width: 82px;
}
.seg-btn.is-active { color: var(--text); font-weight: 600; }
.seg-btn[data-type="expense"].is-active { color: var(--down); }
.seg-btn[data-type="income"].is-active { color: var(--up); }
.seg-thumb {
  position: absolute; z-index: 0; top: 3px; left: 3px;
  width: calc(50% - 3px); height: calc(100% - 6px);
  background: var(--surface-solid); border-radius: 7px;
  box-shadow: var(--shadow-sm);
  transition: transform .32s cubic-bezier(.22,1,.36,1);
}
.seg[data-type="income"] .seg-thumb { transform: translateX(100%); }
.seg-sm { margin-bottom: 0; }
.seg-sm .seg-btn { padding: 6px 18px; font-size: 12.5px; }

/* ============ 录入 ============ */
.amount-box {
  display: flex; align-items: baseline; gap: 8px;
  padding: 1rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.amount-cny { font-size: 26px; font-weight: 400; color: var(--text-3); }
.amount-input {
  flex: 1; min-width: 0;
  border: 0; background: transparent; outline: none;
  font-family: var(--mono); font-size: 40px; font-weight: 600;
  letter-spacing: -0.035em; color: var(--text);
  padding: 0;
}
.amount-input::placeholder { color: var(--text-3); opacity: .45; }

.field-label {
  display: block; font-size: 11.5px; font-weight: 550;
  color: var(--text-3); letter-spacing: .03em; margin-bottom: .6rem;
}
.cat-grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 8px; margin-bottom: 1.5rem;
}
.cat-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 11px 4px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface-solid); cursor: pointer;
  font-family: inherit; font-size: 11.5px; color: var(--text-2);
  transition: border-color .18s, background .18s, transform .12s, box-shadow .18s;
}
.cat-item:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.cat-item:active { transform: scale(.96); }
.cat-item .ci-emoji { font-size: 20px; line-height: 1; }
.cat-item.is-on {
  border-color: var(--accent); background: var(--accent-soft);
  color: var(--accent); font-weight: 550;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.input {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface-solid);
  font-family: inherit; font-size: 13.5px; color: var(--text);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
.select { cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888888' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 14px;
  padding-right: 32px;
}

.add-actions { display: flex; gap: 10px; }
.btn {
  padding: 10px 20px; border-radius: var(--r-sm);
  border: 1px solid transparent; cursor: pointer;
  font-family: inherit; font-size: 13.5px; font-weight: 550;
  transition: transform .12s, box-shadow .18s, background .18s, opacity .18s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 3px 12px rgba(0,113,227,.25); }
.btn-primary:hover { background: #0077ed; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--surface-solid); color: var(--text-2); border-color: var(--line-strong); }
.btn-ghost:hover { color: var(--text); border-color: var(--text-3); }
.btn-danger { background: transparent; color: var(--down); border-color: rgba(255,69,58,.3); }
.btn-danger:hover { background: rgba(255,69,58,.08); border-color: var(--down); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.form-hint { font-size: 12px; color: var(--text-3); margin-top: .75rem; min-height: 17px; }
.form-hint.is-err { color: var(--down); }
.form-hint.is-ok { color: var(--up); }

.today-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.tstat { display: flex; flex-direction: column; gap: 4px; }
.tstat span { font-size: 12px; color: var(--text-3); }
.tstat strong { font-size: 19px; font-weight: 600; letter-spacing: -0.025em; }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  padding: 5px 12px; border-radius: 999px;
  background: var(--bg-2); border: 1px solid var(--line);
  font-family: inherit; font-size: 12px; color: var(--text-2);
  cursor: pointer; transition: background .18s, color .18s, border-color .18s;
}
.chip:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }

/* ============ 筛选栏 ============ */
.filter-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 1.15rem; flex-wrap: wrap; }
.search { flex: 1; min-width: 180px; }
.select { width: auto; min-width: 130px; }
.list-summary {
  display: flex; gap: 1.5rem; flex-wrap: wrap;
  padding-bottom: 1rem; margin-bottom: .5rem;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-2);
}
.list-summary b { font-family: var(--mono); font-weight: 600; color: var(--text); }

/* ============ 统计 ============ */
.mini-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--text-2); }
.mini-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mini-legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.bars { display: flex; align-items: flex-end; gap: 10px; height: 210px; padding-top: 1rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .5rem; height: 100%; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 4px; width: 100%; justify-content: center; }
.bar { width: 42%; max-width: 22px; border-radius: 5px 5px 2px 2px; min-height: 3px;
  transition: height .5s cubic-bezier(.22,1,.36,1); }
.bar.b-in { background: var(--up); }
.bar.b-out { background: var(--down); }
.bar-label { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

.rank-list { list-style: none; display: flex; flex-direction: column; gap: .95rem; }
.rank-item { display: flex; flex-direction: column; gap: 5px; }
.rank-top { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.rank-name { font-weight: 500; }
.rank-val { font-family: var(--mono); font-size: 12.5px; font-weight: 550; margin-left: auto; }
.rank-pct { font-size: 11px; color: var(--text-3); font-family: var(--mono); width: 40px; text-align: right; }
.rank-track { height: 5px; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.rank-fill { height: 100%; border-radius: 999px; transition: width .55s cubic-bezier(.22,1,.36,1); }

.rank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.rank-card {
  padding: 1rem; border-radius: var(--r-md);
  background: var(--surface-solid); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 4px;
  transition: transform .18s, box-shadow .18s;
}
.rank-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.rank-card .rc-top { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.rank-card .rc-emoji { font-size: 15px; }
.rank-card .rc-amt { font-family: var(--mono); font-size: 17px; font-weight: 600; letter-spacing: -0.025em; margin-top: 2px; }
.rank-card .rc-pct { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* ============ 月份导航 ============ */
.month-nav { display: flex; align-items: center; gap: 4px; }
.icon-btn {
  width: 30px; height: 30px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-solid);
  color: var(--text-2); cursor: pointer; display: grid; place-items: center;
  transition: background .18s, color .18s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent); }
.month-label {
  border: 0; background: transparent; cursor: pointer;
  font-family: var(--mono); font-size: 13.5px; font-weight: 600;
  color: var(--text); padding: 5px 10px; border-radius: 8px;
  min-width: 62px;
  transition: background .18s;
}
.month-label:hover { background: var(--bg-2); }

.link-btn {
  border: 0; background: transparent; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  color: var(--accent); padding: 3px 6px; border-radius: 6px;
  transition: background .18s;
}
.link-btn:hover { background: var(--accent-soft); }

/* ============ 提示条 ============ */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translate(-50%, 22px);
  padding: 11px 22px; border-radius: 999px;
  background: var(--surface-solid); border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  font-size: 13px; font-weight: 500;
  opacity: 0; pointer-events: none;
  transition: opacity .28s, transform .28s cubic-bezier(.22,1,.36,1);
  z-index: 100;
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ============ 响应式 ============ */
@media (max-width: 1080px) {
  .hero-grid, .add-grid, .settings-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid .span-2 { grid-column: span 2; }
}

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row;
    align-items: center; gap: 1rem;
    padding: 1rem 1.15rem;
    border-right: 0; border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }
  .brand-text { display: none; }
  .nav { flex-direction: row; gap: 4px; flex: 1; }
  .nav-item { padding: 8px 11px; }
  .nav-item span { font-size: 12.5px; }
  .sidebar-foot { display: none; }
  .content { padding: 1.5rem 1.15rem 3rem; }
  .page-head h1 { font-size: 23px; }
  .field-row { grid-template-columns: 1fr; }
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .stats-grid { grid-template-columns: 1fr; }
  .stats-grid .span-2 { grid-column: span 1; }
  .span-2 { grid-column: span 1; }
  .add-actions .btn { flex: 1; }
  .amount-input { font-size: 33px; }
}