/* ERGOMEX_UNIVERSAL_MOBILE_V8: shared, screen-only responsiveness.
   Native browser pinch-to-zoom remains available; layouts keep their own touch editor.
   Do not change print/pdf geometry or saved application data. */
@media screen and (max-width:900px), screen and (max-device-width:900px){
 html.ergo-mobile-universal-v8{max-width:100%;min-width:0;width:100%;overflow-x:clip!important}
 html.ergo-mobile-universal-v8 body{max-width:100%;width:100%;min-width:0;box-sizing:border-box;overflow-x:clip!important}
 html.ergo-mobile-universal-v8 :is(.app,.container,.container-fluid,.wrap,.shell,.page,.main,.content,.workspace,.main-content,.dashboard,.dashboard-content,.form-container,.form-wrapper,.view,.view-content,.module-root){
  min-width:0;max-width:100%;box-sizing:border-box;
 }
 html.ergo-mobile-universal-v8 :is(.card,.card-body,.panel,.panel-body,.section,.widget,.chart-card,.form-card,.form-section,.grid,.row,.column,.cols,.field){
  min-width:0;max-width:100%;box-sizing:border-box;
 }
 html.ergo-mobile-universal-v8 :is(img,video,iframe,object){max-width:100%}
 html.ergo-mobile-universal-v8 img{height:auto}
 html.ergo-mobile-universal-v8 :is(input:not([type=checkbox]):not([type=radio]):not([type=range]),select,textarea){
  max-width:100%;box-sizing:border-box
 }
 html.ergo-mobile-universal-v8 :is(.hero,.page-header,.section-head,.panel-head,.card-h,.header-actions,.hero-actions){
  min-width:0;max-width:100%;flex-wrap:wrap
 }
 html.ergo-mobile-universal-v8 :is(.hero-actions,.header-actions,.actions,.action-bar,.action-row,.button-row,.form-actions,.filter-actions){
  max-width:100%;min-width:0;flex-wrap:wrap
 }
 html.ergo-mobile-universal-v8 :is(.table-wrap,.table-wrapper,.table-responsive,.table-scroll,.table-container,.datatable-wrap,.data-table-wrap,.ergo-responsive-table-viewport){
  max-width:100%;min-width:0;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;
 }
 html.ergo-mobile-universal-v8 :is(.modal-box,.modal-content,.dialog-content,.modal-dialog,[role=dialog]){
  max-width:min(100%,calc(100vw - 18px));max-height:calc(100svh - 18px);box-sizing:border-box
 }
 html.ergo-mobile-universal-v8 :is(.modal-box,.modal-content,.dialog-content){overflow-y:auto;overscroll-behavior:contain}
 html.ergo-mobile-universal-v8 :is(.tabs,.nav-tabs,.tab-bar,.tab-list){
  max-width:100%;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch;
 }
 html.ergo-mobile-universal-v8 .form-grid > *,
 html.ergo-mobile-universal-v8 .grid2 > *,
 html.ergo-mobile-universal-v8 .courseGrid > *{min-width:0}
 html.ergo-mobile-universal-v8 .signature canvas{max-width:100%}
}
@media screen and (max-width:600px), screen and (max-device-width:600px){
 html.ergo-mobile-universal-v8 :is(.hero h1,.page-title,.module-title){font-size:clamp(19px,5.2vw,27px);overflow-wrap:anywhere}
 html.ergo-mobile-universal-v8 :is(.grid2,.form-grid,.courseGrid,.fields-grid,.input-grid,.field-grid,.filters-grid){
  grid-template-columns:minmax(0,1fr)
 }
 html.ergo-mobile-universal-v8 .toolbar:not(.ergo-layout-nav-controls):not(.ergo-layout-toolbar){
  max-width:100%;min-width:0
 }
 html.ergo-mobile-universal-v8 :is(.wrap,.app,.shell,.page,.container){box-sizing:border-box}
 html.ergo-mobile-universal-v8 :is(.modal,.modal-backdrop){box-sizing:border-box}
}
@media screen and (pointer:coarse){
 html.ergo-mobile-universal-v8 :is(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]),select,textarea){
  font-size:max(16px,1em)
 }
 html.ergo-mobile-universal-v8 :is(button,[role=button],input[type=submit],input[type=button]){
  touch-action:manipulation
 }
 html.ergo-mobile-universal-v8 :is(.form-actions button,.actions button,.hero-actions button,.modal-actions button){
  min-height:42px
 }
}
@media print{
 html.ergo-mobile-universal-v8 :is(.ergo-responsive-table-viewport){overflow:visible!important}
}


/* Large form and spreadsheet screens: allow LOCAL horizontal scrolling instead
   of shrinking the entire page or hiding off-screen fields. */
