/* Shared roles: retain readable money, distinct supporting figures, and the existing layout. */
:root{--weight-hero:650;--radius-leading:24px;--radius-report:20px;--radius-inset:16px;--radius-action:12px}
#app :is(.home-hero-budget,.mobile-budget-summary,.account-card,.settings-menu-group),dialog .private-loan-hero{border-radius:var(--radius-leading)}
#app[data-route=stats] .stats-studio :is(.stats-hero,.stats-trend,.stats-analyzer,.stats-spending-context,.stats-weeks),dialog :is(.private-overview,.private-month-summary){border-radius:var(--radius-report)}
#app .stats-glance-card{border-radius:var(--radius-leading);padding:20px;box-shadow:none}
#app .glance-value{font-size:24px;font-weight:600;line-height:1.25}
#app[data-route=home][data-home-view=daily] .home-ledger-layout .transaction-text>strong,#app[data-route=home][data-home-view=daily] .home-ledger-layout .transaction-amount{font-weight:500}
#app[data-route=stats] .stats-studio h2.stats-hero-number{font-size:clamp(32px,4vw,44px);font-weight:650}
#app[data-route=stats] .stats-hero-sub .stats-number{font-weight:600}
#app .hero-remaining strong,#app .mobile-remaining strong,#app .mobile-unset-overview strong,.private-loan-total{font-weight:650}
#app[data-route=accounts] .accounts-summary .metric:first-child .metric-value{font-weight:650}
#app[data-route=accounts] .accounts-summary .metric:not(:first-child) .metric-value{font-size:20px;font-weight:500;color:var(--text)}
#app .account-delta{color:var(--muted)}
.account-balance,.detail-amount,.private-loan-total,.private-payment-result strong,.private-payment-split dd{font-variant-numeric:tabular-nums}
.private-row-amount strong{font-weight:500}.private-payment-result strong,.private-payment-split dd{font-weight:600}
.private-burn,.private-interest-math,.private-terms,.private-asof-note{font-weight:400;line-height:1.5}
.button,.icon-button,input,select,textarea{border-radius:var(--radius-action)}
.segmented,.chip,.filter-chip,.badge,.view-tabs{border-radius:var(--radius-pill,999px)}
.icon{width:20px;height:20px;stroke-width:1.75}
.navigation .icon{width:23px;height:23px}
.icon-button{min-height:44px;min-width:44px}
.settings-menu-symbol,.transaction-icon{border-radius:var(--radius-sm)}
.setting-row small,.section-heading p,.private-loan-since{line-height:1.5}
.entry-fields :is(label>small,.small),.private-loan-metrics dt{font-weight:400}
.private-payment-result>span{display:grid;gap:4px}
.private-repayment-review .private-payment-split{border-radius:var(--radius-md);background:var(--subtle);padding:16px}
.history-explorer{min-width:0;margin-block:16px}
.history-toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap}
.history-toolbar h4{font-size:var(--text-base);font-weight:600;margin:0}
.history-toolbar label{display:flex;align-items:center;gap:8px;font-size:var(--text-xs);color:var(--muted)}
.history-toolbar select{min-height:44px;max-width:140px}
.history-plot{display:block;width:100%;height:auto;touch-action:pan-y;cursor:crosshair;overflow:visible}
.history-plot text{fill:var(--muted);font:11px var(--font-ui)}
.history-grid{stroke:var(--border);stroke-width:1}.history-line{stroke:var(--reference-blue,var(--brand));stroke-width:2;fill:none;vector-effect:non-scaling-stroke}
.history-record-dot{fill:var(--warning)}.history-guide{stroke:var(--muted);stroke-width:1;stroke-dasharray:3 4}
.history-selected-dot{fill:var(--reference-blue,var(--brand));stroke:var(--surface);stroke-width:2}
[data-history-output]{display:block;min-height:66px;padding:12px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--subtle);font-size:var(--text-sm);font-variant-numeric:tabular-nums;line-height:1.5}
.history-scrubber{display:grid;gap:2px;font-size:var(--text-xs);color:var(--muted);margin-top:8px}
.history-scrubber input{width:100%;min-height:44px;padding:0;accent-color:var(--brand)}
.history-record-markers{display:flex;gap:6px;flex-wrap:wrap;margin-block:8px}
.history-record-markers button{min-height:44px;white-space:normal;text-align:left;font-size:var(--text-xs)}
.history-record-markers [aria-pressed=true]{background:var(--subtle);border-radius:var(--radius-sm);text-decoration:underline;text-underline-offset:4px}
.history-values>summary{min-height:44px;padding-block:10px}
.history-values .table-scroll{max-height:260px;overflow:auto}
.history-values :is(th,td){font-size:var(--text-xs);font-variant-numeric:tabular-nums}
.projection-inspection output{display:block;min-height:76px;background:var(--subtle);border-radius:var(--radius-sm);padding:12px;font-size:var(--text-sm);line-height:1.5;font-variant-numeric:tabular-nums}
.projection-inspection label{display:grid;gap:4px;font-size:var(--text-xs);margin-block:10px;color:var(--muted)}
.projection-inspection input{width:100%;min-height:44px;padding:0;accent-color:var(--brand)}
.type-switch{position:relative;isolation:isolate}.type-switch>button{position:relative;z-index:1}.type-switch>.filter-slide{position:absolute;z-index:0;pointer-events:none}.type-switch>button.is-sliding{background:transparent!important}
.repayment-selected{outline:2px solid var(--brand);outline-offset:-2px;background:var(--subtle);border-radius:var(--radius-sm)}
.loan-option-legend .current{opacity:.65}.loan-option-line.current{opacity:.65}.loan-option-line.planned{stroke-width:3}
.loan-option-outcomes>div:first-child{background:var(--subtle);border-radius:var(--radius-sm);padding:12px}
.refinement-saved{animation:refinement-saved 300ms var(--motion-ease)}
@keyframes refinement-saved{from{background-color:var(--brand-soft)}to{background-color:transparent}}
@media(min-width:640px){#app[data-route=accounts] .account-balance{font-size:24px}}
@media(max-width:359px){#app .glance-value{font-size:22px}.history-toolbar{gap:8px}}
@media(prefers-reduced-motion:reduce){.refinement-saved{animation:none}}
@media(forced-colors:active){.history-line,.history-grid,.history-guide{stroke:CanvasText}.history-selected-dot,.history-record-dot{fill:Highlight}}

#app .account-card,dialog :is(.private-overview,.private-month-summary,.private-loan-hero,.private-loan-row){box-shadow:none}
.repayment-saved{animation:refinement-saved 300ms var(--motion-ease)}
@media(prefers-reduced-motion:reduce){.repayment-saved{animation:none}}
@media(max-width:639px){
 #editor[open]:has(.private-pay-form,.private-repayment-review){display:flex;flex-direction:column;height:var(--keyboard-height,100dvh);max-height:var(--keyboard-height,100dvh);inset:0;margin:0}
 #editor:has(.private-pay-form,.private-repayment-review)>.dialog-heading{flex:none}
 #editor:has(.private-pay-form,.private-repayment-review)>form{display:flex;flex-direction:column;flex:1;min-height:0}
 #editor:has(.private-pay-form,.private-repayment-review)>form>.entry-fields{flex:1;min-height:0;overflow-y:auto}
 #editor:has(.private-pay-form,.private-repayment-review)>form>.dialog-footer{position:static;flex:none;margin-top:auto}
}

.history-record-markers{max-height:144px;overflow:auto;overscroll-behavior:contain}
.history-record-dot{cursor:pointer}
#editor:has(.private-pay-form,.private-repayment-review)>form>.entry-fields,.private-repayment-review{align-content:start}
/* Home view control: matching rounded rectangles with a consistent inner gutter. */
#app[data-route=home] .view-tabs{overflow:hidden}
/* Keep the existing month picker available in the desktop Home heading. */
@media(min-width:640px){
 #app[data-route=home] .page-heading{flex-direction:row;justify-content:space-between;align-items:center}
 #app[data-route=home] .page-heading>.heading-actions{display:flex;flex:none}
 #app[data-route=home] .page-heading .header-add{display:none}
}
.desktop-month-navigation{display:flex;align-items:center;gap:2px;padding:3px;border:1px solid var(--border);border-radius:var(--radius-sm);background:var(--surface)}
.desktop-month-navigation>.icon-button{width:44px;height:44px;padding:12px;border-radius:var(--radius-xs);background:none}
.desktop-month-navigation .desktop-month-previous{transform:rotate(180deg)}
.desktop-month-picker{display:flex;align-items:center;justify-content:center;gap:12px;min-height:44px;padding:8px 12px;border-radius:var(--radius-xs);font-size:16px;font-weight:500;white-space:nowrap}
.desktop-month-picker>span{min-width:132px;text-align:center;font-variant-numeric:tabular-nums}
.desktop-month-picker>.icon{width:16px;height:16px;color:var(--muted)}
@media (hover:hover) and (pointer:fine){.desktop-month-navigation button:hover{background:var(--subtle)}}
.desktop-month-navigation button:disabled{opacity:.35;cursor:default}
.desktop-month-navigation button:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
@media(prefers-reduced-motion:no-preference){.month-picker[open]{animation:month-picker-enter var(--motion-enter) var(--motion-ease)}@keyframes month-picker-enter{from{opacity:0}to{opacity:1}}}
/* Phone basics: no zoom-on-focus (16px fields on touch), no text inflation on rotate,
   no text selection or callout on controls, and press feedback on rows that only had hover. */
html{-webkit-text-size-adjust:100%;text-size-adjust:100%}
button,[role=tab],.chip,.nav-item,.segmented>*{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}
:is(.stats-rank-row,.stats-destination,button.stats-watch-row,.report-category-row,.loan-sheet-lender,.chooser-select,.chooser-action,.morph-option,.row-menu button):active{background:var(--subtle)}
/* !important: compact field rules (receipt items, loan options, Stats month, rate what-if) are more specific, and iOS zooms on anything under 16px. */
@media(pointer:coarse){input,select,textarea{font-size:16px!important}}
/* Filled selected states read by their fill alone: borders keep their width but take the fill's own colour. */
html[data-theme] .mobile-category-chips button[aria-pressed=true]{border-color:color-mix(in srgb,var(--brand-soft) 30%,transparent)}
html[data-theme] .button.primary{border-color:color-mix(in srgb,var(--action-fill,var(--brand)) 30%,transparent)}
html[data-theme=light] .button.primary[data-action=add],html[data-theme=light] #app .navigation button.nav-add{border-color:color-mix(in srgb,var(--decorative) 30%,transparent)}
@media(prefers-contrast:more),(forced-colors:active){html[data-theme] :is(.mobile-category-chips button[aria-pressed=true],.button.primary),html[data-theme=light] #app .navigation button.nav-add{border-color:CanvasText}}
/* Big Home money figures stay on one line: long amounts (data-fit) shrink to their card's width instead of breaking mid-number.
   The visible figure sizes from 1em of its <strong>, so each card keeps its own maximum. */
#app :is(.mobile-remaining,.hero-remaining,.metric){container-type:inline-size}
#app :is(.mobile-remaining,.hero-remaining) strong,#app .metric-value{white-space:nowrap;overflow-wrap:normal;word-break:normal}
#app [data-fit=m]>[aria-hidden]{font-size:min(1em,13.5cqi)}
#app [data-fit=l]>[aria-hidden]{font-size:min(1em,11.8cqi)}
#app [data-fit=xl]>[aria-hidden]{font-size:min(1em,10.4cqi)}
/* Category tiles: every label is the same size in a fixed two-line box, so the icon sits at the same height on every tile.
   A long word (e.g. "Entertainment") breaks only at its soft hyphen. */
.quick-categories .quick-category{container-type:inline-size;justify-content:flex-start}
/* All tiles share one width, so this resolves to one size per sheet: 12px on most phones, 10px on 320px screens. */
.quick-categories .quick-category small{height:2.4em;font-size:clamp(.625rem,17cqi,var(--text-2xs));line-height:1.2;overflow-wrap:break-word;hyphens:manual;-webkit-hyphens:manual}
/* Chart pass: balance history. Solid guide, ringed record dots, faint area wash, line-coloured scrubber, hairline readout. */
.history-area{fill:var(--reference-blue,var(--brand));fill-opacity:.1;stroke:none}
.history-guide{stroke-dasharray:none;stroke-opacity:.6}
.history-record-dot{stroke:var(--surface);stroke-width:2}
.history-scrubber input{accent-color:var(--reference-blue,var(--link))}
[data-history-output]{background:transparent;min-height:0}
.history-plot text{font-variant-numeric:tabular-nums}
@media(forced-colors:active){.history-area{fill:none}}
