/* Patrol Scans V14 mobile stability — visual/layout only.
   Keep all timer, logging, warning, and stopwatch JavaScript untouched. */

/* The older Web R2.3 navigation explicitly hid the flashlight handle whenever
   mode-warning was active. Warning decorations must NOT remove navigation. */
html.rcm-web-fusion body.mode-warning #rcmWebNavToggle,
html.rcm-web-fusion body.mode-warning .rcm-web-nav-handle {
  visibility:visible!important;
  opacity:1!important;
  pointer-events:auto!important;
}
html.rcm-web-fusion body.mode-warning .rcm-web-nav-handle .ps-nav-flashlight {
  visibility:visible!important;
}

/* Settings and History are full sections, not small drawers, when opened from
   the main nav. Position them by viewport edges, not the 100dvh chain of old
   flex/drawer rules; this avoids stale browser height after phone rotation. */
html.rcm-web-fusion body:is(.v065-settings-page,.log-page-mode) main.app {
  position:fixed!important;
  top:var(--rcm-web-top)!important;
  bottom:var(--rcm-web-bottom)!important;
  left:0!important;right:0!important;
  width:100%!important;max-width:none!important;
  height:auto!important;min-height:0!important;
  margin:0!important;
  box-sizing:border-box!important;
  display:flex!important;flex-direction:column!important;
  padding:clamp(5px,1vw,10px)!important;
  overflow:hidden!important;
}
html.rcm-web-fusion body.v065-settings-page #settings,
html.rcm-web-fusion body.log-page-mode #history {
  position:relative!important;
  display:flex!important;flex-direction:column!important;
  flex:1 1 0px!important;
  width:100%!important;height:auto!important;
  min-height:0!important;max-height:none!important;
  margin:0!important;overflow:hidden!important;
  box-sizing:border-box!important;
}
html.rcm-web-fusion body.v065-settings-page #settings>.panel-inner {
  position:absolute!important;
  top:var(--drawer-header-height,47px)!important;bottom:0!important;
  left:0!important;right:0!important;
  overflow-y:auto!important;overflow-x:hidden!important;
  overscroll-behavior-y:contain;
  min-height:0!important;
}
html.rcm-web-fusion body.log-page-mode #history>.panel-inner {
  position:absolute!important;
  top:var(--log-header-height,64px)!important;bottom:0!important;
  left:0!important;right:0!important;
  display:flex!important;flex-direction:column!important;
  min-height:0!important;
  overflow:hidden!important;
}
html.rcm-web-fusion body.log-page-mode #logView:not([hidden]) {
  display:flex!important;flex-direction:column!important;
  flex:1 1 auto!important;min-height:0!important;
}
html.rcm-web-fusion body.log-page-mode #history .table-wrap {
  flex:1 1 auto!important;
  min-height:90px!important;height:auto!important;max-height:none!important;
  overflow-y:auto!important;overflow-x:auto!important;
  overscroll-behavior:contain;
}

/* When the user rotates, keep the nav handle docked to a stable edge even if
   the browser briefly reports a transitional viewport height. */
html.rcm-web-fusion #rcmWebNavToggle{
  max-width:calc(100vw - 24px);
  backface-visibility:hidden;
  -webkit-backface-visibility:hidden;
}
@media (orientation:landscape) and (max-height:520px) {
  html.rcm-web-fusion body:is(.v065-settings-page,.log-page-mode) main.app {
    padding:4px 6px!important;
  }
  html.rcm-web-fusion body.v065-settings-page #settings>.panel-inner,
  html.rcm-web-fusion body.log-page-mode #history>.panel-inner {
    overscroll-behavior:contain;
  }
}


/* One flashlight in the physical CENTER of the lower utility toolbar
   that the top-left wrench reveals. It keeps the original nav toggle handler
   and respects the user's prior nav-hidden preference. */
