/*
  默认壁纸是 assets/bg/rose-window（雨窗玫瑰）。
  水中樱花是 sakura-water。设置里可以换，也可以上传自己的照片。
  纱罩浓淡由 --veil 控制（0 几乎没有，1 最浓）。
*/

:root {
  --veil: 0.38;
  --ink: #5c4a4f;
  --ink-soft: #8c7378;
  --gold: #d4b896;
  --sage: #6f8f7a;
  --berry: #a86b78;
  --cal-row: 54px;
  --glass-fill: linear-gradient(180deg, rgba(255, 255, 255, 0.34) 0%, rgba(255, 255, 255, 0.18) 100%);
  --hairline: rgba(255, 255, 255, 0.62);
  --shadow: 0 18px 44px rgba(176, 122, 130, 0.12), 0 2px 10px rgba(160, 110, 120, 0.05);
  --ease: cubic-bezier(0.22, 0.8, 0.3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
body {
  min-height: 100%;
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", serif;
  font-weight: 400;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input { font: inherit; color: inherit; }
button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
input { border: 0; background: transparent; }
img, svg { display: block; }
::selection { background: rgba(212, 184, 150, 0.35); }

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background-color: #f6e3e2;
  background-image:
    radial-gradient(ellipse 95% 58% at 8% -12%, #fdeef4 0%, rgba(253, 238, 244, 0) 62%),
    radial-gradient(ellipse 78% 52% at 112% -4%, #f2d1cb 0%, rgba(242, 209, 203, 0) 56%),
    radial-gradient(ellipse 86% 52% at 78% 112%, #efded9 0%, rgba(239, 222, 217, 0) 54%),
    linear-gradient(165deg, #fdeef4 0%, #f4d6d4 46%, #efded9 100%);
  background-size: cover;
  background-position: center;
}
.bg-photo,
.bg-veil {
  position: absolute;
  inset: 0;
}
.bg-photo {
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center center;
}
.bg[data-theme="rose"] .bg-photo {
  background-image: url("../assets/bg/rose-window.jpg");
  background-image: image-set(
    url("../assets/bg/rose-window.webp") type("image/webp"),
    url("../assets/bg/rose-window.jpg") type("image/jpeg")
  );
  background-position: center center;
}
.bg[data-theme="sakura"] .bg-photo {
  background-image: url("../assets/bg/sakura-water.jpg");
  background-image: image-set(
    url("../assets/bg/sakura-water.webp") type("image/webp"),
    url("../assets/bg/sakura-water.jpg") type("image/jpeg")
  );
  /* 竖屏会裁掉左右，花朵留在中间。 */
  background-position: center 42%;
}
.bg-veil {
  opacity: var(--veil, 0.38);
  pointer-events: none;
}
.bg[data-theme="rose"] .bg-veil,
.bg[data-theme="custom"] .bg-veil {
  background: linear-gradient(180deg, rgba(253, 236, 240, 0.94) 0%, rgba(244, 214, 210, 0.78) 100%);
}
/* 樱花的天是蓝的，纱罩用更暖的粉把它拢回来。 */
.bg[data-theme="sakura"] .bg-veil {
  background: linear-gradient(180deg, rgba(255, 198, 208, 0.96) 0%, rgba(244, 160, 176, 0.88) 58%, rgba(236, 186, 196, 0.74) 100%);
}
.bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.1;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.55'/></svg>");
  background-size: 180px 180px;
}

#app {
  width: min(480px, 100%);
  margin: 0 auto;
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding:
    calc(22px + env(safe-area-inset-top))
    18px
    calc(158px + env(safe-area-inset-bottom));
}

.num {
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
}
.amt-in { color: var(--sage); }
.amt-out { color: var(--berry); }
.ghost { color: rgba(140, 115, 120, 0.55); }

.glass {
  background: var(--glass-fill);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
  border: 0.5px solid var(--hairline);
  border-radius: 26px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    var(--shadow);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass { background: rgba(255, 248, 248, 0.78); }
}

.hero { padding: 6px 6px 0; }
.eyebrow {
  margin: 0 0 8px;
  font-family: "Jost", "Noto Serif SC", sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.28em;
  color: var(--ink-soft);
}
.eyebrow.latin { text-transform: uppercase; }
.hero-title {
  margin: 0;
  font-family: "Cormorant Garamond", "Noto Serif SC", serif;
  font-weight: 300;
  font-style: italic;
  font-size: clamp(60px, 17vw, 84px);
  line-height: 0.84;
  letter-spacing: -0.035em;
}
.hero-title.zh {
  font-family: "Noto Serif SC", serif;
  font-style: normal;
  font-weight: 400;
  font-size: 40px;
  letter-spacing: 0.12em;
  line-height: 1.15;
}
.hero-sub {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-weight: 300;
  letter-spacing: 0.18em;
  font-size: 13px;
}
.ornament {
  width: 28px;
  height: 0.5px;
  margin: 14px 0 16px;
  background: rgba(212, 184, 150, 0.95);
}

.calendar { padding: 16px 12px 12px; }
.cal-nav {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  margin-bottom: 4px;
}
.cal-title {
  text-align: center;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.18em;
}
.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 30px;
  line-height: 1;
  color: var(--ink-soft);
}
.cal-sum {
  margin: 0 0 10px;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 300;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 2px;
}
.weekdays span {
  text-align: center;
  font-weight: 300;
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.cal-body { overflow: hidden; transition: height 0.48s var(--ease); }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: var(--cal-row);
  transition: transform 0.48s var(--ease);
}
.day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  color: var(--ink);
}
.day.is-out { opacity: 0.38; }
.day.is-out.is-in-range,
.day.is-out.is-multi,
.day.is-out.is-selected { opacity: 0.82; }
.day-num {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  font-weight: 400;
  font-variant-numeric: lining-nums tabular-nums;
}
.day.is-today .day-num { box-shadow: inset 0 0 0 0.5px rgba(212, 184, 150, 0.95); }
.day.is-selected .day-num,
.day.is-multi .day-num {
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 6px 16px rgba(176, 122, 130, 0.1);
}
.day.is-today.is-selected .day-num,
.day.is-today.is-multi .day-num {
  box-shadow:
    inset 0 0 0 0.5px rgba(212, 184, 150, 0.95),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.day.is-in-range { background: rgba(255, 255, 255, 0.28); }
.day.is-range-start { border-radius: 18px 0 0 18px; }
.day.is-range-end { border-radius: 0 18px 18px 0; }
.day.is-range-start.is-range-end { border-radius: 18px; }
.dots { display: flex; gap: 3px; height: 4px; }
.dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  display: block;
}
.dots .in { background: var(--sage); }
.dots .out { background: var(--berry); }
.cal-tools {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 6px;
}
.cal-tools button {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.12em;
}
.cal-tools button.is-on {
  color: var(--ink);
  box-shadow: inset 0 -0.5px 0 var(--gold);
}
.hint {
  margin: 4px 0 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 300;
  letter-spacing: 0.04em;
}
.text-btn {
  display: block;
  margin: 4px auto 0;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.16em;
  font-weight: 300;
}

.day-panel { margin-top: 14px; padding: 18px 16px 8px; }
.day-head {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-bottom: 14px;
}
.day-big {
  margin: 0;
  font-size: 76px;
  font-weight: 300;
  line-height: 0.78;
  letter-spacing: -0.04em;
}
.day-kicker { margin: 0; font-size: 16px; letter-spacing: 0.14em; }
.day-week { margin: 2px 0 6px; color: var(--ink-soft); font-weight: 300; font-size: 13px; letter-spacing: 0.12em; }
.tri {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px 0 14px;
}
.tri .cell { text-align: center; min-width: 0; }
.tri .cell + .cell { box-shadow: inset 0.5px 0 0 rgba(255, 255, 255, 0.7); }
.tri .lbl {
  margin: 0;
  font-family: "Jost", "Noto Serif SC", sans-serif;
  font-weight: 300;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}
.tri .val { margin: 4px 0 0; font-size: 22px; font-weight: 400; letter-spacing: -0.02em; }
.record {
  width: 100%;
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 2px;
  text-align: left;
  border-top: 0.5px solid rgba(92, 74, 79, 0.08);
}
.record-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  color: var(--ink);
}
.record-icon svg { width: 20px; height: 20px; }
.record-main { min-width: 0; display: flex; flex-direction: column; }
.record-title {
  font-size: 15px;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.record-note {
  color: var(--ink-soft);
  font-weight: 300;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.record-side { text-align: right; }
.record-amt { font-size: 22px; font-weight: 400; line-height: 1; }
.flow-balance {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
}
.badge {
  font-family: "Jost", "Noto Serif SC", sans-serif;
  font-style: normal;
  font-weight: 300;
  font-size: 9px;
  letter-spacing: 0.14em;
  color: #a68b62;
  border: 0.5px solid rgba(212, 184, 150, 0.9);
  border-radius: 999px;
  padding: 1px 6px;
}
.empty {
  margin: 8px 0 16px;
  text-align: center;
  color: var(--ink-soft);
  font-weight: 300;
  letter-spacing: 0.12em;
  font-size: 13px;
}

.board-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.wallet-card {
  text-align: left;
  padding: 16px 14px 14px;
  min-height: 168px;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}
.wallet-card .eyebrow { margin-bottom: 4px; letter-spacing: 0.2em; }
.wallet-name { font-size: 18px; letter-spacing: 0.12em; }
.wallet-bal {
  margin: 10px 0 12px;
  font-size: 30px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
}
.pair {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 300;
  padding-top: 3px;
}
.pair .num { font-size: 16px; font-weight: 500; }

.detail-block { margin-top: 14px; padding: 16px 14px 8px; }
.section-title {
  margin: 4px 0 10px;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: 0.14em;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.08em;
  margin: 0 0 6px 4px;
}
.back-link svg { width: 18px; height: 18px; }
.seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.5);
}
.seg button {
  height: 34px;
  border-radius: 999px;
  color: var(--ink-soft);
  letter-spacing: 0.12em;
}
.seg button.is-on {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 4px 12px rgba(160, 110, 120, 0.08);
}
.seg.slim { margin: 0 0 12px; }
.cat-row {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr auto 16px;
  gap: 8px;
  align-items: center;
  padding: 10px 2px;
  text-align: left;
  border-top: 0.5px solid rgba(92, 74, 79, 0.08);
}
.cat-row .record-icon { width: 36px; height: 36px; }
.cat-row .record-icon svg { width: 18px; height: 18px; }
.cat-row .chev {
  width: 16px;
  height: 16px;
  display: grid;
  color: var(--ink-soft);
  transition: transform 0.3s var(--ease);
}
.cat-row .chev svg { width: 16px; height: 16px; }
.cat-row.is-open .chev { transform: rotate(90deg); }
.cat-children { padding: 0 0 6px 8px; }
.cat-children .record { padding-left: 0; }

.set-block { margin-bottom: 12px; padding: 16px 16px 14px; }
.set-block h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: 0.12em;
}
.lede {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-weight: 300;
  font-size: 13px;
  line-height: 1.7;
}
.balance-row, .add-row {
  display: grid;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 0.5px solid rgba(92, 74, 79, 0.08);
}
.balance-row { grid-template-columns: 76px 1fr; }
.add-row { grid-template-columns: 1fr auto; }
.balance-row input, .add-row input, .rename-input, .field input, .field textarea {
  width: 100%;
  font-size: 16px;
  padding: 8px 0;
  border-bottom: 0.5px solid rgba(92, 74, 79, 0.18);
  border-radius: 0;
}
.stack-btn { margin-top: 12px; }
.btn-primary, .btn-quiet, .btn-danger {
  width: 100%;
  height: 48px;
  border-radius: 999px;
  letter-spacing: 0.2em;
}
.btn-primary {
  background: rgba(255, 255, 255, 0.34);
  border: 0.5px solid rgba(255, 255, 255, 0.66);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85), 0 10px 24px rgba(176, 120, 128, 0.12);
}
.btn-quiet { color: var(--ink-soft); letter-spacing: 0.14em; }
.btn-danger { color: var(--berry); letter-spacing: 0.16em; }
.form-error {
  margin: 6px 0;
  text-align: center;
  color: var(--berry);
  font-size: 12px;
  font-weight: 300;
}
.bg-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.bg-card { position: relative; }
.bg-pick {
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  text-align: left;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.45);
}
.bg-pick.is-on {
  box-shadow: inset 0 0 0 1px rgba(212, 184, 150, 0.95), 0 8px 18px rgba(176, 122, 130, 0.12);
}
.bg-pick-pic {
  display: block;
  height: 108px;
  background-size: cover;
  background-repeat: no-repeat;
}
.bg-pick-pic.rose {
  background-image: url("../assets/bg/rose-window.jpg");
  background-image: image-set(
    url("../assets/bg/rose-window.webp") type("image/webp"),
    url("../assets/bg/rose-window.jpg") type("image/jpeg")
  );
  background-position: center center;
}
.bg-pick-pic.sakura {
  background-image: url("../assets/bg/sakura-water.jpg");
  background-image: image-set(
    url("../assets/bg/sakura-water.webp") type("image/webp"),
    url("../assets/bg/sakura-water.jpg") type("image/jpeg")
  );
  background-position: center 42%;
}
.bg-pick-pic img {
  width: 100%;
  height: 108px;
  object-fit: cover;
  object-position: center center;
}
.bg-pick-name {
  display: block;
  padding: 7px 10px 9px;
  font-size: 13px;
  letter-spacing: 0.08em;
}
.bg-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 248, 248, 0.72);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
  line-height: 1;
}
.veil-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 14px 0 4px;
  color: var(--ink-soft);
  font-size: 13px;
  letter-spacing: 0.08em;
}
.veil-row input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  margin: 0;
  border-radius: 99px;
  background: rgba(92, 74, 79, 0.22);
  accent-color: #d4b896;
}
.veil-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fbf6f2;
  box-shadow: inset 0 0 0 0.5px rgba(212, 184, 150, 0.95), 0 3px 8px rgba(176, 122, 130, 0.28);
}
.link-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-top: 0.5px solid rgba(92, 74, 79, 0.08);
  text-align: left;
  letter-spacing: 0.08em;
}
.link-row svg { width: 16px; height: 16px; color: var(--ink-soft); }
.cat-manage { padding: 8px 0; }
.cat-line {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 0.5px solid rgba(92, 74, 79, 0.08);
}
.cat-line svg { width: 18px; height: 18px; }
.mini {
  height: 30px;
  padding: 0 8px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.chart-card { margin-top: 14px; }
.chart-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 8px;
  align-items: center;
}
.donut { width: 150px; height: 150px; }
.donut-total {
  font-family: "Cormorant Garamond", serif;
  font-size: 16px;
  fill: var(--ink);
  font-variant-numeric: lining-nums tabular-nums;
}
.donut-caption {
  font-family: "Noto Serif SC", serif;
  font-size: 10px;
  letter-spacing: 0.18em;
  fill: var(--ink-soft);
}
.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 156px;
  overflow: auto;
}
.legend li {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 12px;
  font-weight: 300;
  padding: 2px 0;
}
.legend i { width: 6px; height: 6px; border-radius: 50%; }
.legend em {
  font-style: normal;
  font-family: "Cormorant Garamond", serif;
  font-size: 15px;
  font-variant-numeric: lining-nums tabular-nums;
}
.bars { width: 100%; height: auto; }
.bar-label {
  font-family: "Cormorant Garamond", serif;
  font-size: 10px;
  fill: var(--ink-soft);
}
.legend-note {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.08em;
}
.legend-note i {
  display: inline-block;
  width: 8px;
  height: 2px;
  margin-right: 5px;
  vertical-align: middle;
  border-radius: 2px;
}
.break-row {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 6px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 0.5px solid rgba(92, 74, 79, 0.08);
  font-size: 13px;
}
.break-row span:not(:first-child) { text-align: right; font-size: 16px; }

