/**
 * futbol-mesa CSS — partial 7/7: 07-checkout. Finalizar-compra.dc.html redesign (TSK checkout).
 * Page header + step indicator, two-column checkout grid, billing/shipping/order-notes
 * cards, the sticky order-review + payment sidebar, and the trust/payment badge rows.
 * Load order is load-bearing (LRN-020/TSK-034): chained after 06-cart.css in
 * functions.php, before storefront-woocommerce. Do NOT reorder. @package futbol-mesa
 *
 * Every selector here is scoped under `body.fm.woocommerce-checkout` (or a
 * still more specific ancestor) per the TSK-034 specificity convention — no
 * `!important` anywhere in this file. Several rules restyle WooCommerce's own
 * markup directly (e.g. `#customer_details`, `.wc_payment_method`,
 * `.woocommerce-terms-and-conditions-wrapper`) rather than a `.fm-` class,
 * because those classes are also load-bearing for checkout.js (see the
 * woocommerce/checkout/*.php override docblocks) — restyle in place, don't
 * duplicate the markup.
 */

/* PAGE HEADER + STEP INDICATOR: title row directly followed by the meta row
   (subtitle + steps) -- the "¿Ya tienes una cuenta?" notice now prints below
   both (see inc/checkout.php, futbol_mesa_checkout_header_meta reorder), so
   no gap is reserved between title and meta beyond the subtitle's own 8px
   margin, matching Finalizar-compra.dc.html's tight title->subtitle spacing.
   See tpl/checkout-header.php / tpl/checkout-header-meta.php. */
body.fm.woocommerce-checkout .fm-checkout-header-top {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(12px, 2vw, 18px) var(--content-gutter) 0;
}

body.fm.woocommerce-checkout .fm-checkout-header-meta {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-gutter) clamp(16px, 2vw, 24px);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

body.fm.woocommerce-checkout .fm-checkout-header__title {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.02em;
  margin: 0;
}

body.fm.woocommerce-checkout .fm-checkout-header__subtitle {
  margin: 8px 0 0;
  font-size: 0.95rem;
  color: var(--color-muted);
}

body.fm.woocommerce-checkout .fm-checkout-steps {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.82rem;
}

body.fm.woocommerce-checkout .fm-checkout-steps__step {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--color-muted);
}

body.fm.woocommerce-checkout .fm-checkout-steps__step--done {
  color: var(--color-pitch-green);
}

body.fm.woocommerce-checkout .fm-checkout-steps__step--active {
  color: var(--color-ink);
}

body.fm.woocommerce-checkout .fm-checkout-steps__bullet {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  background: var(--color-cream);
  border: 1px solid var(--color-hairline);
}

body.fm.woocommerce-checkout .fm-checkout-steps__step--done .fm-checkout-steps__bullet {
  background: var(--color-pitch-green);
  border-color: var(--color-pitch-green);
  color: #fff;
}

body.fm.woocommerce-checkout .fm-checkout-steps__step--active .fm-checkout-steps__bullet {
  background: var(--color-terracotta);
  border-color: var(--color-terracotta);
  color: #fff;
}

body.fm.woocommerce-checkout .fm-checkout-steps__connector {
  width: 24px;
  height: 1px;
  background: var(--color-hairline);
}

/* Breadcrumb band: same vertical rhythm as the shop/cart bands (01-tokens-header.css),
   extended to checkout here rather than editing that shared partial. */
body.woocommerce-checkout .storefront-breadcrumb {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 28px) var(--content-gutter) 0;
}

body.woocommerce-checkout .storefront-breadcrumb .col-full {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* The checkout header, login/coupon toggles and form.checkout each carry their
   own --content-max + --content-gutter container. Storefront also wraps the
   page content in .col-full (same max-width + gutter), so without this the
   gutter is applied twice and all body content lands 48px right of the logo and
   breadcrumb. Neutralise the page .col-full on checkout and let those inner
   wrappers be the sole container, matching the logo/breadcrumb left edge. */
body.fm.woocommerce-checkout .site-content > .col-full {
  max-width: none;
  margin: 0;
  padding-left: 0;
  padding-right: 0;
}

/* CHECKOUT GRID: form.checkout is the grid container itself (its two real
   children, #customer_details and #order_review, are already the left/right
   columns — no wrapper markup needed). */
body.fm.woocommerce-checkout form.checkout.woocommerce-checkout {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--content-gutter) clamp(48px, 6vw, 80px);
  display: grid;
  grid-template-columns: 1fr 400px;
  gap: clamp(20px, 3vw, 40px);
  align-items: start;
}

/* Validation error summary: checkout.js prepends this wrapper into
   form.checkout on AJAX submit failure, with no grid-column/row of its own.
   #customer_details/#order_review already claim both cells of row 1 outright,
   so the auto-placement algorithm drops it into whichever cell is free --
   observed landing in the 400px sidebar column, narrow and misaligned. Span
   both tracks so it always reads as one full-width band, whatever row it
   lands in. */
body.fm.woocommerce-checkout .woocommerce-NoticeGroup-checkout {
  grid-column: 1 / -1;
}

