/* ================================================================
   記帳一下 · 黏土擬態風（Claymorphism）
   三條鐵律：三層立體陰影、超大圓角、按下去會被捏扁再彈回
   ================================================================ */

/* ── 設計代號（顏色、圓角、陰影都從這裡拿） ── */
:root {
  color-scheme: light;

  /* 8pt 間距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* 底色 */
  --bg-1: #f3ecff;
  --bg-2: #fef0f4;
  --surface: #fbf7ff;
  --surface-2: #fffaf6;

  /* 糖果色 */
  --candy-lav: #b9a6ff;
  --candy-peach: #ffb59e;
  --candy-mint: #9fe6c9;
  --candy-cream: #ffd98a;
  --candy-sky: #9cc9ff;

  /* 糖果色加深版（外影、底暗用） */
  --lav-deep: rgba(124, 99, 224, 0.4);
  --peach-deep: rgba(224, 122, 92, 0.4);
  --mint-deep: rgba(74, 184, 142, 0.4);
  --cream-deep: rgba(214, 160, 54, 0.4);

  /* 文字（對淺底都有達到清楚可讀的對比） */
  --text-1: #4a3f63;
  --text-2: #6b5f86;
  --text-on-accent: #ffffff;

  /* 強調色 */
  --accent: #ff7a8a;
  --accent-strong: #8b5cf6;
  --accent-soft: #ffe3e7;
  --accent-strong-soft: #ece2ff;

  /* 狀態色（永遠搭配圖示和文字，不只靠顏色） */
  --ok-bg: #dcf6ea;
  --ok-text: #1f6b4c;
  --warn-bg: #fff1cc;
  --warn-text: #7a5300;
  --err-bg: #ffe3e7;
  --err-text: #a3243a;

  /* 圖表用色（已用色盲模擬檢查：淺色、深色都通過） */
  --viz-sky: #2a78d6;
  --viz-peach: #eb6834;
  --viz-mint: #1baf7a;
  --viz-cream: #eda100;
  --viz-rose: #e87ba4;
  --viz-lav: #4a3aa7;
  --viz-other: #b3adc2;
  --viz-track: #ece6f7;

  /* 黏土材質 */
  --hi: rgba(255, 255, 255, 0.7);
  --shade: rgba(124, 99, 224, 0.16);
  --drop: rgba(124, 99, 224, 0.18);

  /* 圓角（最小 16px，不准直角） */
  --radius-lg: 36px;
  --radius-md: 28px;
  --radius-sm: 22px;
  --radius-pill: 999px;

  /* 三層立體陰影：外柔影 + 頂亮 + 底暗 */
  --clay:
    0 12px 24px var(--drop),
    0 4px 8px rgba(124, 99, 224, 0.1),
    inset 0 3px 4px var(--hi),
    inset 0 -6px 10px var(--shade);
  --clay-sm:
    0 6px 14px rgba(124, 99, 224, 0.16),
    inset 0 2px 3px var(--hi),
    inset 0 -4px 7px rgba(124, 99, 224, 0.14);
  --clay-inset:
    inset 0 4px 8px rgba(124, 99, 224, 0.24),
    inset 0 -2px 3px var(--hi);
  --clay-press:
    0 4px 8px rgba(124, 99, 224, 0.16),
    inset 0 2px 5px rgba(124, 99, 224, 0.22),
    inset 0 -2px 3px var(--hi);

  /* 字體（圓潤、偏粗） */
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, -apple-system,
    "Segoe UI", sans-serif;

  /* 動效（軟糖回彈） */
  --ease: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 130ms;
  --dur: 220ms;

  /* iPhone 瀏海和底部橫條 */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 72px;
}

/* ── 深色模式：夜晚的黏土（跟隨手機設定） ── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg-1: #1c1729;
    --bg-2: #241a2c;
    --surface: #2b2440;
    --surface-2: #322a48;
    --candy-lav: #7d68d9;
    --candy-peach: #d9826a;
    --candy-mint: #4fa585;
    --candy-cream: #c79a3e;
    --candy-sky: #5b8fd1;
    --text-1: #f3eeff;
    --text-2: #c9bfe3;
    --accent-soft: #4a2733;
    --accent-strong-soft: #3b2d66;
    --ok-bg: #1d3d31;
    --ok-text: #a6f0cf;
    --warn-bg: #43361a;
    --warn-text: #ffe29a;
    --err-bg: #4a2230;
    --err-text: #ffc2cc;
    --viz-sky: #3987e5;
    --viz-peach: #d95926;
    --viz-mint: #199e70;
    --viz-cream: #c98500;
    --viz-rose: #d55181;
    --viz-lav: #9085e9;
    --viz-other: #6b6385;
    --viz-track: #3a3252;
    --hi: rgba(255, 255, 255, 0.1);
    --shade: rgba(0, 0, 0, 0.35);
    --drop: rgba(0, 0, 0, 0.45);
    --clay:
      0 12px 24px var(--drop),
      0 4px 8px rgba(0, 0, 0, 0.3),
      inset 0 3px 4px var(--hi),
      inset 0 -6px 10px var(--shade);
    --clay-sm:
      0 6px 14px rgba(0, 0, 0, 0.4),
      inset 0 2px 3px var(--hi),
      inset 0 -4px 7px rgba(0, 0, 0, 0.3);
    --clay-inset:
      inset 0 4px 8px rgba(0, 0, 0, 0.45),
      inset 0 -2px 3px var(--hi);
    --clay-press:
      0 4px 8px rgba(0, 0, 0, 0.35),
      inset 0 2px 5px rgba(0, 0, 0, 0.4),
      inset 0 -2px 3px var(--hi);
  }
}

/* ── 基本設定 ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font);
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1.55;
  color: var(--text-1);
  background: linear-gradient(160deg, var(--bg-1), var(--bg-2)) fixed;
  background-color: var(--bg-1);
}

h1,
h2,
p {
  margin: 0;
}

img {
  display: block;
}

button {
  font: inherit;
  color: inherit;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 3px;
}

/* ── 黏土元件：吹氣膨起 ── */
.clay {
  background: var(--surface);
  border-radius: var(--radius-md);
  box-shadow: var(--clay);
}

.clay--sm {
  box-shadow: var(--clay-sm);
}

.clay--lav {
  background:
    radial-gradient(80% 70% at 25% 15%, var(--hi), transparent 60%),
    linear-gradient(150deg, var(--candy-lav), var(--candy-sky));
  box-shadow:
    0 14px 26px var(--lav-deep),
    inset 0 4px 6px var(--hi),
    inset 0 -8px 14px var(--lav-deep);
}

.clay--mint {
  background: linear-gradient(150deg, var(--candy-mint), var(--candy-sky));
  box-shadow: 0 6px 12px var(--mint-deep), inset 0 3px 4px var(--hi), inset 0 -5px 8px var(--mint-deep);
}

.clay--peach {
  background: linear-gradient(150deg, var(--candy-peach), var(--candy-cream));
  box-shadow: 0 6px 12px var(--peach-deep), inset 0 3px 4px var(--hi), inset 0 -5px 8px var(--peach-deep);
}

.clay--cream {
  background: linear-gradient(150deg, var(--candy-cream), var(--candy-peach));
  box-shadow: 0 6px 12px var(--cream-deep), inset 0 3px 4px var(--hi), inset 0 -5px 8px var(--cream-deep);
}

/* ── 按鈕：按下去被捏扁，放開彈回來 ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-height: 52px;
  padding: 0 var(--space-6);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease-soft),
    opacity var(--dur);
}

.btn:active:not(:disabled) {
  transform: scale(0.94);
  box-shadow: var(--clay-press);
}

.btn:disabled {
  opacity: 0.6;
  cursor: progress;
}

.btn-block {
  width: 100%;
}

.btn-primary {
  color: var(--text-on-accent);
  background:
    radial-gradient(80% 60% at 30% 25%, rgba(255, 255, 255, 0.35), transparent 60%),
    var(--accent-strong);
  box-shadow:
    0 12px 22px rgba(139, 92, 246, 0.42),
    inset 0 3px 5px rgba(255, 255, 255, 0.45),
    inset 0 -6px 10px rgba(90, 50, 180, 0.4);
}

.btn-soft {
  background: var(--surface);
  color: var(--text-1);
  box-shadow: var(--clay);
}

.btn-google {
  width: 100%;
  min-height: 60px;
  background: var(--surface-2);
  color: var(--text-1);
  box-shadow: var(--clay);
}

.g-logo {
  flex: none;
}

/* ── 提示框：圖示 + 文字 + 顏色一起 ── */
.notice {
  display: flex;
  gap: var(--space-2);
  align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: 15px;
  text-align: left;
  box-shadow: var(--clay-inset);
}

