/* ============================================================================
   TOKENISED FINAL-PAYMENT PAGE
   ----------------------------------------------------------------------------
   modules/furni_advancepayment/controllers/front/finalpayment.php renders
   modules/furni_advancepayment/views/templates/front/final_payment.tpl into
   this block: the emailed-link page where a customer pays the remaining
   balance after their deposit. balancepaid.php renders balance_paid.tpl into
   the same block when the customer returns from paying it.

   The price breakdown reuses `.order-summary` / `.order-summary__row` /
   `.order-summary__total` (order-detail.css) and both buttons reuse
   `.frn-button` / `.frn-button--dark-1` (all_styles.css) — this file only
   adds the vertical rhythm between those shared components, which neither of
   them owns on its own.

   Loaded from `_partials/stylesheets.tpl`, just before design-system.css.
   ============================================================================ */

/* page.tpl's shared header carries no styling of its own in this theme, so on
   this page the title sat hard against the breadcrumb above it and the lead
   paragraph below. Scoped to this controller's body id rather than styling
   .page-header globally: every page that extends page.tpl without overriding
   page_title would inherit that, and none of them were asked about. */
#module-furni_advancepayment-finalpayment .page-header,
#module-furni_advancepayment-balancepaid .page-header {
    padding: var(--spaceTopL, 24px) 0 var(--spaceBottomM, 16px);
}

.frn-advance-final > p {
    margin: 0 0 var(--spaceBottomXl);
}

/* order-detail.css gives .order-summary `max-width: 380px; margin-left: auto`
   because there it sits in a right-hand column. Inherited unchanged, the
   breakdown floated to the right of this block with an empty gutter beside it,
   reading as though it belonged to something else on the page. Kept left with
   the copy it explains. */
.frn-advance-final .order-summary {
    margin-bottom: var(--spaceBottomXl);
    margin-left: 0;
    max-width: 460px;
}

/* The deposit leg renders through displayOrderConfirmation, which the theme
   outputs inside `.frn-order-confirmation__lead` — whose own link rule
   (`#order-confirmation .frn-order-confirmation__lead a`, specificity 1-2-1)
   outranks `.frn-button--dark-1` (0-1-0) and repainted this button's label in
   body text colour, underlined, on its near-black background: a black bar with
   an unreadable label. The lead rule is correct for the prose links it was
   written for; this block simply is not prose, so the component asserts its own
   appearance in the context it is embedded into. Scoped to .frn-advance-final
   so nothing else on the confirmation page is affected. */
#order-confirmation .frn-order-confirmation__lead .frn-advance-final .frn-button,
.frn-advance-final .frn-button--dark-1 {
    color: var(--cWhite);
    text-decoration: none;
}

/* Sized by width, not display: custom.css forces `.frn-button { display:
   flex !important }`, and a block-level flex box with width auto spans the
   whole page. */
.frn-advance-final .frn-advance-final__cta {
    width: max-content;
    max-width: 100%;
    padding-left: 32px;
    padding-right: 32px;
}

/* ----------------------------------------------------------------------------
   Ordered items.

   The rows themselves are the theme's shared order-line component
   (.frn-cart-page__items > .frn-cart-page__item-in-cart >
   .frn-product-item-cart), so their grid, image sizes, typography and every
   responsive band come from components/cart.css unchanged. What is added
   below is only what cart.css deliberately leaves to the page: the two pages
   already using the component keep those bits under their own body id —
   #cart in cart.css, #order-confirmation in order-confirmation.css — so
   nothing of theirs is inherited here.
   -------------------------------------------------------------------------- */

/* Capped because this page is a single full-width column, while the component
   was drawn for the cart's and the confirmation page's items column — 800px at
   the widest band (a 1280px content block less the 400px summary and the 80px
   gap). Left to span 1280px the thumbnail stayed 182px and the quantity and
   price drifted half a screen away from the product they belong to. The cap
   reproduces the proportions the customer saw at confirmation. */
.frn-advance-final__products {
    margin: 0 0 var(--spaceBottomXl);
    max-width: 800px;
}

.frn-advance-final__products-title {
    margin: 0 0 8px;
    font-weight: 500;
}

/* The static quantity, in place of the cart's stepper: the customer cannot
   change what they ordered months ago. Takes the stepper's pill so the row
   keeps the height and rhythm the component was drawn at. Same rule
   order-confirmation.css states for its own page. */
#module-furni_advancepayment-finalpayment .frn-product-item-cart__qty {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 16px;
    border-radius: 22px;
    background: var(--bgcLight);
    font-size: var(--fz-body);
    font-weight: 500;
    white-space: nowrap;
    font-variant-numeric: lining-nums tabular-nums;
}

