/*
 * Payment marks and payment pages (methods, add funds, masspay), and the
 * payment bits of checkout, invoices and the dashboard. Owned by the payments
 * agent. Loaded after the page stylesheets, on every page.
 *
 * .hs-pm is the mark from includes/hs-payment-mark.tpl: a card-shaped tile
 * (Ash Control, one Ghost Line) holding the brand or gateway mark, then the
 * label in Geist Sans and the detail (last four, masked email, expiry) in
 * Geist Mono. It is a component, so its rules apply wherever it is included;
 * page rules below are scoped to their body class. Order form pages load
 * Standard Cart's all.min.css after this file: rules for them start with
 * html body.
 */

/* The mark --------------------------------------------------------------- */

.hs-body .hs-pm {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  vertical-align: middle;
  text-align: left;
}
.hs-body .hs-pm-tile {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 30px;
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius-sm);
  background: var(--hs-control);
  color: var(--hs-foreground);
  line-height: 1;
}
.hs-body .hs-pm-tile svg { display: block; width: 20px; height: 20px; fill: currentColor; }
.hs-body .hs-pm-tile i { font-size: 22px; line-height: 1; }
/* Card brands: Font Awesome's glyph is itself a card, so it replaces the
   tile's frame instead of sitting inside a second one. */
.hs-body :is(.hs-pm-visa, .hs-pm-mastercard, .hs-pm-amex, .hs-pm-discover, .hs-pm-jcb, .hs-pm-diners) > .hs-pm-tile { border-color: transparent; background: transparent; }
.hs-body :is(.hs-pm-visa, .hs-pm-mastercard, .hs-pm-amex, .hs-pm-discover, .hs-pm-jcb, .hs-pm-diners) > .hs-pm-tile i { font-size: 33px; }
.hs-body .hs-pm-sm:is(.hs-pm-visa, .hs-pm-mastercard, .hs-pm-amex, .hs-pm-discover, .hs-pm-jcb, .hs-pm-diners) > .hs-pm-tile i { font-size: 24px; }
.hs-body .hs-pm-text { display: flex; flex-direction: column; min-width: 0; }
.hs-body .hs-pm-label {
  overflow: hidden;
  color: var(--hs-foreground);
  font-weight: 600;
  line-height: 1.35;
  text-overflow: ellipsis;
}
.hs-body .hs-pm-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  margin-top: 2px;
  color: var(--hs-muted);
  font-family: var(--hs-font-mono);
  font-size: 0.8125rem;
  line-height: 1.45;
}
.hs-body .hs-pm-brand { font-family: var(--hs-font-sans); }
.hs-body .hs-pm-num { overflow-wrap: anywhere; }
.hs-body .hs-pm.is-expired .hs-pm-exp { color: var(--hs-danger); }

.hs-body .hs-pm-sm { gap: 8px; }
.hs-body .hs-pm-sm .hs-pm-tile { width: 32px; height: 22px; border-radius: var(--hs-radius-sm); }
.hs-body .hs-pm-sm .hs-pm-tile svg { width: 15px; height: 15px; }
.hs-body .hs-pm-sm .hs-pm-tile i { font-size: 16px; }
.hs-body .hs-pm-sm .hs-pm-label { font-weight: 500; }

/* Payment Methods ---------------------------------------------------------- */

.hs-page-account-paymentmethods .hs-paym-plus { width: 14px; height: 14px; fill: currentColor; }
.hs-page-account-paymentmethods .hs-paym-add .dropdown-toggle::after { margin-left: 2px; }

/* The add menu: options with their marks, then the ways that need no form. */
.hs-page-account-paymentmethods .hs-paym-menu { width: min(340px, calc(100vw - 32px)); margin-top: 6px; }
.hs-page-account-paymentmethods .hs-paym-menu .hs-paym-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 10px;
  white-space: normal;
}
.hs-page-account-paymentmethods .hs-paym-menu-item > span:last-child,
.hs-page-account-paymentmethods .hs-paym-option-text { display: flex; flex-direction: column; min-width: 0; }
.hs-page-account-paymentmethods .hs-paym-menu-item strong,
.hs-page-account-paymentmethods .hs-paym-option-text strong { color: var(--hs-foreground); font-weight: 600; }
.hs-page-account-paymentmethods .hs-paym-menu-item strong + span,
.hs-page-account-paymentmethods .hs-paym-option-text strong + span { color: var(--hs-muted); font-size: 0.8125rem; font-weight: 400; }
.hs-page-account-paymentmethods .hs-paym-menu .hs-paym-notes { padding: 4px 10px 6px; }

