/* 80mm thermal receipt. Pure black on white: a thermal head has no greys and no
   colour, so every emphasis here is weight, size, a rule or an inversion. */

:root { --rcpt-width: 80mm; }

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

body {
  margin: 0;
  background: #f0f0f0;
  font-family: Arial, Helvetica, "Liberation Sans", sans-serif;
  font-variant-numeric: tabular-nums; /* same-width digits keep the columns aligned */
}

.rcpt-toolbar { text-align: center; padding: 16px; }

.rcpt-toolbar button {
  font-size: 14px; padding: 8px 18px; cursor: pointer;
  border: 1px solid #888; border-radius: 4px; background: #fff;
}

.receipt {
  width: var(--rcpt-width); box-sizing: border-box;
  margin: 0 auto 24px; padding: 6mm 4mm;
  background: #fff; color: #000;
  font-size: 12px; line-height: 1.35;
  box-shadow: 0 1px 6px rgba(0, 0, 0, .15);
}

.receipt hr { border: none; border-top: 1px solid #000; margin: 4px 0; }
.receipt__center { text-align: center; }

/* ---------- identity ---------- */

/* Forced mono: a colour or mid-grey logo dithers into mud on a thermal head. */
.receipt__logo {
  display: block; margin: 0 auto 3px;
  max-width: 60%; max-height: 18mm;
  filter: grayscale(1) contrast(2.2);
}

.receipt__store   { font-size: 15px; font-weight: 700; letter-spacing: .5px; }
.receipt__branch  { font-size: 12px; font-weight: 700; }
.receipt__contact { font-size: 10.5px; line-height: 1.3; }

/* The reversed bar naming the document, the strongest mark on the paper. */
.receipt__title {
  background: #000; color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 2px;
  padding: 2px 6px; margin: 5px 0 0;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; /* keep the fill when printing */
}

/* ---------- transaction meta ---------- */

.receipt__meta { font-size: 11px; }
.receipt__meta b { font-weight: 700; }
.receipt__meta-row { display: flex; gap: 6px; }
.receipt__meta-row > div { flex: 1 1 0; min-width: 0; }
.receipt__meta-row > div:last-child:not(:only-child) { text-align: right; }

/* ---------- line items ---------- */

/* Fixed layout, or an empty Discount column still reserves the width of the
   word "Discount" and strands Qty in the middle of the roll. */
.receipt__items {
  width: 100%; table-layout: fixed; border-collapse: collapse; font-size: 11px;
}

.receipt__items thead th {
  font-weight: 700; padding: 1px 0;
  border-top: 1px solid #000; border-bottom: 1px solid #000;
}
.receipt__items thead tr:first-child th { border-bottom: none; }
.receipt__items thead tr:last-child th { border-top: none; text-align: left; }

/* Two rows per item: the name takes the full width, its figures sit beneath. */
.receipt__items .desc td { padding: 3px 0 0; font-weight: 400; }
.receipt__items .figs td { padding: 0 0 3px; }

/* A dotted rule opens each item after the first, so a name is never read
   against the previous item's figures. */
.receipt__items tbody tr.desc:not(:first-child) td {
  border-top: 1px dotted #999; padding-top: 4px;
}

.receipt__items .num { text-align: right; white-space: nowrap; }

/* ---------- totals ---------- */

.receipt__totals {
  width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 2px;
}
.receipt__totals td { padding: 1px 0; }
.receipt__totals .lead  { text-align: left; font-weight: 700; }
.receipt__totals .label { text-align: right; font-weight: 700; }
.receipt__totals .num   { text-align: right; white-space: nowrap; }

/* The payable line is the loudest thing on the roll. */
.receipt__totals .grand td {
  font-size: 15px; font-weight: 700;
  border-top: 1px solid #000; padding-top: 3px;
}

/* ---------- footer ---------- */

.receipt__thanks { text-align: center; margin-top: 6px; font-size: 11px; }

/* The software house's credit, deliberately the smallest type on the paper. */
.receipt__credit {
  text-align: center; font-size: 8.5px; line-height: 1.3;
  margin-top: 6px; padding-top: 4px; border-top: 1px solid #000;
}

/* ---------- print ---------- */

@media print {
  body { background: #fff; }
  .rcpt-toolbar { display: none; }
  .receipt { width: auto; margin: 0; padding: 0 2mm; box-shadow: none; }

  @page { size: 80mm auto; margin: 3mm; }
}
