/* ============ 基础与主题 ============ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  /* 默认：霓虹夜幕 */
  --bg: #0b0c1b;
  --surface: #141630;
  --surface-2: #1d2040;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f1f2ff;
  --muted: #9298c4;
  --brand-1: #7c5cff;
  --brand-2: #ff4d8d;
  --accent: #ffd166;
  --good: #34d399;
  --bad: #ff6b8b;
  --glass: rgba(20, 22, 48, 0.92);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
}

[data-theme="neon"] {
  --bg: #0b0c1b;
  --surface: #141630;
  --surface-2: #1d2040;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f1f2ff;
  --muted: #9298c4;
  --brand-1: #7c5cff;
  --brand-2: #ff4d8d;
  --accent: #ffd166;
  --good: #34d399;
  --bad: #ff6b8b;
  --glass: rgba(20, 22, 48, 0.92);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
}

[data-theme="peach"] {
  --bg: #fff4ef;
  --surface: #ffffff;
  --surface-2: #fff0ea;
  --line: #f3ded6;
  --text: #2a1a1f;
  --muted: #9c8186;
  --brand-1: #ff7a59;
  --brand-2: #ff2e77;
  --accent: #ffb703;
  --good: #0fb886;
  --bad: #ef4444;
  --glass: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 36px -26px rgba(255, 90, 90, 0.55);
}

[data-theme="mint"] {
  --bg: #eefbf6;
  --surface: #ffffff;
  --surface-2: #e8f7f2;
  --line: #d8ece5;
  --text: #0b2a24;
  --muted: #6b9189;
  --brand-1: #12b981;
  --brand-2: #0891b2;
  --accent: #f59e0b;
  --good: #12b981;
  --bad: #ef4444;
  --glass: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 36px -26px rgba(6, 148, 120, 0.45);
}

[data-theme="ocean"] {
  --bg: #061426;
  --surface: #0d2038;
  --surface-2: #132e4d;
  --line: rgba(255, 255, 255, 0.09);
  --text: #e8f3ff;
  --muted: #8aa8c4;
  --brand-1: #2f7bff;
  --brand-2: #22d3ee;
  --accent: #ffd166;
  --good: #34d399;
  --bad: #ff7b8a;
  --glass: rgba(13, 32, 56, 0.92);
  --shadow: 0 18px 40px -24px rgba(0, 0, 0, 0.9);
}

[data-theme="sakura"] {
  --bg: #fff4f9;
  --surface: #ffffff;
  --surface-2: #ffeaf4;
  --line: #f4dbea;
  --text: #2b1830;
  --muted: #9d7f9f;
  --brand-1: #ec4899;
  --brand-2: #8b5cf6;
  --accent: #ffb703;
  --good: #10b981;
  --bad: #ef4444;
  --glass: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 36px -26px rgba(236, 72, 153, 0.4);
}

[data-theme="sunset"] {
  --bg: #fffaf0;
  --surface: #ffffff;
  --surface-2: #fff3dc;
  --line: #f3e4c7;
  --text: #2c2110;
  --muted: #9b8a6c;
  --brand-1: #f59e0b;
  --brand-2: #ff5a3c;
  --accent: #7c5cff;
  --good: #10b981;
  --bad: #ef4444;
  --glass: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 36px -26px rgba(245, 158, 11, 0.45);
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: #07070d;
  background-image: radial-gradient(60% 45% at 50% -5%, rgba(124, 92, 255, 0.35), transparent 70%),
    radial-gradient(45% 40% at 90% 105%, rgba(255, 77, 141, 0.22), transparent 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.3s ease;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
}

button {
  cursor: pointer;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

input,
select {
  background: none;
  border: 0;
  color: inherit;
  outline: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  opacity: 0.7;
  cursor: pointer;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

/* ============ 应用外壳 ============ */
.app {
  position: relative;
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.35s ease;
}

@media (min-width: 521px) {
  .app {
    height: min(900px, calc(100dvh - 36px));
    border-radius: 36px;
    box-shadow: 0 50px 120px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.06);
  }
}

.screen {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 18px) 18px calc(118px + env(safe-area-inset-bottom));
  scrollbar-width: none;
}

.screen::-webkit-scrollbar {
  display: none;
}

/* ============ 底部导航 ============ */
.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  z-index: 30;
  display: flex;
  align-items: center;
  padding: 0 6px env(safe-area-inset-bottom);
  border-radius: 24px 24px 0 0;
  background: var(--glass);
  border: 1px solid var(--line);
  border-bottom: 0;
  box-shadow: 0 -14px 30px -20px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(22px) saturate(1.5);
  -webkit-backdrop-filter: blur(22px) saturate(1.5);
}