/* Storefront's own `.woocommerce-error` (storefront/woocommerce.css) already
   handles the icon, padding and list-reset -- but its flat #e2401c red isn't
   the site's terracotta, and the content area's own `a{color:var(--color-
   terracotta)}` (higher specificity than Storefront's `.woocommerce-error
   a{color:#fff}` here) leaves each field-jump link a barely-legible,
   underlined terracotta-on-red rather than a plain white line. */
body.fm.woocommerce-checkout ul.woocommerce-error {
  background-color: var(--color-terracotta);
  border-left: 0;
  border-radius: var(--radius-card);
}

body.fm.woocommerce-checkout ul.woocommerce-error li a {
  color: #fff;
  text-decoration: none;
}

body.fm.woocommerce-checkout ul.woocommerce-error li a:hover {
  opacity: 0.8;
}

/* WooCommerce focuses this list for screen readers on submit failure
   (checkout.js `scroll_to_notices`); the browser's default blue ring clashes
   with the terracotta card, so it's swapped for a brand-colored one instead
   of dropped outright, keeping a visible focus indicator. */
body.fm.woocommerce-checkout ul.woocommerce-error:focus {
  outline: 2px solid var(--color-terracotta-hover);
  outline-offset: 2px;
}

body.fm.woocommerce-checkout #customer_details.col2-set {
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  margin: 0;
  float: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

body.fm.woocommerce-checkout #customer_details .col-1,
body.fm.woocommerce-checkout #customer_details .col-2 {
  width: 100%;
  margin: 0;
  float: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* "Returning customer" login prompt + coupon toggle print via
   woocommerce_before_checkout_form (WooCommerce's own hook for both), which
   fires before <form class="checkout"> opens. They can't be relocated inside
   the grid: woocommerce_checkout_login_form()/woocommerce_checkout_coupon_form()
   each render their own <form>, and nesting a <form> inside form.checkout is
   invalid HTML -- browsers auto-close the outer form early, which drops
   #customer_details/#order_review out of the grid AND out of the submitted
   checkout form. They stay full-width, above the two-column grid, capped to
   the same content width as the header. */
body.fm.woocommerce-checkout .woocommerce-form-login-toggle,
body.fm.woocommerce-checkout .woocommerce-form-coupon-toggle {
  max-width: var(--content-max);
  margin: 0 auto clamp(16px, 2vw, 20px);
  padding: 0 var(--content-gutter);
  box-sizing: border-box;
}

/* 02-navigation-footer.css sets a sitewide `.woocommerce-info{background:ink
   !important;color:cream !important;margin:clamp(16px,2vw,24px) 0 !important}`
   (dark notice band, used for cart/shop notices) -- deliberate !important
   there (kills a WC-blocks blue / Storefront's own margin scale), so beating
   it here for this one white card needs a matching !important on all three
   properties it sets, per the existing 06-cart.css precedent noted below.
   Without the margin !important, this card silently keeps the sitewide
   24px margin-top stacked on top of .fm-checkout-header-meta's own 24px
   padding-bottom -- doubling the gap under the checkout subtitle. */
body.fm.woocommerce-checkout .woocommerce-form-login-toggle .woocommerce-info,
body.fm.woocommerce-checkout .woocommerce-form-coupon-toggle .woocommerce-info {
  background: #fff !important;
  color: var(--color-body) !important;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-card);
  padding: 16px 18px;
  margin: 0 !important;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  list-style: none;
}

/* The sitewide dark-notice ::before icon (white checkmark) assumes a dark
   background; invisible on this white card, and the mockup's notice has no
   icon at all -- drop it here rather than reskin it. */
body.fm.woocommerce-checkout .woocommerce-form-login-toggle .woocommerce-info::before,
body.fm.woocommerce-checkout .woocommerce-form-coupon-toggle .woocommerce-info::before {
  display: none;
}

body.fm.woocommerce-checkout .woocommerce-form-login-toggle .showlogin,
body.fm.woocommerce-checkout .woocommerce-form-coupon-toggle .showcoupon {
  /* margin-left:auto pins the link to the right edge; space-between alone is
     unreliable here because WooCommerce leaves a trailing whitespace text node
     after the link, which becomes a third flex item and centres the link. */
  margin-left: auto;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--color-terracotta);
  text-decoration: none;
}

body.fm.woocommerce-checkout .woocommerce-form-login-toggle .showlogin:hover,
body.fm.woocommerce-checkout .woocommerce-form-coupon-toggle .showcoupon:hover {
  text-decoration: underline;
}

body.fm.woocommerce-checkout form.login.woocommerce-form-login,
body.fm.woocommerce-checkout form.checkout_coupon.woocommerce-form-coupon {
  /* The toggle notice above (.woocommerce-form-login-toggle) gets this same
     span via a padding-only wrapper around a full-width inner card; this
     form has no such wrapper -- it's the visible bordered box itself -- so
     the gutter has to come off its own width instead of just padding
     inward, or its border/background still spans the full content-max
     (matching the header) instead of the grid's actual content area (both
     columns + the gap between them). `max-width` alone only shrinks it once
     the viewport exceeds --content-max (desktop); below that it's a no-op,
     so mobile needs its own `width` term to keep the gutter on narrow
     screens too. */
  width: calc(100% - 2 * var(--content-gutter));
  max-width: calc(var(--content-max) - 2 * var(--content-gutter));
  background: #fff;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-card);
  padding: 20px var(--content-gutter);
  margin: 0 auto clamp(16px, 2vw, 20px);
  box-sizing: border-box;
}

