/* Layout: one-hand phone ledger — sticky month bar, stacked cards, bottom tab bar with a center record button; home and tithe split into two columns at ≥ 920px */
:root {
  --bg: #F2F4F7;
  --card: #FFFFFF;
  --card-2: #F5F6F8;
  --line: #E4E7EC;
  --grid: #EEF0F3;
  --axis: #D0D5DD;
  --ink: #121926;
  --ink-2: #475467;
  --ink-3: #667085;
  --accent: #2563D9;
  --accent-ink: #FFFFFF;
  --accent-soft: #EAF1FF;
  --accent-deep: #1A4BB8;
  --accent-glow: rgba(37, 99, 217, .35);
  --gold: #F2B63D;
  --gold-ink: #8A5A00;
  --gold-soft: #FFF6E0;
  --gold-line: #E9C87E;
  --on-gold: #1A1204;
  --danger: #C93434;
  --danger-soft: #FDECEC;
  --good: #0F7B4B;
  --good-soft: #E4F4EC;
  --knob: #FFFFFF;
  --scrim: rgba(10, 14, 22, .45);
  --s-income: #2A78D6;
  --s-spend: #EB6834;
  --s-fixed: #4A3AA7;
  --s-offer: #EDA100;
  --track: #ECEEF2;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 20px rgba(16, 24, 40, .06);
  --font-ui: "IBM Plex Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --font-display: "Hahmlet", "Nanum Myeongjo", "AppleMyungjo", "Batang", serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0C0F14; --card: #161A22; --card-2: #1D222C; --line: #2A303B; --grid: #232833; --axis: #3A4150;
    --ink: #EEF1F6; --ink-2: #B4BCC8; --ink-3: #8B95A6;
    --accent: #6F9BFF; --accent-ink: #0C0F14; --accent-soft: #1A2744; --accent-deep: #4F7FE8; --accent-glow: rgba(111, 155, 255, .28);
    --gold: #F2B63D; --gold-ink: #F2B63D; --gold-soft: #2A2110; --gold-line: #5E4819; --on-gold: #1A1204;
    --danger: #E66767; --danger-soft: #3A1C1C; --good: #3CC98A; --good-soft: #10291F; --knob: #FFFFFF; --scrim: rgba(0, 0, 0, .6);
    --s-income: #3987E5; --s-spend: #D95926; --s-fixed: #9085E9; --s-offer: #C98500; --track: #242A35;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0C0F14; --card: #161A22; --card-2: #1D222C; --line: #2A303B; --grid: #232833; --axis: #3A4150;
  --ink: #EEF1F6; --ink-2: #B4BCC8; --ink-3: #8B95A6;
  --accent: #6F9BFF; --accent-ink: #0C0F14; --accent-soft: #1A2744; --accent-deep: #4F7FE8; --accent-glow: rgba(111, 155, 255, .28);
  --gold: #F2B63D; --gold-ink: #F2B63D; --gold-soft: #2A2110; --gold-line: #5E4819; --on-gold: #1A1204;
  --danger: #E66767; --danger-soft: #3A1C1C; --good: #3CC98A; --good-soft: #10291F; --knob: #FFFFFF; --scrim: rgba(0, 0, 0, .6);
  --s-income: #3987E5; --s-spend: #D95926; --s-fixed: #9085E9; --s-offer: #C98500; --track: #242A35;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .28);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
html.lock, html.lock body { overflow: hidden; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 15px/1.5 var(--font-ui);
  word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* shell */
.app { max-width: 560px; margin: 0 auto; padding-inline: 16px; padding-block: 0 calc(112px + env(safe-area-inset-bottom, 0px)); }
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 4px; height: calc(60px + env(safe-area-inset-top, 0px)); padding-top: env(safe-area-inset-top, 0px);
  margin-inline: -16px; padding-inline: 6px 12px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px);
}
.mswitch { display: flex; align-items: center; gap: 0; min-width: 0; }
.mswitch .month { display: flex; align-items: baseline; gap: 6px; padding: 6px 6px; border-radius: 10px; white-space: nowrap; }
.mswitch .month b { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.mswitch .month small { font-size: 13px; font-weight: 500; color: var(--ink-3); }
.top .grow { flex: 1; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); flex: none; }
.icon-btn:hover { background: var(--card); }
.icon-btn svg { width: 22px; height: 22px; }
.view { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.home-grid, .tithe-grid { display: flex; flex-direction: column; gap: 12px; }

/* cards */
.card { background: var(--card); border-radius: 20px; padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card-sub { font-size: 12.5px; color: var(--ink-3); }
.link { display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 500; color: var(--ink-3); white-space: nowrap; padding: 4px 0; }
.link svg { width: 14px; height: 14px; }
.link:hover { color: var(--ink); }

/* notes */
.note { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--card); font-size: 13.5px; color: var(--ink-2); }
.note.ex { background: var(--accent-soft); color: var(--ink); }
.note.warn { background: var(--danger-soft); color: var(--ink); }
.note p { min-width: 0; }
.note .btn { flex: none; }

/* hero */
.hero { padding: 22px 20px 20px; box-shadow: var(--shadow); }
.hero-label { font-size: 14px; font-weight: 500; color: var(--ink-2); }
.hero-num { font-size: clamp(34px, 10.4vw, 46px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.15; margin: 4px 0 6px; }
.hero-num .unit { font-size: .52em; font-weight: 600; letter-spacing: 0; margin-left: 3px; }
.hero-num.neg { color: var(--danger); }
.hero-sub { font-size: 13px; color: var(--ink-3); }
.flow { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; margin: 18px 0 16px; }
.flow i { display: block; height: 100%; min-width: 3px; }
.flow i:hover, .flow i:focus-visible { filter: brightness(1.08); outline: none; }
.sw-offer, .flow .offer { background: var(--s-offer); }
.sw-fixed, .flow .fixed { background: var(--s-fixed); }
.sw-spend, .flow .spend { background: var(--s-spend); }
.sw-income { background: var(--s-income); }
.sw-free, .flow .free { background: var(--track); }
.flow .plan { opacity: .42; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.legend li { min-width: 0; }
.legend .k { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); }
.sw { width: 10px; height: 10px; border-radius: 3px; flex: none; display: inline-block; }
.sw.free { box-shadow: inset 0 0 0 1px var(--axis); }
.legend .v { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; margin-top: 1px; }
.legend .n { font-size: 11.5px; color: var(--ink-3); }
.hero-empty { display: flex; flex-direction: column; gap: 14px; }
.hero-empty h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }

/* tiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tile:hover { box-shadow: var(--shadow); }
.t-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-2); }
.t-val { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.t-val.in { color: var(--accent); }
.t-note { font-size: 12px; color: var(--ink-3); }

/* envelope */
.envelope { position: relative; background: var(--gold-soft); border: 1px solid var(--gold-line); border-radius: 20px; padding: 16px 20px 20px; overflow: hidden; min-width: 0; }
.envelope .flap { position: absolute; left: 0; top: 0; width: 100%; height: 30px; pointer-events: none; }
.flap .f-fill { fill: var(--gold-line); opacity: .3; }
.flap .f-edge { fill: none; stroke: var(--gold-line); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.env-top { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 20px; }
.env-kicker { font-size: 12.5px; font-weight: 600; color: var(--gold-ink); letter-spacing: .02em; }
.env-title { font-family: var(--font-display); font-weight: 700; font-size: 23px; letter-spacing: -0.01em; line-height: 1.3; }
.env-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 2px 0 12px; }
.env-due { text-align: right; }
.env-due small { display: block; font-size: 12px; color: var(--ink-3); }
.env-due b { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.env-due b .unit { font-size: 15px; margin-left: 2px; }
.meter { height: 8px; border-radius: 4px; background: var(--card); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 4px; background: var(--s-offer); }
.env-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 8px; font-size: 12.5px; color: var(--ink-2); }
.env-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.env-actions .btn { flex: 1 1 auto; }
.env-lines { margin: 14px 0 4px; display: flex; flex-direction: column; }
.env-line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px dotted var(--gold-line); font-size: 14px; }
.env-line span { color: var(--ink-2); }
.env-line b { font-weight: 600; }
.env-line.total b { font-size: 18px; font-weight: 700; }
.env-foot { margin-top: 14px; font-size: 12px; color: var(--gold-ink); font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--card); color: var(--ink-2); white-space: nowrap; }
.pill svg { width: 13px; height: 13px; }
.pill.done { background: var(--good-soft); color: var(--good); }
.pill.left { background: var(--card); color: var(--gold-ink); }
.pill.over { background: var(--accent-soft); color: var(--accent); }

