/* exui page compositions — billing: invoices, invoice view, transactions, quotations, pay flow (DESIGN §7.6-7.7).
   Loaded on every page after exui.css, so every rule is scoped to a billing root (README §9):
   .ex-billing (every billing page wrapper; .ex-billing--invoice the document, .ex-pay the pay flow),
   the list cards #client_invoices / #client_transactions / #client_quotations (page and dashboard widget),
   form.ex-approve (the approve dialog), and the page head through body.exui:has(<billing root>). */

/* =========================================================================
   0. Area roots
   ========================================================================= */
/* the page head already ends 32px above the content row */
body.exui .ex-billing { margin-top: 0; }
body.exui .ex-billing > .ex-layout:first-child { margin-top: 0; }
body.exui .ex-billing .ex-billing__alerts { margin: 0 0 var(--ex-gap); }
body.exui .ex-billing .ex-billing__alerts + .ex-layout { margin-top: 0; }
/* signed in vs signed out (pay-by-link): the guest shell's body.exui-guest picks one */
body.exui.exui-guest :is(.ex-billing, .ex-pagehead) .ex-when-client,
body.exui:not(.exui-guest) :is(.ex-billing, .ex-pagehead) .ex-when-guest { display: none; }

/* =========================================================================
   1. Billing list cards (invoices, transactions, quotations; page + widget)
   ========================================================================= */
