:root {
  color-scheme: light;
  --bg: #f7f5f1;
  --surface: #fff;
  --surface-2: #f1efeb;
  --surface-3: #e9e5df;
  --ink: #242321;
  --muted: #73716d;
  --line: #dedbd5;
  --accent: hsl(var(--h, 350) 62% 42%);
  --accent-ink: #fff;
  --accent-soft: #f8e8e8;
  --green: #168457;
  --green-soft: #e5f3eb;
  --red: #b32632;
  --red-soft: #fae9e9;
  --shadow: 0 12px 36px rgba(39, 33, 28, .10);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Instrument Sans', system-ui, sans-serif;
  --num: 'Spline Sans Mono', ui-monospace, monospace;
  --radius: 18px;
  font-family: var(--body);
  background: var(--bg);
  color: var(--ink);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1d1b19;
  --surface: #272522;
  --surface-2: #322f2b;
  --surface-3: #403c37;
  --ink: #f5f1ea;
  --muted: #b5afa6;
  --line: #49443e;
  --accent: hsl(var(--h, 350) 62% 54%);
  --accent-ink: #fff;
  --accent-soft: #46282a;
  --green: #57c38d;
  --green-soft: #1c3a2c;
  --red: #e66a70;
  --red-soft: #46282a;
  --shadow: 0 16px 40px rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { min-width: 320px; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 36%, transparent); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }
