@media screen and (max-width: 782px) {
  body.admin-bar [data-amz-pe] {
    --amz-pe-admin-offset: 46px;
    --amz-pe-sticky-offset: 62px;
  }
}

@media (max-width: 1180px) {
  [data-amz-pe] {
    width: calc(var(--amz-pe-viewport-width) - 20px);
  }

  [data-amz-pe] [data-pe-app] {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  [data-amz-pe] .amz-pe__mobilebar {
    display: flex;
    min-height: 56px;
    margin-bottom: 14px;
    padding: 8px 12px;
    align-items: center;
    gap: 12px;
    color: var(--amz-pe-green-dark);
    background: #fff;
    border: 1px solid var(--amz-pe-border);
    box-shadow: 0 8px 28px rgba(20, 55, 43, .07);
    scroll-margin-top: calc(var(--amz-pe-admin-offset, 0px) + 8px);
  }

  [data-amz-pe] .amz-pe__mobilebar > strong {
    min-width: 0;
    font-size: 18px;
    overflow-wrap: anywhere;
  }

  [data-amz-pe] .amz-pe__layout {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* Native modal top layer: not clipped by theme transform/contain/overflow. */
  [data-amz-pe] dialog.amz-pe__drawer {
    display: none !important;
    position: fixed !important;
    inset: var(--amz-pe-drawer-top, 0px) 0 auto 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: var(--amz-pe-drawer-height, 100vh) !important;
    height: var(--amz-pe-drawer-height, 100dvh) !important;
    max-height: none !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    overflow: hidden !important;
    transform: none !important;
    color: var(--amz-pe-text);
    font: 16px/1.4 Calibri, Arial, sans-serif;
  }

  [data-amz-pe] dialog.amz-pe__drawer[open] { display: block !important; }
  [data-amz-pe] dialog.amz-pe__drawer::backdrop { background: transparent !important; }

  [data-amz-pe] [data-pe-sidebar] {
    display: none !important;
    position: absolute !important;
    z-index: 2 !important;
    inset: 0 auto 0 0 !important;
    width: min(86vw, 320px) !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: max(16px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom)) !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    scrollbar-gutter: auto;
    transform: none !important;
    transition: none !important;
    background: #fff !important;
    border: 1px solid var(--amz-pe-border) !important;
  }

  [data-amz-pe] [data-pe-app].is-menu-open [data-pe-sidebar] {
    display: block !important;
    visibility: visible !important;
  }

  [data-amz-pe] [data-pe-menu-toggle],
  [data-amz-pe] [data-pe-menu-close] {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid #b9c7c0 !important;
    border-radius: 3px !important;
    background: #fff !important;
    color: var(--amz-pe-green-dark) !important;
    box-shadow: none !important;
    font: 700 22px/1 Calibri, Arial, sans-serif !important;
    text-indent: 0 !important;
    transform: none !important;
    appearance: none;
    -webkit-appearance: none;
  }

  [data-amz-pe] [data-pe-menu-close] {
    position: sticky !important;
    top: 0 !important;
    right: auto !important;
    float: right;
    z-index: 3;
    margin: 0 0 8px 8px !important;
  }

  [data-amz-pe] .amz-pe__sidebar-head {
    min-height: 60px;
    padding-right: 50px;
    overflow-wrap: anywhere;
  }

  /* The overlay is a close button, not a themed action button. */
  [data-amz-pe] [data-pe-backdrop] {
    display: none !important;
    position: absolute !important;
    z-index: 1 !important;
    inset: 0 !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: rgba(15, 30, 24, .48) !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    transform: none !important;
    appearance: none;
    -webkit-appearance: none;
    touch-action: none;
    cursor: default;
  }
  [data-amz-pe] [data-pe-backdrop]::before,
  [data-amz-pe] [data-pe-backdrop]::after { content: none !important; }
  [data-amz-pe] [data-pe-backdrop]:not([hidden]) { display: block !important; }
  [data-amz-pe] [data-pe-backdrop][hidden] { display: none !important; }

  /* Fallback without dialog support: a normal scrollable menu, no page lock. */
  [data-amz-pe] [data-pe-app].is-menu-inline [data-pe-sidebar] {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    margin-bottom: 14px !important;
  }

  [data-amz-pe] [data-pe-content] {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: visible !important;
    overscroll-behavior: auto;
    scrollbar-gutter: auto;
  }
  [data-amz-pe] [data-pe-panel] { min-width: 0; max-width: 100%; }
}

@media (max-width: 760px) {
  [data-amz-pe] {
    padding: 0 5px;
  }

  .amz-pe__header h1,
  .amz-pe__header h2 {
    font-size: 21px;
  }

  .amz-pe__panel {
    padding: 18px;
  }

  [data-pe-code],
  .amz-pe__field,
  [data-pe-login-button] {
    width: 100%;
    max-width: none;
  }

  [data-pe-panel] > h1,
  [data-pe-panel] > h2,
  .amz-pe__content-head h1,
  .amz-pe__content-head h2 {
    font-size: 21px;
  }
}

@media (max-width: 620px) {
  [data-amz-pe] {
    margin-top: 32px;
    padding: 0 10px;
  }
}

@media (max-width: 480px) {
  .amz-pe__panel {
    padding: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-amz-pe] *,
  [data-amz-pe] *::before,
  [data-amz-pe] *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}


@media (max-width: 760px) {
  .amz-pe__field,
  [data-pe-login-button],
  [data-pe-password-button] {
    width: 100%;
    max-width: none;
  }
}