body.exui :is(#client_invoices, #client_transactions, #client_quotations).ex-card { overflow: visible; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) > .card-content { position: relative; transition: opacity var(--ex-dur-2); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) > .card-content[aria-busy="true"] { opacity: .55; pointer-events: none; }
/* widget head: "Make a payment" (nothing open) + "View all" */
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-billing__headlinks { display: inline-flex; align-items: center; gap: 18px; }

/* toolbar: segmented status + search pill + Filter */
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__bar--seg { flex-wrap: wrap; row-gap: 10px; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__tools { margin-left: auto; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-search { width: 240px; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-search input::-webkit-search-cancel-button { filter: invert(.6); cursor: pointer; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .filter-toggle .ex-count { min-width: 18px; height: 18px; margin-left: 2px; border-color: var(--ex-a-45); background: var(--ex-a-10); color: var(--ex-fg); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-seg__item .num { font-family: var(--ex-mono); color: var(--ex-muted); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-seg__item.is-active .num { color: var(--ex-fg-82); }

/* the widget filter form, as the .ex-filters well under the toolbar: one grid
   (Blesta's .rows flattened), fields on the 22px column, Clear + Apply at the end */
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form { margin: 0; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form > .card {
  display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); align-items: end; gap: 16px;
  margin: 0; padding: 18px 22px !important; border-radius: 0; /* answers Bootstrap's .p-3 !important */
}
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form > .card > .row { display: contents; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form > .card > .row > [class*="col-"] { flex: none; width: auto; max-width: none; margin: 0; padding: 0; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form .col-md-12 { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form .col-md-12 :is(.btn, .ex-btn) { height: 44px; margin: 0; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form .btn.float-right { float: none !important; } /* answers Bootstrap's .float-right !important */
/* the search pill already drives these fields */
body.exui #client_invoices .ex-list__filters .form-group:has(> [name="filters[invoice_number]"]),
body.exui #client_transactions .ex-list__filters .form-group:has(> [name="filters[transaction_id]"]),
body.exui #client_quotations .ex-list__filters .form-group:has(> [name="filters[quotation_number]"]) { display: none; }
/* desktop: the fields and Clear / Apply on one row (DESIGN §5.21: actions in the last, auto column) */
@media (min-width: 1024px) {
  body.exui :is(#client_invoices, #client_quotations) .ex-list__filters form.widget_filter_form > .card { grid-template-columns: repeat(3, minmax(0,1fr)) auto; }
  body.exui #client_transactions .ex-list__filters form.widget_filter_form > .card { grid-template-columns: repeat(4, minmax(0,1fr)) auto; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form .col-md-12 { grid-column: -2 / -1; grid-row: 1; align-self: end; }
}

/* table: never wider than its card. The identity cell gives way (ellipsis, full
   text in title), optional columns go below 1180, and a scroller is the last resort. */
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__scroll { overflow-x: auto; overscroll-behavior-x: contain; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table th.cell-actions,
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-actions { width: 1%; white-space: nowrap; text-align: right; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-actions > .ex-rowactions { display: inline-flex; vertical-align: middle; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-main .ex-id { font-size: 14px; font-weight: 600; }
body.exui :is(#client_quotations, #client_transactions) .ex-list__table td.cell-main { width: 34%; max-width: 0; }
/* invoices: until rows carry a consequence line (◆ line items), the ID column is only as wide as the ID,
   so the dates and amounts carry the row */
/* the identity column: with consequence lines it takes a share (the line wraps
   inside it); without them it still keeps room, so Status never sits against the ID */
body.exui #client_invoices .ex-list__table:not(:has(.ex-consq)) :is(th, td):first-child { width: 16%; white-space: nowrap; }
body.exui #client_invoices .ex-list__table:has(.ex-consq) td.cell-main { width: 38%; }
body.exui #client_invoices .ex-consq__more { color: var(--ex-fg-58); white-space: nowrap; }
body.exui #client_invoices .ex-list__table td.cell-main .ex-consq { max-width: 46ch; }
/* icon-only links carry their tooltip on a wrapper (Blesta cancels clicks on a[data-toggle=tooltip]) */
body.exui :is(.ex-billing, #client_invoices, #client_transactions, #client_quotations) .ex-tip { display: inline-flex; vertical-align: middle; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.r .ex-hint { text-align: right; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table .ex-amt.is-quiet { color: var(--ex-fg-82); font-weight: 500; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table .ex-hint.mono { font-family: var(--ex-mono); font-size: 12px; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-status { white-space: nowrap; }
/* expandable rows: Blesta's tr.expand_details > td.subtable, drawn as hairline rows (never a box) */
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table > tbody > tr.expand_details > td { padding: 0; border-top: 1px solid var(--ex-line); background: rgba(13,15,18,.35); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table > tbody > tr.expand_details:hover { background: transparent; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table > tbody > tr.expanded > td { background: rgba(255,255,255,.015); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table > tbody > tr.expanded.is-attn > td { background: var(--ex-a-06); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.subtable { min-height: 64px; }
/* transaction number: mono, truncated, copy beside it */
body.exui #client_transactions .ex-txn { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; }
body.exui #client_transactions .ex-txn__id { display: inline-block; max-width: 17ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; font-size: 13px; font-weight: 500; color: var(--ex-fg-82); }
body.exui #client_transactions .ex-txn__copy { width: 28px; height: 28px; }
/* e-invoice formats menu next to the download icon */
body.exui :is(#client_invoices, .ex-billing--invoice) .ex-formats { position: relative; display: inline-flex; }
body.exui :is(#client_invoices, .ex-billing--invoice) .ex-formats .dropdown-menu { top: calc(100% + 6px); margin: 0; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-listfoot__pages .pagination { margin: 0; }

/* the dashboard shows the cards as widgets: no search/filter, no billed column */
body.exui.exui-is-dashboard :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__tools,
body.exui.exui-is-dashboard :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters,
body.exui.exui-is-dashboard :is(#client_invoices, #client_transactions, #client_quotations) .cell-opt { display: none; }

/* expanded-row panes (invoices/applied, transactions/applied, quotations/invoices): what + a mono
   sub-line (gateway · number · when) on the left, the amount on the right. billing.js sets
   --ex-amt-inset so the amount ends under the parent table's amount column. */
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subpane { padding: 14px var(--ex-amt-inset, 22px) 16px 22px; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subpane__label { display: flex; margin-bottom: 4px; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrows { margin: 0; padding: 0; list-style: none; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow { display: grid; grid-template-columns: minmax(0,1fr) minmax(110px, auto); align-items: center; gap: 6px 24px; padding: 10px 0; border-top: 1px solid var(--ex-line); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow:first-child { border-top: 0; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow__what { display: grid; justify-items: start; gap: 4px; min-width: 0; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow__top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow__t { font-size: 14px; font-weight: 600; color: var(--ex-fg); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow__s { max-width: 100%; font: 400 12px/1.45 var(--ex-mono); color: var(--ex-muted); overflow-wrap: anywhere; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow__s .sep { color: var(--ex-line-strong); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow__amt { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subrow__amt small { font: 400 11.5px/1.3 var(--ex-mono); color: var(--ex-muted); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subpane__note { margin: 6px 0 0; font-size: 13.5px; line-height: 1.5; color: var(--ex-muted); }
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subpane__msg { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin: 12px 0 0; padding-top: 12px; border-top: 1px dashed var(--ex-line); font-size: 13.5px; line-height: 1.5; color: var(--ex-fg-72); }
/* a declined payment applied to nothing: the gateway's note is the whole pane */
body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subpane__msg.is-only { margin-top: 0; padding-top: 0; border-top: 0; }

/* =========================================================================
   2. Invoice document (DESIGN §7.6, prototype §13.4)
   ========================================================================= */
body.exui .ex-billing--invoice .ex-invoice { margin-top: 0; }
body.exui .ex-billing--invoice .ex-doc { min-width: 0; }
body.exui .ex-billing--invoice .ex-doc__parties { display: grid; grid-template-columns: 1fr 1fr minmax(0,.9fr); border-bottom: 1px solid var(--ex-line); }
body.exui .ex-billing--invoice .ex-doc__party { min-width: 0; padding: 22px; }
body.exui .ex-billing--invoice .ex-doc__party + .ex-doc__party { border-left: 1px solid var(--ex-line); }
body.exui .ex-billing--invoice .ex-doc__party > p:not(.ex-label) { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--ex-fg-72); overflow-wrap: anywhere; }
body.exui .ex-billing--invoice .ex-doc__party > p b { display: block; font-weight: 600; color: var(--ex-fg); }
body.exui .ex-billing--invoice .ex-doc__facts { margin-top: 12px; }
body.exui .ex-billing--invoice .ex-doc__lines td { vertical-align: top; }
body.exui .ex-billing--invoice .ex-doc__lines th:first-child { width: 60%; }
body.exui .ex-billing--invoice .ex-doc__desc { display: block; }
body.exui .ex-billing--invoice .ex-doc__desc b { display: block; font-size: 14.5px; font-weight: 600; line-height: 1.4; color: var(--ex-fg); }
body.exui .ex-billing--invoice .ex-doc__desc > span { display: block; margin-top: 3px; font: 400 12.5px/1.45 var(--ex-mono); color: var(--ex-muted); }
/* a described line's mono sub-line ("host · period", exui_billing_describe_sub): a date range never
   breaks inside, so a narrow line breaks at the " · "; the host may wrap anywhere */
body.exui .ex-billing .ex-desc__host { overflow-wrap: anywhere; }
body.exui .ex-billing .ex-desc__period { white-space: nowrap; }
body.exui .ex-billing .ex-desc__sep { color: var(--ex-fg-58); }
/* a free option line ($0.00) stays quiet beside the lines that cost money */
body.exui .ex-billing--invoice .ex-doc__lines td .ex-amt.is-quiet { font-weight: 500; color: var(--ex-muted); }
body.exui .ex-billing--invoice .ex-doc__lines td .ex-amt.is-quiet small { color: var(--ex-muted); }
/* print only: the document's own head (the page head is hidden on paper) */
body.exui .ex-billing--invoice .ex-doc__printhead { display: none; }
body.exui .ex-billing--invoice .ex-doc__lines tr.is-option .ex-doc__desc { position: relative; padding-left: 18px; }
body.exui .ex-billing--invoice .ex-doc__lines tr.is-option .ex-doc__desc::before { content: "└"; position: absolute; left: 0; top: 0; font-family: var(--ex-mono); color: var(--ex-line-strong); }
body.exui .ex-billing--invoice .ex-doc__lines tr.is-option .ex-doc__desc b { font-size: 13.5px; font-weight: 500; color: var(--ex-fg-82); }
body.exui .ex-billing--invoice .ex-doc__lines .ex-amt.is-unit { font-weight: 500; color: var(--ex-fg-82); }
body.exui .ex-billing--invoice .ex-doc__lines tbody tr:hover { background: transparent; }
body.exui .ex-billing--invoice .ex-doc__foot { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 32px; padding: 22px; border-top: 1px solid var(--ex-line); }
body.exui .ex-billing--invoice .ex-doc__terms { display: grid; align-content: start; gap: 18px; min-width: 0; font-size: 13.5px; line-height: 1.6; color: var(--ex-fg-58); }
body.exui .ex-billing--invoice .ex-doc__note .ex-label { display: flex; margin-bottom: 8px; }
body.exui .ex-billing--invoice .ex-doc__note p:not(.ex-label) { margin: 0; overflow-wrap: anywhere; }
body.exui .ex-billing--invoice .ex-totals { display: grid; align-content: start; gap: 10px; margin: 0; }
body.exui .ex-billing--invoice .ex-totals > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 14px; color: var(--ex-fg-72); }
body.exui .ex-billing--invoice .ex-totals dt { font-weight: 400; }
body.exui .ex-billing--invoice .ex-totals dd { margin: 0; font: 500 14px var(--ex-mono); color: var(--ex-fg); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
body.exui .ex-billing--invoice .ex-totals .is-total { padding-top: 12px; border-top: 1px solid var(--ex-line); color: var(--ex-fg); font-weight: 600; }
body.exui .ex-billing--invoice .ex-totals .is-total dt { font-weight: 600; }
body.exui .ex-billing--invoice .ex-totals .is-due { padding-top: 12px; border-top: 1px solid var(--ex-line-strong); color: var(--ex-fg); }
body.exui .ex-billing--invoice .ex-totals .is-due dt { font-weight: 600; }
body.exui .ex-billing--invoice .ex-totals .is-due dd { font-size: 17px; font-weight: 700; letter-spacing: -.03em; }
body.exui .ex-billing--invoice .ex-doc__payments { padding: 22px 0 6px; border-top: 1px solid var(--ex-line); }
body.exui .ex-billing--invoice .ex-doc__payments > .ex-label { display: flex; margin: 0 22px 12px; }
body.exui .ex-billing--invoice .ex-doc__paylines tbody tr:hover { background: transparent; }
body.exui .ex-billing--invoice .ex-doc__paytype { font-weight: 600; color: var(--ex-fg); }
body.exui .ex-billing--invoice .ex-doc__txn { display: inline-block; max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* a single payment that settled the invoice: the aside names it on screen; print keeps the table */
@media screen {
  body.exui .ex-billing--invoice .ex-doc__payments.is-single { display: none; }
}

/* the "amount due" aside */
body.exui .ex-billing--invoice .ex-duebox { padding: 22px; }
body.exui .ex-billing--invoice .ex-duebox__top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
body.exui .ex-billing--invoice .ex-duebox__amt { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 0; }
body.exui .ex-billing--invoice .ex-duebox__amt .ex-money { font-size: 52px; line-height: .95; }
body.exui .ex-billing--invoice .ex-duebox__amt .ex-unit { font-size: 13px; letter-spacing: .08em; }
body.exui .ex-billing--invoice .ex-duebox__amt.is-void .ex-money { color: var(--ex-muted); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: var(--ex-line-strong); }
body.exui .ex-billing--invoice .ex-duebox__when { margin: 10px 0 0; font-size: 14.5px; line-height: 1.5; color: var(--ex-fg-72); }
body.exui .ex-billing--invoice .ex-duebox__when b { font: 500 13.5px var(--ex-mono); color: var(--ex-fg); white-space: nowrap; }
body.exui .ex-billing--invoice .ex-duebox__cta { margin-top: 22px; }
body.exui .ex-billing--invoice .ex-duebox__fine { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ex-fg-58); }
body.exui .ex-billing--invoice .ex-duebox__facts { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--ex-line); }
/* desktop: one line with an ellipsis (the full value is in title); phones wrap it (below) */
body.exui .ex-billing--invoice .ex-duebox__facts dd { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.exui .ex-billing--invoice .ex-duebox__facts .ex-duebox__txn { align-items: center; }
body.exui .ex-billing--invoice .ex-duebox__facts .ex-duebox__txn dd { flex: 1; }
body.exui .ex-billing--invoice .ex-duebox__facts .ex-duebox__txn .ex-iconbtn { width: 28px; height: 28px; margin: -6px -6px -6px 0; }
body.exui .ex-billing--invoice .ex-covers { margin: 22px -22px -22px; padding: 18px 22px 22px; border-top: 1px solid var(--ex-line); }
body.exui .ex-billing--invoice .ex-covers ul { margin: 0; padding: 0; list-style: none; }
body.exui .ex-billing--invoice .ex-covers li { display: flex; gap: 12px; padding-top: 12px; font-size: 14px; line-height: 1.45; color: var(--ex-fg-82); }
body.exui .ex-billing--invoice .ex-covers li::before { content: ""; flex: none; width: 10px; height: 4px; margin-top: calc(.725em - 2px); background: var(--ex-fg-58); transform: skewX(35deg); }
body.exui .ex-billing--invoice .ex-covers li > span { min-width: 0; }
body.exui .ex-billing--invoice .ex-covers li small { display: block; margin-top: 2px; font: 400 12.5px/1.4 var(--ex-mono); color: var(--ex-muted); overflow-wrap: anywhere; }
/* head: download + other formats */
body.exui:has(.ex-billing--invoice) .ex-pagehead__actions .ex-formats { position: relative; display: inline-flex; }
body.exui:has(.ex-billing--invoice) .ex-pagehead__actions .ex-formats .dropdown-menu { top: calc(100% + 6px); right: 0; left: auto; margin: 0; }

/* =========================================================================
   3. Pay flow (DESIGN §7.7, prototype §13.5)
   ========================================================================= */
/* stepper captions: "2 invoices · $18.20 · Change", where "· Change" never splits */
body.exui:has(.ex-pay) .ex-pagehead .ex-step-h__chg { white-space: nowrap; }
body.exui:has(.ex-pay) .ex-pagehead .ex-stepper__now { display: none; }

body.exui .ex-pay .ex-pay__layout { margin-top: 0; }
body.exui .ex-pay .ex-pay__main { min-width: 0; }
body.exui .ex-pay .ex-pay__h { display: flex; margin-bottom: 12px; }
body.exui .ex-pay .ex-pay__block { min-width: 0; }
body.exui .ex-pay .ex-pay__secure { display: flex; align-items: flex-start; gap: 10px; margin: 16px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ex-fg-58); }
body.exui .ex-pay .ex-pay__secure .i { flex: none; margin-top: 2px; color: var(--ex-muted); }
/* credit covers everything: one line instead of the tiles */
body.exui .ex-pay .ex-pay__covered { display: flex; align-items: center; gap: 14px; padding: 16px 18px 16px 22px; }
body.exui .ex-pay :is(.ex-pay__covered, .ex-pay__methods)[hidden] { display: none; }
body.exui .ex-pay .ex-pay__covered > p { flex: 1; min-width: 0; margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ex-fg-82); }
body.exui .ex-pay .ex-pay__covered > .ex-btn { flex: none; }
body.exui .ex-pay .ex-pay__native { display: none; } /* the tiles drive these selects */
body.exui .ex-pay .ex-choices { margin: 0; padding: 0; border: 0; min-width: 0; }
body.exui .ex-pay .ex-choice__end:empty { display: none; }
body.exui .ex-pay .ex-chip--brand .i { width: 14px; height: 14px; color: var(--ex-fg-82); }

body.exui .ex-pay .ex-pay__paidid { font-family: var(--ex-mono); letter-spacing: -.03em; }
body.exui .ex-pay .ex-pay__paidactions { justify-content: center; flex-wrap: wrap; margin-top: 14px; }
body.exui .ex-pay .ex-pay__paidactions .ex-btn { margin-top: 0; }

/* the new card / bank form, opened in place under its tile: the card (or bank) fields lead,
   the billing contact follows under its own label (CSS order only; every input stays in the DOM) */
body.exui .ex-pay .ex-pay__details { display: flex; flex-direction: column; margin-top: -12px; padding: 22px 22px 6px; border: 1px solid var(--ex-line-strong); border-top: 0; border-radius: 0 0 var(--ex-r-field) var(--ex-r-field); background: rgba(13,15,18,.35); }
body.exui .ex-pay .ex-pay__details > :is(#payment_details_cc, #payment_details_ach) { order: -1; min-width: 0; }
/* gateway markup is not ours: a nowrap row inside it (a card element) must not
   widen the tiles or the page on narrow phones; the details column and every
   block in it shrink, and the gateway wrapper clips what still overflows */
body.exui .ex-pay .ex-pay__details,
body.exui .ex-pay .ex-pay__details :is(#payment_details, #payment_details_cc, #payment_details_ach, .ex-payfields, .exact-payment-card, .exact-payment-element) { min-width: 0; max-width: 100%; }
body.exui .ex-pay :is(.ex-choices, fieldset):has(> .ex-pay__details) { min-width: 0; }
body.exui .ex-pay .ex-pay__details :is(.exact-payment-element, .ex-payfields__gateway) { overflow-x: hidden; }
body.exui .ex-pay .ex-pay__details > .ex-payfields--contact { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--ex-line); }
/* the card section now leads: no separator above it (account.css §12 draws one for the contact-first order) */
body.exui .ex-pay .ex-pay__details > :is(#payment_details_cc, #payment_details_ach) > .ex-payfields:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
body.exui .ex-pay .ex-choice.is-checked:has(+ .ex-pay__details:not([style*="none"])),
body.exui .ex-pay .ex-choice:has(.ex-radio:checked):has(+ .ex-pay__details:not([style*="none"])) { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
body.exui .ex-pay .ex-pay__details .row.panel-fix { margin: 0 -12px; }
body.exui .ex-pay .ex-pay__details .top-focus-box { padding-top: 0; }
body.exui .ex-pay .ex-pay__details h4 { margin: 4px 0 16px; padding-bottom: 12px; border-bottom: 1px solid var(--ex-line); font: 500 11px/1.4 var(--ex-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ex-muted); }
body.exui .ex-pay .ex-pay__details .exact-payment-card { max-width: none; }
body.exui .ex-pay .ex-pay__details .exact-payment-card-heading { margin: 4px 0 16px !important; font: 500 11px/1.4 var(--ex-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ex-muted); } /* answers exui-order.css !important margin */
body.exui .ex-pay .ex-pay__details .exact-payment-element { background: transparent !important; border: 0 !important; padding: 0; } /* answers exui-order.css !important frame: the card field is the frame */
/* the gateway's own 370px cap: the card field runs as wide as the address fields */
body.exui .ex-pay .ex-pay__details :is(#stripe-cc-form, #stripe-ach-form, .StripeElement) { max-width: none; }
/* "Copy contact information from": a hairline row, not a box inside the panel */
body.exui .ex-pay .ex-pay__details .ex-copyfrom { padding: 0 0 18px; border: 0; border-bottom: 1px solid var(--ex-line); border-radius: 0; background: none; }

/* step 1: invoice picker */
body.exui .ex-pay .ex-paylist__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 12px 22px; border-bottom: 1px solid var(--ex-line); }
body.exui .ex-pay .ex-paylist__toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ex-fg-82); border-radius: var(--ex-r-sm); transition: color var(--ex-dur-2); }
/* the pencil stays neutral in both modes (red is never decoration); the label says how to leave the mode */
body.exui .ex-pay .ex-paylist__toggle .i { color: var(--ex-muted); transition: color var(--ex-dur-2); }
body.exui .ex-pay .ex-paylist__toggle:hover, body.exui .ex-pay .ex-paylist__toggle[aria-expanded="true"] { color: var(--ex-fg); }
body.exui .ex-pay .ex-paylist__toggle:hover .i { color: #fff; }
body.exui .ex-pay .ex-paylist__all { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--ex-line); background: var(--ex-well); }
body.exui .ex-pay .ex-paylist__all label { margin: 0; font: 500 11px/1.4 var(--ex-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ex-fg-82); cursor: pointer; }
body.exui .ex-pay .ex-paylist__count { margin-left: auto; font: 400 12px/1.4 var(--ex-mono); color: var(--ex-muted); }
body.exui .ex-pay .ex-paylist__rows { margin: 0; padding: 0; list-style: none; }
body.exui .ex-pay .ex-payrow {
  position: relative; display: grid; grid-template-columns: 20px minmax(0,1fr) auto 32px minmax(120px, auto); align-items: center; gap: 12px 16px;
  min-height: 72px; padding: 14px 22px; border-top: 1px solid var(--ex-line); cursor: pointer; transition: background-color var(--ex-dur-3);
}
body.exui .ex-pay .ex-payrow:first-child { border-top: 0; }
body.exui .ex-pay .ex-payrow:hover { background: var(--ex-row-hover); }
/* selected: the check square and a faint tint (the left bar is the attention row's mark, not selection) */
body.exui .ex-pay .ex-payrow.is-checked { background: rgba(255,255,255,.012); }
body.exui .ex-pay .ex-payrow__main { display: grid; gap: 3px; min-width: 0; margin: 0; cursor: pointer; }
body.exui .ex-pay .ex-payrow__id { font: 600 14.5px/1.3 var(--ex-mono); letter-spacing: -.01em; color: var(--ex-fg); }
body.exui .ex-pay .ex-payrow__when { font-size: 13px; line-height: 1.4; color: var(--ex-muted); }
body.exui .ex-pay .ex-payrow__when .sep { color: var(--ex-line-strong); }
body.exui .ex-pay .ex-payrow__when .is-act { color: var(--ex-fg); }
body.exui .ex-pay .ex-paylist__head .ex-label { white-space: nowrap; }
body.exui .ex-pay .ex-payrow__view .ex-iconbtn { color: var(--ex-muted); }
body.exui .ex-pay .ex-payrow__view .ex-iconbtn:hover { color: #fff; }
body.exui .ex-pay .ex-payrow__amt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
body.exui .ex-pay .ex-payrow__due .ex-amt { font-size: 15px; }
body.exui .ex-pay .ex-paylist.is-editing .ex-payrow__due { display: none; }
/* "$ … USD", as the credit field below */
body.exui .ex-pay .ex-payrow__input { width: 184px; height: 40px; }
body.exui .ex-pay .ex-payrow__input input { padding: 0 8px; font-size: 14px; text-align: right; }
body.exui .ex-pay .ex-payrow__input .ex-inputgroup__affix:first-child { padding-left: 12px; }
body.exui .ex-pay .ex-payrow__input .ex-inputgroup__affix:last-child { padding-right: 12px; }
body.exui .ex-pay .ex-payrow__of { font: 400 11.5px/1.3 var(--ex-mono); color: var(--ex-muted); }
/* a part amount the server would reject (billing.js): the field and its message */
body.exui .ex-pay .ex-payrow__input:has(input.is-invalid) { border-color: var(--ex-accent); box-shadow: var(--ex-ring); }
body.exui .ex-pay .ex-payrow__error { margin-top: 2px; font-size: 12.5px; white-space: nowrap; }
body.exui .ex-pay .ex-payrow.is-invalid .ex-payrow__of { display: none; }
body.exui .ex-pay .ex-paylist--empty .ex-empty { padding: 48px 24px; }

/* step 1: add account credit */
body.exui .ex-pay .ex-pay__credit { padding: 18px 22px; }
body.exui .ex-pay .ex-pay__credit-row { display: flex; align-items: center; justify-content: space-between; gap: 16px 24px; }
body.exui .ex-pay .ex-pay__credit-text { min-width: 0; }
body.exui .ex-pay .ex-pay__credit-text h2 { margin: 0; }
body.exui .ex-pay .ex-pay__credit-text label { margin: 0; font: inherit; letter-spacing: inherit; text-transform: none; color: inherit; cursor: pointer; }
body.exui .ex-pay .ex-pay__opt { margin-left: 6px; font: 500 10.5px/1 var(--ex-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ex-muted); vertical-align: 2px; }
body.exui .ex-pay .ex-pay__credit-input { flex: none; width: 220px; height: 44px; }
body.exui .ex-pay .ex-pay__credit-input input { text-align: right; }
body.exui .ex-pay .ex-pay__credit-help { margin: 12px 0 0; }

/* summary aside (all steps) */
body.exui .ex-pay .ex-sum__lines { margin: 0; padding: 6px 22px; }
body.exui .ex-pay .ex-sum__lines > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--ex-line); font-size: 14px; color: var(--ex-fg-82); }
body.exui .ex-pay .ex-sum__lines > div:last-child { border-bottom: 0; }
body.exui .ex-pay .ex-sum__lines dt { min-width: 0; font-weight: 400; }
body.exui .ex-pay .ex-sum__lines dt small { display: block; margin-top: 3px; font-size: 12.5px; line-height: 1.4; color: var(--ex-muted); overflow-wrap: anywhere; }
/* a line item as the invoice document prints it: the name (Satoshi), then host · period in mono */
body.exui .ex-pay .ex-sum__lines dt small.ex-sum__desc { color: var(--ex-fg-72); }
body.exui .ex-pay .ex-sum__lines dt small .ex-sum__more-n { color: var(--ex-muted); white-space: nowrap; }
body.exui .ex-pay .ex-sum__lines dt small.ex-sum__host { margin-top: 2px; font: 400 12px/1.45 var(--ex-mono); color: var(--ex-muted); }
/* a part payment above the balance (billing.js): the line says what to enter, no amount */
body.exui .ex-pay .ex-sum__lines > .is-invalid dt small { display: flex; gap: 8px; color: var(--ex-fg); }
body.exui .ex-pay .ex-sum__lines > .is-invalid dt small::before { content: ""; flex: none; width: 10px; height: 4px; margin-top: calc(.7em - 2px); background: var(--ex-accent); transform: skewX(35deg); }
body.exui .ex-pay .ex-sum__lines > .is-invalid .ex-amt { color: var(--ex-muted); }
body.exui .ex-pay .ex-sum__lines dd { flex: none; margin: 0; }
body.exui .ex-pay .ex-sum__lines .ex-sum__credit { color: var(--ex-fg); }
body.exui .ex-pay .ex-sum__lines .ex-sum__credit[hidden] { display: none; }
body.exui .ex-pay .ex-sum__lines .ex-sum__sub { padding-top: 0; font-size: 12.5px; color: var(--ex-muted); }
body.exui .ex-pay .ex-sum__lines .ex-sum__empty { font-size: 13.5px; line-height: 1.5; color: var(--ex-muted); }
body.exui .ex-pay .ex-sum__lines > .is-total { color: var(--ex-fg); font-weight: 600; }
body.exui .ex-pay .ex-sum__lines > .is-total .ex-amt { font-size: 15px; }
body.exui .ex-pay .ex-sum__more { margin: 0 22px; border-top: 1px solid var(--ex-line); }
body.exui .ex-pay .ex-sum__more summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 44px; list-style: none; font-size: 13px; font-weight: 600; color: var(--ex-fg-82); cursor: pointer; }
body.exui .ex-pay .ex-sum__more summary::-webkit-details-marker { display: none; }
body.exui .ex-pay .ex-sum__more summary .i { color: var(--ex-muted); transition: transform var(--ex-dur-3) var(--ex-ease); }
body.exui .ex-pay .ex-sum__more[open] summary .i { transform: rotate(180deg); }
body.exui .ex-pay .ex-sum__more ul { display: grid; gap: 8px; margin: 0; padding: 0 0 14px; list-style: none; }
body.exui .ex-pay .ex-sum__more li { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; line-height: 1.45; color: var(--ex-fg-72); }
body.exui .ex-pay .ex-sum__more li > .mono { flex: none; font-size: 12px; color: var(--ex-fg); }
body.exui .ex-pay .ex-sum__item { display: grid; gap: 2px; min-width: 0; }
body.exui .ex-pay .ex-sum__item-t { font-size: 13px; font-weight: 500; color: var(--ex-fg-82); }
body.exui .ex-pay .ex-sum__item-s { font: 400 12px/1.45 var(--ex-mono); color: var(--ex-muted); }
/* the aside is narrow: the period always takes its own line under the host */
body.exui .ex-pay .ex-sum__item-s .ex-desc__period { display: block; }
body.exui .ex-pay .ex-sum__item-s .ex-desc__sep { display: none; }
body.exui .ex-pay .ex-sum__more li > .mono.is-quiet { color: var(--ex-muted); }
body.exui .ex-pay .ex-sum__more li.is-option .ex-sum__item { position: relative; padding-left: 16px; }
body.exui .ex-pay .ex-sum__more li.is-option .ex-sum__item::before { content: "└"; position: absolute; left: 0; top: 0; font-family: var(--ex-mono); color: var(--ex-line-strong); }
body.exui .ex-pay .ex-sum__more li.is-option .ex-sum__item-t { font-weight: 400; color: var(--ex-fg-72); }
body.exui .ex-pay .ex-sum__total { padding: 18px 22px 22px; border-top: 1px solid var(--ex-line); }
body.exui .ex-pay .ex-sum__total:first-child { border-top: 0; }
body.exui .ex-pay .ex-sum__total > .ex-label, body.exui .ex-pay .ex-sum__total > .ex-sum__live > .ex-label { display: flex; overflow-wrap: anywhere; }
body.exui .ex-pay .ex-sum__amt { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 0; min-height: 44px; }
body.exui .ex-pay .ex-sum__amt .ex-money { font-size: 44px; line-height: 1; }
body.exui .ex-pay .ex-sum__amt .ex-unit { font-size: 12px; letter-spacing: .08em; }
/* nothing selected yet, or the credit pays it all: the total is muted, never a $0.00 hero */
body.exui .ex-pay .ex-sum:is(.is-empty, .is-covered) .ex-sum__amt .ex-money { color: var(--ex-muted); }
/* credit covers it all: a word in the hero's place (the strip's word voice), never $0.00 */
body.exui .ex-pay .ex-sum__amt .ex-sum__word { font: 700 24px/1.15 var(--ex-font); letter-spacing: -.03em; color: var(--ex-fg); }
body.exui .ex-pay .ex-sum__amt:has(.ex-sum__word) { align-items: center; }
body.exui .ex-pay .ex-sum__total .ex-btn { margin-top: 20px; }
body.exui .ex-pay .ex-sum__note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ex-fg-58); text-align: center; text-wrap: pretty; }
@media (min-width: 1024px) {
  body.exui .ex-pay--method .ex-pay__aside { padding-top: 28px; }   /* level with the first card under its label */
}

/* step 3: receipt + pay card */
body.exui .ex-pay .ex-receipt__lines { padding-top: 4px; }
body.exui .ex-pay .ex-receipt__method { display: flex; align-items: center; gap: 16px; padding: 18px 22px; }
body.exui .ex-pay .ex-receipt__method .ex-chip { width: 44px; height: 44px; border-radius: var(--ex-r-field); }
body.exui .ex-pay .ex-receipt__t { margin: 0; font-size: 15px; font-weight: 600; color: var(--ex-fg); }
body.exui .ex-pay .ex-receipt__s { margin: 3px 0 0; font: 400 12.5px/1.45 var(--ex-mono); color: var(--ex-muted); }
body.exui .ex-pay .ex-receipt__addr { padding: 16px 22px 20px; border-top: 1px solid var(--ex-line); }
body.exui .ex-pay .ex-receipt__addr p:not(.ex-label) { margin: 10px 0 0; font-size: 14px; line-height: 1.6; color: var(--ex-fg-72); }
body.exui .ex-pay .ex-receipt__addr b { font-weight: 600; color: var(--ex-fg); }
body.exui .ex-pay .ex-paynow__form { margin: 0; }
body.exui .ex-pay .ex-paynow__form:has(> .ex-btn) { margin-top: 20px; }
body.exui .ex-pay .ex-paynow__form .ex-btn { margin-top: 0; }
body.exui .ex-pay .ex-paynow__gateways { display: grid; gap: 10px; margin-top: 20px; }
body.exui .ex-pay .ex-paynow__gateway { min-width: 0; }
body.exui .ex-pay .ex-paynow__gateway > :is(form, div) { margin: 0; }
body.exui .ex-pay .ex-paynow__gateway :is(.btn, button[type="submit"], input[type="submit"]):where(:not(.exact-paypal-fallback)) { width: 100%; height: 50px; font-size: 15px; }
body.exui .ex-pay .ex-paynow #paypal-button-container { max-width: none; margin: 0; }
/* the "Continue to PayPal" fallback (exact-theme.js) is this page's one primary;
   !important answers exui-order.css's PayPal-blue !important */
body.exui .ex-pay .ex-paynow .exact-paypal-fallback {
  max-width: none; min-height: 50px; gap: 8px; font-size: 15px; font-weight: 600;
  background: var(--ex-accent) !important; border-color: transparent !important; border-radius: var(--ex-r-pill) !important;
  box-shadow: var(--ex-inset-hi) !important; color: var(--ex-fg) !important;
}
body.exui .ex-pay .ex-paynow .exact-paypal-fallback:is(:hover, :focus-visible) { background: var(--ex-accent-strong) !important; box-shadow: var(--ex-inset-hi), var(--ex-glow-strong) !important; transform: none; }

/* received: result window across the content width. With facts: result on the left, the receipt
   facts on the right (rows keep their 50px rhythm; the divider runs the card's height); without:
   the result and its actions on one line. The pill carries the status (no second status chip). */
body.exui .ex-pay .ex-result__body { padding: 26px 26px 24px; }
@media (min-width: 1024px) {
  body.exui .ex-pay .ex-result.has-facts .ex-result__body { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: auto 1fr; column-gap: 48px; }
  body.exui .ex-pay .ex-result.has-facts .ex-result__head { grid-column: 1; grid-row: 1; }
  body.exui .ex-pay .ex-result.has-facts .ex-result__actions { grid-column: 1; grid-row: 2; align-self: end; }
  body.exui .ex-pay .ex-result.has-facts .ex-result__facts { grid-column: 2; grid-row: 1 / span 2; align-self: stretch; align-content: start; margin: -26px -26px -24px 0; padding: 8px 0; border-left: 1px solid var(--ex-line); }
  body.exui .ex-pay .ex-result.has-facts .ex-result__facts > div:first-child { border-top: 0; }
  body.exui .ex-pay .ex-result:not(.has-facts) .ex-result__body { display: flex; align-items: center; justify-content: space-between; gap: 24px 48px; }
  body.exui .ex-pay .ex-result:not(.has-facts) .ex-result__actions { flex: none; margin-top: 0; }
}
body.exui .ex-pay .ex-result__head { display: flex; align-items: center; gap: 20px; }
body.exui .ex-pay .ex-result__headtext { display: grid; justify-items: start; gap: 14px; min-width: 0; }
body.exui .ex-pay .ex-result__pill { margin: 0; }
body.exui .ex-pay .ex-result__amt { display: flex; align-items: baseline; gap: 8px; margin: 0; }
body.exui .ex-pay .ex-result__amt .ex-money { font-size: 44px; line-height: 1; }
body.exui .ex-pay .ex-result__amt .ex-unit { font-size: 12px; letter-spacing: .08em; }
body.exui .ex-pay .ex-result__none { margin: 0; font-size: 14.5px; line-height: 1.5; color: var(--ex-fg-72); }
/* the provider's own words, attributed ("Message from PayPal") — an explanation, not a form field */
body.exui .ex-pay .ex-result__reason { max-width: 60ch; margin: 0; }
body.exui .ex-pay .ex-result__from { display: block; margin-bottom: 4px; font-size: 13px; line-height: 1.45; color: var(--ex-muted); }
body.exui .ex-pay .ex-result__reason q { display: block; font-size: 15.5px; line-height: 1.5; color: var(--ex-fg-82); quotes: "\201C" "\201D"; }
body.exui .ex-pay .ex-result__facts { margin: 24px -26px 0; }
body.exui .ex-pay .ex-result__facts > div { padding-left: 26px; padding-right: 26px; }
/* every row keeps the copy button's column (an empty span where there is none),
   so the values end on one edge: 28px button with its -6px pull = 22px */
body.exui .ex-pay .ex-result__facts > div { grid-template-columns: minmax(0,1fr) minmax(0,auto) 22px; }
body.exui .ex-pay .ex-result__invoices a { text-decoration: underline; text-decoration-color: rgba(255,255,255,.25); text-underline-offset: 3px; }
body.exui .ex-pay .ex-result__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
body.exui .ex-pay .ex-result .ex-window__title { overflow: hidden; text-overflow: ellipsis; }

/* approve-quotation dialog: hairline facts, no box inside the modal */
body.exui form.ex-approve .ex-approve__facts { margin: 0 0 18px; padding: 0; border: 0; background: none; }
body.exui form.ex-approve .ex-approve__facts > div { align-items: baseline; padding: 10px 0; border-top: 1px solid var(--ex-line); }
body.exui form.ex-approve .ex-approve__facts > div:last-child { border-bottom: 1px solid var(--ex-line); }
body.exui form.ex-approve :is(.ex-approve__facts, .ex-approve__facts > div)[hidden] { display: none; }
body.exui form.ex-approve .ex-approve__facts dd { min-width: 0; overflow-wrap: anywhere; }
body.exui form.ex-approve .ex-approve__facts .is-total dd { font-size: 15px; font-weight: 700; }
body.exui form.ex-approve .ex-approve__note { margin: 0 0 14px; font-size: 14px; line-height: 1.55; color: var(--ex-fg-72); }

/* =========================================================================
   4. Responsive
   ========================================================================= */
@media screen and (max-width: 1179.98px) {
  /* optional columns (Billed / Created / Applied) give their width to the rest */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table .cell-opt { display: none; }
}
@media screen and (min-width: 768px) and (max-width: 1023.98px) {
  /* two-field filters: both fields and Clear / Apply on one row */
  body.exui :is(#client_invoices, #client_quotations) .ex-list__filters form.widget_filter_form > .card { grid-template-columns: repeat(2, minmax(0,1fr)) auto; }
  body.exui :is(#client_invoices, #client_quotations) .ex-list__filters form.widget_filter_form .col-md-12 { grid-column: -2 / -1; grid-row: 1; align-self: end; }
}
@media screen and (max-width: 1023.98px) {
  body.exui .ex-billing--invoice .ex-invoice__aside { order: -1; }
  /* review and pay: the pay card (total + the one action) comes first for every method, merchant or gateway */
  body.exui .ex-pay--confirm .ex-pay__aside { order: -1; }
  /* a three-cell summary strip: two cells, then the third across */
  body.exui .ex-billing--invoices .ex-strip > .ex-strip__cell:nth-child(3):last-child { grid-column: 1 / -1; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-search { width: 200px; }
  /* tablet: long mono headings ("DATE EXPIRES") wrap instead of widening their column */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table th:not(.cell-actions) { white-space: normal; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table :is(th, td):not(:first-child):not(:last-child) { padding-left: 12px; padding-right: 12px; }
  body.exui #client_transactions .ex-list__filters form.widget_filter_form > .card { grid-template-columns: repeat(2, minmax(0,1fr)); }
  body.exui .ex-billing--invoice .ex-doc__parties { grid-template-columns: 1fr 1fr; }
  body.exui .ex-billing--invoice .ex-doc__party:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--ex-line); }
  body.exui .ex-pay--method .ex-pay__aside { padding-top: 0; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__tools { margin-left: 0; }
}
@media screen and (max-width: 767.98px) {
  /* stepper (DESIGN §5.3, §9): a done step keeps only its Change link; the current step's caption
     is one full-width line under the stepper instead of a 110px column */
  body.exui:has(.ex-pay) .ex-pagehead .ex-step-h.is-done .ex-step-h__cap,
  body.exui:has(.ex-pay) .ex-pagehead .ex-step-h.is-done .ex-step-h__chg .sep,
  body.exui:has(.ex-pay) .ex-pagehead .ex-step-h.is-current .ex-step-h__s { display: none; }
  body.exui:has(.ex-pay) .ex-pagehead .ex-step-h__s a { display: inline-flex; align-items: center; min-height: 40px; }
  body.exui:has(.ex-pay) .ex-pagehead .ex-stepper__now { display: block; margin: 16px 0 0; font: 400 12px/1.45 var(--ex-mono); color: var(--ex-muted); }
  body.exui:has(.ex-pay) .ex-pagehead .ex-stepper__now .ex-stepper__n { font-weight: 600; color: #fff; }
  body.exui:has(.ex-pay) .ex-pagehead .ex-stepper__now .sep { color: var(--ex-line-strong); }

  /* list toolbars: segmented filter, then search + Filter on one line */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__bar--seg { padding: 16px 20px; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-seg { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-seg__item { justify-content: center; height: 40px; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-seg__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* transactions: no row actions, so the expander sits top-right and the number gets the full row */
  /* pinned 20px inside the row (its padding), so it ends where the invoice and quote expanders do. grid-column:auto:
     an absolute grid child with grid lines (exui.css gives cell-actions 1 / -1) takes the grid area, i.e. the
     content box, as its containing block; auto lines use the row's padding box */
  body.exui #client_transactions .ex-list__table tr.expand { position: relative; }
  body.exui #client_transactions .ex-list__table tr.expand > td.cell-actions { position: absolute; top: 14px; right: 20px; width: auto; grid-column: auto; grid-row: auto; }
  /* rows without details carry no expander: the empty actions cell takes no line */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-actions:empty { display: none !important; } /* answers the stacked cell's display:flex!important above */
  body.exui #client_transactions .ex-list__table tr.expand > td:nth-child(3) { grid-column: 1 / -1; }
  body.exui #client_transactions .ex-list__table tr.expand > td.cell-main { padding-right: 48px !important; } /* answers .ex-table--stack td{padding:0!important}: clear the expander */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__tools { width: 100%; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-search { width: auto; flex: 1; height: 40px; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .filter-toggle { height: 40px; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form > .card { grid-template-columns: minmax(0,1fr); padding: 16px 20px !important; } /* answers Bootstrap's .p-3 !important */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__filters form.widget_filter_form .col-md-12 :is(.btn, .ex-btn) { flex: 1; height: 44px; }

  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-actions { width: auto; text-align: left; display: flex !important; align-items: center; gap: 8px; } /* answers .ex-table--stack td{display:block} */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-actions > .ex-rowactions { display: flex; flex: 1; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-actions:not(:has(.ex-rowactions)) { justify-content: flex-end; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-actions > .ex-expand { width: 40px; height: 40px; margin: 0 0 0 auto; }
  body.exui :is(#client_quotations, #client_transactions) .ex-list__table td.cell-main { max-width: none; }
  body.exui #client_invoices .ex-list__table:not(:has(.ex-consq)) :is(th, td):first-child { width: auto; white-space: normal; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.r .ex-hint { text-align: left; }
  body.exui #client_transactions .ex-list__table .ex-txn__id { max-width: 100%; }
  /* 40px touch targets (DESIGN §9) */
  body.exui #client_transactions .ex-txn__copy { width: 40px; height: 40px; margin: -6px 0; }
  body.exui .ex-pay .ex-result__facts .ex-iconbtn { width: 40px; height: 40px; margin-right: -10px; }
  body.exui .ex-pay .ex-paylist__toggle { min-height: 40px; }
  /* a stacked row's ID is its only link to the invoice: a 40px hit area, the row's layout unchanged */
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-list__table td.cell-main a.ex-id { display: inline-block; padding: 12px 0; margin: -12px 0; }
  /* result facts: each invoice link is a 40px target */
  body.exui .ex-pay .ex-result__invoices a { display: inline-block; padding: 11px 0; margin: -11px 0; }
  /* "Already paid": full-size buttons on phones */
  body.exui .ex-pay .ex-pay__paidactions .ex-btn { height: 44px; padding: 0 22px; }
  body.exui :is(#client_invoices, #client_transactions, #client_quotations) .ex-subpane { padding: 12px 20px 16px; }

  /* invoice document */
  body.exui .ex-billing--invoice .ex-doc__parties { grid-template-columns: minmax(0,1fr); }
  body.exui .ex-billing--invoice .ex-doc__party + .ex-doc__party { border-left: 0; border-top: 1px solid var(--ex-line); }
  body.exui .ex-billing--invoice .ex-doc__party { padding: 20px; }
  body.exui .ex-billing--invoice .ex-doc__lines tr { grid-template-columns: auto auto minmax(0,1fr); }
  body.exui .ex-billing--invoice .ex-doc__lines td:last-child { text-align: right; }
  /* the period gets its own line under the host (it never breaks inside) */
  body.exui .ex-billing .ex-desc__period { display: block; }
  body.exui .ex-billing .ex-desc__sep { display: none; }
  body.exui .ex-billing--invoice .ex-doc__lines td.r { text-align: left; }
  body.exui .ex-billing--invoice .ex-doc__lines td:last-child.r { text-align: right; }
  body.exui .ex-billing--invoice .ex-doc__foot { grid-template-columns: minmax(0,1fr); gap: 24px; padding: 20px; }
  body.exui .ex-billing--invoice .ex-doc__terms { order: 2; }
  body.exui .ex-billing--invoice .ex-doc__payments > .ex-label { margin: 0 20px 4px; }
  /* payment rows: the transaction number gets its own line and wraps (never truncated on phones), then date + amount */
  body.exui .ex-billing--invoice .ex-doc__paylines td:nth-child(2) { grid-column: 1 / -1; }
  body.exui .ex-billing--invoice .ex-doc__paylines .ex-doc__txn { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  body.exui .ex-billing--invoice .ex-duebox { padding: 20px; }
  body.exui .ex-billing--invoice .ex-duebox__amt .ex-money { font-size: 46px; }
  /* the paid-with transaction ID wraps, its copy button at the top (DESIGN §9: never truncate values) */
  body.exui .ex-billing--invoice .ex-duebox__facts .ex-duebox__txn { align-items: flex-start; }
  body.exui .ex-billing--invoice .ex-duebox__facts .ex-duebox__txn dd { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
  body.exui .ex-billing--invoice .ex-duebox__facts .ex-duebox__txn .ex-iconbtn { width: 40px; height: 40px; margin: -10px -10px -10px 0; }

  /* pay */
  body.exui .ex-pay .ex-payrow { grid-template-columns: 20px minmax(0,1fr) auto; padding: 14px 20px; gap: 8px 12px; }
  body.exui .ex-pay .ex-paylist__head { flex-wrap: wrap; row-gap: 6px; }
  body.exui .ex-pay .ex-payrow__status { grid-column: 2; grid-row: 2; justify-self: start; }
  body.exui .ex-pay .ex-payrow__status:empty { display: none; }
  body.exui .ex-pay .ex-payrow__view { grid-column: 3; grid-row: 1; }
  body.exui .ex-pay .ex-payrow__view .ex-iconbtn { width: 40px; height: 40px; }
  body.exui .ex-pay .ex-payrow__amt { grid-column: 2 / 4; flex-direction: row; align-items: center; gap: 10px; text-align: left; }
  body.exui .ex-pay .ex-payrow__status:empty + .ex-payrow__view + .ex-payrow__amt { grid-row: 2; }
  /* part payment: the field takes the row's width, "of $1.55 due" (or the error) stays on one line beside or under it */
  body.exui .ex-pay .ex-paylist.is-editing .ex-payrow__amt { flex-wrap: wrap; row-gap: 6px; }
  body.exui .ex-pay .ex-payrow__input { flex: 1 1 150px; width: auto; min-width: 0; max-width: 260px; height: 44px; }
  body.exui .ex-pay .ex-payrow__of { white-space: nowrap; }
  body.exui .ex-pay .ex-payrow__error { flex-basis: 100%; white-space: normal; }
  /* step 1: the list right above already shows the selection and the dock carries the total,
     so the summary keeps only the total and Continue (and its prompt when nothing is selected) */
  body.exui .ex-pay--choose .ex-sum:not(.is-empty) :is(.ex-card__head, .ex-sum__lines) { display: none; }
  body.exui .ex-pay--choose .ex-sum:not(.is-empty) .ex-sum__total { border-top: 0; }
  body.exui .ex-pay :is(.ex-paylist__head, .ex-paylist__all) { padding-left: 20px; padding-right: 20px; }
  body.exui .ex-pay .ex-pay__credit { padding: 18px 20px; }
  body.exui .ex-pay .ex-pay__credit-row { flex-direction: column; align-items: stretch; }
  body.exui .ex-pay .ex-pay__credit-input { width: 100%; }
  body.exui .ex-pay .ex-pay__details { padding: 18px 16px 4px; }
  body.exui .ex-pay .ex-pay__details > .ex-payfields--contact { margin-top: 18px; padding-top: 18px; }
  body.exui .ex-pay .ex-sum__lines { padding: 6px 20px; }
  body.exui .ex-pay .ex-sum__more { margin: 0 20px; }
  body.exui .ex-pay .ex-sum__total { padding: 18px 20px 20px; }
  body.exui .ex-pay .ex-receipt__method { padding: 16px 20px; }
  body.exui .ex-pay .ex-receipt__addr { padding: 16px 20px 18px; }
  body.exui .ex-pay .ex-result__body { padding: 22px 20px 20px; }
  body.exui .ex-pay .ex-result__facts { margin: 20px -20px 0; }
  body.exui .ex-pay .ex-result__facts > div { padding-left: 20px; padding-right: 20px; grid-template-columns: minmax(0,1fr) minmax(0,auto) 30px; } /* 40px button, -10px pull */
  body.exui .ex-pay .ex-result__facts > div > .ex-iconbtn { grid-row: 1; }
  body.exui .ex-pay .ex-result__facts > div > span:empty { grid-column: 3; grid-row: 1; }
  body.exui .ex-pay .ex-result__head { gap: 16px; }
  body.exui .ex-pay .ex-result__amt .ex-money { font-size: 38px; }
  body.exui .ex-pay .ex-result__actions .ex-btn { flex: 1 1 100%; height: 48px; }
  body.exui .ex-pay .ex-pay__covered { flex-wrap: wrap; padding: 16px 20px; }
  body.exui .ex-pay .ex-pay__covered > p { flex: 1 1 calc(100% - 50px); }
  body.exui .ex-pay .ex-pay__covered > .ex-btn { flex: 1 1 100%; height: 44px; }
}
@media screen and (max-width: 359.98px) {
  body.exui .ex-pay .ex-choice { grid-template-columns: 20px minmax(0,1fr); }
  body.exui .ex-pay .ex-choice > .ex-chip--brand { display: none; }
  body.exui .ex-pay .ex-choice > :last-child:not(.ex-choice__body) { grid-column: 2; }
}

/* =========================================================================
   5. Print: the invoice as a clean white document (no shell, no aside).
   Scoped to the invoice page, so no other page loses its kicker in print.
   ========================================================================= */
@media print {
  /* named colours on purpose: the print page is white whatever the screen theme (color-scheme: dark) */
  /* the document lays out at the page width: answers Bootstrap's print body{min-width:992px!important} */
  body.exui:has(.ex-billing--invoice) { min-width: 0 !important; }
  /* the document carries its own head on paper ("INVOICE · PAID", the ID, absolute dates) */
  body.exui:has(.ex-billing--invoice) :is(.ex-invoice__aside, .ex-billing__alerts, .ex-dock, .ex-pagehead) { display: none !important; }
  body.exui .ex-billing--invoice .ex-invoice { display: block; }
  body.exui .ex-billing--invoice .ex-doc__printhead { display: block; padding: 22px 22px 18px; border-bottom: 1px solid silver; }
  body.exui .ex-billing--invoice .ex-doc__printhead .ex-label { display: block; }
  body.exui .ex-billing--invoice .ex-doc__printid { margin: 8px 0 0; font: 600 28px/1.1 var(--ex-mono); letter-spacing: -.04em; }
  body.exui .ex-billing--invoice .ex-doc__printlede { margin: 8px 0 0; font-size: 14px; line-height: 1.5; }
  body.exui .ex-billing--invoice .ex-doc__printlede .mono { font-family: var(--ex-mono); }
  /* the period never breaks inside, and lines up under the host on paper too */
  body.exui .ex-billing .ex-desc__period { white-space: nowrap; }
  body.exui .ex-billing--invoice .ex-doc { border-color: silver !important; background: white !important; }
  body.exui .ex-billing--invoice .ex-doc * { color: black !important; background: transparent !important; box-shadow: none !important; text-shadow: none !important; }
  body.exui .ex-billing--invoice .ex-doc :is(.ex-label, .ex-doc__desc span, .ex-facts dt, .ex-doc__terms, .ex-doc__terms p, .ex-hint, .ex-amt small) { color: dimgray !important; }
  body.exui .ex-billing--invoice .ex-doc :is(.ex-doc__parties, .ex-doc__party, .ex-doc__foot, .ex-doc__payments, .ex-table th, .ex-table td, .ex-totals > div) { border-color: silver !important; }
  body.exui .ex-billing--invoice .ex-doc .ex-table tr { break-inside: avoid; }
  body.exui:has(.ex-billing--invoice) .ex-rise { animation: none !important; opacity: 1 !important; transform: none !important; }
}
