:root {
  color-scheme: light;
  --ink: #17251e;
  --muted: #68756d;
  --cream: #f5f0e7;
  --paper: #fffdf8;
  --green: #164f3a;
  --green-2: #247354;
  --mint: #dceade;
  --gold: #d9a441;
  --red: #a53f36;
  --line: rgba(23, 37, 30, .12);
  --shadow: 0 16px 45px rgba(32, 50, 41, .10);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--cream); }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 90% -5%, #e2eadb 0, transparent 34%), var(--cream); }
button, input, select { font: inherit; }
button { color: inherit; }
button, select { cursor: pointer; }
input, select { min-width: 0; }
.app-shell { width: min(100%, 640px); min-height: 100dvh; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 20px calc(104px + env(safe-area-inset-bottom)); }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.topbar h1 { margin: 2px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 28px; letter-spacing: -.7px; }
.eyebrow, .section-kicker { margin: 0; color: var(--green-2); font-size: 10px; line-height: 1.2; font-weight: 800; letter-spacing: 1.6px; }
.privacy-pill { display: flex; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 8px 11px; background: rgba(255,255,255,.52); color: var(--muted); font-size: 12px; }
.privacy-dot { width: 7px; height: 7px; border-radius: 50%; background: #45a274; box-shadow: 0 0 0 4px rgba(69,162,116,.12); }
.view { display: none; animation: reveal .22s ease; }
.view.is-active { display: block; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }
.month-row, .section-heading, .sheet-heading { display: flex; justify-content: space-between; align-items: center; }
.month-label { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.icon-button, .text-button, .close-button { border: 0; background: transparent; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; font-size: 22px; }
.text-button { padding: 8px 0; color: var(--green-2); font-weight: 700; }
.balance-card { overflow: hidden; position: relative; margin-top: 14px; border-radius: 28px; padding: 26px; background: linear-gradient(145deg, #123e2f, #1d6046); color: #fff; box-shadow: 0 20px 50px rgba(18,62,47,.24); }
.balance-card::after { content: ""; position: absolute; right: -35px; top: -55px; width: 160px; height: 160px; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; box-shadow: 0 0 0 34px rgba(255,255,255,.035); }
.balance-caption { margin: 0; color: rgba(255,255,255,.72); font-size: 13px; }
.balance-value { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 22px; }
.balance-value span { font-size: 25px; font-family: Georgia, serif; }
.balance-value strong { font-size: clamp(40px, 12vw, 58px); font-family: Georgia, serif; font-weight: 500; letter-spacing: -2px; }
.balance-meta { display: flex; gap: 20px; font-size: 13px; color: rgba(255,255,255,.72); }
.balance-meta b { color: white; }
.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 18px 0 30px; }
.quick-action { display: flex; align-items: center; gap: 11px; border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: rgba(255,255,255,.7); text-align: left; box-shadow: 0 8px 22px rgba(23,37,30,.04); }
.quick-action.primary { background: #e4ebd9; }
.quick-icon { display: grid; place-items: center; flex: 0 0 36px; height: 36px; border-radius: 13px; background: var(--green); color: white; font-size: 20px; }
.quick-action b, .quick-action small { display: block; }
.quick-action b { font-size: 14px; }
.quick-action small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.section-heading { margin: 26px 0 12px; }
.section-heading h2, .section-heading h3, .page-title h2, .panel h3 { margin: 5px 0 0; font-family: Georgia, "Songti SC", serif; }
.section-heading.compact { margin-top: 30px; }
.page-title { margin: 8px 0 20px; }
.page-title h2 { margin-top: 8px; font-size: 30px; }
.page-title p:last-child { margin: 8px 0 0; color: var(--muted); line-height: 1.6; font-size: 13px; }
.panel { border: 1px solid var(--line); border-radius: 22px; padding: 20px; background: rgba(255,253,248,.88); box-shadow: var(--shadow); }
.transaction-list, .preview-list, .history-list { display: grid; gap: 10px; }
.transaction { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 14px 2px; border-bottom: 1px solid var(--line); }
.transaction:last-child { border-bottom: 0; }
.transaction-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 15px; background: var(--mint); color: var(--green); font-weight: 800; }
.transaction-main { min-width: 0; }
.transaction-main b, .transaction-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transaction-main small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.reversal-button { margin: 8px 0 0; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; background: transparent; color: var(--muted); font-size: 10px; }
.reversal-button:disabled { opacity: .55; }
.transaction-amount { text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.transaction-amount.income { color: var(--green-2); }
.empty-state { padding: 34px 16px; border: 1px dashed var(--line); border-radius: 20px; color: var(--muted); text-align: center; line-height: 1.7; }
.filter-row, .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.filter-row { margin-bottom: 14px; }
label > span { display: block; margin: 0 0 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
input, select { width: 100%; min-height: 46px; border: 1px solid var(--line); border-radius: 13px; padding: 0 13px; background: rgba(255,255,255,.9); color: var(--ink); outline: none; }
input:focus, select:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(36,115,84,.12); }
.form-stack { display: grid; gap: 16px; }
.form-stack small, .supporting-text { color: var(--muted); line-height: 1.55; font-size: 11px; }
.file-picker { display: grid; place-items: center; min-height: 150px; border: 1px dashed rgba(22,79,58,.35); border-radius: 18px; background: #f2f5ed; text-align: center; }
.file-picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-picker span, .file-picker small { display: block; }
.file-picker .file-icon { margin-bottom: 8px; color: var(--green); font-size: 30px; }
.selected-file { margin: -4px 0 0; color: var(--green); font-size: 12px; text-align: center; overflow-wrap: anywhere; }
.button { min-height: 48px; border: 0; border-radius: 15px; padding: 0 18px; font-weight: 800; }
.primary-button { background: var(--green); color: white; box-shadow: 0 10px 22px rgba(22,79,58,.2); }
.secondary-button { border: 1px solid var(--line); background: white; }
.button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.preview-card { border: 1px solid var(--line); border-radius: 18px; padding: 15px; background: var(--paper); }
.preview-card.is-duplicate { opacity: .65; }
.preview-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.preview-top b { display: block; }
.preview-top small { display: block; margin-top: 5px; color: var(--muted); }
.preview-money { white-space: nowrap; font-weight: 800; }
.preview-card select { margin-top: 12px; }
.preview-card label { display: block; margin-top: 10px; }
.preview-card label > span { margin-bottom: -5px; }
.warning { margin: 10px 0 0; padding: 10px; border-radius: 10px; background: #fbefdd; color: #7b501c; font-size: 11px; line-height: 1.5; }
.error-note { color: var(--red); }
.acknowledgement { display: flex; align-items: flex-start; gap: 10px; margin-top: 14px; border: 1px solid #e5c79a; border-radius: 14px; padding: 13px; background: #fbefdd; }
.acknowledgement input { flex: 0 0 auto; width: 20px; min-height: 20px; margin: 1px 0 0; }
.acknowledgement span { margin: 0; color: #6f491b; line-height: 1.5; }
.sticky-action { position: sticky; bottom: calc(80px + env(safe-area-inset-bottom)); width: 100%; margin-top: 14px; z-index: 2; }
.history-list { margin-top: 24px; }
.history-card { padding: 14px 2px; border-top: 1px solid var(--line); }
.history-card b, .history-card small { display: block; }
.history-card small { margin-top: 5px; color: var(--muted); }
.storage-card { display: grid; gap: 15px; }
.settings .panel + .panel, [data-view="settings"] .panel + .panel { margin-top: 14px; }
.install-card ol { margin: 14px 0 0; padding-left: 22px; color: var(--muted); line-height: 1.8; font-size: 13px; }
.version-line { color: var(--muted); text-align: center; font-size: 11px; margin: 28px 0; }
.tabbar { position: fixed; left: 50%; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, 640px); transform: translateX(-50%); padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(23,37,30,.08); background: rgba(251,248,241,.92); backdrop-filter: blur(22px); }
.tab { display: grid; place-items: center; gap: 2px; min-height: 54px; border: 0; border-radius: 15px; background: transparent; color: #7b877f; }
.tab span { font-size: 22px; line-height: 1; }
.tab b { font-size: 10px; }
.tab.is-active { background: var(--mint); color: var(--green); }
.entry-dialog { width: min(100%, 640px); max-width: none; margin: auto auto 0; border: 0; padding: 0; background: transparent; }
.entry-dialog::backdrop { background: rgba(11,27,20,.45); backdrop-filter: blur(3px); }
.confirm-dialog { width: min(calc(100% - 36px), 430px); border: 0; border-radius: 24px; padding: 0; background: transparent; }
.confirm-dialog::backdrop { background: rgba(11,27,20,.45); backdrop-filter: blur(3px); }
.confirm-card { border-radius: 24px; padding: 24px; background: var(--cream); box-shadow: var(--shadow); }
.confirm-card h2 { margin: 7px 0 10px; font-family: Georgia, "Songti SC", serif; }
.confirm-card > p:not(.section-kicker) { color: var(--muted); line-height: 1.6; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.sheet-card { display: grid; gap: 16px; border-radius: 28px 28px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); background: var(--cream); box-shadow: 0 -20px 60px rgba(0,0,0,.16); }
.sheet-handle { width: 40px; height: 5px; margin: 0 auto 4px; border-radius: 99px; background: rgba(23,37,30,.18); }
.close-button { width: 38px; height: 38px; font-size: 28px; }
.entry-type { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; border-radius: 13px; padding: 4px; background: rgba(23,37,30,.07); }
.entry-type button { min-height: 38px; border: 0; border-radius: 10px; background: transparent; }
.entry-type button.is-active { background: white; color: var(--green); box-shadow: 0 3px 10px rgba(23,37,30,.08); font-weight: 800; }
.amount-input { display: flex; align-items: center; gap: 10px; }
.amount-input > span { margin: 0; color: var(--ink); font-family: Georgia, serif; font-size: 30px; }
.amount-input input { height: 72px; padding: 0; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-family: Georgia, serif; font-size: 44px; }
.amount-input input:focus { box-shadow: none; }
.toast { position: fixed; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 30; max-width: calc(100% - 40px); transform: translate(-50%, 18px); border-radius: 999px; padding: 11px 16px; background: #16271f; color: white; opacity: 0; pointer-events: none; transition: .2s ease; font-size: 12px; text-align: center; box-shadow: var(--shadow); }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
@media (min-width: 680px) { .app-shell { padding-left: 32px; padding-right: 32px; } .tabbar { border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
