/* ═══════════════════════════════════════════════════════════════════════
   Checkout + order confirmation — scoped under .page-checkout.

   Loaded only for $page_type 'checkout' and 'order-confirmation'. Both
   pages carry `page-inner page-checkout` on <body> (confirmation adds
   `page-confirm`), so they inherit every .page-inner reset from
   pages-v2.css — the sticky-header prerequisites, padding-top:0,
   overflow-x:clip, hidden WhatsApp float — and the
   --v2-* design tokens. This file adds only checkout-specific rules and
   deliberately re-uses the cart page's visual language.

   ── CONFLICT AUDIT against assets/css/style.css ──────────────────────
   No `.co-*`, `.page-checkout` or `.oc-*` selector exists in style.css, so
   nothing here is in a specificity fight. The globals that DO reach this
   markup:
     * `a { color: inherit; text-decoration: none }`  — wanted.
     * `img { max-width:100%; height:auto }`          — wanted.
     * `@media (max-width:768px) { input, textarea, select, button
        { font-size:16px } }` — wanted (stops iOS zooming on focus); the
        field rule is !important there, so it wins over the 15px below.
     * `.form-group input|select|textarea` — scoped to the bulk-order modal's
        own class, which this markup does not use. No overlap.
   The only !important rules below are the ones that fight `.page-inner .page`
   padding from pages-v2.css and the `[hidden]` display battle, where
   `display:grid`/`flex` on the same element would otherwise beat it.
   ═══════════════════════════════════════════════════════════════════════ */

/* pages-v2.css sets `.page-inner .page { padding: 0 5% !important }`, which
   zeroed this; the extra specificity lets the bottom space win. */
.page-inner.page-checkout main.page.checkout-page,
.page-inner.page-checkout main.page.confirm-page { padding-bottom: 72px !important; }

.page-checkout .co-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* An element that is BOTH a flex/grid container and [hidden] would otherwise
   stay visible: the display declaration wins over the UA `[hidden]` rule. */
.page-checkout [hidden] { display: none !important; }

/* ── Layout ─────────────────────────────────────────────────────────── */
.page-checkout .co-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.page-checkout .co-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
/* style.css gives every <section> margin: 60px 0; the cards are <section>s,
   so that stacked 120px gaps on top of the 16px column gap. */
.page-checkout section.co-card { margin: 0 !important; }

/* ── Cards ──────────────────────────────────────────────────────────── */
.page-checkout .co-card {
  background: var(--v2-bg);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius);
  padding: 22px;
}
.page-checkout .co-card-title {
  font-family: var(--v2-font-accent);
  font-size: 17px;
  font-weight: 700;
  color: var(--v2-dark);
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}
.page-checkout .co-card-hint {
  font-size: 13px;
  color: var(--v2-text-light);
  margin: 0 0 16px;
}
.page-checkout .co-card-title + .co-field,
.page-checkout .co-card-title + .co-row { margin-top: 14px; }

/* ── Fields ─────────────────────────────────────────────────────────── */
.page-checkout .co-field { display: flex; flex-direction: column; min-width: 0; }
.page-checkout .co-field + .co-field { margin-top: 14px; }

.page-checkout .co-field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--v2-dark);
  margin-bottom: 6px;
}
.page-checkout .co-req { color: var(--v2-orange); }
.page-checkout .co-opt { color: var(--v2-text-muted); font-weight: 500; }

.page-checkout .co-field input,
.page-checkout .co-field select,
.page-checkout .co-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 14px;
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius-sm);
  background: var(--v2-bg);
  font-family: var(--v2-font);
  font-size: 15px;   /* phones: 16px from style.css (stops iOS focus zoom) */
  color: var(--v2-text);
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}
.page-checkout .co-field select {
  /* Chevron, since appearance:none removes the native one. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5 6 6.5l5-5' stroke='%23666' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.page-checkout .co-field textarea { resize: vertical; min-height: 84px; }

.page-checkout .co-field input:focus,
.page-checkout .co-field select:focus,
.page-checkout .co-field textarea:focus {
  outline: none;
  border-color: var(--v2-orange);
  box-shadow: 0 0 0 3px rgba(255, 107, 0, 0.12);
}
.page-checkout .co-field input.is-invalid,
.page-checkout .co-field select.is-invalid,
.page-checkout .co-field textarea.is-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

.page-checkout .co-hint {
  font-size: 12px;
  color: var(--v2-text-muted);
  margin: 6px 0 0;
}
.page-checkout .co-err {
  font-size: 12.5px;
  font-weight: 600;
  color: #dc2626;
  margin: 6px 0 0;
}

.page-checkout .co-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.page-checkout .co-row-3 { grid-template-columns: 0.9fr 1.1fr 1fr; }   /* PIN, City, State */
/* Fields side by side share one top line; the grid gap spaces them when they stack. */
.page-checkout .co-row > .co-field + .co-field { margin-top: 0; }
.page-checkout .co-row + .co-row,
.page-checkout .co-field + .co-row,
.page-checkout .co-row + .co-field { margin-top: 14px; }

/* ── Billing checkbox ───────────────────────────────────────────────── */
.page-checkout .co-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--v2-dark);
  cursor: pointer;
  margin-top: 6px;
}
.page-checkout .co-check input {
  width: 18px; height: 18px;
  accent-color: var(--v2-orange);
  cursor: pointer;
  flex-shrink: 0;
}
.page-checkout .co-billing-fields { margin-top: 18px; }
.page-checkout .co-remind { margin-top: 16px; font-weight: 500; }

