/* Installed-app enhancements only. No DOM remount, device sniffing, forced fullscreen,
   touch suppression, or fixed orientation when a Fold changes its viewport. */
@media screen {
  .pwa-install-banner{margin:16px 0;padding:14px 16px;border:1px solid var(--line,#dcdcd6);border-radius:12px;background:#eeeee7;color:var(--ink,#141b1d)}
  .pwa-install-banner[hidden],[data-pwa-install-entry][hidden]{display:none!important}
  .pwa-install-banner strong{display:block;font-size:13px;line-height:1.5}
  .pwa-install-banner p{font-size:12px;line-height:1.65;margin:5px 0 10px;color:var(--muted,#5a6366)}
  .pwa-install-actions{display:flex;gap:8px;flex-wrap:wrap}
  .pwa-install-actions button{min-height:44px;padding:9px 14px;font-size:13px}
  #pwa-install-message{font-size:12px;line-height:1.65;margin-top:10px;overflow-wrap:anywhere}
}
@media screen and (display-mode: standalone) {
  :root{
    --pwa-safe-top:env(safe-area-inset-top,0px);
    --pwa-safe-right:env(safe-area-inset-right,0px);
    --pwa-safe-bottom:env(safe-area-inset-bottom,0px);
    --pwa-safe-left:env(safe-area-inset-left,0px);
  }
  body,.app-shell,.welcome{min-height:100vh;min-height:100dvh}
  #app-shell.inspection-mode{height:100vh;height:100dvh;min-height:0}
  .inspection-mode .main,.inspection-mode .sidebar{height:100vh;height:100dvh;min-height:0}
  .sidebar{padding-top:calc(30px + var(--pwa-safe-top));padding-bottom:calc(20px + var(--pwa-safe-bottom));padding-left:calc(20px + var(--pwa-safe-left))}
  .topbar{height:auto;min-height:calc(62px + var(--pwa-safe-top));padding-top:var(--pwa-safe-top);padding-left:max(24px,var(--pwa-safe-left));padding-right:max(24px,var(--pwa-safe-right))}
  .inspection-mode .topbar{min-height:54px;padding-top:calc(9px + var(--pwa-safe-top));padding-right:max(20px,var(--pwa-safe-right));padding-left:max(20px,var(--pwa-safe-left))}
  .inspection-mode .content-wrap{max-width:1200px;padding-inline:max(22px,var(--pwa-safe-left)) max(22px,var(--pwa-safe-right))}
  .inspection-entry .content-wrap{max-width:820px;padding-inline:max(18px,var(--pwa-safe-left)) max(18px,var(--pwa-safe-right))}
  .inspection-entry .inspection-layout{max-width:none}
  /* These existing actions already include safe-area-inset-bottom exactly once. */
  .inspection-mode #quick-form .quick-fields,.inspection-mode .feed-scroll{scroll-padding-block:16px;min-height:0}
  .outbox-banner{padding-left:max(24px,var(--pwa-safe-left));padding-right:max(24px,var(--pwa-safe-right));min-width:0;flex-wrap:wrap}
  .outbox-banner>span{min-width:0;overflow-wrap:anywhere}
  .welcome{padding-top:max(24px,var(--pwa-safe-top));padding-right:max(20px,var(--pwa-safe-right));padding-bottom:max(24px,var(--pwa-safe-bottom));padding-left:max(20px,var(--pwa-safe-left))}
  .modal,.guide-modal,.exit-warning{max-width:calc(100vw - 24px - var(--pwa-safe-left) - var(--pwa-safe-right));max-height:calc(100dvh - 24px - var(--pwa-safe-top) - var(--pwa-safe-bottom));inset:var(--pwa-safe-top) var(--pwa-safe-right) var(--pwa-safe-bottom) var(--pwa-safe-left);margin:auto}
  .exit-warning{overflow-y:auto}
  .modal.checklist-modal{max-width:calc(100vw - 24px - var(--pwa-safe-left) - var(--pwa-safe-right));max-height:calc(100dvh - 24px - var(--pwa-safe-top) - var(--pwa-safe-bottom))}
  .toolbar-menu-panel{max-height:calc(100dvh - 80px - var(--pwa-safe-top) - var(--pwa-safe-bottom));overflow:auto}
  .toasts{bottom:calc(18px + var(--pwa-safe-bottom));right:max(18px,var(--pwa-safe-right));max-width:calc(100vw - 36px - var(--pwa-safe-left) - var(--pwa-safe-right))}
  .workspace-footer{padding-bottom:var(--pwa-safe-bottom)}
}
/* viewport-fit=cover also applies to ordinary tabs. With zero insets these
   rules are a no-op; a landscape cutout must not cover the existing web UI. */
@media screen and (display-mode: browser) {
  .app-shell{padding-inline:env(safe-area-inset-left,0px) env(safe-area-inset-right,0px)}
  .sidebar{left:env(safe-area-inset-left,0px)}
  .welcome{border:solid transparent;border-width:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) env(safe-area-inset-bottom,0px) env(safe-area-inset-left,0px)}
}
/* Fold inner displays can exceed the desktop sidebar breakpoint. Keep the unit
   picker, not a fixed navigation column, on installed touch layouts up to 1200px. */
@media screen and (display-mode: standalone) and (pointer: coarse) and (max-width:1200px) {
  .inspection-mode .sidebar{display:none}
  .inspection-mode .main{margin-left:0}
  .inspection-mode .mobile-units-button{display:inline-flex;align-items:center;justify-content:center}
}
@media screen and (display-mode: standalone) and (max-width:600px) {
  .inspection-mode .topbar{padding-top:calc(6px + var(--pwa-safe-top));padding-inline:max(12px,var(--pwa-safe-left)) max(12px,var(--pwa-safe-right))}
  .inspection-mode .content-wrap{padding-inline:max(16px,var(--pwa-safe-left)) max(16px,var(--pwa-safe-right))}
  .inspection-entry .content-wrap{padding-inline:max(10px,var(--pwa-safe-left)) max(10px,var(--pwa-safe-right))}
  .outbox-banner{padding-inline:max(12px,var(--pwa-safe-left)) max(12px,var(--pwa-safe-right))}
  .welcome{padding: max(12px,var(--pwa-safe-top)) max(10px,var(--pwa-safe-right)) max(12px,var(--pwa-safe-bottom)) max(10px,var(--pwa-safe-left))}
  .modal.checklist-modal{inset:auto var(--pwa-safe-right) 0 var(--pwa-safe-left);margin:0;width:auto;max-width:none;max-height:calc(100dvh - 24px - var(--pwa-safe-top))}
}
/* resizes-content lets Android Chrome shrink the layout viewport for the IME.
   Compact decoration in a short viewport while retaining fields and actions. */
@media screen and (display-mode: standalone) and (max-height:480px) {
  .inspection-mode .content-wrap{padding-top:6px}
  .inspection-mode .page-heading{margin-bottom:4px}
  .inspection-mode .page-heading h1{font-size:22px}
  .inspection-mode .page-heading p{display:none}
  .inspection-mode #stats{margin-bottom:5px}
  .inspection-mode .compact-stats>.compact-stat{min-height:44px;flex-direction:row;align-items:center;justify-content:flex-start;gap:7px;padding:7px 10px}
  .inspection-mode .compact-stat strong{font-size:20px}
  .inspection-mode .tabs-row{margin-bottom:4px}
  .inspection-mode .quick-head{padding-block:2px}
  .inspection-mode #quick-form .quick-save{padding-top:6px;padding-bottom:calc(6px + env(safe-area-inset-bottom,0px))}
  .inspection-mode #quick-form .quick-save>button,.inspection-mode .inspection-add>button{min-height:44px}
}
@media print{.pwa-install-banner,[data-pwa-install-entry],#pwa-install-message{display:none!important}}