body.fm.woocommerce-checkout form.checkout_coupon .form-row {
  margin: 0 0 12px;
}

/* Login card, OPEN state (Finalizar-compra-login.dc.html): username + password
   sit side by side while every other row (eyebrow title, remember/submit,
   lost-password) spans full width. Core's global/form-login.php already tags the
   two credential fields form-row-first/-last, so a 2-col grid on the form itself
   needs no extra markup -- the row gap replaces each .form-row's own margin. */
body.fm.woocommerce-checkout form.login.woocommerce-form-login {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 16px;
}

body.fm.woocommerce-checkout form.login .form-row,
body.fm.woocommerce-checkout form.login .lost_password,
body.fm.woocommerce-checkout form.login > p:not([class]) {
  grid-column: 1 / -1;
  margin: 0;
}

body.fm.woocommerce-checkout form.login .form-row-first {
  grid-column: 1;
}

body.fm.woocommerce-checkout form.login .form-row-last {
  grid-column: 2;
}

/* Storefront ships .form-row-first/-last as floated 47%-wide columns; inside the
   grid the leftover width:47% shrinks each field to under half its cell (its
   100%-wide input then reads as "not filling the row"). Reset to let the grid
   track own the width -- mirrors the billing block's own float/width reset. */
body.fm.woocommerce-checkout form.login .form-row-first,
body.fm.woocommerce-checkout form.login .form-row-last {
  width: auto;
  float: none;
}

/* Core drops two empty <div class="clear"> between the field pair and the
   remember/submit row; as grid items they'd each open a phantom gap row. */
body.fm.woocommerce-checkout form.login .clear {
  display: none;
}

/* The intro message (woocommerce_login_form()'s $message, wpautop'd into a bare
   classless <p>) is the card's eyebrow heading in the mockup -- a plain <p>, so
   the sitewide h1-h3 900 !important rule never touches it and 800 lands cleanly.
   padding-right clears the absolutely-positioned close button (below). */
body.fm.woocommerce-checkout form.login > p:not([class]) {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink);
  padding-right: 40px;
}

/* Top-right close (X): an <a class="showlogin"> so checkout.js's existing
   a.showlogin handler slides the card shut (see inc/checkout.php,
   futbol_mesa_checkout_login_close_button). Absolute, so it leaves the grid flow. */
body.fm.woocommerce-checkout form.login .fm-login-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--color-muted);
}

body.fm.woocommerce-checkout form.login .fm-login-close:hover {
  color: var(--color-terracotta);
  background: var(--color-cream);
}

/* "Acceder": Storefront's default button (square, its own theme colour) never
   matched the mockup's rounded terracotta pill. */
body.fm.woocommerce-checkout form.login .woocommerce-form-login__submit {
  margin: 0;
  background: var(--color-terracotta);
  border: 1px solid var(--color-terracotta);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  padding: 13px 28px;
  border-radius: var(--radius-button);
  cursor: pointer;
}

body.fm.woocommerce-checkout form.login .woocommerce-form-login__submit:hover,
body.fm.woocommerce-checkout form.login .woocommerce-form-login__submit:focus {
  background: var(--color-terracotta-hover);
  border-color: var(--color-terracotta-hover);
  color: #fff;
}

/* Lost-password link: default body copy renders it a full 1rem; the mockup's is
   a small 0.85rem terracotta underline sitting just under the field row. */
body.fm.woocommerce-checkout form.login .lost_password a {
  font-size: 0.85rem;
  color: var(--color-terracotta);
  text-decoration: underline;
}

/* Username/password labels never got the billing-field label treatment
   (bold heading font, small caps-ish tracking) -- `[for]` scopes this to the
   two real field labels, not the "Recuérdame" checkbox label just below
   (that one wraps its checkbox rather than using `for`, and reads as plain
   body text like every other checkbox label on this page). */
body.fm.woocommerce-checkout .woocommerce-form-login label[for] {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--color-body);
  margin-bottom: 6px;
}

/* "Recuérdame" + "Acceder": core markup puts both in one plain <p class="form-
   row"> (block flow, so the button dropped below the checkbox). `:has()`
   targets that specific row via the submit button it contains, since it's
   the only .form-row here without a form-row-first/-last class to hook. */
