/* Styles for Invoices (build spec "Invoices"): a merchant's Invoices tab, the invoice drawer, Invoice reports and the
   invoice tag on payments. Prefix: iv-. Colours only from tokens.css. */

/* a report on a list row, next to Overdue and Paid twice (ui/invoice.js) */
.row-flag.danger { color: var(--danger); }

/* "Invoice INV-0042" on a payment row and in the payment drawer */
.tag.iv-tag { margin-top: 4px; color: var(--brand); border-color: color-mix(in srgb, var(--brand) 30%, transparent); background: var(--brand-soft); font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.tag.iv-tag svg { width: 12px; height: 12px; flex: none; }
.tag.iv-tag:hover { text-decoration: none; border-color: var(--brand); }
.pm-pay-top .tag.iv-tag { margin-top: 0; }

/* ---------- merchant Invoices tab ---------- */
.iv-access { align-items: start; }
.iv-logo { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.iv-logo img {
  max-width: min(280px, 100%); max-height: 96px; object-fit: contain;
  padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.iv-logo.empty { flex-direction: row; align-items: center; color: var(--text-3); font-size: 13.5px; }
.iv-logo.empty svg { width: 20px; height: 20px; flex: none; }

/* ---------- invoice drawer ---------- */
.drawer.iv-drawer { width: min(680px, 100%); }
.iv-pills { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.iv-mini { flex: none; border: 1px solid var(--border); border-radius: var(--radius); }
.iv-mini .table td, .iv-mini .table th { padding-left: 12px; padding-right: 12px; }
.iv-items .iv-item { white-space: normal; min-width: 180px; max-width: 320px; }
.iv-items .iv-item .cell-sub { overflow-wrap: anywhere; }
.iv-pics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.iv-pics img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2); }
.iv-pics a { display: block; border-radius: 6px; }
.iv-totals { grid-template-columns: minmax(120px, max-content) minmax(0, 1fr); }
.iv-totals dd { text-align: right; }
.iv-totals .iv-total { padding-top: 8px; border-top: 1px solid var(--border); font-weight: 600; color: var(--text); }
.iv-extra { margin: 0; padding-left: 18px; }
.iv-extra li + li { margin-top: 2px; }

.iv-report {
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2);
}
.iv-report.open { border-color: color-mix(in srgb, var(--danger) 35%, transparent); box-shadow: inset 3px 0 0 var(--danger); }
.iv-report-head { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; }
.iv-report-head a { overflow-wrap: anywhere; }
.iv-report-done { margin: 0; }
.iv-report-note { color: var(--text-2); font-style: normal; }

/* ---------- Invoice reports ---------- */
.iv-trunc { display: block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Settings > Platform: Invoices card ---------- */
.iv-sent { min-height: 40px; display: flex; align-items: baseline; gap: 4px; padding-top: 8px; font-size: 14px; }
.iv-sent b { font-size: 18px; }

@media (max-width: 560px) {
  .iv-totals { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; }
  .iv-totals dd { margin-bottom: 0; }
  .iv-items .iv-item { min-width: 150px; }
}