/* ── Summary ────────────────────────────────────────────────────────── */
.page-checkout .co-summary {
  background: var(--v2-bg-soft);
  border: 1px solid var(--v2-border);
  border-radius: var(--v2-radius);
  padding: 22px;
  position: sticky;
  top: 96px;
}
.page-checkout .co-summary-title {
  font-family: var(--v2-font-accent);
  font-size: 17px;
  font-weight: 700;
  color: var(--v2-dark);
  margin: 0 0 14px;
}

.page-checkout .co-sum-items {
  list-style: none;
  margin: 0 0 14px;
  padding: 0 0 14px;
  border-bottom: 1px solid var(--v2-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
}
.page-checkout .co-sum-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
}
.page-checkout .co-sum-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.page-checkout .co-sum-item-name { font-weight: 600; color: var(--v2-dark); }
.page-checkout .co-sum-item-name:hover { color: var(--v2-orange); }
.page-checkout .co-sum-item-qty { font-size: 12px; color: var(--v2-text-light); }
.page-checkout .co-sum-custs { display: flex; flex-direction: column; gap: 1px; margin-top: 3px; }
.page-checkout .co-sum-cust { font-size: 11.5px; color: var(--v2-text-muted); }
.page-checkout .co-sum-item-total { font-weight: 700; color: var(--v2-dark); white-space: nowrap; }

.page-checkout .co-sum-rows { margin: 0; padding: 0; }
.page-checkout .co-sum-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: 14px;
  color: var(--v2-text);
  padding: 5px 0;
}
.page-checkout .co-sum-row dt,
.page-checkout .co-sum-row dd { margin: 0; white-space: nowrap; flex: 0 0 auto; }
/* The label wraps (a long offer name), the amount stays on one line. */
.page-checkout .co-sum-row dt { min-width: 0; white-space: normal; flex: 1 1 auto; }
.page-checkout .co-sum-row dd { font-weight: 600; }
.page-checkout .co-sum-row-muted { color: var(--v2-text-light); }
.page-checkout .co-sum-qty { font-size: 12px; color: var(--v2-text-muted); font-weight: 500; }

.page-checkout .co-ship-hint {
  font-size: 12.5px;
  color: var(--v2-green);
  font-weight: 600;
  margin: 6px 0 0;
}

.page-checkout .co-sum-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--v2-border);
  font-family: var(--v2-font-accent);
  font-size: 15px;
  font-weight: 700;
  color: var(--v2-dark);
}
.page-checkout .co-sum-total strong { font-size: 22px; letter-spacing: -0.02em; }

/* ── Notices ────────────────────────────────────────────────────────── */
.page-checkout .co-notice {
  border-radius: var(--v2-radius-sm);
  padding: 12px 14px;
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.5;
}
.page-checkout .co-notice-msg { margin: 0; }
.page-checkout .co-notice-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-weight: 600;
}
.page-checkout .co-notice-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  font-weight: 600;
}
.page-checkout .co-notice-info {
  background: var(--v2-orange-light);
  border: 1px solid #ffd9bd;
  color: #9a4b00;
}
/* Phase 5 — "payment received". The one notice variant that is GREEN, because
   it is the only one on these pages that means money arrived and the customer
   has nothing left to do. Amber (warn) would read as "action needed". */
.page-checkout .co-notice-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  font-weight: 600;
}
.page-checkout .co-notice .co-btn { margin-top: 10px; width: auto; }

/* ── Buttons ────────────────────────────────────────────────────────── */
.page-checkout .co-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-family: var(--v2-font);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.page-checkout .co-btn-primary { background: var(--v2-gradient); color: #fff; }
.page-checkout .co-btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(255, 107, 0, 0.28);
}
.page-checkout .co-btn-primary:focus:not(:hover),
.page-checkout .co-btn-primary:active:not(:hover) { transform: none; box-shadow: none; }
.page-checkout .co-btn:disabled,
.page-checkout .co-btn[disabled] { opacity: 0.6; cursor: not-allowed; transform: none; }
.page-checkout .co-btn-outline {
  background: transparent;
  border: 1.5px solid var(--v2-border);
  color: var(--v2-dark);
}
.page-checkout .co-btn-outline:hover { border-color: var(--v2-orange); color: var(--v2-orange); }
.page-checkout .co-btn-wa { background: #25D366; color: #fff; }
.page-checkout .co-btn-wa:hover { background: #1fb457; }
.page-checkout .co-btn-wa svg { width: 18px; height: 18px; flex-shrink: 0; }

.page-checkout .co-place-btn { margin-top: 16px; }

.page-checkout .co-btn-spinner {
  width: 15px; height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: co-spin 0.7s linear infinite;
}
@keyframes co-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .page-checkout .co-btn-spinner { animation-duration: 2s; }
  .page-checkout .co-btn-primary:hover:not(:disabled) { transform: none; }
}

.page-checkout .co-pay-note {
  font-size: 12.5px;
  color: var(--v2-text-light);
  line-height: 1.55;
  margin: 12px 0 0;
  text-align: center;
}
.page-checkout .co-back-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--v2-text-light);
}
.page-checkout .co-back-link:hover { color: var(--v2-orange); }

