/* SIRIUS WMS V5.0.90 · Responsive móvil aditivo
   No altera escritorio: reglas limitadas a <= 900px. */
#wms-mobile-menu-btn,#wms-mobile-overlay{display:none}

@media (max-width:900px){
  html,body{width:100%;max-width:100%;overflow:hidden}
  .topbar{height:auto;min-height:52px;padding:6px 8px;gap:7px;flex-wrap:wrap}
  .tplogo{flex:1;min-width:0}
  #wms-mobile-menu-btn{
    display:inline-flex;align-items:center;justify-content:center;
    width:42px;height:42px;flex:0 0 42px;border:1px solid var(--bdr);
    border-radius:10px;background:var(--card);color:var(--tp);
    font-size:21px;cursor:pointer
  }
  .topnav{
    order:3;width:100%;max-width:100%;display:flex;overflow-x:auto;
    -webkit-overflow-scrolling:touch;scrollbar-width:none;padding-bottom:2px
  }
  .topnav::-webkit-scrollbar{display:none}
  .topnav .tbb{min-width:44px;min-height:40px;flex:0 0 auto}
  .topnav .tbb .qtxt{display:none}
  .tpuser{margin-left:auto}
  .tpuser-role{display:none}

  .app-body{position:relative;min-width:0}
  .sidebar{
    position:fixed!important;z-index:4100;left:0;top:0;bottom:0;
    width:min(84vw,320px)!important;max-width:320px;
    transform:translateX(-105%);transition:transform .22s ease;
    box-shadow:0 18px 55px rgba(0,0,0,.32)
  }
  .sidebar.mobile-open{transform:translateX(0)}
  #wms-mobile-overlay{
    position:fixed;z-index:4050;inset:0;background:rgba(15,23,42,.48);
    backdrop-filter:blur(1px)
  }
  #wms-mobile-overlay.active{display:block}
  .main{width:100%;min-width:0;flex:1 1 100%}
  .view.active{min-width:0}
  .phdr{padding:9px 10px;gap:8px;align-items:flex-start;flex-wrap:wrap}
  .phdr>div:last-child{max-width:100%;flex-wrap:wrap}
  .ptitle{font-size:14px}

  .panel,.card,.home-card,.ct-card,.rpt-card{max-width:100%}
  .pbody,.usr-workspace,.home-shell,.ct-shell,.rpt-shell{padding-left:10px!important;padding-right:10px!important}
  .toolbar,.usr-toolbar,.rpt-filterbar,.ct-toolbar{flex-wrap:wrap!important;gap:7px!important}
  .toolbar>* ,.usr-toolbar>* ,.rpt-filterbar>*{max-width:100%}
  .sin,.fin,.fsel,input,select,textarea{max-width:100%;font-size:16px}
  .btn,button,.tbb,.tab{min-height:42px}
  .frow{display:grid!important;grid-template-columns:1fr!important;gap:9px!important}
  .field,.field.w2,.field.w3{width:100%!important;min-width:0!important;grid-column:auto!important}

  .tblwrap,.table-wrap,.rpt-table-wrap,[style*="overflow-x:auto"]{
    max-width:100%;overflow-x:auto!important;-webkit-overflow-scrolling:touch
  }
  table{min-width:720px}
  .modal,.modal.mlg,.modal.mxl{
    width:calc(100vw - 18px)!important;max-width:calc(100vw - 18px)!important;
    max-height:92dvh!important;margin:9px!important
  }
  .mbody{overflow:auto;-webkit-overflow-scrolling:touch}
  .mftr{position:sticky;bottom:0;background:var(--card);z-index:2;flex-wrap:wrap}

  #vw-usuarios #usr-grid,#centros-grid{grid-template-columns:1fr!important}
  .usr-license-strip{flex-wrap:wrap!important}
  .usr-license-strip>div:last-child{width:100%;justify-content:flex-start!important}
  .usr-admin-nav{overflow-x:auto;white-space:nowrap;-webkit-overflow-scrolling:touch}
  .usr-admin-nav .tab{flex:0 0 auto}

  .home-kpis,.ct-kpis,.rpt-kpis{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .home-grid-main,.home-grid-2,.home-flow-wrap,.ct-grid-main,.ct-grid-2,.ct-domain-grid,.ct-exec,.rpt-grid-2,.rpt-grid-3{
    grid-template-columns:1fr!important
  }
}