/* rows */
.rows { display: flex; flex-direction: column; }
.row { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 9px 0; border-radius: 12px; }
.row:hover .r-title { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.mono { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--ink-2); font-weight: 600; font-size: 15px; flex: none; }
.mono.in { background: var(--accent-soft); color: var(--accent); }
.mono.offer { background: var(--gold-soft); color: var(--gold-ink); }
.r-title { font-weight: 500; line-height: 1.35; }
.r-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 2px; font-size: 12.5px; color: var(--ink-3); }
.r-amt { font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.r-amt.in { color: var(--accent); }
.r-amt.offer { color: var(--gold-ink); }
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--card-2); color: var(--ink-2); }
.badge.gold { background: var(--gold-soft); color: var(--gold-ink); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }
.day { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 0 4px; margin-top: 4px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.day:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.day b { font-weight: 600; color: var(--ink-2); }

/* fixed */
.frow { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 6px; }
.frow + .frow { border-top: 1px solid var(--line); }
.frow-main { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 11px 0; width: 100%; }
.fday { text-align: center; line-height: 1.2; }
.fday b { display: block; font-size: 15px; font-weight: 600; }
.fday small { font-size: 11px; color: var(--ink-3); white-space: nowrap; }
.fday small.late { color: var(--danger); font-weight: 600; }
.fday small.soon { color: var(--gold-ink); font-weight: 600; }
.fname b { display: block; font-weight: 600; line-height: 1.35; }
.fname small { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.famt { font-weight: 600; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.check { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--axis); display: grid; place-items: center; color: transparent; justify-self: end; transition: background .15s, border-color .15s; }
.check svg { width: 18px; height: 18px; }
.check:hover { border-color: var(--accent); color: var(--accent); }
.check.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fsum { display: flex; flex-direction: column; gap: 10px; }
.fsum-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.fsum-top b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.fsum-top b .unit { font-size: 15px; margin-left: 2px; }
.stack { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.stack i { display: block; height: 100%; min-width: 3px; background: var(--s-fixed); }
.stack i.plan { opacity: .3; }
.fsum-meta { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); }
.templates { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }

/* category bars */
.cbar { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 10px; align-items: center; padding: 6px 0; border-radius: 10px; width: 100%; }
.cbar > span:last-child, .row > span:nth-child(2) { display: block; min-width: 0; }
.cbar-track, .r-title { display: block; }
.cbar .mono { width: 32px; height: 32px; font-size: 13px; }
.cbar-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 14px; }
.cbar-top .pct { font-size: 12px; color: var(--ink-3); margin-left: 6px; font-variant-numeric: tabular-nums; }
.cbar-top b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cbar-track { height: 8px; border-radius: 4px; background: var(--track); margin-top: 5px; overflow: hidden; }
.cbar-track i { display: block; height: 100%; background: var(--s-spend); border-radius: 0 4px 4px 0; }
.cbar-more { font-size: 12.5px; color: var(--ink-3); padding-top: 8px; }

/* trend */
.klegend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); }
.klegend span { display: inline-flex; align-items: center; gap: 6px; }
.trend-plot { position: relative; height: 150px; margin: 8px 0 0 46px; border-bottom: 1px solid var(--axis); }
.gl { position: absolute; left: 0; right: 0; border-top: 1px solid var(--grid); }
.gl span { position: absolute; right: calc(100% + 8px); top: -8px; font-size: 11px; line-height: 16px; color: var(--ink-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tcols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.tcol { position: relative; display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; border-radius: 8px 8px 0 0; }
.tcol:hover, .tcol:focus-visible { background: color-mix(in srgb, var(--ink) 5%, transparent); outline: none; }
.tcol i { display: block; width: min(16px, 34%); border-radius: 4px 4px 0 0; }
.tcol i.in { background: var(--s-income); }
.tcol i.out { background: var(--s-spend); }
.trend-x { margin-left: 46px; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); text-align: center; font-size: 12px; color: var(--ink-3); padding-top: 6px; }
.trend-x .cur { color: var(--ink); font-weight: 700; }
.tview { margin-top: 12px; font-size: 13px; }
.tview summary { cursor: pointer; color: var(--ink-3); font-size: 12.5px; width: max-content; }
.tview .tw { overflow-x: auto; margin-top: 8px; }

/* tables */
.ytable { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.ytable th { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-align: right; padding: 0 0 8px 8px; white-space: nowrap; }
.ytable td { text-align: right; padding: 9px 0 9px 8px; border-top: 1px solid var(--line); white-space: nowrap; }
.ytable th:first-child, .ytable td:first-child { text-align: left; padding-left: 0; }
.ytable tbody tr { cursor: pointer; }
.ytable tbody tr:hover td { background: var(--card-2); }
.ytable tr.sel td { background: var(--gold-soft); }
.ytable tr.sel td:first-child { padding-left: 8px; }
.ytable tr.future td { color: var(--ink-3); }
.ytable tfoot td { font-weight: 700; border-top: 1px solid var(--axis); }
.ytable .mbtn { font-weight: 600; }
.st { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; }
.st svg { width: 13px; height: 13px; }
.st.done { color: var(--good); }
.st.left { color: var(--gold-ink); }
.st.over { color: var(--accent); }
.tbl-wrap { overflow-x: auto; }
.kv { display: flex; flex-direction: column; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 14px; }
.kv div + div { border-top: 1px solid var(--line); }
.kv span { color: var(--ink-2); }
.kv b { font-weight: 600; font-variant-numeric: tabular-nums; }
.kv .total b { font-size: 17px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 48px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 15.5px; white-space: nowrap; transition: filter .15s, transform .1s; }
.btn:active { transform: scale(.985); }
.btn:hover { filter: brightness(1.04); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.gold { background: var(--gold); color: var(--on-gold); }
.btn.ghost { background: var(--card-2); color: var(--ink); }
.btn.line { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.block { width: 100%; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13.5px; border-radius: 10px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; padding: 3px; border-radius: 12px; background: var(--card-2); }
.seg.on-bg { background: var(--card); }
.seg button { padding: 8px 4px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-3); text-align: center; white-space: nowrap; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); }
.seg.on-bg button.on { background: var(--bg); box-shadow: none; }
.chip { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: 999px; background: var(--card-2); font-size: 13.5px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--card); }
.chip.gold.on { background: var(--gold); color: var(--on-gold); }
.input { width: 100%; height: 44px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select.input { appearance: none; -webkit-appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%); background-position: calc(100% - 17px) 19px, calc(100% - 12px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 12px; width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 40px; background: var(--card); border-color: transparent; }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 28px; border-radius: 14px; background: var(--axis); position: relative; flex: none; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--knob); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .2s; }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(18px); }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: var(--scrim); animation: fade .2s ease-out; }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: calc(100% - 32px - env(safe-area-inset-top, 0px)); overflow-y: auto; overscroll-behavior: contain; background: var(--card); border-radius: 24px 24px 0 0; padding: 8px 20px calc(20px + env(safe-area-inset-bottom, 0px)); animation: up .28s cubic-bezier(.2, .8, .2, 1); }
.grab { width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 2px auto 10px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sheet-head h2 { font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.flabel { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.flabel small { font-weight: 400; color: var(--ink-3); font-size: 12px; }
.amount { display: flex; align-items: baseline; gap: 4px; border-bottom: 2px solid var(--line); padding: 4px 0 6px; }
.amount:focus-within { border-color: var(--accent); }
.amount input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 0; font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.amount input::placeholder { color: var(--axis); }
.amount span { font-size: 20px; font-weight: 600; color: var(--ink-2); }
.amount-read { min-height: 20px; font-size: 13px; color: var(--ink-3); margin-top: -12px; }
.quick { display: flex; gap: 6px; flex-wrap: wrap; }
.quick .chip { height: 32px; font-size: 13px; }
.cats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cats.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cat { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 8px 2px 7px; border-radius: 14px; font-size: 12px; line-height: 1.25; color: var(--ink-2); text-align: center; border: 1px solid transparent; }
.cat .mono { width: 36px; height: 36px; font-size: 14px; }
.cat.on { background: var(--accent-soft); color: var(--ink); border-color: color-mix(in srgb, var(--accent) 30%, transparent); font-weight: 600; }
.cat.on .mono { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.date-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.date-row .input { width: auto; flex: 1 1 150px; }
.tithe-box { border-radius: 16px; background: var(--gold-soft); border: 1px solid var(--gold-line); padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14.5px; font-weight: 600; }
.switch-row small { display: block; font-size: 12px; font-weight: 400; color: var(--ink-3); }
.tcalc { font-size: 13px; color: var(--gold-ink); font-weight: 600; }
.sheet-actions { display: flex; gap: 8px; padding-top: 4px; }
.sheet-actions .btn.primary, .sheet-actions .btn.gold { flex: 1; }
.form-err { color: var(--danger); font-size: 13px; font-weight: 600; min-height: 0; }
.presets { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.presets::-webkit-scrollbar { display: none; }
.presets .chip { flex: none; }
.set-sec { display: flex; flex-direction: column; gap: 14px; padding: 16px 0; border-top: 1px solid var(--line); }
.set-sec:first-of-type { border-top: 0; padding-top: 0; }
.set-sec h3 { font-size: 14px; font-weight: 700; color: var(--ink); }
.rate-row { display: flex; align-items: center; gap: 8px; }
.rate-row .input { width: 96px; text-align: right; }
.small-print { font-size: 12px; color: var(--ink-3); }

/* tooltip & toast */
.tip { position: fixed; z-index: 70; pointer-events: none; background: var(--ink); color: var(--card); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; max-width: 240px; box-shadow: var(--shadow); }
.tip b { display: block; font-size: 14px; font-weight: 700; }
.tip span { display: block; opacity: .8; }
.toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); display: flex; align-items: center; gap: 12px; transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--card); padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); width: max-content; max-width: calc(100% - 32px); animation: up .22s ease-out; }

.empty { text-align: center; padding: 22px 8px; color: var(--ink-3); font-size: 14px; }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
.loading .hero-num, .loading .t-val { color: var(--ink-3); }

@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (min-width: 700px) {
  .sheet-wrap { align-items: center; padding: 24px; }
  .sheet { border-radius: 24px; max-height: calc(100% - 48px); padding-bottom: 24px; }
  .grab { display: none; }
  .sheet-head { margin-top: 10px; }
}
@media (min-width: 920px) {
  .app { max-width: 1060px; padding-inline: 24px; padding-block: 0 120px; }
  .top { margin-inline: -24px; padding-inline: 14px 24px; }
  .home-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  .tithe-grid { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 16px; align-items: start; }
  .narrow { width: 100%; max-width: 660px; margin-inline: auto; display: flex; flex-direction: column; gap: 12px; }
  .tabbar { max-width: 460px; }
  .toast { bottom: 104px; }
}

/* ───────── installed-app additions ───────── */
html, body { overscroll-behavior-y: none; }
body { touch-action: manipulation; }
.top .chip.today { height: 30px; padding: 0 10px; font-size: 12.5px; background: var(--card); color: var(--ink); }
.icon-btn { position: relative; }
.icon-btn .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--bg); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm svg { width: 18px; height: 18px; }