/* ── Loading / empty ────────────────────────────────────────────────── */
.page-checkout .co-loading { display: flex; flex-direction: column; gap: 16px; }
.page-checkout .co-skel {
  background: linear-gradient(90deg, #f0f0f0 25%, #e6e6e6 37%, #f0f0f0 63%);
  background-size: 400% 100%;
  animation: co-shimmer 1.4s ease infinite;
  border-radius: var(--v2-radius);
}
.page-checkout .co-skel-block { height: 180px; }
@keyframes co-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) {
  .page-checkout .co-skel { animation: none; }
}

.page-checkout .co-empty { text-align: center; padding: 40px 20px 80px; }
.page-checkout .co-empty-text { color: var(--v2-text-light); font-size: 14px; margin: 0 0 20px; }
.page-checkout .co-empty .co-btn { width: auto; padding: 13px 30px; }

/* ═══════════════════════════════════════════════════════════════════════
   ORDER CONFIRMATION (.page-confirm)
   ═══════════════════════════════════════════════════════════════════════ */
.page-confirm .oc-hero {
  text-align: center;
  padding: 10px 0 30px;
}
.page-confirm .oc-tick {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.12);
  color: var(--v2-green);
  display: flex; align-items: center; justify-content: center;
}
.page-confirm .oc-tick svg { width: 26px; height: 26px; }

.page-confirm .oc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: start;
}

.page-confirm .oc-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.page-confirm .oc-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--v2-border);
}
.page-confirm .oc-item:last-child { border-bottom: none; padding-bottom: 0; }
.page-confirm .oc-item-name { font-weight: 700; color: var(--v2-dark); font-size: 15px; }
.page-confirm .oc-item-meta { font-size: 12.5px; color: var(--v2-text-light); margin-top: 2px; }
.page-confirm .oc-item-total { font-weight: 700; white-space: nowrap; }
.page-confirm .oc-custs { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.page-confirm .oc-cust { font-size: 12.5px; color: var(--v2-text-light); }
.page-confirm .oc-cust-key { font-weight: 600; color: var(--v2-text); }
.page-confirm .oc-cust img {
  height: 40px; width: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.12);
  vertical-align: middle;
  display: inline-block;
}

.page-confirm .oc-addr { font-size: 13.5px; line-height: 1.7; color: var(--v2-text); margin: 0; }
.page-confirm .oc-addr-name { font-weight: 700; color: var(--v2-dark); }
.page-confirm .oc-note {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--v2-text);
  background: var(--v2-bg-soft);
  border-radius: var(--v2-radius-sm);
  padding: 12px 14px;
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 980px) {
  .page-checkout .co-layout,
  .page-confirm .oc-layout { grid-template-columns: minmax(0, 1fr); }
  .page-checkout .co-summary { position: static; top: auto; }
  /* Summary first on narrow screens: a shopper should see what they are
     paying for before they start typing an address. */
  .page-checkout .co-summary { order: -1; }
  .page-checkout .co-layout { display: flex; flex-direction: column; }
}