.tab {
  flex: 1;
  height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 16px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.tab svg {
  width: 22px;
  height: 22px;
  transition: transform 0.25s var(--ease);
}

.tab.on {
  color: var(--brand-1);
}

.tab.on svg {
  transform: translateY(-1px) scale(1.06);
}

.tab:active {
  transform: scale(0.94);
}

.fab {
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  margin: -26px 10px 0;
  border-radius: 19px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 14px 30px -12px var(--brand-1), 0 0 0 4px var(--bg);
  transition: transform 0.18s var(--ease), box-shadow 0.2s;
}

.fab svg {
  width: 26px;
  height: 26px;
}

.fab:active {
  transform: scale(0.9) rotate(90deg);
}

/* ============ 通用排版 ============ */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 16px;
}

.page-head h1 {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.card-head h2,
.card > h2 {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: 0.1px;
}

.link {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 2px;
}

.link:active {
  opacity: 0.6;
}

.muted {
  color: var(--muted);
}

.tiny {
  font-size: 11px;
  color: var(--muted);
}

.primary-btn {
  height: 44px;
  padding: 0 24px;
  border-radius: 14px;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 12px 24px -14px var(--brand-1);
}

/* ============ 首页 ============ */
.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin: 2px 2px 18px;
}

.topbar .date {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
  letter-spacing: 0.2px;
}

.topbar h1 {
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.3px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.2s var(--ease);
}

.avatar:active {
  transform: scale(0.92);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 16px;
  border-radius: 24px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  background-size: 160% 160%;
  box-shadow: 0 24px 44px -22px var(--brand-1);
  margin-bottom: 18px;
  animation: heroShift 12s ease infinite;
}

@keyframes heroShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.hero::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  border-radius: 50%;
  top: -105px;
  right: -50px;
  background: rgba(255, 255, 255, 0.16);
}

.hero::after {
  content: "";
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  bottom: -70px;
  left: -30px;
  background: rgba(255, 255, 255, 0.1);
}

.hero-top {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.9;
  margin-bottom: 6px;
  z-index: 1;
}

.hero-badge {
  font-size: 10.5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(4px);
}

.hero-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-amount {
  font-size: 33px;
  font-weight: 750;
  letter-spacing: -0.8px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: baseline;
  gap: 3px;
}

.hero-amount span {
  font-size: 17px;
  font-weight: 600;
  opacity: 0.85;
}

.hero-meta {
  display: flex;
  gap: 14px;
  margin-top: 9px;
  font-size: 11.5px;
  opacity: 0.88;
}