.notice--info {
  background: var(--accent-strong-soft);
  color: var(--text-1);
}

.notice--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.notice--warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.notice--error {
  background: var(--err-bg);
  color: var(--err-text);
}

.pill {
  display: inline-block;
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--accent-strong-soft);
  color: var(--text-1);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--clay-inset);
}

/* ── 啟動畫面（JS 還沒載入時） ── */
.boot {
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: var(--space-4);
}

.boot-ball {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background:
    radial-gradient(70% 60% at 35% 28%, rgba(255, 255, 255, 0.7), transparent 60%),
    var(--candy-lav);
  box-shadow: var(--clay);
  animation: squish 1.1s var(--ease-soft) infinite alternate;
}

.boot-text {
  color: var(--text-2);
  font-weight: 700;
}

@keyframes squish {
  from {
    transform: scale(1, 1);
  }
  to {
    transform: scale(1.08, 0.9);
  }
}

.noscript {
  padding: var(--space-6);
  text-align: center;
}

/* ── 登入頁 ── */
.login {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: calc(var(--space-6) + var(--safe-top)) var(--space-4) calc(var(--space-6) + var(--safe-bottom));
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.login-logo {
  width: 112px;
  height: 112px;
  border-radius: 30px;
  filter: drop-shadow(0 12px 18px var(--lav-deep));
  animation: float 3.2s var(--ease-soft) infinite alternate;
}

@keyframes float {
  to {
    transform: translateY(-6px);
  }
}

.login-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
}

.login-sub {
  color: var(--text-2);
  font-size: 16px;
  margin-bottom: var(--space-4);
}

.login-foot {
  color: var(--text-2);
  font-size: 14px;
}

/* ── 主畫面骨架 ── */
.shell {
  min-height: 100dvh;
}

.content {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--space-6) + var(--safe-top)) var(--space-4)
    calc(var(--nav-h) + 110px + var(--safe-bottom));
}

/* ── 導航：手機底部懸浮膠囊 ── */
.nav {
  position: fixed;
  z-index: 20;
  left: var(--space-3);
  right: var(--space-3);
  bottom: calc(var(--space-3) + var(--safe-bottom));
  height: var(--nav-h);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 0 var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--clay);
}

.nav-brand {
  display: none;
}

.nav-tab {
  flex: 1;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 700;
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease-soft),
    background var(--dur);
}

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

.nav-tab[aria-current="page"] {
  color: var(--accent-strong);
  background: var(--accent-strong-soft);
  box-shadow: var(--clay-inset);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-tab[aria-current="page"] {
    color: #d9ccff;
  }
}

@media (prefers-color-scheme: dark) {
  /* 深色模式的糖果色比較深，大卡上的字改成白色才看得清楚 */
  :root:not([data-theme="light"]) .hero {
    color: #ffffff;
  }
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

/* ── 電腦版：導航放左邊 ── */
@media (min-width: 900px) {
  .nav {
    top: var(--space-4);
    bottom: var(--space-4);
    left: var(--space-4);
    right: auto;
    width: 220px;
    height: auto;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-5) var(--space-3);
  }

  .nav-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0 var(--space-2) var(--space-4);
    font-size: 20px;
    font-weight: 800;
  }

  .nav-brand img {
    border-radius: 12px;
  }

  .nav-tab {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    padding: 0 var(--space-4);
    font-size: 16px;
  }

  .content {
    margin-left: 260px;
    margin-right: auto;
    padding: var(--space-8) var(--space-8) 120px;
    max-width: 720px;
  }
}

/* ── 頁面共用 ── */
.page {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.page-head {
  margin-bottom: var(--space-2);
}

.page-kicker {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 700;
}

.page-title {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.section-title {
  margin-top: var(--space-4);
  font-size: 18px;
  font-weight: 800;
}

.card {
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.card-text {
  color: var(--text-2);
  font-size: 15px;
}

/* 首頁大卡 */
.hero {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  color: #2e2545;
}

.hero-ball {
  flex: none;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  background:
    radial-gradient(70% 60% at 35% 28%, rgba(255, 255, 255, 0.85), transparent 60%),
    var(--surface-2);
  box-shadow:
    0 8px 16px rgba(60, 40, 120, 0.3),
    inset 0 3px 4px rgba(255, 255, 255, 0.8),
    inset 0 -5px 8px rgba(124, 99, 224, 0.25);
}

.hero-title {
  font-size: 20px;
  font-weight: 800;
}

.hero-text {
  font-size: 15px;
  font-weight: 600;
}

/* 開發進度清單 */
.roadmap {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.roadmap li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  font-weight: 700;
}

.roadmap em {
  margin-left: auto;
  font-style: normal;
  font-size: 13px;
  color: var(--text-2);
}

.chip-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #2e2545;
}

/* 沒資料 / 還沒做好 */
.empty {
  padding: var(--space-8) var(--space-6);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.empty-ball {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 40px;
  background: var(--accent-strong-soft);
  box-shadow: var(--clay-inset);
  margin-bottom: var(--space-2);
}

.empty-title {
  font-size: 20px;
  font-weight: 800;
}

.empty-text {
  color: var(--text-2);
  max-width: 28em;
}

/* 設定頁 */
.profile {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
}

.avatar {
  flex: none;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: var(--clay-sm);
}

.avatar--letter {
  display: grid;
  place-items: center;
  font-size: 26px;
  font-weight: 800;
  color: #2e2545;
  background:
    radial-gradient(70% 60% at 35% 28%, rgba(255, 255, 255, 0.7), transparent 60%),
    var(--candy-mint);
}

.profile-text {
  min-width: 0;
}

.profile-name {
  font-size: 18px;
  font-weight: 800;
}

.profile-mail {
  color: var(--text-2);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.version {
  margin-top: var(--space-6);
  text-align: center;
  color: var(--text-2);
  font-size: 13px;
}

/* ── 金額數字：等寬對齊 ── */
.money {
  font-variant-numeric: tabular-nums;
}

.clay--sky {
  background: linear-gradient(150deg, var(--candy-sky), var(--candy-mint));
  box-shadow: 0 6px 12px rgba(74, 138, 214, 0.4), inset 0 3px 4px var(--hi), inset 0 -5px 8px rgba(74, 138, 214, 0.4);
}

.link {
  color: var(--accent-strong);
  font-weight: 700;
  text-decoration: none;
  padding: var(--space-2) 0;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .link {
    color: #cbb8ff;
  }
}

.back {
  display: inline-block;
  margin-bottom: var(--space-2);
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: var(--space-4);
}

.section-head .section-title {
  margin-top: 0;
}

.page .skeleton {
  padding: 0;
}

/* ── 淨資產大卡 ── */
.worth {
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  color: #2e2545;
}

.worth-label {
  font-size: 15px;
  font-weight: 700;
}

.worth-value {
  font-size: 38px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  margin: var(--space-1) 0 var(--space-3);
  word-break: break-all;
}

.worth-split {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  font-size: 14px;
  font-weight: 600;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .worth {
    color: #ffffff;
  }
}

/* ── 帳戶清單 ── */
.acc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.acc-row {
  display: flex;
  align-items: center;
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: transform var(--dur-fast) var(--ease);
}

.acc-row:has(.acc-main:active) {
  transform: scale(0.97);
}

.acc-row.is-archived {
  opacity: 0.72;
}

.acc-main {
  flex: 1;
  min-width: 0;
  min-height: 72px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
}

.acc-ball {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.acc-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.acc-name {
  font-size: 17px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-note {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-bal {
  flex: none;
  font-size: 17px;
  font-weight: 800;
  text-align: right;
}

.acc-bal.is-debt {
  color: var(--err-text);
  font-size: 15px;
}

.acc-bal.is-warn {
  color: var(--warn-text);
}

.sort-btns {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding-right: var(--space-3);
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  box-shadow: var(--clay-sm);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease);
}

.sort-btns .icon-btn {
  width: 44px;
  height: 32px;
  border-radius: var(--radius-pill);
  font-size: 12px;
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.9);
  box-shadow: var(--clay-press);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── 彈出面板 ── */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(40, 30, 70, 0.35);
  animation: fade-in var(--dur) var(--ease-soft);
}

.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding-bottom: var(--safe-bottom);
  animation: sheet-up 280ms var(--ease);
  outline: none;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-5) var(--space-3);
}

.sheet-title {
  font-size: 22px;
  font-weight: 800;
}

.sheet-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-2) var(--space-5) var(--space-6);
}

@media (min-width: 900px) {
  .sheet-backdrop {
    align-items: center;
  }

  .sheet {
    border-radius: var(--radius-lg);
    max-height: 86dvh;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-up {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}

/* ── 表單 ── */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.field-label {
  display: block;
  font-size: 15px;
  font-weight: 800;
  padding: 0;
  margin-bottom: var(--space-2);
}

label.field .field-label {
  margin-bottom: 0;
}

.field-hint {
  display: block;
  font-size: 13px;
  color: var(--text-2);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.input {
  width: 100%;
  min-height: 52px;
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  box-shadow: var(--clay-inset);
  outline: none;
}

.input::placeholder {
  color: var(--text-2);
  opacity: 0.7;
  font-weight: 500;
}

.input:focus-visible {
  outline: 3px solid var(--accent-strong);
  outline-offset: 2px;
}

.money-input {
  position: relative;
  display: block;
}

.money-input > span {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  color: var(--text-2);
}

.money-input .input {
  padding-left: 34px;
  font-size: 22px;
}

/* 選擇按鈕：沒選是凸的，選到變成凹進去 */
.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: var(--space-2);
}

.choice,
.seg-btn,
.icon-choice {
  min-height: 48px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-1);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  box-shadow: var(--clay-sm);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease-soft),
    background var(--dur);
}

.choice:active,
.seg-btn:active,
.icon-choice:active {
  transform: scale(0.94);
}

.choice[aria-pressed="true"],
.seg-btn[aria-pressed="true"],
.icon-choice[aria-pressed="true"] {
  background: var(--accent-strong-soft);
  box-shadow: var(--clay-inset);
  color: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .choice[aria-pressed="true"],
  :root:not([data-theme="light"]) .seg-btn[aria-pressed="true"] {
    color: #e2d8ff;
  }
}

.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: var(--space-2);
}

