/* receipt.css
   The printed order bill (receipt.js), laid out after the store's 76mm
   dot-matrix counter receipt. Owns all printing on orders.html: on screen the
   receipt root is hidden; in print it is the only thing on the page.
   Deliberately plain black-on-white, no theme tokens - this is paper. */

#receiptPrintRoot {
  display: none;
}

@media print {
  @page {
    size: 76mm auto;
    margin: 3mm;
  }

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    min-width: 0 !important;
    width: auto !important;
  }

  body > *:not(#receiptPrintRoot) {
    display: none !important;
  }

  #receiptPrintRoot {
    display: block;
    width: 70mm;
  }
}

.receipt {
  width: 70mm;
  box-sizing: border-box;
  font-family: Arial, Helvetica, sans-serif;
  /* Equal-width digits so amounts line up down the columns. */
  font-variant-numeric: tabular-nums;
  font-size: 9pt;
  /* Every line bold: regular-weight strokes fade to unreadable on the
     store's dot-matrix printer. */
  font-weight: 700;
  line-height: 1.25;
  color: #000;
  background: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.receipt *,
.receipt *::before,
.receipt *::after {
  box-sizing: border-box;
}

/* Header */
.rc-header {
  text-align: center;
  margin-bottom: 2mm;
}

.rc-shop-name {
  font-size: 13pt;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  line-height: 1.2;
}

.rc-shop-address {
  font-weight: 700;
}

.rc-bill-title {
  margin-top: 1mm;
  font-weight: 700;
}

/* Meta rows */
.rc-meta {
  margin-bottom: 1.5mm;
}

.rc-meta-row {
  display: flex;
  align-items: center;
  gap: 1.5mm;
  margin-bottom: 0.8mm;
}

.rc-label {
  font-weight: 700;
  flex: 0 0 auto;
}

.rc-bill-no {
  font-weight: 700;
}

.rc-box {
  border: 1px solid #000;
  padding: 0 1mm;
}

.rc-ms {
  overflow-wrap: anywhere;
  min-width: 0;
}

/* Items table */
.rc-items {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 8.5pt;
}

.rc-col-desc { width: 38%; }
.rc-col-qty { width: 12%; }
.rc-col-price { width: 19%; }
.rc-col-disc { width: 10%; }
.rc-col-amt { width: 21%; }

.rc-items th,
.rc-items td {
  padding: 0.6mm 0.3mm 0.6mm 0.8mm;
  vertical-align: middle;
}

.rc-items th {
  font-size: 8pt;
  font-weight: 700;
  white-space: nowrap;
  overflow-wrap: normal;
  /* Header row is fully boxed: outer edge plus lines between columns. */
  border: 1px solid #000;
}

.rc-items tbody tr + tr td {
  border-top: 1px dotted #000;
}

/* Solid line marking the end of the items. */
.rc-items tbody tr:last-child td {
  border-bottom: 1px solid #000;
}

.rc-desc {
  text-align: left;
  overflow-wrap: anywhere;
}

.rc-num {
  text-align: right;
  letter-spacing: -0.03em;
  /* A number must never split across lines ("4,957.5" / "0"). */
  white-space: nowrap;
}

/* Totals */
.rc-totals {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2mm;
  margin-top: 1.5mm;
}

.rc-totals-left {
  flex: 0 0 auto;
}

.rc-totals-right {
  flex: 1 1 auto;
  max-width: 40mm;
}

.rc-total-line {
  display: flex;
  justify-content: space-between;
  gap: 1mm;
}

.rc-total-line + .rc-total-line {
  margin-top: 0.4mm;
  padding-top: 0.4mm;
  border-top: 1px dotted #000;
}

.rc-total-line.rc-net {
  margin-top: 0.8mm;
  padding-top: 0.8mm;
  border-top: 1px solid #000;
  font-size: 13pt;
  font-weight: 700;
}

/* Customer block */
.rc-customer {
  margin-top: 2mm;
  padding: 1mm 1.5mm;
  border: 1px solid #000;
  overflow-wrap: anywhere;
}

.rc-customer-heading {
  font-size: 8pt;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.rc-address {
  white-space: pre-line;
}

.rc-fulfilment {
  margin-top: 1mm;
  font-size: 13pt;
  font-weight: 700;
  letter-spacing: 0.05em;
}

/* Footer */
.rc-footer {
  margin-top: 2mm;
  text-align: center;
  font-size: 8pt;
  overflow-wrap: anywhere;
}

.rc-notes {
  margin-top: 1mm;
  white-space: pre-line;
}
