.sales-receipt-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .55rem;
}
.sales-receipt-row details { flex: 1 1 16rem; margin: .45rem 0; }

#salesReceipt {
  width: min(32.5rem, calc(100% - 1.5rem));
  max-height: calc(100dvh - 1.5rem);
  padding: clamp(.85rem, 4vw, 1.45rem);
  border: 1px solid #624c34;
  border-radius: 19px;
  color: #f7ead5;
  background: #211b16;
  box-shadow: 0 18px 60px #0a0605a0;
  overflow: auto;
}
#salesReceipt::backdrop { background: #100a08cc; backdrop-filter: blur(3px); }

.sale-receipt-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1rem;
}
.sale-receipt-header h2 { flex: 1; margin: 0; }
.sale-receipt-check {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid #4a644b;
  border-radius: 50%;
  background: #25382a;
  color: #b7e2b9;
}
.sale-receipt-check[hidden] { display: none; }
.sale-receipt-close { flex: none; min-width: 2.5rem; }

.sale-receipt-paper {
  position: relative;
  width: min(100%, 350px);
  margin: 0 auto;
  padding: 19px clamp(11px, 4vw, 19px) 17px;
  background: #faf1df;
  color: #2a2118;
  box-shadow: 0 7px 18px #0b06086b;
  font: 13px/1.4 ui-monospace, Consolas, monospace;
}
.sale-receipt-paper::after {
  position: absolute;
  inset: auto 0 -6px;
  height: 6px;
  background: linear-gradient(135deg, #faf1df 5px, transparent 0) 0 0/12px 6px repeat-x,
              linear-gradient(225deg, #faf1df 5px, transparent 0) 0 0/12px 6px repeat-x;
  content: "";
}

.sale-receipt-paper p { margin: 0; }
.sale-receipt-paper .sale-receipt-brand {
  font: 700 29px/1.1 Georgia, serif;
  letter-spacing: .13em;
  text-align: center;
}
.sale-receipt-paper .sale-receipt-address {
  margin: 5px 0 13px;
  color: #5c4d3a;
  font-size: 11px;
  text-align: center;
}
.sale-receipt-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 3px 8px;
  border-block: 1px dashed #9e8c73;
  padding-block: 7px;
  font-size: 11.5px;
}

.sale-receipt-paper table { margin: 8px 0 9px; }
.sale-receipt-paper :is(th, td) { border: 0; padding: 4px 0; vertical-align: top; }
.sale-receipt-paper th { color: #63523f; font-size: 10px; text-transform: uppercase; }
.sale-receipt-paper :is(th, td):last-child { padding-left: 8px; text-align: right; white-space: nowrap; }
.sale-receipt-paper td:first-child { overflow-wrap: anywhere; }
.sale-receipt-paper td small { display: block; color: #66543e; font-size: 11px; }

.sale-receipt-total, .sale-receipt-method, .sale-receipt-refunds p {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.sale-receipt-total { border-top: 1px dashed #9e8c73; padding: 9px 0 3px; font-weight: 750; }
.sale-receipt-total strong { font-size: 22px; white-space: nowrap; }
.sale-receipt-method, .sale-receipt-refunds { font-size: 12px; }
.sale-receipt-refunds { margin-top: 5px; }
.sale-receipt-paper .sale-receipt-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #9e8c73;
  color: #63523f;
  font-size: 10px;
  letter-spacing: .075em;
  text-align: center;
  text-transform: uppercase;
}

.sale-receipt-actions, .sale-receipt-share { display: flex; flex-wrap: wrap; gap: .5rem; }
.sale-receipt-actions { justify-content: center; margin-top: 22px; }
.sale-receipt-share { align-items: end; margin: .85rem auto 0; max-width: 24rem; }
.sale-receipt-share label { flex: 1 1 10rem; }
.sale-receipt-share-hint, .sale-receipt-share-message { width: 100%; margin: .55rem 0 0; color: #dfcba7; font-size: .84rem; }
.sale-receipt-share-hint { margin: 0; }
.sale-receipt-download {
  display: inline-flex;
  align-items: center;
  padding: .55rem .65rem;
  border: 1px solid #68543a;
  border-radius: .45rem;
  text-decoration: none;
}
.sale-receipt-download:hover { background: #342719; }
.sale-receipt-download[hidden] { display: none; }
.sale-receipt-actions[hidden], .sale-receipt-share[hidden] { display: none; }

@media print {
  html:has(#salesReceipt[open]), body:has(#salesReceipt[open]) { background: white; color-scheme: light; }
  body:has(#salesReceipt[open]) > :not(#salesReceipt),
  #salesReceipt[open] > :not(.sale-receipt-paper),
  #salesReceipt[open]::backdrop,
  #salesReceipt[open] .sale-receipt-paper::after { display: none; }
  #salesReceipt[open] {
    position: static;
    display: block;
    width: auto;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: white;
    box-shadow: none;
  }
  #salesReceipt[open] .sale-receipt-paper {
    width: min(100%, 72mm);
    margin: 0;
    padding: 0;
    color: black;
    background: white;
    box-shadow: none;
  }
  .sale-receipt-paper tr, .sale-receipt-total { break-inside: avoid; }
}

