/* Avakode Hub — scene «routepayaudit» (assets/js/scenes/routepayaudit.js): the weekly settlement, the rate card, the dispute
   text (lane 4.3). Loaded by inc/scenes.php on a family page whose stage is this scene. Classes: .rp-* only; the common parts
   (.sc-head, .sc-sample, .sc-panel, .sc-stamp), the stage, the rail and the caption are scene.css.
   Layout: the settlement on the left (its tags are a column of the row, so nothing has to be kept apart by hand), the rate
   card and the dispute text stacked on the right; on a narrow stage one column, the card between the two. */

/* The height of the stage before the module arrives = the height it takes (measured; e2e: ≤ 4px apart at 1440, 768, 390).
   --stage-h: the two-column stage; --stage-h-narrow: a window ≤ 720px (rail on top, one column). From 721px up to ≈ 794px
   the rail is on the left and the stage is already one column (the stage goes one column when its box is ≤ 760px), hence the
   middle value. If the family page changes its padding, re-measure. */
.hub-scene[data-scene="routepayaudit"] { --stage-h: 592px; --stage-h-narrow: 955px; }
@media (min-width: 721px) and (max-width: 794px) {
  .hub-scene[data-scene="routepayaudit"] { --stage-h: 934px; }
}
/* the narrow phones (lane 5.6, measured every pixel with ?static=1, 16.10.2026): below 385px the stage is a little taller */
@media (max-width: 384px) { .hub-scene[data-scene="routepayaudit"] { --stage-h-narrow: 967px; } }
@media (max-width: 334px) { .hub-scene[data-scene="routepayaudit"] { --stage-h-narrow: 961px; } }
@media (max-width: 319px) { .hub-scene[data-scene="routepayaudit"] { --stage-h-narrow: 966px; } }

.rp-board { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 28px; min-height: 506px; }
.rp-settle { min-width: 0; }

/* the same columns in the header and in a row; the last one holds the tag */
.rp-cols,
.rp-row { display: grid; grid-template-columns: 44px 80px 46px 46px 58px 74px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.rp-cols { padding: 0 8px 6px; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rp-cols span:nth-child(n+3) { text-align: right; }
.rp-rows { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.rp-row { position: relative; padding: 9px 8px; border-top: 1px solid var(--line); }
.rp-row > span { position: relative; min-width: 0; }
.rp-row .c1 { color: var(--fg-2); }
.rp-row .c2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rp-row .c3,
.rp-row .c4,
.rp-row .c5,
.rp-row .c6 { text-align: right; font-variant-numeric: tabular-nums; }
.rp-row .c4 { color: var(--fg-2); }
.rp-row > .rp-hot {
  position: absolute; inset: 0; border-left: 2px solid var(--signal); border-radius: 4px;
  background: rgba(124, 92, 252, .16); pointer-events: none;
}
.rp-row > .rp-tag { font-size: 11px; letter-spacing: .04em; white-space: nowrap; color: var(--signal-hot); }
.rp-beam {
  position: absolute; left: 0; right: 0; top: -12px; height: 24px; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(124, 92, 252, .22) 40%, var(--signal) 50%, rgba(124, 92, 252, .22) 60%, transparent);
}
.rp-legend { margin-top: 10px; padding: 0 8px; font-size: 11px; color: var(--muted); }

/* the dispute panel follows the rate card with the gap of the scene; what is left of the height stays below it */
.rp-side { display: flex; flex-direction: column; justify-content: flex-start; gap: 18px; min-width: 0; }
.rp-card { padding: 12px 14px; }
/* the lines of the card, with the beam that reads them (clipped to them) */
.rp-card-lines { position: relative; overflow: hidden; margin: 0 -8px; padding: 0 8px; }
.rp-card-line { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); color: var(--fg-2); }
.rp-card-line > span { position: relative; }
.rp-card-line span:last-child { color: var(--fg); font-variant-numeric: tabular-nums; }
.rp-card-line > .rp-card-hot {
  position: absolute; inset: 0 -8px; border-left: 2px solid var(--signal); border-radius: 4px;
  background: rgba(124, 92, 252, .16); pointer-events: none;
}
.rp-cbeam {
  position: absolute; left: 0; right: 0; top: -12px; height: 24px; opacity: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(124, 92, 252, .22) 40%, var(--signal) 50%, rgba(124, 92, 252, .22) 60%, transparent);
}
.rp-letter { position: relative; padding: 14px 16px 16px; }
.rp-letter-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.rp-letter-line em { font-style: normal; font-size: 10.5px; color: var(--signal-hot); }
.rp-letter-line b { font-weight: 500; font-variant-numeric: tabular-nums; }
.rp-total { display: flex; justify-content: space-between; align-items: baseline; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--signal); }
.rp-total span { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-2); }
.rp-total b { font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--signal-hot); }
.rp-fly {
  position: absolute; left: 0; top: 0; display: flex; gap: 14px; padding: 5px 10px; white-space: nowrap; pointer-events: none;
  border: 1px solid var(--signal); border-radius: 4px; background: #1A1430; color: var(--fg); opacity: 0;
}
.rp-fly b { font-weight: 500; color: var(--signal-hot); }

/* the settlement is narrower than ~560px: the tag no longer fits beside the amount (the longest, «rate below card · $230», is ~155px) — it goes into the flow, a second line of
   its row, at 12px (the type is not made smaller to make room); the number columns then use the whole width of the panel */
@container (max-width: 1230px) {
  .rp-cols,
  .rp-row { grid-template-columns: 48px minmax(0, 1fr) 46px 46px 58px 76px; }
  .rp-row { padding: 7px 8px; }
  .rp-row > .rp-tag { grid-column: 1 / -1; padding-top: 2px; font-size: 12px; white-space: normal; }
}

@container (max-width: 900px) {
  .rp-board { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 22px; }
  .rp-settle,
  .rp-letter,
  .rp-fly { font-size: 12px; }
  .rp-cols,
  .rp-row { grid-template-columns: 42px minmax(0, 1fr) 42px 42px 52px 62px; gap: 6px; }
  .rp-row { padding: 6px 6px; }
  .rp-card { padding: 10px 11px; font-size: 11.5px; }
  .rp-letter-line { grid-template-columns: minmax(0, 1fr) auto; }
  .rp-letter-line em { grid-column: 1 / -1; grid-row: 2; }
}

/* a narrow stage (by its own width, not the window's): one column — the settlement, then the rate card (a block in the flow),
   then the dispute text */
@container (max-width: 760px) {
  .rp-board { grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 0; }
  .rp-cols,
  .rp-row { grid-template-columns: 34px minmax(0, 1fr) 32px 32px 42px 52px; gap: 6px; }
  .rp-side { justify-content: flex-start; gap: 26px; margin-top: 14px; }
  .rp-card { padding: 8px 12px; }
  .rp-card-line { padding: 3px 0; }
  .rp-total b { font-size: 18px; }
}

@container (max-width: 440px) {
  .rp-settle,
  .rp-letter,
  .rp-fly { font-size: 11px; }
  .rp-cols,
  .rp-row { grid-template-columns: 30px minmax(0, 1fr) 30px 30px 40px 46px; gap: 5px; }
  .rp-row { padding: 6px 4px; }
}

/* the narrowest phones (the stage ≤ 300px): «Standard» (53px) did not fit its column (45px) and the ellipsis cut it; the number
   columns and the gaps give up a few px to the type column (63px); the type is not made smaller */
@container (max-width: 300px) {
  .rp-cols,
  .rp-row { grid-template-columns: 28px minmax(0, 1fr) 28px 28px 40px 46px; gap: 3px; }
}
