/* Phone layout (screens under 1000px): one answer on the home screen, everything else in the drawer. */
.ph { position: relative; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; overflow: hidden; overflow: clip; background: var(--bg); }
@media (min-width: 600px) { .ph { border-left: 1px solid var(--line); border-right: 1px solid var(--line); } }

.ph .view { position: absolute; inset: 0; display: flex; flex-direction: column; transition: transform .32s cubic-bezier(.4,0,.2,1); background: var(--bg); }
.ph .view.off { transform: translateX(100%); }

/* home */
.ph .home { transition: background .4s; padding-bottom: env(safe-area-inset-bottom); }
.ph .hbar { display: flex; align-items: center; justify-content: space-between; padding: calc(18px + env(safe-area-inset-top)) 22px 6px; }
.ph .hdate { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.ph .ava { width: 36px; height: 36px; border-radius: 50%; border: none; background: var(--accent); color: var(--on-accent); display: grid; place-items: center; font-weight: 800; font-size: .84rem; cursor: pointer; }
.ph .horizon { display: flex; gap: 4px; align-self: center; background: color-mix(in srgb, var(--ink) 6%, transparent); border-radius: 999px; padding: 3px; margin: 4px auto 0; }
.ph .horizon button { border: none; background: none; font-weight: 700; font-size: .8rem; color: var(--ink-2); padding: 8px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.ph .horizon button.on { background: var(--card); color: var(--ink); box-shadow: var(--sh-sm); }
.ph .act { margin: 2px 22px 0; display: flex; flex-direction: column; }
.ph .act .none { border: none; border-radius: 14px; background: none; color: var(--ink-2); padding: 10px; min-height: 44px; font-weight: 700; font-size: .88rem; cursor: pointer; }
.ph .peek { margin: 6px 20px 18px; display: flex; align-items: center; gap: 6px; border: none; border-radius: 14px; padding: 13px 14px; background: color-mix(in srgb, var(--ink) 5%, transparent); font-weight: 700; font-size: .88rem; color: var(--ink); cursor: pointer; }
.ph .peek .pk { width: 10px; height: 10px; border-radius: 3px; }
.ph .peek .pkt { margin-left: 6px; flex: 1; text-align: left; }
.ph .peek svg { width: 18px; height: 18px; color: var(--ink-3); }

/* drawer and sheets */
.ph .scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 8; }
.ph .scrim.show { opacity: 1; pointer-events: auto; }
.ph .drawer { position: absolute; left: 0; right: 0; bottom: 0; background: var(--bg); border-radius: 28px 28px 0 0; z-index: 9; transform: translateY(100%); transition: transform .34s cubic-bezier(.4,0,.2,1); max-height: 88%; overflow-y: auto; padding: 10px 20px calc(26px + env(safe-area-inset-bottom)); }
.ph .drawer.show { transform: translateY(0); }
.ph .dgrip { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 16px; }
.ph .dclose { position: absolute; top: 6px; right: 8px; width: 44px; height: 44px; border: none; background: none; border-radius: 12px; color: var(--ink-3); display: grid; place-items: center; cursor: pointer; z-index: 2; }
.ph .dclose svg { width: 20px; height: 20px; }
.ph .dh { font-family: var(--fd); font-weight: 600; font-size: 1.05rem; margin: 14px 2px 10px; }
.ph .spaces { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ph .space { border-radius: 16px; padding: 13px 14px; cursor: pointer; border: 1px solid transparent; text-align: left; }
.ph .space .sn { font-weight: 700; font-size: .88rem; }
.ph .space .sv { font-family: var(--fd); font-weight: 600; font-size: 1.3rem; margin: 6px 0 6px; }
.ph .space .scap { font-size: .7rem; color: var(--ink-3); font-weight: 600; margin: -3px 0 8px; }
.ph .space .sbar { height: 5px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; }
.ph .space .sbar > span { display: block; height: 100%; }
.ph .sp-food { background: var(--food-bg); } .ph .sp-food .sv { color: var(--food-ink); } .ph .sp-food .sbar > span { background: var(--food); }
.ph .sp-fun { background: var(--fun-bg); } .ph .sp-fun .sv { color: var(--fun-ink); } .ph .sp-fun .sbar > span { background: var(--fun); }
.ph .sp-travel { background: var(--travel-bg); } .ph .sp-travel .sv { color: var(--travel-ink); } .ph .sp-travel .sbar > span { background: var(--travel); }
.ph .sp-home { background: var(--home-bg); } .ph .sp-home .sv { color: var(--home-ink); } .ph .sp-home .sbar > span { background: var(--home); }
.ph .space .sv.over { color: var(--over); }
.ph .tools { display: flex; flex-direction: column; margin-top: 6px; }
.ph .tool { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border: none; border-bottom: 1px solid var(--line); cursor: pointer; background: none; width: 100%; text-align: left; }
.ph .tool:last-child { border-bottom: none; }
.ph .tool .tic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.ph .tool .tic svg { width: 19px; height: 19px; }
.ph .tool .tt { flex: 1; font-weight: 700; font-size: .92rem; white-space: nowrap; }
.ph .tool .ts { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.ph .tool .chev { color: var(--ink-3); display: grid; }
.ph .ti-bills { background: var(--warn-bg); color: var(--warn); } .ph .ti-save { background: var(--travel-bg); color: var(--travel-ink); }
.ph .ti-debt { background: var(--debt-bg); color: var(--debt-ink); } .ph .ti-net { background: var(--good-bg); color: var(--good); }
.ph .ti-ins { background: var(--home-bg); color: var(--home-ink); } .ph .ti-set { background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink-2); }

/* inner pages */
.ph .sub { z-index: 7; }
.ph .subbar { display: flex; align-items: center; gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 18px 10px; }
.ph .back { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--ink) 6%, transparent); border: none; display: grid; place-items: center; cursor: pointer; color: var(--ink); }
.ph .back svg { width: 20px; height: 20px; }
.ph .subbar h2 { font-family: var(--fd); font-weight: 600; font-size: 1.35rem; margin: 0; }
.ph .subwrap { flex: 1; min-height: 0; padding: 6px 20px calc(26px + env(safe-area-inset-bottom)); overflow-y: auto; }
.ph .hero2 { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px; margin-bottom: 14px; }
.ph .hero2 .l { font-size: .74rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.ph .hero2 .n { font-family: var(--fd); font-weight: 600; font-size: 2.4rem; margin: 6px 0 0; letter-spacing: -.01em; }
.ph .hero2 .n.over { color: var(--over); }
.ph .hero2 .s2 { font-size: .8rem; color: var(--ink-3); font-weight: 600; margin-top: 3px; line-height: 1.4; }
.ph .hero2 .b { height: 7px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); margin-top: 14px; overflow: hidden; }
.ph .hero2 .b > span { display: block; height: 100%; }
.ph .line { display: flex; align-items: center; gap: 13px; padding: 13px 2px; border-bottom: 1px solid var(--line); }
.ph .line .d { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.ph .line .d svg { width: 17px; height: 17px; }
.ph .line .lm { flex: 1; min-width: 0; }
.ph .line .lt { font-weight: 700; font-size: .9rem; }
.ph .line .ls { font-size: .76rem; color: var(--ink-3); font-weight: 600; }
.ph .line .la { font-family: var(--fd); font-weight: 600; }
.ph .line.fresh { animation: ph-fresh 1.6s ease-out; border-radius: 10px; }
@keyframes ph-fresh { from { background: var(--fresh); } to { background: transparent; } }
.ph .line .rm { border: none; background: none; color: var(--ink-3); font-size: 1.3rem; line-height: 1; min-width: 44px; min-height: 44px; display: grid; place-items: center; border-radius: 10px; cursor: pointer; margin: -6px -10px -6px 0; }
.ph .line .rm:active { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--over); }
.ph .listempty { font-size: .84rem; color: var(--ink-3); font-weight: 600; margin: 4px 2px 8px; }
.ph .pbtn { border: 1px solid var(--line); background: var(--card); border-radius: 10px; min-height: 40px; padding: 0 12px; font-weight: 700; font-size: .78rem; cursor: pointer; color: var(--ink); margin-left: 8px; flex: none; }
.ph .pbtn.primary { display: block; background: var(--ink); color: var(--bg); border-color: var(--ink); width: 100%; min-height: 48px; margin: 0 0 6px; font-size: .92rem; }
.ph .ptip { display: flex; gap: 9px; border-radius: 12px; padding: 11px 12px; font-size: .8rem; font-weight: 600; margin: 14px 0 2px; line-height: 1.45; }
.ph .ptip svg { width: 17px; height: 17px; flex: none; margin-top: 1px; }
.ph .ptip.ok { background: var(--good-bg); color: var(--good-ink); } .ph .ptip.warn { background: var(--warn-bg); color: var(--warn-ink); } .ph .ptip.over { background: var(--over-bg); color: var(--over-ink); }
.ph .pgoal { padding: 13px 0; border-bottom: 1px solid var(--line); } .ph .pgoal:last-child { border-bottom: none; }
.ph .pgoal .gt { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; font-size: .9rem; }
.ph .pgoal .gv { font-family: var(--fd); }
.ph .pgoal .gv small { font-family: var(--fb); color: var(--ink-3); font-weight: 600; }
.ph .pgoal .gb { height: 6px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 8%, transparent); overflow: hidden; margin: 9px 0 6px; }
.ph .pgoal .gb > span { display: block; height: 100%; background: var(--food); border-radius: 999px; }
.ph .pgoal .gs { font-size: .76rem; color: var(--ink-3); font-weight: 600; }
.ph .phb { display: grid; grid-template-columns: 70px 1fr 66px; gap: 10px; align-items: center; padding: 9px 0; font-size: .84rem; font-weight: 700; }
.ph .phb .tr { height: 10px; border-radius: 999px; background: color-mix(in srgb, var(--ink) 6%, transparent); overflow: hidden; }
.ph .phb .tr span { display: block; height: 100%; border-radius: 999px; }
.ph .phb .v { text-align: right; font-family: var(--fd); }
.ph .pset { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: .88rem; }
.ph .pset .k { font-weight: 700; } .ph .pset .v { color: var(--ink-2); font-weight: 600; text-align: right; }
.ph .ptotal { display: flex; justify-content: space-between; border-top: 2px solid var(--ink); padding-top: 10px; margin: 2px 0 4px; font-weight: 800; font-size: .9rem; }