.icon-choice {
  aspect-ratio: 1;
  min-height: 48px;
  border-radius: 50%;
  font-size: 22px;
  padding: 0;
}

.icon-input {
  grid-column: span 2;
  min-height: 48px;
  text-align: center;
  font-size: 18px;
}

/* 收起來的「更多」區塊 */
.more {
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--clay-sm);
  padding: var(--space-3) var(--space-4);
}

.more > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.more > summary::-webkit-details-marker {
  display: none;
}

.more > summary::after {
  content: "▾";
  margin-left: auto;
  transition: transform var(--dur) var(--ease-soft);
}

.more[open] > summary::after {
  transform: rotate(180deg);
}

.more[open] {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding-bottom: var(--space-4);
}

/* 開關：凹槽 + 凸起的圓把手 */
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  cursor: pointer;
}

.switch-row .field-label {
  margin-bottom: 0;
}

.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 60px;
  height: 36px;
  margin: 0;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
  cursor: pointer;
  transition: background var(--dur);
}

.switch::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(70% 60% at 35% 30%, #ffffff, #e9e1ff);
  box-shadow: var(--clay-sm);
  transition: transform var(--dur) var(--ease);
}

.switch:checked {
  background: var(--accent-strong-soft);
}

.switch:checked::after {
  transform: translateX(24px);
  background: radial-gradient(70% 60% at 35% 30%, #c4a8ff, var(--accent-strong));
}

.danger-zone {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding-top: var(--space-5);
  border-top: 2px dashed var(--accent-strong-soft);
}

.confirm {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.btn-text {
  background: none;
  color: var(--err-text);
  min-height: 44px;
  font-size: 15px;
}

.btn-danger {
  color: #ffffff;
  background:
    radial-gradient(80% 60% at 30% 25%, rgba(255, 255, 255, 0.3), transparent 60%),
    #d63a55;
  box-shadow:
    0 10px 20px rgba(214, 58, 85, 0.35),
    inset 0 3px 5px rgba(255, 255, 255, 0.35),
    inset 0 -6px 10px rgba(140, 20, 45, 0.4);
}

/* ── 分類與標籤 ── */
.clay--rose {
  background: linear-gradient(150deg, #ffadc6, var(--candy-peach));
  box-shadow: 0 6px 12px rgba(224, 92, 132, 0.4), inset 0 3px 4px var(--hi), inset 0 -5px 8px rgba(224, 92, 132, 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .clay--rose {
    background: linear-gradient(150deg, #c9607f, var(--candy-peach));
  }
}

.seg--3 {
  grid-template-columns: repeat(3, 1fr);
}

.link-row {
  text-decoration: none;
  color: inherit;
}

.chevron {
  font-size: 26px;
  font-weight: 800;
  color: var(--text-2);
  padding-right: var(--space-1);
}

.cat-preview {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  box-shadow: var(--clay-inset);
  background: var(--surface-2);
}

.cat-ball {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
}

.cat-preview-name {
  font-size: 20px;
  font-weight: 800;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-2);
}

.color-choice {
  aspect-ratio: 1;
  min-height: 44px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  font-weight: 800;
  color: #2e2545;
  transition: transform var(--dur-fast) var(--ease);
}

.color-choice:active {
  transform: scale(0.9);
}

.color-choice[aria-pressed="true"] {
  outline: 3px solid var(--accent-strong);
  outline-offset: 3px;
}

.tag-cloud {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.tag-chip {
  min-height: 44px;
  padding: 0 var(--space-5);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-1);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--clay-sm);
  transition: transform var(--dur-fast) var(--ease);
}

.tag-chip:active {
  transform: scale(0.94);
  box-shadow: var(--clay-press);
}

.tag-input {
  position: relative;
  display: block;
}

.tag-input > span {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  font-weight: 800;
  color: var(--text-2);
}

.tag-input .input {
  padding-left: 34px;
}

/* ── 收入 / 支出 顏色（一定搭配 + / − 符號） ── */
.is-income {
  color: var(--ok-text);
}

.is-expense {
  color: var(--err-text);
}

/* ── 右下角的 ＋ 記帳按鈕：一顆大軟糖球 ── */
.fab {
  position: fixed;
  z-index: 30;
  right: var(--space-5);
  bottom: calc(var(--nav-h) + var(--space-3) + var(--space-5) + var(--safe-bottom));
  width: 68px;
  height: 68px;
  border: none;
  border-radius: 50%;
  color: #ffffff;
  font-size: 36px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  background:
    radial-gradient(70% 60% at 35% 28%, rgba(255, 255, 255, 0.55), transparent 60%),
    var(--accent-strong);
  box-shadow:
    0 14px 26px rgba(139, 92, 246, 0.45),
    0 6px 10px rgba(139, 92, 246, 0.3),
    inset 0 4px 6px rgba(255, 255, 255, 0.5),
    inset 0 -8px 12px rgba(90, 50, 180, 0.45);
  transition:
    transform var(--dur-fast) var(--ease),
    box-shadow var(--dur) var(--ease-soft);
}

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

@media (min-width: 900px) {
  .fab {
    right: var(--space-8);
    bottom: var(--space-8);
  }
}

/* ── 月份卡 ── */
.month-card {
  gap: var(--space-3);
  padding: var(--space-4);
}

.month-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.month-label {
  flex: 1;
  min-height: 44px;
  border: none;
  background: none;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.2;
}

.month-back {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-strong);
}

.sum-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}

.sum-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-3) var(--space-1);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
  min-width: 0;
}

.sum-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.sum-value {
  font-size: 17px;
  font-weight: 800;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-align: center;
}

/* ── 交易清單 ── */
.day {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 0 var(--space-2);
  margin-top: var(--space-2);
}

.day-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-2);
}

.day-sum {
  display: flex;
  gap: var(--space-3);
  font-size: 14px;
  font-weight: 800;
}

.tx-list {
  list-style: none;
  margin: 0;
  padding: var(--space-1) 0;
  border-radius: var(--radius-md);
}

.tx-row + .tx-row {
  border-top: 1.5px dashed var(--accent-strong-soft);
}

.tx-main {
  width: 100%;
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: transform var(--dur-fast) var(--ease);
}

