/* Layaway — ported from Pawn Marketplace v3.0.1 (2026-10-06), translated to v3.1 conventions. */

/* ════════════════════════════════════════════════════════════════════════════════════════════════
   Pages/Layaway.razor (/layaway) and Pages/LayawayDetail.razor (/layaway/{Id}).

   From v3.0.1 (wwwroot/CSS/Pages/Layaway.css): the features and their motion — card tint 0.15s,
   card and Payment History bodies 0.3s cubic-bezier(0.25,0.46,0.45,0.94), chevrons rotate 0.3s ease,
   progress fill width 0.5s ease.
   From v3.1: everything else. Momento 8px scale (no 2/4/6/10/12/14/20/28 spacing), v3.1 tokens, and
   these v3.1 classes reused AS THEY ARE (not restyled here):
     · .fc-item-bar / .fc-item-bar-inner / .fc-item-back — sticky back bar (ItemDetails.css). The
       native status-bar scrim recognises .fc-item-bar. Inherited: .fc-item-back's 4px icon gap.
     · .fc-item-empty (+ -icon / -title / -msg) and .fc-item-cta — empty and not-found states.
     · .fc-item-name / .fc-item-itemno / .fc-item-price — Layaway Detail header block.
     · .fc-item-storelink — link buttons (store, phone) and the View Details link (an <a>): no
       press, link ring.
     · .profile_heading_cls — the list's page heading (ProfileMenu.css).
     · .fc-item-acc / -head / -panel / -panel-inner / -body — Payment History accordion (Block focus
       from Accessibility.css). Its chevron rotates (v3.0.1) instead of swapping glyphs (v3.1).
     · .fc-addr* + .fc-iconbtn + .fc-sheet-handle — Item Detail's address-options modal.
       Inherited: .fc-addr-headtext 2px and .fc-addr-option-text 3px text gaps.
   No hover effects: v3.0.1's layaway pages have none, and v3.1's accordion heads and nav cards have
   none (any future hover must sit inside @media (hover: hover)).
   ════════════════════════════════════════════════════════════════════════════════════════════════ */

/* ── Page root (both pages) ───────────────────────────────────────────────────────────────────── */
/* State colours as one-line properties (spec §2), with the SAME names and values as the Pawn Loans
   pages (PawnLoans.css .fc-pawn), so Kelly approves one set for both. Approved by Kelly, 2026-10-07:
     --fc-loan-urgent  #B50407 (brand red): overdue chip text, card ring and tint. 5.2:1 as chip text
                       on the overdue card (v3.0.1's #E22721 was about 3.4:1).
     --fc-loan-soon    #8A5A00: due-soon chip text on its 10% tint. 5.1:1 on a closed card, 4.6:1 on
                       an open card (v3.0.1's layaway mix was a different hue from the loans pages).
     --fc-loan-ok      #0A6C20, darkened from v3.0.1's #0D8728 to meet WCAG AA (Kelly, 2026-10-07): the
                       Ok / Paid chip, every Paid value and the paid-off banner. At least 4.68:1 on every
                       card, tint and page background these pages use (#0D8728 was 3.7-4.2:1). */
.fc-lay {
  --fc-loan-urgent: var(--color-brand-accent);
  --fc-loan-soon: #8A5A00;
  --fc-loan-ok: #0A6C20;
  --fc-lay-tabclear: 0px;
  /* Profile / Campaign gradient. The floor subtracts the native header and tab bar, which pad the
     scroller (Stores precedent), so short states don't over-scroll in the app. Flex column (with
     .fc-lay-inner and the phone grid growing, below) so a short page still puts the phone summary
     drawer at the bottom of the screen: sticky bottom:0 only pins a drawer that would otherwise sit
     below the fold; it never moves one down. Same structure as the Pawn Loans pages. */
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--fc-appbar-h, 0px) - var(--native-header-h, 0px) - var(--fc-lay-tabclear));
  background: linear-gradient(to bottom, var(--color-surface-info-bg) 0%, var(--color-surface-subtle) 100%);
}
.page.has-bottomnav .fc-lay {
  --fc-lay-tabclear: calc(56px + var(--fc-tabbar-pad-bottom));
}

/* Desktop: the back bar and sticky columns offset by the header only (no Set Location bar here),
   with the 100px fallback so nothing animates on a direct load (CampaignsItemPage.css precedent). */
@media (min-width: 1025px) {
  .fc-lay { --fc-header-h: var(--fc-appbar-h, 100px); }
  html.fc-header-hidden .fc-lay { --fc-header-h: 0px; }
  /* A TABLET IN LANDSCAPE IS >1024 BUT IS NOT DESKTOP — the issue flagged in PawnLoans.css's own
     header comment, now measured on an iPad: --fc-appbar-h is a desktop-only token that the native
     shell never sets, so `var(--fc-appbar-h, 100px)` falls back to the literal 100px and pushes the
     back bar and every sticky column 100px below where the native header actually ends. The desktop
     collapse class (fc-header-hidden) is never set on native either, so nothing returns it to 0.
     Hold the <=1024 value instead; the native header's height is already paid by the scroll
     container's padding, exactly as in portrait. (ItemDetails.css carries the same rule.) */
  html.fc-native-shell .fc-lay { --fc-header-h: 0px; }
}

