/* Down payments (2026-10-28, opt-in key vendorDeposits; public/js/vendor-deposits.js). Theme tokens only, light + dark.
   The list rows ride on the Payment Tracker's own row classes (.pt-row.pt-ret), so this file holds only what is new:
   the store group header, the New / Apply / detail modals, the suggest list, and the card on a watch. */

/* ── the group header: one store, its count and what it holds ─────────────────── */
#pay-tab-deposits .pt-list .vd-group { display: flex; align-items: baseline; gap: 12px; padding: 16px 20px 8px; border-top: 1px solid var(--border); background: var(--bg-void, transparent); }
#pay-tab-deposits .pt-list .vd-group:first-child { border-top: 0; }
.vd-group .vd-g-name { flex: 1 1 auto; min-width: 0; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-group button.vd-g-name { background: none; border: 0; padding: 0; min-height: 0; text-align: left; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; }
.vd-group button.vd-g-name:hover { color: var(--gold); }
.vd-group .vd-g-meta { flex: 0 1 auto; font-size: 12px; color: var(--off-white); white-space: nowrap; }
.vd-group .vd-g-amt { flex: 0 0 auto; font-size: 14px; font-weight: 700; color: var(--white); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  #pay-tab-deposits .pt-list .vd-group { padding: 14px 16px 6px; flex-wrap: wrap; row-gap: 2px; }
  .vd-group .vd-g-meta { order: 3; flex: 1 0 100%; }
}
.vd-fu { color: var(--off-white); white-space: nowrap; }
.vd-fu.is-due { color: var(--red); font-weight: 600; }
#pay-tab-deposits .pt-row.pt-dep .pt-c-memo { text-align: center; justify-content: center; }
#pay-tab-deposits .pt-thead.pt-dep .pt-h-memo { text-align: center; }

/* ── modals ───────────────────────────────────────────────────────────────────── */
.vd-modal { width: min(560px, 94vw); max-width: 560px; max-height: 92vh; overflow-y: auto; }
.vd-modal.vd-wide { width: min(880px, 94vw); max-width: 880px; }
.vd-modal.vd-narrow { width: min(560px, 94vw); }
.vd-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.vd-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--off-white); margin-bottom: 4px; }
.vd-modal .modal-title { font-size: 24px; margin-bottom: 4px; }
.vd-modal .modal-sub { margin-bottom: 0; }
.vd-x { flex: 0 0 44px; width: 44px; height: 44px; min-height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--bg-panel); color: var(--off-white); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.vd-x:hover { color: var(--white); }
.vd-body { display: grid; gap: 14px; }
.vd-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.vd-col { display: grid; gap: 14px; align-content: start; min-width: 0; }
.vd-sec { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--off-white); }
.vd-f { margin-bottom: 0; position: relative; min-width: 0; }
.vd-f > label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--off-white); }
.vd-modal input[type="text"], .vd-modal input[type="date"], .vd-modal input[type="search"], .vd-modal textarea { width: 100%; min-height: 44px; box-sizing: border-box; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-void, var(--bg-raised)); color: var(--white); padding: 10px 14px; font: inherit; }
.vd-modal textarea { resize: vertical; min-height: 64px; }
.vd-modal input:focus, .vd-modal textarea:focus { outline: none; border-color: var(--gold); }
.vd-modal .input-group.ap-row-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin: 0; }
.vd-seg { width: 100%; }
.vd-seg .inv-kind-tab { flex: 1 1 0; justify-content: center; min-height: 40px; padding: 8px 6px; }
.vd-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--border); }
.vd-actions-wrap { flex-wrap: wrap; justify-content: flex-start; }
.vd-actions .btn { min-height: 44px; }
/* F2 (2026-10-29): the primary button was half cut at 1440x900 (the modal scrolls). The action row sticks to the modal's bottom edge. */
/* the shadow paints the panel colour over the modal's bottom padding too, so nothing scrolls into view under the buttons */
.vd-modal > .vd-body > .vd-actions:last-child { position: sticky; bottom: 0; z-index: 3; padding-bottom: 4px; background: var(--bg-panel); box-shadow: 0 48px 0 0 var(--bg-panel); }
.vd-danger { color: var(--red); }
.vd-hint { margin: 0; font-size: 13px; color: var(--off-white); line-height: 1.45; }
.vd-none { padding: 14px; border: 1px dashed var(--border); border-radius: 12px; color: var(--off-white); font-size: 13px; }
.vd-sum { margin: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.vd-sum .lf-sum-t { padding: 12px 14px; }
.vd-sum .lf-sum-v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vd-sum .lf-sum-l { font-size: 11px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; }

/* ── suggest list (never a native select) ─────────────────────────────────────── */
.vd-sug { position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px; z-index: 30; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.18); max-height: 260px; overflow-y: auto; padding: 4px; }
.vd-sug[hidden] { display: none; }
.vd-sug-i { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; min-height: 44px; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--white); text-align: left; font: inherit; cursor: pointer; }
.vd-sug-i:hover, .vd-sug-i:focus { background: var(--bg-raised); }
.vd-sug-i span { font-size: 12px; color: var(--off-white); }

