/* Shared APK and touch-device layout. Desktop remains outside sprev-native. */
html:not(.sprev-native) #sprev-native-controls{display:none!important}
html.sprev-native{--sprev-work-zoom:1;--sprev-bar-height:44px}
html.sprev-native body:not(.sprev-login-visible){margin:0!important;padding:0!important}
html.sprev-native #sprev-native-controls{position:fixed;inset:auto 0 0;min-height:44px;display:flex;align-items:center;justify-content:center;gap:4px;padding:2px 4px calc(2px + env(safe-area-inset-bottom,0px));background:#fff;color:#17253a;border-top:1px solid #cbd5e1;z-index:2147483000;box-sizing:border-box;font-size:12px}
html.sprev-native #sprev-native-controls button{min-height:38px;padding:4px 8px;min-width:36px;border:1px solid #cbd5e1;border-radius:6px;background:#f4f7fb;color:#17253a;font-size:12px;white-space:nowrap}
html.sprev-native .sprev-login-visible #sprev-native-controls{display:none}
html.sprev-native #siovPersistentSidebar,html.sprev-native #menuScreen>.siov-sidebar{display:none!important}
/* Preserve the existing APK drawer width (250px), independent of work zoom. */
html.sprev-native.sprev-native-menu body #siovPersistentSidebar.siov-sidebar,
html.sprev-native.sprev-native-menu body #menuScreen>.siov-sidebar{display:flex!important;position:fixed!important;left:0!important;top:0!important;bottom:var(--sprev-bar-height)!important;width:250px!important;min-width:250px!important;max-width:250px!important;height:auto!important;z-index:2147482000;overflow:auto;box-sizing:border-box}
html.sprev-native.sprev-native-menu body :is(#siovPersistentSidebar,#menuScreen>.siov-sidebar) .siov-nav-item{grid-template-columns:25px minmax(0,1fr) 12px!important;text-align:left!important;font-size:13px!important;gap:6px}
html.sprev-native.sprev-native-menu body :is(#siovPersistentSidebar,#menuScreen>.siov-sidebar) :is(.siov-nav-label,.siov-nav-icon,.siov-sidebar-label){display:block!important;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;word-break:normal;overflow-wrap:break-word;min-width:0}
/* Do not override display on menu buttons: inline permissions remain authoritative. */
html.sprev-native body #menuScreen.siov-main-shell{width:100%!important;max-width:100%!important;min-width:0!important;height:calc(100dvh - var(--sprev-bar-height))!important;margin:0!important;padding:0!important;overflow:auto!important;box-sizing:border-box}
html.sprev-native body #siovWorkspace{left:0!important;right:0!important;top:0!important;bottom:var(--sprev-bar-height)!important;padding:0!important;overflow:auto!important;scrollbar-gutter:auto!important}
/* One zoom boundary per work surface; let CSS zoom resolve its logical width, never clip it. */
html.sprev-native body #menuScreen>.siov-workspace,
html.sprev-native body.siov-persistent-mode #siovWorkspace>[id$="Screen"]{zoom:var(--sprev-work-zoom);width:100%!important;max-width:none!important;min-width:0!important;flex:none!important;height:auto!important;margin:0!important;box-sizing:border-box;overflow:visible!important}
html.sprev-native body #menuScreen>.siov-workspace{scrollbar-gutter:auto!important}
html.sprev-native body #menuScreen>.siov-workspace>:is(.siov-content-area,.siov-topbar){width:100%!important;max-width:100%!important;min-width:0!important;box-sizing:border-box;overflow:visible!important;zoom:1}
html.sprev-native body .siov-content-area{padding:10px!important;flex:none!important}
html.sprev-native body .siov-topbar{height:auto!important;min-height:58px;padding:8px!important;flex-wrap:wrap;gap:8px}
html.sprev-native body .siov-topbar>div{min-width:0;max-width:100%;flex-wrap:wrap;overflow-wrap:anywhere}
html.sprev-native body :is(.siov-submodule-panel,.incidence-section){padding:10px!important;min-width:0!important;max-width:100%;box-sizing:border-box;margin-left:0!important;margin-right:0!important}
html.sprev-native body :is(.siov-submodule-grid,.siov-maintenance-compact-grid,.siov-maintenance-kpi-grid,.incidence-grid,.sprev-native-adaptive-grid){grid-template-columns:repeat(auto-fit,minmax(min(100%,240px),1fr))!important}
html.sprev-native body .sprev-native-adaptive-grid>*{min-width:0!important;max-width:100%!important;grid-column:auto!important;box-sizing:border-box}
html.sprev-native body :is(input,select,textarea){max-width:100%;min-width:0;box-sizing:border-box}
html.sprev-native body :is(.incidence-actions,.siov-global-collapse-toolbar){display:flex;flex-wrap:wrap;gap:8px}
html.sprev-native body .siov-global-collapse-title,html.sprev-native body .incidence-section h3{flex:1 1 180px;white-space:normal!important;overflow:visible!important;text-overflow:clip!important;word-break:normal;overflow-wrap:normal;line-height:1.4}
html.sprev-native body .sprev-native-table-scroll{width:100%!important;min-width:0!important;max-width:100%!important;box-sizing:border-box!important;overflow-x:auto!important;overscroll-behavior-x:contain;touch-action:pan-x pan-y;scrollbar-gutter:auto!important}
html.sprev-native body .sprev-native-table-scroll>table{max-width:none!important}
html.sprev-native body .siov-top-hscroll{display:none!important}
html.sprev-native body .sprev-native-chart{max-width:100%!important;min-width:0!important;box-sizing:border-box}
html.sprev-native body .sprev-native-chart :is(svg,canvas){max-width:100%!important}
html.sprev-native body .sprev-native-chart svg[viewBox]{width:100%!important;height:auto!important}

/* Session visibility wins over the open-drawer rules, including async logout. */
html.sprev-native.sprev-native-menu body.sprev-login-visible #siovPersistentSidebar.siov-sidebar,
html.sprev-native.sprev-native-menu body.sprev-login-visible #menuScreen>.siov-sidebar,
html.sprev-native body.sprev-login-visible :is(#siovWorkspace,#menuScreen,#sprev-native-controls){display:none!important}
html.sprev-native body :is(#siovPersistentSidebar.siov-sidebar,#menuScreen>.siov-sidebar)>.siov-logout{font-size:13px!important;line-height:1.4!important;text-align:left!important;white-space:normal!important}
html.sprev-native body :is(#siovPersistentSidebar.siov-sidebar,#menuScreen>.siov-sidebar)>.siov-logout::before{content:none!important;display:none!important}
body #loginForm>.siov-login-access-header{display:none!important;margin:0!important;padding:0!important;border:0!important}
html.sprev-native #sprev-native-controls{flex-direction:column;gap:0}
html.sprev-native .sprev-native-control-row{display:flex;align-items:center;justify-content:center;gap:4px;width:100%}
html.sprev-native .sprev-native-scroll-row{display:flex;align-items:center;gap:8px;width:100%;height:26px;padding:0 6px;box-sizing:border-box}
html.sprev-native #sprev-native-horizontal{display:block;width:100%;min-width:0;flex:1;margin:0;height:24px;padding:0;accent-color:#347f25;touch-action:pan-y}
html.sprev-native .sprev-native-scroll-row:has(input:disabled){opacity:.4}
/* Android dialogs live in the top layer: their scroll controls must live there too. */
html.sprev-native body dialog[open]{max-height:calc(100dvh - var(--sprev-bar-height) - 24px)!important;margin-top:8px!important;margin-bottom:calc(var(--sprev-bar-height) + 8px)!important;box-sizing:border-box}
html.sprev-native body dialog[open] .attendance-scroll{min-width:0!important;max-width:100%!important;overflow-x:auto!important;touch-action:pan-x pan-y}
html.sprev-native body dialog .attendance-month th:first-child{position:static!important;min-width:130px!important;width:160px!important;max-width:160px!important;white-space:normal!important;overflow-wrap:anywhere}
html.sprev-native body dialog .sprev-native-wide-sticky{position:static!important}
/* Reserve the measured toolbar and visible viewport, including the keyboard. */
html.sprev-native body dialog[open]{max-height:calc(var(--sprev-visible-height,100dvh) - var(--sprev-bar-height) - 24px)!important;overflow-y:auto!important;overscroll-behavior-y:contain;scroll-padding-block:16px;top:var(--sprev-visible-top,0px)!important}
html.sprev-native body :is(.otm-modal-bg,.ms322-adjust-modal,.gdx-modal-bg){top:var(--sprev-visible-top,0px)!important;bottom:auto!important;height:calc(var(--sprev-visible-height,100dvh) - var(--sprev-bar-height))!important;box-sizing:border-box;overflow:hidden;padding:8px!important}
html.sprev-native body :is(.otm-modal,.ms322-adjust-dialog,.gdx-modal){max-height:100%!important;min-height:0!important;overflow-y:auto!important;overscroll-behavior:contain;scroll-padding-block:16px;box-sizing:border-box}
html.sprev-native body .otm-form-actions{flex-wrap:wrap}
html.sprev-native body .sst-plan .sst-scroll{max-width:100%;min-width:0;overflow-x:auto!important;overscroll-behavior-x:contain;touch-action:pan-x pan-y}
html.sprev-native body .sst-plan[data-plan-view="annual"] .sst-scroll :is(thead th:first-child,tbody th){position:static!important;min-width:150px!important;width:170px!important;max-width:170px!important;white-space:normal!important;overflow-wrap:anywhere}
