/* MEMS V5 Universal Responsive R1 — layout-only. No form, auth, permission or API rules. */
:root{--mems-safe-bottom:env(safe-area-inset-bottom,0px);--mems-safe-left:env(safe-area-inset-left,0px);--mems-safe-right:env(safe-area-inset-right,0px)}
html{max-width:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{max-width:100%;min-width:0}
#mems-app-shell{width:100%;min-width:0;min-height:0;max-width:100%}
#mems-app-shell>div{min-width:0;max-width:100%}
#main-content{min-width:0;min-height:0;max-width:100%;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch}
#main-content>div,#main-content>section{min-width:0;max-width:100%}
#main-content :is(img,video,canvas,svg){max-width:100%;height:auto}
#main-content :is(.v5-registration,.mems-report,.mems-sp,.mems-registry,.mems-insights){min-width:0;max-width:100%}
#main-content :is(.v5-registration,.mems-report,.mems-sp,.mems-registry,.mems-insights) :is(.grid,.flex){min-width:0}
#main-content :is(.mems-report,.mems-sp,.v5-registration) :is(input,select,textarea){max-width:100%;box-sizing:border-box}
#main-content :is(.mems-sp,.mems-report,.v5-registration) :is(button,label){overflow-wrap:break-word}
#main-content :is(.mems-sp,.mems-report,.v5-registration) :is(h1,h2,h3,p){overflow-wrap:break-word}
#main-content :is(.mems-sp,.mems-report,.v5-registration) :is(table){max-width:100%}
#sidebar{min-height:0;overflow:hidden}
#sidebar nav{min-height:0}
/* Keep the existing 5 buttons and their JavaScript intact. */
@media(max-width:767.98px){
 #main-content{padding:12px 12px calc(94px + var(--mems-safe-bottom))!important}
 #mems-mobile-nav{box-sizing:content-box;min-width:0;padding-bottom:var(--mems-safe-bottom);padding-left:max(4px,var(--mems-safe-left));padding-right:max(4px,var(--mems-safe-right));height:64px}
 #mems-mobile-nav>button{min-width:0;flex:1 1 0;max-width:25%;padding-left:1px;padding-right:1px}
 #mems-mobile-nav>button span{white-space:nowrap;letter-spacing:-.02em}
 #mems-mobile-nav>button:nth-child(3){flex:0 0 20%;max-width:20%}
 #mobile-more-modal>div{max-width:min(340px,92vw);padding-bottom:max(16px,var(--mems-safe-bottom))}
 #main-content :is(.mems-report .rc-actions,.mems-report .rc-scope,.mems-report .rc-format){flex-wrap:wrap}
 #main-content .mems-sp-stats{min-width:0}
 #main-content .mems-sp-stat{min-width:0}
 #main-content .mems-sp-stat strong{overflow-wrap:anywhere}
 #main-content .v5-registration .mems39-steps{max-width:100%;-webkit-overflow-scrolling:touch}
 #main-content .v5-registration .mems39-panel{max-width:100%}
}
@media(max-width:380px){
 #main-content{padding-inline:9px!important}
 #mems-mobile-nav>button span{font-size:9px!important}
 #main-content .mems-sp-stats{gap:4px}
 #main-content .mems-sp-stat{padding:6px}
}
@media(min-width:768px) and (max-width:1023.98px){
 #sidebar{width:194px!important}
 #main-content{padding:16px!important}
}
@media(min-width:1024px){
 #main-content{padding:clamp(18px,2vw,32px)!important}
}
/* Overlay dimensions: restrict only known existing dialog classes. */
.mems-edit-dialog{max-width:calc(100vw - 20px);max-height:calc(100dvh - 24px)}
.mems-edit-scroll{min-height:0;overscroll-behavior:contain}
@media(max-width:767.98px){.mems-edit-dialog{max-height:calc(100dvh - 20px)!important}}
/* iOS Safari focus zoom: do not interfere with pinch zoom. */
@media(hover:none) and (pointer:coarse) and (max-width:1024px){
 #main-content :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),select,textarea),
 .mems-edit-dialog :is(input:not([type="checkbox"]):not([type="radio"]),select,textarea){font-size:16px!important}
}
@media(prefers-reduced-motion:reduce){#main-content{scroll-behavior:auto}}