/* ── the watch picker / deposit picker ────────────────────────────────────────── */
/* F1 (2026-10-29): a flex column whose rows never shrink. As a grid with max-height the 12 rows were squeezed to 44px while they need ~58,
   so the ref / seller line was drawn over the Cost / paid line. Each row is as tall as its text (at least 44px); the list scrolls. */
.vd-picks { display: flex; flex-direction: column; gap: 8px; max-height: min(300px, 40vh); overflow-y: auto; overscroll-behavior: contain; }
.vd-picks > * { flex: 0 0 auto; }
.vd-pick { display: grid !important; grid-auto-flow: row; align-items: start !important; justify-content: stretch !important; gap: 2px; width: 100%; text-align: left; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-void, var(--bg-raised)); color: var(--white); font: inherit; cursor: pointer; min-height: 44px; height: auto !important; max-height: none !important; flex: 0 0 auto; }
.vd-pick:hover { border-color: var(--gold); }
.vd-pick.is-sel { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; background: color-mix(in srgb, var(--gold) 8%, var(--bg-void, var(--bg-raised))); }
.vd-pick-t { display: flex; width: 100%; justify-content: space-between; gap: 10px; align-items: baseline; }
.vd-pick-t b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.vd-pick-t i { font-style: normal; font-size: 12px; color: var(--off-white); white-space: nowrap; font-variant-numeric: tabular-nums; }
.vd-pick-m, .vd-pick-n { font-size: 12.5px; color: var(--off-white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── the detail hub ───────────────────────────────────────────────────────────── */
.vd-kv { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.vd-kv span { color: var(--off-white); }
.vd-kv b { font-weight: 600; text-align: right; overflow-wrap: anywhere; min-width: 0; }
.vd-kv a { color: var(--gold); }
.vd-move { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.vd-move.is-undone { opacity: .55; }
.vd-move-t { display: grid; gap: 2px; min-width: 0; }
.vd-move-t b { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.vd-move-t i { font-style: normal; font-size: 12px; color: var(--off-white); }
.vd-move-a { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── the card on a watch ──────────────────────────────────────────────────────── */
.vd-watch:empty { display: none; }
.vd-watch { margin: 14px 0 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-panel); display: grid; gap: 10px; }
.vd-w-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.vd-w-title { font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase; color: var(--off-white); }
.vd-w-sum { font-size: 13px; font-weight: 700; color: var(--green); white-space: nowrap; }
.vd-w-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; }
.vd-w-t { display: grid; gap: 1px; min-width: 0; }
.vd-w-t b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vd-w-t i { font-style: normal; font-size: 12px; color: var(--off-white); }
.vd-w-a { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vd-w-none { font-size: 13px; color: var(--off-white); }
.vd-w-apply { justify-self: start; min-height: 44px; }
.vd-watch .btn { min-height: 44px; }

@media (max-width: 720px) {
  .vd-cols { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .vd-modal { width: 100%; max-width: 100%; max-height: 94vh; border-radius: 20px 20px 0 0; }
  .vd-overlay { align-items: flex-end; }
  .vd-sum { gap: 8px; }
  .vd-sum .lf-sum-t { padding: 10px 10px; gap: 6px; }
  .vd-sum .lf-sum-v { font-size: 15px; }
  .vd-actions { position: sticky; bottom: 0; background: var(--bg-panel); padding-bottom: 8px; }
  .vd-actions .btn { flex: 1 1 auto; }
}

/* KPI law (Hal 10-28, 390 phone): the money figure is shown in FULL and wraps if it must; never an ellipsis. The card height is its content. */
html body #dep-kpis .pay-kpi { height: auto !important; min-height: 0; }
html body #dep-kpis .pay-kpi-value, html body #dep-kpis .wf-kpi-thin-v { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere; height: auto !important; line-height: 1.3 !important; }
html body #dep-kpis .pay-kpi-label, html body #dep-kpis .pay-kpi-sub, html body #dep-kpis .pay-kpi-footer { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere; }

/* The five-tab switch on a phone: the standard .inv-kind-switch pattern, one row of chips that scrolls sideways (never stacked). */
@media (max-width: 768px) {
  #page-payments #pay-switch { width: 100%; flex-wrap: nowrap; flex-direction: row; overflow-x: auto; overflow-y: hidden; border-radius: 999px; scroll-snap-type: x proximity; }
  #page-payments #pay-switch .inv-kind-tab { flex: 0 0 auto; padding: 10px 16px; scroll-snap-align: center; }
}

/* Runner Money page: the down-payments card keeps the page's 16px gap to the next card, and its rows breathe (24/12/16/8 rhythm). */
#runner-money-deposits-card { margin-bottom: 16px; }
#runner-money-deposits .vd-w-row { padding: 12px 0; }
#runner-money-deposits .vd-w-t b { white-space: normal; overflow: visible; text-overflow: clip; }
#runner-money-deposits .vd-w-row + .vd-w-row { border-top: 1px solid var(--border); }