/* Below 768 cart.css lays the controls out as actions | quantity | price.
   This page, like the confirmation page, has no actions, so an empty first
   track would leave the quantity floating mid-row; two tracks put it under
   the product it belongs to and keep the price on the right edge. */
@media (max-width: 767.98px) {
    #module-furni_advancepayment-finalpayment .frn-product-item-cart__controls {
        grid-template-columns: auto minmax(0, 1fr);
    }

    #module-furni_advancepayment-finalpayment .frn-product-item-cart__top-amount {
        grid-column: 1;
        grid-row: 1;
    }

    #module-furni_advancepayment-finalpayment .frn-product-item-cart__price {
        grid-column: 2;
        grid-row: 1;
    }
}

/* Matches the cart's stepper, which drops to 40px in this band. */
@media (max-width: 576px) {
    #module-furni_advancepayment-finalpayment .frn-product-item-cart__qty {
        height: 40px;
        padding: 0 14px;
    }
}

.frn-advance-final__pay-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

/* .frn-button is width:100% by default in all_styles.css — the theme's
   convention is that callers narrow it where a full-bleed button is wrong
   (see the hero rule's width:min-content). Left alone, two payment methods
   stacked as two page-wide black bars, far heavier than the choice they
   represent and out of step with the breakdown above them. Sized to their
   labels from the tablet breakpoint up; still full width on a phone, where
   full-bleed is the right target size. */
@media (min-width: 576px) {
    .frn-advance-final__pay-form .frn-button {
        width: auto;
        min-width: 220px;
    }
}

/* The instructions themselves, as a card rather than loose paragraphs. This is
   the one part of the page the customer has to act on — before, it read as
   trailing body copy under a floated table, and the account number was
   indistinguishable from the company name and the bank's address. */
.frn-advance-final__bank {
    padding: 20px 24px;
    /* White against the grey breakdown above it, not a second grey panel: one
       card states what the order costs, this one is the thing the customer has
       to act on, and two identical surfaces gave them equal weight. */
    border: 1px solid var(--bdcPrimary, #dfe3e1);
    border-radius: 8px;
    background: var(--cWhite, #fff);
}

.frn-advance-final__bank-title {
    margin: 0 0 12px;
    font-weight: 600;
}

.frn-advance-final__bank-list {
    margin: 0;
}

.frn-advance-final__bank-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 4px 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--bdcPrimaryLight, #f0f2f1);
}

.frn-advance-final__bank-row dt {
    margin: 0;
    font-weight: 400;
    color: var(--cTextLight2, #6b6f6d);
}

.frn-advance-final__bank-row dd {
    margin: 0;
    text-align: right;
    /* IBANs and long company names must wrap rather than widen the card and
       push the page into a horizontal scroll on a phone. */
    overflow-wrap: anywhere;
}

.frn-advance-final__bank-strong {
    font-weight: 600;
}

/* The amount is the row the customer types into the transfer, so it closes the
   list and carries the emphasis — the same role .order-summary__total plays in
   the breakdown above. */
.frn-advance-final__bank-row--amount {
    border-bottom: 0;
    padding-top: 12px;
    font-size: var(--fz-18, 18px);
}

.frn-advance-final__bank-row--amount dt {
    color: inherit;
}

/* The deferred half of the split. Muted, because it is context for the figure
   below it rather than something to act on today. */
.frn-advance-final__bank-row--later dd {
    color: var(--cTextLight2, #6b6f6d);
}

/* Set on its own grey ground inside the white card: everything above it is a
   field to copy into a transfer, this is what happens afterwards. Without the
   separation it read as one more line of the payment details. */
.frn-advance-final__bank-note {
    margin: 16px 0 0;
    padding: 12px 16px;
    border-radius: 8px;
    background: var(--bgcSecondary, #f7f8f8);
    color: var(--cTextLight2, #6b6f6d);
}

@media (max-width: 575px) {
    .frn-advance-final__bank {
        padding: 16px;
    }

    /* Label above value once the two would fight for the same line. */
    .frn-advance-final__bank-row {
        flex-direction: column;
    }

    .frn-advance-final__bank-row dd {
        text-align: left;
    }
}

/* Shown only when a customer who chose e-banking could not be handed to the
   gateway and is looking at bank details they did not ask for. Neutral, not
   .alert-danger: their order exists and is valid, only the payment method
   changed under them. */
.frn-advance-final__notice {
    padding: 12px 16px;
    margin: 0 0 var(--spaceBottomXl);
    border-left: 3px solid var(--bdcPrimaryLight, #f0f2f1);
    background: var(--bgcSecondary, #f7f8f8);
}
