/* A completed sale keeps its totals and next action visible while the paper scrolls. */
#modal[open]:has(.pdv-receipt-workspace) { display: flex; flex-direction: column; width: min(860px, calc(100vw - 40px)); height: min(620px, calc(100dvh - 40px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--border); border-radius: 5px; overflow: hidden; background: var(--surface); color: var(--text); }
#modal:has(.pdv-receipt-workspace) > .modal-head { flex: 0 0 auto; min-height: 52px; padding: 12px 24px; }
#modal:has(.pdv-receipt-workspace) > .modal-head h2 { font: 500 27px/1.15 "Barlow Condensed", "Arial Narrow", sans-serif; }
#modal:has(.pdv-receipt-workspace) > .modal-body { display: flex; flex: 1 1 auto; min-width: 0; min-height: 0; padding: 0; overflow: hidden; }
.pdv-receipt-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 230px; grid-template-rows: minmax(0, 1fr) auto; grid-template-areas: "paper summary" "paper actions"; width: 100%; min-width: 0; min-height: 0; font: 400 13px/1.4 "IBM Plex Sans", "Segoe UI", sans-serif; color: var(--text); }
.pdv-receipt-overview { grid-area: summary; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 29px; min-height: 0; padding: 27px 22px; }
.pdv-receipt-overview > div { min-width: 0; }
.pdv-receipt-overview span { display: block; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.pdv-receipt-overview strong { display: block; font: 500 39px/1.05 "Barlow Condensed", "Arial Narrow", sans-serif; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pdv-receipt-overview .pdv-receipt-change { text-align: left; }
.pdv-receipt-overview .pdv-receipt-change strong { font-size: 30px; }
.pdv-receipt-scroll { grid-area: paper; min-width: 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 22px 24px; border-right: 1px solid var(--border); background: var(--canvas); }
/* Screen and print share physical line width and typography. Only the screen zoom changes. */
.receipt.pdv-receipt-paper { box-sizing: content-box; width: 72mm; max-width: 72mm; margin: 0 auto; padding: 4mm; border: 0; outline: 1px solid #d8dad6; border-radius: 2px; background: #fff; color: #20252c; font: 400 10px/1.45 "IBM Plex Sans", "Segoe UI", sans-serif; box-shadow: 0 2px 5px #00000009; overflow-wrap: anywhere; color-scheme: light; zoom: 1.2; }
.receipt.pdv-receipt-paper[data-receipt-width="58"] { width: 52mm; max-width: 52mm; padding: 3mm; }
.pdv-receipt-logo { display: block; width: 34mm; max-width: 75%; height: auto; margin: 0 auto 8px; filter: grayscale(1) invert(1); }
.pdv-receipt-paper .pdv-receipt-paper-head { padding-bottom: 10px; border-bottom: 1px dashed #b8bbb8; text-align: center; }
.pdv-receipt-paper-head h3 { margin: 0; color: #20252c; font: 600 22px/1.1 "Barlow Condensed", "Arial Narrow", sans-serif; letter-spacing: .4px; }
.pdv-receipt-paper-head p { margin: 7px 0 0; font-size: 8px; letter-spacing: .65px; }
.pdv-receipt-paper-head .pdv-receipt-store-details { margin-top: 9px; white-space: pre-wrap; font-size: 10px; letter-spacing: 0; }
.pdv-receipt-paper .pdv-receipt-message { margin: 15px 0 0; padding-top: 12px; border-top: 1px dashed #b8bbb8; white-space: pre-wrap; text-align: center; font-size: 10px; }
.pdv-receipt-metadata { padding: 10px 0; }
.pdv-receipt-metadata p { margin: 0; font-size: 10px; }
.pdv-receipt-metadata p + p { margin-top: 7px; }
.pdv-receipt-metadata .pdv-receipt-due { font-weight: 500; }
.pdv-receipt-items { margin: 0; padding: 0; list-style: none; border-top: 1px solid #dedfdc; }
.pdv-receipt-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 9px; margin: 0; padding: 8px 0; border-bottom: 1px solid #e8e9e6; }
.pdv-receipt-item-description { min-width: 0; }
.pdv-receipt-item strong { display: block; font-size: 10px; font-weight: 500; }
.pdv-receipt-item small { display: block; margin-top: 3px; color: #58616a; font-size: 9px; }
.pdv-receipt-item-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.pdv-receipt-totals, .pdv-receipt-payments dl { margin: 0; }
.pdv-receipt-totals { padding-top: 13px; }
.pdv-receipt-totals > div, .pdv-receipt-payment { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.pdv-receipt-totals > div + div { margin-top: 6px; }
.pdv-receipt-paper dt, .pdv-receipt-paper dd { margin: 0; }
.pdv-receipt-paper dd { flex: 0 0 auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pdv-receipt-totals .pdv-receipt-total { margin-top: 10px; font-size: 13px; font-weight: 600; }
.pdv-receipt-payments { margin-top: 15px; padding-top: 12px; border-top: 1px dashed #b8bbb8; }
.pdv-receipt-payments h4 { margin: 0 0 8px; font-size: 10px; font-weight: 500; color: #58616a; }
.pdv-receipt-payment + .pdv-receipt-payment { margin-top: 6px; }
.pdv-receipt-payment.pdv-receipt-payment-change { margin-top: 11px; font-weight: 500; }
.pdv-receipt-actions { grid-area: actions; display: flex; flex-direction: column-reverse; align-items: stretch; justify-content: flex-start; gap: 9px; padding: 22px; background: var(--surface); }
.pdv-receipt-actions button { min-height: 39px; padding: 9px 16px; border: 1px solid var(--border); border-radius: 3px; background: transparent; color: var(--text); box-shadow: none; font: 400 12px/1.35 "IBM Plex Sans", "Segoe UI", sans-serif; }
.pdv-receipt-actions button:hover { background: var(--surface-hover); }
.pdv-receipt-actions button.primary { border-color: var(--accent); background: var(--accent); color: var(--on-accent, #fff); }
.pdv-receipt-actions button.primary:hover { filter: brightness(1.1); background: var(--accent); }
.pdv-receipt-actions button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 3px; }
.pdv-receipt-actions [data-receipt-print-status] { order:2; margin:0; font-size:11px; line-height:1.6; color:var(--muted); }
.pdv-receipt-actions [data-receipt-print-status]:empty { display:none; }
.pdv-receipt-actions [data-receipt-print-status][data-error="true"] { color:var(--warning); }
.pdv-receipt-actions [data-receipt-reprint-confirm] { order:1; display:flex; align-items:flex-start; gap:8px; margin:0; color:var(--text); font-size:11px; line-height:1.6; }
.pdv-receipt-actions [data-receipt-reprint-confirm][hidden] { display:none; }
.pdv-receipt-actions [data-receipt-reprint-confirm] input { flex:none; width:14px; height:14px; margin-top:2px; accent-color:var(--accent-bright); }
.pdv-receipt-actions button:disabled { opacity:.5; cursor:default; }
@media screen and (max-width: 1100px) { .receipt.pdv-receipt-paper { zoom: 1; } }
@media (max-height: 560px) {
  #modal:has(.pdv-receipt-workspace) > .modal-head { min-height: 44px; padding-block: 9px; }
  .pdv-receipt-overview { padding-block: 20px; gap: 22px; }
  .pdv-receipt-overview strong { font-size: 32px; }
  .pdv-receipt-overview .pdv-receipt-change strong { font-size: 27px; }
  .pdv-receipt-scroll { padding-block: 16px; }
  .pdv-receipt-actions { padding-block: 17px; }
}
@media (max-width: 700px) {
  #modal[open]:has(.pdv-receipt-workspace) { width: calc(100vw - 20px); max-height: calc(100dvh - 20px); }
  .pdv-receipt-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "summary" "paper" "actions"; }
  .pdv-receipt-overview { flex-direction: row; align-items: baseline; justify-content: space-between; padding-block: 13px 16px; gap: 20px; }
  .pdv-receipt-overview .pdv-receipt-change { text-align: right; }
  #modal:has(.pdv-receipt-workspace) > .modal-head, .pdv-receipt-overview, .pdv-receipt-actions { padding-inline: 18px; }
  .pdv-receipt-scroll { padding-inline: 14px; border-right: 0; border-top: 1px solid var(--border); }
  .pdv-receipt-actions { flex-direction: row; justify-content: space-between; gap: 8px; padding-block: 13px; border-top: 1px solid var(--border); }
  .pdv-receipt-actions button { padding-inline: 12px; }
}
@media print {
  /* Fixed PDF sheet height; the printer driver controls physical roll length/cutting. */
  @page esquadrao-receipt-80 { size: 80mm 297mm; margin: 4mm; }
  @page esquadrao-receipt-58 { size: 58mm 297mm; margin: 3mm; }
  #modal[open]:has(.pdv-receipt-workspace) { display: block !important; position: static; width: 72mm; max-width: none; height: auto; max-height: none; margin: 0; padding: 0; border: 0; border-radius: 0; overflow: visible; box-shadow: none; background: #fff; color: #000; }
  #modal[open]:has(.pdv-receipt-workspace [data-receipt-width="80"]) { page: esquadrao-receipt-80; }
  #modal[open]:has(.pdv-receipt-workspace [data-receipt-width="58"]) { width: 52mm; page: esquadrao-receipt-58; }
  #modal:has(.pdv-receipt-workspace) > .modal-body, .pdv-receipt-workspace, .pdv-receipt-scroll { display: block; width: 100%; height: auto; max-height: none; min-height: 0; margin: 0; padding: 0; border: 0; overflow: visible; background: #fff; color: #000; }
  .pdv-receipt-workspace .no-print { display: none !important; }
  .receipt.pdv-receipt-paper { width: 100%; max-width: 72mm; margin: 0; padding: 0; border: 0; outline: 0; border-radius: 0; box-shadow: none; color: #000; background: #fff; font-size: 10px; zoom: 1; }
  .receipt.pdv-receipt-paper[data-receipt-width="80"] { page: esquadrao-receipt-80; }
  .receipt.pdv-receipt-paper[data-receipt-width="58"] { max-width: 52mm; padding: 0; page: esquadrao-receipt-58; }
  .pdv-receipt-logo { width: 34mm; margin-bottom: 8px; }
  .pdv-receipt-paper .pdv-receipt-paper-head { padding-bottom: 10px; }
  .pdv-receipt-paper-head h3 { color: #000; font-size: 22px; }
  .pdv-receipt-paper-head p { font-size: 8px; }
  .pdv-receipt-metadata { padding-block: 10px; }
  .pdv-receipt-metadata p { font-size: 10px; }
  .pdv-receipt-item { padding-block: 8px; gap: 9px; break-inside: avoid; }
  .pdv-receipt-item strong { font-size: 10px; }
  .pdv-receipt-item small { color: #000; font-size: 9px; }
  .pdv-receipt-totals > div, .pdv-receipt-payment, .pdv-receipt-paper-head, .pdv-receipt-metadata { break-inside: avoid; }
  .pdv-receipt-totals .pdv-receipt-total { font-size: 13px; }
  .pdv-receipt-payments h4 { color: #000; }
}

/* The same composition is used in the editor, completed sale and print output. */
.pdv-receipt-paper[data-receipt-align="left"] .pdv-receipt-paper-head { text-align: left; }
.receipt.pdv-receipt-paper .pdv-receipt-paper-head h3 { text-align: inherit; }
.pdv-receipt-paper[data-receipt-align="left"] .pdv-receipt-logo { margin-left: 0; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-paper-head { padding-bottom: 6px; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-logo { width: 26mm; margin-bottom: 5px; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-item { padding-block: 4px; gap: 6px; border-bottom: 0; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-item small { margin-top: 0; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-metadata { padding-block: 7px; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-totals { padding-top: 8px; border-top: 1px solid #dedfdc; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-payments { margin-top: 8px; padding-top: 8px; }
.pdv-receipt-paper[data-receipt-template="compact"] .pdv-receipt-message { margin-top: 8px; padding-top: 8px; }
.pdv-receipt-paper .pdv-receipt-column-labels, .pdv-receipt-paper .pdv-receipt-item-columns { display: grid; grid-template-columns: minmax(24px, .55fr) minmax(0, 1fr) minmax(0, 1fr); gap: 6px; font-variant-numeric: tabular-nums; text-align: right; }
.pdv-receipt-paper .pdv-receipt-column-labels > :first-child, .pdv-receipt-paper .pdv-receipt-item-columns > :first-child { text-align: left; }
.pdv-receipt-paper .pdv-receipt-column-labels { padding-block: 7px; border-bottom: 1px solid #20252c; font-size: 9px; font-weight: 600; }
.pdv-receipt-paper[data-receipt-template="detailed"] .pdv-receipt-items { border-top: 0; }
.pdv-receipt-paper[data-receipt-template="detailed"] .pdv-receipt-item { display: block; }
.pdv-receipt-paper[data-receipt-template="detailed"] .pdv-receipt-item-description { margin-bottom: 5px; }
.pdv-receipt-paper[data-receipt-template="detailed"] .pdv-receipt-item-columns > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.pdv-receipt-paper[data-receipt-template="detailed"] .pdv-receipt-total { padding-block: 7px; border-top: 2px solid #20252c; border-bottom: 2px solid #20252c; }
.pdv-receipt-paper[data-receipt-text="large"] { font-size: 12px; }
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-item strong,
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-metadata p,
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-store-details,
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-message,
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-payments h4 { font-size: 12px; }
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-item small,
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-column-labels { font-size: 11px; }
.pdv-receipt-paper[data-receipt-text="large"] .pdv-receipt-total { font-size: 16px; }
