/* =====================================================================================================================
   v8 payments: Payments (#/invoices) and an invoice (#/invoices/:id). 17 October 2026, second pass; third pass 18 October 2026
   (Janne's review: the hero is the next payment, every invoice shows its number and what it covers, Set up e-invoicing and
   Combine invoices, fewer titles).
   Views: ../../prototype/app/v8-payments.js. Spec: ../../old/explore/visual/VISUAL-SPEC.md, section 25 "Money".
   Builds on base.css: only v8-pay-* classes are new; every rule starts with #v8 #app (2 ids). Font sizes and weights carry
   !important (the older `#app *` weight rule); no font-size inside a media or container query. Sizes are the five (16 here).
   ===================================================================================================================== */

/* ---------- The payment details: value first, its label under it (section 11.1) ---------- */
/* dt then dd in the markup (a screen reader hears the label first), shown value first by column-reverse. The Copy button sits
   8 from the last digit so its focus ring clears the text; -10 margins keep the 44 target on a 24 line. Used by the invoice
   page's payment row (.v8-pay-ref) and each open invoice's card on Payments (.v8-pay-det) */
#v8 #app :is(.v8-pay-ref, .v8-pay-det) > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: var(--v8-1); min-width: 0; }
#v8 #app :is(.v8-pay-ref, .v8-pay-det) dt { margin: 0; color: var(--v8-ink-2); font-size: var(--v8-fs-16) !important; line-height: var(--v8-lh-16) !important; font-weight: 400 !important; }
#v8 #app :is(.v8-pay-ref, .v8-pay-det) dd { display: flex; align-items: center; gap: var(--v8-2); min-height: 24px; margin: 0; color: var(--v8-ink); font-size: var(--v8-fs-16) !important; line-height: var(--v8-lh-16) !important; font-weight: 400 !important; }
#v8 #app .v8-pay-v { font-variant-numeric: tabular-nums; white-space: nowrap; }
#v8 #app :is(.v8-pay-ref, .v8-pay-det) .v8-ib { margin: -10px 0; flex: none; }

/* Every Copy is link green since 18 October 2026, night: base.css (V8.copy) draws it on every page, so nothing of its own here */

/* The payment row (an invoice page): a row that wraps */
#v8 #app .v8-pay-ref { display: flex; flex-wrap: wrap; gap: var(--v8-4) var(--v8-7); margin: 0; }

/* The hero's strip is the system's (V8.facts({ strip: true }), README 35, base.css 7) since 18 October 2026, night */

/* ---------- Payments: Invoices to pay (SPEC 4.4) ----------
   Combine invoices sits on the section's title row (V8.section's action), at its right from 640 and under the line on a phone.
   One gray card per open invoice, 8 apart, 32 in (24 on a phone): the claim card's white 48 disc with the invoice icon; the title
   (the invoice's number, the link, 20 Bold) and what it covers; the amount at 28 Bold deep green with Copy and "to pay by ..." under
   it, at the right. Under a hairline that starts past the disc, the bank details in three columns, each value 16 Bold first and its
   label under it, Copy beside the account and reference numbers. The card is a container, so it decides its own columns */
