/* Mobile refinement: no changes to authentication or remote writes. */
@media(max-width:850px){
 html{scroll-padding-bottom:calc(100px + env(safe-area-inset-bottom,0px));}
 main{min-width:0;padding-left:max(12px,env(safe-area-inset-left,0px));padding-right:max(12px,env(safe-area-inset-right,0px));}
 nav#nav{padding-left:max(4px,env(safe-area-inset-left,0px));padding-right:max(4px,env(safe-area-inset-right,0px));}
 nav#nav>button{min-width:0;min-height:54px;padding:6px 2px;}
 nav#nav .ms-nav-label{white-space:normal;overflow-wrap:anywhere;font-size:clamp(10px,2.7vw,13px);}
 #app,.section,.student-actions,.plan-editor,.workout-panel,.ms-v12-thread{min-width:0;}
 #app .student-actions{display:flex;flex-wrap:wrap;gap:8px;}
 #app .student-actions button{flex:1 1 115px;min-height:44px;white-space:normal;}
 #app .ms-v12-list button{min-height:44px;}
 #app .ms-v12-messages{min-height:140px;max-height:42vh;max-height:42dvh;padding:8px;}
 #app .ms-v12-bubble{max-width:88%;padding:9px 12px;}
 #app .ms-v12-actions button{flex:1 1 125px;min-height:44px;}
 #app .ms-v13-input{font-size:16px;min-height:64px;}
 #app .ms-v12-layout{min-width:0;}
 #app .ms-pt-calendar .fc .fc-toolbar{gap:8px;}
 #app .ms-pt-calendar .fc .fc-button{min-height:44px;padding:6px 8px;}
 #app .ms-series-table input:not([type=checkbox]){font-size:16px;min-height:44px;}
 dialog{max-width:calc(100vw - 20px);max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overflow:auto;}
}
@media(max-width:700px){
 #app .ms-v12-layout{grid-template-columns:minmax(0,1fr);gap:12px;}
 #app .ms-v12-list{max-height:24vh;max-height:24dvh;overflow:auto;}
 #app .ms-v12-thread h2{overflow-wrap:anywhere;}
 #app .plan-editor .plan-item{grid-template-columns:repeat(2,minmax(0,1fr));}
}
@media(max-width:360px){
 #app .library-grid{grid-template-columns:minmax(0,1fr);}
 #app .stat{padding-inline:6px;}
 #app .plan-editor .plan-item{grid-template-columns:minmax(0,1fr);}
}