/* iOS app: paint the gradient once on a viewport-fixed layer, not on every scroll frame (Profile's
   fix). Scoped to the app (.page.has-bottomnav), which is what Profile's note intends: its gate,
   -webkit-touch-callout, also matches Safari on iPhone and iPad, and on an iPad wide enough for the
   web footer (1024px and up) this z-index:0 layer painted over that footer (an unpositioned flex item
   after the page), hiding it while its links stayed clickable underneath. */
@supports (-webkit-touch-callout: none) {
  .page.has-bottomnav .fc-lay {
    background: none;
    position: relative;
    z-index: 0;
  }
  .page.has-bottomnav .fc-lay::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: linear-gradient(to bottom, var(--color-surface-info-bg) 0%, var(--color-surface-subtle) 100%);
  }
}

/* Content column: page insets 16 / 16 / 48, sides 32 from 834px. Profile's Momento grid margin, the
   same as the sign-in page these routes show when signed out and the Pawn Loans pages, so nothing
   shifts between them. Grows to fill the page (flex column above). The Detail grid reuses this class
   and overrides display (grid) further down. */
.fc-lay-inner {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  padding: var(--space-2) var(--space-2) var(--space-6);
}
@media (min-width: 834px) {
  .fc-lay-inner {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }
}

/* ── List header ──────────────────────────────────────────────────────────────────────────────── */
/* h1 left, count right (Loan History's header row): wraps, count under the heading, when a long
   heading such as Spanish "Productos apartados" leaves no room on a phone. */
.fc-lay-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
  margin-bottom: var(--space-2);
}
/* The h1 takes v3.1's page heading, .profile_heading_cls (Momento heading-xl, Inter Bold 28/32,
   0.2px; ProfileMenu.css), like the sign-in page and the Pawn Loans pages. */
.fc-lay-title { margin: 0; }
/* "(4) Items": the Wish List count label's look (SavedItems.css .view-text), as on Pawn Loans. */
.fc-lay-count {
  flex-shrink: 0;
  font-family: var(--font-body);
  font-size: var(--text-action-md-size);
  line-height: var(--text-action-md-lh);
  font-weight: var(--fw-bold);
  color: var(--color-text-muted);
  white-space: nowrap;
}

/* ── List grid: cards | Payment Summary ───────────────────────────────────────────────────────── */
.fc-lay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--space-2);
  align-items: start;
}
/* Nothing owed: no summary column. */
.fc-lay-grid--solo { grid-template-columns: minmax(0, 1fr); }

/* ── Tablets (native shell): the summary is 25% of the row, not a fixed 340px ─────────────────
   340px is a constant, so its SHARE of the row tracks whatever width is left over: 26.6% of web's
   1280px content column, but 43.1% of an iPad's 788px in portrait, which squeezed the cards into
   432px and is what truncated the item titles and wrapped the store address over three lines.
   A percentage holds the web proportion at every tablet width and in both orientations
   (portrait 788 -> 197px, landscape 1046 -> 261px). Native shell only, so web and phones keep the
   fixed column they already have; >=768px because phones stack instead. */
@media (min-width: 768px) {
  html.fc-native-shell .fc-lay-grid { grid-template-columns: minmax(0, 1fr) 25%; }
  /* Re-asserted above: the rule before it outranks .fc-lay-grid--solo (0,2,0 vs 0,1,0), so without
     this a layaway with nothing owed would reserve a column for a summary that is not there. */
  html.fc-native-shell .fc-lay-grid--solo { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 768px) and (orientation: portrait) {
  /* PORTRAIT 35%, landscape 25%. A single percentage cannot serve both: 25% of an iPad's 788px
     portrait row is 197px, too narrow for an item name beside its price, while 25% of the 1046px
     landscape row is a comfortable 261px. Keyed on `orientation`, not a width breakpoint, so a
     Split View window gets the share that matches its own aspect rather than the device's. */
  html.fc-native-shell .fc-lay-grid { grid-template-columns: minmax(0, 1fr) 35%; }
  html.fc-native-shell .fc-lay-grid--solo { grid-template-columns: minmax(0, 1fr); }
}
.fc-lay-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

/* ── Layaway card ─────────────────────────────────────────────────────────────────────────────── */
/* Status tint + ring (v3.0.1): default grey, open blue, overdue red (overdue wins over open). The ring
   is an inset shadow so 1px → 2px never shifts the content. */
.fc-lay-card {
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-border) 7%, var(--color-surface-default));
  box-shadow: inset 0 0 0 1px var(--color-border);
  overflow: hidden;
  transition: box-shadow 0.15s, background-color 0.15s;
}
.fc-lay-card--open {
  background: color-mix(in srgb, var(--color-brand-primary) 7%, var(--color-surface-default));
  box-shadow: inset 0 0 0 2px var(--color-brand-primary);
}
.fc-lay-card--overdue {
  background: color-mix(in srgb, var(--fc-loan-urgent) 7%, var(--color-surface-default));
  box-shadow: inset 0 0 0 2px var(--fc-loan-urgent);
}

