/*
 * Payments.
 *
 * 🟢 SOURCE CARD — `payments-r1.html`
 *    (`@dsCard group="Pages · lists & results" name="🟢 Payments"`).
 *    Table selectors here follow §1 of THAT card.
 *
 * 🔴 BF-492 — the table half of this file was originally written against
 *    `payments-packing-slips-r1.html`, which is in the
 *    "Archive · from YNET+ Design System" group. Its name still contains the
 *    word "(RATIFIED)" from when it was; the `group` is the status, not the
 *    name. The PANEL block further down is unaffected and untouched — it
 *    matches `payment-panel.html` (BF-497).
 *
 * Selectors + values are copied verbatim from the ratified card's <style>
 * block wherever the card draws the element. `client-table.css` already
 * owns the LIST canon (page-head-row, chip-bar, table, pagination, phone
 * row-cards) and `invoices.css` already owns the shared money-status hues
 * (`:root` block: --paid-*, --overdue-*, --open-*, --partial-*) — this file
 * owns only what is NEW on this page: payment-specific table cells
 * (`.cell-ref`, `.cell-applied`, `.applied-wrap`), the `.cp-tag` partial-
 * allocation chip, and the record-detail slide-over PANEL canon
 * (payments-packing-slips-r1.html §2 "record-detail canon, Direction A —
 * read-only") — the FIRST page in this app to need that panel language;
 * every page after this one that needs a read-only slide-over inherits it
 * from here rather than re-authoring it (same "extract once" discipline
 * `client-table.js` documents for the LIST canon).
 */

/* ================= payment-specific table cells ===========================
   `.cell-date` / `.cell-amt` are already generic (top-level, not scoped) in
   invoices.css — reused unchanged here. `.cell-ref` is new (the card draws it
   only on this page's table).

   BF-492 removed `.cell-applied` and `.applied-wrap`: both existed only to
   style the archived card's left-aligned "Applied to" cell, which the ratified
   `payments-r1.html` does not draw. Their only consumers were in payments.js
   and both are gone. */
.cell-ref { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13.5px; color: var(--ink); }

/* The card's zero-money idiom is `<td class="right cell-amt zero">&mdash;</td>`
   — `.cell-amt.zero` (0,2,0) outranks `table.client-table tbody td` (0,1,3)
   because class count is compared before element count, so the em-dash renders
   --faint. `createClientTable` takes one STATIC `cellClass` per column
   (client-table.js:235) while the card varies this <td> per row, so the
   modifier rides on an inner <span> here. It declares the money face itself
   rather than inheriting it, because the two columns that use it sit on
   different <td> shapes: `Applied`'s <td> carries `.cell-amt` (mono/700) but
   `Unallocated`'s is a bare `<td class="right">` — the card's own partial-row
   shape, kept so the `.cp-tag` chip inherits the table's sans-serif face.
   `font-size` is left to inherit: the <td> rule pins 13px in both columns,
   which is what the card actually renders. Measured equal to the card's zero
   cell: rgb(156,163,175), ui-monospace, 700, 13px. */
.cell-amt-zero { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; color: var(--faint); }

/* ================= .cp-tag — compact allocation-status chip ===============
   Card's own annotation: "Adapted from the admin table canon's compact-pill
   convention; scoped here to the 'partially unallocated' signal only, using
   the LOCKED partial hue (never a new color)." Reuses --partial-bg/--partial-
   ink, already defined in invoices.css's :root (loaded before this file). */
.cp-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 8px; border-radius: var(--r-full); background: var(--partial-bg); color: var(--partial-ink); white-space: nowrap; }
.cp-tag .icon { width: 10px; height: 10px; stroke: var(--partial-ink); }

/* ================= record-detail slide-over PANEL (§2, Direction A) =======
   Read-only by construction: no edit-field, no Save/Cancel, no destructive
   action anywhere in this markup — the money-is-immutable rule made literal,
   not just enforced by omission in the JS. */
.panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 40; opacity: 0; pointer-events: none; transition: opacity var(--dur-2) var(--ease); }
.panel-backdrop.open { opacity: 1; pointer-events: auto; }

.panel-shell { position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 100vw;
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: var(--shadow-pop);
  z-index: 50; display: flex; flex-direction: column; transform: translateX(100%);
  transition: transform var(--dur-2) var(--ease); }
.panel-shell.open { transform: translateX(0); }

.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); flex-shrink: 0; }
.panel-head-l { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-title { font-size: 16px; font-weight: 800; color: var(--navy); font-family: var(--mono); }
/* A <button> (needed for real keyboard/click a11y — the card's own markup
   draws a plain <div> for this demo) pulls in Chromium's UA button defaults
   (font-size, color, padding, font-family, appearance) that a <div> never
   had — invisible on screen, caught only by the mandatory pixel self-check
   measuring a 13.33px/black-text button instead of the card's 16px/
   ink-colored icon-only circle. Neutralized explicitly below. */
.panel-close { width: 36px; height: 36px; min-width: 44px; min-height: 44px; margin: -4px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--field); border: none; padding: 0; cursor: pointer; flex-shrink: 0; font: inherit; color: inherit; appearance: none; -webkit-appearance: none; }
.panel-close svg { width: 14px; height: 14px; stroke: var(--muted); }
.panel-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.panel-strip { display: flex; gap: 24px; padding: 14px 20px; border-bottom: 1px solid var(--line-soft); background: var(--field); flex-shrink: 0; flex-wrap: wrap; }
.panel-strip .ps-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); display: block; margin-bottom: 2px; }
.panel-strip .ps-val { font-family: var(--mono); font-variant-numeric: tabular-nums; font-weight: 700; font-size: 14px; color: var(--ink); }

.panel-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 22px; flex: 1; overflow-y: auto; }
.panel-sec h5 { margin: 0 0 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ro-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 13px; color: var(--ink-soft); border-bottom: 1px solid var(--line-soft); }
.ro-row:last-child { border-bottom: none; }
.ro-row .v { font-weight: 600; color: var(--ink); font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.ro-row.credit .v { color: var(--partial-ink); }
.ro-row.credit span:first-child { color: var(--partial-ink); font-weight: 600; }

.panel-note { padding: 16px 20px; border-top: 1px solid var(--line); background: var(--field); text-align: center; flex-shrink: 0; }
.panel-note p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.panel-note b { color: var(--ink-soft); }

/* ================= states (this page reuses client-table.css's generic
   skel-row/skel/empty-state-mini/es-* primitives — no page-specific states
   container needed beyond what createClientTable already renders) ======== */

/* ================= phone reflow (~480px, matches client-table.css's own
   breakpoint): the panel is promoted to a full-screen sheet, per the card's
   §7 note ("Row tap still opens the same slide-over panel, promoted to a
   full-screen sheet — per the record-detail canon's phone provision."). === */
@media (max-width: 480px) {
  .panel-shell { width: 100vw; border-left: none; }
  .panel-strip { gap: 16px; }
}