@media (max-width: 600px) {
  .page-checkout .co-row,
  .page-checkout .co-row-3 { grid-template-columns: minmax(0, 1fr); }
  .page-checkout .co-card { padding: 18px; }
  .page-checkout .co-summary { padding: 18px; }

  /* MOBILE SUMMARY ORDER.
     The summary already sits above the form on narrow screens, but in source
     order it reads: title -> item list -> subtotal/shipping rows -> TOTAL.
     On a phone that puts the one number the customer actually wants — what
     they will pay — below a list they have to scroll past, so it reads as
     "fill the address first, find the price later".

     Reordering the flex children puts the total immediately under the title.
     The breakdown and the item list stay, just after it, for anyone who wants
     to check. Source order is unchanged, so the DOM still reads
     title -> items -> rows -> total for a screen reader. */
  .page-checkout .co-summary { display: flex; flex-direction: column; }
  .page-checkout .co-summary-title { order: 0; }
  .page-checkout .co-sum-total     { order: 1; margin-top: 0; }
  .page-checkout .co-sum-rows      { order: 2; }
  .page-checkout .co-ship-hint     { order: 3; }
  .page-checkout .co-sum-items     { order: 4; }
  /* Alerts and the button must stay last — a price-change warning above the
     total would be read as part of the total. */
  .page-checkout .co-notice        { order: 5; }
  .page-checkout .co-place-btn     { order: 6; }
  .page-checkout .co-pay-note      { order: 7; }
  .page-checkout .co-back-link     { order: 8; }

  .page-checkout .co-sum-total {
    font-size: 14px;
    padding-bottom: 10px;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--v2-border, #e5e5e5);
  }
  .page-checkout .co-sum-total strong { font-size: 22px; }

  /* A long cart must not push the form off the screen. */
  .page-checkout .co-sum-items {
    max-height: 132px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* ── PINNED PAY BAR ────────────────────────────────────────────────
     The button lives inside the summary, and the summary sits ABOVE the
     form on mobile. Left alone that forces the worst possible flow:
     read the total, scroll down through the whole address form, then
     scroll all the way back UP to commit.

     Pinning it to the bottom of the viewport means the action is always
     one tap away, and the amount rendered into .co-btn-amount keeps the
     figure visible at the moment of committing even though the summary
     has long scrolled off screen.

     form="coForm" on the button is what makes this legal — a fixed bar is
     no longer a descendant of the form, and without that attribute the
     submit would do nothing. */
  /* The same bar as the cart: a white strip at the bottom with the
     rounded button in it (the strip is body::after below). */
  .page-checkout .co-place-btn {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 60;
    width: auto;
    margin: 0;
    border-radius: 12px;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 16px;
    padding: 0 16px;
    box-shadow: none;
  }
  body.page-checkout:has(.co-layout:not([hidden]))::after {
    content: ""; position: fixed; left: 0; right: 0; bottom: 0; z-index: 59;
    height: calc(92px + env(safe-area-inset-bottom, 0px));
    background: #fff; border-top: 1px solid var(--v2-border, #e5e5e5); box-shadow: 0 -6px 18px rgba(0,0,0,0.06);
  }
  .page-checkout .co-btn-amount {
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.2px;
  }
  .page-checkout .co-btn-amount:empty { display: none; }

  /* Room under the footer so the pinned bar never covers its links. */
  .page-checkout footer.footer { padding-bottom: calc(98px + env(safe-area-inset-bottom, 0px)) !important; }
  /* The trust line sits in the bar, above the button; the long note and
     Back to cart are not needed here (the header cart icon goes back). */
  .page-checkout .co-paybar-trust {
    display: flex; align-items: center; justify-content: center; gap: 5px;
    position: fixed; left: 12px; right: 12px; z-index: 60; margin: 0;
    bottom: calc(66px + env(safe-area-inset-bottom, 0px));
    font-size: 11.5px; color: var(--v2-text-light, #666);
  }
  .page-checkout .co-paybar-trust svg { color: #15803d; flex-shrink: 0; }
  .page-checkout .co-paybar-trust ~ .co-pay-note,
  .page-checkout .co-paybar-trust ~ .co-back-link { display: none !important; }

  /* Like an app: a light grey page with flat white sections (as the cart). */
  body.page-checkout { background: #f6f3ef; }
  .page-checkout .checkout-page { padding: 0 0 12px !important; }
  body.page-checkout .co-bar-head { margin: 0 0 8px; padding: 10px 16px; border-bottom: 0; }   /* body: beats the desktop rule at the end */
  .page-checkout .co-layout { gap: 8px; }
  .page-checkout .co-card, .page-checkout .co-summary { border: 0; border-radius: 0; padding: 16px; box-shadow: none; background: #fff; }

  /* The note and the back link read as part of the summary on desktop; under
     a pinned bar they are just clutter above the fold. */
  .page-checkout .co-pay-note { font-size: 12px; margin-top: 10px; }
}

/* ── Collapsible summary: MOBILE ────────────────────────────────────── */
@media (max-width: 600px) {
  .page-checkout .co-sum-toggle {
    order: 0;                      /* first thing in the summary card */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 14px 0;
    margin: 0;
    background: none;
    border: 0;
    font: inherit;
    color: inherit;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  /* No outline after a tap (focus comes back here when the sheet closes);
     keyboard users get the orange ring. */
  .page-checkout .co-sum-toggle:focus, .page-checkout .co-sheet-close:focus, .page-checkout .co-sum-body:focus { outline: none; }
  .page-checkout .co-sum-toggle:focus-visible, .page-checkout .co-sheet-close:focus-visible { outline: 2px solid #ff6b00; outline-offset: 2px; border-radius: 8px; }
  .page-checkout .co-sheet-close, .page-checkout .co-sheet-bg { -webkit-tap-highlight-color: transparent; }
  .page-checkout .co-sum-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--v2-text-light, #666);
  }
  .page-checkout .co-sum-toggle-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
  .page-checkout .co-sum-toggle-amount {
    font-size: 20px;
    font-weight: 800;
    color: var(--v2-dark, #0a0a0a);
  }
  /* Chevron drawn in CSS — no icon font, no extra request. */
  .page-checkout .co-sum-toggle-caret {
    width: 9px; height: 9px;
    border-right: 2px solid var(--v2-text-light, #666);
    border-bottom: 2px solid var(--v2-text-light, #666);
    /* Open: points up (tap to close). */
    transform: rotate(-135deg) translate(-2px, -2px);
    transition: transform 0.2s ease;
  }
  /* Closed: points down (tap to open). */
  .page-checkout .co-sum-collapsed .co-sum-toggle-caret {
    transform: rotate(45deg) translate(-2px, -2px);
  }

  /* The heading and the standalone total are redundant once the toggle
     carries both the label and the amount. */
  .page-checkout .co-summary-title { display: none; }
  .page-checkout .co-sum-total     { display: none; }

  /* Open: a bottom sheet over the page. Only transform and opacity
     animate (no layout per frame), so it is smooth on iPhones; the page
     behind does not move. Closed, it is off screen and hidden from
     screen readers. */
  html.co-sheet-open, html.co-sheet-open body { overflow: hidden !important; }
  .page-checkout .co-sum-body {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 3001;
    max-height: 80vh; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
    padding: 6px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    background: #fff; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,0.12);
    transform: translateY(0); visibility: visible;
    transition: transform 0.32s cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
    will-change: transform;
  }
  .page-checkout .co-sum-collapsed .co-sum-body {
    transform: translateY(105%); visibility: hidden;
    transition: transform 0.24s cubic-bezier(0.4, 0, 1, 1), visibility 0s linear 0.24s;
  }
  .page-checkout .co-sheet-bg {
    position: fixed; inset: 0; z-index: 3000; background: rgba(20,14,8,0.45);
    opacity: 1; visibility: visible; transition: opacity 0.25s ease, visibility 0s;
  }
  .page-checkout .co-sum-collapsed .co-sheet-bg { opacity: 0; visibility: hidden; transition: opacity 0.2s ease, visibility 0s linear 0.2s; }
  .page-checkout .co-sheet-head { display: flex; align-items: center; justify-content: space-between; position: relative; padding: 14px 0 10px; border-bottom: 1px solid var(--v2-border, #e5e5e5); margin-bottom: 8px; }
  .page-checkout .co-sheet-head strong { font-size: 16px; color: var(--v2-dark, #0a0a0a); }
  .page-checkout .co-sheet-grip { position: absolute; left: 50%; top: 2px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #e5ddd4; }
  .page-checkout .co-sheet-close { width: 40px; height: 40px; margin-right: -8px; display: flex; align-items: center; justify-content: center; border: 0; background: none; color: var(--v2-text-light, #666); cursor: pointer; }
  /* In the sheet the whole item list shows (it scrolls with the sheet). */
  .page-checkout .co-sum-body .co-sum-items { max-height: none; overflow: visible; }

  /* Same padding open or closed: opening it must not shift the block (the
     offer card and this row stay put; only the item list appears below). */
}

/* ── Collapsible summary: DESKTOP ───────────────────────────────────── */
@media (min-width: 601px) {
  .page-checkout .co-btn-amount  { display: none; }
  .page-checkout .co-sum-toggle  { display: none; }
  /* Forced visible so a collapsed class left over from a narrow viewport
     can never hide the summary on a wide one. */
  .page-checkout .co-sum-body    { display: block !important; }
  .page-checkout .co-sheet-bg, .page-checkout .co-sheet-head { display: none; }
}

/* Automatic order-value offer (server-computed) */
.page-checkout .co-sum-row-offer dd { color: var(--v2-green); font-weight: 600; }
.page-checkout .co-sum-row-offer[hidden] { display: none; }

/* ═══════════ "You save" strip (as the cart), MRP prices, free delivery ═══════════ */
.page-checkout .co-save { display: flex; align-items: stretch; overflow: hidden; margin: 0 0 14px; background: #fff; border: 1px solid #cfe5d8; border-radius: 10px; }
.page-checkout .co-save[hidden], .page-checkout .co-save-line[hidden] { display: none; }
.page-checkout .co-save-stub { position: relative; flex: 0 0 72px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 6px 4px; background: #12834a; color: #fff; }
.page-checkout .co-save-stub::after {   /* perforated edge */
  content: ''; position: absolute; right: -5px; top: 0; bottom: 0; width: 10px;
  background: radial-gradient(circle at 5px 5px, #fff 3.5px, transparent 4px) 0 0 / 10px 10px repeat-y;
}
.page-checkout .co-save-stub strong { font-family: var(--v2-font-accent); font-size: 16px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.page-checkout .co-save-stub span { margin-top: 1px; font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; opacity: .9; }
.page-checkout .co-save-body { flex: 1; min-width: 0; padding: 8px 12px 8px 16px; display: flex; flex-direction: column; justify-content: center; }
.page-checkout .co-save-title { margin: 0; font-size: 13.5px; font-weight: 700; line-height: 1.3; color: var(--v2-dark); }
.page-checkout .co-save-line { display: flex; align-items: center; gap: 5px; margin: 3px 0 0; font-size: 11.5px; font-weight: 600; line-height: 1.3; color: #0b6e3a; }
.page-checkout .co-save-line svg { width: 14px; height: 14px; flex: 0 0 14px; }
.page-checkout .co-sum-item-total { text-align: right; }
.page-checkout .co-sum-was { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 3px; }
.page-checkout .co-sum-was s { font-size: 12px; font-weight: 400; color: var(--v2-text-muted); }
.page-checkout .co-sum-off { background: #e8f6ee; color: #0b6e3a; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 2px 5px; border-radius: 4px; }
.page-checkout .co-sum-row-offer dt, .page-checkout .co-sum-row-offer dd { color: #0b6e3a; }
.page-checkout .co-sum-row.is-free dd { color: #0b6e3a; font-weight: 600; }
.page-checkout .co-sum-row.is-free dd s { color: var(--v2-text-muted); font-weight: 400; margin-right: 2px; }
.page-checkout .co-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
  /* The summary column reorders children on phones; keep the strip first. */
  .page-checkout .co-save { order: -1; margin: 0 0 4px; }
}
@media (prefers-reduced-motion: reduce) {
  .page-checkout .co-sum-body, .page-checkout .co-sum-collapsed .co-sum-body,
  .page-checkout .co-sheet-bg, .page-checkout .co-sum-collapsed .co-sheet-bg { transition: none; }
}

/* Follow / share strip under "Thank you" */
.page-confirm .oc-love {
  margin: 28px 0 0; padding: 20px 22px; border: 1px solid var(--v2-border); border-radius: var(--v2-radius, 14px); background: #fff;
}
.page-confirm .oc-love-title { margin: 0; font-family: var(--v2-font-accent); font-size: 17px; font-weight: 700; color: var(--v2-dark); }
.page-confirm .oc-love-text { margin: 6px 0 14px; font-size: 14px; line-height: 1.55; color: var(--v2-text); }
.page-confirm .oc-love-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; max-width: 520px; }
.page-confirm .oc-love-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 14px;
  border: 1px solid var(--v2-border); border-radius: 10px; background: #fff;
  font-size: 14px; font-weight: 600; color: var(--v2-dark); text-decoration: none; white-space: nowrap;
}
.page-confirm .oc-love-btn svg { flex: none; color: #c2560a; }
.page-confirm .oc-love-btn:hover, .page-confirm .oc-love-btn:focus-visible { border-color: #ff6b00; color: #c24f00; }

/* App bar (pages-v2.css .app-bar) above the form, in the page's width. */
.page-checkout .co-bar-head { margin: 0 0 20px; padding-left: 0; padding-right: 0; }

/* The bar's trust line is for phones only. */
@media (min-width: 601px) { .page-checkout .co-paybar-trust { display: none; } }

/* "Questions? WhatsApp us" in the checkout heading. */
.page-checkout .co-bar-head .app-count a { color: #15803d; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* Phones: .co-layout is a column flex with align-items:start, so every
   block in it (form, summary) must stretch, or it shrinks to its longest
   line of text and leaves a grey strip on the right. */
@media (max-width: 600px) {
  .page-checkout .co-layout > * { align-self: stretch; width: auto; min-width: 0; }
}

/* ═══════════ Phones: checkout as an app screen ═══════════
   The site header and offer ticker give way to a slim sticky app bar
   (back, title, WhatsApp) on checkout and on the order page; on checkout
   the page title block and section hints go, and the summary row is
   compact. */
.page-checkout .co-appbar { display: none; }
@media (max-width: 600px) {
  body.page-checkout > header,
  body.page-checkout .ann-bar { display: none !important; }
  .page-checkout .co-appbar {
    position: sticky; top: 0; z-index: 70;
    display: flex; align-items: center; gap: 4px;
    height: 54px; padding: 0 6px; margin: 0 0 8px;
    background: #fff; border-bottom: 1px solid #eee7e0;
  }
  .page-checkout .co-appbar-btn {
    flex: none; width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--v2-dark, #0a0a0a); -webkit-tap-highlight-color: transparent;
  }
  .page-checkout .co-appbar-btn:active { background: #f3eee9; }
  .page-checkout .co-appbar-wa { color: #15803d; }
  .page-checkout .co-appbar-title { flex: 1; font-size: 18px; font-weight: 700; color: var(--v2-dark, #0a0a0a); }
  body.page-checkout .co-bar-head { display: none; }
  body.page-checkout:not(.page-confirm) .co-card-hint { display: none; }
  body.page-checkout:not(.page-confirm) .co-summary { padding-top: 2px; padding-bottom: 2px; }
}
@media (max-width: 600px) {
  /* One left/right edge for everything: the pinned bar lines up with the
     16px content edge, and each section title keeps the same gap to its
     first field as the fields keep to each other. */
  .page-checkout .co-place-btn,
  .page-checkout .co-paybar-trust { left: 16px; right: 16px; }
  .page-checkout .co-card > .co-card-title { margin-bottom: 16px; }
  .page-checkout .co-card-title + .co-field,
  .page-checkout .co-card-title + .co-row { margin-top: 0; }
  .page-checkout .co-appbar { padding: 0 4px; }
  .page-checkout .co-appbar-title { margin-left: 2px; }
}

/* Order confirmation on phones. The checkout's collapsible-summary rules
   above (hidden title and total, reordered children) are for the checkout
   form only; here the summary is a plain receipt in source order, so the
   customer always sees "Order total" and the Total they paid. */
@media (max-width: 600px) {
  body.page-confirm .co-summary > * { order: 0; }
  body.page-confirm .co-summary-title { display: block; }
  body.page-confirm .co-sum-total {
    display: flex; font-size: 15px; margin: 12px 0 0; padding: 12px 0 0;
    border-bottom: 0; border-top: 1px solid var(--v2-border);
  }
}

/* ═══════════ Order page: hero, tracker, items, payment ═══════════ */
.page-confirm .oc-title { margin: 0; font-family: var(--v2-font-accent); font-size: 26px; font-weight: 700; color: var(--v2-dark); letter-spacing: -0.01em; }
.page-confirm .oc-sub { margin: 8px 0 0; font-size: 14px; color: var(--v2-text-light); }
.page-confirm .oc-sub strong { color: var(--v2-dark); font-weight: 700; }

.page-confirm .oc-status-kicker { margin: 0 0 4px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--v2-text-light); }
.page-confirm .oc-status-title { margin: 0; font-family: var(--v2-font-accent); font-size: 20px; font-weight: 700; color: #15803d; }
.page-confirm .oc-status.is-closed .oc-status-title { color: var(--v2-dark); }
.page-confirm .oc-status-text { margin: 6px 0 0; font-size: 14px; line-height: 1.55; color: var(--v2-text); }
.page-confirm .oc-track { margin: 14px 0 0; padding: 12px 14px; border-radius: 10px; background: #f6f3ef; display: flex; flex-direction: column; gap: 2px; }
.page-confirm .oc-track-label { font-size: 12.5px; color: var(--v2-text-light); }
.page-confirm .oc-track-no { font-size: 16px; color: var(--v2-dark); letter-spacing: .02em; user-select: all; overflow-wrap: anywhere; }
.page-confirm .oc-track-btn {
  margin-top: 14px; width: 100%; max-width: 360px; display: flex; align-items: center; justify-content: center; gap: 6px; height: 44px;
  border-radius: 10px; background: var(--v2-orange, #ff6b00); color: #fff; font-weight: 700; font-size: 15px; text-decoration: none;
}
.page-confirm .oc-track-btn:hover, .page-confirm .oc-track-btn:focus-visible { color: #fff; filter: brightness(.95); }

/* Vertical stepper: a line runs through the dots; done = green tick,
   current = orange ring, upcoming = grey. */
.page-confirm .oc-steps { list-style: none; margin: 18px 0 0; padding: 0; }
.page-confirm .oc-step {
  position: relative; display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center;
  column-gap: 12px; min-height: 26px; padding: 0 0 18px; color: var(--v2-text-light); font-size: 14px;
}
.page-confirm .oc-step:last-child { padding-bottom: 0; }
.page-confirm .oc-step::before {
  content: ""; position: absolute; left: 10px; top: 22px; bottom: -2px; width: 2px; background: #e7e1db;
}
.page-confirm .oc-step:last-child::before { display: none; }
.page-confirm .oc-step.is-done::before { background: #16a34a; }
.page-confirm .oc-step-dot {
  position: relative; z-index: 1; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; border: 2px solid #d9d2cb; box-sizing: border-box;
}
.page-confirm .oc-step.is-done .oc-step-dot { background: #16a34a; border-color: #16a34a; }
.page-confirm .oc-step.is-done .oc-step-dot::after {
  content: ""; position: absolute; left: 6px; top: 3px; width: 5px; height: 9px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
.page-confirm .oc-step.is-current .oc-step-dot { border-color: #ff6b00; box-shadow: 0 0 0 4px #ffe8d6; background: #ff6b00; }
.page-confirm .oc-step.is-done, .page-confirm .oc-step.is-current { color: var(--v2-dark); }
.page-confirm .oc-step.is-current .oc-step-label { font-weight: 700; }
.page-confirm .oc-step-date { font-size: 12.5px; color: var(--v2-text-light); white-space: nowrap; }

/* Items with a product photo. */
.page-confirm .oc-item { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.page-confirm .oc-item-img { width: 64px; height: 64px; border-radius: 10px; background: #f3ede7; overflow: hidden; display: block; }
.page-confirm .oc-item-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-confirm .oc-item-body { min-width: 0; }

.page-confirm .oc-contact { margin: 12px 0 0; font-size: 13.5px; line-height: 1.7; color: var(--v2-text); overflow-wrap: anywhere; }
.page-confirm .oc-contact span { display: inline-block; min-width: 52px; color: var(--v2-text-light); }
.page-confirm .oc-paid { margin: 10px 0 0; font-size: 13px; font-weight: 600; color: var(--v2-text-light); text-align: right; }
.page-confirm .oc-paid.is-paid { color: #15803d; }

@media (max-width: 600px) {
  body.page-confirm { background: #f6f3ef; }
  .page-confirm .oc-hero { margin: 0 0 8px; padding: 20px 16px; background: #fff; }
  .page-confirm .oc-title { font-size: 22px; }
  .page-confirm .co-notice { margin: 0 0 8px !important; border-radius: 0; }
  .page-confirm .oc-layout { gap: 8px; }
  .page-confirm .co-form { gap: 8px; }
  /* Receipt order on phones: status, items, address, then payment. */
  body.page-confirm .co-summary { order: 0; }
  .page-confirm .co-card, .page-confirm .co-summary { border: 0; border-radius: 0; padding: 16px; box-shadow: none; background: #fff; }
  .page-confirm .oc-love { margin: 8px 0 0; padding: 16px; border: 0; border-radius: 0; }
  .page-confirm .oc-love-btns { max-width: none; }
  /* No pinned pay bar here (that room is for checkout), and the bottom tab
     bar has its own spacer: keep the page end and footer tight. */
  .page-inner.page-checkout.page-confirm main.page.confirm-page { padding: 0 0 8px !important; }   /* beats line 31 */
  body.page-confirm footer.footer { padding-bottom: 20px !important; }
}

/* Order page cross-sell row: the product page's More gifts design. Desktop:
   the shared card (product-card.css) in a row with arrows, 4 across. */
.page-confirm .oc-more-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.page-confirm .oc-more-head .co-card-title { margin: 0 !important; }
.page-confirm .oc-more-all { font-size: 14px; font-weight: 700; color: #cc4d00; text-decoration: none; white-space: nowrap; }
.page-confirm .oc-more .products-carousel {
  display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px;
  scroll-snap-type: x mandatory; scrollbar-width: none;
}
.page-confirm .oc-more .products-carousel::-webkit-scrollbar { display: none; }
.page-confirm .oc-more .products-carousel > * { flex: 0 0 calc((100% - 42px) / 4); scroll-snap-align: start; }
.page-confirm .oc-more-note { margin: 12px 0 0; font-size: 13px; color: var(--v2-text-light); }
/* Phones: banner cards (product-card.css shows .fb-track at 640px and
   below), edge to edge across the section's own side padding. */
.page-confirm .oc-more { --fb-px: 22px; }
@media (max-width: 640px) {
  .page-confirm #ocMoreWrap { display: none; }
}
@media (max-width: 600px) {
  .page-confirm .oc-more { --fb-px: 16px; }
}

/* ── "Leaving checkout?" sheet (checkout.js) ──────────────────────────
   A native <dialog>: showModal() gives the backdrop, Escape and focus.
   Centred card on desktop, bottom sheet on phones. style.css has no
   dialog or .co-leave rule. */
.page-checkout .co-leave {
  border: 0;
  padding: 24px;
  width: min(400px, calc(100% - 32px));
  max-width: none;
  margin: auto;            /* a global reset removes the UA centring */
  outline: none;           /* the box itself takes focus on open (checkout.js) */
  border-radius: var(--v2-radius);
  background: #fff;
  color: var(--v2-dark);
  font-family: var(--v2-font);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.page-checkout .co-leave::backdrop { background: rgba(10, 10, 10, 0.45); }
.page-checkout .co-leave-title {
  margin: 0 0 8px;
  font-family: var(--v2-font-accent);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--v2-dark);
}
.page-checkout .co-leave-text {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--v2-text-light);
}
.page-checkout .co-leave-actions { display: flex; flex-direction: column; gap: 10px; }
.page-checkout .co-leave-go {
  padding: 8px;
  border: 0;
  background: none;
  font-family: var(--v2-font);
  font-size: 14px;
  font-weight: 600;
  color: var(--v2-text-light);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.page-checkout .co-leave-go:hover { color: var(--v2-dark); }
@media (max-width: 600px) {
  .page-checkout .co-leave {
    width: 100%;
    margin: auto 0 0;
    padding: 22px 16px calc(14px + env(safe-area-inset-bottom));
    border-radius: 20px 20px 0 0;
  }
}

/* Phones: the savings strip catches the eye (count-up and pop in cart.js
   countMoney; a soft shine across the coupon; the truck nudges). Nothing moves
   with Reduce Motion. */
@media (max-width: 600px) and (prefers-reduced-motion: no-preference) {
  .page-checkout .co-save { position: relative; }
  .page-checkout .co-save::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 70px; z-index: 1; pointer-events: none;
    background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.45) 50%, transparent 70%) no-repeat;
    background-size: 220% 100%; background-position: 160% 0;
    animation: sk-save-shine 4s ease-in-out 1.2s infinite;
  }
  .page-checkout .co-save.is-pop { animation: sk-save-pop .45s ease-out; }
  .page-checkout #coSaveFree svg { animation: sk-save-truck 4s ease-in-out 1.2s infinite; }
}
@keyframes sk-save-shine { 0%, 55% { background-position: 160% 0; } 85%, 100% { background-position: -60% 0; } }
@keyframes sk-save-pop { 0% { transform: scale(1); } 40% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes sk-save-truck { 0%, 60%, 100% { transform: translateX(0); } 70% { transform: translateX(3px); } 80% { transform: translateX(-1px); } }