/* Card head: a real <button> (catch-all press from PressFeedback.css). The UA button chrome is
   stripped; justify-content overrides MudBlazor's global `button { justify-content: center }`. */
.fc-lay-card-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--space-1);
  width: 100%;
  margin: 0;
  padding: var(--space-2);
  background: none;
  border: none;
  cursor: pointer;
  text-align: start;
  font: inherit;
  color: inherit;
}
/* Focus: Momento's Block accordion, as .fc-item-acc and the Pawn Loans tickets do. The card's border
   becomes 2px #4B4B4B, drawn inside (the generic 2px button outline would be clipped by the card's
   overflow:hidden; the card's own outline is not). On a card that already carries a coloured 2px
   state ring (open blue, overdue red) the grey ring sits 2px outside it instead, so the state colour
   stays visible. !important because the generic button rule is (0,29,1); the transparent outline
   keeps focus visible in forced-colours mode. */
.fc-lay-card > .fc-lay-card-row:focus-visible { outline: 2px solid transparent !important; }
.fc-lay-card:has(> .fc-lay-card-row:focus-visible) {
  outline: 2px solid var(--fc-focus-grey);
  outline-offset: -2px;
}
.fc-lay-card--open:has(> .fc-lay-card-row:focus-visible),
.fc-lay-card--overdue:has(> .fc-lay-card-row:focus-visible) {
  outline-offset: 2px;
}

/* Category icon (ImageFallback.css keeps item-icons at contain; the frame is square). */
.fc-lay-thumb {
  display: block;
  width: 88px;
  height: 88px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
}
.fc-lay-card-grid {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  justify-items: start;
  column-gap: var(--space-2);
  row-gap: var(--space-1);
}
.fc-lay-card-grid > .fc-lay-name       { grid-area: 1 / 1; }
.fc-lay-card-grid > .fc-lay-due        { grid-area: 2 / 1; }
.fc-lay-card-grid > .fc-lay-itembadge  { grid-area: 2 / 2; }
.fc-lay-card-grid > .fc-lay-store      { grid-area: 3 / 1; }
.fc-lay-card-grid > .fc-lay-amount-row { grid-area: 3 / 2; }
.fc-lay-card-grid > .fc-pld-address    { grid-area: 4 / 1; }
.fc-lay-card-grid > .fc-lay-transnum   { grid-area: 4 / 2; }
.fc-lay-card-grid > .fc-lay-itembadge,
.fc-lay-card-grid > .fc-lay-amount-row,
.fc-lay-card-grid > .fc-lay-transnum {
  justify-self: end;
}
.fc-lay-name {
  display: block;
  max-width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-body-md-size);
  font-weight: var(--fw-bold);
  line-height: var(--text-body-md-lh);
  letter-spacing: 0.2px;
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Due chip: the Pawn Loans chip (Momento pill: 0 8px in a 24px line box, 14px bold, full radius).
   One difference on purpose: no nowrap. The 88px thumb leaves the chip about 116-200px across phone
   widths (360-430px). The longest Spanish chip, "Vence el 26 sept 2026", needs about 160px with its
   padding, English about 131px (CoreText, Helvetica Neue Bold 14). A one-line chip would run into
   the price on most phones in Spanish and on 360px phones in English, so it wraps there instead. */
.fc-lay-due {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  max-width: 100%;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  font-weight: var(--fw-bold);
  line-height: 24px;
}
.fc-lay-due--overdue {
  color: var(--fc-loan-urgent);
  background: color-mix(in srgb, var(--fc-loan-urgent) 10%, transparent);
}
.fc-lay-due--soon {
  color: var(--fc-loan-soon);
  background: color-mix(in srgb, var(--fc-loan-soon) 10%, transparent);
}
.fc-lay-due--ok,
.fc-lay-due--paid {
  color: var(--fc-loan-ok);
  background: color-mix(in srgb, var(--fc-loan-ok) 10%, transparent);
}

/* Store line: plain informational text in v3.1's item-card store look (.product-card-store: muted,
   bold name, no underline). Not a link: it sits inside the head button. */
