/* v20: each authenticated user selects layout and five readable type sizes. */
:root{--k-font-scale:1;--k-button-scale:1;--k-input-scale:1}
:root[data-kakei-font="1"]{--k-font-scale:.91;--k-button-scale:.97;--k-input-scale:1}
:root[data-kakei-font="2"]{--k-font-scale:.96;--k-button-scale:1;--k-input-scale:1}
:root[data-kakei-font="3"]{--k-font-scale:1;--k-button-scale:1;--k-input-scale:1}
:root[data-kakei-font="4"]{--k-font-scale:1.13;--k-button-scale:1.06;--k-input-scale:1.09}
:root[data-kakei-font="5"]{--k-font-scale:1.26;--k-button-scale:1.14;--k-input-scale:1.18}
/* Inputs remain at least 16px on iOS to avoid undesired focus zoom. */
.appShell .card h2{font-size:calc(16px * var(--k-font-scale))}
.appShell .card h3{font-size:calc(14px * var(--k-font-scale))}
.appShell .topControls h1{font-size:calc(22px * var(--k-font-scale))!important;overflow-wrap:anywhere}
.appShell .brandName b{font-size:calc(16px * var(--k-font-scale));white-space:normal}
.appShell .muted,.appShell .cardSub,.appShell .inlineTip,.appShell .scopeExplain{font-size:calc(12px * var(--k-font-scale))}
.appShell .card p,.appShell .card .caption,.appShell .kpi .caption,.appShell .listItem .title,.appShell .menuLink strong,.appShell .title{font-size:calc(13px * var(--k-font-scale));overflow-wrap:anywhere}
.appShell .card small,.appShell .listItem small,.appShell .menuLink small,.appShell .kpi .detail{font-size:calc(11px * var(--k-font-scale));overflow-wrap:anywhere}
.appShell .listItem .amount,.appShell .billSum b,.appShell .expenseEnd b{font-size:calc(14px * var(--k-font-scale));white-space:normal;text-align:right;overflow-wrap:anywhere}
.appShell .heroAmount{font-size:clamp(29px,calc(8vw * var(--k-font-scale)),52px)}
.appShell .overviewKpis .kpi strong{font-size:clamp(17px,calc(5vw * var(--k-font-scale)),32px)}
.appShell button:not(.bottomNav button),.appShell .segmented button{font-size:calc(13px * var(--k-button-scale));line-height:1.42}
.appShell input:not([type="checkbox"]):not([type="radio"]),.appShell select,.appShell textarea{font-size:calc(16px * var(--k-input-scale));max-width:100%;min-width:0}
.appShell .bottomNav button{font-size:calc(10px * var(--k-font-scale));min-height:54px}
.appShell .bottomNav button span{overflow-wrap:anywhere}
.appShell .monthField{min-width:0}
:root[data-kakei-font="5"] #appArea .overviewKpis{grid-template-columns:minmax(0,1fr)}
:root[data-kakei-font="5"] .billRow, :root[data-kakei-font="5"] .listItem{gap:6px}
:root[data-kakei-font="5"] .billSum{min-width:0;overflow-wrap:anywhere}
/* The setup itself uses consistently comfortable text regardless of selected font. */
.uiSetupCard{padding:16px 15px;width:min(100%,580px)}
.uiSetupCard h2,.displayPreferencesPage h2{font-size:22px!important;color:#173d30;margin:8px 0 10px}
.uiPrefForm{display:grid;gap:14px}
.uiPrefForm p{margin:2px 0 9px;font-size:14px!important;color:#5a6e61;line-height:1.55}
.prefBadge{font-size:12px;font-weight:850;color:#167b55;letter-spacing:.02em}
.uiPrefForm fieldset{border:0;margin:0;padding:0;min-width:0}
.uiPrefForm legend{font-weight:850;font-size:16px;padding:0 0 9px;color:#204c3a}
.uiPrefModes{display:grid;gap:9px}
.uiPrefModes legend{margin-bottom:4px}
.uiPrefForm .uiModeOption{display:flex;gap:10px;align-items:flex-start;border:1.5px solid #d6e5da;border-radius:15px;padding:13px;margin:0;background:#fff;cursor:pointer}
.uiPrefForm .uiModeOption:has(input:checked){border-color:#0e8b58;background:#f1fbf4;box-shadow:0 0 0 2px #0e8b5811}
.uiPrefForm .uiModeOption input{width:20px;height:20px;min-height:20px;flex:0 0 20px;margin:3px 0 0;accent-color:#147953}
.uiModeCopy{display:grid;gap:4px;min-width:0;font-size:14px;font-weight:400;color:#345c44}
.uiModeCopy b{font-size:18px;color:#103929;display:flex;align-items:center;gap:9px}
.uiModeCopy b small{font-size:11px!important;color:#137a52;background:#ddefdf;padding:3px 6px;border-radius:9px}
.uiModeCopy em{font-size:13px;font-style:normal;font-weight:700;color:#297053}
.uiModeCopy .uiModeFor{font-weight:650;font-size:13px;color:#3f654f}
.uiModeCopy .uiModeDescription{font-size:12px;color:#718473;line-height:1.5}
.uiFontList{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px}
.uiPrefForm .uiFontOption{position:relative;border:1.5px solid #d6e5da;border-radius:12px;text-align:center;margin:0;display:grid;place-items:center;min-height:50px;cursor:pointer;padding:3px}
.uiPrefForm .uiFontOption:has(input:checked){background:#e3f7e9;border-color:#178254;color:#125238}
.uiPrefForm .uiFontOption input{position:absolute;opacity:0;width:1px;min-height:0;margin:0}
.uiPrefForm .uiFontOption:focus-within{outline:2px solid #4c9e6c;outline-offset:2px}
.uiPrefForm .uiFontOption span{font-size:clamp(10px,2.8vw,13px);font-weight:800}
.uiFontNote{font-size:12px!important;margin:6px 0!important}
.uiPrefPreview{border:1px solid #e0e9e1;background:#f7faf8;border-radius:13px;padding:12px}
.uiPrefPreview>small{font-size:12px;color:#5e816e}
.uiPrefSample{display:grid;gap:3px;background:#fff;border:1px solid #dfeae2;border-radius:11px;padding:13px;margin-top:8px;font-size:16px;color:#1f3e2f}
.uiPrefSample strong{font-size:calc(23px * var(--k-font-scale));overflow-wrap:anywhere}
.uiPrefSample[data-font="1"]{font-size:14px}.uiPrefSample[data-font="1"] strong{font-size:20px}
.uiPrefSample[data-font="2"]{font-size:15px}.uiPrefSample[data-font="2"] strong{font-size:22px}
.uiPrefSample[data-font="3"]{font-size:16px}.uiPrefSample[data-font="3"] strong{font-size:24px}
.uiPrefSample[data-font="4"]{font-size:18px}.uiPrefSample[data-font="4"] strong{font-size:27px}
.uiPrefSample[data-font="5"]{font-size:20px}.uiPrefSample[data-font="5"] strong{font-size:30px}
.uiPrefSample .uiPreviewDetail{font-size:.73em;color:#637d6b}
.uiPrefFooter{font-size:12px!important}
/* Simple: intentionally keeps the most important data and two big actions, not a second menu. */
.uiSimpleHome{padding:22px 19px!important;background:linear-gradient(155deg,#fff,#eff9f1)!important}
.simpleHeading{font-size:16px;font-weight:800;color:#234836;margin-bottom:14px}
.uiSimpleHome .caption{display:block;color:#607a69;font-size:14px}
.simpleSum{display:block;font-size:clamp(29px,8vw,45px);line-height:1.15;color:#0d5839;margin:5px 0 9px;overflow-wrap:anywhere}
.simpleDelta{font-size:14px!important;color:#3d6a4f;margin:0 0 14px}
.simpleNumbers{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.simpleNumbers>div{padding:11px;border-radius:11px;background:#fff;border:1px solid #deebdf;min-width:0}
.simpleNumbers small{font-size:11px!important;color:#618272;display:block}
.simpleNumbers b{font-size:20px;display:block;overflow-wrap:anywhere}
.simpleActionPanel{display:grid;gap:10px;padding:6px 4px}
.simpleActionPanel button{min-height:56px!important;font-weight:800}
.simpleAssist{font-size:13px;line-height:1.65;padding:12px 17px;border:1px solid #deebe3;background:#f9fcf9;border-radius:12px}
.expertStats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:7px}
.expertStats>div{background:#f4f8f6;border-radius:10px;padding:10px;min-width:0}
.expertStats span{color:#688478;font-size:11px;display:block}
.expertStats b{color:#143e31;font-size:17px;overflow-wrap:anywhere}
@media(max-width:400px){.appShell .brand small{display:none}.appShell .status{font-size:9px;min-width:0}.appShell .topControls{gap:4px}.appShell .topControls h1{font-size:calc(19px * var(--k-font-scale))!important}.appShell .card{padding:13px}.uiPrefForm .uiModeOption{padding:11px 9px}.uiPrefForm .uiModeCopy b{font-size:16px}}
@media(max-width:350px){.simpleNumbers{grid-template-columns:minmax(0,1fr)}.expertStats{grid-template-columns:minmax(0,1fr)}.uiFontList{gap:3px}}
.simplePending{font-size:12px!important;color:#8c642b;margin:14px 0 0!important;line-height:1.5}

/* v21: simple mode preserves the actions, hiding only optional detail. */
.simpleListTotal{display:block;font-size:clamp(27px,7vw,42px);font-weight:850;color:#10553c;margin:12px 0;overflow-wrap:anywhere}
:root[data-kakei-font="5"] .simpleListTotal{font-size:clamp(29px,8vw,45px)}

.modeSwitcher {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-block: 5px 9px;
}
.expensePaging {
  justify-content: space-between;
  margin-top: 12px;
}
.expensePaging button:disabled {
  opacity: 0.55;
  cursor: default;
}
