/* iPhone / Safari refinements and consistent controls. */
:root{--body-text:#55647b;--subtle-text:#617189;--nav-clearance:112px;--visible-height:100dvh;--visible-top:0px;color-scheme:light}
html{scroll-padding-block:24px calc(var(--nav-clearance) + env(safe-area-inset-bottom,0px));-webkit-text-size-adjust:100%}
body{min-width:0}p{color:var(--body-text)}.eyebrow,.tiny-label,.notice,.private-label{color:var(--subtle-text)}
.app-content{min-width:0}.panel,.group-fields,.form-grid,.group-fields>label,.screen,fieldset{min-width:0;min-inline-size:0}
input,select,textarea{box-sizing:border-box;width:100%;max-width:100%;min-width:0;min-inline-size:0;font-size:16px;line-height:1.4;min-height:54px;border-radius:14px;border-color:#d8e1ef;background:#f8faff;color:#253750;scroll-margin-block:110px 180px}
input[type="date"]{display:block;appearance:none;-webkit-appearance:none;inline-size:100%;max-inline-size:100%;height:54px;text-align:left;padding:13px 42px 13px 14px;margin:0;overflow:hidden}
input::-webkit-date-and-time-value{text-align:left;min-height:1.4em;display:block}input::-webkit-datetime-edit{display:block;padding:0;min-width:0}input::-webkit-calendar-picker-indicator{position:absolute;right:12px;width:24px;height:24px;opacity:0}
.date-control{display:block;position:relative;width:100%;max-width:100%;min-width:0;margin-top:9px;overflow:hidden;border-radius:14px}.date-glyph{position:absolute;right:14px;top:15px;pointer-events:none;color:#7084a2}.date-glyph svg{width:22px;height:22px}.date-empty{position:absolute;inset:0 40px 0 15px;display:flex;align-items:center;pointer-events:none;color:#76849a;font-size:14px;font-weight:400}.date-control.has-date .date-empty{display:none}.date-control:not(.has-date) input::-webkit-datetime-edit{color:transparent}.date-control:not(.has-date) input::-webkit-date-and-time-value{color:transparent}
input:disabled{opacity:1;-webkit-text-fill-color:#56677f;color:#56677f;background:#eef2f7;border-style:dashed;cursor:not-allowed}
/* Let native date segments take over while typing; never overlay the hint. */
.date-control:focus-within .date-empty{display:none}
.date-control:not(.has-date):not(:focus-within) input{color:transparent;-webkit-text-fill-color:transparent}
.date-control:not(.has-date):focus-within input::-webkit-datetime-edit,.date-control:not(.has-date):focus-within input::-webkit-date-and-time-value{color:#253750;-webkit-text-fill-color:#253750}
label{font-size:14px;line-height:1.5;font-weight:600;color:#40516b}label small{font-size:12px;font-weight:400;line-height:1.6;color:#617189;margin-top:9px}input::placeholder{font-size:14px;color:#7e8ba0}
.icon-button,.hero .icon-button,.avatar{width:44px;height:44px;min-width:44px;min-height:44px}.hero .icon-button svg{width:20px;height:20px}
.button-link,button:not(.icon-button):not(#quickReminder){font-size:14px;min-height:48px;border-radius:13px}.primary-submit{width:100%;margin-top:8px;min-height:52px!important}
.muted{color:#617189!important;font-size:12px!important}.hero-status{font-size:12px}.hero-label{font-size:14px}.hero-bottom{font-size:13px}.hero-bottom small{font-size:11px;color:#e0ebff}.hero-pill{color:#fff;font-size:10px}
.hero-amount{font-size:clamp(30px,3.6vw,44px);overflow-wrap:anywhere;font-variant-numeric:tabular-nums;line-height:1.25}.hero-amount.unknown{font-size:32px}.metrics b,#reminderAmount{overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
.hero .green{background:#e5f7e9;color:#215e3b}.hero .amber{background:#fff2cf;color:#78500b}.hero .red{background:#ffe6e4;color:#9e302a}.hero .neutral{background:#eef1f6;color:#465973}
.notice{font-size:12px;background:#edf3e4;border:1px solid #dce7ce;border-radius:12px;padding:12px 14px;line-height:1.55}
.section-head>span:not(.square-icon){color:#64748b}.metrics span{font-size:12px;color:#5d6d84}.row p,.history-panel #purchases{color:#607088}.row b{font-size:14px}.row button{font-size:12px!important;min-height:44px!important;flex-shrink:0}.row>div{min-width:0}.row b{overflow-wrap:anywhere}.row{align-items:flex-start}
.form-grid{display:flex;flex-direction:column;gap:0}.setting-group{border:0;margin:0;padding:24px 0 8px;border-top:1px solid #e7edf6}.setting-group:first-child{border-top:0;padding-top:18px}.setting-group legend{float:left;display:flex;align-items:center;gap:10px;width:100%;font-size:16px;font-weight:700;color:#293b56}.setting-group legend span{display:grid;place-items:center;background:#edf3ff;color:#1764f5;width:28px;height:28px;border-radius:9px;font-size:11px}.group-hint{clear:both;font-size:12px;padding:9px 0 0;margin:0 0 20px}.group-fields{display:grid;grid-template-columns:1fr 1fr;gap:0 22px}.group-fields>label:only-child{grid-column:1/-1}.locked-note{font-size:12px;margin:0 0 16px;color:#52677f;background:#edf3fa;padding:12px;border-radius:10px}
.setup-explanation{background:#f7f9fc;padding:15px;margin:2px 0 20px;border-radius:12px}.setup-explanation summary{font-size:12px}.setup-explanation .muted{margin-bottom:0}
.feedback{border:1px solid #f1d6c9;background:#fff4ec;color:#8a3d1d!important;border-radius:12px;padding:12px 14px;font-size:13px!important;line-height:1.55}.feedback-success{background:#edf8ef;border-color:#cfebd6;color:#286440!important}#saved:empty,#purchaseSaved:empty,#payMessage:empty{display:none}
.page-heading h1{font-size:32px}.page-heading p{font-size:14px}.panel>p,.result p,.lesson p,details p{font-size:14px;line-height:1.65}.panel>h2{font-size:21px}.habit-panel .eyebrow{font-size:10px}.result{padding:18px}.result strong{font-size:26px}.result .eyebrow{font-size:10px}.panel .eyebrow{font-size:10px}.tip-banner p{color:#4f6846}.legend-card small{color:#607088;font-size:11px}.legend-card p{font-size:11px}.tip-banner .tiny-label{color:#526b40}.learning-hero p{color:#506745}summary{font-size:14px;min-height:24px}.sources{font-size:12px;line-height:1.7}
footer{font-size:11px;color:#66768d;line-height:1.8}.version-stamp{font-size:10px;color:#73849a}
#paymentReminder,#paymentEntry,#deleteMovement{box-sizing:border-box;border:1px solid #dfe7f4;border-radius:25px;padding:24px;width:min(460px,calc(100% - 32px));max-width:calc(100% - 32px);max-height:min(calc(100dvh - 32px),calc(var(--visible-height) - 32px));overflow:auto;overscroll-behavior:contain;color:#243149;box-shadow:0 25px 100px #162e6040;scrollbar-gutter:stable}
#deleteMovement::backdrop{background:#15294d66;backdrop-filter:blur(5px)}#paymentReminder h2,#paymentEntry h2,#deleteMovement h2{font-size:24px;line-height:1.3}.reminder-details{margin:18px 0}.reminder-details div{font-size:13px;gap:12px}.reminder-details dt{color:#607088}.reminder-details dd{max-width:60%;overflow-wrap:anywhere}.reminder-label{font-size:13px;margin-top:20px}#reminderNote,#deleteDescription,#payDebt{font-size:13px}#reminderAmount{font-size:32px}.reminder-actions{gap:10px}.reminder-heading{margin-bottom:15px}.reminder-actions .secondary-action{background:#eef3fc!important;color:#36527b!important}.reminder-actions .danger-action{background:#fff0ee!important;color:#a22b29!important}#deleteError{font-size:13px;color:#a22b29}body:has(dialog[open]){overflow:hidden}
@media(max-width:900px){
 :root{--nav-clearance:112px}
 .app-content{padding-bottom:calc(var(--nav-clearance) + env(safe-area-inset-bottom,0px) + 30px);padding-top:env(safe-area-inset-top,0px)}
 .bottom-nav{bottom:0;left:0;transform:none;max-width:none;width:100%;padding:8px max(14px,env(safe-area-inset-left,0px)) calc(8px + env(safe-area-inset-bottom,0px));border-radius:22px 22px 0 0;border:0;border-top:1px solid #dfe6f1;background:#ffffffed;box-shadow:0 -6px 28px #2238570b;gap:5px;-webkit-backdrop-filter:blur(18px);backdrop-filter:blur(18px)}
 .bottom-nav a{min-height:58px;font-size:11px;color:#586b85;border-radius:16px;gap:6px;padding:8px 4px}.bottom-nav a[aria-current]{color:#1155d0;background:#eaf1ff}.bottom-nav a svg{width:23px;height:23px}
 body.editing-field .bottom-nav{visibility:hidden;pointer-events:none}
 .toast{bottom:calc(100px + env(safe-area-inset-bottom,0px));max-width:calc(100vw - 32px);font-size:13px;padding:14px 18px}
 .app-header{height:78px;margin-bottom:22px}.app-header .icon-button,.app-header .avatar{width:40px;height:40px;min-width:40px;min-height:40px}.page-heading{margin:22px 0}
}
@media(max-width:600px){
 .app-content{padding-left:18px;padding-right:18px}.greeting h1{font-size:28px;line-height:1.2;max-width:310px}.greeting p{font-size:14px}.greeting .eyebrow{font-size:9px;line-height:1.5;letter-spacing:1.3px}.hero{padding:22px;min-height:230px}.hero-amount{font-size:clamp(28px,8.5vw,38px)}.hero-amount.unknown{font-size:32px}.hero-bottom{margin-top:18px;padding-top:14px}.hero-label{margin-top:16px}.quick-actions{margin:20px 0 24px;gap:8px}.quick-actions>a,.quick-actions>button{gap:9px;padding:0}.quick-actions b{font-size:11px;line-height:1.45;max-width:80px}.quick-actions>a>span,.quick-actions>button>span{width:50px;height:50px}.quick-actions a:hover,.quick-actions button:hover{transform:none}
 .panel{padding:20px;margin-bottom:20px}.panel>p,.next-step p{font-size:14px}.next-step{padding:20px}.next-step .button-link{font-size:14px;min-height:48px}.section-head{flex-wrap:wrap}.section-head h2{font-size:19px}.section-head>span:not(.square-icon){font-size:11px}.history-panel .section-head h2{font-size:18px}.history-panel .section-head button{font-size:12px!important;min-height:44px!important}.group-fields{grid-template-columns:minmax(0,1fr)}.setting-group legend{font-size:16px}.group-hint{font-size:13px}.setting-group{padding-top:22px}.page-heading h1{font-size:30px}.page-heading p{font-size:14px}.page-heading .eyebrow{font-size:10px}.metrics{gap:18px 12px}.metrics b{font-size:17px}.metrics>div:first-child b{font-size:28px}.status{font-size:12px}.actions{gap:10px}.actions button{flex:1;min-width:120px}.tip-banner>div:first-child{max-width:68%}.tip-banner p{font-size:13px}.legend-card b{font-size:13px}.legend-card p{font-size:11px;gap:7px}.legend-card small{font-size:12px}.row{gap:10px}.row b{font-size:13px}.row p{font-size:12px}
 #paymentReminder,#paymentEntry,#deleteMovement{padding:20px;width:calc(100% - 28px);max-width:440px;border-radius:24px;scrollbar-gutter:auto}.reminder-details div{flex-direction:column;gap:5px;padding:11px 0}.reminder-details dd{max-width:100%;text-align:left}#paymentReminder .muted{font-size:11px!important}.reminder-details{margin:15px 0}#reminderNote{font-size:12px}.reminder-label{margin:16px 0 5px}#paymentReminder h2{font-size:23px}.reminder-heading{margin-bottom:10px}label{margin-bottom:20px}.source{overflow-wrap:anywhere}
}
@media(max-width:900px){#paymentReminder[open],#paymentEntry[open],#deleteMovement[open]{position:fixed;inset:auto;left:50%;top:calc(var(--visible-top) + var(--visible-height)/2);transform:translate(-50%,-50%);margin:0}}
@media(max-width:360px){.app-content{padding-left:14px;padding-right:14px}.panel{padding:17px}.greeting h1{font-size:26px}.mobile-brand{font-size:18px}.header-actions{gap:6px}.quick-actions b{font-size:10px}.bottom-nav{padding-left:9px;padding-right:9px}.bottom-nav a{font-size:10px}.hero{padding:20px}.hero-pill{font-size:9px}}
