/* ishtari — the invoice of an order (admin and trader): a red header with the logo, the customer or trader,
   the products, the totals. On phones each line is a small card; printed on A4 with its colours. */
.inv-sheet { background: #fff; color: var(--ink); border-radius: var(--r-lg); box-shadow: var(--ring); max-width: 820px; overflow: hidden; }
.inv-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap; padding: 22px 26px; background: var(--red); color: #fff; }
.inv-brand { display: flex; align-items: center; gap: 14px; }
.inv-logo { display: grid; place-items: center; width: 62px; height: 62px; flex: none; border-radius: 16px; background: rgba(255, 255, 255, .16); }
.inv-logo img { width: 44px; height: auto; display: block; }
.inv-brand strong, .inv-brand span { display: block; }
.inv-name { font: 800 26px/1.1 'Rubik', sans-serif; letter-spacing: -.4px; margin-bottom: 4px; }
.inv-name em { font-style: normal; color: var(--sun); }
.inv-brand span { font-size: 13px; opacity: .92; }
.inv-title { text-align: end; }
.inv-title h2 { font-size: 22px; font-weight: 800; line-height: 1.2; }
.inv-meta { display: grid; gap: 2px; margin: 6px 0 0; font-size: 13.5px; }
.inv-meta div { display: flex; justify-content: flex-end; gap: 8px; }
.inv-meta dt { opacity: .8; }
.inv-meta dd { margin: 0; font-weight: 600; font-family: 'Rubik', 'Noto Sans Arabic', sans-serif; }
.inv-party { padding: 18px 26px 4px; }
.inv-party h3 { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.inv-party dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 6px 20px; margin: 0; font-size: 14.5px; }
.inv-party dl div { display: flex; gap: 8px; }
.inv-party dt { color: var(--muted); min-width: 4.5em; }
.inv-party dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.inv-party .is-wide { grid-column: 1 / -1; }
.inv-table { width: calc(100% - 52px); margin: 14px 26px 0; border-collapse: collapse; font-size: 14.5px; }
.inv-table th { background: var(--ink); color: #fff; padding: 9px 10px; text-align: start; font-weight: 600; white-space: nowrap; }
.inv-table th:first-child { border-start-start-radius: 10px; border-end-start-radius: 10px; }
.inv-table th:last-child { border-start-end-radius: 10px; border-end-end-radius: 10px; }
.inv-table td { padding: 10px; border-bottom: 1px solid var(--line); }
.inv-table .num { text-align: center; white-space: nowrap; font-family: 'Rubik', sans-serif; }
.inv-totals { margin: 16px 26px 0; margin-inline-start: auto; max-width: 340px; display: grid; gap: 6px; font-size: 15px; }
.inv-totals div { display: flex; justify-content: space-between; gap: 16px; }
.inv-totals dd { margin: 0; font-family: 'Rubik', sans-serif; font-weight: 600; }
.inv-totals .is-discount { color: var(--red); }
.inv-totals .is-total { background: var(--red-t); color: var(--red); padding: 9px 12px; border-radius: 12px; font-size: 18px; font-weight: 800; }
.inv-totals .is-total dd { font-weight: 800; }
.inv-foot { margin: 20px 0 0; padding: 14px 26px; text-align: center; color: var(--muted); font-size: 13.5px; border-top: 1px dashed var(--line); }
.inv-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.inv-actions .hint { font-size: 13px; color: var(--muted); }

@media screen and (max-width: 600px) {
  .inv-head { padding: 18px; }
  .inv-title { text-align: start; }
  .inv-meta div { justify-content: flex-start; }
  .inv-party { padding: 16px 18px 4px; }
  .inv-table { width: calc(100% - 36px); margin: 12px 18px 0; }
  .inv-table thead { display: none; }
  .inv-table, .inv-table tbody, .inv-table tr { display: block; }
  .inv-table tr { padding: 9px 0; border-bottom: 1px solid var(--line); }
  .inv-table td { display: flex; justify-content: space-between; gap: 16px; padding: 2px 0; border: 0; text-align: start; }
  .inv-table td::before { content: attr(data-label); color: var(--muted); font-weight: 600; font-family: 'Noto Sans Arabic', sans-serif; }
  .inv-table td:first-child { font-weight: 700; font-size: 15.5px; }
  .inv-table td:first-child::before { content: none; }
  .inv-table td:last-child { font-weight: 700; }
  .inv-totals { margin: 14px 18px 0; max-width: none; }
}

/* Printing a page that shows an invoice prints the invoice alone, in colour (unless the waybill is printing). */
@media print {
  @page { size: A4; margin: 12mm; }
  body:has(.inv-sheet):not(.printing-waybill) { background: #fff; }
  body:has(.inv-sheet):not(.printing-waybill) * { visibility: hidden; }
  /* Same weight as the rule above (body:has(...) counts as a class), so the invoice shows again. */
  body:has(.inv-sheet):not(.printing-waybill) .inv-sheet, body:has(.inv-sheet):not(.printing-waybill) .inv-sheet * { visibility: visible; }
  body:not(.printing-waybill) .inv-sheet { position: absolute; inset: 0 0 auto 0; max-width: none; box-shadow: none; border-radius: 0; }
  .inv-head, .inv-table th, .inv-totals .is-total { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