#v8 #app .v8-pay-topay .v8-sh-a { flex-wrap: nowrap; align-items: flex-end; }
#v8 #app .v8-pay-topay .v8-sh-act { flex: none; }
/* On a phone the button goes under the line, at its left, where the eye already is */
@media (max-width: 639px) {
  #v8 #app .v8-pay-topay .v8-sh-a { display: block; }
  #v8 #app .v8-pay-topay .v8-sh-act { margin-top: var(--v8-4); }
}
#v8 #app .v8-pay-cards { display: grid; gap: var(--v8-2); margin: 0; padding: 0; list-style: none; }
#v8 #app .v8-pay-card { container: paycard / inline-size; padding: var(--v8-6); border-radius: var(--v8-r); background: var(--v8-gray); }
#v8 #app .v8-pay-ch { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: start; gap: var(--v8-4) var(--v8-6); }
#v8 #app .v8-pay-disc { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--v8-white); }
#v8 #app .v8-pay-disc svg.i { width: 24px; height: 24px; color: var(--v8-green); }
#v8 #app .v8-pay-ct { min-width: 0; padding-top: 2px; }
#v8 #app .v8-pay-ct > .v8-cn { margin: 0; }
#v8 #app .v8-pay-ct > .v8-cn > .v8-link { display: inline; font-size: var(--v8-fs-20) !important; line-height: var(--v8-lh-20) !important; font-weight: 700 !important; }
#v8 #app .v8-pay-ct > .v8-cl { margin: var(--v8-2) 0 0; color: var(--v8-ink-2); }
#v8 #app .v8-pay-amt { display: grid; justify-items: end; gap: var(--v8-1); margin: 0; text-align: right; }
#v8 #app .v8-pay-amt > span:last-child { color: var(--v8-ink-2); }
#v8 #app .v8-pay-amtv { display: flex; align-items: center; gap: var(--v8-2); }
#v8 #app .v8-pay-amtv .v8-f28 { color: var(--v8-deep) !important; font-weight: 700 !important; white-space: nowrap; }
#v8 #app .v8-pay-amtv .v8-ib { margin: -8px -10px -8px 0; }   /* the 44 target on the 32 line, its ring clear of the figure */
#v8 #app .v8-pay-det { display: grid; grid-template-columns: minmax(max-content, 1.2fr) minmax(max-content, 0.8fr) minmax(max-content, 1fr); gap: var(--v8-4) var(--v8-6); margin: var(--v8-5) 0 0 calc(48px + var(--v8-6)); padding: var(--v8-5) 0 0; border-top: 1px solid var(--v8-line); }
#v8 #app .v8-pay-det dd, #v8 #app .v8-pay-det dd .v8-pay-v { font-weight: 700 !important; }
/* A narrow card: the disc steps aside under a 560 content box (the hairline then starts at the card's edge); the amount goes under
   the title, left-aligned, under 480; the account number takes a row of its own, then the recipient and the reference number side
   by side. The markup is in that order at every width (account number, recipient, reference number, as a Finnish bank's
   transfer form asks for them), so what she sees and what a screen reader reads agree */