.fc-lay-store {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  max-width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  line-height: var(--text-label-md-lh);
  color: var(--color-text-muted);
}
.fc-lay-store i {
  flex-shrink: 0;
  font-size: 0.75rem;
}
.fc-lay-store-name {
  min-width: 0;
  font-weight: var(--fw-bold);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Count badge and the price row, right-aligned by the head grid - Pawn Loans'
   .fc-pawn-itembadge / .fc-pawn-amount-row. */
.fc-lay-itembadge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: 24px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  font-weight: var(--fw-bold);
  line-height: 24px;
  white-space: nowrap;
  background: var(--color-brand-primary);
  color: var(--color-surface-default);
}
.fc-lay-amount-row {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

/* Item rows: picture and description only, above the balance rows (.fc-pawn-item). */
.fc-lay-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
}
.fc-lay-item + .fc-lay-item {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2);
}
.fc-lay-item-img {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  box-sizing: border-box;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-default);
  object-fit: contain;
}
.fc-lay-item-main {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}
.fc-lay-item-name {
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  font-weight: var(--fw-bold);
  line-height: var(--text-label-md-lh);
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc-lay-transnum {
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  line-height: var(--text-label-md-lh);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.fc-lay-price {
  font-family: var(--font-heading);
  font-size: var(--text-action-md-size);
  line-height: var(--text-action-md-lh);
  font-weight: var(--fw-bold);
  letter-spacing: -0.3px;
  color: var(--color-text-primary);
}
/* Chevron (card heads and Payment History): rotates 180deg over 0.3s ease (v3.0.1). */
.fc-lay-chev {
  font-size: 20px;
  color: var(--color-text-primary);
  transition: transform 0.3s ease;
}
.fc-lay-chev--open { transform: rotate(180deg); }

/* Card body: grid-trick accordion (always rendered, row 0fr → 1fr). A closed body turns
   visibility:hidden once its close finishes, so its View Details link leaves the Tab order and
   screen readers skip it; it turns visible at once on open. */
.fc-lay-acc {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fc-lay-acc--open { grid-template-rows: 1fr; }
.fc-lay-acc--instant,
.fc-lay-acc--instant > .fc-lay-acc-inner { transition: none; }
.fc-lay-acc-inner {
  min-height: 0;
  overflow: hidden;
  visibility: hidden;
  transition: visibility 0s linear 0.3s;
}
.fc-lay-acc--open > .fc-lay-acc-inner {
  visibility: visible;
  transition-delay: 0s;
}
.fc-lay-card-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 0 var(--space-2) var(--space-2);
}
.fc-lay-divider {
  height: 1px;
  background: color-mix(in srgb, var(--color-text-muted) 30%, transparent);
}
.fc-lay-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.fc-lay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}
.fc-lay-row-k {
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  line-height: var(--text-label-md-lh);
  color: var(--color-text-muted);
}
.fc-lay-row-v {
  font-family: var(--font-heading);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}
/* Paid to Date / payments: green (v3.0.1). The same property as the Ok / Paid chip, so one approved
   value fixes both (see the contrast note on .fc-lay). */
.fc-lay-paid {
  color: var(--fc-loan-ok);
  font-weight: var(--fw-bold);
}
/* View Details: a real link in v3.1's link-button look (a.fc-item-storelink, as Pawn Loans' "View
   Loan Details"), centred at content width as in v3.0.1. */
.fc-lay-card-body .fc-lay-viewdetails { align-self: center; }

/* Firearm note (v3.0.1 copy kept): the Pawn Loans note's look, 14px in 24px line boxes (Momento has
   no 12px text). Own class, so neither page's sheet can override the other's. */
.fc-lay-firearm {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  line-height: var(--text-body-md-lh);
  color: var(--color-text-muted);
}
.fc-lay-firearm i {
  flex-shrink: 0;
  font-size: 0.75rem;
  line-height: var(--text-body-md-lh);
  color: var(--color-brand-primary);
}

/* ── Payment Summary card (list column and Detail third column) ───────────────────────────────── */
.fc-lay-summary,
.fc-layd-summary { min-width: 0; }
/* Sticky under the back bar: the Item Detail gallery's offset (41px bar + 16) and its transitions,
   which follow the header as it hides. */
.fc-lay-summary {
  position: sticky;
  top: calc(var(--fc-header-h, 0px) + 57px);
  transition: top 0.42s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.fc-lay-summary-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--color-surface-default);
  border: 1px solid var(--color-border);
}
.fc-lay-summary-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: var(--text-heading-xsm-size);
  line-height: var(--text-heading-xsm-lh);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}
