/* MMG Storefront — delivery reward module (moved from mmg-fulfilment-date in
   storefront Phase 5b; selectors renamed to mmg-sf-reward* in Phase 5c).

   DUAL-CLASS WINDOW (5c): the rendered markup carries BOTH mmg-fd-reward*
   and mmg-sf-reward* on every element. This file targets the NEW names;
   themes/live tweaks targeting the legacy names keep working off the same
   elements. A later release drops the legacy classes from the markup.

   TOKENS: this file styles structure only. The --mmg-fd-* custom properties
   it consumes are declared by mmg-fulfilment-date — its stylesheet's token
   scope list AND its theme_inline_css() emission both target
   `.mmg-fd,.mmg-fd-reward,.mmg-fd-mini`, which matches the reward block via
   its LEGACY class (the block renders OUTSIDE .mmg-fd and carries the scope
   itself). The per-store button vars (--mmg-fd-reward-btn-*) are emitted by
   MMG_SF_Rewards::button_style_inline_css() on this stylesheet's handle.
   That fd selector list, this file, and the static-regression lockstep
   assertions move together — never edit one without the others. Every
   var() below keeps a literal fallback so the block degrades sanely if
   fd's tokens are ever absent. */

.mmg-sf-reward,
.mmg-sf-reward *,
.mmg-sf-reward *::before,
.mmg-sf-reward *::after {
  box-sizing: border-box;
}

/* Deliberately chrome-free: no card border or wash — whitespace and the small
   section headings do the structuring. */
.mmg-sf-reward {
  display: grid;
  gap: 18px;
  margin: 20px 0;
  padding: 6px 0;
  color: var(--mmg-fd-text);
}

.mmg-delivery-upsell-anchor .mmg-sf-reward {
  margin: 0;
}

.mmg-sf-reward-progress {
  display: grid;
  gap: 9px;
}

.mmg-sf-reward-head,
.mmg-sf-reward-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

/* Stacked (not spread) so the label and its supporting note read as one unit
   even when the module sits in a wide cart-totals column. */
.mmg-sf-reward-addons-head {
  display: grid;
  gap: 2px;
}

.mmg-sf-reward-title,
.mmg-sf-reward-addons-head strong {
  color: var(--mmg-fd-muted);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.25;
  text-transform: uppercase;
}

.mmg-sf-reward-head strong {
  color: var(--mmg-fd-accent-dark);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.mmg-sf-reward-meter {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: var(--mmg-fd-radius-sm);
  /* Borderless neutral track — a line-tinted grey that stays visible on a
     plain white page and clearly reads as the "empty" part under the fill.
     Mixed from --mmg-fd-line (never white in any store theme), NOT panel or
     surface: live themes swap those two and either can be #fff. */
  background: color-mix(in srgb, var(--mmg-fd-line) 55%, var(--mmg-fd-surface));
}

.mmg-sf-reward-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mmg-fd-accent);
  transition: width 180ms ease;
}

/* Unlocked = goal reached: the fill and status flip to the semantic success
   tone so the state change is visible at a glance, not just re-worded. */
.mmg-sf-reward.is-unlocked .mmg-sf-reward-meter span {
  background: var(--mmg-fd-success);
}

.mmg-sf-reward.is-unlocked .mmg-sf-reward-head strong {
  color: var(--mmg-fd-success);
}

.mmg-sf-reward-meta,
.mmg-sf-reward-addons-head span {
  color: var(--mmg-fd-muted);
  font-size: 12.5px;
  line-height: 1.35;
}

.mmg-sf-reward-addons {
  display: grid;
  gap: 12px;
}

/* Image-forward tile grid. auto-fill keeps it breakpoint-free: ~4 across in a
   desktop cart-totals column, 2-3 in the narrower checkout/product columns,
   2 on phones. Tiles are chrome-free (no nested cards) — the image edge and
   the CTA carry the shape. */
.mmg-sf-reward-addon-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 16px 12px;
}

.mmg-sf-reward-addon {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.mmg-sf-reward-addon-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: var(--mmg-fd-radius-sm);
  background: color-mix(in srgb, var(--mmg-fd-line) 40%, var(--mmg-fd-surface));
}

.mmg-sf-reward-addon-thumb img,
.mmg-sf-reward-addon-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mmg-sf-reward-addon-main {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.mmg-sf-reward-addon-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  color: var(--mmg-fd-strong);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.3;
}