@media screen and (max-width:900px), screen and (max-device-width:900px){
 html.ergo-mobile-universal-v8 body[data-ergo-wide-module="coa"]{
  overflow-x:auto!important;overscroll-behavior-x:contain;
  -webkit-overflow-scrolling:touch
 }
 html.ergo-mobile-universal-v8 body[data-ergo-wide-module="historico"] > .app{
  width:100%;min-width:0;max-width:100%;overflow-x:auto;overscroll-behavior-x:contain
 }
 html.ergo-mobile-universal-v8 body[data-ergo-wide-module="comedor"] #formPage{
  width:100%;min-width:0;max-width:100%;box-sizing:border-box
 }
 html.ergo-mobile-universal-v8 body[data-ergo-wide-module="comedor"] :is(.top,.topTitle,.hero,.grid3){
  min-width:0;max-width:100%;flex-wrap:wrap
 }
 html.ergo-mobile-universal-v8 body[data-ergo-wide-module="comedor"] :is(.topTitle b,.topTitle span,.hero h1){
  white-space:normal;overflow-wrap:anywhere
 }
}


/* ERGOMEX_CONTROL_BADGE_MOBILE_V9
   Compact documentation information on phones without touching printed formats. */
@media screen and (max-width:900px),screen and (max-device-width:900px){
 #nedecDocControlV44{
  position:fixed!important;left:auto!important;right:8px!important;
  bottom:max(7px,env(safe-area-inset-bottom,0px))!important;
  width:auto!important;max-width:calc(100vw - 16px)!important;
 }
 #nedecDocControlV44 .dc-pill{
  display:inline-flex!important;max-width:calc(100vw - 16px)!important;
  flex-wrap:nowrap!important;gap:5px!important;
  min-height:35px;max-height:39px;padding:5px 9px!important;
  white-space:nowrap!important;font-size:10px!important;
 }
 #nedecDocControlV44 .dc-pill>.dc-logo{height:13px!important}
 #nedecDocControlV44 .dc-pill>span:not(.dc-dot){display:none!important}
 #nedecDocControlV44 .dc-pill>b{font-size:10px;font-weight:900}
 #nedecDocControlV44 .dc-panel{
  right:0!important;bottom:45px!important;
  width:min(390px,calc(100vw - 16px))!important;
  max-width:calc(100vw - 16px)!important;
  max-height:min(60svh,540px)!important;overflow-y:auto!important
 }
}


/* ERGOMEX_MOBILE_USABILITY_V10
   Address measured clipping and undersized mobile controls without affecting
   documents/print, saved equipment, or application logic. */