/* Per-item breakdown + subtotal (desktop and tablet only). */
.fc-lay-summary-breakdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.fc-lay-summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  font-family: var(--font-body);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-lh);
}
.fc-lay-summary-line-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-muted);
}
.fc-lay-summary-line-amt {
  flex-shrink: 0;
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}
.fc-lay-summary-subdiv {
  height: 1px;
  background: color-mix(in srgb, var(--color-text-muted) 15%, transparent);
}
.fc-lay-summary-line--subtotal {
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}
.fc-lay-summary-rows {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.fc-lay-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  line-height: var(--text-label-md-lh);
  color: var(--color-text-muted);
}
.fc-lay-summary-row > span:last-child {
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}
.fc-lay-summary-row > span.fc-lay-paid { color: var(--fc-loan-ok); }
.fc-lay-summary-row--ruled {
  padding-top: var(--space-1);
  border-top: 1px solid color-mix(in srgb, var(--color-text-muted) 20%, transparent);
}
.fc-lay-summary-row--total {
  padding-top: var(--space-1);
  border-top: 1px solid color-mix(in srgb, var(--color-text-muted) 20%, transparent);
  font-family: var(--font-heading);
}
.fc-lay-summary-row--total > span {
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}

/* 768–1024: the sticky columns ride up with the collapsing native/mobile header, in lockstep with the
   back bar: their sticky top drops by --native-header-h (ItemDetails.css .fc-item-gallery; the bar's 0.3s
   curve is set after the ≥768 media rule below). A sticky offset only moves them while pinned; the
   translateY used before kept shifting them after the pin let go at the end of the scroll (Kelly,
   2026-10-07). */
/* No max-width cap: fc-native-header-hidden exists only in the native shell, so this cannot reach
   desktop web at any width, and a tablet in landscape needs the same compensation portrait does.
   .fc-layd-summary joins the list because it is the sticky third column from 1025px up — i.e. it is
   sticky ONLY in landscape, and had no compensation at all.
   + --fc-safe-top: while the header is hidden the back bar (.fc-item-bar, shared with Item Detail)
   is the topmost element, so it pays the status-bar inset itself and its box grows by that much.
   Subtracting only --native-header-h moved these columns up by the header's full height while the
   bar below them got taller, so they ended up behind it — measured at -16px on Item Detail, the
   same shape here. */
@media (min-width: 768px) {
  html.fc-native-header-hidden .fc-lay-summary,
  html.fc-native-header-hidden .fc-layd-media,
  html.fc-native-header-hidden .fc-layd-summary {
    top: calc(var(--fc-header-h, 0px) + 57px - var(--native-header-h, 0px) + var(--fc-safe-top, 0px));
  }
}

/* ── Layaway Detail ───────────────────────────────────────────────────────────────────────────── */
/* Phones: one column (media, info, summary). 768–1024: media | info, the summary under Payment
   History. ≥1025: media | info | summary. Column and row gaps 16. The grid grows with the page
   (.fc-lay-inner), so align-content keeps its rows packed at the top instead of stretching them
   (which would open a gap above the summary on a short page). */
.fc-layd-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "info" "summary";
  gap: var(--space-2);
  align-items: start;
  align-content: start;
}
.fc-layd-media { grid-area: media; }
.fc-layd-info { grid-area: info; }
.fc-layd-summary { grid-area: summary; }

/* Media: v3.0.1's square frame (Kelly, 2026-10-07: not Item Detail's 4:3; v3.0.1 .fc-layd2-media, the
   rule its live page uses): 1:1, radius 16, no border. Phones keep the full-bleed square below, which is
   v3.0.1's phone frame too. No zoom button, lightbox or hover scale. The item-icon placeholder fills the
   frame (cover, centred, as v3.0.1's object-fit: cover). */
.fc-layd-media {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface-subtle);
}
.fc-layd-media .fc-layd-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.fc-layd-info {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
/* Name / Item # / price: Item Detail's classes, 8px apart. */
.fc-layd-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.fc-layd-contact {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
/* The shared link-button is width:100% (ItemDetails.css), which left the whole 900px row clickable
   either side of the store name and the phone number. Hug the content so only the link takes the
   click; align-self keeps the column stretch from putting the full width back. */
.fc-layd-contact .fc-item-storelink {
  width: fit-content;
  max-width: 100%;
  align-self: flex-start;
}

/* Due banner (v3.0.1): brand tint, 8 / 16 padding. */
.fc-layd-banner {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--color-brand-primary) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-brand-primary) 20%, transparent);
}
.fc-layd-banner i {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--color-brand-primary);
}
.fc-layd-banner span {
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  line-height: var(--text-label-md-lh);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}
.fc-layd-banner b { color: var(--color-brand-primary); }
/* Paid-off variant: the same green property as the Paid values (its text is 4.2:1 on this tint today). */
.fc-layd-banner--paid {
  background: color-mix(in srgb, var(--fc-loan-ok) 8%, transparent);
  border-color: color-mix(in srgb, var(--fc-loan-ok) 20%, transparent);
}
.fc-layd-banner--paid span { color: var(--fc-loan-ok); }