/* The CTA is a centered "+ price" pair, pinned to the tile bottom so buttons
   align across a row even when one title wraps. Colors/radius resolve through
   the --mmg-fd-reward-btn-* custom properties (per-store settings emitted by
   theme_inline_css); the var() fallbacks are the theme defaults. */
.mmg-sf-reward-addon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  margin-top: auto;
  padding: 0 10px;
  border: 1px solid var(--mmg-fd-reward-btn-bg, var(--mmg-fd-accent-dark));
  border-radius: var(--mmg-fd-reward-btn-radius, var(--mmg-fd-radius-sm));
  background: var(--mmg-fd-reward-btn-bg, var(--mmg-fd-accent-dark));
  color: var(--mmg-fd-reward-btn-text, #fff);
  cursor: pointer;
  line-height: 1.1;
  text-decoration: none;
  white-space: nowrap;
}

.mmg-sf-reward-addon-plus {
  display: inline-flex;
}

.mmg-sf-reward-addon-plus svg {
  display: block;
}

.mmg-sf-reward-addon-button .mmg-sf-reward-addon-price {
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

.mmg-sf-reward-addon-button:hover,
.mmg-sf-reward-addon-button:focus {
  background: var(--mmg-fd-reward-btn-bg-hover, var(--mmg-fd-accent));
  border-color: var(--mmg-fd-reward-btn-bg-hover, var(--mmg-fd-accent));
  color: var(--mmg-fd-reward-btn-text-hover, #fff);
}

.mmg-sf-reward-addon-button:visited {
  color: var(--mmg-fd-reward-btn-text, #fff);
}

.mmg-sf-reward-addon-button:focus-visible {
  outline: 2px solid var(--mmg-fd-focus);
  outline-offset: 2px;
}

/* The fulfilment summary keeps its icon. Align the reward text with the
   summary text column and separate the two flat sections with a hairline. */
#fkcart-modal .mmg-sf-reward--minicart {
  margin: 0;
  padding: 12px 16px 14px 68px;
  border-top: 1px solid var(--mmg-fd-line, #e9e1da);
  min-width: 0;
  font-family: inherit;
  color: inherit;
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-progress {
  gap: 5px;
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-head {
  gap: 4px 12px;
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-heading {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-title {
  color: inherit;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-transform: none;
  letter-spacing: normal;
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-head strong {
  color: var(--mmg-fd-accent, #6f4e37);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-align: start;
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-meter {
  height: 6px;
}

/* Reaching the spend threshold is not coupon application: retain the brand
   accent and let the full meter and status copy communicate progress. */
#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-meter span {
  background: var(--mmg-fd-accent, #6f4e37);
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-meta {
  display: grid;
  gap: 2px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.5;
  color: var(--mmg-fd-muted, #5f574e);
  overflow-wrap: anywhere;
}

#fkcart-modal .mmg-sf-reward--minicart .mmg-sf-reward-code {
  color: var(--mmg-fd-muted, #5f574e);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.4;
  white-space: nowrap;
  padding: 2px 6px;
  border: 1px solid #dfd5ca;
  border-radius: 4px;
  background: #f6f1eb;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

#wfacp-e-form .shipping_total_fee .mmg-sf-shipping-savings {
  display: inline-block;
  line-height: 1.35;
  max-width: 100%;
  text-align: right;
  vertical-align: top;
}

#wfacp-e-form .shipping_total_fee .mmg-sf-shipping-savings-fees {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

#wfacp-e-form .shipping_total_fee .mmg-sf-shipping-savings del {
  color: #7a746e;
  text-decoration-thickness: 1px;
}

#wfacp-e-form .shipping_total_fee .mmg-sf-shipping-savings small,
.brxe-wfacp-order-summary .wfacp_mini_cart_reviews tr.shipping_total_fee td .mmg-sf-shipping-savings small {
  color: #55745a;
  display: inline-block;
  font-size: 12px !important;
  font-weight: 400;
  line-height: 1.5 !important;
  text-align: right;
  text-transform: none !important;
}

#wfacp-e-form .shipping_total_fee .mmg-sf-shipping-savings small .woocommerce-Price-amount,
#wfacp-e-form .shipping_total_fee .mmg-sf-shipping-savings small .woocommerce-Price-currencySymbol,
.brxe-wfacp-order-summary .wfacp_mini_cart_reviews tr.shipping_total_fee td .mmg-sf-shipping-savings small .woocommerce-Price-amount,
.brxe-wfacp-order-summary .wfacp_mini_cart_reviews tr.shipping_total_fee td .mmg-sf-shipping-savings small .woocommerce-Price-currencySymbol {
  font-size: 12px !important;
  line-height: inherit !important;
}

#fkcart-modal .mmg-sf-reward-action-status {
  display: block;
  font-size: 12px;
  line-height: 1.4;
}

#wfacp-e-form #payment .mmg-sf-final-review {
  display: none;
}

@media (max-width: 767px) {
  #wfacp-e-form #payment .mmg-sf-final-review {
    background: #fff;
    border: 1px solid #e8ddd2;
    border-radius: 12px;
    color: #353030;
    display: block;
    font-size: 14px;
    line-height: 1.4;
    margin: 20px 0 18px;
    min-height: 170px;
    padding: 16px;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-head,
  #wfacp-e-form #payment .mmg-sf-final-review-items li,
  #wfacp-e-form #payment .mmg-sf-final-review-totals > div,
  #wfacp-e-form #payment .mmg-sf-final-review-offer {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-head {
    align-items: center;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-head h3 {
    color: #353030;
    font-size: 17px;
    line-height: 1.3;
    margin: 0;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-edit {
    background: transparent;
    border: 0;
    color: #694833;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    min-height: 40px;
    padding: 4px 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-items {
    list-style: none;
    margin: 12px 0;
    padding: 0;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-items li {
    border-top: 1px solid #f0eae4;
    padding: 10px 0;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-items li > span:first-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-qty,
  #wfacp-e-form #payment .mmg-sf-final-review-item-meta,
  #wfacp-e-form #payment .mmg-sf-final-review-fulfilment span,
  #wfacp-e-form #payment .mmg-sf-final-review-fulfilment small,
  #wfacp-e-form #payment .mmg-sf-final-review-offer small {
    color: #665d55;
    display: block;
    font-size: 12px;
    line-height: 1.4;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-item-meta dl,
  #wfacp-e-form #payment .mmg-sf-final-review-item-meta p {
    margin: 2px 0 0;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-money {
    flex: none;
    white-space: nowrap;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-fulfilment,
  #wfacp-e-form #payment .mmg-sf-final-review-offer {
    border-top: 1px solid #f0eae4;
    padding: 12px 0;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-fulfilment small {
    margin-top: 4px;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-offer strong,
  #wfacp-e-form #payment .mmg-sf-final-review-applied {
    font-size: 13px;
    font-weight: 600;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-applied {
    color: #55745a;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-offer-actions {
    align-items: center;
    display: flex;
    flex: none;
    gap: 10px;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-totals {
    border-top: 1px solid #e8ddd2;
    padding-top: 10px;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-totals > div {
    padding: 4px 0;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-totals > div > span:last-child,
  #wfacp-e-form #payment .mmg-sf-final-review-totals > div > strong:last-child {
    text-align: right;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-pending {
    color: #665d55;
    font-size: 12px;
    line-height: 1.4;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-total {
    border-top: 1px solid #e8ddd2;
    font-size: 16px;
    margin-top: 8px;
    padding-top: 12px !important;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-totals p,
  #wfacp-e-form #payment .mmg-sf-final-review-status {
    color: #665d55;
    font-size: 12px;
    line-height: 1.4;
    margin: 4px 0 0;
  }

  #wfacp-e-form #payment .mmg-sf-final-review-status:empty {
    display: none;
  }

  #wfacp-e-form #payment .mmg-sf-final-review .mmg-sf-shipping-savings {
    display: inline-block;
    line-height: 1.35;
    text-align: right;
  }

  #wfacp-e-form #payment .mmg-sf-final-review .mmg-sf-shipping-savings-fees {
    display: inline-flex;
    gap: 4px;
    white-space: nowrap;
  }

  #wfacp-e-form #payment .mmg-sf-final-review .mmg-sf-shipping-savings small,
  #wfacp-e-form #payment .mmg-sf-final-review .mmg-sf-shipping-savings small * {
    color: #55745a;
    font-size: 12px !important;
    line-height: 1.4 !important;
    text-transform: none !important;
  }

  #wfacp-e-form #payment .mmg-sf-final-review .mmg-sf-shipping-savings small {
    display: block;
    text-align: right;
  }
}

.mmg-sf-public-primary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid #eee5dd; }
.mmg-sf-public-primary span { min-width: 0; }
.mmg-sf-public-primary strong, .mmg-sf-public-primary small { display: block; line-height: 1.35; }
.mmg-sf-public-primary strong { font-size: 13px; }
.mmg-sf-public-primary small { margin-top: 2px; color: #776a62; font-size: 11px; }
.mmg-sf-public-primary .mmg-sf-public-offers-open { flex: none; margin: 0; }


.mmg-sf-public-offers-dialog {
  width: min(420px, calc(100vw - 24px));
  max-height: min(680px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid #e5d8cc;
  border-radius: 16px;
  background: #fff;
  color: #2f2925;
  box-shadow: 0 24px 70px rgba(32, 22, 15, .24);
  overflow: auto;
}

.mmg-sf-public-offers-dialog::backdrop { background: rgba(30, 23, 18, .48); }
.mmg-sf-public-offers-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid #e9dfd6; }
.mmg-sf-public-offers-header h2 { flex: 1; margin: 0; font-size: 18px; line-height: 1.3; }
.mmg-sf-public-offers-close { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: inherit; line-height: 1; cursor: pointer; }
.mmg-sf-public-offer-content { padding: 4px 20px 20px; }
.mmg-sf-public-offer { display: flex; align-items: center; gap: 12px; padding: 16px 0; border-bottom: 1px solid #eee5dd; }
.mmg-sf-public-offer-details { flex: 1; min-width: 0; }
.mmg-sf-public-offer-name { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-width: 0; }
.mmg-sf-public-offer strong { font-size: 14px; }
.mmg-sf-public-offer-code { padding: 2px 5px; border-radius: 4px; background: #f6efe9; color: #6b5445; font-size: 10px; letter-spacing: .04em; }
.mmg-sf-public-offer p, .mmg-sf-public-offer > small, .mmg-sf-public-offer-state { display: block; margin: 4px 0; color: #6e625b; font-size: 12px; line-height: 1.45; }
.mmg-sf-public-code-apply { padding: 9px 12px; border: 1px solid #684733; border-radius: 6px; background: transparent; color: #684733; font-size: 12px; cursor: pointer; }
.mmg-sf-public-offer-action:disabled, .mmg-sf-public-code-apply:disabled { opacity: .55; cursor: wait; }
.mmg-sf-public-offer-manual { padding-top: 18px; }
.mmg-sf-public-offer-manual label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 13px; }
.mmg-sf-public-offer-manual > div { display: flex; gap: 8px; }
.mmg-sf-public-offer-manual input { flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid #cbbdb2; border-radius: 8px; font-size: 14px; }
.mmg-sf-public-code-apply { margin: 0; width: auto !important; flex: 0 0 auto; white-space: nowrap; }
.mmg-sf-public-offer-feedback { min-height: 1.4em; margin: 10px 0 0; font-size: 12px; line-height: 1.4; }

/* Typed-code submission is the only boxed coupon action. Keep the native
 * form layout, with the same quiet outline in the cart, checkout and sheet. */
.mmg-sf-public-code-apply,
#fkcart-modal .fkcart-coupon-button,
:is(#wfacp-e-form, .wfacp_mini_cart_start_h, .woocommerce) [name="apply_coupon"] {
  background: transparent !important;
  border: 1px solid #694833 !important;
  border-radius: 6px !important;
  box-shadow: none !important;
  color: #694833 !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  min-height: 40px !important;
  height: auto !important;
  padding: 8px 12px !important;
}

:is(#wfacp-e-form, .wfacp_mini_cart_start_h, .woocommerce) [name="apply_coupon"]:disabled {
  opacity: .55;
  cursor: not-allowed;
}

/* Coupon actions share a quiet text treatment, including native cart controls.
 * Scoped important resets prevent FunnelKit/Bricks button rules expanding them. */
.mmg-sf-public-offers-open,
.mmg-sf-public-offer-action,
:is(#fkcart-modal, #wfacp-e-form, .woocommerce, .wfacp_mini_cart_start_h) :is(.mmg-sf-apply-delivery-coupon, .mmg-sf-remove-delivery-coupon, .mmg-sf-public-offers-open, .fkcart-remove-coupon, .wfacp_remove_coupon, .woocommerce-remove-coupon) {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: fit-content !important;
  flex: 0 0 auto;
  align-self: flex-start;
  justify-self: start;
  min-width: 0 !important;
  min-height: 32px !important;
  height: auto !important;
  padding: 4px 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #694833 !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 1.5 !important;
  letter-spacing: normal !important;
  text-transform: none !important;
  text-decoration: underline !important;
  text-underline-offset: 3px;
  white-space: nowrap;
  cursor: pointer;
}

:is(.mmg-sf-public-offers-open, .mmg-sf-public-offer-action, .mmg-sf-apply-delivery-coupon, .mmg-sf-remove-delivery-coupon, .fkcart-remove-coupon, .wfacp_remove_coupon, .woocommerce-remove-coupon):hover {
  text-decoration-thickness: 2px !important;
}

:is(.mmg-sf-public-offers-open, .mmg-sf-public-offer-action, .mmg-sf-public-code-apply, [name="apply_coupon"], .mmg-sf-apply-delivery-coupon, .mmg-sf-remove-delivery-coupon, .fkcart-remove-coupon, .wfacp_remove_coupon, .woocommerce-remove-coupon):focus-visible {
  outline: 2px solid #694833 !important;
  outline-offset: 3px;
}

:is(.mmg-sf-public-offer-action, .mmg-sf-apply-delivery-coupon, .mmg-sf-remove-delivery-coupon):disabled {
  opacity: .55;
  cursor: wait;
}

#fkcart-modal .mmg-sf-reward-action { margin-top: 2px; }
#fkcart-modal .fkcart-coupon-code-wrapper { gap: 8px; }
#fkcart-modal .fkcart-coupon-code-wrapper > span:first-child { text-transform: uppercase; }
/* FunnelKit already has a remove control beside the code. WooCommerce also
 * appends one to the amount; suppress only that duplicate within the same row. */
#fkcart-modal .fkcart-coupon-applied:has(.fkcart-remove-coupon) .woocommerce-remove-coupon {
  display: none !important;
}

/* The recovery action belongs to the sentence, not a separate button row. */
#fkcart-modal .mmg-sf-reward-action.mmg-sf-reward-action--inline {
  display: inline !important;
  width: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: inherit !important;
  line-height: inherit !important;
  vertical-align: baseline;
}
#fkcart-modal .mmg-sf-reward-action-status:empty { display: none; }

#fkcart-modal .fkcart-coupon-code-wrapper,
:is(#wfacp-e-form, .wfacp_mini_cart_start_h) .wfacp_coupon_code.mmg-sf-applied-coupon {
  display: inline-flex !important;
  align-items: center;
  gap: 8px !important;
  padding: 2px 2px 2px 8px !important;
  border: 1px dashed #5ba238 !important;
  border-radius: 19px !important;
  background: #f1fded !important;
  color: #353030 !important;
  font-family: inherit !important;
  font-size: 12px !important;
  font-weight: 400;
  line-height: 1.5 !important;
  white-space: nowrap;
  vertical-align: middle;
}

/* Treat the delivery coupon label and code as one compact unit. After the
 * remove link moves into the badge, its old table cell has no content. */
.mmg-sf-delivery-coupon-label {
  display: inline-flex !important;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  vertical-align: middle;
}
.wfacp_mini_cart_reviews tr.mmg-sf-delivery-coupon-row th {
  width: 100% !important;
}
.wfacp_mini_cart_reviews tr.mmg-sf-delivery-coupon-row td {
  display: none !important;
}

#fkcart-modal .fkcart-remove-coupon.mmg-sf-coupon-remove-icon,
:is(#wfacp-e-form, .wfacp_mini_cart_start_h) .mmg-sf-applied-coupon .woocommerce-remove-coupon.mmg-sf-coupon-remove-icon {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 24px !important;
  min-width: 24px !important;
  height: 24px !important;
  min-height: 24px !important;
  margin: 0 !important;
  padding: 0 !important;
  color: #fff !important;
  position: relative !important;
  background: transparent !important;
  text-decoration: none !important;
}
/* The white glyph needs its native grey circle; keep a larger hit target. */
.mmg-sf-coupon-remove-icon::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #82838e;
}
.mmg-sf-coupon-remove-icon svg.mmg-sf-coupon-x {
  display: block !important;
  position: relative !important;
  inset: auto !important;
  margin: 0 !important;
  width: 8px !important;
  height: 8px !important;
  color: #fff !important;
  z-index: 1;
  flex: none;
}

/* Keep the existing success glyph beside the message, including its remove link. */
body .mmg-sf-coupon-notice,
body .wfacp_coupon_success {
  display: block !important;
  line-height: 1.5 !important;
}
body :is(.wfacp_mini_cart_start_h, .wfacp_collapsible_order_summary_wrap) .wfacp_coupon_msg > .woocommerce-message.wfacp_success {
  display: none !important;
}
body .mmg-sf-coupon-notice::before,
body .wfacp_coupon_success::before {
  display: inline-block !important;
  position: static !important;
  float: none !important;
  margin: 0 6px 0 0 !important;
  vertical-align: middle !important;
  line-height: 1 !important;
}
body .mmg-sf-coupon-notice > span,
body .wfacp_coupon_success > span {
  display: inline !important;
}
body .mmg-sf-coupon-notice--inline {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding-left: 0 !important;
  background-image: none !important;
}
body .mmg-sf-coupon-notice--inline::before {
  content: none !important;
  display: none !important;
}
body .mmg-sf-coupon-notice-icon {
  display: block;
  flex: none;
  width: 12px;
  height: 12px;
  color: #0b9f80;
}
:is(#wfacp-e-form, .wfacp_mini_cart_start_h) :is(.mmg-sf-coupon-notice, .wfacp_coupon_success) .woocommerce-remove-coupon {
  display: inline !important;
  min-height: 0 !important;
  padding: 0 !important;
  line-height: inherit !important;
}

.mmg-sf-public-offer-action.mmg-sf-public-offer-quick-apply {
  flex: none;
  align-self: center;
  min-height: 32px !important;
  padding: 4px 9px !important;
  border: 1px solid #694833 !important;
  border-radius: 6px !important;
  background: #694833 !important;
  color: #fff !important;
  font-size: 11px !important;
  text-decoration: none !important;
}
.mmg-sf-public-offer-action.mmg-sf-public-offer-quick-apply:hover { background: #533826 !important; }
.mmg-sf-public-offers-dialog .mmg-sf-public-offer-action { align-self: center; }

/* Offer discovery belongs immediately above the coupon field in each summary. */
body :is(#wfacp-e-form, .wfacp_mini_cart_start_h) .mmg-sf-public-offers-open.mmg-sf-public-offers-summary-open {
  display: flex !important;
  align-items: center;
  gap: 10px;
  width: 100% !important;
  min-height: 52px !important;
  margin: 0 0 12px !important;
  padding: 12px !important;
  border: 1px solid #e5d8cc !important;
  border-radius: 8px !important;
  background: #f8f4ef !important;
  text-align: left !important;
  text-decoration: none !important;
  white-space: normal;
}
body :is(#wfacp-e-form, .wfacp_mini_cart_start_h) .mmg-sf-public-offers-summary-open .mmg-sf-offers-title {
  flex: 1;
  min-width: 0;
  color: #353030;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1.35 !important;
}
body :is(#wfacp-e-form, .wfacp_mini_cart_start_h) .mmg-sf-public-offers-summary-open .mmg-sf-offers-status {
  flex: none;
  color: #695b50;
  font-size: 11px !important;
  line-height: 1.4 !important;
  white-space: nowrap;
}
body :is(#wfacp-e-form, .wfacp_mini_cart_start_h) .mmg-sf-public-offers-summary-open.has-applied-offer .mmg-sf-offers-status {
  padding: 3px 6px;
  border-radius: 4px;
  background: #e7f2e2;
  color: #3c6531;
}
.mmg-sf-public-offers-summary-open svg {
  display: block !important;
  flex: none;
  width: 20px !important;
  height: 20px !important;
}
.mmg-sf-public-offers-summary-open .mmg-sf-offers-chevron {
  width: 16px !important;
  height: 16px !important;
}
body :is(#wfacp-e-form, .wfacp_mini_cart_start_h) .wfacp_coupon_row :is(input[name="coupon_code"], button[name="apply_coupon"]),
.mmg-sf-public-offer-manual :is(input, .mmg-sf-public-code-apply) {
  box-sizing: border-box !important;
  height: 48px !important;
  min-height: 48px !important;
}

@media (prefers-reduced-motion: reduce) {
  .mmg-sf-reward *,
  .mmg-sf-reward *::before,
  .mmg-sf-reward *::after {
    transition: none !important;
    animation: none !important;
  }
}