.tx-main:active {
  transform: scale(0.97);
}

.tx-ball {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.tx-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tx-title {
  font-size: 16px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-note {
  font-weight: 600;
  color: var(--text-2);
}

.tx-sub {
  font-size: 13px;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tx-amount {
  flex: none;
  font-size: 17px;
  font-weight: 800;
}

/* ── 快速記帳視窗 ── */
.sheet--entry {
  height: 96dvh;
  max-height: 96dvh;
}

.sheet--entry .sheet-head {
  padding: var(--space-4) var(--space-5) var(--space-2);
}

.sheet--entry .sheet-body {
  flex: 1;
  min-height: 0;
}

@media (min-width: 900px) {
  .sheet--entry {
    height: min(860px, 94dvh);
  }
}

.sheet-foot {
  flex: none;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 2px dashed var(--accent-strong-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.entry {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.amount-box {
  position: sticky;
  top: calc(-1 * var(--space-2));
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-height: 76px;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
}

.amount-expr {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
}

.amount-kind {
  font-size: 14px;
  font-weight: 700;
  color: var(--ok-text);
}

.amount-big {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
  overflow-wrap: anywhere;
  text-align: right;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.cat-choice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-1);
  min-height: 70px;
  border: none;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-1);
  cursor: pointer;
  transition:
    transform var(--dur-fast) var(--ease),
    background var(--dur);
}

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

.cat-choice[aria-pressed="true"] {
  background: var(--accent-strong-soft);
  box-shadow: var(--clay-inset);
}

.cat-ball-sm {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 22px;
}

.cat-name {
  font-size: 13px;
  font-weight: 700;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) var(--space-1) var(--space-2);
  margin: 0 calc(-1 * var(--space-1));
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
  display: none;
}

.chip-row--wrap {
  flex-wrap: wrap;
  overflow: visible;
}

.chip {
  flex: none;
  min-height: 44px;
  padding: 0 var(--space-4);
  white-space: nowrap;
}

.more-dot {
  margin-left: var(--space-2);
  color: var(--accent-strong);
  font-size: 10px;
}

/* 自製數字鍵盤：每顆都是小軟糖 */
.keypad {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2);
}

.key {
  min-height: 46px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-1);
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  box-shadow: var(--clay-sm);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition:
    transform 90ms var(--ease),
    box-shadow var(--dur-fast) var(--ease-soft);
}

.key:active {
  transform: scale(0.92);
  box-shadow: var(--clay-press);
}

.key--op {
  background: var(--accent-strong-soft);
  color: var(--accent-strong);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .key--op {
    color: #e2d8ff;
  }

  :root:not([data-theme="light"]) .month-back {
    color: #cbb8ff;
  }
}

.entry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
}

.entry-actions.is-edit {
  grid-template-columns: 1fr;
}

.entry-actions .btn {
  padding: 0 var(--space-3);
  font-size: 16px;
}

/* Toast 的「復原」按鈕 */
.toast--action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  text-align: left;
  pointer-events: auto;
}

.toast-btn {
  flex: none;
  min-height: 40px;
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--accent-strong);
  color: #ffffff;
  font-weight: 800;
  cursor: pointer;
}

.diff-list {
  margin: var(--space-2) 0 0;
  padding-left: 1.2em;
}

/* ── 轉帳、退款 ── */
.is-transfer {
  color: var(--text-1);
}

.badge {
  display: inline-block;
  margin-left: var(--space-2);
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--ok-bg);
  color: var(--ok-text);
  font-size: 12px;
  font-weight: 800;
  vertical-align: 2px;
}

.transfer-arrow {
  text-align: center;
  font-size: 20px;
  color: var(--text-2);
  margin: calc(-1 * var(--space-2)) 0;
}

.chip:disabled {
  opacity: 0.35;
  cursor: default;
}

/* ── 統計 ── */
.filter-row {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-1) var(--space-1) var(--space-2);
  margin: 0 calc(-1 * var(--space-1));
  scrollbar-width: none;
  align-items: center;
}

.filter-row::-webkit-scrollbar {
  display: none;
}

.seg--inline {
  flex: none;
  display: flex;
  gap: var(--space-2);
}

.seg--inline .seg-btn {
  padding: 0 var(--space-4);
  white-space: nowrap;
}

.select {
  flex: none;
  min-height: 48px;
  padding: 0 var(--space-4);
  border: none;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-1);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  box-shadow: var(--clay-sm);
  cursor: pointer;
}

.btn-small {
  flex: none;
  min-height: 44px;
  padding: 0 var(--space-3);
  white-space: nowrap;
}

.stat-hero {
  gap: var(--space-1);
  text-align: center;
  align-items: center;
}

.stat-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
}

.stat-value {
  font-size: 40px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.stat-delta {
  font-size: 14px;
  color: var(--text-2);
}

/* 甜甜圈 */
.donut {
  position: relative;
  width: min(240px, 70vw);
  margin: 0 auto;
}

.donut svg {
  display: block;
  width: 100%;
  height: auto;
  transform: rotate(-90deg);
}

.donut-track {
  fill: none;
  stroke: var(--viz-track);
  stroke-width: 30;
}

.donut-seg {
  fill: none;
  stroke-width: 30;
  cursor: pointer;
  transition: opacity var(--dur);
}

.donut-seg.is-dim,
.bar.is-dim {
  opacity: 0.3;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}

.donut-icon {
  font-size: 22px;
}

.donut-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.donut-value {
  font-size: 20px;
  font-weight: 800;
}

/* 排行清單（分類、帳戶） */
.rank-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.rank-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.rank-ball {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.rank-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.rank-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
}

.rank-name {
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-amount {
  font-weight: 800;
}

.rank-track {
  display: block;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
  overflow: hidden;
}

.rank-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
}

.is-expense-fill {
  background: var(--viz-peach);
}

.is-income-fill {
  background: var(--viz-mint);
}

.rank-share {
  flex: none;
  width: 52px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

/* 長條圖 */
.bar-chart svg {
  display: block;
  width: 100%;
  height: auto;
}

.bar-tip {
  min-height: 24px;
  margin-bottom: var(--space-1);
  font-size: 15px;
  font-weight: 800;
  text-align: center;
}

.bar-open {
  min-height: 44px;
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-2);
}

.bar-tip--2 {
  min-height: 46px;
  line-height: 1.45;
}

.bar {
  transition: opacity var(--dur);
}

.bar.is-expense {
  fill: var(--viz-peach);
}

.bar.is-income {
  fill: var(--viz-mint);
}

.bar-hit {
  fill: transparent;
  cursor: pointer;
}

.bar-axis {
  stroke: var(--text-2);
  stroke-opacity: 0.35;
  stroke-width: 1;
}

.bar-grid {
  stroke: var(--text-2);
  stroke-opacity: 0.15;
  stroke-dasharray: 3 4;
}

.bar-label {
  fill: var(--text-2);
  font-size: 10px;
  font-weight: 700;
}

.table-view {
  margin-top: var(--space-2);
}

.table-view > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  cursor: pointer;
}

.table-view table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-view th,
.table-view td {
  padding: var(--space-1) var(--space-2);
  border-bottom: 1px dashed var(--accent-strong-soft);
  text-align: left;
  font-weight: 600;
}

.table-view td {
  text-align: right;
}

/* 收支總結 */
.summary-card {
  gap: var(--space-4);
}

.summary-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3);
}

.summary-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
  min-width: 0;
}