@container paycard (max-width: 719px) { #v8 #app .v8-pay-det { grid-template-columns: repeat(3, max-content); column-gap: var(--v8-5); } }
@container paycard (max-width: 559px) {
  #v8 #app .v8-pay-ch { grid-template-columns: minmax(0, 1fr) auto; }
  #v8 #app .v8-pay-disc { display: none; }
  #v8 #app .v8-pay-det { margin-left: 0; }
}
@container paycard (max-width: 479px) {
  #v8 #app .v8-pay-ch { grid-template-columns: minmax(0, 1fr); }
  #v8 #app .v8-pay-amt { justify-items: start; text-align: left; }
  #v8 #app .v8-pay-det { grid-template-columns: max-content minmax(0, 1fr); gap: var(--v8-4) var(--v8-6); }
  #v8 #app .v8-pay-det > div:first-child { grid-column: 1 / -1; }
}
@container paycard (max-width: 399px) { #v8 #app .v8-pay-det { column-gap: var(--v8-4); } }   /* "Reference number" on one line at 320 */
/* On a phone the cards take 16 in from their edges, so the account number and its Copy keep one line at 320 */
@media (max-width: 639px) {
  #v8 #app .v8-pay-card { padding: var(--v8-4); }
  #v8 #app .v8-pay-det .v8-ib, #v8 #app .v8-pay-amtv .v8-ib { margin-right: -10px; }
}

/* Paired boxes (For your bookkeeping beside Questions about an invoice?, and an invoice's band) are base.css 30 since 18 October
   2026, late evening: nothing of their own here */

/* ---------- Payments: the paid invoices, white month rows (SPEC 4.4; README 36) ----------
   The system's records (V8.drows({ surface: "white", total }) with V8.rows({ surface: "white" }) in each month, base.css "Records
   as white rows"). Here only: the year's Fennia radio pair 24 above the rows, the month's total in ink Bold, and each month's
   invoice amounts on the months' totals' edge (left of the 40 chevron and the row's 24 gap) */
#v8 #app .v8-pay-yrs { margin-bottom: var(--v8-5); }
#v8 #app .v8-pay-paid .v8-drow-e, #v8 #app .v8-pay-paid .v8-drow-e .v8-pay-v { font-weight: 700 !important; }
/* One edge for every amount: the month's total, its invoices and the year's total all end left of the chevron. A month's total is
   short, so it keeps its place beside the chevron on a phone too (the system's phone layout drops it under the line, which made
   each month 120 tall and put the totals on a different edge from the invoices') */
#v8 #app .v8-pay-paid .v8-drow-h { column-gap: var(--v8-5); }
#v8 #app .v8-pay-paid .v8-drow-p .v8-rows-end, #v8 #app .v8-pay-paid .v8-drow-tot > b { padding-right: calc(40px + var(--v8-5)); }
@media (max-width: 767px) {
  #v8 #app .v8-pay-paid .v8-drow-h { grid-template-columns: minmax(0, 1fr) auto 40px; grid-template-areas: "n e x" "l e x"; column-gap: var(--v8-4); padding: var(--v8-3); }
  #v8 #app .v8-pay-paid .v8-drow-x { align-self: center; margin-top: 0; }
  #v8 #app .v8-pay-paid .v8-drow-p .v8-rows-end, #v8 #app .v8-pay-paid .v8-drow-tot > b { padding-right: calc(40px + var(--v8-4)); }
}

/* ---------- An invoice: Payment details on a gray card on the white page (the claim page's payment card) ---------- */
#v8 #app .v8-pay-box { padding: var(--v8-5) var(--v8-6); border-radius: var(--v8-r); background: var(--v8-gray); }
#v8 #app .v8-pay-box .v8-pay-ref { margin: 0; padding: 0; border-top: 0; }

/* ---------- An invoice: what it covers, a white table on the band ---------- */
/* A policy cell (V8.table's link cell): the name in link green, its number under it in ink-2 */
#v8 #app .v8-pay-ln { display: grid; justify-items: start; gap: 2px; }
#v8 #app .v8-pay-pn { color: var(--v8-ink-2); }

/* ---------- The confirmations (Set up e-invoicing, Combine invoices) ---------- */
#v8 .v8-dlg-b .v8-pay-dlg { margin: 0; color: var(--v8-ink); }
#v8 .v8-dlg-b .v8-pay-dlg + .v8-pay-dlg { margin-top: var(--v8-4); }
/* Set up e-invoicing: the two things she does as a numbered list, 8 under its line, 16 above the next */
#v8 .v8-dlg-b .v8-pay-steps { margin: var(--v8-2) 0 var(--v8-4); padding-left: var(--v8-5); color: var(--v8-ink); list-style: decimal outside; }
#v8 .v8-dlg-b .v8-pay-steps > li { display: list-item; list-style: inherit; }
#v8 .v8-dlg-b .v8-pay-steps > li + li { margin-top: var(--v8-2); }
/* Combine invoices (18 October 2026, after the payments review): the one invoice on a gray card (its 20 Bold title, its line 8
   under with the amount said once, then the policies 16 under as a compact two-column list: name left, monthly price right, no
   total row, at every width), then the optional renewal choice 32 under it: the system's option rows with the hint under their
   question. V8.table's styles are scoped to #app (base.css), and a dialog sits outside it, so the list's few rules are here */
#v8 .v8-dlg-b .v8-pay-new { margin-top: var(--v8-5); padding: var(--v8-5); border-radius: var(--v8-r); background: var(--v8-gray); }
#v8 .v8-dlg-b .v8-pay-new > h3 { margin: 0; color: var(--v8-ink); font-size: var(--v8-fs-20) !important; line-height: var(--v8-lh-20) !important; font-weight: 700 !important; }
#v8 .v8-dlg-b .v8-pay-new > .v8-line { margin: var(--v8-2) 0 0; color: var(--v8-ink-2); }
/* The system's table (base.css 11, scoped to dialogs too since 18 October 2026) as a compact two-column list on the gray card:
   no inner card, and rows stay rows on phones */
#v8 :is(#app, .v8-dlgw) .v8-dlg-b .v8-pay-new .v8-tablew { margin: var(--v8-4) 0 0; padding: 0; background: none; }
#v8 :is(#app, .v8-dlgw) .v8-dlg-b .v8-pay-new .v8-table tbody tr { display: table-row; padding: 0; border: 0; }
#v8 :is(#app, .v8-dlgw) .v8-dlg-b .v8-pay-new .v8-table { width: 100%; border-collapse: collapse; }
#v8 :is(#app, .v8-dlgw) .v8-dlg-b .v8-pay-new .v8-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
#v8 :is(#app, .v8-dlgw) .v8-dlg-b .v8-pay-new .v8-table tbody :is(th, td) { padding: var(--v8-2) 0; text-align: left; vertical-align: baseline; border-top: 1px solid var(--v8-line); color: var(--v8-ink); font-size: var(--v8-fs-16) !important; line-height: var(--v8-lh-16) !important; font-weight: 400 !important; }
#v8 :is(#app, .v8-dlgw) .v8-dlg-b .v8-pay-new .v8-table tbody tr:first-child :is(th, td) { border-top: 0; }
#v8 :is(#app, .v8-dlgw) .v8-dlg-b .v8-pay-new .v8-table .v8-num { padding-left: var(--v8-4); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
#v8 .v8-dlg-b .v8-pay-align { margin-top: var(--v8-6); }
#v8 .v8-dlg-b > .v8-pay-align:first-child { margin-top: 0; }   /* Change renewal dates: the choice is the whole body */
#v8 .v8-dlg-b .v8-pay-align .v8-opts-hint { margin: var(--v8-1) 0 var(--v8-4); color: var(--v8-ink-2); }
/* The first focus is the dialog's title (tabindex -1, focused by script): no ring after a mouse click, the system's ring for keys */
#v8 .v8-dlg-h h2[tabindex="-1"]:focus:not(:focus-visible) { outline: none; }

/* ---------- New stage: the empty state straight after the hero ---------- */
#v8 #app .v8-pay-empty { margin-top: var(--v8-sec); }

/* ---------- Phone (section 23): stacks; type never changes ---------- */
@media (max-width: 639px) {
  #v8 #app .v8-pay-ref { flex-direction: column; gap: var(--v8-4); }
  #v8 .v8-dlg-b .v8-pay-new { padding: var(--v8-4); }
  #v8 #app .v8-pay-box { padding: var(--v8-4); }
}

/* Month and invoice read as two levels (20 October 2026, Janne: "hiearachy of month vs invoice row is not clear enough"): the
   month is the heading, its name and total 20 Bold; its invoices sit under it on a gray inset, 32 in from the month's edge, radius
   12, hairlines between, the invoice number 16 and its amount 16 regular on the same right edge as the month's total */
#v8 #app .v8-pay-paid .v8-drow-h .v8-drow-b, #v8 #app .v8-pay-paid .v8-drow-e, #v8 #app .v8-pay-paid .v8-drow-e .v8-pay-v { font-size: var(--v8-fs-20) !important; line-height: var(--v8-lh-20) !important; }
#v8 #app .v8-pay-paid .v8-drow-p { max-width: none; margin: 0 0 var(--v8-5) var(--v8-6); padding: var(--v8-1) 0 var(--v8-1) var(--v8-5); border-radius: var(--v8-r-in); background: var(--v8-gray); }
#v8 #app .v8-pay-paid .v8-drow-p .v8-rows-end { padding-right: calc(40px + var(--v8-5) + var(--v8-1)); font-weight: 400 !important; }
#v8 #app .v8-pay-paid .v8-drow-p > * { margin: 0; }
@media (max-width: 767px) {
  #v8 #app .v8-pay-paid .v8-drow-p { margin-left: var(--v8-4); padding-left: var(--v8-4); }
  #v8 #app .v8-pay-paid .v8-drow-p .v8-rows-end { padding-right: calc(40px + var(--v8-4) - var(--v8-3)); }
}
/* Each invoice its own gray card (20 October 2026, Janne: "each item always should be its own individual gray card ... the strokes
   between the table items look very awkward with the gray card. I would like to take the grayness away"): the month's panel has
   no ground of its own; under the month, indented 32, each invoice is one gray card (radius 12, 16 / 20 in), 8 apart, no
   hairlines; the whole card is its invoice's link and fills with the green wash on hover. Amounts on the months' right edge */
#v8 #app .v8-pay-paid .v8-drow-p { padding: 0; border-radius: 0; background: none; }
#v8 #app .v8-pay-paid .v8-drow-p .v8-rows.v8-rows-w { display: grid; gap: var(--v8-2); border: 0; }
#v8 #app .v8-pay-paid .v8-drow-p .v8-rows-w > li { position: relative; padding: var(--v8-4) var(--v8-5); border: 0 !important; border-radius: var(--v8-r-in); background: var(--v8-gray); }
#v8 #app .v8-pay-paid .v8-drow-p .v8-rows-w > li::before { content: none !important; }
#v8 #app .v8-pay-paid .v8-drow-p .v8-rows-l::after { content: ""; position: absolute; inset: 0; border-radius: var(--v8-r-in); }
@media (hover: hover) { #v8 #app .v8-pay-paid .v8-drow-p .v8-rows-w > li:has(.v8-rows-l:hover) { background: var(--v8-hover); } }
#v8 #app .v8-pay-paid .v8-drow-p .v8-rows-end { padding-right: calc(40px + var(--v8-5) - var(--v8-5) + var(--v8-1)); }
