
/* Layout: a deep-colour panel owns the top third (tabs, month, one enormous ultra-light figure, a comb of daily marks); its colour is the budget's mood (emerald, amber, oxblood) and savings get slate. Below it the paper is bare rows on whitespace. Entry happens in a full-screen composer with a custom keypad in the same deep colour. */
:root {
  --bg: #F3F5F2;
  --ink: #101311;
  --muted: #646C66;
  --faint: #8A918C;
  --line: #E0E4E1;
  --track: #E1E6E2;
  --chip: #E9EDEA;
  --accent: #1E6A58;
  --warn: #B26A12;
  --over: #B8372F;

  --p-spend: #0E3B31;
  --p-warn: #4A3411;
  --p-over: #4D1B1D;
  --p-save: #172C3B;
  --h-spend: #8EE6C6;
  --h-warn: #F2C27C;
  --h-over: #FF9F97;
  --h-save: #9FCDEB;
  --on: #F1F6F3;
  --on-mute: rgba(241, 246, 243, 0.68);
  --on-faint: rgba(241, 246, 243, 0.5);

  --panel: var(--p-spend);
  --hi: var(--h-spend);
  --fabc: var(--p-spend);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}
html[data-panel="warn"] { --panel: var(--p-warn); --hi: var(--h-warn); }
html[data-panel="over"] { --panel: var(--p-over); --hi: var(--h-over); }
html[data-panel="save"] { --panel: var(--p-save); --hi: var(--h-save); }
html[data-tone="save"] { --fabc: var(--p-save); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #090B0A; --ink: #EDF1EE; --muted: #99A29C; --faint: #707972; --line: #1F2523; --track: #242A27; --chip: #171C1A;
    --accent: #5FC7A8; --warn: #E3A961; --over: #F0807A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #090B0A; --ink: #EDF1EE; --muted: #99A29C; --faint: #707972; --line: #1F2523; --track: #242A27; --chip: #171C1A;
  --accent: #5FC7A8; --warn: #E3A961; --over: #F0807A;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html.lock { overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  padding-block: 0 140px;
}
/* paint the status-bar band in the panel colour */
body::before {
  content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10;
  background: var(--panel); transition: background-color 0.5s ease;
}
.gut { padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
.col { max-width: 480px; margin: 0 auto; }
h1, h2, p, ul { margin: 0; }
button, input { font: inherit; color: inherit; }
button { appearance: none; cursor: pointer; }
input { border: 0; background: transparent; outline: none; min-width: 0; width: 100%; }
input::placeholder { color: var(--faint); opacity: 1; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; border-radius: 4px; }
input:focus-visible { outline: none; }
.muted { color: var(--muted); }

/* ===== panel ===== */
.panel {
  --ink: var(--on); --muted: var(--on-mute); --faint: var(--on-faint);
  color: var(--on);
  background-color: var(--panel);
  background-image: radial-gradient(130% 70% at 88% -12%, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0) 62%);
  border-radius: 0 0 38px 38px;
  padding-block: 10px 34px;
  transition: background-color 0.5s ease;
}
.top { display: flex; align-items: center; justify-content: space-between; }
.tabs { display: flex; align-items: baseline; gap: 24px; }
.tab { border: 0; background: none; padding: 8px 0; font-size: 22px; font-weight: 600; letter-spacing: 0.02em; color: var(--faint); }
.tab[aria-selected="true"] { color: var(--ink); }
.icon { border: 0; background: none; width: 44px; height: 44px; margin-right: -12px; display: grid; place-items: center; color: var(--ink); }
.month { display: flex; align-items: center; margin: 20px 0 0 -10px; }
.step { border: 0; background: none; width: 36px; height: 36px; font-size: 22px; line-height: 1; color: var(--muted); }
.step:disabled { opacity: 0.3; cursor: default; }
.m-label { font-size: 15px; font-weight: 600; padding: 0 4px; color: var(--ink); }
.hero { margin-top: 16px; }
.hero.pt { margin-top: 30px; }
.row2 { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; color: var(--muted); }
.row2.foot { margin-top: 22px; }
.big {
  display: block; white-space: nowrap; color: var(--ink);
  font-size: clamp(60px, 25vw, 108px); font-weight: 200; letter-spacing: -0.04em; line-height: 1.05; margin-top: 10px;
}
.big .cur { font-size: 0.3em; font-weight: 300; color: var(--muted); margin-right: 0.3em; position: relative; top: -1.55em; letter-spacing: 0; }
.big .fr { font-size: 0.36em; font-weight: 200; color: var(--muted); letter-spacing: 0; }
.linkb { border: 0; background: none; padding: 8px 0 8px 12px; margin: -8px 0; font-size: 15px; color: var(--muted); }
.setup { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 0; color: var(--ink); }
.setup .lbl { display: block; font-size: 15px; color: var(--muted); }
.setup .st { display: block; font-size: 44px; font-weight: 200; letter-spacing: -0.03em; margin-top: 10px; }
.setup .st i { font-style: normal; color: var(--faint); margin-left: 8px; }

