/* The active checkout step is a blue status, independent of the material
   profile's neutral --primary token. Focus styling stays on navigable links. */
nav[aria-label="Checkout progress"] li[aria-current="step"] > :is(a, span) > span.flex-col {
  color: hsl(var(--contextual-primary, 217 92% 48%)) !important;
}
nav[aria-label="Checkout progress"] li[aria-current="step"] > :is(a, span) > span.flex-col > span[aria-hidden="true"].rounded-full {
  background: hsl(var(--contextual-primary, 217 92% 48%)) !important;
  border: 0 !important;
  outline: none !important;
  box-shadow: none !important;
  color: white !important;
}
nav[aria-label="Checkout progress"] li[aria-current="step"] > :is(a, span) > span.flex-col > span[aria-hidden="true"].rounded-full svg {
  color: white !important;
}
nav[aria-label="Checkout progress"] li[aria-current="step"] > :is(a, span) > span.flex-col > span.text-2xs {
  color: hsl(var(--contextual-primary, 217 92% 48%)) !important;
}

/* Recoverable member attachment already has header identity and universal Undo. */
[data-recovery-inline]:has(button[aria-label^="Undo Attached customer "]),
[data-recovery-inline]:has(button[aria-label^="Undo Detached customer "]) {
  display: none !important;
}
@media (max-width: 767px) {
  #page-scroll-container > nav[aria-label="Checkout progress"] {
    width: 100vw !important;
    margin: 0 calc((100% - 100vw) / 2) !important;
    flex-shrink: 0;
  }
}
/* The compact dock can expose the document canvas while it shrinks. */
html:has(nav[data-checkout-current]) {
  background: hsl(var(--background, 0 0% 100%));
}
/* Checkout actions already have universal Undo. Inline history rows must not
   move the progress rail when quantities or payment methods change. */
#page-scroll-container:has(> nav[data-checkout-current]) > [data-recovery-inline] {
  display: none !important;
}
@media (max-width: 767px) {
  button[aria-label^="Go to bag."] { display: none !important; }
}

[aria-label="Link recipient preview"] .truncate {
  white-space: normal !important;
  text-overflow: clip !important;
  overflow: visible !important;
}
[aria-label="Link recipient preview"] .line-clamp-2 {
  display: block !important;
  -webkit-line-clamp: unset !important;
  overflow: visible !important;
}