body.fm.woocommerce-checkout .woocommerce-form-login p.form-row:has(.woocommerce-form-login__submit) {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* CARDS: shared look for every left-column panel (billing, shipping-toggle,
   order-notes) and the injected .fm-checkout-card wrapper from the copied
   form-billing.php. */
body.fm.woocommerce-checkout .fm-checkout-card,
body.fm.woocommerce-checkout .woocommerce-shipping-fields,
body.fm.woocommerce-checkout .woocommerce-additional-fields {
  background: #fff;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-card);
  padding: 24px;
}

body.fm.woocommerce-checkout .fm-checkout-card__title,
body.fm.woocommerce-checkout .woocommerce-additional-fields__field-wrapper label[for="order_comments"] {
  display: block;
  font-family: var(--font-heading);
  /* No font-weight override: the sitewide `h1,h2,h3{font-weight:900 !important}`
     rule (01-tokens-header.css) already applies to .fm-checkout-card__title's
     <h2>/<h3> tags and can only be beaten by another !important (see
     06-cart.css's .fm-cart-summary__eyebrow for that precedent) -- 900 vs the
     mockup's 800 is not worth reintroducing !important for on a small
     uppercase label. order_comments' label is a plain <label>, unaffected by
     that rule, so it renders at this rule's default (browser/UA) weight;
     living beside the two headings, it reads consistently enough as-is. */
  font-size: 0.82rem;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 18px;
}

/* order_comments' label is a plain <label>, not subject to the h1-h3 rule
   above, so 700 applies cleanly without !important. */
body.fm.woocommerce-checkout .woocommerce-additional-fields__field-wrapper label[for="order_comments"] {
  font-weight: 700;
}

/* FIELD GRID: WooCommerce's own form-row-first/-last/-wide classes already
   distinguish half- vs full-width fields, so the 2-col grid needs no extra
   markup — see the "mockup's .field-grid/.full via WC's own classes" note in
   the implementation report. */
body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
body.fm.woocommerce-checkout .shipping_address .woocommerce-shipping-fields__field-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-wide,
body.fm.woocommerce-checkout .shipping_address .woocommerce-shipping-fields__field-wrapper .form-row-wide {
  grid-column: 1 / -1;
}

/* Pin the contact/name group above the address block. WooCommerce's client-side
   address-i18n.js reorders the address fields by locale priority on load and
   drops billing_phone (not an address field, so it carries no locale priority)
   to the end of the wrapper; grid `order` re-fixes the mockup sequence
   (Nombre|Apellidos, Correo, Teléfono, then the address block) independent of
   that DOM shuffle. */
body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper #billing_first_name_field {
  order: -5;
}
body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper #billing_last_name_field {
  order: -4;
}
body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper #billing_email_field {
  order: -3;
}
body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper #billing_phone_field {
  order: -2;
}

body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-first,
body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-last,
body.fm.woocommerce-checkout .shipping_address .woocommerce-shipping-fields__field-wrapper .form-row-first,
body.fm.woocommerce-checkout .shipping_address .woocommerce-shipping-fields__field-wrapper .form-row-last {
  width: auto;
  float: none;
  margin: 0;
}

body.fm.woocommerce-checkout .woocommerce-billing-fields .form-row,
body.fm.woocommerce-checkout .woocommerce-shipping-fields .form-row,
body.fm.woocommerce-checkout .woocommerce-account-fields .form-row {
  margin: 0 0 16px;
}

body.fm.woocommerce-checkout .woocommerce-billing-fields label,
body.fm.woocommerce-checkout .woocommerce-shipping-fields label,
body.fm.woocommerce-checkout .woocommerce-account-fields div.create-account label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  color: var(--color-body);
  margin-bottom: 6px;
}

/* Core's own auto-appended "(opcional)" indicator (woocommerce_form_field(),
   .optional class) on non-required fields -- muted to match the mockup's hint
   styling instead of reinventing the optional/required logic here. */
body.fm.woocommerce-checkout .woocommerce-billing-fields .optional,
body.fm.woocommerce-checkout .woocommerce-shipping-fields .optional,
body.fm.woocommerce-checkout .woocommerce-additional-fields .optional {
  font-weight: 500;
  color: var(--color-muted);
}

body.fm.woocommerce-checkout .woocommerce-billing-fields input.input-text,
body.fm.woocommerce-checkout .woocommerce-billing-fields select,
body.fm.woocommerce-checkout .woocommerce-billing-fields textarea,
body.fm.woocommerce-checkout .woocommerce-shipping-fields input.input-text,
body.fm.woocommerce-checkout .woocommerce-shipping-fields select,
body.fm.woocommerce-checkout .woocommerce-additional-fields input.input-text,
body.fm.woocommerce-checkout .woocommerce-additional-fields textarea,
body.fm.woocommerce-checkout .woocommerce-account-fields input.input-text,
body.fm.woocommerce-checkout .woocommerce-form-login input.input-text {
  width: 100%;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-button);
  padding: 12px 14px;
  font-size: 0.95rem;
  /* Storefront's global body line-height (1.618) inherits into every field,
     inflating each one several px taller than the mockup, which never sets
     its own line-height (so it renders at the browser's tighter ~1.2
     default) -- pinned here so field height is padding + glyph, not
     padding + Storefront's prose line-height. */
  line-height: 1.3;
  color: var(--color-ink);
  background: #fff;
  /* Storefront's own input style sets an inset box-shadow on this same
     selector's element type -- a different property than anything above, so
     it never lost the cascade and kept rendering. The mockup has flat,
     shadow-less fields (Finalizar-compra.dc.html .field input/select/textarea). */
  box-shadow: none;
}

