/* ===== PAC.CO Store Navigation ===== */

.nav-studio-btn {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  margin-right: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.nav-studio-btn:hover {
  transform: scale(1.05);
  opacity: 0.9;
}

.pacco-is-admin .nav-studio-btn,
.nav-studio-btn.admin-visible {
  display: inline-flex !important;
}

@media (max-width: 900px) {
  .nav-links {
    gap: clamp(10px, 2vw, 30px);
  }

  .nav-links a,
  .nav-links button {
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .nav-row {
    align-items: center;
    flex-wrap: nowrap;
  }

  .nav-studio-btn {
    padding: 6px 12px;
    max-width: 80px;
    font-size: 0.7rem;
  }

  .nav-studio-btn span {
    display: none;
  }
}

.icon-btn--rel {
  position: relative;
}

/* Cart close button — visible circle like modal close buttons */
#cartClose.icon-btn {
  width: 36px !important;
  height: 36px !important;
  border: 2px solid var(--ink) !important;
  background: var(--paper) !important;
  font-weight: 700 !important;
  font-size: 1rem !important;
  box-shadow: none !important;
}
#cartClose.icon-btn svg {
  width: 16px !important;
  height: 16px !important;
}

/* All frontend close buttons — visible circle + SVG icon */
#checkoutClose.icon-btn,
#ipadCheckoutClose.icon-btn,
#productClose.icon-btn,
#revealModalClose,
#ticketModalClose,
#collectionModalClose {
  width: 36px !important;
  height: 36px !important;
  border: 2px solid var(--ink) !important;
  background: var(--paper) !important;
  border-radius: 50% !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  box-shadow: none !important;
}

/* Remove shadow from all modal close buttons */
.modal-close-btn,
.store-modal-close {
  box-shadow: none !important;
}

/* ===== iPad/tablet fix: keep nav on ONE row at all sizes ===== */
/* Override store.css 820px wrap — nav stays inline, elements shrink to fit */
@media (max-width: 820px) {
  .nav-row {
    flex-wrap: nowrap;
  }
  .nav-links {
    order: 0;
    width: auto;
    overflow: visible;
    display: flex; /* override the 768px display:none below */
    gap: clamp(8px, 1.5vw, 20px);
  }
  .nav-links a {
    white-space: nowrap;
    font-size: 0.72rem;
  }
  .brand-logo {
    width: 100px;
  }

  /* Change Studio button to icon layout on iPad/tablet sizes and below */
  .nav-studio-btn {
    width: 38px !important;
    height: 38px !important;
    padding: 0 !important;
    margin-right: 8px !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--ink) !important;
    border: 2px solid transparent !important;
    font-size: 0px !important; /* Hide original text "OPEN STUDIO" */
    transition: all 160ms ease !important;
    align-items: center !important;
    justify-content: center !important;
  }

  .nav-studio-btn::after {
    content: "" !important;
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    background-color: currentColor !important;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E") no-repeat center !important;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E") no-repeat center !important;
    -webkit-mask-size: contain !important;
    mask-size: contain !important;
  }
}

/* ============================================================
   MOBILE REDESIGN — Hamburger + Drawer navigation
   ============================================================ */

/* Hidden on desktop — shown on phone */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  color: var(--ink);
  flex-shrink: 0;
}
.hamburger-btn svg {
  display: block;
}

