/* Loaded with media="print" so receipt and sticker styles do not block screen rendering. */
@media print {
  @page {
    size: auto;
    margin: 0;
  }

  html[data-print-mode='stickers'],
  html[data-print-mode='stickers'] body {
    width: var(--sticker-width, 90.3mm);
    min-width: var(--sticker-width, 90.3mm);
    height: var(--sticker-height, 29mm);
    min-height: var(--sticker-height, 29mm);
    margin: 0;
    background: #fff;
  }

  html[data-print-mode='ticket'],
  html[data-print-mode='ticket'] body {
    width: var(--ticket-paper-width, 80mm);
    min-width: var(--ticket-paper-width, 80mm);
    min-height: var(--ticket-paper-height, 200mm);
    margin: 0;
    background: #fff;
  }

  body * {
    visibility: hidden !important;
  }

  html[data-print-mode='stickers'] body *:not(.print-sticker-sheet):not(.print-sticker-sheet *):not(:has(.print-sticker-sheet)),
  html[data-print-mode='ticket'] body *:not(.print-ticket):not(.print-ticket *):not(:has(.print-ticket)) {
    display: none !important;
  }

  html[data-print-mode='stickers'] body *:has(.print-sticker-sheet),
  html[data-print-mode='ticket'] body *:has(.print-ticket) {
    position: static !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    transform: none !important;
  }

  html[data-print-mode='stickers'] .print-sticker-sheet,
  html[data-print-mode='stickers'] .print-sticker-sheet *,
  html[data-print-mode='ticket'] .print-ticket,
  html[data-print-mode='ticket'] .print-ticket * {
    visibility: visible !important;
  }

  html[data-print-mode='ticket'] .print-ticket {
    position: absolute;
    inset: 0 auto auto 0;
    display: block !important;
    box-sizing: border-box;
    width: calc(var(--ticket-paper-width, 80mm) - 8mm);
    min-height: calc(var(--ticket-paper-height, 200mm) - 8mm);
    color: #000;
    background: #fff;
    font-family: "Courier New", Courier, monospace;
    font-size: 9pt;
    line-height: 1.25;
  }

  .print-ticket p {
    margin: 0;
  }

  .print-ticket__header {
    border-bottom: 1px dashed #000;
    padding-bottom: 3mm;
    text-align: center;
  }

  .print-ticket__business {
    font-size: 13pt;
    font-weight: 900;
  }

  .print-ticket__folio {
    margin-top: 2mm !important;
    font-size: 16pt;
    font-weight: 900;
  }

  .print-ticket__date {
    margin-top: 1mm !important;
    font-size: 8pt;
  }

  .print-ticket__customer {
    display: flex;
    flex-direction: column;
    gap: 1mm;
    border-bottom: 1px dashed #000;
    padding: 3mm 0;
  }

  .print-ticket__customer span {
    font-size: 7pt;
    font-weight: 700;
  }

  .print-ticket__customer strong {
    overflow-wrap: anywhere;
    font-size: 13pt;
  }

  .print-ticket__items {
    padding: 1mm 0;
  }

  .print-ticket__item {
    border-bottom: 1px dashed #777;
    padding: 2.5mm 0;
    break-inside: avoid;
  }

  .print-ticket__item > p:first-child,
  .print-ticket__summary,
  .print-ticket__total {
    display: flex;
    justify-content: space-between;
    gap: 3mm;
  }

  .print-ticket__detail,
  .print-ticket__note {
    margin-top: 1mm !important;
    padding-left: 3mm;
    font-size: 8pt;
  }

  .print-ticket__summary {
    padding-top: 2mm;
  }

  .print-ticket__total {
    margin-top: 2mm;
    border-top: 2px solid #000;
    padding-top: 2mm;
    font-size: 13pt;
    font-weight: 900;
  }

  html[data-print-mode='stickers'] .print-sticker-sheet {
    position: absolute;
    inset: 0 auto auto 0;
    display: block !important;
    box-sizing: border-box;
    width: var(--sticker-width, 90.3mm);
    padding: 0;
    color: #000;
    background: #fff;
    font-family: "Courier New", Courier, monospace;
  }

  .print-sticker {
    display: grid;
    box-sizing: border-box;
    width: var(--sticker-width, 90.3mm);
    height: var(--sticker-height, 29mm);
    grid-template-areas: "branding content";
    grid-template-columns: clamp(4mm, 24%, 21mm) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    column-gap: 2mm;
    overflow: hidden;
    padding: 1.5mm;
    break-after: page;
    break-inside: avoid;
    page-break-after: always;
    page-break-inside: avoid;
    color: #000;
    background: #fff;
    font-size: 7pt;
    line-height: 1.15;
  }

  .print-sticker:last-child {
    break-after: auto;
    page-break-after: auto;
  }

  .print-sticker--artwork {
    display: block;
    padding: 0;
  }

  .print-sticker--artwork > img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
  }

  .print-sticker p {
    margin: 0;
  }

  .print-sticker__logo {
    display: block;
    width: 90%;
    max-width: 19mm;
    height: 70%;
    max-height: 18mm;
    margin: 0;
    object-fit: contain;
  }

  .print-sticker__branding {
    grid-area: branding;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8mm;
    overflow: hidden;
  }

  .print-sticker__order {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0;
    min-width: 0;
    overflow: hidden;
    padding: 0;
    font-size: 9pt;
    font-weight: 900;
  }

  .print-sticker__order span {
    display: -webkit-box;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 9pt;
    font-weight: 900;
    letter-spacing: 0;
    line-height: 1;
    text-transform: none;
  }

  .print-sticker__customer-row {
    display: flex;
    width: 100%;
    align-items: flex-start;
    justify-content: space-between;
    gap: 2mm;
    margin-bottom: 5mm;
    padding-right: 1mm;
    box-sizing: border-box;
  }

  .print-sticker__customer-row time {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 6pt;
    font-weight: 700;
    line-height: 1;
  }

  .print-sticker__order::after {
    content: "";
    display: block;
    width: 55%;
    max-width: 30mm;
    margin-top: 0.15mm;
    border-bottom: 1px dashed #000;
  }

  .print-sticker__item-name {
    display: -webkit-box;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 16pt;
    font-weight: 900;
    line-height: 1;
  }

  .print-sticker__customer {
    grid-area: customer;
    display: flex;
    align-items: baseline;
    gap: 1.5mm;
    border-bottom: 1px dashed #000;
    padding: 0.6mm 0;
    min-width: 0;
  }

  .print-sticker__customer span {
    flex: 0 0 auto;
    font-size: 6pt;
    font-weight: 700;
    letter-spacing: 0.08em;
  }

  .print-sticker__customer strong {
    display: -webkit-box;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 9pt;
  }

  .print-sticker__extras {
    display: block;
    min-width: 0;
    overflow: hidden;
    padding-top: 0.15mm;
  }

  .print-sticker__content {
    grid-area: content;
    display: flex;
    min-width: 0;
    min-height: 0;
    flex-direction: column;
    justify-content: flex-start;
    overflow: hidden;
    padding-top: 1mm;
  }

  .print-sticker__detail,
  .print-sticker__note {
    display: -webkit-box;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    padding: 0;
    font-size: 6pt;
  }

  .print-sticker__note {
    font-weight: 700;
  }

  .print-sticker__footer {
    min-height: 0;
    padding: 0;
    text-align: center;
    font-size: 5pt;
    font-weight: 700;
    text-transform: uppercase;
  }

  .print-sticker__footer strong {
    display: block;
    overflow: hidden;
    overflow-wrap: anywhere;
    font-size: 8pt;
    font-weight: 900;
    line-height: 1;
  }

  .print-sticker__footer span {
    display: block;
    margin-top: 0.3mm;
    font-size: 5pt;
    font-weight: 700;
    line-height: 1;
  }
}