body.fm.woocommerce-checkout .woocommerce-billing-fields input.input-text:focus,
body.fm.woocommerce-checkout .woocommerce-billing-fields select:focus,
body.fm.woocommerce-checkout .woocommerce-shipping-fields input.input-text:focus,
body.fm.woocommerce-checkout .woocommerce-shipping-fields select:focus,
body.fm.woocommerce-checkout .woocommerce-additional-fields textarea:focus,
body.fm.woocommerce-checkout .woocommerce-account-fields input.input-text:focus,
body.fm.woocommerce-checkout .woocommerce-form-login input.input-text:focus {
  outline: none;
  border-color: var(--color-terracotta);
}

/* Login form ("¿Ya tienes una cuenta?" toggle): unlike the billing/shipping
   fields above, this form never got its own input styling, so username/
   password fell back to Storefront's default grey, square-cornered fields.
   The password field also carries Storefront's show/hide-password button
   (assets/js password-toggle feature) absolutely positioned inside
   `.password-input` -- give that wrapper a real height/position so the
   button lands inside the now-taller, rounded field instead of overlapping
   its border. */
body.fm.woocommerce-checkout .woocommerce-form-login .password-input {
  position: relative;
  display: block;
}

body.fm.woocommerce-checkout .woocommerce-form-login .password-input input.input-text {
  padding-right: 44px;
}

/* Storefront draws the button's icon with a Font Awesome ::after glyph, but
   storefront-icons (the FA stylesheet) is dequeued site-wide (functions.php)
   -- same missing-glyph problem already fixed for .woocommerce-message/
   -error::before (02-navigation-footer.css), same inline-SVG fix here. */
body.fm.woocommerce-checkout .woocommerce-form-login .show-password-input {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

body.fm.woocommerce-checkout .woocommerce-form-login .show-password-input::after {
  font-family: inherit;
  content: '';
  display: block;
  width: 100%;
  height: 100%;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 18px 18px;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23606060' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3e%3ccircle cx='12' cy='12' r='3'/%3e%3c/svg%3e");
}

body.fm.woocommerce-checkout .woocommerce-form-login .show-password-input.display-password::after {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23606060' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpath d='M17.94 17.94A10.94 10.94 0 0 1 12 20c-7 0-11-8-11-8a18.5 18.5 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24'/%3e%3cline x1='1' y1='1' x2='23' y2='23'/%3e%3c/svg%3e");
}

body.fm.woocommerce-checkout .woocommerce-additional-fields textarea {
  resize: vertical;
  min-height: 80px;
}

/* Country/state selects render as select2 (search + WooCommerce's state-cascade
   JS bind to it, see checkout-shipping-refresh.js -- the plugin isn't removed,
   only reskinned). WooCommerce's own select2.css loads before this partial and
   sets a fixed 28px pill, #aaa border and 4px radius; overridden below to the
   same flat hairline/radius/padding/line-height as every other checkout field
   above, so both sit at the same height. */
body.fm.woocommerce-checkout .select2-container--default .select2-selection--single {
  height: auto;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-button);
  background: #fff;
  box-shadow: none;
}

body.fm.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__rendered {
  padding: 12px 32px 12px 14px;
  line-height: 1.3;
  font-size: 0.95rem;
  color: var(--color-ink);
}

body.fm.woocommerce-checkout .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 100%;
  top: 0;
  right: 6px;
  width: 20px;
}

body.fm.woocommerce-checkout .select2-container--default .select2-selection--single:focus,
body.fm.woocommerce-checkout .select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--color-terracotta);
}

body.fm.woocommerce-checkout .select2-dropdown {
  border-color: var(--color-hairline);
  border-radius: var(--radius-button);
  font-size: 0.95rem;
}

body.fm.woocommerce-checkout .select2-container--default .select2-results__option--highlighted[aria-selected] {
  background-color: var(--color-terracotta);
}

/* "Ship to a different address?" toggle + revealed address fields. */
body.fm.woocommerce-checkout #ship-to-different-address {
  margin: 0 0 4px;
}

body.fm.woocommerce-checkout #ship-to-different-address label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.88rem;
  color: var(--color-body);
  cursor: pointer;
  margin: 0;
}

body.fm.woocommerce-checkout #ship-to-different-address-checkbox {
  width: 17px;
  height: 17px;
  accent-color: var(--color-terracotta);
  cursor: pointer;
}

body.fm.woocommerce-checkout .shipping_address {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--color-hairline);
}

/* "¿Crear una cuenta?" inset box: one shared background wraps the checkbox
   row (p.create-account) and the revealed password field (div.create-account)
   -- both real, siblings under .woocommerce-account-fields. */
body.fm.woocommerce-checkout .woocommerce-account-fields {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--color-cream);
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-button);
}

body.fm.woocommerce-checkout .woocommerce-account-fields p.create-account {
  margin: 0;
}