/* add-spending sheet */
.ph .sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--card); border-radius: 26px 26px 0 0; z-index: 11; transform: translateY(100%); transition: transform .32s cubic-bezier(.4,0,.2,1); padding: 10px 20px calc(24px + env(safe-area-inset-bottom)); }
.ph .sheet.show { transform: translateY(0); }
.ph .shgrip { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 10px; }
.ph .shh h3 { font-family: var(--fd); font-weight: 600; margin: 0 0 6px; font-size: 1.12rem; }
.ph .ghost { position: absolute; top: 8px; right: 10px; width: 44px; height: 44px; display: grid; place-items: center; background: none; border: none; color: var(--ink-3); cursor: pointer; }
.ph .ghost svg { width: 22px; height: 22px; }
.ph .amt { font-family: var(--fd); text-align: center; font-size: 3rem; font-weight: 600; margin: 6px 0; letter-spacing: -.02em; }
.ph .amt.empty { color: var(--ink-3); }
.ph .again { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 8px; scrollbar-width: none; }
.ph .again::-webkit-scrollbar { display: none; }
.ph .againchip { display: inline-flex; align-items: center; gap: 7px; flex: none; border: 1px solid var(--line); border-radius: 999px; padding: 9px 12px; background: var(--card); cursor: pointer; font-weight: 700; font-size: .82rem; }
.ph .againchip small { color: var(--ink-3); font-weight: 600; }
.ph .pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph .pad button { border: none; background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 14px; height: 52px; font-family: var(--fd); font-size: 1.5rem; font-weight: 500; cursor: pointer; }
.ph .pad button:active { background: color-mix(in srgb, var(--ink) 12%, transparent); }
.ph .save { margin-top: 10px; width: 100%; border: none; border-radius: 15px; padding: 15px; background: var(--ink); color: var(--bg); font-weight: 700; font-size: .98rem; cursor: pointer; }

/* closed panels: not visible, not focusable */
.ph .view.off, .ph .drawer:not(.show), .ph .sheet:not(.show) { visibility: hidden; transition-property: transform, visibility; transition-delay: 0s, .34s; }

/* messages: top on the home screen, bottom on inner pages (clear of the back button) */
.ph .toast { position: absolute; left: 16px; right: 16px; top: calc(14px + env(safe-area-inset-top)); z-index: 14; background: var(--ink); color: var(--bg); border-radius: 14px; padding: 13px 16px; font-size: .86rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: 12px; opacity: 0; transform: translateY(-12px); transition: all .25s; pointer-events: none; }
.ph .toast.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.ph .toast.low { top: auto; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateY(12px); }
.ph .toast.low.show { transform: translateY(0); }
.ph .toast button { border: none; background: color-mix(in srgb, var(--bg) 16%, transparent); color: var(--bg); font-weight: 800; padding: 6px 12px; border-radius: 9px; cursor: pointer; flex: none; }

.ph .hbig.pop { animation: ph-pop .4s ease-out; }
@keyframes ph-pop { 40% { transform: scale(1.05); } }
