/*
 * PE-Class v1.20.64 — PAPS original workbook action layout.
 * Existing production layouts remain the cascade owners; this file only adds
 * the new upload control and the compact upload/export choice dialog.
 */

/* PC · MacBook · iPad landscape: upload and export are adjacent equal peers. */
@media (min-width: 1000px) and (orientation: landscape) {
  html[data-pe-foundation][data-pe-tab="paps"]:not(.pe87FoldWide):not([data-pe-fold-wide="true"])
  #app:has(#papsTableBox) > .pe87PageHead.peRecordStickyRegion > .row >
  :is(#uploadPapsOriginBtn12064, #exportPapsBtn) {
    display: inline-flex !important;
    flex: 0 0 clamp(136px, 10.2vw, 158px) !important;
    width: clamp(136px, 10.2vw, 158px) !important;
    min-width: clamp(136px, 10.2vw, 158px) !important;
    max-width: clamp(136px, 10.2vw, 158px) !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    text-align: center !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
  }
}

/* Galaxy Fold7 unfolded: preserve the one-line header and add one equal slot. */
@media (min-width: 769px) and (max-width: 1200px) {
  html.pe87FoldWide[data-pe87-fold-device^="galaxy-fold"][data-pe-tab="paps"]:not(.pe87Ipad):not(.pe87IpadRuntime)
  #app:has(#papsTableBox) > .pe87PageHead.foldPapsUnifiedHead12003 > .row {
    grid-template-columns:
      minmax(0, 1.02fr)
      minmax(0, .84fr)
      minmax(0, 1.42fr)
      minmax(0, 1.42fr)
      minmax(0, .84fr)
      minmax(0, .66fr) !important;
  }

  html.pe87FoldWide[data-pe87-fold-device^="galaxy-fold"][data-pe-tab="paps"]:not(.pe87Ipad):not(.pe87IpadRuntime)
  #app:has(#papsTableBox) > .pe87PageHead.foldPapsUnifiedHead12003 > .row > #uploadPapsOriginBtn12064 {
    grid-column: 3 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 clamp(2px, .55vw, 7px) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    font-size: clamp(9.5px, 1.28vw, 12px) !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    letter-spacing: -.35px !important;
    text-align: center !important;
    white-space: nowrap !important;
    word-break: normal !important;
    overflow-wrap: normal !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  html.pe87FoldWide[data-pe87-fold-device^="galaxy-fold"][data-pe-tab="paps"]:not(.pe87Ipad):not(.pe87IpadRuntime)
  #app:has(#papsTableBox) > .pe87PageHead.foldPapsUnifiedHead12003 > .row > #exportPapsBtn {
    grid-column: 4 !important;
  }

  html.pe87FoldWide[data-pe87-fold-device^="galaxy-fold"][data-pe-tab="paps"]:not(.pe87Ipad):not(.pe87IpadRuntime)
  #app:has(#papsTableBox) > .pe87PageHead.foldPapsUnifiedHead12003 > .row > #deletePapsBtn {
    grid-column: 5 !important;
  }

  html.pe87FoldWide[data-pe87-fold-device^="galaxy-fold"][data-pe-tab="paps"]:not(.pe87Ipad):not(.pe87IpadRuntime)
  #app:has(#papsTableBox) > .pe87PageHead.foldPapsUnifiedHead12003 > .row > #savePapsBtn {
    grid-column: 6 !important;
  }
}

/* iPhone 15 Pro · Fold7 folded: the third rail button stays a single action. */
@media (max-width: 768px) {
  html:not(.pe87FoldWide):not([data-pe-fold-wide="true"])
  body.mobilePapsView #mobilePapsDashboardCard #mPapsExport.papsOriginMenu12064 {
    grid-column: 3 !important;
    overflow: hidden !important;
    text-align: center !important;
    white-space: nowrap !important;
    word-break: keep-all !important;
    overflow-wrap: normal !important;
    -webkit-tap-highlight-color: transparent !important;
  }
}

.papsOriginChoiceModal12064 {
  z-index: 53000;
}

.papsOriginChoiceCard12064 {
  width: min(460px, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
}

.papsOriginChoices12064 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.papsOriginChoices12064 > .papsOriginChoice12064 {
  display: inline-flex;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 10px;
  box-sizing: border-box;
  font-size: 14px;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  word-break: keep-all;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 420px) {
  .papsOriginChoiceCard12064 {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    padding: 16px;
  }

  .papsOriginChoices12064 {
    grid-template-columns: 1fr;
  }
}
