/* ============================================================================
   Barmaso — Wholesale › Rebate
   ----------------------------------------------------------------------------
   Written as a finance tool is: neutral surfaces, one accent, numbers in
   aligned columns, colour only where it means something — green for money
   paid back, amber for something to look at, red for a return. Tables on a
   desk, labelled cards on a phone. The file cards are Shop To Shop's
   (s2s.css); everything else is here.
   ============================================================================ */

.rb { display: grid; gap: 20px; padding-bottom: 40px; min-width: 0; }

/* --- page header --------------------------------------------------------------- */

.rb-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 24px; }
.rb-head-text { min-width: 0; flex: 1 1 420px; }
.rb-title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 600; letter-spacing: -0.01em; color: var(--pt-ink); }
.rb-lede { margin: 6px 0 0; max-width: 72ch; font-size: 13.5px; line-height: 1.6; color: var(--pt-slate); }
.rb-head-action { display: inline-flex; align-items: center; gap: 8px; }

/* What the result runs on, read across in one line. */
.rb-context { display: flex; flex-wrap: wrap; align-items: stretch; margin: 0; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; }
.rb-context-item { display: grid; gap: 2px; padding: 10px 16px; border-right: 1px solid var(--pt-line-soft); min-width: 0; }
.rb-context-item dt { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--pt-muted); }
.rb-context-item dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--pt-ink); font-variant-numeric: tabular-nums; }
.rb-context-item.is-warn dd { color: #b45309; }
.rb-context-link { align-self: center; margin-left: auto; padding: 0 16px; font-size: 13px; font-weight: 600; color: var(--pt-green-700); white-space: nowrap; }

.reb-files { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reb-file-do { grid-area: do; display: flex; flex-wrap: wrap; gap: 8px; }

/* --- notes, status, keeping ------------------------------------------------------ */

.rb-notes { display: grid; gap: 8px; }
.rb-note { margin: 0; padding: 10px 14px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #78350f; font-size: 13px; line-height: 1.55; }
.rb-note.is-bad { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.rb-note-list summary { cursor: pointer; font-weight: 600; }
.rb-note-list ul { margin: 8px 0 0; padding-left: 20px; max-height: 220px; overflow: auto; font-size: 12.5px; }
.rb-status-line:empty { display: none; }
.rb-status-line { margin: 0; padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; }
.rb-status-line.is-ok { background: var(--pt-green-50); color: var(--pt-green-700); }
.rb-status-line.is-bad { background: #fef2f2; color: #991b1b; }

.rb-keeps { display: grid; gap: 8px; }
.rb-keeps:empty { display: none; }
.rb-keeps > div:empty { display: none; }
.rb-keep {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 14px;
  border: 1px solid var(--pt-line); border-left-width: 3px; border-radius: 10px; background: #fff;
}
.rb-keep.is-ok { border-left-color: var(--pt-green-600); }
.rb-keep.is-warn { border-left-color: #d97706; }
.rb-keep.is-bad { border-left-color: #dc2626; }
.rb-keep.is-info { border-left-color: #2563eb; }
.rb-keep-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--pt-line-soft); color: var(--pt-slate); flex: none; }
.rb-keep.is-ok .rb-keep-icon { background: var(--pt-green-50); color: var(--pt-green-700); }
.rb-keep.is-warn .rb-keep-icon { background: #fffbeb; color: #b45309; }
.rb-keep.is-bad .rb-keep-icon { background: #fef2f2; color: #b91c1c; }
.rb-keep.is-info .rb-keep-icon { background: #eff6ff; color: #1d4ed8; }
.rb-keep-text { display: grid; gap: 2px; flex: 1 1 320px; min-width: 0; }
.rb-keep-text b { font-size: 13.5px; font-weight: 600; color: var(--pt-ink); }
.rb-keep-text span { font-size: 12.5px; line-height: 1.55; color: var(--pt-slate); }
.rb-keep-do { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.rb-month-input { width: auto; min-height: 36px; }

.rb-blank { display: grid; justify-items: center; gap: 6px; padding: 48px 16px; border: 1px dashed #cbd5e1; border-radius: 14px; background: #fff; text-align: center; }
.rb-blank-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--pt-line-soft); color: var(--pt-slate); }
.rb-blank-title { margin: 6px 0 0; font-size: 15px; font-weight: 600; color: var(--pt-ink); }
.rb-blank-sub { margin: 0; max-width: 540px; font-size: 13px; line-height: 1.6; color: var(--pt-slate); }
.rb-empty { padding: 32px 16px; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; text-align: center; font-size: 13.5px; color: var(--pt-slate); }

/* --- the figures ------------------------------------------------------------------- */

.rb-result { display: grid; gap: 16px; }
.rb-summary {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) minmax(0, 1fr); align-items: stretch;
  border: 1px solid var(--pt-line); border-radius: 14px; background: #fff;
}
.rb-summary > div { padding: 18px 20px; min-width: 0; }
.rb-summary > div + div { border-left: 1px solid var(--pt-line-soft); }
.rb-summary-lead { display: grid; align-content: start; gap: 4px; }
.rb-summary-value { font-family: var(--font-display); font-size: 30px; font-weight: 600; line-height: 1.15; letter-spacing: -0.01em; color: var(--pt-ink); font-variant-numeric: tabular-nums; }
.rb-summary-paid { display: grid; align-content: start; gap: 10px; }
.rb-summary-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rb-summary-counts { display: grid; align-content: start; gap: 6px; }
.rb-count { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--pt-slate); }
.rb-count b { font-weight: 600; color: var(--pt-ink); font-variant-numeric: tabular-nums; }
.rb-figure { display: grid; gap: 2px; min-width: 0; }
.rb-figure-label { font-size: 12px; font-weight: 500; color: var(--pt-muted); }
.rb-figure-value { font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--pt-ink); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rb-figure-sub { font-size: 12px; color: var(--pt-muted); }
.rb-figure.is-rebate .rb-figure-value { color: var(--pt-green-700); }
.rb-figure.is-left .rb-figure-value { color: #b45309; }
.rb-bar { display: block; height: 6px; border-radius: 999px; background: var(--pt-line-soft); overflow: hidden; }
.rb-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--pt-green-600); transition: width 0.3s ease; }
.rb-bar.is-thin { height: 4px; }

/* --- toolbar, tabs, filters ----------------------------------------------------------- */

.rb-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.rb-search { flex: 1 1 280px; min-width: 0; }
.rb-toolbar .ucx-menu-btn { display: inline-flex; align-items: center; gap: 6px; }

.rb-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--pt-line); overflow-x: auto; scrollbar-width: none; }
.rb-tabs::-webkit-scrollbar { display: none; }
.rb-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 12px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: none; font: inherit; font-size: 13.5px; font-weight: 500;
  color: var(--pt-slate); white-space: nowrap; cursor: pointer;
}
.rb-tab:hover { color: var(--pt-ink); }
.rb-tab b { padding: 1px 8px; border-radius: 999px; background: var(--pt-line-soft); font-size: 12px; font-weight: 600; color: var(--pt-slate); font-variant-numeric: tabular-nums; }
.rb-tab.is-on { border-bottom-color: var(--pt-ink); color: var(--pt-ink); font-weight: 600; }
.rb-tab.is-on b { background: var(--pt-ink); color: #fff; }

.rb-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.rb-filters:empty { display: none; }
.rb-seg { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border: 1px solid var(--pt-line); border-radius: 10px; background: var(--pt-line-soft); }
.rb-seg-btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 4px 12px; border: 0; border-radius: 7px;
  background: none; font: inherit; font-size: 13px; font-weight: 500; color: var(--pt-slate); cursor: pointer;
}
.rb-seg-btn span { font-size: 12px; color: var(--pt-muted); font-variant-numeric: tabular-nums; }
.rb-seg-btn.is-on { background: #fff; color: var(--pt-ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.1); }
.rb-pick-all { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--pt-slate); cursor: pointer; }
.rb-hint { font-size: 12.5px; color: var(--pt-muted); }
.rb-check { width: 18px; height: 18px; accent-color: var(--pt-ink); cursor: pointer; }

/* --- tables --------------------------------------------------------------------------- */

.rb-table-wrap { overflow-x: auto; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; }
.rb-table { width: 100%; border-collapse: collapse; font-size: 13.5px; color: var(--pt-ink); }
.rb-table th {
  padding: 10px 14px; border-bottom: 1px solid var(--pt-line); background: #f8fafc;
  font-size: 12px; font-weight: 600; color: var(--pt-muted); text-align: left; white-space: nowrap;
}
.rb-table td { padding: 12px 14px; border-bottom: 1px solid var(--pt-line-soft); vertical-align: middle; }
.rb-table tbody tr:last-child td { border-bottom: 0; }
.rb-table .rb-n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rb-strong { font-weight: 600; }
.rb-muted { color: var(--pt-muted); }
.rb-left { color: #b45309; }
.rb-rebate { font-weight: 600; color: var(--pt-green-700); }
.rb-row { transition: background 0.12s ease; }
.rb-row:hover td { background: #f8fafc; }
.rb-row:focus-visible { outline: 2px solid var(--pt-ink); outline-offset: -2px; }
.rb-row.is-picked td { background: #f1f5f9; }
.rb-records .rb-row, .rb-shops .rb-row { cursor: pointer; }
.rb-c-pick { width: 40px; padding-right: 0 !important; }
.rb-c-name { min-width: 220px; }
.rb-name { display: block; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.rb-subline { display: block; margin-top: 2px; font-size: 12px; color: var(--pt-muted); }
.rb-c-basis small, .rb-c-why small { display: block; margin-top: 2px; font-size: 12px; color: var(--pt-muted); }
.rb-basis { font-weight: 500; white-space: nowrap; }
.rb-c-why { min-width: 240px; color: var(--pt-slate); font-size: 13px; }
.rb-c-status { white-space: nowrap; }
.rb-c-more { width: 44px; text-align: right; }
.rb-c-progress { min-width: 160px; }
.rb-c-progress small { display: block; margin-top: 4px; font-size: 12px; color: var(--pt-muted); }

.rb-status { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.rb-status.is-paid { background: var(--pt-green-50); color: var(--pt-green-700); }
.rb-status.is-open { background: var(--pt-line-soft); color: var(--pt-slate); }
.rb-status.is-changed { background: #fffbeb; color: #92400e; }
.rb-paid { display: grid; gap: 2px; justify-items: start; }
.rb-paid small { font-size: 12px; color: var(--pt-muted); }
.rb-paid-undo { min-height: 28px; padding: 2px 0; font-size: 12px; }
.rb-paid-undo:hover { color: #b91c1c; }
.rb-pay { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.rb-link { padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--pt-slate); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.rb-link:hover { color: #b91c1c; }
.rb-more { display: block; margin: 12px auto 0; }
.rb-list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }

/* The invoice lines. */
.rb-lines td { padding: 9px 12px; font-size: 13px; vertical-align: top; }
.rb-mono { font-family: var(--font-mono); font-size: 12px; }
.rb-lines .rb-c-ref { white-space: nowrap; }
.rb-c-date { white-space: nowrap; color: var(--pt-slate); font-variant-numeric: tabular-nums; }
.rb-c-shop span { display: block; font-weight: 500; }
.rb-c-shop small { display: block; font-size: 12px; color: var(--pt-muted); }
.rb-words { display: block; font-size: 12px; color: #6d28d9; font-weight: 600; }
.rb-c-remark { min-width: 150px; color: var(--pt-slate); }
.rb-tag { display: inline-block; margin-left: 6px; padding: 0 7px; border: 1px solid currentColor; border-radius: 5px; font-size: 12px; font-weight: 600; vertical-align: 1px; }
.rb-lines tr.is-return td { color: #b91c1c; }
.rb-lines tr.is-promo td { color: var(--pt-muted); }
.rb-lines tr.is-promo .rb-strong { text-decoration: line-through; }
.rb-lines tfoot td { border-top: 1px solid var(--pt-line); border-bottom: 0; background: #f8fafc; font-weight: 600; }

/* The selection's bar stays in sight while the list scrolls under it. */
.rb-tray-slot { position: sticky; bottom: 12px; z-index: 5; }
.rb-tray {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 10px 12px 10px 18px;
  border-radius: 12px; background: var(--pt-ink); color: #fff; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.25);
}
.rb-tray-text { display: grid; gap: 1px; flex: 1 1 180px; }
.rb-tray-text b { font-size: 13.5px; font-weight: 600; }
.rb-tray-text span { font-family: var(--font-display); font-size: 16px; font-variant-numeric: tabular-nums; opacity: 0.85; }
.rb-tray-clear { background: transparent; border-color: rgba(255, 255, 255, 0.3); color: #fff; }
.rb-tray-go { display: inline-flex; align-items: center; gap: 6px; background: #fff; border-color: #fff; color: var(--pt-ink); font-weight: 600; }

/* --- the detail box ----------------------------------------------------------------------- */

.rb-detail { display: grid; gap: 16px; }
.rb-figures, .rb-months-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border: 1px solid var(--pt-line); border-radius: 12px; }
.rb-figures .rb-figure, .rb-months-row .rb-figure { padding: 12px 16px; }
.rb-figures .rb-figure + .rb-figure, .rb-months-row .rb-figure + .rb-figure { border-left: 1px solid var(--pt-line-soft); }
.rb-why { padding: 10px 14px; border: 1px solid #fde68a; border-radius: 10px; background: #fffbeb; color: #78350f; font-size: 13px; line-height: 1.55; }
.rb-why p { margin: 0; }
.rb-detail-pay { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 1px solid var(--pt-line); border-radius: 10px; }
.rb-detail-pay.is-paid { border-color: #bbf7d0; background: #f7fdf9; }
.rb-shops { margin: 0; font-size: 12.5px; line-height: 1.6; color: var(--pt-slate); }
.rb-shop-block { display: grid; gap: 10px; }
@media (min-width: 721px) { dialog.ucx-sheet.is-wide.rb-box { width: min(1080px, calc(100vw - 32px)); } }
.rb-shop-wrap { max-height: 280px; overflow: auto; }
.rb-shop-table td { padding: 9px 14px; }
.rb-shop-table thead th { position: sticky; top: 0; z-index: 1; }
.rb-row.is-pickable { cursor: pointer; }
.rb-sub-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; margin-bottom: -6px; }
.rb-sub-row .rb-sub { margin: 4px 0 0; }
.rb-sub { margin: 4px 0 -6px; font-size: 13px; font-weight: 600; color: var(--pt-ink); }
.rb-detail-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.rb-detail-foot .btn { display: inline-flex; align-items: center; gap: 6px; }
.rb-grow { flex: 1 1 auto; }
.rb-print-frame { position: fixed; right: 0; bottom: 0; width: 0; height: 0; border: 0; visibility: hidden; }

/* --- History ---------------------------------------------------------------------------- */

.rb-range { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; padding: 14px 16px; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; }
.rb-range:empty { display: none; }
.rb-range-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.rb-range-field { display: grid; gap: 4px; font-size: 12px; font-weight: 600; color: var(--pt-muted); }
.rb-range-field .field-input { min-height: 38px; width: 170px; }
.rb-range-dash { padding-bottom: 9px; color: var(--pt-muted); }
.rb-month { display: grid; gap: 16px; scroll-margin-top: 80px; }
.rb-month:empty { display: none; }
.rb-month-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; padding-top: 18px; border-top: 1px solid var(--pt-line); }
.rb-month-title { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 600; color: var(--pt-ink); }
.rb-month-meta { margin: 4px 0 0; font-size: 12.5px; line-height: 1.55; color: var(--pt-slate); overflow-wrap: anywhere; }
.rb-month-head .btn { display: inline-flex; align-items: center; gap: 6px; }

/* --- Setting ------------------------------------------------------------------------------ */

.reb { display: grid; gap: 16px; padding-bottom: 32px; }
.reb-tiers { display: grid; gap: 10px; }
.reb-tier { display: grid; grid-template-columns: 80px minmax(0, 1fr) minmax(0, 180px); align-items: end; gap: 12px; }
.reb-tier-name { padding-bottom: 12px; font-weight: 600; color: var(--pt-ink); }
.reb-words-pick { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.reb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.reb-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 6px 4px 14px;
  border: 1px solid var(--pt-line); border-radius: 999px; background: var(--pt-line-soft); font-size: 13px; font-weight: 600; color: var(--pt-ink);
}
.reb-chip small { font-size: 12px; font-weight: 500; color: var(--pt-muted); }
.reb-chip button { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 999px; background: #fff; color: var(--pt-slate); cursor: pointer; }
.reb-chip button:hover { color: #b91c1c; }
.reb-alone-do { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.reb-alone-do select { flex: 1 1 260px; max-width: 420px; }
.reb .s2s-actions .btn { display: inline-flex; align-items: center; gap: 6px; }
.reb-table-wrap { overflow-x: auto; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; }
.reb-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.reb-table th, .reb-table td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--pt-line-soft); }
.reb-table thead th { background: #f8fafc; font-size: 12px; font-weight: 600; color: var(--pt-muted); white-space: nowrap; }
.reb-table .reb-c-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.reb-c-ref b { font-weight: 600; }
.reb-c-no { color: var(--pt-muted); }
.reb-c-read { white-space: nowrap; font-weight: 600; color: var(--pt-green-700); font-variant-numeric: tabular-nums; }
.reb-vip tr.is-bad td { background: #fef2f2; }
.reb-vip tr.is-bad .reb-c-read { color: #b91c1c; }
.reb-badge { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.reb-badge.is-contract { background: #eff6ff; color: #1d4ed8; }
.reb-badge.is-tier { background: var(--pt-line-soft); color: var(--pt-slate); }

/* --- narrower ------------------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .rb-summary { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rb-summary-counts { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-left: 0 !important; border-top: 1px solid var(--pt-line-soft); }
  .rb-count { flex-direction: column; gap: 0; }
}

@media (max-width: 720px) {
  .rb { gap: 16px; }
  .rb-title { font-size: 20px; }
  .rb-head-action { width: 100%; justify-content: center; min-height: 46px; }
  .rb-context { display: grid; grid-template-columns: minmax(0, 1fr); }
  .rb-context-item { border-right: 0; border-bottom: 1px solid var(--pt-line-soft); }
  .rb-context-link { margin: 0; padding: 10px 16px; }
  .reb-files { grid-template-columns: minmax(0, 1fr); }
  .rb-keep-do { width: 100%; }
  .rb-keep-do .btn, .rb-month-input { flex: 1 1 auto; justify-content: center; min-height: 42px; }

  .rb-summary { grid-template-columns: minmax(0, 1fr); }
  .rb-summary > div + div { border-left: 0; border-top: 1px solid var(--pt-line-soft); }
  .rb-summary > div { padding: 14px 16px; }
  .rb-summary-value { font-size: 26px; }
  .rb-summary-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rb-toolbar .ucx-menu-btn { flex: 1 1 100%; justify-content: center; min-height: 42px; }
  .rb-filters { display: grid; grid-template-columns: minmax(0, 1fr); }
  .rb-seg { display: flex; }
  .rb-seg-btn { flex: 1 1 0; justify-content: center; min-height: 36px; }

  /* Rows as cards: the name across the top, then labelled figures. */
  .rb-table-wrap { overflow: visible; border: 0; background: none; }
  .rb-table, .rb-table tbody, .rb-table tfoot { display: block; }
  .rb-table thead { display: none; }
  .rb-table tr {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; align-items: start;
    margin-bottom: 8px; padding: 14px; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff;
  }
  .rb-table td { display: block; padding: 0; border: 0; min-width: 0; background: none !important; }
  .rb-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font-size: 12px; font-weight: 600; color: var(--pt-muted); text-align: left; }
  .rb-table .rb-n { text-align: left; white-space: normal; }
  .rb-c-name, .rb-c-why, .rb-c-progress, .rb-c-shop, .rb-c-ref, .rb-c-remark { grid-column: 1 / -1; min-width: 0; }
  .rb-table tr.is-picked { border-color: var(--pt-ink); }
  /* A reached shop: [pick] name ⋯ / basis / amount | rebate / paid. The
     first column holds the checkbox, and is nothing when there is none. */
  .rb-groups tr { grid-template-columns: auto minmax(0, 1fr) minmax(0, 1fr) auto; column-gap: 12px; }
  .rb-groups .rb-c-pick { grid-column: 1; grid-row: 1; width: auto; padding: 2px 0 0 !important; }
  .rb-groups .rb-c-name { grid-column: 2 / 4; grid-row: 1; }
  .rb-groups .rb-c-more { grid-column: 4; grid-row: 1; justify-self: end; width: auto; }
  .rb-groups .rb-c-basis, .rb-groups .rb-c-why { grid-column: 2 / 5; }
  .rb-groups .rb-n { grid-column: 2; }
  .rb-groups .rb-n + .rb-n { grid-column: 3 / 5; text-align: right; }
  .rb-groups .rb-n + .rb-n::before { text-align: right; }
  /* A 3-month contract: name ⋯ / contract / its months side by side. */
  .rb-groups.is-three tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rb-groups.is-three .rb-c-name { grid-column: 1 / 3; }
  .rb-groups.is-three .rb-c-more { grid-column: 3; }
  .rb-groups.is-three .rb-c-basis { grid-column: 1 / -1; }
  .rb-groups.is-three .rb-n, .rb-groups.is-three .rb-n + .rb-n { grid-column: auto; text-align: left; }
  .rb-groups.is-three .rb-n + .rb-n::before { text-align: left; }
  .rb-groups .rb-c-status { grid-column: 1 / -1; }
  .rb-groups .rb-c-status .rb-pay { width: 100%; justify-content: center; min-height: 42px; }
  .rb-lines tr { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rb-lines .rb-c-date { grid-column: 1 / -1; font-size: 12px; }
  .rb-lines tr.is-return { border-color: #fecaca; background: #fff5f5; }
  .rb-lines tfoot tr { grid-template-columns: minmax(0, 1fr) auto auto; background: #f8fafc; }
  .rb-lines tfoot td[colspan] { grid-column: 1 / -1; }
  .rb-tray { padding: 12px; }
  .rb-tray .btn { flex: 1 1 auto; justify-content: center; }

  .rb-range { display: grid; }
  .rb-range-fields { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  .rb-range-field .field-input { width: 100%; }
  .rb-month-head .btn { width: 100%; justify-content: center; }
  .rb-figures .rb-figure + .rb-figure, .rb-months-row .rb-figure + .rb-figure { border-left: 0; border-top: 1px solid var(--pt-line-soft); }

  /* On a phone the shops stay a compact list, not cards: name, then the figures on one line. */
  .rb-shop-wrap { max-height: 320px; overflow: auto; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; }
  .rb-shop-table tr { grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; border: 0; border-bottom: 1px solid var(--pt-line-soft); border-radius: 0; padding: 10px 12px; }
  .rb-shop-table tr.is-picked { background: #f1f5f9; }
  .rb-detail-foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  .rb-detail-foot .rb-grow { display: none; }
  .rb-detail-foot .btn { justify-content: center; white-space: nowrap; min-height: 44px; }
  .reb-words-pick { grid-template-columns: minmax(0, 1fr); }
  .reb-tier { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .reb-tier-name { grid-column: 1 / -1; padding: 0; }
  .reb-alone-do select, .reb-alone-do .btn { flex: 1 1 100%; max-width: none; }
  .reb-table-wrap { overflow: visible; border: 0; background: none; }
  .reb-table, .reb-table tbody { display: block; }
  .reb-table thead { display: none; }
  .reb-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin-bottom: 8px; padding: 12px; border: 1px solid var(--pt-line); border-radius: 12px; background: #fff; }
  .reb-table td { padding: 0; border: 0; min-width: 0; }
  .reb-table td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 600; color: var(--pt-muted); }
  .reb-table .reb-c-num { text-align: left; }
  .reb-vip .reb-c-no { display: none; }
  .reb-vip .reb-c-ref, .reb-vip td:last-child { grid-column: 1 / -1; }
}
.reb-min { max-width: 420px; }