.hero-meta b {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.ring {
  position: relative;
  width: 84px;
  height: 84px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 7;
}

.ring-bar {
  fill: none;
  stroke: #fff;
  stroke-width: 7;
  stroke-linecap: round;
  transition: stroke-dasharray 0.7s var(--ease);
}

.ring-label {
  position: relative;
  text-align: center;
  line-height: 1.15;
}

.ring-label b {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ring-label span {
  display: block;
  font-size: 9px;
  opacity: 0.82;
  margin-top: 1px;
}

.ring-setup {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: 1.5px dashed rgba(255, 255, 255, 0.5);
  color: #fff;
  font-size: 11px;
  line-height: 1.4;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 2px 10px;
  font-size: 13px;
  font-weight: 650;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 20px;
}

.qbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px 2px;
  border-radius: 16px;
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.18s var(--ease), background 0.2s;
}

.qbtn:active {
  transform: scale(0.92);
  background: var(--surface-2);
}

.qbtn .q-ico {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 21px;
  transition: transform 0.2s var(--ease);
}

.qbtn:active .q-ico {
  transform: scale(1.04);
}

/* ============ 记录行 ============ */
.rec {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 2px;
  text-align: left;
  border-radius: 12px;
  transition: background 0.18s;
}

.rec:active {
  background: var(--surface-2);
}

.rec-ico {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 19px;
}

.rec-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rec-name {
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

.rec-sub {
  font-size: 10.5px;
  color: var(--muted);
}

.rec-amt {
  flex: 0 0 auto;
  font-size: 14px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
}

.rec-amt.inc {
  color: var(--good);
}

.day-items .rec + .rec {
  border-top: 1px solid var(--line);
}

/* ============ 明细页 ============ */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 6px 8px;
  margin-bottom: 12px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.month-nav span {
  font-size: 14px;
  font-weight: 650;
  min-width: 108px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.month-nav button {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--text);
  background: var(--surface-2);
  transition: transform 0.15s;
}

.month-nav button:active {
  transform: scale(0.9);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 10px;
}

.search-box svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-box input {
  flex: 1;
  font-size: 13px;
  min-width: 0;
}

.search-box input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.chips {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  height: 32px;
  padding: 0 15px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.chip.on {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 8px 18px -12px var(--brand-1);
}

.month-sum {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.month-sum span {
  flex: 1;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
}

.month-sum b {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.daycard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}

.dayhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.dayhead span:first-child {
  font-weight: 600;
  color: var(--text);
}

.empty {
  padding: 46px 20px;
  text-align: center;
  border-radius: 20px;
  background: var(--surface);
  border: 1px dashed var(--line);
}

.empty-emoji {
  font-size: 40px;
  margin-bottom: 10px;
  opacity: 0.9;
}

.empty p {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ============ 统计页 ============ */
.stat-hero {
  background: linear-gradient(140deg, var(--surface), var(--surface-2));
  position: relative;
  overflow: hidden;
}

.stat-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-big {
  font-size: 32px;
  font-weight: 750;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pill.warn {
  color: var(--bad);
  background: color-mix(in srgb, var(--bad) 14%, transparent);
}

.pill.good {
  color: var(--good);
  background: color-mix(in srgb, var(--good) 14%, transparent);
}

.budget-line {
  height: 7px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 14px 0 7px;
}

.budget-line div {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  transition: width 0.6s var(--ease);
}

.donut-wrap {
  display: grid;
  place-items: center;
  padding: 6px 0 14px;
}

.donut {
  position: relative;
  width: 170px;
  height: 170px;
  display: grid;
  place-items: center;
}

.donut svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.donut-center {
  position: relative;
  text-align: center;
  line-height: 1.25;
}

.donut-center span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
}

.donut-center b {
  font-size: 19px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.legend li {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
}

.legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.legend .lg-name {
  width: 52px;
  flex: 0 0 auto;
  color: var(--muted);
}

.legend .lg-bar {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.legend .lg-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  transition: width 0.6s var(--ease);
}

.legend .lg-amt {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 12px;
  min-width: 58px;
  text-align: right;
}

.legend .lg-pct {
  width: 34px;
  text-align: right;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  height: 148px;
  padding: 6px 2px 0;
}

.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  min-width: 0;
}

.bar-val {
  font-size: 9px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bar {
  width: 100%;
  max-width: 26px;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, var(--brand-1), color-mix(in srgb, var(--brand-2) 70%, transparent));
  min-height: 4px;
  transition: height 0.6s var(--ease);
}

.bar.dim {
  background: var(--surface-2);
}

.bar-label {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.insights {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.insights li {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 12.5px;
}

.insights .ins-ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: var(--surface-2);
  flex: 0 0 auto;
}

.insights b {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 2px;
}

.insights p {
  font-size: 12.5px;
  font-weight: 550;
}

/* ============ 我的 ============ */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.theme-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 11px 6px 9px;
  border-radius: 15px;
  border: 1.5px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.theme-item .sw {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.35);
  transition: transform 0.25s var(--ease);
}

.theme-item.on {
  color: var(--text);
  font-weight: 650;
  border-color: var(--brand-1);
  background: var(--surface);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-1) 18%, transparent);
}

.theme-item.on .sw {
  transform: scale(1.06);
}

.theme-item:active {
  transform: scale(0.96);
}

.budget-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.budget-row span {
  color: var(--muted);
  font-size: 13px;
}

.budget-row input {
  flex: 1;
  font-size: 18px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  min-width: 0;
}

.budget-row input::placeholder {
  font-weight: 400;
  font-size: 14px;
  color: var(--muted);
  opacity: 0.85;
}

.hint {
  margin-top: 9px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.rows {
  display: flex;
  flex-direction: column;
}

.rows .row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 2px;
  font-size: 13px;
  text-align: left;
  border-radius: 10px;
}

.rows .row + .row {
  border-top: 1px solid var(--line);
}

.rows .row:active {
  opacity: 0.65;
}

.row-ico {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 15px;
  background: var(--surface-2);
  flex: 0 0 auto;
}

.row-main {
  flex: 1;
  min-width: 0;
}

.row-main b {
  display: block;
  font-weight: 550;
  font-size: 13px;
}

.row-main small {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
}

.row .chev {
  color: var(--muted);
  font-size: 15px;
  opacity: 0.6;
}

.row.danger .row-main b {
  color: var(--bad);
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stat-cell {
  padding: 12px 8px;
  border-radius: 14px;
  background: var(--surface-2);
  text-align: center;
}

.stat-cell b {
  display: block;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}

.stat-cell span {
  display: block;
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
}

.footer {
  text-align: center;
  font-size: 10.5px;
  color: var(--muted);
  opacity: 0.75;
  padding: 8px 0 10px;
  line-height: 1.7;
}

/* ============ 记账弹层 ============ */
.sheet-layer {
  position: absolute;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.sheet-layer .backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 7, 16, 0.55);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.sheet-layer .sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 94%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.45);
  transform: translateY(104%);
  transition: transform 0.36s var(--ease);
  scrollbar-width: none;
}

.sheet-layer .sheet::-webkit-scrollbar {
  display: none;
}

.sheet-layer.open {
  pointer-events: auto;
}

.sheet-layer.open .backdrop {
  opacity: 1;
}

.sheet-layer.open .sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 38px;
  height: 4px;
  border-radius: 99px;
  background: var(--line);
  margin: 2px auto 12px;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 12px;
  background: var(--surface-2);
}

.seg button {
  padding: 7px 15px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--muted);
  transition: all 0.2s ease;
}

