/* Ajustes de pantalla: los desplazamientos de las tablas quedan dentro de su panel. */
#mobileNavBackdrop{display:none}
@media(max-width:1050px){
 body>header .brand{min-width:0;gap:8px}body>header h1{white-space:normal;overflow-wrap:anywhere}
 .layout>main,.workspace-section,.panel,.settings-grid>*{min-width:0}
 #settingsSection .settings-grid{grid-template-columns:1fr}
}
@media(max-width:900px){
 html,body{width:100%;max-width:100%;height:100dvh;overflow:hidden}
 body>header{height:auto;min-height:60px;padding:10px 12px;gap:10px;flex-wrap:wrap;position:relative;z-index:41}
 body>header .brand{flex:1 1 100%;min-width:0}body>header h1{font-size:15px!important;line-height:1.4;margin:0}
 body>header .brand>.logo{width:30px;height:30px;flex-shrink:0}
 body>header>.actions{display:flex;flex:1 1 100%;min-width:0;max-width:100%;gap:8px;flex-wrap:wrap}
 body>header>.actions>button{min-height:42px;padding:9px 10px;font-size:13px;flex:1;min-width:0;white-space:normal}
 .inventory-file-actions{flex:2;min-width:0;display:flex;max-width:100%}.inventory-file-actions>button.primary{flex:1;min-width:0;font-size:13px;padding:10px 8px;min-height:42px}
 .layout,.sidebar-hidden .layout{display:flex;flex-direction:column;width:100%;height:calc(100dvh - var(--header-h,116px));min-height:0;grid-template-columns:minmax(0,1fr)}
 .layout>aside{position:fixed;top:var(--header-h,116px);bottom:0;left:0;width:min(290px,86vw);max-width:100%;z-index:50;display:block;overflow:auto;overscroll-behavior:contain;padding:18px 14px;box-shadow:10px 0 30px #14263725;padding-bottom:max(20px,env(safe-area-inset-bottom))}
 body.sidebar-hidden .layout>aside{display:none}.layout>aside .workspace-tab{min-height:48px;font-size:14px;line-height:1.5;white-space:normal;padding:11px 12px}
 #mobileNavBackdrop:not([hidden]){display:block;position:fixed;inset:var(--header-h,116px) 0 0;border:0;border-radius:0;z-index:49;background:#13263870;padding:0}
 #mobileNavBackdrop[hidden]{display:none!important}
 .layout>main{width:100%;height:100%;min-height:0;overflow:hidden;padding:12px 10px calc(10px + env(safe-area-inset-bottom))}
 .title-row{flex-wrap:wrap;gap:10px;align-items:center}.title-row h2{font-size:20px!important;line-height:1.4;overflow-wrap:anywhere}
 .title-row>.actions{flex-wrap:wrap;max-width:100%}.title-row>div{min-width:0}
 .table-wrap,.worker-table-wrap,.movement-scroll,.backup-table,.sr-history-wrap{max-width:100%;min-width:0;overflow:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
 .table-wrap td.desc,.table-wrap .desc-head,.table-wrap .row-tools{position:static!important;left:auto!important;right:auto!important}
 .catalog-searchbar{display:grid!important;grid-template-columns:1fr 1fr;gap:8px!important;padding:10px!important}
 .catalog-searchbar .search{grid-column:1/-1;width:100%;min-width:0;height:44px!important;font-size:16px!important}
 .catalog-searchbar #addBtn,.catalog-searchbar #expandBtn{min-width:0;min-height:44px;height:auto!important;font-size:13px!important;padding:10px 8px!important;white-space:normal}
 .inventory-tools{display:flex;flex-wrap:wrap;padding:8px;gap:6px}.inventory-tools>button{font-size:13px;min-height:42px;padding:9px 10px;white-space:normal}
 .tool-panel{padding:12px;max-height:45dvh;overflow:auto}.tool-panel select,.tool-panel input{max-width:100%;min-width:0!important}
 .exact-filter-controls{display:grid!important;grid-template-columns:1fr 1fr;gap:8px!important}.exact-filter-controls>select,.exact-filter-controls>input{width:100%;max-width:none!important;min-width:0!important;height:44px}
 .filter-type-row,.catalog-groups,.warehouse-groups{flex-wrap:wrap;gap:8px}.catalog-groups select,.warehouse-groups select{min-width:0;max-width:100%;flex:1 1 140px}
 .focus-bar,.focus-selection{flex-wrap:wrap!important}.focus-bar input{flex:1 1 100%;min-width:0;height:44px;font-size:16px}.focus-bar button,.focus-selection button{height:auto;min-height:42px;font-size:12px;padding:9px;white-space:normal}
 .table-focus .panel,.warehouse-focus #warehouseSection{width:100%;max-width:100%;inset:0!important;height:100dvh!important;padding-bottom:env(safe-area-inset-bottom)}
 .footer{max-width:100%;flex-wrap:wrap;gap:8px;font-size:12px;padding:9px}.footer .actions{flex-wrap:wrap}.footer button{min-height:36px;min-width:36px}
 #settingsSection,#backupInboxSection{overflow:auto;overscroll-behavior:contain;width:100%;max-width:100%;padding:0 0 18px}
 #settingsSection .settings-grid{display:grid;grid-template-columns:1fr;gap:16px}#settingsSection .settings-options{display:block}#settingsSection .settings-detail-grid{grid-template-columns:1fr}
 #settingsSection .settings-card{min-width:0;padding:20px 16px}#settingsSection input:not([type=checkbox]),#settingsSection select,#settingsSection textarea{width:100%;max-width:100%;min-width:0;font-size:16px;min-height:44px}
 #settingsSection button{max-width:100%;min-height:44px;overflow-wrap:anywhere}#settingsSection .settings-heading{align-items:start;flex-wrap:wrap;gap:10px}#settingsSection .storage-numbers{display:flex;flex-wrap:wrap;gap:10px}
 #workerScreen{padding:0 0 env(safe-area-inset-bottom);max-width:100%;height:100dvh}
 .worker-header{display:flex;flex-wrap:wrap;gap:10px;padding:12px;border-radius:0}.worker-header .brand{min-width:0;flex:1 1 100%}.worker-header .worker-sync{display:flex;flex-wrap:wrap;justify-content:space-between;width:100%;gap:8px}
 .worker-header button{min-height:42px;font-size:13px}.worker-toolbar{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding:10px;flex-shrink:0}
 .worker-toolbar input,.worker-toolbar select{width:100%;max-width:100%;min-width:0;font-size:16px;min-height:44px}.worker-toolbar input{grid-column:1/-1}.worker-toolbar button{margin:0;min-width:0;min-height:44px;font-size:13px;white-space:normal;padding:9px}
 #workerCount{white-space:normal;font-size:12px}#workerNewRequest{grid-column:1/-1}.worker-table-wrap{min-height:150px;scrollbar-gutter:auto}.worker-table-wrap table{min-width:960px}
 .worker-table-wrap th:last-child,.worker-table-wrap td.worker-actions{position:static!important;right:auto!important}.worker-table-wrap th:first-child,.worker-table-wrap td.worker-code{max-width:150px!important;min-width:120px!important;width:140px!important;overflow-wrap:anywhere}
 .worker-table-wrap td{font-size:13px;padding:10px}.worker-table-wrap button{min-height:42px}.worker-footer{font-size:12px;padding:10px;white-space:normal;overflow-wrap:anywhere}
 .movement-stats{gap:14px;flex-wrap:wrap;font-size:12px}.movement-toolbar{padding:10px;gap:8px}.movement-toolbar input[type=search]{flex:1 1 100%;min-width:0;font-size:16px;min-height:44px}.movement-toolbar button,.movement-toolbar select{min-height:44px;height:auto;font-size:13px;white-space:normal}.movement-pagination{flex-wrap:wrap;margin:0;gap:8px}.movement-pagination button,.movement-pagination select{min-height:40px}#movementSection .movement-subtitle{font-size:13px}
 dialog{width:calc(100vw - 24px)!important;max-width:680px!important;max-height:calc(100dvh - 24px);padding:0;border-radius:12px;overflow:auto}
 dialog .dialog-head{padding:18px 16px;gap:12px}dialog .dialog-head h2{font-size:18px;line-height:1.4;min-width:0;overflow-wrap:anywhere}dialog .dialog-body{padding:4px 16px 20px;max-height:calc(100dvh - 180px);overflow:auto}
 dialog .dialog-foot{padding:14px 16px;display:flex;flex-wrap:wrap;gap:10px}dialog button{min-height:44px;font-size:14px;white-space:normal}dialog .dialog-foot button{flex:1;min-width:100px}
 dialog .fields,#workerRequestDialog .fields{grid-template-columns:1fr!important}dialog input:not([type=checkbox]),dialog select,dialog textarea{font-size:16px!important;min-height:44px;max-width:100%;min-width:0;width:100%}
 dialog .columns-grid{grid-template-columns:1fr 1fr}.dialog-body p,.dialog-body small{overflow-wrap:anywhere}
 body.session-locked .login-screen{position:fixed;inset:0;overflow:auto;align-items:start;padding:16px 12px max(20px,env(safe-area-inset-bottom))}
 .portal-login-shell{width:100%;max-width:440px;margin:auto;min-width:0}.portal-login-shell .login-card{min-width:0;padding:24px}.portal-login-shell input{font-size:16px;min-height:46px}.portal-login-shell button{min-height:46px;font-size:14px}
 #shiftReportsScreen{max-width:100%;height:100dvh;overflow:auto;padding-bottom:env(safe-area-inset-bottom)}.sr-header{position:relative;padding:14px 12px;align-items:flex-start;gap:12px;flex-wrap:wrap}.sr-header>div{min-width:0;max-width:100%}.sr-header h1{font-size:20px!important;line-height:1.4;overflow-wrap:anywhere}.sr-actions{width:100%;gap:8px}.sr-actions button{min-height:44px;font-size:13px!important;white-space:normal}.sr-actions>span{display:none}
 .sr-body{width:100%;padding:18px 12px 30px!important;min-width:0}.sr-tabs{display:flex;flex-wrap:wrap;gap:8px}.sr-tabs button{flex:1 1 130px;min-width:0;min-height:44px;font-size:13px!important;white-space:normal;padding:10px!important;line-height:1.5}
 .sr-editor-grid{grid-template-columns:minmax(0,1fr)}.sr-editor-grid>*{min-width:0}.sr-summary{order:-1;position:static;display:grid;width:auto;max-width:none;overflow:visible;grid-template-columns:1fr 1fr;min-width:0;gap:10px}.sr-summary>button{min-height:44px;font-size:13px!important;white-space:normal}
 .sr-datebar{display:grid;grid-template-columns:1fr 1fr;gap:12px}.sr-datebar label{min-width:0}.sr-datebar input,.sr-datebar select{width:100%!important;min-width:0!important;font-size:16px!important;min-height:44px}.sr-date-info{grid-column:1/-1;font-size:12px}
 #shiftReportsScreen input,#shiftReportsScreen select,#shiftReportsScreen textarea{max-width:100%;min-width:0;font-size:16px!important}.sr-people{flex-wrap:wrap}.sr-person{min-width:0;max-width:100%;flex:1 1 100%}.sr-person select{min-width:0;flex:1;width:100%}.sr-person button{min-height:44px;flex-shrink:0}
 .sr-machine-fields{grid-template-columns:1fr!important}.sr-machine-fields label{grid-column:1!important}.sr-machine-head{gap:12px;flex-wrap:wrap;align-items:center}.sr-machine-head h3{min-width:0;overflow-wrap:anywhere}.sr-machine-head select{min-height:44px;width:112px!important}.sr-riles{gap:10px;flex-wrap:wrap}.sr-riles input{width:100px!important}
 .sr-mail-address{grid-template-columns:1fr;gap:8px}.sr-mail-address span,.sr-address-chip{max-width:100%;overflow-wrap:anywhere}.sr-mail-actions{flex-wrap:wrap}.sr-mail-actions button{min-height:44px}
 #shiftReportsScreen .portal-history-filters{grid-template-columns:1fr 1fr;gap:12px;padding:14px 12px}#shiftReportsScreen .portal-history-search{grid-column:1/-1}#shiftReportsScreen .portal-history-filters input{height:44px;font-size:16px}
 #shiftReportsScreen .portal-history-actions{gap:8px;justify-content:stretch}#shiftReportsScreen .portal-history-actions button{flex:1 1 120px;min-height:44px;font-size:13px}
 .sr-reader{width:100%;max-width:100%;height:100dvh;padding:16px 12px max(24px,env(safe-area-inset-bottom));overflow:auto}.sr-reader-frame{min-width:0;width:100%;max-width:1050px}.sr-day-title{gap:14px;flex-wrap:wrap}.sr-day-title h2{width:100%;font-size:17px!important;line-height:1.5}.portal-history-back{max-width:100%;min-height:44px;white-space:normal}
 .sr-reader-shifts{gap:8px}.sr-reader-shifts button{min-width:0;flex:1 1 95px;font-size:12px;min-height:48px;white-space:normal;padding:8px;line-height:1.5}.sr-read-content{padding:20px 16px}.sr-read-meta{gap:10px;padding-bottom:18px;margin-bottom:18px;flex-direction:column;align-items:flex-start}.sr-read-meta>small{margin-left:0}.sr-read-machine summary{align-items:start;gap:12px}.sr-read-machine summary strong{min-width:0;overflow-wrap:anywhere}.sr-read-machine p,.sr-read-message{font-size:15px;line-height:1.8}.sr-reader-actions{flex-wrap:wrap}.sr-reader-actions>button{flex:1;min-height:44px;font-size:14px}
 .backup-toolbar{gap:10px}.backup-toolbar label{max-width:none;flex-basis:100%;min-width:0}.backup-toolbar button{flex:1;min-height:44px}.backup-toolbar select,.backup-filters input,.backup-filters select{font-size:16px}.backup-filters{grid-template-columns:1fr 1fr;gap:12px}.backup-filters label{min-width:0}.backup-filters label:nth-child(3),.backup-search{grid-column:1/-1}#backupInboxSection .sr-pagination{flex-wrap:wrap;gap:8px}#backupInboxCount{flex-basis:100%}
 /* Los historiales de cuatro columnas se convierten en tarjetas, conservando la tabla accesible. */
 #shiftReportsScreen #srHistory table[data-mobile-cards],#backupInboxSection .backup-table table[data-mobile-cards]{min-width:0!important;width:100%;table-layout:auto;display:block}
 table[data-mobile-cards] thead{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
 table[data-mobile-cards] tbody{display:block;width:100%}
 #shiftReportsScreen #srHistory table[data-mobile-cards] tr,#backupInboxSection table[data-mobile-cards] tr{display:grid;grid-template-columns:1fr;width:100%;min-width:0;padding:16px;margin:0 0 12px;border:1px solid #dce4eb;border-radius:10px;background:#fff}
 #shiftReportsScreen #srHistory table[data-mobile-cards] td,#backupInboxSection table[data-mobile-cards] td{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;width:100%;max-width:none;min-width:0;padding:9px 0;white-space:normal!important;border:0;font-size:14px;position:static;line-height:1.6}
 table[data-mobile-cards] td:not(:first-child)::before{content:attr(data-mobile-label);color:#6c7e91;font-size:11px;flex:0 0 90px;line-height:1.8;font-weight:600}
 #shiftReportsScreen #srHistory table[data-mobile-cards] td:first-child,#backupInboxSection table[data-mobile-cards] td:first-child{font-size:17px;font-weight:650;padding:0 0 10px;border-bottom:1px solid #edf1f5;margin-bottom:4px}
 table[data-mobile-cards] td:last-child::before{display:none}table[data-mobile-cards] .sr-day-actions{display:flex;gap:8px;min-width:0!important;width:100%;flex-wrap:wrap!important}
 #shiftReportsScreen #srHistory table[data-mobile-cards] .sr-day-actions>button,#backupInboxSection table[data-mobile-cards] .sr-day-actions>button{min-height:44px;font-size:13px;flex:1;padding:10px!important}
 #shiftReportsScreen #srHistory table[data-mobile-cards] .portal-day-delete{flex:0 0 44px!important;margin-left:0;width:44px;height:44px}
 #shiftReportsScreen #srHistory .sr-history-wrap:has(table[data-mobile-cards]),#backupInboxSection .backup-table:has(table[data-mobile-cards]){padding:0!important;background:transparent;border:0;box-shadow:none;overflow:visible}
 .toast{max-width:calc(100vw - 24px);left:12px;right:12px;bottom:max(14px,env(safe-area-inset-bottom));width:auto;font-size:13px;overflow-wrap:anywhere}
}
@media(max-width:420px){
 body>header .brand>.logo{display:none}body>header h1{font-size:14px!important}body>header .inventory-file-actions{flex:1 1 100%}body>header>.actions>button{flex:1 1 35%}
 .sr-datebar,.exact-filter-controls{grid-template-columns:1fr}.sr-date-info{grid-column:1}.sr-summary{grid-template-columns:1fr}.sr-summary>*{grid-column:1!important}.sr-person{flex-wrap:wrap}.sr-person select{flex-basis:calc(100% - 52px)}
 .sr-header .sr-actions button{flex:1 1 100%}.sr-header h1{font-size:18px!important}.portal-login-shell .login-card{padding:22px 18px}.portal-cover{padding:20px}.portal-cover h2{font-size:22px}.portal-gears{opacity:.24}
 dialog .columns-grid{grid-template-columns:1fr}.movement-stats{gap:8px 14px}.movement-stats strong{font-size:16px}.focus-bar button{flex:1 1 40%}
}
@media(max-height:550px) and (max-width:1000px){
 .portal-cover{display:none}.portal-login-shell .login-card{padding:20px}.portal-login-shell{max-width:520px}.sr-header{position:static}.sr-reader-shifts{margin:12px 0}dialog .dialog-body{max-height:calc(100dvh - 150px)}
}
@media(prefers-reduced-motion:reduce){html:focus-within{scroll-behavior:auto}*,*::before,*::after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important}}
@media(max-width:900px){body,button,input,select,textarea,h1,h2,h3,h4{font-family:system-ui,-apple-system,'Segoe UI',sans-serif!important}}
.mobile-filter-toggle{display:none}
@media(max-width:900px){
 #sidebarToggle{min-width:44px;min-height:44px;padding:10px;display:inline-flex;align-items:center;justify-content:center}#sidebarToggle .ui-icon{width:20px;height:20px}
 .mobile-filter-toggle{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:44px;margin:14px 0;padding:11px 13px;border:1px solid #d5dfe8;background:#fff;border-radius:8px;color:#3a5367;font-size:13px;font-weight:600}
 .mobile-filter-toggle::after{content:'⌄';font-size:18px}.mobile-filter-toggle[aria-expanded=true]::after{content:'⌃'}
 .mobile-filter-panel:not(.mobile-filters-open){display:none!important}
 .backup-toolbar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;margin:16px 0 8px;gap:10px}.backup-toolbar label{min-width:0}.backup-toolbar button{min-height:46px;font-size:12px;padding:10px}.backup-tabs{margin:16px 0}.backup-filters{margin-top:0}.backup-subtitle{margin-top:6px}
 body.portal-backup-inbox>header{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px;padding:8px}body.portal-backup-inbox>header .brand{grid-column:1;min-width:0}body.portal-backup-inbox>header>.actions{display:contents}body.portal-backup-inbox>header #sessionLockBtn{grid-column:2;grid-row:1;max-width:110px;font-size:12px;padding:8px;min-height:44px}
}
@media(max-width:900px){
 #shiftReportsScreen #srHistory table[data-mobile-cards] td,#backupInboxSection table[data-mobile-cards] td{height:auto!important;min-height:44px;overflow:visible;text-overflow:clip}
 #shiftReportsScreen #srHistory table[data-mobile-cards] tr,#backupInboxSection table[data-mobile-cards] tr{height:auto!important}
 #backupInboxSection .backup-table:has(table[data-mobile-cards]){flex:0 0 auto}
}
/* Inventario movil: tabla completa, bordes continuos y mas espacio de lectura. */
@media(max-width:900px){
 #catalogSection .table-wrap,#workerScreen .worker-table-wrap{border:1px solid #d5dfe8;touch-action:pan-x pan-y;scrollbar-width:auto}
 #catalogSection #table th,#catalogSection #table td,#workerTable th,#workerTable tr.worker-data-row td{border-right:1px solid #dce4ec;border-bottom:1px solid #dce4ec}
 #catalogSection #table th,#workerTable th{background:#edf2f7;color:#43576b}
 #workerTable td.worker-code,#workerTable th:first-child{position:sticky!important;left:0;width:108px!important;min-width:108px!important;max-width:108px!important;background:#fff;z-index:3;box-shadow:1px 0 #c8d4df}
 #workerTable th:first-child{background:#edf2f7;z-index:5}
 .worker-header{padding:8px 10px;gap:6px;align-items:center}.worker-header .brand{flex:1 1 170px}.worker-header .brand .logo,.worker-header .brand small{display:none}.worker-header h1{font-size:14px;line-height:1.4}.worker-header .worker-sync{width:auto;display:contents}.worker-header .worker-sync>span{display:none}.worker-header #workerLogout{font-size:12px;padding:8px;min-height:40px}
 .worker-toolbar{gap:6px;padding:8px}.worker-toolbar input,.worker-toolbar select{min-height:42px}.worker-toolbar #workerCount{font-size:11px;text-align:right}.worker-toolbar #workerNewRequest{grid-column:auto;min-height:42px;font-size:12px}.worker-toolbar button{min-height:42px;font-size:12px}.worker-footer{padding:6px 10px;font-size:11px}
 #mobileWorkerExpand{display:block}
 body.mobile-worker-expanded .worker-header,body.mobile-worker-expanded .worker-footer,body.mobile-worker-expanded .worker-toolbar>:not(#workerSearch):not(#mobileWorkerExpand){display:none!important}
 body.mobile-worker-expanded .worker-toolbar{grid-template-columns:minmax(0,1fr) auto}body.mobile-worker-expanded .worker-toolbar #workerSearch{grid-column:auto}
 body.table-focus .panel{inset:0!important;height:100dvh!important;border-radius:0}
}
#mobileWorkerExpand{display:none}
@media(max-width:900px){#mobileWorkerExpand{display:block}}

@media(max-width:900px){
 #shiftReportsScreen #srHistory table[data-mobile-cards] td:nth-child(2),#shiftReportsScreen #srHistory table[data-mobile-cards] td:nth-child(3),#backupInboxSection table[data-mobile-cards] td:nth-child(2),#backupInboxSection table[data-mobile-cards] td:nth-child(3){display:grid;grid-template-columns:90px minmax(0,1fr);gap:10px}
 table[data-mobile-cards] .mobile-turns{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;min-width:0;max-width:100%;white-space:normal}
 table[data-mobile-cards] .mobile-turns>div{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px;min-width:0;max-width:100%}
 table[data-mobile-cards] .mobile-turns .sr-turn-pill{margin:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;line-height:1.6}
}
