.mobile-bottom-nav,.mobile-account-button,.brand-short{display:none}
.mobile-menu{display:grid;gap:20px}
.mobile-menu section{display:grid;gap:6px}
.mobile-menu h2{margin:0 0 4px;color:var(--muted);font-size:12px;font-weight:750;text-transform:uppercase;letter-spacing:.05em}
.mobile-menu a{display:flex;align-items:center;gap:12px;padding:12px;border-radius:10px;border:1px solid var(--border);color:var(--text);font-weight:650;min-height:48px}
.mobile-menu a[aria-current=page]{background:var(--blue-100);color:var(--blue-700);border-color:#b8ccef}
.mobile-account-summary{display:grid;gap:10px;margin-bottom:20px;overflow-wrap:anywhere}
.mobile-account-actions{display:grid;gap:10px}
.mobile-account-actions .btn{width:100%;min-height:48px;white-space:normal}
.mobile-filter-disclosure{display:contents}
.mobile-filter-disclosure>summary{display:none}
.portal-menu{margin-left:auto}
.portal-menu>summary{display:none}
.portal-menu-items{display:flex;align-items:center;flex-wrap:wrap;gap:10px}
.m1-administrative-tools{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:16px}

@media(max-width:820px){
  .app-shell{padding-bottom:calc(76px + env(safe-area-inset-bottom))}
  .topbar{height:68px;gap:12px;padding:8px max(16px,env(safe-area-inset-right)) 8px max(16px,env(safe-area-inset-left))}
  .topbar-brand{flex:1;min-width:0;gap:10px}
  .topbar-brand>span:last-child{min-width:0}
  .topbar-brand .brand-mark{width:44px;height:44px;flex:0 0 44px}
  .topbar-brand strong{font-size:17px;line-height:1.2;white-space:nowrap}
  .topbar-brand small{display:block;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:220px}
  .brand-long,.topbar-spacer,.topbar-actions,.sidebar{display:none}
  .brand-short{display:inline}
  .mobile-account-button{display:flex;min-height:44px;padding:10px 14px;flex-shrink:0}
  .mobile-bottom-nav{position:fixed;z-index:60;bottom:0;left:0;right:0;display:flex;align-items:stretch;background:#fff;border-top:1px solid var(--border);padding:6px max(8px,env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));box-shadow:0 -4px 18px rgba(11,25,48,.05)}
  .mobile-bottom-nav>a,.mobile-bottom-nav>button{flex:1;min-width:0;display:grid;justify-items:center;align-content:center;gap:4px;min-height:54px;padding:5px 4px;border:0;border-radius:10px;background:transparent;color:var(--muted);font:inherit;font-size:12px;font-weight:650;text-align:center;line-height:1.2}
  .mobile-bottom-nav .nav-icon{font-size:19px;line-height:20px}
  .mobile-bottom-nav .active{background:var(--blue-100);color:var(--blue-700)}
  .main{padding:22px 16px 26px}
  .page,.panel,.panel-body,.panel-head,.form-field,.portal-main,.portal-card{min-width:0}
  .page-head{align-items:flex-start;gap:16px;flex-direction:column}
  .page-title{font-size:26px;line-height:1.2;overflow-wrap:anywhere}
  .page-subtitle{font-size:14px;line-height:1.55}
  .page-actions,.panel-actions{flex-wrap:wrap;gap:8px}
  .panel-head{flex-wrap:wrap;gap:12px}
  .panel-head h2{font-size:17px;overflow-wrap:anywhere}
  .panel-body{padding:16px}
  .btn,.btn-sm,.close-btn{min-height:44px}
  .btn{white-space:normal}
  .close-btn{min-width:44px}
  input:not([type=checkbox]):not([type=radio]),select,textarea{font-size:16px;min-width:0;max-width:100%}
  .portal-main select,.portal-auth select,.main select,.modal select{font-size:16px}
  .input,select,textarea{min-height:46px}
  .card-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .metric-card{padding:14px;min-height:112px}
  .metric-value{font-size:clamp(16px,4.4vw,21px);overflow-wrap:anywhere;font-variant-numeric:tabular-nums}
  .metric-label,.metric-meta{font-size:12px;line-height:1.4}
  .finance-m1 .m1-metrics{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .finance-m1 .m1-metrics>div{min-width:0;overflow-wrap:anywhere}
  .finance-m1 .m1-metrics strong{font-size:21px;font-variant-numeric:tabular-nums}
  .modal{max-height:94vh;max-height:94dvh}
  .modal-head,.modal-foot{padding:16px}
  .modal-body{padding:16px}
  .modal-foot{padding-bottom:calc(16px + env(safe-area-inset-bottom));flex-wrap:wrap}
  .modal-foot .btn{flex:1}
  .mobile-filter-disclosure{display:block;margin:0 0 18px;border:1px solid var(--border);border-radius:12px;background:#fff}
  .mobile-filter-disclosure>summary{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:56px;padding:14px;cursor:pointer;font-size:13px}
  .mobile-filter-disclosure>summary span{font-size:12px;color:var(--muted)}
  .mobile-filter-disclosure>summary span:after{content:' +';font-size:17px}
  .mobile-filter-disclosure[open]>summary span:after{content:' −'}
  .mobile-filter-disclosure .scope-bar,.mobile-filter-disclosure .portal-filter{margin:0;padding:14px;border:0;border-radius:0;background:transparent}
  .mobile-filter-disclosure .m1-administrative-tools{padding:0 14px 14px;margin:0;display:grid;gap:8px}
  .mobile-filter-disclosure .m1-page-grid{margin:0;padding:0 12px 12px}
  .mobile-filter-disclosure #native-enrollment-intake{margin:0;border:0;box-shadow:none}
  .portal-header{position:sticky;top:0;z-index:50;flex-wrap:nowrap;gap:12px;padding:14px 16px}
  .portal-brand{flex:1;flex-basis:auto;min-width:0;gap:10px}
  .portal-brand .brand-mark{width:42px;height:42px;flex:0 0 42px}
  .portal-brand>span:last-child{min-width:0}
  .portal-brand strong{display:block;font-size:16px;line-height:1.2}
  .portal-brand small{display:block;font-size:10px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:210px}
  .portal-menu{margin:0;flex-shrink:0}
  .portal-menu>summary{display:flex;align-items:center;justify-content:center;min-width:68px;min-height:44px;padding:10px 14px;border:1px solid rgba(255,255,255,.28);border-radius:10px;color:#fff;font-weight:650;font-size:14px;cursor:pointer;list-style:none}
  .portal-menu>summary::-webkit-details-marker{display:none}
  .portal-menu-items{position:absolute;z-index:70;top:calc(100% - 2px);right:16px;left:16px;display:grid;gap:8px;padding:14px;background:white;border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow)}
  .portal-menu:not([open]) .portal-menu-items{display:none}
  .portal-menu-items .btn{width:100%;min-height:46px;color:var(--text);background:var(--surface-2);border-color:var(--border)}
  .portal-main{padding:24px 16px 36px}
  .portal-main h1{font-size:26px;line-height:1.25;overflow-wrap:anywhere}
  .portal-subtitle{font-size:14px;line-height:1.6}
  .portal-card{border-radius:14px;padding:18px}
  .portal-line{gap:16px}
  .portal-line h3{font-size:17px;line-height:1.35;overflow-wrap:anywhere}
  .portal-line p{font-size:13px;line-height:1.6;overflow-wrap:anywhere}
  .portal-amount{gap:12px;min-width:0}
  .portal-amount strong{font-size:21px;overflow-wrap:anywhere}
  .portal-summary .portal-stat strong{font-size:clamp(16px,4vw,21px);font-variant-numeric:tabular-nums}
  .portal-origin summary,.portal-credit-details summary{min-height:44px;line-height:1.5}
  .portal-origin,.portal-credit-details{font-size:13px;overflow-wrap:anywhere}
  .portal-auth{max-width:500px;margin:32px auto;padding:0 16px}
  .portal-auth .portal-card{padding:24px}
  .portal-auth h1{font-size:27px;line-height:1.25}
}

@media(max-width:640px){
  .form-grid,.detail-grid{grid-template-columns:1fr}
  .table-wrap:has(>.mobile-record-table){overflow:visible}
  .mobile-record-table{display:block;width:100%!important;min-width:0!important}
  .mobile-record-table thead{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
  .mobile-record-table tbody{display:block}
  .mobile-record-table tbody tr{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));margin:0 0 12px;padding:8px;border:1px solid var(--border);border-radius:12px;background:white}
  .mobile-record-table tbody td{display:block!important;width:auto!important;min-width:0;padding:8px 10px;white-space:normal!important;border:0;overflow-wrap:anywhere;text-align:left!important}
  .mobile-record-table tbody td[hidden]{display:none!important}
  .mobile-record-table tbody td:before{content:attr(data-mobile-label);display:block;margin-bottom:5px;color:var(--muted);font-size:11px;font-weight:650;line-height:1.4}
  .mobile-record-table tbody td[data-mobile-wide]{grid-column:1/-1}
  .mobile-record-table tbody td .btn{min-height:44px;margin:3px 3px 3px 0}
  .mobile-record-table .table-secondary{font-size:12px;line-height:1.5;overflow-wrap:anywhere}
  .mobile-selection-hitarea{display:inline-grid;place-items:center;min-width:44px;min-height:44px;cursor:pointer}
  .mobile-selection-hitarea input{width:22px;height:22px;margin:0}
  .portal-amount{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap}
  .portal-amount .btn{flex:1;min-width:130px}
  .portal-amount>div{flex:1;min-width:130px}
  .portal-detail{grid-template-columns:1fr}
  .portal-main .kv{grid-template-columns:minmax(0,1fr)}
  .portal-pages .btn{min-height:44px}
  .portal-admin-overview{grid-template-columns:1fr}
  .auth-card{padding:28px 22px}
  .auth-card h1{font-size:29px;line-height:1.25}
}