.summary-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.summary-value {
  font-size: 22px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.summary-net {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  text-align: center;
}

.summary-net-value {
  font-size: 34px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.spent-meter {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.spent-track {
  height: 14px;
}

.spent-text {
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.summary-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  text-align: center;
}

.summary-facts li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}

.summary-facts b {
  font-size: 16px;
  color: var(--text-1);
}

/* 細項標題 + 支出／收入切換 */
.detail-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* 圖例 */
.legend {
  list-style: none;
  margin: 0 0 var(--space-1);
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.is-now-swatch {
  height: 3px;
  width: 18px;
  border-radius: 2px;
  background: var(--viz-peach);
}

.is-prev-swatch {
  height: 0;
  width: 18px;
  border-radius: 0;
  border-top: 2px dashed var(--viz-other);
}

/* 折線圖 */
.line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.line.is-now {
  stroke: var(--viz-peach);
}

.line.is-prev {
  stroke: var(--viz-other);
  stroke-width: 2;
  stroke-dasharray: 5 5;
}

.line-dot {
  stroke: var(--surface);
  stroke-width: 2;
  pointer-events: none;
}

.line-dot.is-now {
  fill: var(--viz-peach);
}

.line-dot.is-prev {
  fill: var(--viz-other);
}

.line-cross {
  stroke: var(--text-2);
  stroke-opacity: 0.4;
  stroke-width: 1;
  pointer-events: none;
}

.table-view thead th,
.table-view thead td {
  font-size: 12px;
  color: var(--text-2);
}

/* 跟上一期比 */
.compare-list {
  list-style: none;
  margin: 0;
  gap: var(--space-3);
}

.compare-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 600;
}

.compare-arrow {
  margin-left: auto;
  font-size: 13px;
}

/* ── 骨架畫面 ── */
.skeleton {
  max-width: 640px;
  margin: 0 auto;
  padding: calc(var(--space-8) + var(--safe-top)) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.sk {
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--clay-inset);
  animation: pulse 1.2s ease-in-out infinite alternate;
}

.sk--title {
  width: 55%;
  height: 36px;
  border-radius: var(--radius-pill);
}

.sk--card {
  height: 96px;
}

@keyframes pulse {
  to {
    opacity: 0.55;
  }
}

/* ── Toast 提示 ── */
.toast-host {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: calc(var(--nav-h) + 110px + var(--safe-bottom));
  transform: translateX(-50%);
  width: min(92vw, 420px);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-1);
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  box-shadow: var(--clay);
  animation: pop-in var(--dur) var(--ease);
}

.toast--error {
  background: var(--err-bg);
  color: var(--err-text);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.85) translateY(8px);
  }
}

/* ── 離線小橫條 ── */
.offline-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  padding: calc(var(--space-2) + var(--safe-top)) var(--space-4) var(--space-2);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  box-shadow: var(--clay-sm);
}

/* ── 減少動態（手機有開「減少動態效果」時） ── */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ── 預算 ── */
.budget-track {
  display: block;
  height: 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
  overflow: hidden;
}

.budget-track.is-big {
  height: 18px;
}

.budget-fill {
  display: block;
  height: 100%;
  min-width: 6px;
  border-radius: var(--radius-pill);
  transition: width var(--dur) var(--ease);
}

.budget-fill.is-ok {
  background: var(--viz-mint);
}

.budget-fill.is-near {
  background: var(--viz-cream);
}

.budget-fill.is-over {
  background: #d93a50; /* 淺色、深色底都看得清楚的紅 */
}

.budget-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.budget-badge.is-ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.budget-badge.is-near {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.budget-badge.is-over {
  background: var(--err-bg);
  color: var(--err-text);
}

.budget-hero {
  gap: var(--space-3);
  text-align: center;
  align-items: center;
}

.budget-hero .budget-track,
.budget-hero .summary-facts {
  width: 100%;
}

.budget-left {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.budget-daily {
  font-size: 15px;
  font-weight: 600;
}

.budget-list {
  list-style: none;
  margin: 0;
  gap: var(--space-4);
}

.budget-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.budget-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.budget-left-small {
  flex: none;
  font-size: 14px;
  font-weight: 600;
}

.budget-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.budget-row.is-plain .rank-name {
  flex: 1;
}

.budget-plain-amount {
  font-weight: 800;
}

.budget-inputs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.budget-input-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.budget-input-name {
  flex: 1;
  min-width: 0;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.budget-input-row .money-input {
  flex: none;
  width: 44%;
}

/* 首頁的本月預算 */
.home-budget {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--accent-strong-soft);
  color: inherit;
  text-decoration: none;
}

.home-budget-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  font-size: 14px;
  font-weight: 600;
}

.home-budget .budget-badge {
  align-self: flex-start;
}

.home-budget-empty {
  align-self: center;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

/* ── 階段 8：明細的列表／月曆、搜尋、帳戶詳細 ── */
.page-head--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.page-head--back {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.page-head--back .icon-btn {
  flex: none;
  text-decoration: none;
  color: inherit;
}

.page-head--back .page-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.seg--4 {
  grid-template-columns: repeat(4, 1fr);
}

.range-label {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-align: center;
}

.search-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search-box > span {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.search-box .input {
  width: 100%;
  padding-left: 44px;
}

.filter-toggle {
  flex: none;
  white-space: nowrap;
}

.filter-panel {
  gap: var(--space-3);
}

.search-result {
  padding: 0 var(--space-2);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}

.empty-inline {
  padding: var(--space-3) var(--space-2);
  color: var(--text-2);
  font-weight: 600;
}

/* 月曆 */
.cal {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-wd {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--text-2);
  padding-bottom: 2px;
}

.cal-cell {
  min-width: 0;
  min-height: 56px;
  padding: 4px 2px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  cursor: pointer;
  transition: background var(--dur-fast), transform var(--dur-fast);
}

.cal-cell:active {
  transform: scale(0.95);
}

.cal-cell.is-blank {
  cursor: default;
}

.cal-day {
  font-size: 15px;
  font-weight: 800;
  line-height: 1.3;
}

.cal-cell.is-future .cal-day {
  color: var(--text-2);
  opacity: 0.7;
}

.cal-cell.is-today .cal-day {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cal-cell.is-picked {
  background: var(--accent-strong-soft);
  box-shadow: var(--clay-inset);
}

.cal-exp,
.cal-inc {
  max-width: 100%;
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.cal-exp {
  color: var(--err-text);
}

.cal-inc {
  color: var(--ok-text);
}

.cal-dot {
  color: var(--text-2);
  line-height: 1;
}

/* 帳戶詳細 */
.acc-hero {
  gap: var(--space-2);
  align-items: center;
  text-align: center;
}

.acc-hero-ball {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 30px;
}

.acc-hero-bal {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.5px;
}

.acc-credit {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.acc-credit-text {
  font-size: 14px;
  font-weight: 600;
}

.acc-hero .summary-facts {
  width: 100%;
  margin-top: var(--space-2);
}

.acc-hero-actions {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-top: var(--space-2);
}

.acc-hero-actions .btn {
  flex: 1 1 140px;
}

.page-head--back a.icon-btn {
  display: inline-grid;
  place-items: center;
  padding: 0;
  line-height: 1;
}

.filter-panel .filter-row {
  flex-wrap: wrap;
  overflow: visible;
  margin: 0;
  padding: 0;
}

/* ── 階段 9-1：定期交易、連續記帳 ── */
.page-intro {
  padding: 0 var(--space-2);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
}

.streak {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.streak.is-on {
  background: linear-gradient(135deg, var(--warn-bg), var(--accent-soft));
}

.streak-fire {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 26px;
  background: var(--surface-2);
  box-shadow: var(--clay-sm);
}

.streak-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.streak-title {
  font-weight: 800;
  font-size: 16px;
}

.streak-title b {
  font-size: 22px;
}

.streak-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.streak.is-on .streak-title,
.streak.is-on .streak-sub {
  color: var(--warn-text);
}

.pending-card {
  gap: var(--space-3);
}

.pending-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pending-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

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

.pending-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-2);
  font-weight: 800;
}

.pending-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.pending-actions {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.pending-card .section-head,
.pending-card .section-title {
  margin-top: 0;
}

/* ── 階段 9-2：代墊、存錢目標 ── */
.badge--warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.badge--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.reimburse-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-weight: 600;
}

.reimburse-box.is-done {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.reimburse-box .btn-small {
  align-self: flex-start;
}

.reimburse-box .field-label,
.reimburse-box .field-hint {
  color: inherit;
}

.goal-card {
  gap: var(--space-3);
}

.goal-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.goal-ball {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
}

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

.goal-sub {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
}

.budget-fill.is-goal {
  background: var(--viz-cream);
}

.goal-numbers {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
}

.goal-rate {
  font-weight: 800;
  color: var(--text-2);
}

.goal-status {
  font-size: 15px;
  font-weight: 600;
}

.goal-card.is-done .goal-status {
  color: var(--ok-text);
}

.goal-actions {
  display: flex;
  gap: var(--space-2);
}

.goal-actions .btn {
  flex: 1;
}

/* ── 階段 10：備份 ── */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.backup-card {
  gap: var(--space-3);
}

.import-counts {
  list-style: none;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.import-counts li {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
}

/* ── 階段 11：外觀設定、更新提示、錯誤畫面 ── */
.select--block {
  width: 100%;
  flex: 1 1 auto;
}

.update-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  padding: calc(var(--space-2) + var(--safe-top)) var(--space-4) var(--space-2);
  background: var(--accent-strong-soft);
  color: var(--text-1);
  font-weight: 800;
}

.empty-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: center;
  flex-wrap: wrap;
}

/* ── v1.1.0：使用說明 ── */
.page-head--home {
  position: relative;
}

.help-link {
  position: absolute;
  top: 0;
  right: 0;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--clay-sm);
  color: var(--text-1);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
}

.help-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-strong-soft), var(--accent-soft));
  color: inherit;
  text-decoration: none;
}

.help-banner-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--surface);
  box-shadow: var(--clay-sm);
}

