/* Mobile layout — natural page scroll, no trapped parts panel */
@media (max-width: 768px) {
  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .shell {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    min-height: 100svh;
  }

  body.test-mode-active .shell {
    height: auto;
    min-height: calc(100dvh - 36px);
    min-height: calc(100svh - 36px);
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0 14px;
  }

  body.test-mode-active .topbar {
    top: 36px;
  }

  .topbar-stat {
    display: none;
  }

  .main {
    display: flex;
    flex-direction: column;
    overflow: visible;
    min-height: auto;
    flex: none;
  }

  .catalogue {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
    min-height: auto;
    flex: none;
  }

  #cat-collapsible {
    flex: none;
    min-height: auto;
    display: block;
    overflow: visible;
  }

  #cat-collapsible.collapsed {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
  }

  /* Browse catalogue in a short window; scroll past it for the order form */
  .parts-scroll {
    flex: none;
    height: auto;
    max-height: min(50dvh, 420px);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .order-panel {
    overflow: visible;
    min-height: auto;
    flex: none;
  }

  .order-scroll {
    flex: none;
    max-height: none;
    overflow: visible;
    overscroll-behavior: auto;
    -webkit-overflow-scrolling: touch;
  }

  .empty-order {
    height: auto;
    min-height: 100px;
    padding: 1.5rem;
  }

  .send-section {
    padding: 12px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    overflow: visible;
  }

  .signon-block,
  .job-combo {
    overflow: visible;
  }

  .job-dropdown.open {
    z-index: 2100;
    max-height: min(40dvh, 280px);
  }

  .job-opt {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .filter-row {
    gap: 5px;
  }

  .cat-btn {
    font-size: 11px;
    padding: 6px 10px;
    min-height: 36px;
  }

  .part-row,
  .picked-row {
    touch-action: pan-y;
  }

  .part-row {
    padding: 12px 14px;
    min-height: 48px;
  }

  .collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
  }

  .signon-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  /* Prevent iOS zoom-on-focus */
  #search,
  #wtg-input,
  #job-desc,
  .field-input,
  .field-select,
  .pin-input,
  .pin-select {
    font-size: 16px;
  }

  .qbtn,
  .rbtn {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .qty-popup-btn,
  .qty-popup-input {
    min-height: 44px;
    min-width: 44px;
  }

  .tpl-btn,
  .ac-btn,
  .clr-btn {
    min-height: 40px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
}