/* Drawer overlay */
.drawer-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 49;
  background: rgba(0,0,0,0.35);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms ease;
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* Drawer panel */
.mobile-nav-drawer {
  display: none;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 50;
  width: min(320px, 78vw);
  background: #fff;
  transform: translateX(-100%);
  pointer-events: none;
  transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1), pointer-events 0ms 280ms;
  box-shadow: 4px 0 24px rgba(0,0,0,0.12);
  overflow-y: auto;
}
.mobile-nav-drawer.open {
  transform: translateX(0);
  pointer-events: auto;
  transition: transform 280ms cubic-bezier(0.32, 0.72, 0, 1), pointer-events 0ms 0ms;
}
.mobile-drawer-inner {
  padding: 20px 0;
}
.mobile-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px 16px;
  border-bottom: 1px solid #ededf0;
  margin-bottom: 8px;
}
.mobile-drawer-title {
  font-size: 1rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 12px;
}
.mobile-nav-links a,
.mobile-nav-links button {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  border-radius: 10px;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background 160ms ease;
}
.mobile-nav-links a:hover,
.mobile-nav-links button:hover {
  background: #f5f5f7;
}
.mobile-nav-links a svg,
.mobile-nav-links button svg {
  flex-shrink: 0;
  color: #666;
}
.mobile-nav-links a span,
.mobile-nav-links button span {
  flex: 1;
}
.mobile-nav-divider {
  height: 1px;
  background: #ededf0;
  margin: 8px 12px;
}

/* Phone size: new hamburger layout */
@media (max-width: 600px) {
  /* Hamburger visible */
  .hamburger-btn {
    display: inline-flex;
    width: 36px !important;
    height: 36px !important;
    order: 0 !important;
  }
  .hamburger-btn svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* Drawer visible (closed by default) */
  .mobile-nav-drawer,
  .drawer-overlay {
    display: block;
  }

  /* Redesign nav-row: [☰] [LOGO] ... [icons] */
  .nav-row {
    flex-wrap: nowrap !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    min-height: 52px !important;
    gap: 8px !important;
  }

  /* Logo moves right next to hamburger */
  .brand-link {
    order: 1 !important;
    flex: 0 0 auto !important;
    min-width: auto !important;
  }
  .brand-logo {
    width: 95px !important;
    max-height: 32px !important;
  }

  /* Hide nav-links on mobile — they're in the drawer */
  .nav-links {
    display: none !important;
  }

  /* Nav actions on the right */
  .nav-actions {
    order: 2 !important;
    margin-left: auto !important;
    gap: 4px !important;
    flex: 0 0 auto !important;
  }

  /* Smaller icons (~30% reduction from 42px) */
  .nav-studio-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin-right: 0 !important;
    border-radius: 50% !important;
    background: transparent !important;
    color: var(--ink) !important;
    border: 2px solid transparent !important;
    font-size: 0px !important;
    transition: all 160ms ease !important;
    align-items: center !important;
    justify-content: center !important;
    display: none !important; /* moved to drawer */
  }

  .icon-btn,
  .store-icon-btn {
    width: 40px !important;
    height: 40px !important;
    padding: 0 !important;
    border-radius: 50% !important;
  }

  .icon-btn svg,
  .store-icon-btn svg {
    width: 19px !important;
    height: 19px !important;
  }

  .nav-studio-btn::after {
    width: 16px !important;
    height: 16px !important;
  }

  /* Hamburger touch target larger than its icon */
  .hamburger-btn {
    width: 40px !important;
    height: 40px !important;
  }
  .hamburger-btn svg {
    width: 22px !important;
    height: 22px !important;
  }

  /* Smaller badges */
  .badge-count,
  .store-badge {
    font-size: 8px !important;
    min-width: 14px !important;
    height: 14px !important;
    padding: 0 3px !important;
    top: -4px !important;
    right: -4px !important;
    border-width: 1.5px !important;
  }

  /* Extra-small phones */
  @media (max-width: 375px) {
    .hamburger-btn {
      width: 36px !important;
      height: 36px !important;
    }
    .hamburger-btn svg {
      width: 20px !important;
      height: 20px !important;
    }
    .brand-logo {
      width: 80px !important;
    }
    .icon-btn,
    .store-icon-btn {
      width: 36px !important;
      height: 36px !important;
    }
    .icon-btn svg,
    .store-icon-btn svg {
      width: 17px !important;
      height: 17px !important;
    }
    .badge-count,
    .store-badge {
      min-width: 12px !important;
      height: 12px !important;
      font-size: 7px !important;
      top: -3px !important;
      right: -3px !important;
    }
  }
}