body.fm.woocommerce-checkout .woocommerce-account-fields p.create-account label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.88rem;
  color: var(--color-body);
  cursor: pointer;
}

body.fm.woocommerce-checkout .woocommerce-account-fields #createaccount {
  width: 18px;
  height: 18px;
  accent-color: var(--color-terracotta);
  cursor: pointer;
}

body.fm.woocommerce-checkout .woocommerce-account-fields #createaccount + span {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--color-ink);
}

/* Real reveal is WooCommerce's own JS (checkout.js toggle_create_account,
   fires on #createaccount's `change` event) toggling an inline style on
   div.create-account, which always wins over a stylesheet rule. This is a
   CSS-only fallback for the (extremely unlikely) case JS fails to load — a
   literal `~` sibling selector can't reach div.create-account because
   #createaccount is nested two levels inside p.create-account, not a direct
   sibling, so :has() keys off the same real checkbox instead. */
body.fm.woocommerce-checkout .woocommerce-account-fields div.create-account {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--color-hairline);
}

body.fm.woocommerce-checkout .woocommerce-account-fields:not(:has(#createaccount:checked)) div.create-account {
  display: none;
}

/* SIDEBAR: #order_review holds the two real sibling blocks (the
   review-order-table div and the #payment div) as a plain flex column so each
   keeps its own card look — see woocommerce/checkout/review-order.php. */
body.fm.woocommerce-checkout #order_review.woocommerce-checkout-review-order {
  grid-column: 2;
  grid-row: 1;
  /* Storefront's own woocommerce.css sets #order_review{width:41.17%;float:right}
     for its native 2-col checkout float layout; we don't otherwise touch
     `width`, so that percentage still resolves (against this grid item's
     400px track) unless overridden here -- same fix already applied to
     #customer_details.col2-set below. */
  width: 100%;
  float: none;
  margin-right: 0;
  align-self: start;
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  /* Sidebar is a bare column of white cards on the cream page -- Storefront
     paints #order_review white, which would put white cards on a white panel. */
  background: transparent;
}

/* Core's own "Your order" <h3> duplicates the review card's own eyebrow title.
   As a grid child it also occupies an empty first row, so its row-gap opens a
   ~40px band between the step indicator and the columns; drop it from the
   layout entirely (the visible "TU PEDIDO" title in the review card remains). */
body.fm.woocommerce-checkout #order_review_heading {
  display: none;
}

body.fm.woocommerce-checkout .fm-checkout-review,
body.fm.woocommerce-checkout .woocommerce-checkout-payment {
  background: #fff;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-card);
  padding: 22px 22px 24px;
}

/* The place-order row is Storefront-styled with a grey inner box + padding; the
   mockup has the button, trust points and badges sit flush inside the payment
   card, so strip that nested box. Storefront also puts a huge 2.618em
   margin-top on this wrapper (meant to separate it from a much taller default
   payment box) -- dropped to 0 since #place_order's own 16px margin-top
   already gives the button its gap from the payment method list above. */
body.fm.woocommerce-checkout #payment .place-order {
  background: none;
  padding: 0;
  margin-top: 0;
}

/* Hidden order-attribution inputs are still a flex item in .col-1 (gap:20px),
   opening a phantom 20px above the billing card so it no longer top-aligns with
   the order card; drop it from the flex flow. */
body.fm.woocommerce-checkout wc-order-attribution-inputs {
  display: none;
}

body.fm.woocommerce-checkout .fm-checkout-review__items {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

body.fm.woocommerce-checkout .fm-checkout-review__item {
  display: flex;
  align-items: center;
  gap: 12px;
}

body.fm.woocommerce-checkout .fm-checkout-review__thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  border-radius: var(--radius-button);
  overflow: hidden;
  background: var(--color-cream);
}

body.fm.woocommerce-checkout .fm-checkout-review__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

body.fm.woocommerce-checkout .fm-checkout-review__name {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.3;
  /* Neither this nor .fm-checkout-review__total set their own color in the
     mockup either -- both just inherit its body{color:var(--color-ink)}.
     Storefront's own body color is a lighter grey, so without an explicit
     override here the item name/price silently inherited that grey instead
     of the near-black ink the design intends. */
  color: var(--color-ink);
}

body.fm.woocommerce-checkout .fm-checkout-review__qty {
  display: block;
  margin-top: 3px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--color-muted);
}

body.fm.woocommerce-checkout .fm-checkout-review__total {
  flex: 0 0 auto;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 0.92rem;
  color: var(--color-ink);
}

body.fm.woocommerce-checkout .fm-checkout-review__divider {
  height: 1px;
  background: var(--color-hairline);
  margin: 16px 0;
}

body.fm.woocommerce-checkout .fm-checkout-review__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.95rem;
  padding: 5px 0;
}

body.fm.woocommerce-checkout .fm-checkout-review__label {
  color: var(--color-body);
}

body.fm.woocommerce-checkout .fm-checkout-review__value {
  font-family: var(--font-heading);
  font-weight: 700;
  text-align: right;
  color: var(--color-ink);
}

