/* Transactions: header, wallet card with peeking accounts, detail panel, filter chips, list by day. */

.tx-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-1); padding: calc(var(--sp-3) + env(safe-area-inset-top)) var(--sp-3) var(--sp-2); }
.tx-head h1 { margin: 0 var(--sp-1) 0 0; font-size: min(var(--fs-hero), 12vw); font-weight: 800; letter-spacing: -.02em; text-wrap: balance; }
.tx-head .nav { width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: 50%; color: var(--text-2); }
.tx-head .nav:active { background: var(--fill); }
.tx-head .nav:last-child { margin-left: auto; }
.tx-head .year { display: inline-flex; align-items: center; gap: 2px; min-height: 32px; padding: 0 6px 0 10px; border-radius: 16px; background: var(--fill); color: var(--wine-600); font-size: var(--fs-head); font-weight: 700; }
.tx-head .year .ic { width: 16px; height: 16px; }
@media (prefers-color-scheme: dark) { .tx-head .year { color: var(--wine-200); } }

/* wallet: account cards peek above the front card */
.wallet { position: relative; margin: var(--sp-2) var(--sp-4) 0; padding-top: 16px; }
.stack { position: absolute; inset: 0 0 auto; height: 0; }
.acc { position: absolute; top: 0; left: calc(30px - var(--i) * 15px); right: calc(30px - var(--i) * 15px); height: 60px; border-radius: 20px; padding: 9px 16px;
  display: flex; justify-content: space-between; align-items: flex-start; font-size: var(--fs-small); transform: translateY(calc(var(--i) * 7px));
  opacity: calc(1 - (var(--i) > 1) * 1); transition: transform .45s var(--ease-out), left .45s var(--ease-out), right .45s var(--ease-out), opacity .3s; pointer-events: none; }
