.costco-order-page {
  --costco-summary-desktop: 138px;
  --costco-summary-mobile: 184px;
}

.costco-hero {
  padding: 42px 0 38px;
  color: var(--card);
  background: var(--ink);
}

.costco-eyebrow {
  margin: 0 0 7px;
  color: var(--raspberry);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.costco-hero .costco-eyebrow { color: var(--soft-pink); }
.costco-hero h1 { margin: 0 0 10px; font-size: 3.4rem; line-height: 1; }
.costco-hero p:last-child { max-width: 660px; margin: 0; color: var(--dark-muted); }
.costco-main { padding-bottom: calc(var(--costco-summary-desktop) + 36px); }

.costco-toolbar {
  position: sticky;
  top: 72px;
  z-index: 70;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--page) 96%, transparent);
  backdrop-filter: blur(12px);
}

.costco-toolbar .shell { display: grid; gap: 10px; }
.costco-search input { min-height: 50px; padding-left: 16px; background: var(--card); }
.category-chips { display: flex; gap: 8px; overflow-x: auto; padding: 1px 1px 4px; scrollbar-width: thin; }
.category-chip { min-height: 40px; flex: 0 0 auto; padding: 8px 14px; border: 1px solid var(--input-border); border-radius: 999px; color: var(--ink); background: var(--card); font-size: .78rem; font-weight: 800; cursor: pointer; }
.category-chip.active, .category-chip[aria-pressed="true"] { border-color: var(--raspberry); color: var(--card); background: var(--raspberry); }

.costco-catalog-shell { padding-top: 34px; }
.catalog-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.catalog-heading h2, .custom-item-section h2 { margin: 0 0 4px; font-size: 2rem; }
.catalog-heading p { margin: 0; color: var(--muted); }
.catalog-heading a { color: var(--raspberry); font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.catalog-status { padding: 24px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted); background: var(--card); }
.catalog-status[hidden] { display: none; }
.catalog-groups { display: grid; gap: 30px; }
.catalog-group h3 { margin: 0 0 10px; font-family: "Playfair Display", serif; font-size: 1.45rem; }
.product-list { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.product-row { padding: 17px 18px; border-bottom: 1px solid var(--border); }
.product-row:last-child { border-bottom: 0; }
.product-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(112px, auto) 146px; align-items: center; gap: 18px; }
.product-copy { min-width: 0; }
.product-name { display: block; font-weight: 800; }
.product-size { display: block; margin-top: 3px; color: var(--muted); font-size: .8rem; }
.product-price { color: var(--ink); font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.product-price small { display: block; max-width: 120px; margin-top: 3px; color: var(--muted); font-size: .66rem; font-weight: 500; line-height: 1.25; }
.product-price.quote { color: var(--raspberry); font-size: .82rem; }
.quantity-stepper { display: grid; grid-template-columns: 44px 48px 44px; align-items: center; overflow: hidden; border: 1px solid var(--input-border); border-radius: 7px; }
.quantity-stepper button { width: 44px; height: 44px; padding: 0; border: 0; color: var(--ink); background: var(--pale-pink); font-size: 1.3rem; font-weight: 800; cursor: pointer; }
.quantity-stepper output { display: grid; height: 44px; place-items: center; background: var(--card); font-weight: 800; font-variant-numeric: tabular-nums; }
.out-options { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border); }
.out-options > span { margin-right: 2px; font-size: .78rem; font-weight: 800; }
.out-option { position: relative; }
.out-option input { position: absolute; opacity: 0; pointer-events: none; }
.out-option span { min-height: 36px; display: inline-flex; align-items: center; padding: 7px 11px; border: 1px solid var(--input-border); border-radius: 999px; color: var(--muted); background: var(--card); font-size: .72rem; font-weight: 700; cursor: pointer; }
.out-option input:checked + span { border-color: var(--raspberry); color: var(--raspberry); background: var(--pale-pink); }
.out-option input:focus-visible + span { outline: 2px solid var(--raspberry); outline-offset: 2px; }