/* Payment progress. */
.fc-layd-progress {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.fc-layd-progress-head,
.fc-layd-progress-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1);
}
.fc-layd-progress-label {
  font-family: var(--font-body);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  font-weight: var(--fw-bold);
  color: var(--color-text-primary);
}
.fc-layd-progress-pct {
  font-family: var(--font-body);
  font-size: var(--text-label-md-size);
  line-height: var(--text-label-md-lh);
  font-weight: var(--fw-bold);
  color: var(--color-brand-primary);
}
.fc-layd-bar {
  height: 8px;
  border-radius: var(--radius-full);
  background: var(--color-border);
  overflow: hidden;
}
/* Width eases over 0.5s when the value changes (v3.0.1). */
.fc-layd-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-brand-primary);
  transition: width 0.5s ease;
}
.fc-layd-progress-foot span {
  font-family: var(--font-body);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-lh);
}
.fc-layd-remaining { color: var(--color-text-muted); }

/* Payment History: .fc-item-acc as it is. The body's 8px flex gap is zeroed so the table's own
   8px row padding and dividers set the rhythm; the closed panel hides like the card bodies. */
.fc-layd-hist .fc-item-acc-body.fc-layd-hist-body { gap: 0; }
.fc-layd-hist-panel > .fc-item-acc-panel-inner {
  visibility: hidden;
  transition: visibility 0s linear 0.3s;
}
.fc-layd-hist-panel.fc-item-acc-panel--open > .fc-item-acc-panel-inner {
  visibility: visible;
  transition-delay: 0s;
}
.fc-layd-hist-empty {
  font-family: var(--font-body);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
  color: var(--color-text-muted);
}
.fc-layd-hist-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.fc-layd-hist-table th {
  padding: var(--space-1) 0;
  border-bottom: 2px solid var(--color-border);
  text-align: left;
  font-family: var(--font-body);
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-lh);
  font-weight: var(--fw-bold);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--color-text-muted);
}
.fc-layd-hist-table td {
  padding: var(--space-1) 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
  font-family: var(--font-body);
  font-size: var(--text-body-md-size);
  line-height: var(--text-body-md-lh);
}
.fc-layd-hist-table tbody tr:last-child td { border-bottom: none; }
/* Column widths are component sizes (v3.0.1), not spacing. */
/* Three equal columns: the amount and the balance were fixed at 90 and 110px, so the date took
   everything that was left and the two figures huddled on the right edge. */
.fc-layd-hist-table .fc-layd-hist-date,
.fc-layd-hist-table .fc-layd-hist-amt,
.fc-layd-hist-table .fc-layd-hist-bal {
  width: 33.33%;
}
.fc-layd-hist-table .fc-layd-hist-amt,
.fc-layd-hist-table .fc-layd-hist-bal {
  text-align: right;
}
.fc-layd-hist-table td.fc-layd-hist-bal { color: var(--color-text-muted); }
.fc-layd-hist-date > span { display: block; }
.fc-layd-hist-date > span:first-child { color: var(--color-text-primary); }
.fc-layd-hist-meta {
  font-size: var(--text-xs-size);
  line-height: var(--text-xs-lh);
  color: var(--color-text-muted);
}

/* 768+: media and info side by side; the media pins under the back bar like Item Detail's gallery. */
@media (min-width: 768px) {
  .fc-layd-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "info"
      "summary";
  }
  .fc-layd-media {
    position: sticky;
    top: calc(var(--fc-header-h, 0px) + 57px);
    transition: top 0.42s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  }
}
/* 768–1024: the sticky top moves on the back bar's 0.3s curve, so the columns stay locked to it while the
   small header collapses (after the rules above so it wins; the offset itself is set earlier). */
/* Uncapped for the same reason as the offset above — in landscape these columns ride too, and the
   0.42s resting curve would drift away from the bar's 0.3s one mid-slide. */