.acc:nth-child(n+3) { opacity: 0; left: 0; right: 0; } /* hidden cards stay inside, or 5+ accounts scroll the page sideways */
.front { position: relative; border-radius: 22px; overflow: hidden; color: var(--on-hero); background: var(--wallet); box-shadow: 0 12px 26px rgba(92, 20, 40, .3); transition: transform .45s var(--ease-out); }
.front .top { padding: 14px 18px 12px; }
.card-main { display: block; width: 100%; text-align: left; color: inherit; border-radius: 12px; }
.card-label { display: block; font-size: var(--fs-small); opacity: .9; }
.big { display: block; font-size: 2.1rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; margin: 4px 0 8px; }
.big small { font-size: .42em; margin-right: 4px; letter-spacing: 0; }
.big.over { color: #ffd0dc; }
.big-note { display: block; font-size: var(--fs-body); font-weight: 600; margin: 6px 0 8px; text-wrap: pretty; }
.tl { display: block; font-size: var(--fs-small); opacity: .9; }
.tl b { font-weight: 700; }
.front :focus-visible { outline-color: #fff; }

/* the week: one box per day, light = over that day's limit, dim = under, today fills left to right */
.wk { display: flex; gap: 4px; margin: 12px 0 2px; }
.box { flex: 1; min-width: 0; height: 30px; border-radius: 7px; background: rgba(255, 255, 255, .12); font-size: var(--fs-tiny); font-weight: 600; display: grid; place-items: center; color: rgba(255, 255, 255, .85); }
.box.under { background: rgba(255, 255, 255, .34); color: #fff; }
.box.over { background: rgba(255, 255, 255, .9); color: var(--wine-800); }
.box.today { outline: 2px solid #fff; outline-offset: 1px; background: linear-gradient(to right, rgba(255, 255, 255, .55) var(--p), rgba(255, 255, 255, .14) var(--p)); color: #fff; font-weight: 800; }
.box.future, .box.outside { opacity: .55; }
.box:disabled { cursor: default; }
.box.sel { box-shadow: 0 0 0 2px var(--wine-800), 0 0 0 4px #ffd6e0; }

/* the month on a ticket strip under a dashed tear line */
.strip { background: rgba(0, 0, 0, .22); border-top: 1.5px dashed rgba(255, 255, 255, .3); padding: 10px 18px 11px; font-size: var(--fs-small); }
.strip p { display: flex; justify-content: space-between; gap: var(--sp-2); margin: 0; }
.strip p + p { margin-top: 4px; }
.strip span { opacity: .9; }
.strip b { font-weight: 700; }

/* detail panel: month or one day */
.panel { margin: var(--sp-3) var(--sp-4) 0; background: var(--surface); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow-card); animation: rise-panel .3s var(--ease-out); }
@keyframes rise-panel { from { opacity: 0; transform: translateY(-6px); } }
.panel .hdr { display: flex; gap: 10px; align-items: flex-start; }
.panel .t { flex: 1; min-width: 0; }
.panel .r1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.panel h2 { margin: 0; font-size: var(--fs-body); font-weight: 700; }
.panel small { font-size: var(--fs-small); color: var(--text-2); }
.panel .st { font-size: var(--fs-tiny); font-weight: 700; border-radius: 10px; padding: 3px 9px; white-space: nowrap; background: var(--fill); color: var(--text-2); }
.panel .st.over { background: #fde3e8; color: #a3123a; }
.panel .st.under { background: #e3f4e7; color: #1e6b30; }
.x2 { flex: none; width: var(--tap); height: var(--tap); margin: -8px -8px 0 0; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.x2 .ic { width: 18px; height: 18px; }
.rows { margin-top: 6px; }
.ir { display: flex; gap: 10px; align-items: center; width: 100%; padding: 7px 6px; border-radius: 12px; text-align: left; }
.ir.on, .ir:active { background: var(--fill); }
.ir .tile { width: 28px; height: 28px; }
.ir-t { flex: 1; min-width: 0; }
.ir .l1, .ir .l2 { display: flex; justify-content: space-between; gap: 8px; }
.ir .l1 b { font-size: var(--fs-small); }
.ir .l2 { font-size: var(--fs-tiny); color: var(--text-2); margin-top: 2px; }
.bt { display: block; height: 4px; border-radius: 2px; background: var(--fill); margin-top: 4px; overflow: hidden; }
.bt i { display: block; height: 100%; border-radius: 2px; }
@media (prefers-color-scheme: dark) { .panel .st.over { background: #4a1020; color: #ffb3c6; } .panel .st.under { background: #12351c; color: #8be3a0; } }

/* what the list is filtered to */
.fchips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--sp-3) var(--sp-4) 0; }
.fchip { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 0 8px 0 12px; border-radius: 17px; background: var(--text); color: var(--bg); font-size: var(--fs-small); font-weight: 600; }
.fchip .ic { width: 14px; height: 14px; }

/* entries by day */
.list { padding: 0 var(--sp-4); }
.dh { display: flex; justify-content: space-between; margin: var(--sp-4) 4px var(--sp-1); font-size: var(--fs-head); font-weight: 600; color: var(--text-2); }
.rw { position: relative; border-radius: 14px; overflow: hidden; }
.rw .row { background: var(--bg); padding-left: 4px; border-radius: 14px; }
.rw .row-body { border-bottom: 0; }
.row.is-new { animation: slide-in .4s var(--ease-out); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-8px); } }

/* account picker sheet */
.pick .badge { flex: none; display: grid; place-items: center; min-width: 32px; height: 26px; padding: 0 5px; border-radius: 8px; font-size: var(--fs-tiny); font-weight: 800; }
.pick .ic { color: var(--tint); }

/* hold the card: accounts fan out above it */
.wallet { transition: padding-top .45s var(--ease-out); }
.wallet.open { padding-top: calc(var(--n) * 50px + 8px); }
.wallet.open .acc { left: 0; right: 0; height: 58px; opacity: 1; pointer-events: auto; transform: translateY(calc(var(--i) * 50px)); }
.wallet.open .acc:focus-visible { outline: 2px solid var(--tint); outline-offset: 2px; }
.front { touch-action: pan-y; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }

/* row actions under a sliding row */
.rw .row { position: relative; transform: translateX(var(--dx, 0)); transition: transform .3s var(--ease-out); touch-action: pan-y; -webkit-touch-callout: none; }
.rw.drag .row { transition: none; }
.rw.opened .row { transform: translateX(-150px); }
.acts { position: absolute; inset: 0; display: flex; justify-content: flex-end; opacity: 0; }
.rw.drag .acts, .rw.opened .acts { opacity: 1; }
.acts button { width: 75px; color: #fff; font-size: var(--fs-small); font-weight: 600; }
.acts [data-copy] { background: #636366; }
.acts [data-del] { background: #c8102e; }
.acts .again { display: none; align-items: center; gap: 4px; margin-right: auto; padding-left: 14px; width: 100%; background: var(--green-600); color: #fff; font-size: var(--fs-small); font-weight: 600; }
.acts .again .ic { width: 16px; height: 16px; }
.rw.right .acts .again { display: flex; }
.rw.right .acts button { display: none; }
.danger { color: var(--wine-500); }

/* slim bar once the card scrolls away */
.mini { position: fixed; z-index: 9; left: 50%; transform: translateX(-50%); top: calc(8px + env(safe-area-inset-top)); width: min(528px, calc(100% - 32px)); min-height: var(--tap);
  display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); padding: 0 16px; border-radius: 16px; color: #fff; background: var(--wallet); box-shadow: var(--shadow-float); font-size: var(--fs-small); animation: rise-panel .25s var(--ease-out); }
.mini b { font-size: var(--fs-body); }

/* List | Calendar switch and the month grid */
.txbar { display: flex; align-items: center; gap: var(--sp-2); margin: var(--sp-3) var(--sp-3) var(--sp-2); }
.txview { flex: 1; margin: 0; }
.find { flex: none; width: var(--tap); height: var(--tap); display: grid; place-items: center; border-radius: 50%; color: var(--text-2); background: var(--fill); }
.find:active { background: var(--separator); }
/* search sheet */
.sheet:has(.search-top) { height: calc(100dvh - 24px); } /* full height: it does not jump as results change */
.search-top { position: sticky; top: 0; z-index: 1; display: grid; gap: var(--sp-2); margin: 0 0 var(--sp-2); padding: var(--sp-2) 0; background: var(--bg); } /* the field stays while results scroll */
.search-q { margin: 0 var(--sp-3); min-height: var(--tap); padding: 0 var(--sp-3); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-card); font-size: 16px; color: var(--text); }
.search-sum { margin: 0 var(--sp-5); font-variant-numeric: tabular-nums; }
.search-top .seg button { min-height: 36px; }
[data-hits] .row-body b { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.more-hits { display: block; margin: var(--sp-2) auto var(--sp-4); }
.txview button { min-height: 36px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin: 0 var(--sp-3) var(--sp-2); }
.cal .wh { text-align: center; font-size: var(--fs-tiny); font-weight: 600; color: var(--text-2); padding: 2px 0; }
.cd { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 1px; min-height: 52px; padding: 4px 1px;
  border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-card); font-variant-numeric: tabular-nums; overflow: hidden; }
.cd .n { font-size: var(--fs-head); font-weight: 600; }
.cd .o { font-size: var(--fs-tiny); color: var(--text); }
.cd .i { font-size: var(--fs-tiny); color: var(--income); font-weight: 600; }
.cd.today { box-shadow: inset 0 0 0 2px var(--tint); }
.cd[aria-pressed="true"] { background: var(--primary); color: #fff; }
.cd[aria-pressed="true"] .o, .cd[aria-pressed="true"] .i { color: #fff; }
.cal-hint { text-align: center; margin: var(--sp-3) var(--sp-5); }