.hs-page-account-paymentmethods .hs-paym-notes { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.hs-page-account-paymentmethods .hs-paym-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--hs-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}
.hs-page-account-paymentmethods .hs-paym-note .hs-pm { flex: none; margin-top: -1px; }
.hs-page-account-paymentmethods .hs-paym-note strong { color: var(--hs-foreground); font-weight: 600; }

/* Saved methods: one tile, a row each, fine lines between. */
.hs-page-account-paymentmethods .hs-paym-list { margin: 0; padding: 0; list-style: none; }
.hs-page-account-paymentmethods .hs-paym-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "method chips" "actions actions";
  align-items: center;
  gap: 12px 16px;
  padding: 16px 20px;
  border-top: 1px solid var(--hs-border);
}
.hs-page-account-paymentmethods .hs-paym-row:first-child { border-top: 0; }
.hs-page-account-paymentmethods .hs-paym-method { grid-area: method; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hs-page-account-paymentmethods .hs-paym-desc { padding-left: 56px; color: var(--hs-muted); font-size: 0.8125rem; overflow-wrap: anywhere; }
.hs-page-account-paymentmethods .hs-paym-chips { grid-area: chips; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.hs-page-account-paymentmethods .hs-paym-chips:empty { display: none; }
.hs-page-account-paymentmethods .hs-paym-actions { grid-area: actions; display: flex; flex-wrap: wrap; gap: 6px; padding-left: 56px; }
.hs-page-account-paymentmethods .hs-paym-actions .btn { min-height: 44px; }
@media (min-width: 768px) {
  .hs-page-account-paymentmethods .hs-paym-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "method chips actions";
    padding: 16px 24px;
  }
  .hs-page-account-paymentmethods .hs-paym-actions { justify-content: flex-end; flex-wrap: nowrap; padding-left: 0; }
  .hs-page-account-paymentmethods .hs-paym-actions .btn { min-height: 36px; }
}
.hs-page-account-paymentmethods .hs-paym-row.is-expired .hs-pm-tile { opacity: 0.6; }

/* The method named in the delete dialog. */
.hs-page-account-paymentmethods .hs-paym-confirm-which {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--hs-border);
  border-radius: var(--hs-radius-md);
  background: var(--hs-fill);
}

