/* mobile-ui-fix.css - phone UI audit fixes (1 Dec 2026, update 20261201t).
   Loaded by the main app and by every stand-alone screen. Only active on screens up to 820px wide (touch phones / small tablets).
   Adds only: nothing existing is removed. Desktop is not touched. */
@media (max-width:820px){
  html{-webkit-text-size-adjust:100%;text-size-adjust:100%;-webkit-tap-highlight-color:rgba(18,41,59,.12)}
  body{max-width:100%;overflow-x:hidden}
  img,video,canvas,svg{max-width:100%}
  img,video{height:auto}
  pre,code,kbd{max-width:100%;overflow-x:auto;white-space:pre-wrap;word-break:break-word}
  a,li,p,h1,h2,h3,h4,label{overflow-wrap:anywhere}
  td,th{overflow-wrap:break-word}

  /* 1. Typing boxes: 16px stops iPhone from zooming the page when a box is tapped */
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]),
  select,textarea{font-size:16px!important;max-width:100%;box-sizing:border-box}
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not([type=hidden]),select{min-height:40px}
  textarea{min-height:64px}

  /* 2. Tap size: buttons and links used as buttons are at least 40px high (34px inside tables) */
  button,.btn,[role=button],input[type=button],input[type=submit],summary{min-height:40px;touch-action:manipulation}
  td button,th button,td .btn,th .btn,td [role=button]{min-height:34px}
  input[type=checkbox],input[type=radio]{width:20px;height:20px;min-width:20px;flex:none}

  /* 3. Wide tables scroll sideways inside themselves (mobile-ui-fix.js marks them), the page itself never scrolls sideways */
  table.mfx-ts{display:block;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;overscroll-behavior-x:contain}

  /* 4. Pop-ups / dialogs: never taller than the visible screen (address bar and keyboard safe), body of the box scrolls */
  [style*="position: fixed"][style*="inset: 0"]{padding-top:max(10px,env(safe-area-inset-top))!important;padding-bottom:max(10px,env(safe-area-inset-bottom))!important;-webkit-overflow-scrolling:touch}
  [style*="position: fixed"][style*="inset: 0"]>div{max-width:100%!important;max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overflow-y:auto;box-sizing:border-box}
  [role=dialog],.modal,.dlg,.popup{max-width:calc(100vw - 16px);max-height:calc(100vh - 24px);max-height:calc(100dvh - 24px);overflow-y:auto}

  /* 5. Messages ("Saved" toast) stay above the bottom bar and the phone's home line */
  [style*="position: fixed"][style*="translateX(-50%)"][style*="bottom"]{bottom:calc(72px + env(safe-area-inset-bottom,0px))!important;max-width:calc(100vw - 24px);text-align:center}

  /* 6. Sticky top bars respect the notch */
  .bar,.topbar,header.sticky{padding-top:max(7px,env(safe-area-inset-top))}
  body{padding-bottom:env(safe-area-inset-bottom,0px)}

  /* 7. Tab strips and button rows that are too long scroll sideways instead of squeezing */
  .tabs,.tabrow,.tab-row,.pills{overflow-x:auto;flex-wrap:nowrap;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  .tabs::-webkit-scrollbar,.tabrow::-webkit-scrollbar,.tab-row::-webkit-scrollbar,.pills::-webkit-scrollbar{display:none}
  .tabs>*,.tabrow>*,.tab-row>*,.pills>*{flex:0 0 auto;white-space:nowrap}

  /* 9. Calendar Studio: the New / Open / Save group wraps on a phone instead of pushing the page 120px sideways */
  #fbar5{flex:1 1 100%!important;flex-wrap:wrap;max-width:100%;min-width:0}
  #fbar5 button{flex:1 1 auto}

  /* 8. Date / time pickers fit their column */
  input[type=date],input[type=time],input[type=datetime-local],input[type=month]{min-width:0;width:100%}
}
@media (max-width:480px){
  /* very narrow phones: two-column forms become one column */
  .grid2,.two-col,.cols-2,.row2,.fgrid,.form-grid{grid-template-columns:1fr!important}
  h1{font-size:1.35rem}
}
@media (hover:none) and (pointer:coarse){
  a:not(.btn):not([role=button]){text-underline-offset:2px}
}

/* ---- Round 2 (20261201u): phone address bar - 100vh is taller than the visible screen, so the bottom of a page was cut off.
   dvh = the really visible height. Only where the browser supports it; older phones keep the old values. ---- */
@media (max-width:820px){
  @supports (height:100dvh){
    .auth-root,.auth-main{min-height:100dvh}
    .app-shell,.app-shell-mobile{min-height:100dvh!important}
    /* embedded screens (Salary, Meta Reports, Lead Access, Health Camps, Template Library, App Health ...) */
    iframe[style*="calc(100vh - 62px)"]{height:calc(100dvh - 62px)!important}
    iframe[style*="calc(100vh - 110px)"]{height:calc(100dvh - 110px)!important}
    iframe[style*="calc(100vh - 130px)"]{height:calc(100dvh - 130px)!important}
    iframe[style*="calc(100vh - 150px)"]{height:calc(100dvh - 150px)!important}
    iframe[style*="calc(100vh - 170px)"]{height:calc(100dvh - 170px)!important}
    /* lists / chat panes with a capped height */
    [style*="max-height: calc(100vh - 210px)"]{max-height:calc(100dvh - 210px)!important}
    [style*=" height: calc(100vh - 190px)"],[style^="height: calc(100vh - 190px)"]{height:calc(100dvh - 190px)!important}
    [style*=" height: calc(100vh - 120px)"],[style^="height: calc(100vh - 120px)"]{height:calc(100dvh - 120px)!important}
  }
  /* embedded iframes never wider than the phone */
  iframe{max-width:100%}
}