.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.sheet-head input[type="date"] {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 8px 9px;
  border-radius: 10px;
  max-width: 128px;
}

.text-btn {
  font-size: 12px;
  color: var(--bad);
  padding: 8px 6px;
  flex: 0 0 auto;
}

.amount-row {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 5px;
  padding: 12px 4px 9px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 10px;
}

.amount-row .cny {
  font-size: 19px;
  color: var(--muted);
  font-weight: 500;
}

#amountText {
  font-size: 40px;
  font-weight: 750;
  letter-spacing: -1.2px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  transition: color 0.2s;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#amountText.empty {
  color: var(--muted);
  opacity: 0.45;
}

.cat-scroll {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  margin: 0 -2px;
  scrollbar-width: none;
}

.cat-scroll::-webkit-scrollbar {
  display: none;
}

.cat-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  color: var(--muted);
  width: 52px;
  transition: color 0.2s;
}

.cat-chip .ico {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  font-size: 21px;
  border: 2px solid transparent;
  transition: transform 0.22s var(--ease), border-color 0.2s;
}

.cat-chip.on {
  color: var(--text);
  font-weight: 650;
}

.cat-chip.on .ico {
  transform: translateY(-2px);
}

.cat-chip:active .ico {
  transform: scale(0.92);
}

.meta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.note-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 13px;
  border-radius: 12px;
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.note-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.meta-row select {
  flex: 0 0 auto;
  height: 40px;
  padding: 0 10px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  appearance: none;
  -webkit-appearance: none;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-areas:
    "k7 k8 k9 kdel"
    "k4 k5 k6 kok"
    "k1 k2 k3 kok"
    "kdot k0 k00 kok";
  gap: 7px;
}

