@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(fonts/PlusJakartaSans-latin.woff2) format('woff2');
}

/* ---------- Dark 1 · Graphite glass ---------- */
:root {
  --bg: #0A0A0B;
  --glass: rgba(255, 255, 255, .06);
  --glass-hi: rgba(255, 255, 255, .09);
  --glass-press: rgba(255, 255, 255, .13);
  --edge: rgba(255, 255, 255, .10);
  --well: rgba(255, 255, 255, .05);
  --text: #F4F5F7; --text-2: #E2E4E8; --muted: #A1A6AE; --line: rgba(255, 255, 255, .07);
  --accent: #FFFFFF; --accent-ink: #0A0A0B;
  --good: #7BE0B0; --bad: #FF8A80; --warn: #F5C26B;
  --warn-bg: rgba(245, 194, 107, .14); --good-bg: rgba(123, 224, 176, .12);
  --scrim: rgba(0, 0, 0, .62);
  --float: rgba(24, 25, 28, .72);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); }
body { margin: 0; background: transparent; color: var(--text); touch-action: manipulation; }
html { margin: 0; touch-action: manipulation; }
body {
  font: 15px/1.45 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-user-select: none; user-select: none;
  overscroll-behavior-y: none;
}
/* Soft grey light behind the glass (gradients, not blur filters: cheap to scroll) */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(520px 520px at -12% -8%, rgba(78, 82, 92, .55), transparent 62%),
    radial-gradient(460px 460px at 112% 52%, rgba(52, 55, 62, .65), transparent 62%),
    radial-gradient(380px 380px at 20% 110%, rgba(40, 42, 48, .6), transparent 60%),
    var(--bg);
}
input, textarea, select { -webkit-user-select: text; user-select: text; }
button { font: inherit; color: inherit; }
a { color: var(--accent); }
.hidden { display: none !important; }

/* Privacy: blur everything while the app is in the background / app switcher */
body.privacy #app { filter: blur(24px); }

#app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; position: relative; }

/* ---------- glass primitives ---------- */
.out { background: var(--glass); border: 1px solid var(--edge); border-radius: 24px; }
.in { background: var(--well); border: 1px solid var(--line); }
button.out, a.out { cursor: pointer; color: var(--text); }
button.out:active, a.out:active { background: var(--glass-press); }

.screen { padding: calc(env(safe-area-inset-top) + 20px) 16px calc(env(safe-area-inset-bottom) + 120px); display: flex; flex-direction: column; gap: 12px; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 0 4px 2px; gap: 8px; }
.topbar .sub { font-size: 13px; color: var(--muted); font-weight: 600; }
.topbar h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0; }
.monthnav { display: flex; align-items: center; gap: 2px; margin-left: -8px; }
.iconbtn { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex: none; }
.navbtn { width: 32px; height: 36px; border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; }
.navbtn:disabled { opacity: .3; }
.icons { display: flex; gap: 10px; }