@media screen and (max-width:900px),screen and (max-device-width:900px){
  /* Main ErgoMX shell: no controls extending off the right edge. */
  body[data-ergo-mobile-tune="shell"] .topbar{
    position:relative!important;padding:9px 10px!important;
    max-width:100%!important;overflow:visible!important;
  }
  body[data-ergo-mobile-tune="shell"] .topbar-inner{
    display:flex!important;flex-wrap:wrap!important;gap:7px!important;
    min-width:0!important;width:100%!important;
  }
  body[data-ergo-mobile-tune="shell"] .logo{
    order:0;flex:1 1 170px;min-width:0!important;
  }
  body[data-ergo-mobile-tune="shell"] .top-right{
    order:1;flex:1 1 100%;min-width:0!important;max-width:100%!important;
    width:100%!important;justify-content:space-between!important;
    flex-wrap:wrap!important;gap:6px!important;
  }
  body[data-ergo-mobile-tune="shell"] .top-right .pill{display:none!important}
  body[data-ergo-mobile-tune="shell"] .zoomctl{
    min-width:0!important;flex:1 1 220px;max-width:calc(100% - 50px);
    width:auto!important;gap:5px!important;padding:5px 7px!important;
  }
  body[data-ergo-mobile-tune="shell"] .zoomctl input[type=range]{
    min-width:45px!important;flex:1 1 60px;width:60px!important;
  }
  body[data-ergo-mobile-tune="shell"] .top-right .iconbtn,
  body[data-ergo-mobile-tune="shell"] .zoomctl .pillbtn,
  body[data-ergo-mobile-tune="shell"] .side-mini-btn{
    min-height:40px!important;min-width:40px!important;
    font-size:12px!important;
  }
  body[data-ergo-mobile-tune="shell"] #btnSettings{
    flex:0 0 42px;min-width:42px!important;
  }
  body[data-ergo-mobile-tune="shell"] .capsule{
    order:2;flex:1 1 100%;width:100%!important;min-width:0!important;
    max-width:100%!important;overflow-x:auto!important;
    border-radius:14px!important;padding:5px!important;
    scrollbar-width:thin;
  }
  body[data-ergo-mobile-tune="shell"] .capsule .tab{
    flex:0 0 auto;min-height:40px;align-items:center;
    padding:7px 11px!important;
  }
  /* Historical training: filters should be visible; matrix remains scrollable. */
  body[data-ergo-wide-module="historico"] .table-filters{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    min-width:0!important;width:100%!important;
    max-width:100%!important;overflow:visible!important;
    gap:9px!important;align-items:stretch!important;
  }
  body[data-ergo-wide-module="historico"] .table-filters>*{
    min-width:0!important;max-width:100%!important;
  }
  body[data-ergo-wide-module="historico"] .table-filters .field:first-child{
    grid-column:1/-1;
  }
  body[data-ergo-wide-module="historico"] .table-filters :is(select,input:not([type=checkbox])){
    min-width:0!important;width:100%!important;max-width:100%!important;
    min-height:42px!important;box-sizing:border-box!important;
  }
  body[data-ergo-wide-module="historico"] .table-filters :is(.switch,.toggle-btn){
    display:flex!important;align-items:center!important;
    min-height:42px!important;font-size:12px!important;
  }
  body[data-ergo-wide-module="historico"] .table-filters .switch input{
    min-width:19px;min-height:19px;
  }
  body[data-ergo-wide-module="historico"] .table-filters #completedPageOnly{
    grid-column:1/-1;min-width:0!important;width:100%!important;
    white-space:normal!important;min-height:44px!important;
  }
  body[data-ergo-wide-module="historico"] .matrix-actions{
    display:flex;flex-wrap:wrap;gap:7px;max-width:100%;
  }
  body[data-ergo-wide-module="historico"] .matrix-actions button{
    min-height:42px;max-width:100%;
  }
  /* NOM-024: original report-cover grid expands to 395px on a 360px phone. */
  body[data-ergo-mobile-tune="vibraciones"] .report-cover{
    display:grid!important;
    grid-template-columns:minmax(0,1fr)!important;
    width:100%!important;max-width:100%!important;
  }
  body[data-ergo-mobile-tune="vibraciones"] :is(
    .cover-main,.cover-side,.cover-copy,.cover-brand-row,
    .date-panel-title,.date-grid,.date-field){
    min-width:0!important;max-width:100%!important;box-sizing:border-box!important;
  }
  body[data-ergo-mobile-tune="vibraciones"] .cover-main{
    width:100%!important;padding:19px 15px!important;min-height:0!important;
  }
  body[data-ergo-mobile-tune="vibraciones"] .cover-side{width:100%!important}
  body[data-ergo-mobile-tune="vibraciones"] .cover-brand-row{
    flex-wrap:wrap!important;justify-content:space-between!important;gap:9px!important;
  }
  body[data-ergo-mobile-tune="vibraciones"] .cover-copy h1{
    font-size:clamp(27px,7.8vw,34px)!important;line-height:1.08!important;
    overflow-wrap:anywhere!important;
  }
  body[data-ergo-mobile-tune="vibraciones"] :is(.cover-copy p,.cover-kicker,.date-panel-title){
    overflow-wrap:anywhere!important;
  }
  body[data-ergo-mobile-tune="vibraciones"] .date-panel-title{
    flex-wrap:wrap!important;gap:8px!important;
  }
  body[data-ergo-mobile-tune="vibraciones"] :is(.date-field input,.date-field select,.doc-field input,.doc-field select){
    min-height:40px!important;width:100%!important;max-width:100%!important;
  }
  /* Chemical safety inventory: legible labels and gloved-finger friendly actions. */
  body[data-ergo-mobile-tune="sustancias"] :is(.field label,.filter label,.form-label){
    font-size:12px!important;line-height:1.35!important;
  }
  body[data-ergo-mobile-tune="sustancias"] button{
    min-height:40px!important;
  }
}
@media screen and (max-width:400px),screen and (max-device-width:400px){
  body[data-ergo-wide-module="historico"] .table-filters{grid-template-columns:minmax(0,1fr)!important}
  body[data-ergo-wide-module="historico"] .table-filters .field:first-child,
  body[data-ergo-wide-module="historico"] .table-filters #completedPageOnly{grid-column:1!important}
}


/* ERGOMEX_MORE_TAP_TARGETS_V10 - scoped controls, no printer stylesheet changes */
@media screen and (max-width:900px),screen and (max-device-width:900px){
 body[data-ergo-mobile-tune="leysilla"] .integrationTab,
 body[data-ergo-mobile-tune="leysilla"] :is(.mini-action,.btn){
   min-height:42px!important;
   font-size:max(12px,1em)!important;
 }
 body[data-ergo-mobile-tune="riskai"] :is(.topActions button,.btn.mini,#newStudy){
   min-height:42px!important;font-size:max(12px,1em)!important;
 }
 body[data-ergo-mobile-tune="ruido"] .mobile-tab-hint{
   display:block;color:#475569;font-size:12px;font-weight:700;
   padding:0 7px;margin:8px 0 4px;
 }
 body[data-ergo-mobile-tune="ruido"] .tabs{
   max-width:100%!important;overflow-x:auto!important;
   scroll-snap-type:x proximity;overscroll-behavior-x:contain;
 }
 body[data-ergo-mobile-tune="ruido"] .tabs .tab{
   flex:0 0 auto;scroll-snap-align:start;min-height:42px;
 }
}
@media print{body[data-ergo-mobile-tune="ruido"] .mobile-tab-hint{display:none!important}}