.key {
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  background: var(--surface-2);
  transition: transform 0.1s ease, background 0.15s ease;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.key:active {
  transform: scale(0.94);
  background: var(--line);
}

.key.del {
  font-size: 17px;
  color: var(--muted);
}

.key.ok {
  font-size: 14.5px;
  font-weight: 650;
  color: #fff;
  border-radius: 16px;
  background: linear-gradient(150deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 14px 28px -16px var(--brand-1);
}

.key.ok:active {
  background: linear-gradient(150deg, var(--brand-1), var(--brand-2));
  transform: scale(0.96);
  filter: brightness(0.94);
}

/* ============ 提示条 ============ */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 60;
  transform: translate(-50%, 12px);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--bg);
  background: var(--text);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.28s var(--ease);
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app:has(.sheet-layer.open) .toast {
  top: calc(env(safe-area-inset-top) + 22px);
  bottom: auto;
}

/* ============ 小屏适配 ============ */
@media (max-width: 380px) {
  .screen {
    padding-left: 14px;
    padding-right: 14px;
  }

  .hero-amount {
    font-size: 29px;
  }

  #amountText {
    font-size: 34px;
  }

  .key {
    height: 44px;
    font-size: 19px;
  }

  .cat-chip {
    width: 48px;
  }

  .cat-chip .ico {
    width: 42px;
    height: 42px;
    font-size: 19px;
  }

  .legend .lg-name {
    width: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   账号 / 登录注册 / 下拉刷新 / 邀请
   ============================================================ */

.app.auth .tabbar {
  display: none;
}

.app.auth .screen {
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 22px) 18px calc(env(safe-area-inset-bottom) + 26px);
}

.app.auth .screen > * {
  flex: 0 0 auto;
}

.auth {
  width: 100%;
  max-width: 380px;
  margin: auto;
}

.auth-brand {
  text-align: center;
  margin-bottom: 20px;
}

.auth-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 18px 38px -16px var(--brand-1);
}

.auth-brand h1 {
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -0.4px;
}

.auth-brand p {
  margin-top: 4px;
  font-size: 11.5px;
  letter-spacing: 1px;
  color: var(--muted);
}

.auth-card {
  padding: 16px;
  border-radius: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-tabs {
  display: flex;
  gap: 3px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 14px;
  background: var(--surface-2);
}

.auth-tabs button {
  flex: 1;
  height: 36px;
  border-radius: 11px;
  font-size: 13px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.auth-tabs button.on {
  background: var(--surface);
  color: var(--text);
  font-weight: 650;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.12);
}

.field {
  display: block;
  margin-bottom: 11px;
}

.field > span {
  display: block;
  margin: 0 2px 5px;
  font-size: 10.5px;
  color: var(--muted);
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.field input:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-1) 16%, transparent);
}

