/* Shared phone design, derived from the approved home. Desktop rules are untouched. */
.mobile-choice,.mobile-head-help,.mobile-section-disclosure,.mobile-monitor-tabs{display:none}
@media (max-width:720px){
  body main{width:100%;max-width:100%;min-width:0;margin-inline:0;padding-inline:max(12px,env(safe-area-inset-left)) max(12px,env(safe-area-inset-right))}
  main .page,main .page>*,.page .panel,.page .card,.page .group,.page .head,.page .actions,.page .stats,.page .cards,.page .two{min-width:0;max-width:100%;box-sizing:border-box}
  main .page:not(#home){font-size:14px;line-height:1.5}
  main .page:not(#home)>.head{display:flex!important;flex-direction:row!important;flex-wrap:wrap;align-items:center;gap:8px;margin:0 0 12px;padding:0;min-height:0}
  main .page:not(#home)>.head>div:first-child{flex:1;min-width:0}
  main .page:not(#home) .head h1{font-size:20px;line-height:1.35;margin:0;color:var(--navy)}
  main .page:not(#home) .head h2{font-size:16px;line-height:1.4;margin:0}
  main .page:not(#home) .head p{font-size:12px;line-height:1.6;margin-top:5px;overflow-wrap:anywhere}
  main .page:not(#home) .head .actions{margin:0;gap:6px;max-width:100%;flex-wrap:wrap}
  main .page:not(#home) .head .actions button{flex:0 1 auto;width:auto;min-width:0}
  main .page:not(#home) .head>button:not(.mobile-head-help){min-height:38px;padding:6px 10px;font-size:12px;max-width:100%;white-space:normal}
  .page .mobile-head-help{display:grid;place-items:center;width:34px;height:34px;min-height:34px;padding:6px;flex:0 0 34px;border:0;background:var(--bluebg);color:var(--navy);border-radius:11px}
  .mobile-head-help svg{width:20px;height:20px}
  .page .head:not(.mobile-help-open) .mobile-head-description{display:none!important}
  .page .head.mobile-help-open .mobile-head-description{display:block!important}
  .page .page-purpose{display:none}
  main .page:not(#home) .panel,main .page:not(#home) .card{border-radius:16px;padding:12px;margin-bottom:10px;box-shadow:none;border-color:var(--border)}
  main .page:not(#home) .panel h2,main .page:not(#home) .card h2{font-size:16px;line-height:1.4;margin:0 0 8px;color:var(--navy)}
  main .page:not(#home) .panel p{overflow-wrap:anywhere}
  main .page:not(#home) .stats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important;margin-bottom:10px}
  main .page:not(#home) .stats .stat{min-width:0;padding:11px;border-radius:15px;box-shadow:none}
  main .page:not(#home) .stat>span{font-size:12px;line-height:1.35;white-space:normal}
  main .page:not(#home) .stat>b{font-size:18px;line-height:1.35;max-width:100%;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
  main .page:not(#home) .stat>small{font-size:10px}
  main .page:not(#home) .cards,main .page:not(#home) .two{gap:10px;grid-template-columns:minmax(0,1fr)}
  .page button,.page a,dialog button{touch-action:manipulation}
  .page .actions{gap:6px;flex-wrap:wrap}
  .page .actions>button{max-width:100%;min-width:0;white-space:normal;overflow-wrap:anywhere}
  .page .tabs{display:flex;flex-wrap:wrap!important;overflow:visible!important;width:100%;max-width:100%;gap:6px;white-space:normal}
  .page .tabs button{min-width:0!important;max-width:100%;flex:1 1 100px;white-space:normal!important;font-size:12px;line-height:1.4;padding:7px 9px}
  .page .mobile-choice{display:grid;gap:4px;margin:0 0 12px;max-width:100%;min-width:0}
  .mobile-choice>span{font-size:12px;font-weight:600;color:var(--muted)}
  .mobile-choice select{width:100%;min-width:0;max-width:100%;min-height:44px;border-radius:13px;background:var(--card);font-size:16px;padding:9px 10px}
  .page .mobile-choice-source,.page .mobile-repeated-label{display:none!important}
  .page .mobile-section-disclosure{display:flex;align-items:center;justify-content:space-between;width:100%;max-width:100%;min-height:44px;gap:8px;background:var(--card);border:1px solid var(--border);border-radius:14px;padding:9px 12px;margin:0 0 10px;text-align:right;font-size:13px}
  .mobile-section-disclosure svg{width:18px;height:18px;flex:none}
  .mobile-section-disclosure[aria-expanded=true] svg{transform:rotate(180deg)}
  .page .mobile-section-body:not([data-mobile-expanded=true]){display:none!important}
  .page .mobile-section-body[data-mobile-expanded=true]>h2:first-child{display:none}
  main .page .group{border-radius:15px;margin-bottom:10px}
  main .page .group>summary{padding:11px 12px;gap:8px;flex-wrap:wrap;font-size:14px}
  main .page .groupbody{padding:0 12px 12px}
  main .page .notice{font-size:12px;line-height:1.6;padding:9px 11px;margin-bottom:10px;white-space:normal;overflow-wrap:anywhere}
  .page .detail-back{max-width:100%;font-size:12px;min-height:36px;padding:5px 8px;margin:0 0 10px}
  .page .line{min-width:0;max-width:100%;gap:7px;padding-block:8px}
  .page .line>*,.page .report-row>*,.page .bank-linked-account>*,.page .reminder-card-head>*{min-width:0;max-width:100%;overflow-wrap:anywhere}
  #bankAccounts .bank-account-details{padding:0 2px;border:0;background:transparent;margin-bottom:8px;min-height:0}
  #bankAccounts .bank-account-details .pill{font-size:11px}
  #bankAccounts .bank-linked-account,#reports .bank-statement .bank-linked-account{gap:8px;min-width:0;width:100%}
  #bankAccounts .bank-linked-account b,#reports .bank-statement .bank-linked-account b{white-space:normal;overflow-wrap:anywhere;font-size:14px}
  #bankAccounts .bank-breakdown-total,#reports .bank-breakdown-total{flex-wrap:wrap;gap:6px}
  #loans .loan-account-details{padding:0;gap:7px;margin:0 0 10px}
  #loans .loan-account-details button{width:auto;min-height:34px;padding:5px 9px;font-size:12px}
  #loans .loan-ledger-head{gap:7px;margin:10px 0 8px;min-width:0;max-width:100%}
  #loans .loan-ledger-head .actions{width:100%;gap:6px}
  #loans .loan-ledger-head .actions button{flex:1;min-width:0;white-space:normal}
  #savingsMonitorView>.panel.actions{display:grid;grid-template-columns:minmax(80px,.7fr) minmax(0,1.5fr);align-items:end;gap:8px}
  #savingsMonitorView>.panel.actions label{min-width:0;font-size:12px}
  #savingsMonitorView .mobile-monitor-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;margin:0 0 10px;padding:4px;border-radius:14px;background:var(--bluebg)}
  #savingsMonitorView .mobile-monitor-tabs button{min-width:0;min-height:40px;white-space:normal;padding:6px 4px;font-size:12px;border:0;border-radius:10px;background:transparent;text-align:center}
  #savingsMonitorView .mobile-monitor-tabs button[aria-pressed=true]{background:var(--navy);color:white}
  #savingsMonitorView>.mobile-monitor-inactive{display:none!important}
  #savingsMonitorView .savings-chart-legend{gap:8px!important;margin:8px 0!important;font-size:11px;line-height:1.4}
  #savingsMonitorView .savings-chart-legend>span{gap:4px!important}
  #savingsMonitorView .savings-chart-legend>span>span{width:10px!important;height:10px!important;flex:none}
  #reminders .reminder-card-head{flex-wrap:wrap;gap:8px}
  #reminders .reminder-due{min-width:0;text-align:right}
  #reminders .reminder-meta{display:flex;flex-wrap:wrap;gap:7px;font-size:12px}
  #reminders .reminder-card .actions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
  #reminders .reminder-card .actions button{font-size:12px;min-height:38px;padding:6px}
  #control .settings-pane>.head{display:flex!important;flex-direction:row!important;flex-wrap:wrap;gap:8px;margin-bottom:10px}
  #control .settings-pane>.head>div:first-child{flex:1;min-width:0}
  #control .settings-pane>.head>div>h2{display:none}
  #control .settings-pane>.head>button:not(.mobile-head-help){width:auto!important;font-size:12px;padding:6px 10px;min-height:38px;white-space:normal}
  #control .withdrawal-reason-row{min-width:0;max-width:100%;grid-template-columns:38px minmax(0,1fr);gap:7px}
  #control .withdrawal-reason-row>.actions{grid-column:1/-1;display:flex;flex-wrap:wrap}
  #control .withdrawal-reason-row>.actions>button{flex:1;min-width:0}
  #control .school-settings-list{min-width:0;max-width:100%}
  dialog,.modalcard{box-sizing:border-box!important;width:calc(100% - 20px)!important;max-width:calc(100vw - 20px)!important;min-width:0!important;max-height:90dvh!important;padding:14px!important;border-radius:17px!important;overflow-y:auto;overflow-x:visible}
  .modal{padding:10px!important}
  .modal .modalcard{width:100%!important;max-width:100%!important}
  dialog .modalhead,.modalcard .modalhead{display:flex;align-items:flex-start;gap:8px;max-width:100%;min-width:0}
  dialog .modalhead h2,.modalcard .modalhead h2{font-size:17px;line-height:1.45;min-width:0;overflow-wrap:anywhere}
  dialog .modalhead>button,.modalcard .modalhead>button{width:36px;height:36px;min-height:36px;flex:none;padding:4px}
  dialog .formgrid,.modalcard .formgrid,dialog .wealth-form-grid,.modalcard .wealth-form-grid{grid-template-columns:minmax(0,1fr)!important;gap:10px;max-width:100%}
  dialog :is(form,label,section,article,dl),.modalcard :is(form,label,section,article,dl){min-width:0;max-width:100%}
  :is(main,dialog,.modalcard) :is(input:not([type=checkbox]):not([type=radio]),select,textarea){min-width:0!important;max-width:100%!important;width:100%;box-sizing:border-box;font-size:16px!important}
  :is(main,dialog,.modalcard) input[type=date],:is(main,dialog,.modalcard) input[type=month],:is(main,dialog,.modalcard) input[type=time]{min-inline-size:0!important;inline-size:100%}
  dialog .actions,.modalcard .actions{max-width:100%;min-width:0;flex-wrap:wrap;gap:7px}
  dialog .actions>*:not(input),.modalcard .actions>*:not(input){min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere}
  dialog img,.modalcard img,main .page img,main .page canvas,main .page svg:not(button svg){max-width:100%}
  dialog p,dialog dd,.modalcard p,.modalcard dd{overflow-wrap:anywhere;white-space:normal}
  .summary-row>b{white-space:normal;overflow-wrap:anywhere;max-width:55%}
  #mobileBottomNav{max-width:100%;box-sizing:border-box}
  #mobileBottomNav button{min-width:0}
  .mobile-amounts-hidden .mobile-saving-hero strong,.mobile-amounts-hidden .mobile-saving-summary strong{filter:blur(7px);user-select:none}
}