@media (min-width: 768px) {
  .fc-lay-summary,
  .fc-layd-media { transition: top 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
  /* .fc-layd-summary needs the native-shell prefix, not bare: its own declaration lives in the
     >=1025 block BELOW this one and would win on source order with equal specificity. The prefix
     (0,2,0 vs 0,1,0) settles it regardless of order, and keeps desktop web on its 0.42s curve,
     which is correct there — the desktop header is what it follows. */
  html.fc-native-shell .fc-layd-summary { transition: top 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
}

/* Tablets (native shell): the Detail summary moves BESIDE the content from 768px, not 1025px.
   Below 1025 it was stacked under Payment History, so on an iPad in portrait it sat off the bottom
   of the page while landscape (>1024) already showed it at the side — the same page disagreeing
   with itself between orientations, and with Pawn Loan Detail, which has used a side column from
   768px all along. 25% matches the list grid above. */
@media (min-width: 768px) {
  html.fc-native-shell .fc-layd-grid {
    grid-template-columns: minmax(0, 1fr) 25%;
    grid-template-areas: "info summary";
  }
  html.fc-native-shell .fc-layd-summary {
    position: sticky;
    top: calc(var(--fc-header-h, 0px) + 57px);
  }
}
@media (min-width: 768px) and (orientation: portrait) {
  html.fc-native-shell .fc-layd-grid { grid-template-columns: minmax(0, 1fr) 35%; }
}

/* ≥1025: the summary becomes the sticky third column. */
@media (min-width: 1025px) {
  .fc-layd-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
    grid-template-areas: "info summary";
  }
  .fc-layd-summary {
    position: sticky;
    top: calc(var(--fc-header-h, 0px) + 57px);
    transition: top 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  }
}

/* ── Phones (≤767) ────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 767px) {
  /* List: one column that grows to fill the page, so on a short list the drawer (margin-top: auto,
     below) starts at the bottom of the screen; on a long one it follows the cards and pins. */
  .fc-lay-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    flex: 1 0 auto;
  }

  /* Detail: the media goes full-bleed and square (Item Detail's phone frame); only the info is inset.
     A flex column here (same order as the grid areas) so the drawer can take the free space above
     it the same way. */
  .fc-lay-inner.fc-layd-grid {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
  }
  .fc-layd-media {
    aspect-ratio: 1 / 1;
    border-radius: 0;
  }
  .fc-layd-info { padding: var(--space-2); }
  /* A paid-off layaway's summary is an ordinary card at the end of the page. */
  .fc-layd-summary--settled { padding: 0 var(--space-2) var(--space-6); }

  /* Payment Summary drawer: IN-FLOW sticky at the bottom, never position:fixed inside the scroller
     (iOS repaint jank, and it would cover the web footer). margin-top: auto puts it at the bottom
     of a short page; on a long page it pins while the content scrolls and settles above the footer
     at the end. In the app, sticky honours the scroller's tab-bar padding, so bottom:0 sits on top
     of the tab bar. Edge to edge: the list cancels its 16px gutter. */
  .fc-lay-drawer {
    position: sticky;
    top: auto;
    bottom: 0;
    z-index: var(--fc-z-sticky, 1000);
    transform: none;
  }
  .fc-lay-summary.fc-lay-drawer { margin: auto calc(-1 * var(--space-2)) 0; }
  .fc-layd-summary.fc-lay-drawer { margin-top: auto; }
  .fc-lay-inner:has(.fc-lay-drawer) { padding-bottom: 0; }
  .fc-lay-drawer .fc-lay-summary-card {
    gap: var(--space-1);
    padding: var(--space-2);
    border: 0;
    border-top: 1px solid var(--color-border);
    border-radius: 0;
  }
  /* Web phones: clear the home indicator (the app's tab bar already does). */
  .page:not(.has-bottomnav) .fc-lay-drawer .fc-lay-summary-card {
    padding-bottom: calc(var(--space-2) + var(--fc-bottom-inset));
  }
  /* Totals only; the big heading becomes the small uppercase drawer label (v3.0.1). */
  .fc-lay-drawer .fc-lay-summary-breakdown { display: none; }
  .fc-lay-drawer .fc-lay-summary-title {
    font-family: var(--font-body);
    font-size: var(--text-xs-size);
    line-height: var(--text-xs-lh);
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--color-text-muted);
  }

  /* The drawer's height, for a Go to Top lift on web (that rule lives in app.css, the one place the
     FAB is styled; this only publishes the height, under the same name as the Pawn Loans pages, so
     one app.css rule serves both). Every line in the drawer has a fixed line box:
       1 border + 16 + 18 label + 8 + 18 + 8 + 18 + 8 + (8 + 1 + 18) total row + 16 = 138px
     (--fc-bottom-inset is 0 on web: App.razor's viewport has no viewport-fit=cover). The detail's
     firearm note adds 8 + 48, assuming two 24px lines = 194px. That is the phone case: English wraps
     at 360px, Spanish on phones; where the note fits one line (English from 375px, Spanish at 500px,
     measured) the drawer is 170px and a lift keyed to this sits 24px higher than it needs to. Every
     Layaway drawer carries .fc-lay-drawer (list summary and detail summary alike), so an app.css
     lift keyed to html:has(.fc-lay-drawer) covers both pages. */
  html:has(.fc-lay-drawer) { --fc-bottom-drawer-h: 138px; }
  html:has(.fc-lay-drawer--note) { --fc-bottom-drawer-h: 194px; }

  /* The detail drawer carries two money rows the list's does not (Sub Total, Tax Amount), so it is
     52px taller - 26px per row, the same 8 gap + 18 line box as the figures above. Measured at
     390px: 190px plain, 222px with the firearm note. .fc-layd-summary is the detail's own class,
     so the list keeps the heights above. */
  html:has(.fc-layd-summary.fc-lay-drawer) { --fc-bottom-drawer-h: 190px; }
  html:has(.fc-layd-summary.fc-lay-drawer--note) { --fc-bottom-drawer-h: 222px; }
}

/* ── Loading ─────────────────────────────────────────────────────────────────────────────────
   The shared .fc-authgate-loading (AccountLinking.css) only centres horizontally and pads the
   top, so the spinner sat just under the header. Centred here instead, on the same 60vh box
   .fc-linkgate uses for the "Please link account" state - both render in this slot, so the
   spinner and the block that may replace it land in the same place. Scoped to this page: the
   shared class is also AuthGate's and LinkedAccountGate's, on every other gated screen. */
