/* Printable documents: invoices, receipts (A4/A5 and 80mm/58mm thermal), card sheets.
   On screen they appear as a paper preview with a small toolbar; when printing only the paper remains. */

.print-shell {
  min-height: 100vh;
  background: var(--surface-sunken);
  padding: var(--s6) var(--s4) var(--s12);
}
.print-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  flex-wrap: wrap;
  max-width: 794px;
  margin: 0 auto var(--s4);
}
.paper {
  width: min(794px, 100%);
  margin-inline: auto;
  padding: 40px;
  background: #fff;
  color: #111;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-2);
  font-size: 14px;
  line-height: 1.6;
}
.paper.a5 {
  width: min(560px, 100%);
  padding: 28px;
}
.paper.thermal {
  width: 302px; /* 80mm */
  padding: 12px;
  font-size: 12.5px;
  line-height: 1.5;
}
.paper.thermal.w58 {
  width: 219px; /* 58mm */
  font-size: 11.5px;
}
.paper h1 {
  font-size: 20px;
}
.paper h2 {
  font-size: 15px;
}
.paper .doc-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 2px solid #14212b;
  margin-bottom: 16px;
}
.paper .doc-head img {
  max-width: 72px;
  max-height: 72px;
}
.paper .doc-title {
  text-align: end;
}
.paper .doc-title .no {
  font-family: var(--mono);
  font-size: 13px;
}
.paper .sub-en {
  display: block;
  font-size: 0.82em;
  color: #555;
  line-height: 1.3;
}
.paper table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
}
.paper th {
  text-align: start;
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid #14212b;
  background: #f4f2ed;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.paper td {
  padding: 6px 8px;
  border-bottom: 1px solid #ddd;
  vertical-align: top;
}
.paper .end {
  text-align: end;
}
.paper .totals {
  width: 55%;
  margin-inline-start: auto;
}
.paper .totals td {
  border: 0;
  padding: 3px 8px;
}
.paper .totals tr.grand td {
  border-top: 1px solid #14212b;
  font-weight: 600;
  font-size: 1.1em;
  padding-top: 6px;
}
.paper .pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 8px;
}
.paper .box {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 10px 12px;
}
.paper .box .k {
  font-size: 0.85em;
  color: #555;
}
.paper .kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 2px 0;
}
.paper .kv .v {
  text-align: end;
}
.paper .doc-title .kv {
  justify-content: flex-end;
}
.paper .doc-foot {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-top: 24px;
  padding-top: 12px;
  border-top: 1px solid #ccc;
  font-size: 12px;
  color: #444;
}
.paper .qr {
  width: 96px;
  height: 96px;
  flex: none;
}
.paper .stamp {
  display: inline-block;
  padding: 2px 10px;
  border: 2px solid currentColor;
  border-radius: 6px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.paper .stamp.paid {
  color: #1c7447;
}
.paper .stamp.void {
  color: #b3261e;
}
.paper .stamp.due {
  color: #8f5500;
}
.paper.thermal .doc-head {
  flex-direction: column;
  align-items: center;
  text-align: center;
  border-bottom: 1px dashed #000;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.paper.thermal .doc-title {
  text-align: center;
}
.paper.thermal .line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.paper.thermal .rule {
  border-top: 1px dashed #000;
  margin: 6px 0;
}
.paper.thermal .big {
  font-size: 1.35em;
  font-weight: 600;
}
.paper.thermal .qr {
  margin: 8px auto 4px;
}
.paper .powered {
  margin-top: 10px;
  font-size: 10.5px;
  color: #777;
  text-align: center;
}

/* welcome card: one small page per subscriber */
.wcard {
  width: min(520px, 100%);
  margin-inline: auto;
  padding: 24px;
  background: #fff;
  color: #14212b;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}
.wcard-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 8px;
  border-bottom: 2px solid #14212b;
}
.wcard-head img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}
.wcard-company {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
}
.wcard-company strong {
  font-size: 18px;
  font-weight: 600;
}
.wcard-company span {
  font-size: 12.5px;
  color: #5b6670;
}
.wcard-title {
  font-weight: 600;
  color: #a8481f;
  white-space: nowrap;
}
.wcard-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid #e7e2d9;
}
.wcard-facts dt {
  color: #5b6670;
}
.wcard-facts dd {
  margin: 0;
  font-weight: 500;
  text-align: end;
}
.wcard-box {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f6f3ed;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.wcard-box h3,
.wcard-how h3 {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.wcard-box p,
.wcard-how p {
  font-size: 12.5px;
  color: #5b6670;
}
.wcard-secret {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 2px 0;
}
.wcard-secret > span:first-child {
  color: #5b6670;
}
.wcard-secret .mono {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  overflow-wrap: anywhere;
}
.wcard-portal {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wcard-portal > div {
  flex: 1 1 auto;
  min-width: 0;
}
.wcard-portal .qr {
  flex: none;
  width: 104px;
  height: 104px;
}
.wcard .wcard-url {
  color: #14212b;
  overflow-wrap: anywhere;
}
.wcard-how {
  margin-top: 12px;
}
.wcard-foot {
  margin-top: 10px;
}
.wcard-powered {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid #e7e2d9;
  font-size: 10.5px;
  color: #777;
  text-align: center;
}
.print-shell .wcard + .wcard {
  margin-top: 16px;
}

/* card and voucher sheets */
.card-sheet {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.scratch-card {
  border: 1px dashed #777;
  border-radius: 8px;
  padding: 10px 12px;
  break-inside: avoid;
  text-align: center;
}
.scratch-card .brand {
  font-weight: 600;
}
.scratch-card .pin {
  direction: ltr;
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  margin: 6px 0 2px;
}
.scratch-card .meta {
  font-size: 11px;
  color: #555;
}

@media print {
  @page {
    margin: 10mm;
  }
  /* roll printers: the sheet is as wide as the roll; A5 receipts get their own page size */
  @page roll80 {
    size: 80mm 297mm;
    margin: 2mm;
  }
  @page roll58 {
    size: 58mm 297mm;
    margin: 1mm;
  }
  @page a5 {
    size: A5;
    margin: 10mm;
  }
  .paper.a5 {
    page: a5;
  }
  .wcard {
    page: a5;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    break-after: page;
  }
  .wcard:last-of-type {
    break-after: auto;
  }
  .print-shell .wcard + .wcard {
    margin-top: 0;
  }
  .paper.thermal {
    page: roll80;
  }
  .paper.thermal.w58 {
    page: roll58;
  }
  html,
  body {
    background: #fff !important;
  }
  .no-print,
  .sidebar,
  .topbar,
  .app-banners,
  .toasts,
  .scrim,
  .skip-link {
    display: none !important;
  }
  .print-shell {
    padding: 0;
    background: #fff;
    min-height: 0;
  }
  .paper {
    width: 100% !important;
    padding: 0;
    border: 0;
    box-shadow: none;
  }
  .paper.thermal {
    width: 100% !important;
    padding: 0 2mm;
  }
  .page {
    padding: 0;
    max-width: none;
  }
}
@media (max-width: 600px) {
  .paper {
    padding: 20px;
  }
  .paper .pair {
    grid-template-columns: minmax(0, 1fr);
  }
  .paper .totals {
    width: 100%;
  }
  .card-sheet {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
