/* Bug-sweep fixes, team d (Oct 2026). Loaded after si.css. */

/* D12 — Suppliers detail: the unpaid-items grid (22+74+…+82px) was wider than the modal at 390px.
   Phone: hide the Date and Unit columns; the date + unit cost move under the item name. */
.sup-item-date { display: none; }
@media (max-width: 600px) {
  .sup-row, .sup-row-head { grid-template-columns: 22px minmax(0,1fr) 34px 76px; gap: 6px; }
  .sup-row > :nth-child(2), .sup-row-head > :nth-child(2),
  .sup-row > :nth-child(5), .sup-row-head > :nth-child(5) { display: none; }
  .sup-item-date { display: block; margin-top: 2px; }
  .sup-item { min-width: 0; }
  .sup-pay-actions > .btn, .sup-amt-group { flex: 1 1 auto; }
  .sup-amt-group .input { max-width: none !important; flex: 1 1 auto; min-width: 0; }
  /* Payables summary: name + owed on top, contact / sold / paid underneath */
  .sup-srow, .sup-srow-head { grid-template-columns: minmax(0,1fr) auto; row-gap: 2px; }
  .sup-srow-head > :nth-child(2), .sup-srow-head > :nth-child(3), .sup-srow-head > :nth-child(4) { display: none; }
  .sup-srow-head > :nth-child(5) { grid-column: 2; grid-row: 1; }
  .sup-srow > .sup-sname { grid-column: 1; grid-row: 1; }
  .sup-srow > .sup-owed { grid-column: 2; grid-row: 1; }
  .sup-srow > :nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .sup-srow > :nth-child(3), .sup-srow > :nth-child(4) { grid-row: 3; text-align: left; font-size: 12px; }
  .sup-srow > :nth-child(3) { grid-column: 1; }
  .sup-srow > :nth-child(4) { grid-column: 2; text-align: right; }
  .sup-srow > :nth-child(3)::before { content: 'Sold '; }
  .sup-srow > :nth-child(4)::before { content: 'Paid '; }
}

/* D6 — credit with a supplier (paid for items later refunded / voided / excluded) */
.sup-credit-banner { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, var(--ok, #2E7D5B) 10%, #fff); border: 1px solid color-mix(in srgb, var(--ok, #2E7D5B) 30%, transparent); }
.sup-credit-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.sup-credit-top b { color: var(--ok, #2E7D5B); font-size: 16px; }
.sup-credit-chip { display: block; font-size: 11.5px; font-weight: 600; color: var(--ok, #2E7D5B); white-space: nowrap; }
.sup-detail.is-busy .sup-pay-actions { opacity: .6; pointer-events: none; }

/* D19 — charts are drawn at the card's real width; wider charts scroll sideways inside the card */
.rep-chartwrap > .rep-chartin { min-width: 0; }
.rep-chartwrap > .rep-chartin .chart svg { width: 100%; }

/* D18 — "before bill discounts" note on the Insights All sales card */
.ins-card-note { font-size: 11px; line-height: 1.2; }

/* D-R1 — a deleted supplier that still has money on its row stays listed, labelled "(inactive)" */
.sup-inactive { font-weight: 400; white-space: nowrap; }

/* D-5.1 — ranged CSV links after a failed load: dimmed; a tap shows why instead of downloading an error */
.rep-export.rep-export-off { opacity: .5; cursor: not-allowed; }