.custom-item-section { display: grid; gap: 18px; margin: 42px 0 12px; padding: 28px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.custom-item-form { display: grid; grid-template-columns: 1.1fr 1fr 150px 100px auto; align-items: end; gap: 12px; }
.custom-item-form .button { min-height: 46px; }
.custom-items-list { display: grid; gap: 8px; }
.custom-item-row { min-height: 54px; display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 7px; background: var(--page); }
.custom-item-row strong, .custom-item-row span { display: block; }
.custom-item-row span { color: var(--muted); font-size: .78rem; }
.custom-item-row > span { color: var(--ink); font-weight: 800; }
.custom-item-row button { min-width: 44px; min-height: 44px; border: 0; color: var(--raspberry); background: transparent; font-weight: 800; cursor: pointer; }

.costco-summary {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 105;
  padding: 12px max(20px, calc((100vw - var(--max)) / 2));
  border-top: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 -12px 32px rgba(36, 16, 28, .09);
}
.costco-summary-main { display: grid; grid-template-columns: minmax(130px, .8fr) minmax(420px, 1.8fr) auto; align-items: center; gap: 22px; }
.summary-count { display: grid; gap: 2px; }
.summary-count strong { font-family: "Playfair Display", serif; font-size: 1.2rem; }
.summary-count span { color: var(--raspberry); font-size: .72rem; font-weight: 800; }
.costco-summary dl { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 0; }
.costco-summary dl div { display: grid; gap: 1px; }
.costco-summary dt { color: var(--muted); font-size: .7rem; }
.costco-summary dd { margin: 0; font-size: .95rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.costco-summary button { min-height: 46px; padding: 10px 20px; border: 0; border-radius: 6px; color: var(--card); background: var(--raspberry); font-weight: 800; cursor: pointer; }
.costco-summary button:disabled { cursor: not-allowed; opacity: .45; }
.costco-summary > p { margin: 8px 0 0; color: var(--muted); font-size: .7rem; text-align: center; }

.review-step { padding: 42px 0 72px; }
.review-step[hidden], .success-step[hidden] { display: none; }
.review-shell { max-width: 1050px; }
.review-back { min-height: 44px; margin-bottom: 20px; padding: 8px 0; border: 0; color: var(--raspberry); background: transparent; font-weight: 800; cursor: pointer; }
.review-header { margin-bottom: 28px; }
.review-header h1, .success-card h1 { margin: 0 0 9px; font-size: 2.6rem; line-height: 1.08; }
.review-header p:last-child { margin: 0; color: var(--muted); }
.review-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.review-order-card, .review-form { padding: 26px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); }
.review-order-card h2 { margin-bottom: 18px; font-size: 1.55rem; }
.review-items { display: grid; }
.review-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; padding: 13px 0; border-top: 1px solid var(--border); }
.review-item:first-child { border-top: 0; }
.review-item strong, .review-item span { display: block; }
.review-item span { margin-top: 3px; color: var(--muted); font-size: .76rem; }
.review-item > strong { font-variant-numeric: tabular-nums; }
.review-estimate { display: grid; gap: 8px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.review-estimate div { display: flex; justify-content: space-between; gap: 18px; }
.review-estimate .review-total { padding-top: 8px; border-top: 1px solid var(--border); font-weight: 800; }
.send-order-button { width: 100%; }
.costco-reviewing .costco-summary, .costco-complete .costco-summary { display: none; }
.costco-reviewing .costco-main, .costco-complete .costco-main { padding-bottom: 0; }
.success-step { min-height: 520px; padding: 70px 0; }
.success-card { max-width: 680px; margin: 0 auto; padding: 44px; border: 1px solid var(--border); border-radius: 8px; background: var(--card); text-align: center; }
.success-card p:not(.costco-eyebrow) { margin-bottom: 24px; color: var(--muted); }

@media (max-width: 767px) {
  .costco-order-page { padding-bottom: calc(var(--mobile-shell-tabs-height) + var(--mobile-shell-action-height) + var(--costco-summary-mobile) + env(safe-area-inset-bottom)) !important; }
  .costco-order-page.costco-reviewing, .costco-order-page.costco-complete { padding-bottom: calc(var(--mobile-shell-tabs-height) + var(--mobile-shell-action-height) + env(safe-area-inset-bottom)) !important; }
  .costco-hero { padding: 28px 0 24px; }
  .costco-hero h1 { font-size: 2.5rem; }
  .costco-hero p:last-child { font-size: .88rem; }
  .costco-toolbar { top: 62px; padding: 10px 0 7px; }
  .costco-toolbar .shell { width: 100%; }
  .costco-search { padding: 0 14px; }
  .category-chips { padding: 1px 14px 5px; }
  .category-chip { min-height: 44px; }
  .costco-catalog-shell { width: 100%; padding: 24px 14px 0; }
  .catalog-heading { display: grid; gap: 8px; margin-bottom: 18px; }
  .catalog-heading h2, .custom-item-section h2 { font-size: 1.7rem; }
  .catalog-heading p, .catalog-heading a { font-size: .82rem; }
  .catalog-groups { gap: 24px; }
  .catalog-group h3 { font-size: 1.25rem; }
  .product-row { padding: 15px 14px; }
  .product-main { grid-template-columns: minmax(0, 1fr) 132px; gap: 12px; }
  .product-price { grid-column: 1; grid-row: 2; text-align: left; }
  .product-price small { max-width: none; }
  .quantity-stepper { grid-column: 2; grid-row: 1 / span 2; justify-self: end; grid-template-columns: 44px 44px 44px; }
  .product-name { font-size: .9rem; line-height: 1.3; }
  .out-options { align-items: flex-start; }
  .out-options > span { width: 100%; }
  .out-option span { min-height: 40px; }
  .custom-item-section { margin-top: 28px; padding: 20px 16px; }
  .custom-item-form { grid-template-columns: 1fr 92px; }
  .custom-item-form .fg:nth-child(1), .custom-item-form .fg:nth-child(2), .custom-item-form .button { grid-column: 1 / -1; }
  .custom-item-form .custom-cost { grid-column: 1; }
  .custom-item-form .custom-quantity { grid-column: 2; }
  .custom-item-form .button { width: 100%; }
  .custom-item-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .costco-main { padding-bottom: calc(var(--costco-summary-mobile) + 22px); }
  .costco-summary { bottom: calc(var(--mobile-shell-tabs-height) + var(--mobile-shell-action-height) + env(safe-area-inset-bottom)); z-index: 108; padding: 9px 12px; }
  .costco-summary-main { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .summary-count { align-self: center; }
  .costco-summary dl { grid-column: 1 / -1; grid-row: 2; gap: 6px; }
  .costco-summary dl div { padding: 6px 7px; border-radius: 5px; background: var(--page); }
  .costco-summary button { grid-column: 2; grid-row: 1; min-height: 44px; padding-inline: 16px; }
  .costco-summary > p { margin-top: 6px; font-size: .62rem; line-height: 1.3; }
  .review-step { padding: 24px 0 38px; }
  .review-shell { width: calc(100% - 28px); }
  .review-header h1, .success-card h1 { font-size: 2rem; }
  .review-layout { grid-template-columns: 1fr; }
  .review-order-card, .review-form { padding: 18px; }
  .success-step { min-height: 430px; padding: 36px 0; }
  .success-card { padding: 28px 20px; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .costco-summary-main { grid-template-columns: minmax(110px, .7fr) minmax(360px, 1.8fr) auto; gap: 12px; }
  .review-layout { grid-template-columns: 1fr; }
}

@media (min-width: 768px) {
  .category-chips { flex-wrap: wrap; overflow: visible; }
}

@media (prefers-reduced-motion: reduce) {
  .costco-toolbar { backdrop-filter: none; }
}
