/* Sổ Thu Chi: grouped-list finance app. Tokens first; components use only these. */
:root {
  color-scheme: light;
  --ground: #F2F2F7; --panel: #FFFFFF; --panel2: #F2F2F7; --fill: #E9E9EE; --raised: #FFFFFF;
  --text: #111114; --muted: #616167; --faint: #8E8E93; --sep: rgba(60, 60, 67, .16);
  --accent: #0062D1; --accent-solid: #0062D1; --accent-fill: rgba(0, 98, 209, .1); --on-accent: #fff;
  --red: #C9302C; --red-fill: rgba(201, 48, 44, .1); --green: #1A7F3C; --green-fill: rgba(26, 127, 60, .1); --amber: #B25E00;
  --chart-off: #DCDCE2;
  --bar-bg: rgba(249, 249, 251, .86);
  --shadow-pop: 0 10px 30px rgba(0, 0, 0, .16), 0 2px 6px rgba(0, 0, 0, .08);
  --r: 14px; --r-sm: 10px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* legacy names used inline by app.js */
  --card: var(--panel); --card2: var(--fill); --bg: var(--ground); --line: var(--sep); --blue: var(--accent); --blue-l: var(--accent-fill);
}
body.dark {
  color-scheme: dark;
  --ground: #000000; --panel: #1C1C1E; --panel2: #2C2C2E; --fill: #2C2C2E; --raised: #2C2C2E;
  --text: #F5F5F7; --muted: #A1A1A8; --faint: #8E8E93; --sep: rgba(84, 84, 88, .55);
  --accent: #4C9DFF; --accent-solid: #0A6CDB; --accent-fill: rgba(76, 157, 255, .16); --on-accent: #fff;
  --red: #FF6B61; --red-fill: rgba(255, 107, 97, .16); --green: #3DD26A; --green-fill: rgba(61, 210, 106, .14); --amber: #FFB340;
  --chart-off: #3A3A3C;
  --bar-bg: rgba(22, 22, 24, .86);
  --shadow-pop: 0 12px 36px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
html { background: var(--ground); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 17px/1.35 var(--font); letter-spacing: -.01em; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
input, select, textarea { caret-color: var(--accent); }
::selection { background: var(--accent-fill); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.hidden { display: none !important; }
b, strong { font-weight: 600; }

.app { max-width: 520px; margin: 0 auto; min-height: 100vh; position: relative; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* money and type helpers */
.red { color: var(--red); } .green { color: var(--green); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.link { color: var(--accent); font-weight: 400; }
button.link:hover { opacity: .75; }
.amt, .big-money, .val, .n, .stat .val, .budget b, .li b, .txn .amt, .cal .d, .bars, td, .sum3, .total-card, .band b, .group-h, .fin .v, .fin b, .acc .bl {
  font-variant-numeric: tabular-nums;
}
.spacer, .grow { flex: 1; }

/* large-title screens: Tổng quan, Tài khoản, Báo cáo, Khác */
.lt { display: flex; align-items: flex-end; gap: 8px; padding: 14px 20px 10px; }
.lt h1 { margin: 0; font-size: 32px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; flex: 1; }
.lt .hi { display: block; font-size: 15px; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-bottom: 2px; }
.page-title { margin: 0; padding: 14px 20px 10px; font-size: 32px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; }

/* nav bar for pushed screens */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; min-height: 52px; padding: 4px 8px;
  background: var(--bar-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--sep); }
.topbar h2 { margin: 0; flex: 1; font-size: 17px; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 44px; }
.topbar h2:not(:last-child) { padding-right: 0; }
.topbar .icon-btn { color: var(--accent); }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: inherit; border-radius: 50%; flex: none; }
.icon-btn:hover { background: var(--fill); }
.round-btn { width: 40px; height: 40px; border-radius: 50%; background: var(--panel); color: var(--accent); display: grid; place-items: center; flex: none; }

/* grouped panels */
.card { background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 17px; font-weight: 600; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h3 { margin: 0; flex: 1; }
.sec-title { display: flex; align-items: baseline; gap: 12px; padding: 0 20px 8px; font-size: 20px; font-weight: 700; letter-spacing: -.015em; }
.sec-title > span:first-child { flex: 1; }
.sec-title .link { font-size: 15px; font-weight: 400; letter-spacing: 0; }
.sec-h { padding: 0 20px 7px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
.foot-note, .hint { padding: 8px 20px 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.fcard .hint, .card .hint { padding: 0 16px 12px; }

/* balance panel */
.big-money { font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; display: flex; align-items: center; gap: 6px; margin: 4px 0 0; }
.big-money .icon-btn { color: var(--faint); width: 36px; height: 36px; }
.lbl-row { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 15px; }
.row-line { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 44px; border-top: .5px solid var(--sep); margin-top: 14px; padding-top: 12px; font-size: 15px; }
.row-line + .row-line { margin-top: 0; }
.more-btn { display: flex; align-items: center; gap: 4px; color: var(--accent); font-size: 15px; margin-top: 10px; }

/* shortcuts */
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 4px; text-align: center; }
.feat { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; line-height: 1.25; padding: 2px; border-radius: var(--r-sm); color: var(--text); }
.feat .ico { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; color: #fff; }
.feat:hover .ico { filter: brightness(1.06); }

.chip-btn { background: var(--fill); color: var(--accent); border-radius: 50%; width: 36px; height: 36px; display: grid; place-items: center; flex: none; }

/* segmented control */
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; }
.seg button { flex: 1; padding: 6px 12px; border-radius: 7px; font-size: 14px; font-weight: 500; text-align: center; }
.seg button.on { background: var(--raised); box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }

/* in/out pair: a segmented control that carries the values */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 0; background: var(--fill); border-radius: 12px; padding: 3px; margin: 0 0 16px; }
.stat { border-radius: 10px; padding: 9px 12px; text-align: left; }
.stat.on { background: var(--raised); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat .val { font-size: 19px; font-weight: 600; margin-top: 2px; letter-spacing: -.01em; }
.period { border: 0; background: transparent; color: var(--accent); font-size: 15px; padding: 2px 0; appearance: none; cursor: pointer; }

/* donut + legend */
.donut-wrap { display: flex; align-items: center; gap: 20px; min-height: 150px; position: relative; }
.legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; font-size: 14px; }
.legend div { display: flex; align-items: center; gap: 8px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend span { flex: 1; line-height: 1.25; }
.legend b { font-weight: 500; font-variant-numeric: tabular-nums; }
.nodata { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); background: var(--panel); border-radius: 16px; padding: 6px 14px; white-space: nowrap; font-size: 14px; color: var(--muted); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }
.skel { height: 10px; border-radius: 5px; background: var(--fill); }

/* record rows */
.cat-ico { width: 40px; height: 40px; border-radius: 11px; background: var(--fill); display: grid; place-items: center; font-size: 21px; flex: none; color: var(--accent); }
.cat-ico.sm { width: 32px; height: 32px; font-size: 17px; border-radius: 8px; }
.txn { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; min-height: 60px; text-align: left; background: var(--panel); }
.txn:hover, .li:hover, .crow:hover, .frow:is(button):hover { background: var(--panel2); }
body.dark .txn:hover, body.dark .li:hover, body.dark .crow:hover, body.dark .frow:is(button):hover { background: #262628; }
.txn + .txn::before { content: ""; position: absolute; top: 0; left: 68px; right: 0; border-top: .5px solid var(--sep); }
.txn .mid { flex: 1; min-width: 0; }
.txn .name { font-size: 16px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn .sub { color: var(--muted); font-size: 14px; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn .amt { text-align: right; font-size: 16px; font-weight: 600; white-space: nowrap; }
.txn .tacc { color: var(--muted); font-size: 13px; margin-top: 1px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.txns { background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; overflow: hidden; }
.card > .txn { margin: 0 -16px; width: calc(100% + 32px); }
.card > .txn:last-child { margin-bottom: -16px; border-radius: 0 0 var(--r) var(--r); }
.plain-list .txn { background: transparent; }
.day-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 0 20px 7px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .02em; }
.day-h span { text-transform: none; letter-spacing: 0; font-size: 14px; font-variant-numeric: tabular-nums; }

/* budgets */
.budget { display: block; width: 100%; text-align: left; padding: 2px 0; }
.budget + .budget { margin-top: 14px; padding-top: 16px; border-top: .5px solid var(--sep); }
.budget .top { display: flex; gap: 12px; align-items: center; }
.budget .name { font-size: 16px; font-weight: 500; }
.budget b { font-size: 16px; }
.bar { height: 6px; border-radius: 3px; background: var(--fill); margin: 12px 0 10px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.over > i { background: var(--red); }
.budget .foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }

/* yearly bars */
.bars { display: flex; align-items: flex-end; gap: 5px; height: 150px; border-bottom: .5px solid var(--sep); padding: 0 2px; }
.bars .col { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 2px; height: 100%; }
.bars .col i { width: 42%; border-radius: 2px 2px 0 0; background: var(--chart-off); }
.bars .col i.inc { background: var(--green); } .bars .col i.exp { background: var(--red); }
.bar-labels { display: flex; gap: 5px; padding: 6px 2px 0; font-size: 12px; color: var(--muted); }
.bar-labels span { flex: 1; text-align: center; }
.key { display: inline-flex; align-items: center; gap: 5px; }
.key i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* accounts */
.total-card { background: var(--panel); border-radius: var(--r); margin: 0 16px 16px; padding: 16px; }
.tabs-pill { margin: 0 16px 24px; }
.band { display: flex; justify-content: space-between; align-items: center; background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; padding: 14px 16px; font-size: 16px; }
.group-h { display: flex; justify-content: space-between; align-items: center; width: calc(100% - 32px); margin: 0 16px 7px; padding: 0 4px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
.group-h svg { color: var(--faint); }
.acc-list { background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; overflow: hidden; }
.acc { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 6px 8px 16px; min-height: 64px; }
.acc + .acc::before { content: ""; position: absolute; top: 0; left: 68px; right: 0; border-top: .5px solid var(--sep); }
.acc .mid { flex: 1; min-width: 0; text-align: left; padding: 4px 0; }
.acc .nm { font-size: 16px; font-weight: 500; }
.acc .bl { margin-top: 1px; color: var(--muted); font-size: 15px; }
.acc .bl.neg { color: var(--red); }
.acc .icon-btn { color: var(--faint); }
.acc-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; flex: none; }
.acc-ico.cash { background: #2F9E57; } .acc-ico.bank { background: #2F6FDB; } .acc-ico.ewallet { background: #C2337A; } .acc-ico.credit { background: #5E5CE6; }
.acc-ico.invest { background: #0F8A8A; } .acc-ico.saving { background: #D97706; } .acc-ico.goal { background: #E0473B; } .acc-ico.other { background: #8E8E93; }

.fab { position: fixed; z-index: 6; bottom: calc(84px + env(safe-area-inset-bottom)); right: max(16px, calc(50vw - 244px)); width: 56px; height: 56px; border-radius: 50%;
  background: var(--accent-solid); color: var(--on-accent); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0, 60, 140, .3), 0 2px 4px rgba(0, 0, 0, .12); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
.fab:active { transform: scale(.94); }

/* empty states */
.empty { background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; padding: 32px 24px 28px; text-align: center; color: var(--muted); font-size: 15px; line-height: 1.45; }
.empty .pic { width: 64px; height: 64px; border-radius: 18px; background: var(--accent-fill); color: var(--accent); margin: 0 auto 14px; display: grid; place-items: center; }
.empty .btn { width: auto; display: inline-flex; padding: 11px 20px; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 12px 18px; border-radius: 12px; background: var(--accent-solid); color: var(--on-accent); font-size: 17px; font-weight: 600; transition: transform .15s, filter .15s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: var(--accent-fill); color: var(--accent); }
.btn.danger { background: var(--panel); color: var(--red); font-weight: 400; }
.btn:disabled { opacity: .45; }

/* add / edit record */
.add-page { padding-top: 2px; }
.add-top { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 8px; padding: 6px 8px; }
.add-top .icon-btn { color: var(--accent); }
.type-pill { justify-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 20px; background: var(--panel); color: var(--text); font-size: 17px; font-weight: 600; box-shadow: 0 0 0 .5px var(--sep); }
.type-pill svg { color: var(--muted); }
.menu { position: absolute; left: 50%; transform: translateX(-50%); top: 54px; width: min(300px, calc(100% - 32px)); background: var(--raised); border-radius: 14px; box-shadow: var(--shadow-pop); z-index: 20; overflow: hidden; padding: 4px 0; }
.menu button { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 16px; min-height: 48px; font-size: 16px; text-align: left; }
.menu button + button::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; border-top: .5px solid var(--sep); }
.menu button:hover { background: var(--panel2); }
.menu .tick { margin-left: auto; color: var(--accent); }
.menu .mi { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: #fff; flex: none; }
.amount-card { background: var(--panel); border-radius: var(--r); margin: 6px 16px 24px; padding: 14px 16px 16px; text-align: center; }
.amount-card label { display: block; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .03em; }
.amount-card input { width: 100%; text-align: center; border: 0; outline: 0; background: transparent; font-size: 44px; line-height: 1.1; font-weight: 600; letter-spacing: -.025em; margin-top: 4px; font-variant-numeric: tabular-nums; }
#adjInfo { margin-top: 6px; }
.fcard { background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; overflow: hidden; }
.frow { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 50px; padding: 11px 16px; text-align: left; font-size: 17px; }
.frow + .frow::before, .frow + div > .frow::before { content: ""; position: absolute; top: 0; left: 54px; right: 0; border-top: .5px solid var(--sep); }
.frow:not(:has(> svg:first-child, > .cat-ico:first-child, > span:first-child > svg, > button > svg)) + .frow::before, .fcard > .frow:first-child + .frow:not(:has(svg))::before { left: 16px; }
.frow input, .frow select, .frow textarea { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; min-width: 0; padding: 0; }
.frow input::placeholder, .search input::placeholder, .amount-card input::placeholder { color: var(--muted); }
.frow select { appearance: none; cursor: pointer; }
.frow .ph { color: var(--muted); flex: 1; }
.frow > svg, .frow > button > svg { color: var(--faint); flex: none; }
.frow > svg:last-child { color: var(--faint); opacity: .7; }
.frow .link { color: var(--accent); font-size: 15px; }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: var(--fill); border-radius: 16px; transition: background .25s; box-shadow: inset 0 0 0 .5px var(--sep); cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .16), 0 0 1px rgba(0, 0, 0, .2); transition: transform .25s cubic-bezier(.3, .7, .3, 1); }
.switch input:checked + span { background: #2FB45A; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 2px; padding: 4px 8px 12px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 12px; line-height: 1.2; border-radius: 10px; padding: 6px 2px; color: var(--text); }
.quick button span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quick button.on { background: var(--accent-fill); color: var(--accent); font-weight: 500; }
.quick button:hover:not(.on) { background: var(--panel2); }
.sub-h { padding: 4px 16px 4px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .02em; }
.fcard .sub-h { padding-top: 10px; border-top: .5px solid var(--sep); margin-left: 16px; padding-left: 0; }
.save-wrap { padding: 0 16px 24px; display: grid; gap: 10px; }
.details-toggle { display: flex; justify-content: center; align-items: center; min-height: 50px; color: var(--accent); }

/* lists (settings style) */
.list { background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; overflow: hidden; }
.list.flat { border-radius: var(--r); margin: 0 16px 24px; }
.li { position: relative; display: flex; align-items: center; gap: 14px; width: 100%; min-height: 48px; padding: 10px 16px; text-align: left; font-size: 17px; }
.li + .li::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--sep); }
.li:has(> .bx, > .cat-ico) + .li::before { left: 60px; }
.li > svg:last-child { color: var(--faint); opacity: .7; flex: none; }
.li.red { color: var(--red); }
.li .val { color: var(--muted); }
.li select, .li input[type=number], .li input[type=text] { border: 0; background: transparent; color: var(--muted); font-size: 17px; text-align: right; outline: 0; max-width: 55%; appearance: none; cursor: pointer; }
.li select { padding-right: 18px; background: linear-gradient(45deg, transparent 50%, var(--faint) 50%) right 6px top 55% / 6px 6px no-repeat, linear-gradient(-45deg, transparent 50%, var(--faint) 50%) right 0 top 55% / 6px 6px no-repeat; }
.bx { width: 30px; height: 30px; border-radius: 8px; background: var(--accent-solid); color: #fff; display: grid; place-items: center; flex: none; }
.bx svg { width: 18px; height: 18px; }
.bx.av { border-radius: 50%; width: 32px; height: 32px; font-size: 14px; font-weight: 600; }
.bx.red { background: var(--red); } .bx.green { background: var(--green); } .bx.gray { background: #8E8E93; } .bx.orange { background: #E8831A; } .bx.purple { background: #7A5AF8; } .bx.teal { background: #0F8A8A; } .bx.pink { background: #D23F7A; }
.li .sub2 { color: var(--muted); font-size: 14px; }

/* categories */
.ctabs { display: flex; margin: 8px 16px 12px; background: var(--fill); border-radius: 9px; padding: 2px; }
.ctabs button { flex: 1; padding: 6px; font-size: 14px; font-weight: 500; border-radius: 7px; text-align: center; }
.ctabs button.on { background: var(--raised); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.search { display: flex; align-items: center; gap: 8px; margin: 8px 16px 16px; padding: 0 10px; min-height: 38px; border-radius: 10px; background: var(--fill); color: var(--muted); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 17px; color: var(--text); min-width: 0; padding: 8px 0; }
.cgroup { background: var(--panel); border-radius: var(--r); margin: 0 16px 16px; overflow: hidden; }
.crow { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 16px 8px 4px; text-align: left; font-size: 17px; }
.crow.parent { font-weight: 600; }
.crow.child { padding-left: 60px; }
.crow.child::before { content: ""; position: absolute; top: 0; left: 104px; right: 0; border-top: .5px solid var(--sep); }
.cgroup .icon-btn { color: var(--faint); }

/* reports */
.fin { background: var(--panel); border-radius: var(--r); margin: 0 16px 24px; padding: 16px; }
.fin .t { color: var(--muted); font-size: 15px; }
.fin .v { font-size: 34px; line-height: 1.1; font-weight: 600; letter-spacing: -.02em; margin: 4px 0 14px; }
.fin .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fin .two button { position: relative; background: var(--fill); border-radius: 12px; padding: 10px 12px; text-align: left; font-size: 14px; color: var(--muted); }
.fin .two b { display: block; margin-top: 2px; font-size: 17px; color: var(--text); }
.fin .two svg { position: absolute; right: 8px; top: 10px; color: var(--faint); }
.mnav { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 17px; font-weight: 600; margin-bottom: 12px; }
.mnav .icon-btn { color: var(--accent); }
.sum3 { display: grid; grid-template-columns: repeat(3, 1fr); text-align: center; background: var(--fill); border-radius: 12px; padding: 10px 4px; }
.sum3 > div + div { border-left: .5px solid var(--sep); }
.sum3 .l { color: var(--muted); font-size: 13px; } .sum3 .n { font-weight: 600; margin-top: 2px; font-size: 15px; white-space: nowrap; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-top: 8px; }
.cal .dh { text-align: center; color: var(--muted); font-size: 12px; padding: 8px 0 4px; }
.cal .d { border-radius: 8px; min-height: 58px; padding: 4px 3px; font-size: 14px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1px; overflow: hidden; }
.cal .d:hover { background: var(--panel2); }
.cal .d > span:first-child { width: 26px; height: 26px; line-height: 26px; border-radius: 50%; }
.cal .d.today > span:first-child { background: var(--accent-solid); color: var(--on-accent); font-weight: 600; }
.cal .d .in, .cal .d .ex { font-size: 12px; font-weight: 500; letter-spacing: -.02em; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-bars { display: flex; gap: 14px; align-items: flex-end; height: 96px; }
.mini-bars .c { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 18px; height: 100%; justify-content: flex-end; font-size: 12px; }
.mini-bars .c div { width: 18px; background: var(--fill); border-radius: 4px; height: 80px; display: flex; align-items: flex-end; overflow: hidden; }
.mini-bars .c div i { width: 100%; background: var(--red); border-radius: 4px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl td { padding: 10px 0; border-top: .5px solid var(--sep); }
.tbl tr:first-child td { border: 0; color: var(--muted); font-size: 13px; padding-top: 0; }
.tbl tr:last-child td { font-weight: 600; border-top: 1px solid var(--sep); }

/* tab bar */
.tabbar { position: fixed; left: 50%; bottom: 0; transform: translateX(-50%); width: 100%; max-width: 520px; z-index: 10; display: flex; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  background: var(--bar-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: .5px solid var(--sep); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.tabbar button.on { color: var(--accent); }
.tabbar .plus { width: 26px; height: 26px; border-radius: 8px; box-shadow: inset 0 0 0 1.6px currentColor; color: inherit; display: grid; place-items: center; margin-bottom: 1px; }
.tabbar button.on .plus { background: var(--accent-solid); color: var(--on-accent); }

/* sheets, popups, toast */
.sheet { position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .32); animation: fade .2s ease-out; }
.sheet .panel { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; background: var(--ground); border-radius: 14px 14px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom)); animation: rise .32s cubic-bezier(.2, .8, .2, 1); }
.sheet .panel .topbar { border-radius: 14px 14px 0 0; }
.sheet .panel .search { margin-top: 12px; }
.sheet .list { margin-top: 0; }
.sheet.center { align-items: center; padding: 16px; }
.sheet .panel.dp { max-width: 360px; border-radius: 16px; background: var(--raised); padding: 8px 12px 14px; box-shadow: var(--shadow-pop); animation: pop .22s cubic-bezier(.2, .8, .2, 1); }
.dp-nav { display: flex; align-items: center; gap: 0; padding-bottom: 6px; }
.dp-nav .icon-btn { color: var(--accent); font-size: 20px; }
.dp-nav b { flex: 1; text-align: center; font-size: 17px; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; padding: 4px 0 10px; text-align: center; }
.dp-grid span { color: var(--muted); font-size: 12px; padding: 6px 0; font-weight: 500; }
.dp-grid button { aspect-ratio: 1; border-radius: 50%; font-size: 17px; font-variant-numeric: tabular-nums; }
.dp-grid button:hover { background: var(--fill); }
.dp-grid button.on { background: var(--accent-solid); color: var(--on-accent); font-weight: 600; }
.dp-foot { display: flex; align-items: center; gap: 8px; border-top: .5px solid var(--sep); padding-top: 10px; }
.dp-foot .btn { width: auto; min-height: 40px; padding: 8px 16px; font-size: 15px; }
.dp-foot .btn.ghost { background: var(--fill); color: var(--text); }
.dp-foot .link { font-size: 15px; font-weight: 500; padding: 8px 4px; }
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40; max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 22px; background: rgba(30, 30, 32, .94); color: #fff; font-size: 15px; box-shadow: var(--shadow-pop); animation: pop .2s cubic-bezier(.2, .8, .2, 1); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
@keyframes pop { from { transform: translate(var(--tx, 0), 6px) scale(.97); opacity: 0; } }
.toast { --tx: -50%; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* theme picker */
.theme-card { display: block; width: calc(100% - 32px); margin: 0 16px 16px; padding: 14px; text-align: left; background: var(--panel); border-radius: var(--r); box-shadow: inset 0 0 0 2px transparent; }
.theme-card.on { box-shadow: inset 0 0 0 2px var(--accent); }
.preview { height: 132px; border-radius: 10px; display: flex; gap: 12px; justify-content: center; align-items: center; margin-bottom: 12px; }
.preview .ph { width: 62px; height: 110px; border-radius: 10px; padding: 8px 6px; display: flex; flex-direction: column; gap: 6px; }
.preview .ph i { display: block; height: 10px; border-radius: 3px; }
.theme-card .nm { display: flex; justify-content: space-between; font-size: 17px; }
.theme-card .nm svg { color: var(--accent); }

/* profile (Khác) */
.profile { display: flex; align-items: center; gap: 14px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(180deg, #A1A1AA, #8E8E93); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 600; flex: none; }
.profile input { font-size: 20px; font-weight: 600; border: 0; background: transparent; width: 100%; outline: 0; padding: 0; }
.profile .muted { font-size: 14px; }

@media (min-width: 700px) {
  body { background: var(--ground); }
  .app { padding-top: 12px; }
}
.frow .acc-ico { width: 30px; height: 30px; border-radius: 8px; }
.frow .acc-ico svg { width: 18px; height: 18px; }
.frow .cat-ico.sm { margin: -2px 0; }

/* finish-review fixes */
body.dark .seg button.on, body.dark .stat.on, body.dark .ctabs button.on { background: #636366; }
.frow:focus-within, .amount-card:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.frow:focus-within { border-radius: var(--r-sm); }
.frow input::-webkit-calendar-picker-indicator { opacity: 0; position: absolute; inset: 0; width: auto; height: auto; cursor: pointer; }
.frow:has(input[type=datetime-local]) { position: relative; }
.amount-card.rec { padding: 18px 16px; }
.amt-row { display: flex; align-items: baseline; justify-content: center; gap: 6px; }
.amt-row input { width: auto; flex: 0 1 auto; field-sizing: content; min-width: 1ch; max-width: 100%; font-size: 52px; margin: 0; }
.amt-row .cur { font-size: 30px; font-weight: 600; color: var(--muted); }