@media (max-width:560px){
  .topbar{padding:5px 7px}
  .tplogo{font-size:14px}
  .tpuser-name{max-width:92px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .home-kpis,.ct-kpis,.rpt-kpis,.usr-kpis{grid-template-columns:1fr!important}
  .home-shell,.ct-shell,.rpt-shell{padding:8px!important}
  .phbread{display:none}
  .modal,.modal.mlg,.modal.mxl{width:calc(100vw - 10px)!important;max-width:calc(100vw - 10px)!important;margin:5px!important}
  .mhdr,.mbody,.mftr{padding-left:10px!important;padding-right:10px!important}
  .mftr .btn{flex:1 1 120px}
  #wms-login-screen>div:last-child{margin:10px!important;padding:30px 20px 24px!important;max-width:calc(100vw - 20px)!important}
}


/* Ajustes específicos para vistas con grids inline del HTML */
@media (max-width:900px){
  #vw-centros>div[style*="padding:14px"]>div[style*="grid-template-columns:repeat(4,1fr)"]{
    grid-template-columns:repeat(2,minmax(0,1fr))!important
  }
  #centros-grid{grid-template-columns:1fr!important}
  .sidebar .sbgh,.sidebar .sbitem{min-height:44px}
  .fin,.sin,.fsel,.lin{min-height:42px}
  .mov.open{padding:0}
}
@media (max-width:560px){
  #vw-centros>div[style*="padding:14px"]>div[style*="grid-template-columns:repeat(4,1fr)"]{
    grid-template-columns:1fr!important
  }
}


