  /* Buy Qty input font size (mobile) */
  .buy-qty-input {
    font-size: 14px !important;
  }
/* Fasteners Mobile Styles (layout-only; no logic changes)
   Target: <= 768px, overrides desktop CSS via cascade precedence.
*/
@media (max-width: 768px) {

  /* --- Page scaffolding --- */
  .fastener {
    --m-gap: 8px;
    --m-pill-w: 120px;    /* visible ~3 pills per viewport */
    --m-pill-h: 44px;
    --icon-pill-size: 90px;
  }

  /* Stack panels vertically */
  .fastener .fastener-top-row {
    display: block !important;
    margin-bottom: var(--m-gap);
  }

  .fastener .fastener-bottom-row {
    display: flex !important;
    flex-direction: column;
    margin-bottom: var(--m-gap);
  }

  .fastener .fastener-details-panel,
  .fastener .fastener-order-panel {
    min-width: 0 !important;
    width: 100%;
  }

  /* On mobile, show Order panel above Details panel */
  .fastener .fastener-order-panel {
    order: 1;
  }

  .fastener .fastener-details-panel {
    order: 2;
  }

  /* --- Facet boxes: turn pill grid into a horizontal rail with snap --- */
  .fastener .fastener-facet-box {
    min-height: auto;
    height: auto;
    padding-bottom: 6px;
    position: relative;
  }

  .fastener .fastener-facet-box .facet-header {
    padding: 10px 12px 6px;
  }

  .fastener .fastener-facet-box .facet-pills {
    display: flex !important;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 16px 12px;
    scroll-snap-type: x mandatory;
    scroll-padding: 0 16px;
    -webkit-overflow-scrolling: touch;
  }

  .fastener .fastener-facet-box .pill,
  .fastener .fastener-facet-box .icon-pill {
    flex: 0 0 var(--m-pill-w);
    height: var(--m-pill-h);
    scroll-snap-align: start;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
  }

  /* Icon pills: compact stack on mobile */
  .fastener .fastener-facet-box .icon-pill {
    flex-direction: column;
    gap: 6px;
    flex: 0 0 var(--icon-pill-size);
  }
  .fastener .fastener-facet-box .icon-pill .icon {
    width: 28px;
    height: 28px;
  }
  .fastener .fastener-facet-box .icon-pill .label {
    font-size: 12px !important;
    line-height: 1.15;
  }

  /* "All Sizes" / generic all-pills remain inline-sized */
  .fastener .fastener-facet-box .all-pill {
    flex: 0 0 auto;
  }

  /* --- Submit / Back buttons (styles only; DOM wired later) --- */
  .fastener .fastener-mobile-actions {
    display: flex;
    gap: 10px;
    padding: 8px 12px 12px;
  }
  .fastener .fastener-mobile-actions .btn {
    flex: 1 1 0;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid #ddd;
    background: #004C93;
    color: #fff;
    font-weight: 600;
  }
  /* Force full width for mobile next and addall buttons */
  .fastener .fastener-mobile-next,
  .fastener #fastener-addall-btn {
    width: 100% !important;
    display: block !important;
    margin: 10px 0 !important;
  }
  .fastener .fastener-mobile-actions .btn.secondary {
    background: #fff;
    color: #004C93;
    border-color: #004C93;
  }

  /* Mobile back and show order table button styling (fastener table page and filters page) */
  .fastener .fastener-mobile-back,
  .fastener .fastener-mobile-next {
    display: block;
    width: 100%;
    margin: 8px 0 10px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #004C93;
    background: #ffffff;
    color: #004C93;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
  }

  .fastener .fastener-mobile-back:disabled,
  .fastener .fastener-mobile-next:disabled {
    opacity: 0.6;
  }

  /* --- Two-page mobile state (filters ↔ table)
     Note: classes will be toggled in JS later. No logic changes now. */
  .fastener[state="filters"] .fastener-table-page { display: none !important; }
  .fastener[state="table"]   .fastener-filters-page { display: none !important; }

  /* Simple slide transition container (optional; respects reduced motion) */
  .fastener .fastener-mobile-stage {
    position: relative;
    width: 100%;
    overflow: hidden;
  }
  .fastener .fastener-mobile-stage .stage-inner {
    display: flex;
    width: 200%;
    transition: transform 180ms ease;
  }
  .fastener[state="filters"] .fastener-mobile-stage .stage-inner { transform: translateX(0%); }
  .fastener[state="table"]   .fastener-mobile-stage .stage-inner { transform: translateX(-50%); }
  @media (prefers-reduced-motion: reduce) {
    .fastener .fastener-mobile-stage .stage-inner { transition: none; }
  }

  /* --- Order table compaction --- */
  .fastener .order-table {
    font-size: 13px !important;
    table-layout: fixed;
  }

  /* Tighten cell padding & allow wrapping to prevent horizontal clipping */
  .fastener .order-table thead th,
  .fastener .order-table tbody td {
    padding: 6px 4px;
  }

  .fastener .order-table tbody td {
    white-space: normal;
  }


  /* Hide the "Price / Pc" (tiers) column to save space
     Desktop order has 6 columns:
     1: Size | 2: Price / Pc | 3: Buy Qty | 4: Price Applied | 5: Cost | 6: Add */
  .fastener .order-table thead th:nth-child(2),
  .fastener .order-table tbody td:nth-child(2) {
    display: none !important;
  }

  /* Hide the Cost column on mobile */
  .fastener .order-table thead th:nth-child(5),
  .fastener .order-table tbody td:nth-child(5) {
    display: none !important;
  }

  /* Rebalance remaining visible columns (1, 3, 4, 5, 6) for better fit */
  .fastener .order-table thead th:nth-child(1),
  .fastener .order-table tbody td:nth-child(1) { width: 26% !important; }                                /* Size */
  .fastener .order-table thead th:nth-child(3),
  .fastener .order-table tbody td:nth-child(3) { width: 18% !important; text-align: center !important; } /* Buy Qty */
  .fastener .order-table thead th:nth-child(4),
  .fastener .order-table tbody td:nth-child(4) { width: 22% !important; text-align: center !important; } /* Price Applied */
  .fastener .order-table thead th:nth-child(6),
  .fastener .order-table tbody td:nth-child(6) { width: 18% !important; }                                /* Add */

  .fastener .order-table .add-btn,
  .fastener .order-table .pill {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Summary spacing */
  .fastener .fastener-summary-wrap {
    margin-top: 10px;
  }

  /* Gallery already switches to 3 columns in fastener.css; ensure spacing */
  .fastener .fastener-gallery {
    gap: 8px !important;
    margin-top: 8px;
    margin-bottom: 8px;
  }

  /* Description block spacing */
  .fastener .fastener-description {
    padding: 8px 2px 12px;
  }
}