/* ===== Mobile Cart Drawer — Sticky Footer ===== */
@media (max-width: 820px) {
  /* Full-width drawer on phone — use top:0;bottom:0 for reliable viewport fill */
  .drawer,
  .store-drawer {
    width: 100% !important;
    border-left: none !important;
    top: 0 !important;
    bottom: 0 !important;
    height: auto !important;
    overflow: hidden !important;
  }

  /* Pin the header to the top */
  .drawer-head,
  .store-drawer-head {
    flex-shrink: 0 !important;
    padding: 14px 16px !important;
  }

  /* Scrollable cart items area — isolated, no scroll chaining */
  .drawer-body,
  .store-drawer-body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    touch-action: pan-y !important;
    min-height: 0 !important;
    padding: 12px 16px !important;
  }

  /* Pin the footer to the bottom with safe-area padding */
  .drawer-foot,
  .store-drawer-foot {
    flex-shrink: 0 !important;
    position: relative !important;
    bottom: 0 !important;
    padding: 14px 16px !important;
    padding-bottom: max(14px, env(safe-area-inset-bottom, 14px)) !important;
    border-top: 2px solid #ededf0 !important;
    background: #fbfbfc !important;
  }

  /* Ensure checkout button always visible & tappable */
  #checkoutButton,
  .drawer-foot .button,
  .store-drawer-foot .button {
    min-height: 44px !important;
  }

  /* Compact empty cart state */
  .drawer-body:empty,
  .store-drawer-body:empty {
    min-height: 120px !important;
  }
}

/* ===== Mobile Full-Screen Checkout Sheets ===== */
@media (max-width: 820px) {
  /* All store modals become full-screen bottom sheets */
  .modal.store-modal {
    padding: 0 !important;
    align-items: stretch !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  .modal.store-modal::before {
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
  }

  /* Modal panels → full-screen (sized by inset:0 from parent .modal) */
  .modal-panel,
  .store-modal-panel {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    /* NOTE: no 100dvh — that would conflict with JS keyboard handling */
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    transform: translateY(0) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: none !important;
    overscroll-behavior: none !important;
  }

  /* Product modal slides from bottom — override the full-screen transform */
  #productModal .store-modal-panel {
    transform: translateY(100%) !important;
    transition: transform 0.5s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.3s ease !important;
    border-radius: 0 !important;
  }
  #productModal.open .store-modal-panel {
    transform: translateY(var(--drag-y, 0)) !important;
  }
  #productModal .store-modal-panel.is-dragging {
    transition: none !important;
  }

  /* ===== Checkout Modal (Shipping + Payment) — Desktop/Tablet only ===== */
  /* Mobile (<768px) gets a completely separate architecture below */
  .checkout-panel {
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
  }

  .modal-foot-sticky,
  .store-modal-foot {
    flex-shrink: 0 !important;
    background: var(--paper, #fff) !important;
    padding: 16px 20px !important;
    padding-bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.06) !important;
  }

  /* Checkout action buttons compact */
  .checkout-actions .button.store-btn {
    min-height: 44px !important;
    font-size: 0.95rem !important;
  }

  /* ===== PromptPay Modal ===== */
  .promptpay-panel {
    border-radius: 0 !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100% !important;
    max-height: 100dvh !important;
  }

  .promptpay-modal {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px 16px !important;
    -webkit-overflow-scrolling: touch !important;
    align-items: stretch !important; /* full-width children */
  }

  .promptpay-header {
    flex-shrink: 0 !important;
    position: sticky !important;
    top: 0 !important;
    background: var(--paper, #fff) !important;
    z-index: 5 !important;
    padding-bottom: 12px !important;
    margin-bottom: 8px !important;
    text-align: center !important;
  }

  /* Close button always reachable */
  .promptpay-close {
    position: fixed !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 20 !important;
    background: var(--paper, #fff) !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15) !important;
  }

  .promptpay-actions {
    flex-shrink: 0 !important;
    padding-bottom: max(12px, env(safe-area-inset-bottom, 12px)) !important;
    margin-top: 16px !important;
    border-top: 1px solid #ededf0 !important;
    padding-top: 16px !important;
  }

  .promptpay-actions .button {
    min-height: 44px !important;
  }

  /* Amount cards full-width on mobile */
  .qr-card {
    max-width: 200px !important;
    margin: 0 auto 16px !important;
  }

  .payment-amount-card {
    padding: 12px 16px !important;
  }

  /* Evidence upload section compact */
  .evidence-upload-section {
    margin-top: 12px !important;
    padding-top: 12px !important;
  }

  /* ===== Bank Transfer Modal ===== */
  .pp-instructions--bt {
    flex: 1 !important;
  }

  .bt-section {
    padding: 10px 0 !important;
  }

  /* ===== Product Detail Modal (full-screen too) ===== */
  #productModal .modal-panel {
    height: 100% !important;
    max-height: 100% !important;
  }

  #productModal .modal-content {
    overflow-y: auto !important;
    flex: 1 !important;
    -webkit-overflow-scrolling: touch !important;
  }

  /* Auth modal */
  .auth-panel {
    border-radius: 0 !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100% !important;
    max-height: 100dvh !important;
  }

  .auth-content {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 0 20px 24px !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* ===== iPad/Tablet: Remove heavy card shadow from product modal ===== */
@media (max-width: 1024px) {
  #productModal .modal-panel,
  #productModal .store-modal-panel {
    box-shadow: none !important;
  }
}