.auth-error {
  min-height: 16px;
  margin: 2px 2px 8px;
  font-size: 11px;
  line-height: 1.45;
  color: var(--bad);
}

.btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 14px;
  border: 0;
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 12px 26px -14px var(--brand-1);
  transition: transform 0.15s var(--ease), opacity 0.2s;
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-primary:disabled {
  opacity: 0.6;
}

.btn-ghost {
  width: 100%;
  height: 42px;
  margin-top: 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12.5px;
}

.auth-note {
  margin-top: 12px;
  font-size: 10.5px;
  line-height: 1.6;
  text-align: center;
  color: var(--muted);
}

.auth-themes {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.theme-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  opacity: 0.6;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.3);
  transition: transform 0.2s var(--ease), opacity 0.2s, box-shadow 0.2s;
}

.theme-dot.on {
  opacity: 1;
  transform: scale(1.12);
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--brand-1);
}

/* 启动 / 加载 */
.boot {
  margin: auto;
  width: 100%;
  max-width: 260px;
  text-align: center;
}

.boot .auth-logo {
  margin-bottom: 16px;
}

.boot-text {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.6;
}

.boot-spinner {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--brand-1);
  animation: spin 0.8s linear infinite;
}

.boot .btn-primary {
  margin-top: 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 下拉刷新指示 */
.pull-indicator {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 6px);
  left: 50%;
  z-index: 36;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -60px);
  transition: transform 0.25s var(--ease), opacity 0.2s;
  white-space: nowrap;
}

.pull-indicator.show {
  opacity: 1;
}

.pull-spinner {
  display: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--brand-1);
  animation: spin 0.8s linear infinite;
}

.pull-indicator.loading .pull-spinner {
  display: block;
}

/* 头部图标按钮 */
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.18s var(--ease), color 0.2s;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.icon-btn:active {
  transform: scale(0.92);
  color: var(--brand-1);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 账号 */
.account-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-lg {
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  border-radius: 15px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
  box-shadow: 0 10px 22px -12px var(--brand-1);
}

.account-main {
  flex: 1;
  min-width: 0;
}

.account-main b {
  display: block;
  font-size: 14px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.account-main small {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--muted);
}

/* 邀请 */
.invite-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 2px;
}

.invite-create {
  width: auto;
  height: 40px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 12.5px;
  box-shadow: 0 10px 22px -14px var(--brand-1);
}

.invite-actions .chip {
  height: 40px;
}

.invite-code {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 13px;
  border-radius: 13px;
  border: 1px dashed var(--line);
  background: var(--surface-2);
}

.invite-code code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 1.5px;
  word-break: break-all;
}

.invite-list {
  margin-top: 10px;
}

.invite-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
}

.invite-item + .invite-item {
  border-top: 1px solid var(--line);
}

.invite-status {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--muted);
}

.invite-status.active {
  background: var(--good);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 16%, transparent);
}

.invite-status.used {
  background: var(--brand-1);
}

.invite-status.expired {
  background: var(--line);
}

.invite-main {
  flex: 1;
  min-width: 0;
}

.invite-main b {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.invite-main small {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--muted);
}

.invite-item .text-btn {
  padding: 6px 4px;
  color: var(--bad);
  font-size: 11px;
}

/* 修改密码 */
.pwd-box summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.pwd-box summary::-webkit-details-marker {
  display: none;
}

.pwd-box summary::after {
  content: '›';
  color: var(--muted);
  font-size: 15px;
  transition: transform 0.2s var(--ease);
}

.pwd-box[open] summary::after {
  transform: rotate(90deg);
}

.pwd-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

.pwd-fields input {
  height: 44px;
  padding: 0 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
}

.pwd-fields input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.pwd-fields .primary-btn {
  width: 100%;
  height: 44px;
  font-size: 13px;
}

.chip:disabled,
.primary-btn:disabled {
  opacity: 0.55;
}