.card { padding: 16px 18px; }
.h { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 0; font-size: 15px; color: var(--text-2); }
.card .row + .row { border-top: 1px solid var(--line); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.accent { color: var(--accent); }
b { color: var(--text); }

/* hero */
.hero { padding: 20px; border-radius: 28px; background: var(--glass-hi); }
.hero .label { font-size: 14px; font-weight: 600; color: var(--muted); }
.hero .big { font-size: 50px; font-weight: 800; letter-spacing: -.03em; margin: 2px 0 2px; color: var(--accent); font-variant-numeric: tabular-nums; line-height: 1.15; }
.hero .big.bad { color: var(--bad); }
.hero .muted.small { color: #C5C9CF; font-size: 14px; }
.hero .foot { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); gap: 8px; }
.track { height: 6px; border-radius: 3px; margin: 16px 0 12px; background: rgba(255, 255, 255, .12); border: 0; overflow: hidden; }
.track .fill { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .4s; }
.track.thin { margin: 7px 0 0; background: rgba(255, 255, 255, .10); }
.track.thin .fill { background: #D9DCE1; }
.track .fill.bad { background: var(--bad); }

.total { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-radius: 14px; margin-top: 8px; font-weight: 800; font-size: 16px; background: rgba(255, 255, 255, .08); border: 0; }

.banner { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 20px; text-decoration: none; color: var(--text); width: 100%; text-align: left; }
.badge { width: 36px; height: 36px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; color: var(--warn); background: var(--warn-bg); border: 0; }
.banner .t { font-weight: 700; font-size: 15px; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 0; font-size: 14px; color: var(--text-2); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 700; font-size: 12px; }
tr + tr td { border-top: 1px solid var(--line); }

/* transactions */
.txlist { padding: 2px 16px; }
.tx { display: flex; align-items: center; gap: 12px; padding: 12px 0; width: 100%; background: none; border: 0; text-align: left; cursor: pointer; color: var(--text); }
.tx + .tx { border-top: 1px solid var(--line); }
.tx .ic { width: 40px; height: 40px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; color: var(--text-2); background: rgba(255, 255, 255, .07); border: 0; }
.tx .ic.warn { color: var(--warn); background: var(--warn-bg); }
.tx .ic.in-ic { color: var(--good); background: var(--good-bg); }
.tx .main { flex: 1; min-width: 0; }
.tx .t1 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx .amt { font-size: 15px; font-weight: 700; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: var(--warn); background: var(--warn-bg); margin-right: 4px; }
.day { font-size: 13px; font-weight: 700; color: var(--muted); margin: 8px 4px -4px; }
.empty { color: var(--muted); text-align: center; padding: 20px 0; }

.search { display: flex; align-items: center; gap: 8px; height: 46px; border-radius: 15px; padding: 0 14px; color: var(--muted); }
.search input { border: 0; outline: 0; background: transparent; font: inherit; font-size: 16px; flex: 1; color: var(--text); min-width: 0; }
.search input::placeholder { color: var(--muted); }
.pills { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 4px; scrollbar-width: none; }
.pills::-webkit-scrollbar { display: none; }
.pill { height: 36px; padding: 0 14px; border-radius: 12px; font-size: 13px; font-weight: 600; white-space: nowrap; flex: none; color: var(--text-2); }
.pill.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

/* floating glass: tab bar, + button, sheets (the only places that blur) */
.tabbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 12px); width: calc(100% - 28px); max-width: 492px; height: 66px; border-radius: 24px; display: flex; z-index: 10; background: var(--float); -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: #8D929B; background: none; border: 0; cursor: pointer; }
.tabbar button.on { color: var(--accent); }
.fab { position: fixed; right: max(20px, calc(50% - 240px)); bottom: calc(env(safe-area-inset-bottom) + 96px); width: 58px; height: 58px; border-radius: 20px; display: flex; align-items: center; justify-content: center; z-index: 10; background: var(--accent) !important; border-color: var(--accent) !important; color: var(--accent-ink) !important; box-shadow: 0 10px 28px rgba(0, 0, 0, .5); }

/* buttons & forms */
.btn { height: 54px; border-radius: 18px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); font-size: 16px; font-weight: 700; cursor: pointer; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:active { filter: brightness(.9); }
.btn:disabled { opacity: .5; }
.btn.ghost { background: var(--glass); border-color: var(--edge); color: var(--text); }
.btn.danger { background: var(--glass); border-color: var(--edge); color: var(--bad); }
.btn.sm { height: 36px; border-radius: 12px; font-size: 13px; width: auto; padding: 0 14px; }
.btns { display: flex; gap: 12px; margin-top: 18px; }
.lbl { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 16px 2px 8px; }
.field { width: 100%; height: 48px; border-radius: 14px; padding: 0 14px; font: inherit; font-size: 16px; color: var(--text); outline: 0; }
.field.in { background: rgba(255, 255, 255, .06); border: 1px solid var(--edge); }
.field::placeholder { color: #7D828A; }
.field:focus { border-color: rgba(255, 255, 255, .45); }
select.field { -webkit-appearance: none; appearance: none; }
input[type="date"].field, input[type="datetime-local"].field { color-scheme: dark; }
.seg { display: flex; border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { flex: 1; height: 40px; border: 0; background: none; border-radius: 11px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { color: var(--accent-ink); background: var(--accent); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn { height: 40px; padding: 0 14px; border-radius: 13px; font-size: 14px; font-weight: 600; }
.chipbtn.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px; border-radius: 18px; }
.opt + .opt { margin-top: 10px; }
.opt .ot { font-size: 15px; font-weight: 700; }
.opt .os { font-size: 13px; color: var(--muted); }
.radio { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 2px solid rgba(255, 255, 255, .3); }
.opt.on { border-color: rgba(255, 255, 255, .55); background: var(--glass-hi); }
.opt.on .radio { border: 7px solid var(--accent); }
.check { display: flex; align-items: center; gap: 12px; margin-top: 16px; font-size: 14px; cursor: pointer; }

.switch { width: 52px; height: 32px; border-radius: 16px; border: 0; padding: 3px; cursor: pointer; flex: none; position: relative; background: rgba(255, 255, 255, .16); }
.switch::after { content: ''; display: block; width: 26px; height: 26px; border-radius: 50%; background: #E2E4E8; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: transform .18s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--accent-ink); }
.switch:disabled { opacity: .4; }

.list { padding: 2px 16px; }
.item { display: flex; align-items: center; gap: 10px; min-height: 52px; font-size: 15px; width: 100%; background: none; border: 0; text-align: left; color: var(--text); cursor: pointer; padding: 0; }
.item + .item { border-top: 1px solid var(--line); }
.item .grow { flex: 1; min-width: 0; }
.item .v { color: var(--muted); font-variant-numeric: tabular-nums; }
.item.bad { color: var(--bad); }
.item.accent { color: var(--accent); }
.sec { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin: 10px 4px -2px; }

/* bottom sheet */
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 20; animation: fade .18s; }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px; max-height: calc(100vh - env(safe-area-inset-top) - 24px); overflow-y: auto; background: rgba(20, 21, 24, .94); -webkit-backdrop-filter: blur(30px) saturate(140%); backdrop-filter: blur(30px) saturate(140%); border: 1px solid var(--edge); border-bottom: 0; border-radius: 28px 28px 0 0; padding: 10px 20px calc(env(safe-area-inset-bottom) + 24px); z-index: 21; animation: up .22s ease-out; -webkit-overflow-scrolling: touch; }
.grab { width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .2); margin: 0 auto 6px; }
.sheethead { display: flex; justify-content: space-between; align-items: center; margin: 8px 0 4px; min-height: 36px; }
.sheethead button { background: none; border: 0; color: var(--accent); font-size: 15px; font-weight: 700; cursor: pointer; padding: 6px 0; min-width: 56px; }
.sheethead button:first-child { text-align: left; font-weight: 600; color: var(--muted); }
.sheethead button:last-child { text-align: right; }
.sheethead .mid { font-size: 14px; color: var(--muted); font-weight: 700; text-align: center; }
.centered { text-align: center; margin: 10px 0 4px; }
.bigamt { font-size: 44px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
@keyframes up { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* keypad */
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.key { height: 54px; border-radius: 16px; font-size: 22px; font-weight: 600; display: flex; align-items: center; justify-content: center; }

/* lock / pair */
.center { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(env(safe-area-inset-top) + 32px) 28px calc(env(safe-area-inset-bottom) + 32px); text-align: center; max-width: 420px; margin: 0 auto; }
.logo { width: 84px; height: 84px; border-radius: 26px; display: flex; align-items: center; justify-content: center; color: var(--accent); background: var(--glass-hi); }
.center h2 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 22px 0 6px; }
.center p { color: var(--muted); margin: 0; font-size: 15px; }
.center .grow { flex: 0 0 40px; }
.codebox { width: 100%; height: 64px; border-radius: 18px; text-align: center; font: inherit; font-size: 28px; font-weight: 800; letter-spacing: .18em; color: var(--text); outline: 0; text-transform: uppercase; margin-top: 28px; background: rgba(255, 255, 255, .06); border: 1px solid var(--edge); }
.codebox:focus { border-color: rgba(255, 255, 255, .45); }
.note { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 20px; font-size: 13px; color: var(--muted); }
.err { color: var(--bad); font-size: 14px; margin-top: 12px; min-height: 20px; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 170px); background: #F4F5F7; color: #0A0A0B; padding: 11px 18px; border-radius: 14px; font-size: 14px; font-weight: 600; z-index: 40; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 88vw; text-align: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast.show { opacity: 1; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { text-align: center; color: var(--muted); padding: 30vh 0; }
.skeleton { height: 160px; border-radius: 24px; }

/* Instant press feedback (no waiting for the network to feel the tap) */
button, a { touch-action: manipulation; }
button:not(:disabled):active, a:active { transform: scale(.97); }
.tabbar button:active, .tx:active, .item:active { transform: none; opacity: .7; }
.fab:active { transform: scale(.94); }
.btn, .out, .chipbtn, .pill, .key, .opt, .switch { transition: transform .08s ease-out, background-color .12s; }

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