#layaway-loading,
#layaway-detail-loading {
  min-height: 60vh;
  align-items: center;
  padding: var(--space-2);
}

/* Detail items table on phones: ITEM NAME and ITEM NUMBER scroll sideways while ITEM PRICE
   stays pinned to the right edge, so the price is always readable. */
@media (max-width: 767px) {
  /* Wide enough for the heading itself: "ITEM PRICE" (87px) + its 8px gap + the 17.5px chevron,
     plus the 16px padding. At 104px the heading truncated to "ITEM ...". */
  #layaway-detail-items {
    --fc-lay-itemprice-w: 136px;
  }
  /* The shared scroller is pulled out by a negative margin, so its right edge sits outside the
     card and the pinned cell lands short of it - the number column then shows past the price.
     Squaring the scroller to the card makes right: 0 the card's own edge and clips the rest. */
  #layaway-detail-items {
    overflow: hidden;
  }
  #layaway-detail-items .fc-pld-table-scroll {
    margin: 0;
    padding: 0;
    overflow-x: auto;
  }
  /* The card is the measuring stick: 100cqw is its width, so the name and the number columns are
     each exactly one card minus the price. At rest that shows name + price; one swipe brings the
     number flush to the left and the scroll ends there. Adapts to any screen without magic sizes. */
  #layaway-detail-items .fc-pld-table-scroll {
    container-type: inline-size;
  }
  #layaway-detail-items .fc-pld-table {
    table-layout: fixed;
    min-width: 0;
    width: calc(200cqw - var(--fc-lay-itemprice-w));
  }
  /* Pawn Loans caps the first column at max-width 0 so its two-column table cannot be widened by a
     long name. This table has three columns and scrolls, so that cap has to go or the name column
     collapses to the thumbnail and the number column slides over it. */
  #layaway-detail-items .fc-pld-th:first-child,
  #layaway-detail-items .fc-pld-td:first-child,
  #layaway-detail-items .fc-pld-th:nth-child(2),
  #layaway-detail-items .fc-pld-td:nth-child(2) {
    width: calc(100cqw - var(--fc-lay-itemprice-w));
    max-width: calc(100cqw - var(--fc-lay-itemprice-w));
  }
  #layaway-detail-items .fc-pld-th:last-child,
  #layaway-detail-items .fc-pld-td:last-child {
    position: sticky;
    right: 0;
    z-index: 1;
    background: var(--color-surface-default);
    padding-right: 0;
    padding-left: var(--space-2);
    box-shadow: -8px 0 8px -8px rgba(0, 0, 0, 0.18);
    text-align: center;
    width: var(--fc-lay-itemprice-w);
  }
  #layaway-detail-items .fc-pld-th:last-child .fc-pld-sortbtn {
    justify-content: flex-end;
    width: 100%;
  }
}

/* Phones: the transaction number is the widest thing in the right column, and a grid column is
   sized by its widest cell - it was squeezing the title, the due chip and the store onto a few
   characters each. Giving the address and the number their own full-width rows leaves column 2
   sized by the badge and the price alone, so the left column gets the room back. */
@media (max-width: 767px) {
  /* 56px, as Pawn Loans' thumbnail - 88px took a third of a 360px card. */
  .fc-lay-thumb {
    width: 56px;
    height: 56px;
  }
  /* The number is wider than the price, so it takes a row of its own rather than setting the
     width of column 2 - that is what squeezed the name, the chip and the store. The name and the
     address stay in column 1, ending where the price begins; the address wraps. */
  .fc-lay-card-grid > .fc-lay-transnum {
    grid-area: 5 / 1 / auto / -1;
  }
  .fc-lay-card-grid > .fc-lay-due {
    white-space: nowrap;
    /* nowrap fixes the TEXT at its full width, but the base rule's `max-width: 100%` still clamps
       the CHIP to the grid cell - so the green background shrank out from under a date it could no
       longer contain. Measured at 412px: as the cell narrowed the background went 146 -> 96px while
       the text stayed 153.6px, leaving 15 -> 65px of date sitting outside the colour. Dropping the
       clamp moves no text (it is already laid out at that width); it only lets the background cover
       it - measured 169.6px of green around 153.6px of text, the 8px padding intact on both sides. */
    max-width: none;
  }
}

/* ── Reduced motion: the accordions, chevrons, card tint and progress fill change instantly. ── */
@media (prefers-reduced-motion: reduce) {
  .fc-lay-card,
  .fc-lay-acc,
  .fc-lay-acc-inner,
  .fc-lay-chev,
  .fc-layd-bar-fill,
  .fc-layd-hist-panel,
  .fc-layd-hist-panel > .fc-item-acc-panel-inner {
    transition: none;
  }
}