body.fm.woocommerce-checkout .fm-checkout-review__row--total .fm-checkout-review__label {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  color: var(--color-ink);
}

body.fm.woocommerce-checkout .fm-checkout-review__row--total .fm-checkout-review__value {
  font-weight: 900;
  font-size: 1.7rem;
  color: var(--color-terracotta);
}

/* wc_cart_totals_order_total_html() wraps the amount in a <strong> that resets
   the weight to 600; re-assert the mockup's 900 on the amount itself. */
body.fm.woocommerce-checkout .fm-checkout-review__row--total .fm-checkout-review__value strong,
body.fm.woocommerce-checkout .fm-checkout-review__row--total .fm-checkout-review__value .woocommerce-Price-amount {
  font-weight: 900;
}

/* Shipping row: wc_cart_totals_shipping_html() renders a <tr><th>/<td> via
   cart/cart-shipping.php; with no parent <table>, the parser drops those
   tokens and keeps only ul#shipping_method (is_cart() is false on checkout,
   so the destination line/calculator that cart.php also handles don't print
   here at all). */
body.fm.woocommerce-checkout .fm-checkout-review__row--shipping {
  flex-wrap: wrap;
}

body.fm.woocommerce-checkout .fm-checkout-review__row--shipping ul.woocommerce-shipping-methods {
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  text-align: right;
}

body.fm.woocommerce-checkout .fm-checkout-review__row--shipping ul.woocommerce-shipping-methods li {
  margin: 0;
}

body.fm.woocommerce-checkout .woocommerce-remove-coupon {
  margin-left: 6px;
  font-size: 0.78rem;
  color: var(--color-muted);
}

body.fm.woocommerce-checkout .woocommerce-remove-coupon:hover {
  color: var(--color-terracotta);
}

/* PAYMENT CARD */
body.fm.woocommerce-checkout ul.wc_payment_methods.payment_methods {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Radio-left / title+description-right, matching the mockup's .pay-option.
   WooCommerce prints <input><label><div.payment_box> as siblings; a 2-col grid
   places the radio in column 1 and the label + (toggled) payment_box stacked in
   column 2, instead of the label block wrapping onto its own line below. */
/* Selector carries the `ul.wc_payment_methods li` ancestry to out-specify
   Storefront's `#payment li:last-child { padding-bottom:0; border-bottom:0 }`,
   which otherwise strips the last card's bottom padding + border and clips the
   selected method's description against the edge (LRN-020 load order). */
body.fm.woocommerce-checkout #payment ul.wc_payment_methods li.wc_payment_method {
  position: relative;
  border: 1px solid var(--color-hairline);
  border-radius: var(--radius-button);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 12px;
  /* Storefront's Customizer generates an inline `<style>` (theme_mod-derived,
     no stylesheet href) that darkens every unselected option's background by
     10% -- this rule never set its own background-color to compete with it.
     The mockup's .pay-option is transparent (shows the white card underneath)
     until .pay-option--selected tints it terracotta (below). */
  background: transparent;
}

/* Stretched-label hit target: the label's own box only covers the title text
   (grid-column 2, grid-row 1), so clicking the border/padding around it, or
   the description text below, did nothing. `label::before` is generated
   content of the label itself, so a click anywhere on it still fires the
   label's native `for`-linked toggle -- absolutely positioned to `inset: 0`
   against the now-relative `li`, it covers the full card without touching
   the visible layout (transparent, no size in normal flow). */
body.fm.woocommerce-checkout #payment .wc_payment_method label::before {
  content: '';
  position: absolute;
  inset: 0;
  cursor: pointer;
}

body.fm.woocommerce-checkout #payment ul.wc_payment_methods li.wc_payment_method:has(> input:checked) {
  border-color: var(--color-terracotta);
  background: rgba(168, 72, 48, 0.04);
}

body.fm.woocommerce-checkout .wc_payment_method input.input-radio {
  grid-column: 1;
  grid-row: 1;
  margin-top: 2px;
  accent-color: var(--color-terracotta);
  cursor: pointer;
}

/* #payment in the selector matches the specificity of Storefront's own
   `#payment label` / `#payment .payment_box` rules, which otherwise win because
   storefront-woocommerce.css loads after this child partial (LRN-020). */
body.fm.woocommerce-checkout #payment .wc_payment_method label {
  grid-column: 2;
  grid-row: 1;
  display: block;
  /* Storefront gives payment labels a ~20px padding that pushes the title text
     down so the radio no longer lines up with it; zero it so radio + title
     share a baseline, matching the mockup. */
  margin: 0;
  padding: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--color-ink);
  cursor: pointer;
}

/* The mockup's payment options are text-only (no gateway logo); hide the
   WooCommerce PayPal mark so every option reads as a plain title + description. */
body.fm.woocommerce-checkout .wc_payment_method label img {
  display: none;
}

/* Description shows only for the selected method: WooCommerce prints
   non-selected .payment_box with an inline `display:none` and checkout.js
   toggles it on change -- left as-is (no display override). Strip WooCommerce's
   default speech-bubble box (grey background, padding, border) so it renders as
   the mockup's plain muted paragraph directly under the title. */