/* V5.1.02 · Mobile shell overrides the desktop grid; desktop stays unchanged. */
.wms-mobile-drawer-head{display:none}
@media(max-width:900px){
  html body{height:100dvh;min-height:0;padding-bottom:var(--wms-quality-footer-height,0px)!important}
  html body .topbar{
    display:grid!important;grid-template-columns:44px minmax(0,1fr)!important;
    height:auto!important;min-height:0;padding:8px 12px!important;gap:8px!important;
    padding-top:max(8px,env(safe-area-inset-top))!important;flex-shrink:0;
  }
  html body #tx-sidebar-toggle{grid-column:1;grid-row:1;width:44px;height:44px}
  html body .topbar .tplogo{grid-column:2;grid-row:1;width:auto;font-size:15px!important;padding:0!important}
  html body .topbar .tplogo::before{content:none}
  html body .topbar .tx-command-wrap{
    grid-column:1/-1!important;grid-row:2;width:100%;max-width:none!important;height:44px;
  }
  html body #tx-command-input{height:44px;font-size:16px;padding-right:12px}
  html body .tx-command-results{top:48px;max-height:45dvh}
  html body .tx-command-kbd,html body .tpclock,html body .topnav{display:none!important}
  html body .topbar .tpright{
    grid-column:1/-1!important;grid-row:3;min-width:0;width:100%;
    display:flex;flex-wrap:wrap;gap:8px!important;justify-content:flex-end;
  }
  html body #wms-almacen-scope-wrap{display:flex!important;min-width:0;flex:1 1 140px}
  html body .wms-warehouse-context{
    min-width:0!important;max-width:100%!important;width:100%;height:44px!important;
  }
  html body .wms-warehouse-context select{
    min-width:0!important;max-width:100%;width:100%;height:42px;font-size:14px!important;
  }
  html body .tpuser{max-width:44px;margin-left:0;padding:0!important}
  html body .tpuser-info{display:none!important}
  html body .av{width:40px;height:40px;font-size:12px}
  html body .tpright>button{width:44px;min-width:44px;height:44px;padding:0}
  html body .app-body,html body .main{min-height:0;min-width:0;max-width:100%}
  html body .main{flex:1 1 0;width:100%;overflow:hidden}
  html body .view.active{min-height:0;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain}
  html body .view.active>.ta{flex:1 0 auto;overflow:visible;min-width:0;padding:12px}
  html body .phdr{padding:12px;gap:10px;flex-direction:column;align-items:stretch}
  html body .phdr>div{min-width:0;max-width:100%}
  html body .phdr>div:last-child{display:flex;flex-wrap:wrap;gap:8px!important}
  html body .phdr .btn{flex:1 1 145px;white-space:normal;justify-content:center;min-height:44px}
  html body .ptitle{font-size:18px;line-height:1.3;overflow-wrap:anywhere}
  html body .toolbar{height:auto;min-height:54px;padding:10px 12px;overflow:visible;flex:0 0 auto}
  html body .toolbar>:not(.tsep){min-width:0!important;flex:1 1 160px;max-width:100%}
  html body .toolbar input,html body .toolbar select{width:100%}
  html body .field{min-width:0!important;max-width:100%!important}
  html body .sin,html body .fin,html body .fsel,html body .lin{
    min-width:0!important;max-width:100%;min-height:44px;font-size:16px;
  }
  html body .btn{min-height:44px;line-height:1.3;white-space:normal}
  html body #ubi-v5013-filterbar{padding:12px!important;flex:0 0 auto}
  html body #ubi-v5013-filterbar>div{
    display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px!important;align-items:end;
  }
  html body #ubi-v5013-filterbar .field{
    width:auto!important;min-width:0!important;max-width:none!important;
  }
  html body #ubi-v5013-filterbar .field:first-child{grid-column:1/-1}
  html body #ubi-v5013-filterbar .field:first-child>span:last-child{font-size:11px!important;line-height:1.4}
  html body #ubi-v5013-filterbar select,html body #ubi-v5013-filterbar input{width:100%}
  html body #ubi-v5013-filterbar>div>div[style="flex:1"]{display:none}
  html body .tw,html body .tblwrap,html body .table-wrap,html body .rpt-table-wrap{
    width:100%;max-width:100%;min-width:0;overflow-x:auto!important;overscroll-behavior-x:contain;
    -webkit-overflow-scrolling:touch;
  }
  html body .sidebar,html body.tx-sidebar-open .sidebar{
    position:fixed!important;inset:0 auto var(--wms-quality-footer-height,0px) 0;
    top:0!important;bottom:var(--wms-quality-footer-height,0px)!important;
    width:min(88vw,340px)!important;min-width:0!important;max-width:340px;
    opacity:1!important;overflow-y:auto!important;z-index:4200;
    transform:translateX(-105%);transition:transform .2s ease!important;
    padding-top:env(safe-area-inset-top);padding-bottom:env(safe-area-inset-bottom);
  }
  html body.tx-sidebar-open .sidebar{transform:translateX(0)}
  html body .tx-sidebar-backdrop{position:fixed;inset:0;z-index:4100;background:rgba(15,23,42,.5)}
  html body.tx-sidebar-open .tx-sidebar-backdrop{display:block}
  html body .wms-mobile-drawer-head{
    display:flex;align-items:center;justify-content:space-between;gap:8px;padding:12px;
    position:sticky;top:0;background:#fff;z-index:2;border-bottom:1px solid var(--bdr);flex-shrink:0;
  }
  html body .wms-mobile-drawer-head button{width:44px;height:44px;border:1px solid var(--bdr);border-radius:8px;background:#f7f9fb}
  html body .sidebar .sbitem,html body .sidebar .sbgh{min-height:48px}
  html body .sidebar .sbitem{font-size:14px!important}
  html body .sidebar .sbgl{font-size:12px!important}
  html body .modal,html body .modal.mlg,html body .modal.mxl{
    max-height:calc(100dvh - var(--wms-quality-footer-height,0px) - 16px)!important;
  }
  html body .mov.open{padding-bottom:var(--wms-quality-footer-height,0px)}
  html body .mbody{min-height:0}
  html body .mftr{flex-shrink:0;gap:8px}
  html body .kgrid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  html body #wms-quality-banner{padding-bottom:max(6px,env(safe-area-inset-bottom))!important;line-height:1.4!important}
}
@media(max-width:380px){
  html body #ubi-v5013-filterbar>div{grid-template-columns:minmax(0,1fr)}
  html body .phdr .btn{flex-basis:100%}
}
@media(prefers-reduced-motion:reduce){
  html body .sidebar{transition:none!important}
}


@media(max-width:900px){
  html body .sbar{flex-wrap:wrap;gap:8px;padding:10px 12px}
  html body .sbar>input,html body .sbar>select{width:100%;flex:1 1 180px;min-width:0}
  html body .sbar>.scnt{flex:1 1 100%}
}