.dock {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(440px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 6px;
  border-radius: 28px;
}
.dock button {
  height: 54px;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--ink-soft);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.16em;
}
.dock button svg { width: 20px; height: 20px; }
.dock button.is-on {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.fab {
  position: fixed;
  z-index: 21;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  height: 46px;
  padding: 0 26px;
  border-radius: 999px;
  letter-spacing: 0.22em;
  font-size: 15px;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(92, 58, 66, 0.16);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.overlay.show { opacity: 1; }
.overlay.no-anim, .overlay.no-anim .sheet, .overlay.no-anim .modal { transition: none; }
.sheet {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: min(480px, 100%);
  border-radius: 28px 28px 0 0;
  padding: 8px 18px calc(16px + env(safe-area-inset-bottom));
  transform: translate(-50%, 104%);
  transition: transform 0.46s var(--ease);
  max-height: 92dvh;
}
.overlay.show .sheet { transform: translate(-50%, 0); }
.sheet.form {
  top: calc(8px + env(safe-area-inset-top));
  max-height: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sheet.page { overflow: auto; }
.sheet.tall {
  top: calc(8px + env(safe-area-inset-top));
  max-height: none;
}
.handle {
  width: 36px;
  height: 3px;
  border-radius: 99px;
  margin: 6px auto 8px;
  background: rgba(212, 184, 150, 0.85);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sheet-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: 0.14em;
}
.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ink-soft);
}
.icon-btn svg { width: 18px; height: 18px; }
.amount-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin: 12px 0 8px;
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
}
.amount-line .currency { font-size: 22px; color: var(--ink-soft); }
.sheet-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-bottom: 8px;
}
.meta-row {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  align-items: end;
}
.field-label {
  margin: 14px 0 8px;
  font-family: "Jost", "Noto Serif SC", sans-serif;
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
}
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  max-height: 112px;
  overflow: auto;
}
.cat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px 7px;
  border-radius: 18px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 0.02em;
}
.cat svg { width: 20px; height: 20px; }
.cat.is-on {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.38);
  box-shadow: inset 0 0 0 0.5px rgba(212, 184, 150, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.wallet-picks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.wallet-chip {
  height: 40px;
  border-radius: 999px;
  color: var(--ink-soft);
  letter-spacing: 0.1em;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.5);
}
.wallet-chip.is-on {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.4);
  box-shadow: inset 0 0 0 0.5px rgba(212, 184, 150, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.85);
}
.sheet-footer { padding-top: 6px; }
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}
.key {
  height: 44px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  font-family: "Cormorant Garamond", serif;
  font-size: 26px;
  font-variant-numeric: lining-nums tabular-nums;
  display: grid;
  place-items: center;
}
.key svg { width: 22px; height: 22px; }
.overlay.center {
  display: grid;
  place-items: center;
  padding: 24px 18px;
}
.modal {
  width: min(420px, 100%);
  padding: 26px 22px 20px;
  transform: translateY(16px);
  transition: transform 0.45s var(--ease);
}
.overlay.show .modal { transform: none; }
.modal-title {
  margin: 0 0 8px;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: 0.14em;
}
.sheet-detail { padding-bottom: 8px; }
.detail-amount {
  margin: 8px 0 4px;
  text-align: center;
  font-size: 48px;
  font-weight: 300;
  line-height: 1;
}

.toast {
  position: fixed;
  z-index: 60;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

:focus-visible {
  outline: 1px solid rgba(212, 184, 150, 0.95);
  outline-offset: 2px;
}

@media (max-height: 700px) {
  :root { --cal-row: 46px; }
  .hero-title { font-size: 54px; }
  .day-big { font-size: 60px; }
}

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