/* Customer handoff: one instruction, one order summary and one clear QR surface. */
.checkout-handoff-card { padding: 22px 20px !important; }
.checkout-handoff-title { margin: 0; font-size: 24px; line-height: 30px; font-weight: 700; letter-spacing: -0.025em; }
.checkout-handoff-summary { margin: 7px 0 18px; font-size: 16px; line-height: 24px; color: hsl(var(--muted-foreground)); }
.checkout-handoff-summary strong { font-weight: 600; color: hsl(var(--foreground)); }
.checkout-handoff-qr { display: block; width: min(100%, 232px); margin: 0 auto; padding: 16px; border: 1px solid hsl(var(--border)); border-radius: 20px; background: #fff; transition: transform 160ms ease; }
.checkout-handoff-qr:active { transform: scale(.985); }
.checkout-handoff-qr:focus-visible { outline: 2px solid hsl(var(--primary)); outline-offset: 4px; }
.checkout-handoff-loading { display: flex; justify-content: center; align-items: center; min-height: 232px; }
.checkout-handoff-instruction { margin: 12px 0 0; font-size: 14px; line-height: 20px; color: hsl(var(--muted-foreground)); }
.checkout-handoff-status { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 14px 0 0; font-size: 13px; line-height: 20px; font-weight: 500; color: hsl(var(--muted-foreground)); }
.checkout-handoff-copy { margin-top: 18px; min-height: 44px; min-width: 196px; padding: 0 20px; font-size: 14px; }
@media (max-width: 359px) { .checkout-handoff-card { padding: 18px 16px !important; } .checkout-handoff-qr { width: min(100%, 216px); } }
@media (prefers-reduced-motion: reduce) { .checkout-handoff-qr { transition: none; } }

/* Readiness follows the connection state, not merely the presence of a QR. */
.checkout-handoff-instruction { max-width: 22rem; margin-left: auto; margin-right: auto; }
.checkout-handoff-status { min-height: 20px; }
.checkout-handoff-status svg { width: 18px; height: 18px; flex: 0 0 18px; }
.checkout-handoff-status[data-ready="true"] { color: #008a2e; }
.dark .checkout-handoff-status[data-ready="true"] { color: #86efac; }
.checkout-handoff-status[data-ready="true"] svg path:nth-of-type(2),
.checkout-handoff-status[data-ready="true"] svg path:nth-of-type(3) { animation: mpos-radio-inner 1.8s steps(1, end) infinite; }
.checkout-handoff-status[data-ready="true"] svg path:nth-of-type(1),
.checkout-handoff-status[data-ready="true"] svg path:nth-of-type(4) { animation: mpos-radio-outer 1.8s steps(1, end) infinite; }
@keyframes mpos-radio-inner { 0%, 24.99% { opacity: 0; } 25%, 100% { opacity: 1; } }
@keyframes mpos-radio-outer { 0%, 49.99% { opacity: 0; } 50%, 100% { opacity: 1; } }
nav[aria-label="Checkout progress"] li[data-checkout-state="skipped"] > a > span > span[aria-hidden="true"].rounded-full {
  background: hsl(var(--secondary, 0 0% 95%)) !important;
  border: 1px solid hsl(var(--border, 0 0% 88%)) !important;
  color: hsl(var(--muted-foreground, 0 0% 40%)) !important;
  box-shadow: none !important;
}
@media (prefers-reduced-motion: reduce) {
  .checkout-handoff-status svg path { animation: none !important; opacity: 1 !important; }
}

/* Filled progress circles do not need an additional outline. */
nav[aria-label="Checkout progress"] li > :is(a, span) > span.flex-col > span[aria-hidden="true"].rounded-full {
  border: 0 !important;
}
nav[aria-label="Checkout progress"] li:is([data-checkout-state="locked"], [data-checkout-state="upcoming"], [data-checkout-state="skipped"]) > :is(a, span) > span.flex-col > span[aria-hidden="true"].rounded-full {
  background: hsl(var(--secondary, 0 0% 95%)) !important;
  border: 0 !important;
}

/* The wallet sheet owns input while open; hidden fixed actions cannot duplicate it. */
body:has([data-demo-wallet]) [data-checkout-actions] { visibility: hidden; pointer-events: none; }
.qr-customer-flow { overflow-x: clip; }
body:has(.qr-customer-flow) [data-checkout-actions] { padding-bottom: max(24px, env(safe-area-inset-bottom)); }

@media (max-width: 359px) {
  body:has(.qr-customer-flow) [data-checkout-actions] button[aria-label="Back"] { flex: 0 0 48px; padding-inline: 12px; }
  body:has(.qr-customer-flow) [data-checkout-actions] button:not([aria-label="Back"]) { min-width: 0; padding-inline: 12px; font-size: 14px; line-height: 20px; white-space: normal; }
}

/* Receipt actions share one pill geometry, icon gap and content alignment. */
.qr-receipt-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.qr-receipt button,
body:has(.qr-receipt) [data-checkout-actions] button { border-radius: 9999px !important; }
.qr-receipt-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  width: 100%; min-width: 0; height: 48px; min-height: 48px;
  padding: 0 12px !important;
  font-size: 14px; line-height: 20px; white-space: nowrap;
}
.qr-receipt-action svg { width: 16px !important; height: 16px !important; flex: 0 0 16px; margin: 0 !important; }
.qr-receipt-action > span:not([aria-hidden]) { display: block; line-height: 20px; }

/* One action geometry throughout associate checkout and customer handoff.
   Navigation tabs, product/member cards and disclosure rows keep their layouts. */
body:has(:is(nav[data-checkout-current], .qr-customer-flow, .checkout-member-profile, [aria-label="Scanner"]))
:is(.mpos-primary-action, .mpos-outline-action, .mpos-secondary-action, .mpos-tertiary-action, .mpos-destructive-action):not(.header-action-control) {
  border-radius: 9999px !important;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px !important;
  padding-inline: 16px !important;
  line-height: 20px;
}
body:has(:is(nav[data-checkout-current], .qr-customer-flow, .checkout-member-profile, [aria-label="Scanner"]))
:is(.mpos-primary-action, .mpos-outline-action, .mpos-secondary-action, .mpos-tertiary-action, .mpos-destructive-action):not(.header-action-control) > svg {
  width: 16px !important; height: 16px !important; flex: 0 0 16px;
  margin: 0 !important;
}
body:has(:is(nav[data-checkout-current], .qr-customer-flow, .checkout-member-profile, [aria-label="Scanner"]))
:is(.mpos-primary-action, .mpos-outline-action, .mpos-secondary-action, .mpos-tertiary-action, .mpos-destructive-action):is([class~="w-9"],[class~="w-10"],[class~="w-11"],[class~="w-12"]):not(.header-action-control) {
  padding-inline: 0 !important;
}
body:has(.qr-customer-flow) :is(.qr-customer-flow, [data-demo-wallet], [data-checkout-actions]) button {
  border-radius: 9999px !important;
}
body:has(.qr-customer-flow) .qr-receipt-action:not(.header-action-control),
body:has(nav[data-checkout-current]) .checkout-receipt-option:not(.header-action-control),
body:has(nav[data-checkout-current]) .checkout-method-option:not(.header-action-control) {
  padding-inline: 12px !important;
  min-width: 0;
}
.checkout-receipt-option { height: 48px !important; flex-direction: row !important; }
.checkout-receipt-option > span[data-material-label] { line-height: 20px; }
@media (max-width: 359px) {
  body:has(.qr-customer-flow) [data-checkout-actions] button { padding-inline: 12px !important; }
  body:has(nav[data-checkout-current]) .checkout-method-option:not(.header-action-control) { font-size: 13px; }
}

/* Customer payment choices use stable pill rows instead of oversized circles. */
.qr-payment-method {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 20px;
  grid-template-rows: 20px 16px;
  align-content: center;
  align-items: center;
  gap: 2px 12px;
  width: 100%; min-width: 0; min-height: 64px;
  padding: 12px 20px;
  text-align: left;
}
.qr-payment-method > svg { grid-column: 1; grid-row: 1 / 3; width: 20px; height: 20px; margin: 0; color: inherit; }
.qr-payment-method > p { min-width: 0; margin: 0; color: inherit; }
.qr-payment-method > p:first-of-type { grid-column: 2; grid-row: 1; line-height: 20px; }
.qr-payment-method > p:nth-of-type(2) { grid-column: 2; grid-row: 2; line-height: 16px; opacity: .72; }
.qr-payment-method > div { grid-column: 3; grid-row: 1 / 3; margin: 0; background: #005bf4; color: white; }
.qr-payment-method[aria-pressed="true"] { background: #171717; border-color: #171717; color: #fff; }
.qr-payment-method[aria-pressed="false"] { color: hsl(var(--foreground)); }

/* Narrow three-way receipt groups retain the same 12px edge padding. */
body:has(.qr-customer-flow) .qr-receipt-actions button.qr-receipt-action:not(.header-action-control) { padding-inline: 12px !important; }
body:has(nav[data-checkout-current]) .checkout-undo-action {
  display: inline-flex; align-items: center; justify-content: center;
  height: 44px; min-height: 44px; border-radius: 9999px; padding: 0 16px; gap: 8px;
}
body:has(nav[data-checkout-current]) .checkout-undo-action > svg { width: 16px; height: 16px; margin: 0; flex: 0 0 16px; }
@media (max-width: 359px) {
  body:has(.qr-customer-flow) [data-checkout-actions] button[aria-label="Back"] { min-width: 48px; padding-inline: 0 !important; }
}

/* Member actions span the whole preview footer, including the avatar column. */
@media (max-width: 767px) {
  body:has(nav[data-checkout-current]) .checkout-member-actions { margin-left: -64px; width: calc(100% + 64px); }
  body:has(nav[data-checkout-current]) .checkout-member-actions > button { min-width: 0; flex: 1 1 0; }
}
@media (max-width: 359px) {
  body:has(nav[data-checkout-current]) .checkout-member-actions > button:not(.header-action-control) { padding-inline: 12px !important; }
}

@media (max-width: 767px) {
  body:has(nav[data-checkout-current]) .checkout-member-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
body:has(.checkout-member-profile) .checkout-profile-option:not(.header-action-control) { padding-inline: 12px !important; min-width: 0; }
body:has(.checkout-member-profile) button[aria-label="Back to results"] { padding: 0 !important; }
body:has(.checkout-member-profile) button[aria-controls="associate-notes-editor"] { border-radius: 9999px; padding-inline: 12px; gap: 8px; }
body:has(.checkout-member-profile) button[aria-controls="associate-notes-editor"] > svg { width: 16px; height: 16px; margin: 0; }

body:has(.checkout-member-profile) .checkout-member-profile .checkout-profile-option:not(.header-action-control) { padding-inline: 12px !important; }