.help-toc {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.help-chip {
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-1);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.help-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.help-topic {
  gap: var(--space-3);
  scroll-margin-top: var(--space-4);
}

.help-summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  list-style: none;
  cursor: pointer;
}

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

.help-icon {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
}

.help-title {
  flex: 1;
  font-size: 17px;
  font-weight: 800;
}

.help-arrow {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-2);
  transition: transform var(--dur);
}

.help-topic[open] .help-arrow {
  transform: rotate(90deg);
}

.help-where {
  font-size: 14px;
  color: var(--text-2);
}

.help-where b {
  color: var(--text-1);
}

.help-steps {
  margin: 0;
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  line-height: 1.6;
}

.help-tips {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
}

/* ════════════════════════════════════════════
   v1.2.0 介面重新設計（黏土風不變，更整齊、更有層次）
   ════════════════════════════════════════════ */

/* ── 自己畫的圖示 ── */
.ic {
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.ic-fill {
  fill: currentColor;
  fill-opacity: 0.28;
}

.ic-dot {
  fill: currentColor;
  stroke: none;
}

.ic-emoji {
  line-height: 1;
}

/* 文字旁邊的小圖示 */
.ic-inline {
  display: inline-block;
  vertical-align: -0.18em;
  margin-right: 3px;
}

/* 糖果球裡的圖示：用同色系的深色（比白色清楚） */
:root {
  --ink-peach: #b4532f;
  --ink-lav: #5a45c2;
  --ink-mint: #1d7a57;
  --ink-cream: #95620a;
  --ink-sky: #2b64b3;
  --ink-rose: #b3365f;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink-peach: #3d1407;
    --ink-lav: #1d1250;
    --ink-mint: #06301f;
    --ink-cream: #3a2500;
    --ink-sky: #0b2552;
    --ink-rose: #43061c;
  }
}

.clay--peach > .ic,
.clay--peach .ic-ink {
  color: var(--ink-peach);
}

.clay--lav > .ic {
  color: var(--ink-lav);
}

.clay--mint > .ic {
  color: var(--ink-mint);
}

.clay--cream > .ic {
  color: var(--ink-cream);
}

.clay--sky > .ic {
  color: var(--ink-sky);
}

.clay--rose > .ic {
  color: var(--ink-rose);
}

.empty-ball > .ic,
.streak-fire > .ic,
.help-icon > .ic {
  color: var(--accent-strong);
}

.streak.is-on .streak-fire > .ic {
  color: #ee6a2f;
}

.streak:not(.is-on) .streak-fire > .ic {
  color: var(--ok-text);
}