body.fm.woocommerce-checkout #payment .wc_payment_method .payment_box {
  grid-column: 2;
  margin: 3px 0 0;
  padding: 0;
  background: none;
  border: 0;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--color-muted);
}

body.fm.woocommerce-checkout #payment .wc_payment_method .payment_box::before {
  display: none;
}

body.fm.woocommerce-checkout .wc_payment_method .payment_box p {
  margin: 0;
}

/* Bizum/bank-transfer descriptions (futbol-mesa-core mu-plugin,
   futbol_mesa_bizum_gateway_description() / _bacs_gateway_description())
   print as a checklist instead of one paragraph -- plain lines, no bullet
   marker, matching the payment_box's existing plain-paragraph look. */
body.fm.woocommerce-checkout .wc_payment_method .payment_box .fm-gateway-description {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Terms + submit. The wrapper can legitimately render empty (no terms page
   configured, per wc_terms_and_conditions_checkbox_enabled()) -- spacing is
   applied to the real checkbox row so an empty wrapper takes no visual room. */
body.fm.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper .form-row {
  margin: 18px 0 0;
}

body.fm.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper label {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.82rem;
  color: var(--color-body);
  cursor: pointer;
}

body.fm.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper input#terms {
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--color-terracotta);
  cursor: pointer;
}

body.fm.woocommerce-checkout .woocommerce-terms-and-conditions-wrapper a {
  color: var(--color-terracotta);
  text-decoration: underline;
}

body.fm.woocommerce-checkout #place_order {
  display: block;
  width: 100%;
  margin-top: 24px;
  background: var(--color-terracotta);
  border: 1px solid var(--color-terracotta);
  color: #fff;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding: 16px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-align: center;
}

body.fm.woocommerce-checkout #place_order:hover,
body.fm.woocommerce-checkout #place_order:focus {
  background: var(--color-terracotta-hover);
  border-color: var(--color-terracotta-hover);
  color: #fff;
}

/* Existing TSK-028 card-brand/Bizum block (hooked before the button) keeps its
   own styling from that feature; only the new trust row + payment badges
   below the button (hooked after it) are new here. */
body.fm.woocommerce-checkout .fm-checkout-trustrow {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}

body.fm.woocommerce-checkout .fm-checkout-trustrow__item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--color-body);
}

body.fm.woocommerce-checkout .fm-checkout-trustrow__icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: rgba(31, 107, 74, 0.10);
  color: var(--color-pitch-green);
}

body.fm.woocommerce-checkout .fm-checkout-trustrow__icon svg {
  width: 14px;
  height: 14px;
}

/* RESPONSIVE */
@media (max-width: 900px) {
  body.fm.woocommerce-checkout form.checkout.woocommerce-checkout {
    grid-template-columns: 1fr;
  }

  /* Collapsed to a single column, so #customer_details and #order_review
     can no longer sit side by side in row 1 -- both still carry the base
     rule's explicit `grid-row: 1` though, which pins them to the same cell
     and makes them overlap instead of stack. Let auto-placement flow them
     into their own rows, in DOM order (billing fields, then the sidebar). */
  body.fm.woocommerce-checkout #customer_details.col2-set {
    grid-row: auto;
  }

  body.fm.woocommerce-checkout #order_review.woocommerce-checkout-review-order {
    grid-column: 1;
    grid-row: auto;
    position: static;
    top: auto;
  }
}

@media (max-width: 560px) {
  body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
  body.fm.woocommerce-checkout .shipping_address .woocommerce-shipping-fields__field-wrapper {
    grid-template-columns: 1fr;
  }

  body.fm.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-wide,
  body.fm.woocommerce-checkout .shipping_address .woocommerce-shipping-fields__field-wrapper .form-row-wide {
    grid-column: auto;
  }

  /* Login card: username + password sit side by side above this breakpoint
     (Finalizar-compra-login.dc.html's OPEN state), same as the billing
     fields' two-up layout -- collapse to one column here too so the fields
     don't get squeezed narrower than they can hold their own value. */
  body.fm.woocommerce-checkout form.login.woocommerce-form-login {
    grid-template-columns: 1fr;
  }

  body.fm.woocommerce-checkout form.login .form-row-first,
  body.fm.woocommerce-checkout form.login .form-row-last {
    grid-column: 1;
  }

  body.fm.woocommerce-checkout .steps-label {
    display: none;
  }

  /* "¿Ya tienes una cuenta?" notice: text + "Iniciar sesión" link sit on one
     row, space-between, above this breakpoint. Stacked instead on mobile,
     both left-aligned -- the link's margin-left:auto (base rule, pins it to
     the row's right edge) has to be dropped or it'd still shove itself to
     the right of the now-full-width column. */
  body.fm.woocommerce-checkout .woocommerce-form-login-toggle .woocommerce-info {
    flex-direction: column;
    align-items: flex-start;
  }

  body.fm.woocommerce-checkout .woocommerce-form-login-toggle .showlogin {
    margin-left: 0;
  }
}
