/* Final layout order guard — 2026-10-08. Loaded last to prevent legacy UI sheets overriding the clean card/grid arrangement. */
@media screen {
  body.nw-modern-erp .app-shell #content,
  body.nw-modern-erp .clean-shell #content{box-sizing:border-box!important;min-width:0!important}
}
@media (min-width:981px){
  body.nw-modern-erp .app-shell .grid.grid-4:has(>.stat){display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:14px!important;align-items:stretch!important}
  body.nw-modern-erp .app-shell .grid.grid-3:has(>.stat){display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:14px!important;align-items:stretch!important}
  body.nw-modern-erp .app-shell .stat,
  body.nw-modern-erp .app-shell [class*="kpi-card"]{min-width:0!important;margin:0!important}
}
@media (max-width:980px){
  body.nw-modern-erp .app-shell .grid.grid-4:has(>.stat),
  body.nw-modern-erp .app-shell .grid.grid-3:has(>.stat){display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:10px!important;align-items:stretch!important}
  body.nw-modern-erp #nwEmergencyDrawer .nw-drawer-nav,
  body.nw-modern-erp #sidebar #nav{display:flex!important;flex-direction:column!important;gap:9px!important}
  body.nw-modern-erp #nwEmergencyDrawer .nw-drawer-nav .nav-group,
  body.nw-modern-erp #sidebar #nav .nav-group{width:100%!important;min-width:0!important;margin:0!important}
  body.nw-modern-erp .app-shell #content{padding-bottom:calc(118px + max(env(safe-area-inset-bottom,0px),var(--system-bottom,0px)))!important}
}
@media (max-width:420px){
  body.nw-modern-erp .app-shell .grid.grid-4:has(>.stat),
  body.nw-modern-erp .app-shell .grid.grid-3:has(>.stat){grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
}
@media print{body.nw-modern-erp .app-shell .grid{break-inside:avoid}}
