/* Paper receipt look for receipts.js receiptHTML(). Self-contained: works with or without tokens.css. */
@font-face {
  font-family: 'Receipt Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/plex-mono-400-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Receipt Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/plex-mono-600-latin.woff2') format('woff2');
}

.tz-receipt {
  --paper: #fbfaf6;
  --ink: #2b2b2e;
  --ink-soft: #6b6b70;
  --zig: 8px;
  box-sizing: border-box;
  position: relative;
  width: min(100%, var(--tz-receipt-width, 320px));
  margin: 0;
  padding: 22px 20px calc(18px + var(--zig));
  color: var(--ink);
  font: 400 12.5px/1.55 'Receipt Mono', ui-monospace, 'SF Mono', Menlo, Consolas, 'Courier New', monospace;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  text-shadow: 0 0 0.35px rgba(40, 40, 45, 0.55); /* thermal ink bleed */
  background-color: var(--paper);
  /* faint paper fibre + a soft fold shading */
  background-image:
    linear-gradient(180deg, rgba(0, 0, 0, 0.018) 0%, transparent 18%, transparent 64%, rgba(0, 0, 0, 0.03) 66%, transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .45 0 0 0 0 .42 0 0 0 0 .36 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* torn (zig-zag) bottom edge */
  -webkit-mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) var(--zig) repeat-x;
  mask:
    linear-gradient(#000 0 0) top / 100% calc(100% - var(--zig)) no-repeat,
    conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / calc(var(--zig) * 2) var(--zig) repeat-x;
}
/* the mask clips box-shadow, so the shadow is a drop-shadow filter on a wrapper */
.tz-receipt-shadow {
  display: inline-block;
  filter: drop-shadow(0 1px 1px rgba(15, 31, 61, 0.08)) drop-shadow(0 12px 24px rgba(15, 31, 61, 0.12));
}
.tz-receipt p { margin: 0; }
.tz-r-head { text-align: center; color: var(--ink-soft); }
.tz-r-store {
  color: var(--ink);
  font-weight: 600;
  font-size: 1.35em;
  letter-spacing: 0.08em;
  margin-bottom: 4px !important;
}
.tz-r-meta { display: flex; justify-content: center; gap: 1.5em; }
.tz-r-rule {
  border: 0;
  border-top: 1.5px dashed rgba(43, 43, 46, 0.45);
  margin: 12px 0;
}
.tz-r-lines { list-style: none; margin: 0; padding: 0; }
.tz-r-line {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  padding: 1px 0;
  border-radius: 3px;
  transition: background-color 0.2s ease-out;
}
.tz-r-name { overflow-wrap: anywhere; }
.tz-r-amt { text-align: right; white-space: nowrap; }
.tz-r-flag { display: inline-block; width: 1.4ch; text-align: right; color: var(--ink-soft); }
.tz-r-detail { grid-column: 1 / -1; padding-left: 2ch; color: var(--ink-soft); }
.tz-r-line.is-active { background: rgba(36, 97, 189, 0.12); }
.tz-r-sums { margin: 0; }
.tz-r-sums div { display: flex; justify-content: space-between; gap: 12px; padding-right: 1.4ch; }
.tz-r-sums dt, .tz-r-sums dd { margin: 0; }
.tz-r-total { font-weight: 600; font-size: 1.25em; margin: 4px 0; }
.tz-r-foot { text-align: center; color: var(--ink-soft); }
.tz-r-barcode {
  height: 38px;
  margin: 12px auto 0;
  width: 78%;
  background: repeating-linear-gradient(90deg,
    var(--ink) 0 2px, transparent 2px 4px, var(--ink) 4px 5px, transparent 5px 8px,
    var(--ink) 8px 11px, transparent 11px 12px, var(--ink) 12px 13px, transparent 13px 16px,
    var(--ink) 16px 17px, transparent 17px 19px, var(--ink) 19px 22px, transparent 22px 25px);
  opacity: 0.85;
}
@media (prefers-reduced-motion: reduce) {
  .tz-r-line { transition: none; }
}