/* floating tab bar with a raised record button */
.tabbar {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 40;
  max-width: 536px; margin: 0 auto;
  background: var(--card);
  background: color-mix(in srgb, var(--card) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border: 1px solid var(--line); border-radius: 26px;
  box-shadow: 0 12px 32px rgba(16, 24, 40, .16), 0 2px 6px rgba(16, 24, 40, .06);
}
.tabbar-in { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); height: 66px; padding: 0 4px; }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11px; font-weight: 600; letter-spacing: -0.01em; -webkit-user-select: none; user-select: none; }
.tab .ti { width: 50px; height: 30px; border-radius: 15px; display: grid; place-items: center; transition: background-color .2s, transform .15s; }
.tab .ti svg { width: 24px; height: 24px; }
.tab .cut { stroke: var(--accent-soft); stroke-width: 1.8; fill: none; }
.tab .seal { fill: var(--gold); }
.tab.on { color: var(--accent); }
.tab.on .ti { background: var(--accent-soft); animation: pop .28s cubic-bezier(.2, .9, .3, 1.3); }
.tab.on .tl { color: var(--ink); font-weight: 700; }
.tab:active .ti, .tab:active .fab { transform: scale(.9); }
.tab.add { gap: 4px; color: var(--ink); }
.tab .fab {
  width: 52px; height: 52px; margin-top: -30px; border-radius: 19px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-deep)); color: var(--accent-ink);
  box-shadow: 0 0 0 5px var(--bg), 0 10px 22px var(--accent-glow); transition: transform .15s;
}
.tab .fab svg { width: 26px; height: 26px; }
@keyframes pop { from { transform: scale(.7); } to { transform: none; } }