/* Nothing saved: what this page is for, the one form it offers, the rest. */
.hs-page-account-paymentmethods .hs-paym-empty > .card-body { padding: 24px 20px; }
@media (min-width: 768px) {
  .hs-page-account-paymentmethods .hs-paym-empty > .card-body { padding: 32px; }
}
.hs-page-account-paymentmethods .hs-paym-empty-title {
  margin: 0;
  color: var(--hs-foreground);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.hs-page-account-paymentmethods .hs-paym-empty .hs-acct-lead { max-width: 52ch; margin: 4px 0 0; }
.hs-page-account-paymentmethods .hs-paym-options { display: grid; gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.hs-page-account-paymentmethods .hs-paym-option {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 14px;
  padding: 14px 16px;
  border: 1px solid var(--hs-input);
  border-radius: var(--hs-radius-lg);
  background: var(--hs-fill);
}
.hs-page-account-paymentmethods .hs-paym-option-text { flex: 1 1 160px; }
.hs-page-account-paymentmethods .hs-paym-option .btn { min-height: 44px; }
@media (max-width: 575.98px) {
  .hs-page-account-paymentmethods .hs-paym-option .btn { flex: 1 1 100%; }
}
.hs-page-account-paymentmethods .hs-paym-empty .hs-paym-notes { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--hs-border); }
/* The Expired chip says it in red; the date beside the mark stays quiet. */
.hs-page-account-paymentmethods .hs-paym-row .hs-pm.is-expired .hs-pm-exp { color: var(--hs-muted); }

/* Add or edit a payment method -------------------------------------------- */

.hs-page-account-paymentmethods-manage .hs-paym-editing { margin-top: 14px; }
.hs-page-account-paymentmethods-manage .frm-credit-card-input .hs-paym-type {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 0 8px 8px 0;
  padding: 6px 14px 6px 12px;
  border: 1px solid var(--hs-input);
  border-radius: var(--hs-radius-md);
  background: var(--hs-fill);
  cursor: pointer;
}
.hs-page-account-paymentmethods-manage .frm-credit-card-input .hs-paym-type:has(.checked) { border-color: oklch(1 0 0 / 40%); background: var(--hs-fill-hover); }
.hs-page-account-paymentmethods-manage .frm-credit-card-input .hs-paym-type:has(.disabled) { cursor: default; }
.hs-page-account-paymentmethods-manage .hs-paym-type-note { margin: 2px 0 0; color: var(--hs-muted); font-size: 0.8125rem; line-height: 1.5; }
.hs-page-account-paymentmethods-manage #innerBillingContactsContainer .hs-bc-addr { flex-basis: 100%; }

/* Add Funds and Mass Payment: the payment method as options with marks. ---- */

body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-gateways { margin: 0 0 20px; padding: 0; border: 0; }
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-gateways > legend { float: none; width: auto; margin: 0; padding: 0 0 6px; font-size: 0.875rem; font-weight: 600; }
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-options { display: grid; gap: 8px; }
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  margin: 0;
  padding: 10px 14px;
  border: 1px solid var(--hs-input);
  border-radius: var(--hs-radius-md);
  background: var(--hs-fill);
  cursor: pointer;
}
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-option:hover { background: var(--hs-fill-hover); }
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-option:has(input:checked) { border-color: oklch(1 0 0 / 55%); background: var(--hs-control); }
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-option:has(input:focus-visible) { outline: 2px solid var(--hs-ring); outline-offset: 2px; }
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-option input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--hs-foreground);
}
body:is(.hs-page-clientareaaddfunds, .hs-page-masspay) .hs-pay-option input:focus-visible { outline: 0; }

/* Invoice: the method in the facts, in the ledger and under How to pay. ----- */

.hs-page-viewinvoice .hs-invoice-facts dd .hs-pm { align-items: flex-start; }
.hs-page-viewinvoice .hs-invoice-facts dd .hs-pm-tile { margin-top: 1px; }
.hs-page-viewinvoice .hs-invoice-txmethod { display: block; }
.hs-page-viewinvoice .hs-invoice-txtype { display: block; margin-top: 2px; padding-left: 40px; color: var(--hs-muted); font-size: 0.8125rem; }
.hs-page-viewinvoice .hs-invoice-gateway { display: flex; align-items: center; gap: 10px; }
.hs-page-viewinvoice .hs-invoice-gateway > .hs-pm { flex: none; }
.hs-page-viewinvoice .hs-invoice-gateway .custom-select { min-width: 0; flex: 0 1 16rem; }

/* Checkout: each payment option shows its mark; saved methods too. -------- */

/* With a mark each option needs more room than a bare name: one per row
   until three fit at 240px (page-checkout.css allowed 128px). */
@media (min-width: 576px) {
  html body.hs-page-checkout .hs-co .hs-co-gateways { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
}
html body.hs-page-checkout #order-standard_cart #paymentGatewaysContainer .hs-co-gateway-name { display: flex; min-width: 0; }
html body.hs-page-checkout #order-standard_cart #paymentGatewaysContainer .hs-co-gateway-name .hs-pm-label { white-space: normal; overflow-wrap: anywhere; }
html body.hs-page-checkout #order-standard_cart .existing-cc-grid .paymethod-info .hs-pm { vertical-align: middle; }
html body.hs-page-checkout #order-standard_cart .existing-cc-grid .paymethod-info .hs-pm-detail { font-size: 0.8125rem; }

/* Order complete: the invoice's method under its number. */
html body.hs-page-complete #order-standard_cart .hs-complete-method { margin: 10px 0 0; }

/* Service page: the method in the billing tile. */
.hs-page-clientareaproductdetails .hs-svc-paymethod .hs-pm-label { font-weight: 500; }

/* Saved methods at checkout and on the pay-an-invoice page: Standard Cart's
   five-cell grid, each row centred on its mark. */
html body.hs-page-checkout #order-standard_cart .existing-cc-grid,
.hs-page-invoice-payment .three-column-grid { align-items: center; }
