/* PE-Class v1.21.26 — stable iPad PAPS core surface
 * The head-owned hardware class survives responsive marker churn. */

/* The existing mobile paint gate has a stronger body-state selector. Cover
 * both states explicitly so the core never flashes blank. */
@media (max-width: 768px) {
  html.pePapsIpadHardware12126[data-pe-tab="paps"] body:not(.mobilePapsView) #app,
  html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView #app {
    visibility: visible !important;
  }

  html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView
  #app:has(#papsTableBox) > .pe87PageHead {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView
  #app:has(#papsTableBox) > .papsUpload {
    display: block !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView
  #app:has(#papsTableBox) > .papsPanel {
    display: flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView
  #app:has(#papsTableBox) #papsTableBox {
    display: block !important;
    visibility: visible !important;
  }

  html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView
  #app:has(#papsTableBox) #papsTableBox table.pe87Paps {
    display: table !important;
    visibility: visible !important;
  }

  html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView
  #app:has(#papsTableBox) :is(
    #bulkMale,
    #bulkFemale,
    #exportPapsBtn,
    #deletePapsBtn,
    #savePapsBtn
  ) {
    display: inline-flex !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  html.pePapsIpadHardware12126.peRecordWorkspace[data-pe-tab="paps"] .pe87Main {
    display: flex !important;
    flex-direction: column !important;
    height: calc(100dvh - var(--pe-record-main-top, 88px)) !important;
    max-height: calc(100dvh - var(--pe-record-main-top, 88px)) !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html.pePapsIpadHardware12126.peRecordWorkspace[data-pe-tab="paps"] #app {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
  }

  html.pePapsIpadHardware12126.peRecordWorkspace[data-pe-tab="paps"]
  #app > .papsPanel.peRecordDataPanel {
    display: flex !important;
    flex: 1 1 0 !important;
    flex-direction: column !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  html.pePapsIpadHardware12126.peRecordWorkspace[data-pe-tab="paps"]
  #app > .papsPanel.peRecordDataPanel
  > [data-pe-record-scroll-owner="paps"].peRecordTableViewportPaps {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
}

html.pePapsIpadHardware12126[data-pe-tab="paps"] body:not(.mobilePapsView) #app,
html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView #app {
  visibility: visible !important;
}

/* iPad uses the original core table exclusively. These rules also neutralize
 * stale mobile body/host state without rebuilding or moving any core node. */
html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView #app,
html.pePapsIpadHardware12126[data-pe-tab="paps"] #app:has(#papsTableBox) {
  display: flex !important;
  flex-direction: column !important;
}

html.pePapsIpadHardware12126[data-pe-tab="paps"] body:not(.mobilePapsView) #mobilePapsHost,
html.pePapsIpadHardware12126[data-pe-tab="paps"] body.mobilePapsView #mobilePapsHost {
  display: none !important;
}

/* Safari may restore focus before application events run. Keep the existing
 * healthy control height while preventing native focus auto-zoom. */
html.pePapsIpadHardware12126[data-pe-tab="paps"] #papsTableBox input.papsInput {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 4px !important;
  font-size: 16px !important;
  line-height: 1.1 !important;
  box-sizing: border-box !important;
}