/* banners */
.note.install { background: var(--card); box-shadow: var(--shadow); }
.note.install img { width: 40px; height: 40px; border-radius: 10px; flex: none; }
.note.install p { flex: 1; }
.note p b { display: block; color: var(--ink); }

/* menu sheet */
.menu-head { display: grid; grid-template-columns: 48px minmax(0, 1fr) 40px; gap: 12px; align-items: center; margin: 4px 0 16px; }
.app-mark { width: 48px; height: 48px; border-radius: 12px; box-shadow: 0 4px 12px rgba(10, 20, 48, .25); }
.menu-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.02em; }
.menu-head p { font-size: 12.5px; color: var(--ink-3); }
.install-card { display: grid; grid-template-columns: 52px minmax(0, 1fr) 40px; gap: 14px; align-items: center; width: 100%; padding: 14px; border-radius: 18px; margin-bottom: 14px; color: #fff;
  background: radial-gradient(120% 140% at 0% 0%, #2C4C90 0%, #14264E 55%, #0B1532 100%); box-shadow: 0 10px 24px rgba(11, 21, 50, .28); text-align: left; }
.install-card img { width: 52px; height: 52px; border-radius: 13px; }
.install-card b { display: block; font-size: 15.5px; }
.install-card small { display: block; font-size: 12.5px; color: #C9D5EE; margin-top: 2px; }
.install-card .ic-go { width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .14); display: grid; place-items: center; color: #FFD979; }
.install-card .ic-go svg { width: 22px; height: 22px; }
.mgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mtile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 18px; background: var(--card-2); text-align: left; min-height: 104px; transition: background-color .15s, transform .1s; }
.mtile:hover { background: var(--accent-soft); }
.mtile:active { transform: scale(.98); }
.mt-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--card); color: var(--accent); box-shadow: 0 1px 2px rgba(16, 24, 40, .08); }
.mt-ic svg { width: 20px; height: 20px; }
.mt-tx b { display: block; font-size: 14.5px; font-weight: 700; letter-spacing: -0.01em; }
.mt-tx small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.mtile.warn .mt-ic { color: var(--gold-ink); background: var(--gold-soft); }
.menu-foot { margin-top: 14px; }