.mini-ball {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

/* ── 頁面進場：輕輕往上浮出來 ── */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page > * {
  animation: rise-in 360ms var(--ease-soft) both;
}

.page > *:nth-child(2) { animation-delay: 30ms; }
.page > *:nth-child(3) { animation-delay: 60ms; }
.page > *:nth-child(4) { animation-delay: 90ms; }
.page > *:nth-child(5) { animation-delay: 120ms; }
.page > *:nth-child(6) { animation-delay: 150ms; }
.page > *:nth-child(n + 7) { animation-delay: 180ms; }

/* 按下去：軟糖回彈 */
.btn,
.acc-tile,
.round-btn,
.worth-hero,
.home-budget,
.help-chip {
  transition:
    transform 180ms var(--ease),
    box-shadow var(--dur) var(--ease-soft),
    background var(--dur);
}

.btn:active,
.acc-tile:active,
.round-btn:active,
.home-budget:active,
.help-chip:active {
  transform: scale(0.96);
}

.worth-hero:active {
  transform: scale(0.98);
}

/* 手機有開「減少動態效果」就不要動畫 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}

/* ── 導航：圖示放在糖果球裡 ── */
.nav-icon {
  width: 40px;
  height: 32px;
  border-radius: var(--radius-pill);
  display: grid;
  place-items: center;
  transition:
    background var(--dur),
    transform 260ms var(--ease);
}

.nav-tab[aria-current="page"] {
  background: none;
  box-shadow: none;
}

.nav-tab[aria-current="page"] .nav-icon {
  background: linear-gradient(150deg, var(--candy-lav), #d8c8ff);
  color: #3d2a99;
  box-shadow:
    0 4px 10px rgba(124, 99, 224, 0.35),
    inset 0 2px 3px var(--hi),
    inset 0 -3px 5px rgba(90, 60, 190, 0.3);
  transform: translateY(-2px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav-tab[aria-current="page"] .nav-icon {
    background: linear-gradient(150deg, #8f7af0, #6a55d6);
    color: #f3eeff;
  }
}

@media (min-width: 900px) {
  .nav-tab[aria-current="page"] {
    background: var(--accent-strong-soft);
    box-shadow: var(--clay-inset);
  }
}

/* ── 首頁 ── */
.home-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.round-btn {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  color: var(--accent-strong);
  text-decoration: none;
}

/* 淨資產大卡：紫到桃的黏土、白字 */
.worth-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-6) var(--space-5) var(--space-5);
  border-radius: var(--radius-lg);
  color: #ffffff;
  text-decoration: none;
  background:
    radial-gradient(90% 80% at 20% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(140deg, #9d85ff 0%, #b79bff 45%, #ffa58c 100%);
  box-shadow:
    0 18px 34px rgba(124, 99, 224, 0.38),
    0 6px 12px rgba(124, 99, 224, 0.2),
    inset 0 4px 6px rgba(255, 255, 255, 0.55),
    inset 0 -10px 18px rgba(95, 60, 200, 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .worth-hero {
    background:
      radial-gradient(90% 80% at 20% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
      linear-gradient(140deg, #5d46c9 0%, #7a5fe0 45%, #c46a55 100%);
    box-shadow:
      0 18px 34px rgba(0, 0, 0, 0.5),
      inset 0 4px 6px rgba(255, 255, 255, 0.18),
      inset 0 -10px 18px rgba(0, 0, 0, 0.35);
  }
}

.wh-blob {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0.08) 70%);
  box-shadow: inset 0 -6px 12px rgba(95, 60, 200, 0.25);
}

.wh-blob--1 {
  width: 120px;
  height: 120px;
  right: -26px;
  top: -34px;
}

.wh-blob--2 {
  width: 56px;
  height: 56px;
  right: 74px;
  bottom: -18px;
  opacity: 0.8;
}

.wh-label {
  position: relative;
  font-size: 15px;
  font-weight: 700;
  opacity: 0.92;
}

.wh-value {
  position: relative;
  font-size: 44px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -1px;
  text-shadow: 0 2px 8px rgba(80, 40, 160, 0.3);
}

.wh-split {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}

.wh-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.5);
  font-size: 13px;
  font-weight: 700;
}

.wh-pill b {
  margin-left: 4px;
}

/* 本月收支卡：標題和月份切換放同一行 */
.month-card--home {
  gap: var(--space-3);
}

.month-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.section-title--flat {
  margin: 0;
}

.month-row .month-switch {
  gap: 2px;
}

.month-row .icon-btn {
  width: 36px;
  height: 36px;
}

.month-row .month-label {
  font-size: 15px;
  padding: 0 var(--space-1);
}

/* 預算：圓環 + 文字 */
.home-budget {
  display: flex;
  flex-direction: row;
  border-top: 0;
  color: inherit;
  text-decoration: none;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  box-shadow: var(--clay-inset);
}

.home-budget-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  font-size: 14px;
}

.home-budget-title {
  color: var(--text-2);
  font-weight: 700;
}

.home-budget-left {
  font-size: 16px;
  font-weight: 700;
}

.home-budget-left b {
  font-size: 18px;
}

.ring {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
}

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

.ring-track {
  fill: none;
  stroke: var(--viz-track);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 700ms var(--ease-soft);
}

.ring-fill.is-ok {
  stroke: var(--viz-mint);
}

.ring-fill.is-near {
  stroke: var(--viz-cream);
}

.ring-fill.is-over {
  stroke: #d93a50;
}

.ring-text {
  position: relative;
  font-size: 15px;
  font-weight: 800;
}

.ring-text small {
  font-size: 10px;
}

/* 帳戶：橫向滑動的小卡 */
.acc-rail {
  display: flex;
  gap: var(--space-3);
  overflow-x: auto;
  padding: var(--space-2) var(--space-4) var(--space-4);
  margin: calc(-1 * var(--space-2)) calc(-1 * var(--space-4)) calc(-1 * var(--space-2));
  scroll-snap-type: x proximity;
  /* 對齊時保留左邊的留白，第一張卡不會貼到螢幕邊 */
  scroll-padding-inline: var(--space-4);
  scrollbar-width: none;
}

.acc-rail::-webkit-scrollbar {
  display: none;
}

.acc-tile {
  flex: none;
  width: 138px;
  min-height: 132px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
  padding: var(--space-4);
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.acc-ball--sm {
  width: 42px;
  height: 42px;
  margin-bottom: var(--space-2);
}

.acc-tile-name {
  max-width: 100%;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-tile-bal {
  font-size: 17px;
  font-weight: 800;
}

.acc-tile-bal.is-debt {
  color: var(--err-text);
}

.acc-tile--add {
  justify-content: center;
  align-items: center;
  background: transparent;
  border: 2px dashed var(--accent-strong-soft);
  box-shadow: none;
  color: var(--accent-strong);
}

.acc-tile-plus {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
  background: var(--accent-strong-soft);
  box-shadow: var(--clay-inset);
}

.acc-tile--add .acc-tile-name {
  color: var(--accent-strong);
}

/* 本月收支三格：數字大一點、格子更軟 */
.sum-cell {
  gap: 2px;
  padding: var(--space-3) var(--space-1) var(--space-3);
}

.sum-value {
  font-size: 18px;
}

/* 最近記帳：清單更透氣 */
.tx-ball {
  width: 44px;
  height: 44px;
}

/* ── 記一筆：三下就記完（金額 → 分類 → 儲存），帳戶固定在鍵盤上面 ── */
.amount-box {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  column-gap: var(--space-3);
  min-height: 84px;
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-3);
}

.amount-cat {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.amount-cat .cat-ball-sm {
  width: 48px;
  height: 48px;
  animation: pop-in 320ms var(--ease);
}

.amount-cat-name {
  font-size: 15px;
  font-weight: 800;
  white-space: nowrap;
}

.amount-cat-name.is-empty {
  color: var(--text-2);
  font-weight: 700;
  font-size: 14px;
}

.amount-expr,
.amount-kind {
  flex-basis: 100%;
  text-align: right;
}

.amount-big {
  font-size: 38px;
}

@keyframes pop-in {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.cat-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: var(--space-1);
}

.cat-choice {
  min-height: 72px;
  padding: var(--space-2) 2px;
}

.cat-choice[aria-pressed="true"] .cat-ball-sm {
  transform: scale(1.08);
  box-shadow:
    0 0 0 3px var(--surface),
    0 0 0 6px var(--accent-strong),
    0 8px 14px rgba(124, 99, 224, 0.3);
}

.cat-ball-sm {
  transition: transform 220ms var(--ease), box-shadow var(--dur);
}

.key:active {
  transform: scale(0.9);
}

/* ── 統計：收支總結改成漸層大卡 ── */
.summary-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  color: #ffffff;
  background:
    radial-gradient(90% 80% at 15% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(140deg, #4cc39c 0%, #6fb4f2 55%, #9d85ff 100%);
  box-shadow:
    0 18px 34px rgba(76, 150, 190, 0.35),
    inset 0 4px 6px rgba(255, 255, 255, 0.5),
    inset 0 -10px 18px rgba(40, 90, 160, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .summary-hero {
    background:
      radial-gradient(90% 80% at 15% 0%, rgba(255, 255, 255, 0.15), transparent 60%),
      linear-gradient(140deg, #1f8a68 0%, #3b72b8 55%, #5d46c9 100%);
    box-shadow:
      0 18px 34px rgba(0, 0, 0, 0.5),
      inset 0 4px 6px rgba(255, 255, 255, 0.15),
      inset 0 -10px 18px rgba(0, 0, 0, 0.35);
  }
}

.summary-hero .summary-net {
  position: relative;
  align-items: flex-start;
  text-align: left;
}

.summary-hero .summary-label {
  color: inherit;
  opacity: 0.92;
}

.summary-hero .summary-net-value {
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: -1px;
  text-shadow: 0 2px 8px rgba(30, 60, 120, 0.3);
}

.summary-delta {
  font-size: 14px;
  font-weight: 700;
  opacity: 0.95;
}

.summary-hero .summary-cell {
  background: var(--surface);
  color: var(--text-1);
  box-shadow: var(--clay-sm);
}

.summary-hero .summary-cell .summary-label {
  color: var(--text-2);
  opacity: 1;
}

.spent-track {
  display: block;
  height: 12px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 2px 4px rgba(20, 50, 100, 0.25);
  overflow: hidden;
}

.spent-fill {
  display: block;
  height: 100%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, #ffd9a0, #ffffff);
  transition: width 700ms var(--ease-soft);
}

.summary-hero .spent-text {
  text-align: left;
}

.summary-hero .summary-facts li {
  color: rgba(255, 255, 255, 0.88);
}

.summary-hero .summary-facts b {
  color: #ffffff;
}

/* ── 預算：漸層大卡＋圓環 ── */
.budget-hero2 {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border-radius: var(--radius-lg);
  color: #ffffff;
  background:
    radial-gradient(90% 80% at 15% 0%, rgba(255, 255, 255, 0.35), transparent 60%),
    linear-gradient(140deg, #ffa58c 0%, #ff8fb1 50%, #b79bff 100%);
  box-shadow:
    0 18px 34px rgba(230, 110, 130, 0.35),
    inset 0 4px 6px rgba(255, 255, 255, 0.55),
    inset 0 -10px 18px rgba(170, 60, 110, 0.3);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .budget-hero2 {
    background:
      radial-gradient(90% 80% at 15% 0%, rgba(255, 255, 255, 0.15), transparent 60%),
      linear-gradient(140deg, #c4674f 0%, #b8466f 50%, #5d46c9 100%);
    box-shadow:
      0 18px 34px rgba(0, 0, 0, 0.5),
      inset 0 4px 6px rgba(255, 255, 255, 0.15),
      inset 0 -10px 18px rgba(0, 0, 0, 0.35);
  }
}

.bh-top {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.bh-ring {
  flex: none;
  display: grid;
  place-items: center;
  width: 108px;
  height: 108px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-1);
  box-shadow:
    0 8px 16px rgba(150, 50, 90, 0.25),
    inset 0 3px 5px rgba(255, 255, 255, 0.7),
    inset 0 -5px 10px rgba(120, 90, 200, 0.15);
}

.bh-ring .ring-text {
  font-size: 22px;
}

.bh-ring .ring-text small {
  font-size: 13px;
}

.bh-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.bh-value {
  font-size: 36px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 8px rgba(150, 40, 90, 0.3);
}

.budget-hero2 .budget-badge {
  box-shadow: var(--clay-sm);
}

.budget-hero2 .wh-split {
  margin-top: 0;
}

.bh-daily {
  position: relative;
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.45);
  font-size: 14px;
  font-weight: 700;
}

.search-box > .search-ic {
  display: grid;
  color: var(--text-2);
}

/* ── 挑圖示（分組） ── */
.icon-picker {
  display: grid;
  gap: var(--space-3);
  max-height: 340px;
  overflow-y: auto;
  padding: 4px 4px 8px;
  margin: 0 -4px;
  overscroll-behavior: contain;
}

.icon-group {
  display: grid;
  gap: var(--space-2);
}

.icon-group-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-2);
  position: sticky;
  top: -4px;
  z-index: 1;
  padding: 4px 2px;
  background: var(--surface);
}

.icon-choice {
  display: grid;
  place-items: center;
  color: var(--text-2);
}

.icon-choice[aria-pressed="true"] {
  color: var(--accent-strong);
}

.icon-custom {
  display: grid;
  grid-template-columns: 1fr 96px;
  align-items: center;
  gap: var(--space-2);
}

.icon-custom .icon-input {
  grid-column: auto;
}

/* ── 電腦版排版：內容置中、首頁分左右兩欄 ── */
.home-grid,
.home-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.home-col > .section-head:first-child .section-title {
  margin-top: 0;
}

@media (min-width: 900px) {
  .content {
    margin-left: 252px;
    margin-right: 0;
    max-width: none;
    padding: var(--space-8) var(--space-8) 120px;
  }

  .content > .page {
    max-width: 860px;
    margin-inline: auto;
  }

  .content > .page--home {
    max-width: 1200px;
  }

  /* 帳戶小卡：電腦版排成格子，不用左右滑 */
  .acc-rail {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .acc-rail .acc-tile {
    width: auto;
  }
}

@media (min-width: 1200px) {
  .home-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
    gap: var(--space-6);
  }

  .home-col > .section-head:first-child {
    margin-top: 0;
  }
}

/* ── 小提示視窗（記帳時忘了選東西） ── */
.alert-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  background: rgba(40, 30, 70, 0.45);
  animation: fade-in var(--dur) var(--ease-soft);
}

.alert {
  width: min(340px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-5) var(--space-5);
  border-radius: var(--radius-lg);
  text-align: center;
  animation: alert-pop 260ms var(--ease);
}

.alert-ball {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #b4532f;
  background: radial-gradient(circle at 35% 30%, #ffe1c8, #ffb48f);
  box-shadow:
    0 8px 16px rgba(230, 120, 80, 0.3),
    inset 0 3px 5px rgba(255, 255, 255, 0.7),
    inset 0 -5px 10px rgba(200, 90, 50, 0.25);
}

.alert-title {
  font-size: 20px;
  font-weight: 800;
}

.alert-msg {
  margin: 0 0 var(--space-2);
  color: var(--text-2);
  font-weight: 700;
}

@keyframes alert-pop {
  from {
    transform: scale(0.85);
    opacity: 0;
  }
}

/* 提示關掉後，缺少的那一項閃一下 */
.field-flash {
  animation: field-flash 1.2s var(--ease-soft);
  border-radius: var(--radius-md);
}

@keyframes field-flash {
  0%,
  60% {
    box-shadow: 0 0 0 4px rgba(255, 140, 100, 0.65);
  }
  100% {
    box-shadow: 0 0 0 4px rgba(255, 140, 100, 0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert,
  .field-flash {
    animation: none;
  }

  .field-flash {
    box-shadow: 0 0 0 4px rgba(255, 140, 100, 0.65);
  }
}

/* ── 記一筆：上面的金額區固定，下面捲動的東西不會跑到它上面 ── */
.sheet-top {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-1) var(--space-5) var(--space-3);
  border-bottom: 2px dashed var(--accent-strong-soft);
}

.sheet-top .amount-box {
  position: static;
}

.sheet--entry .sheet-body {
  padding-top: var(--space-4);
}

/* 比較矮的手機：記一筆上面、下面都縮小一點，中間留多一點空間捲動 */
@media (max-height: 780px) {
  .sheet-top {
    gap: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .sheet-top .seg-btn {
    min-height: 40px;
  }

  .sheet-top .amount-box {
    min-height: 64px;
  }

  .sheet--entry .keypad .key {
    min-height: 40px;
  }
}

/* ── 版本更新：上方橫條的按鈕、設定頁的卡片 ── */
.update-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.update-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-lg);
}

.update-card .acc-text {
  flex: 1;
  min-width: 0;
}

.update-card .btn {
  flex: none;
}

.update-card .acc-note {
  white-space: normal;
}

/* ==== BEGIN 手動深色（tools/gen-dark-css.py 自動產生，不要直接改）==== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-1: #1c1729;
  --bg-2: #241a2c;
  --surface: #2b2440;
  --surface-2: #322a48;
  --candy-lav: #7d68d9;
  --candy-peach: #d9826a;
  --candy-mint: #4fa585;
  --candy-cream: #c79a3e;
  --candy-sky: #5b8fd1;
  --text-1: #f3eeff;
  --text-2: #c9bfe3;
  --accent-soft: #4a2733;
  --accent-strong-soft: #3b2d66;
  --ok-bg: #1d3d31;
  --ok-text: #a6f0cf;
  --warn-bg: #43361a;
  --warn-text: #ffe29a;
  --err-bg: #4a2230;
  --err-text: #ffc2cc;
  --viz-sky: #3987e5;
  --viz-peach: #d95926;
  --viz-mint: #199e70;
  --viz-cream: #c98500;
  --viz-rose: #d55181;
  --viz-lav: #9085e9;
  --viz-other: #6b6385;
  --viz-track: #3a3252;
  --hi: rgba(255, 255, 255, 0.1);
  --shade: rgba(0, 0, 0, 0.35);
  --drop: rgba(0, 0, 0, 0.45);
  --clay:
    0 12px 24px var(--drop),
    0 4px 8px rgba(0, 0, 0, 0.3),
    inset 0 3px 4px var(--hi),
    inset 0 -6px 10px var(--shade);
  --clay-sm:
    0 6px 14px rgba(0, 0, 0, 0.4),
    inset 0 2px 3px var(--hi),
    inset 0 -4px 7px rgba(0, 0, 0, 0.3);
  --clay-inset:
    inset 0 4px 8px rgba(0, 0, 0, 0.45),
    inset 0 -2px 3px var(--hi);
  --clay-press:
    0 4px 8px rgba(0, 0, 0, 0.35),
    inset 0 2px 5px rgba(0, 0, 0, 0.4),
    inset 0 -2px 3px var(--hi);
}

:root[data-theme="dark"] .nav-tab[aria-current="page"] {
  color: #d9ccff;
}

/* 深色模式的糖果色比較深，大卡上的字改成白色才看得清楚 */
:root[data-theme="dark"] .hero {
  color: #ffffff;
}

:root[data-theme="dark"] .link {
  color: #cbb8ff;
}

:root[data-theme="dark"] .worth {
  color: #ffffff;
}

:root[data-theme="dark"] .choice[aria-pressed="true"],
:root[data-theme="dark"] .seg-btn[aria-pressed="true"] {
  color: #e2d8ff;
}

:root[data-theme="dark"] .clay--rose {
  background: linear-gradient(150deg, #c9607f, var(--candy-peach));
}

:root[data-theme="dark"] .key--op {
  color: #e2d8ff;
}

:root[data-theme="dark"] .month-back {
  color: #cbb8ff;
}

:root[data-theme="dark"] {
  --ink-peach: #3d1407;
  --ink-lav: #1d1250;
  --ink-mint: #06301f;
  --ink-cream: #3a2500;
  --ink-sky: #0b2552;
  --ink-rose: #43061c;
}

:root[data-theme="dark"] .nav-tab[aria-current="page"] .nav-icon {
  background: linear-gradient(150deg, #8f7af0, #6a55d6);
  color: #f3eeff;
}

:root[data-theme="dark"] .worth-hero {
  background:
    radial-gradient(90% 80% at 20% 0%, rgba(255, 255, 255, 0.18), transparent 60%),
    linear-gradient(140deg, #5d46c9 0%, #7a5fe0 45%, #c46a55 100%);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.5),
    inset 0 4px 6px rgba(255, 255, 255, 0.18),
    inset 0 -10px 18px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .summary-hero {
  background:
    radial-gradient(90% 80% at 15% 0%, rgba(255, 255, 255, 0.15), transparent 60%),
    linear-gradient(140deg, #1f8a68 0%, #3b72b8 55%, #5d46c9 100%);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.5),
    inset 0 4px 6px rgba(255, 255, 255, 0.15),
    inset 0 -10px 18px rgba(0, 0, 0, 0.35);
}

:root[data-theme="dark"] .budget-hero2 {
  background:
    radial-gradient(90% 80% at 15% 0%, rgba(255, 255, 255, 0.15), transparent 60%),
    linear-gradient(140deg, #c4674f 0%, #b8466f 50%, #5d46c9 100%);
  box-shadow:
    0 18px 34px rgba(0, 0, 0, 0.5),
    inset 0 4px 6px rgba(255, 255, 255, 0.15),
    inset 0 -10px 18px rgba(0, 0, 0, 0.35);
}
/* ==== END 手動深色 ==== */
