/* KZPOS INPUT/KEYBOARD FINAL — global mobile viewport stabilizer */
:root{
  --kz-visible-h:100dvh;
  --kz-visible-w:100vw;
  --kz-visible-top:0px;
  --kz-visible-left:0px;
}

/* iOS Safari zooms focused controls smaller than 16px. Keep text entry stable. */
body.phone input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="button"]):not([type="submit"]),
body.phone textarea,
body.phone select,
body.phone #login input{
  font-size:16px !important;
}

html.phone.kz-keyboard-open,
body.phone.kz-keyboard-open{
  overflow:hidden !important;
  overscroll-behavior:none !important;
}

/* Keyboard replaces the bottom navigation while typing. */
body.phone.kz-keyboard-open .tabbar,
body.phone.kz-keyboard-open #saveSale.sale-save{
  opacity:0 !important;
  visibility:hidden !important;
  pointer-events:none !important;
}

/* Lock the application to the actual visible viewport, not the full layout viewport. */
body.phone.kz-keyboard-open #app{
  position:fixed !important;
  left:var(--kz-visible-left) !important;
  top:var(--kz-visible-top) !important;
  right:auto !important;
  bottom:auto !important;
  width:var(--kz-visible-w) !important;
  max-width:var(--kz-visible-w) !important;
  height:var(--kz-visible-h) !important;
  min-height:0 !important;
  max-height:var(--kz-visible-h) !important;
  overflow:hidden !important;
}

body.phone.kz-keyboard-open #app > .page:not(.hidden){
  position:absolute !important;
  inset:0 !important;
  width:100% !important;
  height:100% !important;
  min-height:0 !important;
  max-height:100% !important;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  overscroll-behavior:contain !important;
  -webkit-overflow-scrolling:touch;
  padding-bottom:18px !important;
}

/* Modal/sheet must live wholly above the native keyboard. */
body.phone.kz-keyboard-open .sheet,
body.phone.kz-keyboard-open .keypad{
  position:fixed !important;
  left:var(--kz-visible-left) !important;
  top:var(--kz-visible-top) !important;
  right:auto !important;
  bottom:auto !important;
  width:var(--kz-visible-w) !important;
  height:var(--kz-visible-h) !important;
  max-height:var(--kz-visible-h) !important;
  overflow:hidden !important;
  align-items:flex-end !important;
}

body.phone.kz-keyboard-open .sheet .box,
body.phone.kz-keyboard-open .keypad .box{
  width:100% !important;
  max-width:100% !important;
  max-height:calc(var(--kz-visible-h) - 6px) !important;
  overflow-x:hidden !important;
  overflow-y:auto !important;
  overscroll-behavior:contain !important;
  -webkit-overflow-scrolling:touch;
  scroll-padding-top:14px;
  scroll-padding-bottom:82px;
}

body.phone.kz-keyboard-open .form-actions{
  position:sticky !important;
  bottom:0 !important;
  z-index:8 !important;
}

/* Login is fixed separately from #app content in some render paths. */
body.phone.kz-keyboard-open #login.kz-auth{
  left:var(--kz-visible-left) !important;
  top:var(--kz-visible-top) !important;
  right:auto !important;
  bottom:auto !important;
  width:var(--kz-visible-w) !important;
  height:var(--kz-visible-h) !important;
  min-height:0 !important;
  max-height:var(--kz-visible-h) !important;
  overflow-y:auto !important;
}