html.rcm-web-fusion .unified-status-row{
  position:relative!important;
}
html.rcm-web-fusion body .unified-status-row #rcmWebNavToggle.ps-flashlight-in-toolbar,
html.rcm-web-fusion.ps-theme.ps-tactical body.rcm-web-nav-hidden .unified-status-row #rcmWebNavToggle.ps-flashlight-in-toolbar{
  position:absolute!important;
  left:50%!important;top:50%!important;
  right:auto!important;bottom:auto!important;
  inset-inline-start:50%!important;inset-inline-end:auto!important;
  transform:translate(-50%,-50%)!important;
  margin:0!important;padding:4px 8px!important;
  display:flex!important;align-items:center!important;justify-content:center!important;
  width:58px!important;min-width:48px!important;
  height:38px!important;min-height:36px!important;
  border-radius:11px!important;
  z-index:9!important;
  visibility:visible!important;opacity:1!important;pointer-events:auto!important;
}
html.rcm-web-fusion body .unified-status-row #rcmWebNavToggle.ps-flashlight-in-toolbar .ps-nav-flashlight{
  font-size:23px!important;line-height:1!important;
}
html.rcm-web-fusion body.rcm-web-nav-hidden:has(#rcmWebNavToggle.ps-flashlight-in-toolbar) {
  /* When collapsed there is no floating flashlight to reserve space for. */
  --rcm-web-bottom:0px;
}
html.rcm-web-fusion body:has(#rcmWebNavToggle.ps-flashlight-in-toolbar) main.app{
  min-height:0!important;
}
/* A real rotation can stall mobile compositing on content:// Android HTML.
   Suspend only optional warning decorations during the short reflow, never
   hide the clock, black theme, buttons, or the timer itself. */
body.ps-v14-layout-rotating .ps-v14-perimeter,
body.ps-v14-layout-rotating .ps-v14-dim,
body.ps-v14-layout-rotating .ps-v14-clock-flares,
body.ps-v14-layout-rotating .ps-v14-sheen,
body.ps-v14-layout-rotating .ps-v14-glint{
  display:none!important;
}


/* Warning-mode landscape top-row compression (2026-11-04).
   The 2-minute banner consumes vertical space: reclaim it from the three
   small top tiles rather than shrinking the large CURRENT TIME display.
   Scoped ONLY to warning states in landscape. No clock or timer overrides. */
@media (orientation:landscape) and (max-height:740px){
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top{
    height:clamp(76px,15dvh,106px)!important;
    min-height:0!important;
    max-height:clamp(76px,15dvh,106px)!important;
    flex:0 0 clamp(76px,15dvh,106px)!important;
    align-items:stretch!important;
  }
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top > .mini{
    box-sizing:border-box!important;
    height:100%!important;
    min-height:0!important;
    max-height:100%!important;
    padding:2px 6px!important;
    margin:0!important;
    gap:1px!important;
    justify-content:center!important;
    overflow:hidden!important;
  }
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top > .mini > .display-unit{
    width:100%!important;
    min-height:0!important;
    max-height:100%!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    gap:1px!important;
    overflow:hidden!important;
  }
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top > .mini:not(.user-mini) .label{
    font-size:clamp(10px,2.3dvh,15px)!important;
    line-height:1.08!important;
    margin:0!important;
    padding-bottom:1px!important;
  }
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top > .mini:not(.user-mini) .value{
    font-size:clamp(24px,6.8dvh,48px)!important;
    line-height:1.05!important;
    margin:2px 0 0!important;
    min-height:0!important;
  }
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top > .user-mini .label{
    font-size:clamp(10px,2.2dvh,14px)!important;
    line-height:1.08!important;
    margin:0!important;
  }
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top > .user-mini #quickUser{
    height:clamp(23px,4.9dvh,34px)!important;
    min-height:0!important;
    max-height:34px!important;
    padding:1px 17px 1px 5px!important;
    font-size:clamp(19px,4.4dvh,29px)!important;
    line-height:1.04!important;
    margin:0!important;
  }
  html.rcm-web-fusion body:is(.mode-warning,.ps-v14-warning) #alarmClockFrame > .top > .user-mini .user-date{
    font-size:clamp(10px,1.8dvh,12px)!important;
    line-height:1.12!important;
    margin:0!important;
    max-height:2.3em!important;
    overflow:hidden!important;
  }
}