/* comb of daily marks */
.ruler { display: flex; align-items: flex-end; justify-content: space-between; height: 48px; margin-top: 26px; }
.ruler i { display: block; width: 3px; border-radius: 2px; transform-origin: bottom; }
.ruler .past { background: var(--on); opacity: 0.55; }
.ruler .today { background: var(--hi); }
.ruler .future { background: var(--on); opacity: 0.2; }
.ruler.rise i { animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) backwards; }
@keyframes rise { from { transform: scaleY(0); } }

/* ===== paper ===== */
.content { margin-top: 36px; }
.dayh { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; color: var(--muted); margin: 30px 0 2px; }
.dayh:first-child { margin-top: 0; }
.rows { list-style: none; padding: 0; }
.rowb { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; width: 100%; text-align: left; border: 0; background: none; padding: 14px 0; font-size: 18px; }
.rowb .n { min-width: 0; overflow-wrap: anywhere; }
.rowb .a { flex: none; }
.rowx { text-align: right; padding: 0 0 8px; }
.empty { font-size: 16px; color: var(--muted); }
.demo { margin-top: 40px; font-size: 13px; color: var(--muted); }
.bar { display: block; height: 3px; background: var(--track); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width 0.3s ease; }
.fw + .fw { border-top: 1px solid var(--line); }
.fund { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 20px 0 6px; }
.fund .top2 { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.fund .fn { font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
.fund .fa { font-size: 24px; font-weight: 200; flex: none; }
.fund .bar { margin: 14px 0 6px; }
.fd { padding: 8px 0 20px; }
.fd .meta { font-size: 15px; color: var(--muted); }
.facts { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.flog { list-style: none; padding: 0; margin: 18px 0 0; font-size: 15px; color: var(--muted); }
.flog li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }

/* buttons */
.btn { border: 0; height: 50px; padding: 0 30px; border-radius: 999px; background: var(--ink); color: var(--bg); font-size: 17px; font-weight: 600; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.sm { height: 42px; padding: 0 22px; font-size: 15px; }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.wide { width: 100%; height: 56px; font-size: 18px; }
.tbtn { border: 0; background: none; padding: 10px 6px; font-size: 16px; color: var(--muted); }
.tbtn.danger, .lrow.danger { color: var(--over); }
.fab {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 5;
  bottom: calc(22px + env(safe-area-inset-bottom, 0px));
  height: 56px; padding: 0 30px; border: 0; border-radius: 999px;
  background: var(--fabc); color: var(--on); font-size: 17px; font-weight: 600; white-space: nowrap;
  box-shadow: 0 14px 30px -10px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  transition: background-color 0.4s ease;
}
.fab:active { transform: translateX(-50%) translateY(1px); }
.fade {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4; pointer-events: none;
  height: calc(120px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 0%, transparent), var(--bg) 62%);
}

/* ===== composer ===== */
.sheet {
  --sb: var(--p-spend); --hi: var(--h-spend);
  --bg: var(--sb); --ink: var(--on); --muted: var(--on-mute); --faint: var(--on-faint);
  --line: rgba(241, 246, 243, 0.2); --chip: rgba(241, 246, 243, 0.12); --over: #FF9F97;
  color-scheme: dark; color: var(--ink);
  position: fixed; inset: 0; z-index: 30; overflow-y: auto; display: flex; flex-direction: column;
  background-color: var(--sb);
  background-image: radial-gradient(130% 55% at 88% -10%, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 62%);
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  animation: up 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sheet[data-tone="save"] { --sb: var(--p-save); --hi: var(--h-save); }
@keyframes up { from { transform: translateY(36px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-in { flex: 1; display: flex; flex-direction: column; width: 100%; max-width: 480px; margin: 0 auto; min-height: 0; }
.sheet .btn { background: var(--hi); color: var(--sb); }
.sh-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.x { border: 0; background: none; width: 44px; height: 44px; margin-left: -12px; display: grid; place-items: center; color: var(--ink); }
.sh-t { font-size: 15px; color: var(--muted); margin-top: 18px; }
.sh-n { font-size: 15px; color: var(--muted); margin-top: 10px; }
.sh-big { font-size: 30px; font-weight: 200; letter-spacing: -0.02em; margin-top: 12px; }
.amt-disp { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; margin-top: 16px; }
.amt-disp .cur { font-size: 28px; font-weight: 300; color: var(--muted); }
.amt-num { display: block; font-size: 88px; font-weight: 200; letter-spacing: -0.04em; line-height: 1.1; min-width: 0; }
.amt-num.empty { color: var(--faint); }
.line { display: flex; align-items: baseline; gap: 8px; border-bottom: 1px solid var(--line); margin-top: 14px; }
.line:focus-within { border-bottom-color: var(--ink); }
.line .c { font-size: 22px; color: var(--muted); font-weight: 300; }
.line input { font-size: 22px; height: 56px; }
.line.big-in input { font-size: 32px; font-weight: 300; height: 72px; }
.spacer { flex: 1; min-height: 16px; }
.chips { display: flex; gap: 8px; overflow-x: auto; margin-top: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 0; background: var(--chip); border-radius: 999px; padding: 8px 18px; font-size: 16px; }
.sh-top input[type="date"] { width: auto; height: 40px; border-radius: 999px; background: var(--chip); padding: 0 14px; font-size: 16px; }
.sh-top input[type="date"]:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.act { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px; }
.act.end { justify-content: flex-end; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 6px; }
.key { border: 0; background: none; height: 66px; font-size: 32px; font-weight: 300; color: var(--ink); border-radius: 999px; display: grid; place-items: center; }
.key:active { background: var(--chip); }
.sheet.typing .pad, .sheet.typing .spacer { display: none; }
.list { margin-top: 10px; }
.lrow { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 20px 0; font-size: 19px; }
.lrow + .lrow { border-top: 1px solid var(--line); }
.lrow i { font-style: normal; color: var(--faint); }

.toast {
  position: fixed; left: 0; right: 0; z-index: 50; pointer-events: none; display: flex; justify-content: center;
  padding: 0 max(24px, env(safe-area-inset-right, 0px)) 0 max(24px, env(safe-area-inset-left, 0px));
}
.toast[data-pos="bottom"] { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
.toast[data-pos="top"] { top: calc(14px + env(safe-area-inset-top, 0px)); }
.toast span { background: var(--on); color: #101311; padding: 10px 18px; border-radius: 999px; font-size: 15px; max-width: 100%; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.4); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* Production layout, accessibility and composer adaptation. */
body { margin: 0; }
.panel { padding-top: calc(10px + env(safe-area-inset-top, 0px)); min-height: 240px; }
.panel .quiet { color: var(--on-mute); }
.local-note { margin: 40px 0 0; font-size: 12px; color: var(--faint); line-height: 1.8; }
.sheet { height: 100dvh; overscroll-behavior: contain; }
.sheet-in { min-height: 100%; }
#sheet-content { display: flex; flex: 1; min-height: 0; }
.composer { display: flex; flex-direction: column; width: 100%; flex: 1; margin: 0; }
#sheet-title { font-size: 16px; font-weight: 500; color: var(--muted); }
.header-spacer { width: 32px; }
.date-row { margin-top: 18px; }
.date-row .sh-n { margin: 0; }
.amt-disp { margin-top: 24px; }
.amount { width: 100%; font-size: 88px; font-weight: 200; letter-spacing: -0.04em; line-height: 1.1; padding: 0; height: 112px; border-radius: 0; caret-color: var(--hi); }
.amt-disp .cur { align-self: center; }
input { font-size: 16px; }
input:focus-visible { outline: 2px solid var(--hi, var(--accent)); outline-offset: 4px; }
.amount:focus-visible, .line input:focus-visible { outline: none; }
.sheet .btn { flex-shrink: 0; }
.sheet .pad { flex-shrink: 0; padding-top: 8px; }
.sheet .key { min-height: 44px; height: clamp(48px, 8.3dvh, 66px); }
.sheet.typing .spacer { display: block; min-height: 12px; }
.sheet.typing .wide { margin-top: 20px; }
#sheet .spacer { min-height: 24px; }
.field-label { margin-top: 28px; font-size: 14px; color: var(--muted); }
.field-label + .line { margin-top: 0; }
.record-label { font-size: 13px; color: var(--faint); margin-top: 22px; }
.flog { margin-top: 8px; }
.more-log { color: var(--muted); margin-top: 12px; font-size: 14px; }
.backup-note { margin-top: 40px; line-height: 1.8; }
.backup-warning { margin-top: 28px; font-size: 16px; color: var(--hi); }
.backup-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 24px; }
.fund .top2 { align-items: center; }
.fund .fa { font-size: clamp(18px, 5.8vw, 24px); overflow-wrap: anywhere; max-width: 65%; text-align: right; }
.chip { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.fab:disabled { opacity: .45; cursor: default; }
.row2 { flex-wrap: wrap; }
.rowb .a { font-size: clamp(15px, 4.6vw, 18px); }
body:has(.sheet:not([hidden]))::before { background: var(--p-spend); z-index: 31; }
body:has(.sheet[data-tone="save"]:not([hidden]))::before { background: var(--p-save); }
@media (min-width: 700px) { .panel { border-radius: 0 0 48px 48px; } .sheet { padding-inline: 36px; } }
@media (max-width: 350px) { .gut, .sheet { padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); } .row2 { font-size: 13px; gap: 6px; } .facts { gap: 8px; } .btn.sm { padding-inline: 18px; } }