/* install guide */
.guide { display: flex; flex-direction: column; gap: 14px; }
.guide-lead { font-size: 14.5px; color: var(--ink-2); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; border-radius: 16px; background: var(--card-2); }
.st-n { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 14px; display: grid; place-items: center; }
.st-t { font-size: 14.5px; line-height: 1.6; padding-top: 2px; }
.st-t small { display: block; font-size: 12.5px; color: var(--ink-3); }
.kbd { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; margin: 0 2px; border-radius: 8px; background: var(--card); border: 1px solid var(--line); font-weight: 600; font-size: 13px; vertical-align: 1px; }
.kbd svg { width: 16px; height: 16px; color: var(--accent); }

/* share */
.share { display: flex; flex-direction: column; gap: 10px; }
.share-card { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 16px; align-items: center; padding: 14px; border-radius: 18px; background: var(--card-2); margin-bottom: 6px; }
.qr-box { width: 132px; height: 132px; padding: 6px; border-radius: 14px; background: #FFFFFF; }
.qr-box svg { width: 100%; height: 100%; }
.guide .qr-box { width: 200px; height: 200px; margin: 4px auto 0; }
.qr-url { text-align: center; font-size: 13px; color: var(--ink-3); word-break: break-all; }
.share-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.share-meta b { font-size: 16px; }
.share-meta span { font-size: 12.5px; color: var(--ink-3); }
.url-row { display: flex; gap: 6px; margin-top: 6px; }
.url-row .input { height: 36px; font-size: 12.5px; min-width: 0; }

/* restore */
.btn.tall { height: auto; min-height: 60px; padding: 10px 16px; justify-content: flex-start; text-align: left; }
.btn.tall b { display: block; font-size: 15.5px; }
.btn.tall small { display: block; font-size: 12.5px; font-weight: 500; opacity: .85; }
.restore-kv b { text-align: right; word-break: break-all; }

.toast-btn { flex: none; padding: 6px 10px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: 13.5px; font-weight: 700; }
@media (max-width: 360px) { .mgrid { grid-template-columns: 1fr; } .share-card { grid-template-columns: 1fr; justify-items: center; text-align: center; } }

/* ───────── automatic entry: photos, screenshots, pasted texts ───────── */
.file-picker { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }
.quick-import { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: -4px; }
.qi { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 16px; background: var(--card-2); min-width: 0; transition: background-color .15s, transform .1s; }
.qi:first-child { background: var(--accent-soft); }
.qi:active { transform: scale(.98); }
.qi > svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.qi b { display: block; font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.qi small { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.3; margin-top: 1px; }
.import-card { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 14px; align-items: center; width: 100%; padding: 14px; border-radius: 18px; margin-bottom: 12px; text-align: left;
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent); transition: transform .1s; }
.import-card:active { transform: scale(.985); }
.import-card .ic { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(150deg, var(--accent), var(--accent-deep)); color: var(--accent-ink); box-shadow: 0 6px 14px var(--accent-glow); }
.import-card .ic svg { width: 24px; height: 24px; }
.import-card b { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.import-card small { display: block; font-size: 12.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }
.import-card.alt { background: var(--card-2); box-shadow: none; }
.import-card.alt .ic { background: var(--card); color: var(--accent); box-shadow: 0 1px 2px rgba(16, 24, 40, .1); }
.form > .import-card { margin-bottom: -8px; }
.note-line { font-size: 13px; color: var(--ink-2); background: var(--card-2); padding: 10px 12px; border-radius: 12px; line-height: 1.55; }
.note-line b { color: var(--ink); }
.note.hint { background: var(--card); box-shadow: var(--shadow); }
.note.hint p { flex: 1; }
.hint-ic { width: 40px; height: 40px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.hint-ic svg { width: 22px; height: 22px; }

.imp-prog { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 6px 0 4px; text-align: center; }
.imp-thumbs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.imp-thumbs img { width: 58px; height: 76px; object-fit: cover; object-position: top; border-radius: 10px; box-shadow: 0 0 0 1px var(--line); transition: opacity .2s; }
.imp-thumbs img.done { opacity: .45; }
.imp-thumbs img.now { box-shadow: 0 0 0 2px var(--accent), 0 6px 16px var(--accent-glow); animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: translateY(-2px); } }
.imp-status { font-size: 15.5px; font-weight: 600; color: var(--ink); }
.imp-meter { width: 100%; max-width: 360px; background: var(--track); }
.imp-meter i { background: var(--accent); transition: width .3s ease-out; }
.imp-prog .form-err { font-size: 14px; line-height: 1.55; }
.imp-prog .sheet-actions { width: 100%; }

.imp-sum { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.imp-sum b { color: var(--ink); }
.imp-list { display: flex; flex-direction: column; gap: 8px; margin-top: -6px; }
.imp-row { display: grid; grid-template-columns: 46px minmax(0, 1fr); align-items: stretch; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 1px var(--line); transition: box-shadow .15s; }
.imp-row.open { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 55%, transparent), 0 6px 18px rgba(16, 24, 40, .08); }
.imp-check { display: grid; place-items: center; min-height: 62px; border-radius: 16px 0 0 16px; }
.imp-check svg { width: 26px; height: 26px; padding: 4px; border-radius: 8px; color: transparent; box-shadow: inset 0 0 0 2px var(--axis); transition: background-color .15s, box-shadow .15s; }
.imp-row.on .imp-check svg { background: var(--accent); color: var(--accent-ink); box-shadow: none; }
.imp-main { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px 14px 10px 0; min-width: 0; text-align: left; border-radius: 0 16px 16px 0; }
.imp-main .mono { width: 38px; height: 38px; font-size: 14px; }
.imp-row:not(.on) .imp-main { opacity: .5; }
.imp-txt { min-width: 0; }
.imp-txt b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-txt small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.imp-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.imp-amt { font-weight: 700; font-size: 15px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.imp-amt.in { color: var(--accent); }
.imp-edit { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 14px; border-top: 1px dashed var(--line); }
.imp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.imp-grid label, .imp-full { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.imp-grid label > span, .imp-full > span { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.imp-edit .input { height: 42px; }
.imp-edit .seg button { padding: 7px 4px; font-size: 13.5px; }
.imp-ti { padding: 10px 12px; border-radius: 12px; background: var(--gold-soft); box-shadow: inset 0 0 0 1px var(--gold-line); font-size: 14px; }
.imp-total { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: -8px; font-variant-numeric: tabular-nums; }
.imp-total span { white-space: nowrap; }
.imp-raw { margin: 8px 0 0; padding: 10px 12px; max-height: 220px; overflow: auto; border-radius: 12px; background: var(--card-2); font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-all; color: var(--ink-2); }
.sheet-actions.stick { position: sticky; bottom: 0; z-index: 3; margin: -6px -20px calc(-20px - env(safe-area-inset-bottom, 0px)); padding: 12px 20px calc(14px + env(safe-area-inset-bottom, 0px));
  background: var(--card); box-shadow: 0 -1px 0 var(--line), 0 -10px 18px -14px rgba(16, 24, 40, .35); }
@media (min-width: 700px) { .sheet-actions.stick { margin-bottom: -24px; padding-bottom: 20px; border-radius: 0 0 24px 24px; } }
.paste-box { height: auto; min-height: 168px; padding: 12px; line-height: 1.55; font-size: 14px; resize: vertical; }

/* PC: drag screenshots anywhere */
html.dropping body::after { content: "사진을 놓으면 기록을 찾아요"; position: fixed; inset: 12px; z-index: 90; display: grid; place-items: center; pointer-events: none;
  border: 2px dashed var(--accent); border-radius: 24px; background: color-mix(in srgb, var(--accent-soft) 90%, transparent); color: var(--accent); font-size: 18px; font-weight: 700; }