/* ===== iPad/Tablet: Remove card shadow from product cards ===== */
@media (max-width: 1024px) {
  .product-card {
    box-shadow: none !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE CHECKOUT — Dedicated Architecture (<768px)
   Separate from the desktop/tablet checkout. Pure flexbox, no sticky positioning.
   Fixed header + fixed footer + independent scrollable content.
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {
  /* Overlay: true fixed fullscreen — visibility controlled by .open class as usual */
  #checkoutModal {
    padding: 0 !important;
    align-items: stretch !important;
    overflow: hidden !important;
    overscroll-behavior: none !important;
  }

  /* Panel: fixed, fills layout viewport always.
     When keyboard opens, bottom is adjusted via JS to lift the panel
     by the keyboard height. This keeps the footer stationary — it
     stays at the panel's bottom, which moves up by exactly the keyboard
     height, so it remains visible just above the keyboard. */
  #checkoutModal .checkout-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    /* No height values — inset:0 sizes to layout viewport */
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
    border: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    box-shadow: none !important;
    background: var(--paper, #fff) !important;
    z-index: 1 !important;
    transform: none !important;
    transition: none !important;
    /* bottom is overridden by JS _updateVh on keyboard open */
  }

  /* ── Fixed Header ── */
  #checkoutModal .modal-head {
    flex-shrink: 0 !important;
    /* NO position:sticky — pure flex child at top */
    z-index: 10 !important;
    background: var(--paper, #fff) !important;
    padding: 14px 16px !important;
    border-bottom: 1px solid rgba(0,0,0,0.08) !important;
  }

  #checkoutModal .modal-head h2 {
    font-size: 1.15rem !important;
  }

  /* ── Scrollable Content ── */
  #checkoutModal .modal-scroll-area {
    flex: 1 1 0 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 16px !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    /* Allow country dropdown to overflow via position:fixed (JS-assisted) */
  }

  #checkoutModal .modal-content {
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
  }

  /* ── Fixed Footer ── */
  #checkoutModal .modal-foot-sticky,
  #checkoutModal .store-modal-foot {
    flex-shrink: 0 !important;
    /* NO position:sticky — pure flex child at bottom */
    z-index: 10 !important;
    background: var(--paper, #fff) !important;
    padding: 8px 16px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px)) !important;
    border-top: 1px solid rgba(0,0,0,0.08) !important;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.04) !important;
  }

  /* Compact summary rows — Products, Shipping, Total */
  #checkoutModal .checkout-subtotal-line,
  #checkoutModal .checkout-shipping-line,
  #checkoutModal .order-total-line {
    font-size: 0.85rem !important;
    gap: 8px !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    min-height: 22px !important;
  }

  #checkoutModal .checkout-subtotal-line .price,
  #checkoutModal .checkout-shipping-line .price,
  #checkoutModal .order-total-line .price {
    font-size: 0.85rem !important;
  }

  #checkoutModal .shipping-fee-time {
    display: inline !important;
    font-size: 0.7rem !important;
    margin-left: 4px !important;
  }

  #checkoutModal .order-total-line {
    border-top: 1px solid rgba(0,0,0,0.08) !important;
    padding-top: 6px !important;
    margin-top: 4px !important;
  }

  #checkoutModal .order-total-line strong:first-child {
    font-size: 0.85rem !important;
    font-weight: 950 !important;
  }

  /* Side-by-side buttons */
  #checkoutModal .checkout-actions {
    flex-direction: row !important;
    gap: 8px !important;
    margin-top: 8px !important;
    /* NO display override — respect inline style="display:none" toggle */
  }

  #checkoutModal .checkout-actions .button.store-btn {
    min-height: 38px !important;
    font-size: 0.85rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #checkoutModal .checkout-actions .button.store-btn.minimal-btn {
    display: none !important;
  }

  #checkoutModal .checkout-actions .primary-cta {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  #checkoutModal .checkout-actions .ghost-btn {
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  /* Footer — never covers form fields */
  #checkoutModal .modal-scroll-area {
    padding-bottom: 8px !important;
  }

  /* Form layout */
  #checkoutModal .form-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #checkoutModal .form-field {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  #checkoutModal .form-field input,
  #checkoutModal .form-field select,
  #checkoutModal .form-field .field {
    min-height: 44px !important;
    font-size: 16px !important;  /* Prevents iOS zoom */
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Account box compact */
  #checkoutModal .account-box {
    padding: 12px !important;
    margin-bottom: 18px !important;
    gap: 12px !important;
  }

  /* Shipping methods wrapper */
  #checkoutModal .shipping-methods-wrapper {
    width: 100% !important;
  }

  /* Shipping summary box compact */
  #checkoutModal .shipping-summary-box {
    margin-bottom: 20px !important;
    padding: 12px !important;
  }

  /* Payment step — payment cards full width */
  #checkoutModal .payment-card {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════════
     PHONE FIX: Remove device-style rounded frame + restore payment-card taps
     • store-checkout.css forces border-radius:16px !important on the panel
       (device bezel look on full-screen mobile). Override it on phones only.
     • Force payment cards to receive taps: explicit pointer-events, relative
       positioning, and a z-index that puts them above the footer's box-shadow.
     • Also force the iPad payment step hidden on phones (safety net) and
       unblock any pointer-events:none inherited from desktop defaults.
     ═══════════════════════════════════════════════════════════════════════════ */

  /* Kill the device-style border/frame on the Shipping + Payment modals */
  #checkoutModal .checkout-panel,
  #promptPayModal .promptpay-panel,
  #bankTransferModal .promptpay-panel {
    border-radius: 0 !important;
    border: none !important;
  }

  /* Belt-and-braces: make sure iPad payment panels are hidden on phones */
  #ipadPanelIpad,
  #checkoutPanelIpad,
  #ipadPromptPayPanel,
  #ipadBankTransferPanel,
  #ipadPaymentReview {
    display: none !important;
  }

  /* Payment cards must be tappable on phones */
  #checkoutModal .payment-card,
  #checkoutModal .payment-grid,
  #checkoutModal .payment-group,
  #checkoutModal .option-group,
  #checkoutModal .modal-content,
  #checkoutModal .modal-scroll-area {
    pointer-events: auto !important;
  }

  /* Pin payment cards above the footer's box-shadow in the stacking order */
  #checkoutModal .payment-card {
    position: relative !important;
    z-index: 2 !important;
  }

  /* Footer should never visually overlap the cards above it */
  #checkoutModal .modal-foot-sticky,
  #checkoutModal .store-modal-foot {
    position: relative !important;
    z-index: 3 !important;
    box-shadow: none !important;
  }

  /* Order total line */
  #checkoutModal .order-total-line {
    margin-bottom: 16px !important;
    padding-top: 14px !important;
  }

  /* Country dropdown — escape scroll container via position:fixed (JS positions it) */
  #checkoutModal .custom-select-dropdown {
    position: fixed !important;
    z-index: 200 !important;
    max-height: 280px !important;
    /* top/left set via JS in toggleCountryDropdown */
  }

  #checkoutModal .custom-select-wrapper.open .custom-select-dropdown {
    max-height: 280px !important;
  }

  /* Shipping method cards — full width tappable */
  #checkoutModal .shipping-method-card {
    padding: 14px 12px !important;
    min-height: 56px !important;
  }

  /* ── Mobile: native <select> for Country (replaces custom dropdown) ── */
  #checkoutModal .custom-select-wrapper {
    display: none !important;
  }
  #countryNativeSelect.mobile-country-select {
    display: block !important;
    width: 100% !important;
    min-height: 44px !important;
    font-size: 16px !important;
    padding: 10px 12px !important;
    border: 2px solid #d8d8df !important;
    border-radius: 12px !important;
    background: var(--paper, #fff) !important;
    color: var(--ink, #000) !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
  }
  #countryNativeSelect.mobile-country-select:focus {
    border-color: var(--ink, #000) !important;
    outline: none !important;
    box-shadow: 0 0 0 4px rgba(0,0,0,0.06) !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════════
     MOBILE KEYBOARD MODE — Show only Total + Primary Action button
     Base footer shows all rows; keyboard mode strips to minimum.
     ═══════════════════════════════════════════════════════════════════════════ */
  #checkoutModal.checkout-keyboard-open .modal-foot-sticky,
  #checkoutModal.checkout-keyboard-open .store-modal-foot {
    padding-top: 6px !important;
    padding-bottom: max(6px, env(safe-area-inset-bottom, 6px)) !important;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.04) !important;
  }

  /* Hide summary rows and delivery estimate — only Total stays */
  #checkoutModal.checkout-keyboard-open .checkout-subtotal-line,
  #checkoutModal.checkout-keyboard-open .checkout-shipping-line,
  #checkoutModal.checkout-keyboard-open .shipping-fee-time {
    display: none !important;
  }

  /* Remove Total divider when keyboard is open */
  #checkoutModal.checkout-keyboard-open .order-total-line {
    border-top: none !important;
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  /* Compact buttons during keyboard */
  #checkoutModal.checkout-keyboard-open .checkout-actions {
    gap: 4px !important;
  }

  #checkoutModal.checkout-keyboard-open .checkout-actions .button.store-btn {
    min-height: 38px !important;
    font-size: 0.85rem !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════════
     PAYMENT METHOD CARD — Mobile Selected State
     Match shipping-method-card.active styling: white bg, strong border.
     ═══════════════════════════════════════════════════════════════════════════ */
  .payment-card.bank.active {
    background: #fafafb !important;
    border-color: var(--ink, #000) !important;
    border-width: 2px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05) !important;
  }

  .payment-card.bank.active .payment-icon {
    background: var(--soft, #f1f1f4) !important;
    color: var(--ink, #000) !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════════
     PROMPTPAY MODAL — Mobile (<768px)
     Header scrolls naturally; only Close button is fixed.
     ═══════════════════════════════════════════════════════════════════════════ */
  #promptPayModal .promptpay-header {
    position: static !important;
    flex-shrink: unset !important;
    top: unset !important;
    background: transparent !important;
    z-index: unset !important;
    padding-bottom: 12px !important;
    margin-bottom: 8px !important;
    text-align: center !important;
  }

  #promptPayModal .promptpay-close {
    position: fixed !important;
    top: 16px !important;
    right: 16px !important;
    z-index: 20 !important;
    background: var(--paper, #fff) !important;
  }

  /* ═══════════════════════════════════════════════════════════════════════════
     PROMPTPAY MODAL — Mobile Simplification (<768px)
     ═══════════════════════════════════════════════════════════════════════════ */

  /* Remove subtitle */
  #promptPayModal .promptpay-header p {
    display: none !important;
  }

  /* Smaller logo */
  #promptPayModal .pp-logo-circle {
    width: 36px !important;
    height: 36px !important;
    margin-bottom: 6px !important;
  }

  /* Compact header spacing */
  #promptPayModal .promptpay-header {
    margin-bottom: 6px !important;
    padding-bottom: 6px !important;
  }

  /* Remove Transaction Reference field (label + input) */
  #promptPayModal .evidence-upload-section > label:first-child,
  #promptPayModal #ppTransactionRef {
    display: none !important;
  }

  /* Reorder PromptPay modal content via flexbox */
  #promptPayModal .promptpay-modal {
    display: flex !important;
    flex-direction: column !important;
  }

  #promptPayModal .promptpay-modal > .promptpay-header  { order: 1; }
  #promptPayModal .promptpay-modal > .qr-card           { order: 2; }
  #promptPayModal .promptpay-modal > .pp-id-box         { order: 3; }
  #promptPayModal .promptpay-modal > .pp-timer          { order: 4; }
  #promptPayModal .promptpay-modal > .payment-amount-card { order: 5; }
  #promptPayModal .promptpay-modal > .evidence-upload-section { order: 6; }
  #promptPayModal .promptpay-modal > .promptpay-actions { order: 7; }
  #promptPayModal .promptpay-modal > .pp-instructions   { order: 8; }

  /* Smaller spacing above QR */
  #promptPayModal .qr-card {
    margin-top: 4px !important;
  }

  /* Tighter evidence upload section */
  #promptPayModal .evidence-upload-section {
    margin-top: 8px !important;
    padding-top: 8px !important;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE HOMEPAGE REDESIGN (<768px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

  /* ── 1. TOP BAR: bigger icons + tap targets ── */
  .nav-row {
    min-height: 64px !important;
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  .brand-logo {
    max-height: 36px !important;
  }

  .hamburger-btn {
    width: 44px !important;
    height: 44px !important;
  }
  .hamburger-btn svg {
    width: 26px !important;
    height: 26px !important;
  }

  .icon-btn,
  .store-icon-btn {
    width: 44px !important;
    height: 44px !important;
  }
  .icon-btn svg,
  .store-icon-btn svg {
    width: 24px !important;
    height: 24px !important;
  }

  /* ── 2. HERO SLIDER: layout only — visual style inherits from editor ── */
  .hero-section {
    padding: 16px 0 8px !important;
  }

  .hero-slider {
    width: 100% !important;
    /* no margins — inherits container padding, matching feature cards & products */
  }

  .hero-frame {
    flex-direction: column !important;
    padding: 24px 24px !important;
    gap: 12px !important;
    min-height: auto !important;
    text-align: center !important;
    align-items: center !important;
  }

  .hero-media {
    flex: none !important;
    width: 60% !important;
    max-width: 60% !important;
    order: 0 !important;
  }

  .hero-art {
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    /* border-radius — inherit from editor (--hero-radius) */
  }

  .hero-copy {
    flex: none !important;
    width: 100% !important;
    align-items: center !important;
    order: 1 !important;
  }

  .hero-title {
    max-width: 100% !important;
    font-size: clamp(1.5rem, 5vw, 2rem) !important;
    line-height: 1.05 !important;
  }

  .hero-text {
    max-width: 85% !important;
    margin: 8px 0 14px !important;
    font-size: 0.9rem !important;
  }

  .hero-actions {
    justify-content: center !important;
  }

  .hero-actions .button {
    min-height: 44px !important;
    padding-inline: 20px !important;
    font-size: 0.85rem !important;
  }

  /* Arrow position only — size/style inherit from editor */
  .hero-nav-btn.prev {
    left: 8px !important;
  }
  .hero-nav-btn.next {
    right: 8px !important;
  }

  .hero-dots {
    padding-top: 12px !important;
  }

  /* ── 3. CATEGORY FILTER: wrapped pills, no horizontal scroll ── */
  .toolbar {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding: 8px 0 !important;
    overflow: visible !important;
  }

  /* Hide sort dropdown on mobile — only category pills shown */
  .toolbar .select-field {
    display: none !important;
  }

  /* ── COLLECTION HEADER: compact for mobile ── */
  .section-head {
    margin-bottom: 6px !important;
  }

  .section-head .eyebrow {
    font-size: 11px !important;
    letter-spacing: 0.12em !important;
    margin-bottom: 6px !important;
  }

  .section-head h1 {
    font-size: 32px !important;
    line-height: 1.0 !important;
    font-weight: 800 !important;
  }

  .section-subtitle {
    font-size: 13px !important;
    line-height: 1.4 !important;
    max-width: 100% !important;
    margin-top: 8px !important;
    margin-bottom: 8px !important;
  }

  .toolbar {
    margin-bottom: 8px !important;
    padding: 4px 0 !important;
  }

  .pill-row {
    flex-wrap: wrap !important;
    gap: 8px !important;
    justify-content: flex-start !important;
    width: 100% !important;
    overflow: visible !important;
  }

  .pill-row .pill {
    height: 22px !important;
    min-height: 22px !important;
    padding: 0 5px !important;
    font-size: 9px !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* "All" pill — perfect circle */
  .pill-row .pill:first-child {
    width: 22px !important;
    min-width: 22px !important;
    padding: 0 !important;
  }

  /* When "All" is hidden, first child is a collection pill — normal pill shape */
  .pill-row.no-all .pill:first-child {
    width: auto !important;
    min-width: unset !important;
    padding: 0 4px !important;
  }

  /* Non-"All" pills narrower */
  .pill-row .pill:not(:first-child) {
    padding: 0 4px !important;
  }

  .pill-row {
    gap: 3px !important;
  }

  /* ── 4. FEATURE CARDS: 2x2 grid, uniform heights, inherit Builder styling ── */
  .feature-grid,
  .store-page .feature-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 10px !important;
    padding: 8px 0 16px !important;
    align-items: stretch !important;
  }

  .feature-card {
    height: 100% !important;
    min-height: 64px !important;
    padding: 10px 14px !important;
    gap: 10px !important;
    align-items: stretch !important;  /* text wrapper fills card height */
    /* border-radius, border-width, border-color — inherit from Builder via --psb-* vars */
  }

  /* Fixed-height title + subtitle areas for uniform card alignment */
  .feature-card strong {
    display: block !important;
    min-height: 2.4em !important;
    line-height: 1.2 !important;
  }

  .feature-card span {
    display: block !important;
    margin-top: auto !important;  /* pins subtitle to bottom of text area */
  }

  /* Text wrapper: flex column so subtitle stays at same vertical position */
  .feature-card > div:not(.feature-icon) {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
  }

  /* Reduce section spacing on mobile */
  .dynamic-section {
    margin: 12px 0 !important;
  }
}

/* ── Desktop: hide mobile native <select> for Country ── */
@media (min-width: 768px) {
  #countryNativeSelect.mobile-country-select {
    display: none !important;
  }

  /* Desktop payment footer: right-aligned [← Back | Complete Order →]
     Ghost secondary is small + compact (fit-content). Primary CTA keeps
     primary emphasis. Back sits immediately to the left of the primary,
     right-aligned, 12px gap, no stretch on the back button. */
  #checkoutModal .checkout-actions {
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 12px !important;
    margin-top: 8px !important;
  }

  /* Reset oversized min-height that would force the small ghost-btn
     to match the primary CTA — keep the ghost-btn visually compact. */
  #checkoutModal .checkout-actions .ghost-btn {
    min-height: 0 !important;
    height: 40px !important;
  }

  #checkoutModal .checkout-actions .primary-cta {
    flex: 0 1 auto !important;
  }
}