.app { width: min(100%, 620px); min-height: 100dvh; margin: 0 auto; padding: 0 22px calc(98px + env(safe-area-inset-bottom)); position: relative; background: var(--bg); }
.top { height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 93%, transparent); backdrop-filter: blur(14px); }
.wordmark { margin: 0; font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: -.8px; line-height: 1; color: var(--ink); }
.wordmark span { color: var(--accent); }
.wordmark.big { font-size: clamp(42px, 12vw, 64px); letter-spacing: -2.8px; }
.top-r { display: flex; align-items: center; gap: 8px; }
.iconbtn, .pchip { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; min-width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: transform .16s ease, border-color .16s ease, background .16s ease; }
.iconbtn:hover, .pchip:hover { border-color: var(--accent); transform: translateY(-1px); }
.pchip { padding: 0 12px; gap: 6px; font-size: 13px; font-weight: 600; }
#view { padding: 18px 0 24px; outline: none; }
#view > .sub:first-child { margin-top: 4px; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.5; }
.num { font-family: var(--num); font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.inc { color: var(--green) !important; }
.exp { color: var(--red) !important; }
.lbl { display: block; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .025em; }
.nav { min-height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.nav h2 { flex: 1; margin: 0; text-align: center; font-family: var(--display); font-size: 19px; letter-spacing: -.35px; }
.nav h2[style*="text-align:left"] { text-align: left; }
.daynav { margin: 12px -6px 10px; }
.daynav .iconbtn { border: 0; background: transparent; }
.datelabel { position: relative; display: grid; justify-items: center; gap: 3px; cursor: pointer; text-align: center; }
.datelabel input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.dl-main { font-family: var(--display); font-size: 19px; font-weight: 700; }
.dl-sub { font-size: 12px; color: var(--muted); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.seg button { min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; cursor: pointer; }
.seg button[aria-pressed="true"] { color: var(--ink); background: var(--surface); box-shadow: 0 1px 4px rgba(30, 25, 20, .10); }
.homeseg { width: fit-content; min-width: 174px; margin: 8px auto 12px; }
.months { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 1px 10px; }
.months::-webkit-scrollbar { display: none; }
.mchip { flex: 0 0 auto; display: grid; gap: 2px; min-width: 83px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: left; cursor: pointer; }
.mchip span { font-size: 13px; font-weight: 600; }
.mchip small { color: var(--muted); font-size: 11px; }
.mchip[aria-pressed="true"] { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 10px 0 14px; padding: 15px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.strip > div { min-width: 0; display: grid; gap: 5px; }
.strip .num { font-size: clamp(12px, 3.5vw, 16px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.monthline { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 14px 2px; }
.daycard { margin: 8px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.daycard.plain { margin-top: 10px; }
.dayhead { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.dnum { width: 42px; height: 42px; flex: 0 0 42px; display: grid; place-items: center; border-radius: 13px; background: var(--surface-2); font-family: var(--display); font-size: 18px; font-weight: 700; }
.dtxt, .meta { min-width: 0; flex: 1; display: grid; gap: 4px; }
.dwk { font-size: 13px; font-weight: 700; }
.dmo, .note { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dtot { font-size: 12px; white-space: nowrap; }
.chev { color: var(--muted); display: inline-flex; transition: transform .18s ease; }
.dayhead[aria-expanded="true"] .chev { transform: rotate(180deg); }
.daybody { padding: 0 10px 8px; }
.row { width: 100%; min-width: 0; display: flex; align-items: center; gap: 11px; padding: 11px 4px; border: 0; border-top: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.row:hover { background: color-mix(in srgb, var(--surface-2) 65%, transparent); }
.chip { flex: 0 0 auto; display: inline-grid; place-items: center; border-radius: 13px; color: #fff; }
.cat { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.amt { flex: 0 0 auto; font-size: 12px; text-align: right; }
.tag { flex: 0 0 auto; padding: 2px 6px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 9px; font-weight: 600; }
.notice { position: relative; margin: 10px 0; padding: 14px; border: 1px solid #e3c9b2; border-radius: 16px; background: #fff8ef; color: #49372c; }
:root[data-theme="dark"] .notice { background: #3a2d24; border-color: #604b3c; color: #f4e6d7; }
.notice p { margin: 0 0 10px; font-size: 13px; line-height: 1.5; }
.notice .iconbtn { position: absolute; top: 8px; right: 8px; min-width: 32px; height: 32px; }
.empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 24px 18px; text-align: center; }
.empty strong { font-family: var(--display); font-size: 20px; }
.empty span { max-width: 310px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.btn { min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 650; text-decoration: none; cursor: pointer; transition: transform .16s ease, background .16s ease, border-color .16s ease; }
.btn:hover { transform: translateY(-1px); border-color: var(--accent); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.btn.small { min-height: 35px; padding: 0 11px; border-radius: 10px; font-size: 12px; }
.btn.block { width: 100%; }
.btn.two { min-height: 58px; flex-direction: column; gap: 1px; }
.fill-red { border-color: var(--accent); background: var(--accent); color: white; }
.fill-green { border-color: var(--green); background: var(--green); color: white; }
.sm { opacity: .78; font-size: 11px; font-weight: 500; }
.fab { position: fixed; z-index: 6; right: max(calc((100vw - 620px) / 2 + 24px), 24px); bottom: calc(82px + env(safe-area-inset-bottom)); width: 58px; height: 58px; display: grid; place-items: center; border: 0; border-radius: 18px; background: var(--accent); color: #fff; box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); cursor: pointer; transition: transform .18s ease; }
.fab:hover { transform: translateY(-3px) rotate(3deg); }
.fab[hidden] { display: none; }
.tabs { position: fixed; z-index: 5; left: 50%; bottom: env(safe-area-inset-bottom); transform: translateX(-50%); width: min(calc(100% - 24px), 590px); min-height: 66px; display: grid; align-items: stretch; padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-radius: 20px 20px 0 0; background: color-mix(in srgb, var(--surface) 96%, transparent); box-shadow: 0 -5px 24px rgba(30, 26, 20, .06); backdrop-filter: blur(16px); }
.tabs button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 13px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--accent); background: var(--accent-soft); }
.choose { width: min(100%, 470px); margin: clamp(42px, 11vh, 100px) auto 0; }
.choose > .sub { margin: 8px 0 28px; }
.mode-card { width: 100%; display: flex; align-items: center; gap: 14px; margin: 10px 0; padding: 17px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: left; cursor: pointer; transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease; }
.mode-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: var(--shadow); }
.mc-ic { width: 52px; height: 52px; flex: 0 0 52px; display: grid; place-items: center; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.mc-ic.k { background: var(--surface-2); color: var(--ink); }
.mc-t { min-width: 0; flex: 1; display: grid; gap: 5px; }
.mc-t strong { font-family: var(--display); font-size: 16px; }
.mc-t > span { color: var(--muted); font-size: 12px; line-height: 1.4; }
.mc-t .mc-s { color: var(--ink); font-size: 11px; }
.stack { display: grid; gap: 14px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { min-width: 0; display: grid; gap: 7px; }
.input { width: 100%; min-height: 46px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); outline: none; }
.input:focus { border-color: var(--accent); }
.input.amt { font-family: var(--num); font-size: 21px; font-weight: 500; }
.searchbar { padding: 10px 0 0; }
.searchbar[hidden] { display: none; }
.searchbar .input { min-height: 44px; }
.sec { margin: 22px 2px 9px; font-family: var(--display); font-size: 16px; }
.set { display: grid; gap: 10px; margin: 8px 0; padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.set p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.swatches, .icongrid, .catgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.sw, .ig { width: 38px; height: 38px; display: grid; place-items: center; border: 2px solid var(--surface); border-radius: 12px; color: white; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.sw[aria-pressed="true"], .ig[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.ig { border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.cg { min-width: 95px; display: flex; align-items: center; gap: 7px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); cursor: pointer; }
.cg[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.cg .t { font-size: 11px; font-weight: 600; }
.actions { display: flex; justify-content: flex-end; gap: 9px; padding-top: 4px; }
.actions .danger { margin-right: auto; }
.err { margin: 0; color: var(--red); font-size: 12px; }
.err[hidden] { display: none; }
.scrim { position: fixed; z-index: 20; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding: 18px 12px 0; background: rgba(25, 22, 20, .42); backdrop-filter: blur(4px); }
.sheet { width: min(100%, 560px); max-height: min(88dvh, 820px); overflow: auto; padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; background: var(--surface); box-shadow: var(--shadow); animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(24px); opacity: .7; } to { transform: translateY(0); opacity: 1; } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin: 0 0 17px; }
.sheet-h h2 { margin: 0; font-family: var(--display); font-size: 20px; }
.plist { display: grid; gap: 4px; margin-bottom: 14px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100vw - 36px); padding: 11px 15px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 13px; box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.donutwrap { display: grid; place-items: center; margin: 18px 0; }
.donut { width: min(100%, 260px); overflow: visible; }
.d-total { fill: var(--ink); font: 700 16px var(--num); }
.d-label { fill: var(--muted); font: 11px var(--body); }
.trend { display: block; width: 100%; height: auto; margin-top: 14px; overflow: visible; }
.trend .base { stroke: var(--line); stroke-width: 1; }
.trend .axis { fill: var(--muted); font: 9px var(--num); }
.bar-e { fill: var(--accent); }
.bar-i { fill: var(--green); }
.read { margin: 8px 0; color: var(--muted); font-size: 11px; text-align: center; }
.leg { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.top2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.name, .pct { font-size: 12px; }
.pct { color: var(--muted); }
.bar { height: 5px; overflow: hidden; border-radius: 99px; background: var(--surface-2); }
.bar i { display: block; height: 100%; border-radius: inherit; }
.kd-head { display: flex; align-items: center; gap: 10px; padding: 4px 0 16px; }
.kd-head .iconbtn { flex: 0 0 42px; }
.kd-name { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.kd-name > div { display: grid; gap: 3px; min-width: 0; }
.kd-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kd-name span:not(.chip) { color: var(--muted); font-size: 11px; }
.kd-bal { display: grid; gap: 5px; padding: 20px 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); text-align: center; }
.big { font-size: 28px; }
.kd-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.kd-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 12px 0 20px; }
.kamt { display: grid; gap: 4px; }
.blab { color: var(--muted); font-family: var(--body); font-size: 9px; }
.day { display: flex; justify-content: space-between; gap: 8px; margin: 20px 2px 6px; }
.day .num { font-size: 11px; }
@media (min-width: 700px) {
  .app { min-height: 100vh; padding: 0 34px 110px; }
  .top { height: 84px; }
  #view { padding-top: 24px; }
  .tabs { border-radius: 18px; bottom: 18px; padding-bottom: 5px; }
  .fab { bottom: 102px; }
  .scrim { align-items: center; padding: 20px; }
  .sheet { border: 1px solid var(--line); border-radius: 24px; }
}
@media (max-width: 390px) {
  .app { padding-left: 15px; padding-right: 15px; }
  .strip { padding: 12px 9px; }
  .strip .lbl { font-size: 10px; }
  .mchip { min-width: 75px; }
  .two { gap: 8px; }
  .tabs { width: calc(100% - 16px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
