/* Midway mobile forms: visible-viewport sizing, single modal scroll region.
   Activated only while a form/dialog is being edited on a touch/narrow screen.
   No changes to desktop layout or Deacon meeting editor's dedicated behavior. */
@media (max-width:900px), (max-width:1366px) and (hover:none) and (pointer:coarse) {
  /* Prevent Safari's automatic field-focus zoom, which causes sideways jumps. */
  input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  select,textarea { font-size:max(16px,1em); }
  .midway-mobile-keyboard-overlay {
    position:fixed!important;
    inset:auto 0 auto 0!important;
    top:var(--midway-visual-top,0px)!important;
    height:var(--midway-visual-height,100dvh)!important;
    max-height:var(--midway-visual-height,100dvh)!important;
    display:flex!important;
    flex-direction:column!important;
    align-items:center!important;
    justify-content:center!important;
    overflow:hidden!important;
    box-sizing:border-box!important;
    padding:10px 12px max(10px,env(safe-area-inset-bottom,0px))!important;
  }
  .midway-mobile-keyboard-overlay.hidden,
  .midway-mobile-keyboard-overlay[hidden] { display:none!important; }
  .midway-mobile-keyboard-overlay > .midway-mobile-keyboard-panel,
  .midway-mobile-keyboard-overlay .midway-mobile-keyboard-panel {
    box-sizing:border-box!important;
    min-width:0!important;
    min-height:0!important;
    max-height:100%!important;
    overflow-y:auto!important;
    overflow-x:hidden;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
    flex-shrink:1!important;
  }
  .midway-mobile-keyboard-panel .modal-actions,
  .midway-mobile-keyboard-panel .dialog-actions,
  .midway-mobile-keyboard-panel .dialogactions {
    position:sticky;
    bottom:0;
    z-index:5;
    background:var(--card,var(--desk-surface,#fff));
    padding:12px 0 max(12px,env(safe-area-inset-bottom,0px));
  }
  .midway-mobile-keyboard-panel.quick-entry-dialog .quick-save-actions {
    position:sticky;
    bottom:0;
    z-index:5;
    background:var(--card,#fff);
    padding:10px 0 max(10px,env(safe-area-inset-bottom,0px));
  }
  dialog.midway-mobile-keyboard-native {
    box-sizing:border-box!important;
    position:fixed!important;
    top:calc(var(--midway-visual-top,0px) + 8px)!important;
    max-height:calc(var(--midway-visual-height,100dvh) - 16px)!important;
    overflow-y:auto!important;
    overscroll-behavior:contain;
    -webkit-overflow-scrolling:touch;
  }
  [role="dialog"].midway-mobile-keyboard-custom {
    box-sizing:border-box!important;
    max-height:calc(var(--midway-visual-height,100dvh) - 16px)!important;
    overflow-y:auto!important;
    -webkit-overflow-scrolling:touch;
  }
}
