/* =============================================================================================
   Printed documents (A4 / Letter): invoice, quotation, delivery note, credit note.
   Four designs: .doc-classic, .doc-modern, .doc-minimal, .doc-bold, each with one accent colour.
   Colours here are fixed (paper is white in light and dark mode). Sizes in pt/mm for print.
   ============================================================================================= */

.doc {
  --a: #1d3557;          /* accent */
  --a-tint: #eef2f7;     /* very light accent, for fills */
  --ink: #1a1a1a;
  --ink-2: #4a4a4a;
  --ink-3: #7a7a7a;
  --rule: #d9d9d9;
  --rule-strong: #1a1a1a;
  --sans: "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color: var(--ink);
  background: #fff;
  font: 9.5pt/1.45 var(--sans);
  font-variant-numeric: tabular-nums lining-nums;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  text-align: left;
  letter-spacing: 0;
}
.doc.accent-ink { --a: #1c1c1e; --a-tint: #f1f1f2; }
.doc.accent-navy { --a: #1d3557; --a-tint: #eef2f7; }
.doc.accent-forest { --a: #2b5a3e; --a-tint: #eef4f0; }
.doc.accent-burgundy { --a: #7a2131; --a-tint: #f7eef0; }
.doc.accent-teal { --a: #135d63; --a-tint: #ebf4f4; }
.doc.accent-ochre { --a: #8a5a13; --a-tint: #f8f2e8; }

.doc * { box-sizing: border-box; }
.doc h1 { margin: 0; font-weight: inherit; }
.doc dl, .doc dd { margin: 0; }
.doc table { width: 100%; border-collapse: collapse; }
.doc th { font-weight: 600; text-align: left; }
.doc .c-num { text-align: right; white-space: nowrap; }
.doc .c-no { width: 7mm; color: var(--ink-3); }
.doc .c-sku { white-space: nowrap; }
.doc td.c-sku { color: var(--ink-2); font-size: 8.5pt; }
.doc .c-unit, .doc .c-check { text-align: center; white-space: nowrap; width: 18mm; }
.doc .c-amt { width: 28mm; }
.doc-label { font-size: 7.5pt; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; margin-bottom: 1mm; }
.doc-muted, .doc-unit { color: var(--ink-3); }
.doc-cur { font-weight: 400; color: var(--ink-3); margin-left: 1.5mm; font-size: 0.85em; letter-spacing: 0.04em; }
.doc-logo { display: block; max-height: 18mm; max-width: 55mm; object-fit: contain; }
.doc-addr, .doc-contacts { color: var(--ink-2); }
.doc-item { display: block; }
.doc-item-sub { display: block; font-size: 8.5pt; color: var(--ink-3); }
.doc-stamp { display: inline-block; border: 1.2pt solid currentColor; color: var(--a); font-size: 8pt; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; padding: 0.6mm 2.2mm; margin-top: 2mm; }
.doc-stamp-void { color: #a11a1a; }
.doc-box { display: inline-block; width: 3.6mm; height: 3.6mm; border: 0.8pt solid var(--ink-2); vertical-align: middle; }

/* parties + details */
.doc-parties { display: grid; grid-template-columns: 1fr auto; gap: 10mm; margin: 7mm 0 5mm; align-items: start; }
.doc-party-name { font-weight: 600; font-size: 10.5pt; }
.doc-meta { display: grid; gap: 0.8mm; min-width: 62mm; }
.doc-meta > div { display: grid; grid-template-columns: 30mm 1fr; gap: 3mm; }
.doc-meta dt { color: var(--ink-3); }
.doc-meta dd { font-weight: 500; text-align: right; }

/* line items */
.doc-lines { margin-top: 2mm; }
.doc-lines th { font-size: 7.5pt; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); padding: 2.2mm 2mm; }
.doc-lines td { padding: 2.1mm 2mm; vertical-align: top; border-bottom: 0.5pt solid var(--rule); }
.doc-lines th:first-child, .doc-lines td:first-child { padding-left: 0; }
.doc-lines th:last-child, .doc-lines td:last-child { padding-right: 0; }
.doc-lines thead { display: table-header-group; }
.doc-lines tr { break-inside: avoid; }

/* summary */
.doc-summary { display: grid; grid-template-columns: 1fr 72mm; gap: 10mm; margin-top: 5mm; break-inside: avoid; align-items: start; }
.doc-summary-left { display: grid; gap: 4mm; }
.doc-words { color: var(--ink-2); }
.doc-count { grid-column: 1 / -1; color: var(--ink-2); }
.doc-totals td { padding: 1.3mm 0; }
.doc-totals .doc-grand td { font-size: 12pt; font-weight: 700; padding-top: 2.5mm; padding-bottom: 2.5mm; border-top: 1pt solid var(--rule-strong); }
.doc-totals .doc-small td { font-size: 8.5pt; color: var(--ink-2); padding: 0.6mm 0; }
.doc-totals .doc-pay-head td { padding-top: 2.5mm; }
.doc-totals .doc-pay-head .doc-label { margin: 0; }
.doc-totals .doc-due td { font-weight: 700; border-top: 0.5pt solid var(--rule); padding-top: 2mm; }
.doc-taxsum { font-size: 8.5pt; max-width: 90mm; }
.doc-taxsum th { font-size: 7.5pt; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); border-bottom: 0.5pt solid var(--rule); padding: 1mm 2mm 1mm 0; }
.doc-taxsum td { padding: 0.8mm 2mm 0.8mm 0; color: var(--ink-2); }

/* notes, signatures, footer */
.doc-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(70mm, 1fr)); gap: 5mm 10mm; margin-top: 7mm; break-inside: avoid; color: var(--ink-2); font-size: 8.8pt; }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 20mm; margin-top: 9mm; break-inside: avoid; }
.doc-sign-line { height: 11mm; border-bottom: 0.6pt solid var(--ink-2); margin-bottom: 1.5mm; }
.doc-foot { margin-top: auto; padding-top: 6mm; break-inside: avoid; font-size: 7.8pt; color: var(--ink-3); display: grid; gap: 0.6mm; text-align: center; }
.doc-foot > div:first-child { border-top: 0.5pt solid var(--rule); padding-top: 2.5mm; }

/* ---------------------------------------------------------------------------- Classic
   Serif letterhead, centred; double rule; ruled table; boxed details. */
.doc-classic { font-family: var(--serif); font-size: 9.8pt; }
.doc-classic .doc-head { text-align: center; padding-bottom: 3mm; border-bottom: 3pt double var(--a); }
.doc-classic .doc-logo { margin: 0 auto 2mm; max-height: 16mm; }
.doc-classic .doc-name { font-size: 17pt; letter-spacing: 0.12em; text-transform: uppercase; color: var(--a); font-weight: 600; }
.doc-classic .doc-addr { margin-top: 1.2mm; font-size: 9pt; }
.doc-classic .doc-contacts { font-size: 8.6pt; margin-top: 0.6mm; }
.doc-classic .doc-title-row { text-align: center; margin-top: 4mm; }
.doc-classic .doc-title { font-size: 13pt; letter-spacing: 0.3em; text-transform: uppercase; font-weight: 600; }
.doc-classic .doc-stamp { margin-left: 3mm; vertical-align: middle; margin-top: 0; }
.doc-classic .doc-label, .doc-classic .doc-lines th, .doc-classic .doc-taxsum th { font-family: var(--serif); letter-spacing: 0.1em; }
.doc-classic .doc-meta { border: 0.6pt solid var(--ink-2); padding: 2mm 3mm; }
.doc-classic .doc-lines thead th { border-top: 1pt solid var(--ink); border-bottom: 0.6pt solid var(--ink); color: var(--ink); }
.doc-classic .doc-lines tbody tr:last-child td { border-bottom: 1pt solid var(--ink); }
.doc-classic .doc-totals .doc-grand td { border-top: 0.6pt solid var(--ink); border-bottom: 3pt double var(--ink); }
.doc-classic .doc-foot > div:first-child { border-top: 3pt double var(--a); }

/* ---------------------------------------------------------------------------- Modern
   Colour rule at the top, brand left, large light title right; tinted table header. */
.doc-modern { border-top: 2.2mm solid var(--a); padding-top: 7mm; }
.doc-modern .doc-head { display: flex; justify-content: space-between; gap: 10mm; align-items: flex-start; }
.doc-modern .doc-brand { display: flex; gap: 4mm; align-items: flex-start; }
.doc-modern .doc-name { font-size: 13pt; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 1mm; }
.doc-modern .doc-addr { font-size: 8.6pt; line-height: 1.5; }
.doc-modern .doc-title-block { text-align: right; flex-shrink: 0; }
.doc-modern .doc-title { font-size: 24pt; font-weight: 300; letter-spacing: -0.01em; color: var(--a); line-height: 1.05; }
.doc-modern .doc-number { font-size: 10.5pt; font-weight: 600; margin-top: 1.5mm; }
.doc-modern .doc-parties { padding: 4mm 0; border-top: 0.5pt solid var(--rule); border-bottom: 0.5pt solid var(--rule); }
.doc-modern .doc-lines thead th { background: var(--a-tint); color: var(--a); }
.doc-modern .doc-lines th:first-child { padding-left: 2mm; }
.doc-modern .doc-lines td:first-child { padding-left: 2mm; }
.doc-modern .doc-lines th:last-child, .doc-modern .doc-lines td:last-child { padding-right: 2mm; }
.doc-modern .doc-totals .doc-grand td { background: var(--a); color: #fff; border-top: 0; padding-left: 3mm; padding-right: 3mm; }
.doc-modern .doc-totals .doc-grand .doc-cur { color: rgb(255 255 255 / 75%); }
.doc-modern .doc-totals td { padding-left: 3mm; padding-right: 3mm; }

/* ---------------------------------------------------------------------------- Minimal
   Monochrome, generous space, hairlines; accent only on the document number line. */
.doc-minimal { font-family: "Avenir Next", Avenir, "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-size: 9.2pt; color: #222; }
.doc-minimal .doc-head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 10mm; }
.doc-minimal .doc-brand { display: flex; align-items: center; gap: 3.5mm; }
.doc-minimal .doc-logo { max-height: 12mm; }
.doc-minimal .doc-name { font-size: 10.5pt; font-weight: 600; letter-spacing: 0.02em; }
.doc-minimal .doc-title-block { text-align: right; }
.doc-minimal .doc-title { font-size: 11pt; font-weight: 500; letter-spacing: 0.32em; text-transform: uppercase; }
.doc-minimal .doc-parties { margin-top: 0; padding-top: 5mm; border-top: 0.5pt solid #222; }
.doc-minimal .doc-meta dd { color: #111; }
.doc-minimal .doc-meta > div:first-child dd { color: var(--a); font-weight: 600; }
.doc-minimal .doc-lines thead th { border-bottom: 0.5pt solid #222; font-weight: 500; color: var(--ink-3); }
.doc-minimal .doc-lines td { border-bottom-color: #ececec; padding-top: 3mm; padding-bottom: 3mm; }
.doc-minimal .doc-totals .doc-grand td { border-top: 0.5pt solid #222; font-weight: 600; font-size: 11pt; }
.doc-minimal .doc-stamp { color: #222; border-width: 0.6pt; }

/* ---------------------------------------------------------------------------- Bold
   Solid accent band with the name and title, contact strip below, zebra rows. */
.doc-bold .doc-head { display: flex; justify-content: space-between; align-items: center; gap: 8mm; background: var(--a); color: #fff; padding: 7mm 8mm; }
.doc-bold .doc-brand { display: flex; align-items: center; gap: 4mm; }
.doc-bold .doc-logo-plate { background: #fff; padding: 2mm 2.5mm; display: inline-flex; }
.doc-bold .doc-logo { max-height: 13mm; max-width: 40mm; }
.doc-bold .doc-name { font-size: 15pt; font-weight: 700; letter-spacing: 0.01em; }
.doc-bold .doc-title-block { text-align: right; }
.doc-bold .doc-title { font-size: 20pt; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1; }
.doc-bold .doc-number { margin-top: 1.5mm; font-weight: 500; opacity: 0.85; }
.doc-bold .doc-subhead { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2mm 8mm; padding: 2.5mm 8mm; background: var(--a-tint); color: var(--ink-2); font-size: 8.4pt; align-items: center; }
.doc-bold .doc-subhead .doc-stamp { margin: 0; }
.doc-bold .doc-parties { padding: 0 8mm; }
.doc-bold .doc-lines thead th { background: var(--ink); color: #fff; }
.doc-bold .doc-lines th:first-child, .doc-bold .doc-lines td:first-child { padding-left: 3mm; }
.doc-bold .doc-lines th:last-child, .doc-bold .doc-lines td:last-child { padding-right: 3mm; }
.doc-bold .doc-lines td { border-bottom: 0; }
.doc-bold .doc-lines tbody tr:nth-child(even) td { background: #f5f5f5; }
.doc-bold .doc-totals .doc-grand td { color: var(--a); font-size: 13pt; border-top: 1.5pt solid var(--a); }
.doc-bold .doc-foot > div:first-child { border-top: 1.5pt solid var(--a); }

/* ============================================================================ screen preview */
.doc-frame { position: relative; overflow: hidden; width: 100%; background: #e9e9ec; border-radius: 12px; padding: 0; }
.doc-sheet { display: block; width: 210mm; min-height: 297mm; padding: 13mm 14mm; background: #fff; transform-origin: top left; box-shadow: 0 1px 3px rgb(0 0 0 / 12%); }
.doc-sheet.paper-letter { width: 215.9mm; min-height: 279.4mm; }
.doc-sheet > .doc { min-height: calc(297mm - 26mm); }
.doc-sheet.paper-letter > .doc { min-height: calc(279.4mm - 26mm); }

/* Settings → Templates */
.docs-settings { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.docs-preview { position: sticky; top: 1rem; display: grid; gap: 0.75rem; }
.template-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem; margin: 0.5rem 0 1rem; }
.template-card { display: grid; gap: 0.5rem; cursor: pointer; align-content: start; }
.template-card input { position: absolute; opacity: 0; pointer-events: none; }
.template-thumb { display: block; position: relative; aspect-ratio: 210 / 297; overflow: hidden; border-radius: 8px; background: #fff;
  border: 1px solid var(--border); box-shadow: 0 1px 2px rgb(0 0 0 / 6%); transition: border-color 0.15s, box-shadow 0.15s; }
.template-thumb .doc-sheet { position: absolute; left: 0; top: 0; transform: scale(0.18); box-shadow: none; pointer-events: none; }
.template-card:has(input:checked) .template-thumb { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.template-card:has(input:focus-visible) .template-thumb { outline: 2px solid var(--brand); outline-offset: 2px; }
.template-label { display: grid; gap: 0.1rem; }
.template-label small { color: var(--muted); font-size: 0.78rem; line-height: 1.3; }
.docs-row { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: end; }
.docs-row > label { display: grid; gap: 0.35rem; font-size: 0.85rem; color: var(--muted); min-width: 160px; }
.swatches { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.swatches legend { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.4rem; padding: 0; }
.swatch { display: grid; justify-items: center; gap: 0.2rem; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { width: 30px; height: 30px; border-radius: 50%; background: var(--sw); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 12%); }
.swatch small { font-size: 0.72rem; color: var(--muted); }
.swatch:has(input:checked) span { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--sw); }
.swatch:has(input:focus-visible) span { outline: 2px solid var(--brand); outline-offset: 4px; }
.swatch.accent-ink { --sw: #1c1c1e; } .swatch.accent-navy { --sw: #1d3557; } .swatch.accent-forest { --sw: #2b5a3e; }
.swatch.accent-burgundy { --sw: #7a2131; } .swatch.accent-teal { --sw: #135d63; } .swatch.accent-ochre { --sw: #8a5a13; }
.logo-row { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.logo-preview { width: 150px; height: 70px; border-radius: 10px; border: 1px dashed var(--border-strong); display: grid; place-items: center; background: #fff; padding: 6px; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.doc-switch { display: flex; background: var(--fill); padding: 3px; border-radius: 12px; gap: 2px; overflow-x: auto; }
.doc-switch button { flex: 1; border: 0; background: transparent; font: inherit; font-size: 0.86rem; padding: 0.45rem 0.6rem; border-radius: 9px; cursor: pointer; color: var(--text); white-space: nowrap; }
.doc-switch button.active { background: var(--panel); box-shadow: 0 1px 3px rgb(0 0 0 / 12%); font-weight: 600; }
@media (max-width: 1100px) {
  .docs-settings { grid-template-columns: 1fr; }
  .docs-preview { position: static; order: -1; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ============================================================================ printing */
#print-root { display: none; }
@media print {
  html.printing-doc, html.printing-doc body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  html.printing-doc body > :not(#print-root) { display: none !important; }
  html.printing-doc #print-root { display: block !important; position: static; }
  html.printing-doc #print-root, html.printing-doc #print-root * { visibility: visible !important; }
  html.printing-doc .doc-paper { width: 100%; }
}
.doc-nb { white-space: nowrap; }

/* =============================================================================================
   Till receipts (80 mm / 58 mm thermal). Thermal paper prints black only: no greys or tints,
   hierarchy comes from weight, size and rules. Designs: standard, compact, classic, bold.
   ============================================================================================= */
.rcpt {
  --rsans: "Helvetica Neue", Helvetica, Arial, "Segoe UI", sans-serif;
  --rmono: "SF Mono", ui-monospace, Menlo, Consolas, "Courier New", monospace;
  color: #000; background: #fff; font: 9pt/1.35 var(--rsans); text-align: left;
  font-variant-numeric: tabular-nums; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.rcpt * { box-sizing: border-box; }
.rcpt table { width: 100%; border-collapse: collapse; }
.rcpt td, .rcpt th { padding: 0; vertical-align: top; font-weight: inherit; }
.rcpt td:last-child, .rcpt th:last-child { text-align: right; white-space: nowrap; padding-left: 2mm; }
.rcpt-head { text-align: center; display: grid; gap: 0.4mm; justify-items: center; }
.rcpt-logo { display: block; max-width: 46mm; max-height: 16mm; object-fit: contain; filter: grayscale(1) contrast(1.2); margin-bottom: 1.5mm; }
.rcpt-name { font-size: 12pt; font-weight: 700; line-height: 1.2; }
.rcpt-small { font-size: 7.6pt; }
.rcpt-title { text-align: center; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 9pt; margin: 3mm 0 2mm; }
.rcpt-flag { text-align: center; font-weight: 800; letter-spacing: 0.1em; margin: 1mm 0; }
.rcpt-flag-soft { font-weight: 600; letter-spacing: 0; font-size: 8pt; }
.rcpt-meta { font-size: 8pt; }
.rcpt-meta td:first-child { white-space: nowrap; padding-right: 2mm; }
.rcpt-rule { border-top: 0.8pt solid #000; margin: 2mm 0; }
.rcpt-rule-heavy { border-top-width: 1.6pt; }
.rcpt-dash { border-top: 1pt dashed #000; margin: 2mm 0; }
.rcpt-items { display: grid; gap: 1.6mm; }
.rcpt-row { display: flex; justify-content: space-between; gap: 2mm; }
.rcpt-row > span:last-child { white-space: nowrap; }
.rcpt-iname { font-weight: 600; }
.rcpt-sub { font-size: 7.8pt; }
.rcpt-totals td { padding: 0.4mm 0; }
.rcpt-totals .rcpt-grand td { font-size: 12pt; font-weight: 800; padding: 1.5mm 0; border-top: 0.8pt solid #000; border-bottom: 0.8pt solid #000; }
.rcpt-totals .rcpt-small td { font-size: 7.8pt; }
.rcpt-pay { margin-top: 2mm; }
.rcpt-pay td { padding: 0.4mm 0; }
.rcpt-strong td { font-weight: 700; }
.rcpt-taxsum { margin-top: 2.5mm; font-size: 7.6pt; }
.rcpt-taxsum th { text-align: left; border-bottom: 0.6pt solid #000; font-weight: 700; }
.rcpt-taxsum th:nth-child(2), .rcpt-taxsum td:nth-child(2) { text-align: right; }
.rcpt-foot { text-align: center; margin-top: 4mm; display: grid; gap: 1mm; font-size: 8pt; }
.rcpt-thanks { font-weight: 600; }
.rcpt-lines td { padding: 0.7mm 0; }
.rcpt-q { width: 7mm; padding-right: 1.5mm !important; }
.rcpt-line-meta { text-align: center; font-size: 7.8pt; }

/* Compact: smaller type, one line per item */
.rcpt-compact { font-size: 8pt; line-height: 1.25; }
.rcpt-compact .rcpt-name { font-size: 10.5pt; }
.rcpt-compact .rcpt-title { margin: 2mm 0 0.5mm; letter-spacing: 0.06em; }
.rcpt-compact .rcpt-lines td { padding: 0.35mm 0; }
.rcpt-compact .rcpt-totals .rcpt-grand td { font-size: 10.5pt; padding: 1mm 0; }
.rcpt-compact .rcpt-foot { margin-top: 2.5mm; }

/* Classic: monospace, dashed rules, capitals like a cash register */
.rcpt-classic { font-family: var(--rmono); font-size: 8.4pt; }
.rcpt-classic .rcpt-name { font-size: 11pt; text-transform: uppercase; letter-spacing: 0.04em; }
.rcpt-classic .rcpt-title { letter-spacing: 0.25em; margin: 1mm 0; }
.rcpt-classic .rcpt-colhead td { font-weight: 700; text-transform: uppercase; font-size: 7.6pt; border-bottom: 1pt dashed #000; padding-bottom: 1mm; }
.rcpt-classic .rcpt-totals .rcpt-grand td { border: 0; font-size: 11pt; text-transform: uppercase; }
.rcpt-classic .rcpt-foot { text-transform: uppercase; font-size: 7.6pt; margin-top: 1mm; }
.rcpt-classic .rcpt-thanks { font-weight: 700; }

/* Bold: black name band, large total box */
.rcpt-band { background: #000; color: #fff; text-align: center; padding: 3mm 2mm; display: grid; justify-items: center; gap: 1.5mm; }
.rcpt-band .rcpt-name { font-size: 13pt; letter-spacing: 0.02em; }
.rcpt-logo-plate { background: #fff; padding: 1mm 2mm; display: inline-flex; }
.rcpt-logo-plate .rcpt-logo { margin: 0; max-height: 12mm; }
.rcpt-head-sub { margin-top: 1.5mm; }
.rcpt-bold .rcpt-iname { font-weight: 700; }
.rcpt-totalbox { display: flex; justify-content: space-between; align-items: baseline; background: #000; color: #fff; padding: 2.2mm 2.5mm; margin: 2mm 0 1mm; }
.rcpt-totalbox span { font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 8.4pt; }
.rcpt-totalbox strong { font-size: 15pt; font-weight: 800; }

/* 58 mm paper: slightly smaller */
.rcpt-w58 { font-size: 8pt; }
.rcpt-w58 .rcpt-name { font-size: 10.5pt; }
.rcpt-w58 .rcpt-totalbox strong { font-size: 12.5pt; }
.rcpt-w58 .rcpt-logo { max-width: 36mm; }

/* on screen: a strip of paper the printed width */
.receipt.receipt-frame { max-width: none; font: inherit; text-align: initial; display: flex; justify-content: center; background: #e9e9ec; border-radius: 12px; padding: 14px 8px; margin-bottom: 0.75rem; }
.rcpt-paper { background: #fff; padding: 4mm; box-shadow: 0 1px 3px rgb(0 0 0 / 14%); }
.rcpt-paper-80 { width: 80mm; }
.rcpt-paper-58 { width: 58mm; }
.receipt-thumb { display: block; height: 210px; overflow: hidden; border-radius: 8px; border: 1px solid var(--border); background: #fff; position: relative; transition: border-color 0.15s, box-shadow 0.15s; }
.receipt-thumb .rcpt-paper { position: absolute; left: 50%; top: 0; transform-origin: top center; box-shadow: none; pointer-events: none; }
.template-card:has(input:checked) .receipt-thumb { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
@media (max-width: 420px) { .rcpt-paper-80 { width: 100%; } }

/* Return QR on receipts */
.rcpt-qr { display: grid; grid-template-columns: 22mm 1fr; gap: 3mm; align-items: center; margin-top: 4mm; padding-top: 3mm; border-top: 0.8pt dashed #000; }
.rcpt-qr .qr { display: block; width: 22mm; height: 22mm; }
.rcpt-qr-text { display: grid; gap: 0.6mm; font-size: 7.6pt; line-height: 1.3; }
.rcpt-qr-text strong { font-size: 8.2pt; }
.rcpt-qr-text span:last-child { font-weight: 700; letter-spacing: 0.04em; }
.rcpt-w58 .rcpt-qr { grid-template-columns: 18mm 1fr; gap: 2mm; }
.rcpt-w58 .rcpt-qr .qr { width: 18mm; height: 18mm; }

/* Scanning (camera window, scan buttons) */
.pos-search-wrap { display: flex; gap: 0.4rem; flex: 1 1 260px; min-width: 0; }
.pos-search-wrap input { flex: 1 1 auto; min-width: 0; }
.scan-btn { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; display: inline-grid; place-items: center; background: var(--fill); color: var(--text); border: 0; cursor: pointer; }
.scan-btn:hover { background: var(--brand-soft); color: var(--brand); }
.receipt-find { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: nowrap; }
.receipt-find input { flex: 1 1 auto; min-width: 0; }
.scan-box { display: grid; gap: 0.75rem; }
.scan-view { position: relative; aspect-ratio: 4 / 3; background: #000; border-radius: 14px; overflow: hidden; }
.scan-view video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18% 22%; border: 3px solid rgb(255 255 255 / 85%); border-radius: 16px; box-shadow: 0 0 0 999px rgb(0 0 0 / 35%); pointer-events: none; }
@media (max-width: 960px) { .pos-toolbar .pos-search-wrap { grid-column: 1 / -1; } }
.input-with-btn { display: flex; gap: 0.4rem; align-items: center; }
.input-with-btn input { flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------- shop QR poster (A4) */
.qr-poster { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260mm; padding: 18mm; text-align: center; color: #111; font-family: Inter, system-ui, sans-serif; }
.qr-poster-logo { width: 34mm; height: 34mm; object-fit: cover; border-radius: 8mm; margin-bottom: 8mm; }
.qr-poster h1 { margin: 0; font-size: 34pt; letter-spacing: -0.02em; line-height: 1.1; }
.qr-poster-lead { margin: 4mm 0 12mm; font-size: 18pt; color: #444; }
.qr-poster-code { width: 120mm; height: 120mm; padding: 6mm; border: 1.2mm solid #111; border-radius: 8mm; background: #fff; }
.qr-poster-code svg { width: 100%; height: 100%; display: block; }
.qr-poster-how { margin: 10mm 0 2mm; font-size: 18pt; font-weight: 700; }
.qr-poster-link { margin: 0; font-size: 13pt; color: #333; word-break: break-all; }
.qr-poster-phone { margin: 8mm 0 0; font-size: 12pt; color: #555; }

/* ------------------------------------------------------------------ gift cards (public/js/giftcards.js)
   Credit-card size (85.6 × 54 mm), 8 to an A4 sheet with dashed cut lines. */
.gc { position: relative; overflow: hidden; width: 85.6mm; height: 54mm; box-sizing: border-box; padding: 4.5mm 5mm; border-radius: 3.2mm;
  display: flex; flex-direction: column; justify-content: space-between; font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, "EasyPOS Thaana", sans-serif;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; color: #fff; }
.gc-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.gc-top, .gc-bottom { position: relative; display: flex; justify-content: space-between; gap: 2mm; }
.gc-shop { display: flex; align-items: center; gap: 1.6mm; font-weight: 700; font-size: 3.1mm; letter-spacing: .02em; max-width: 46mm; }
.gc-logo { height: 6.5mm; width: auto; max-width: 16mm; object-fit: contain; border-radius: 1mm; background: #fff; padding: .6mm; }
.gc-greeting { text-align: right; font-size: 3.6mm; font-weight: 700; line-height: 1.15; display: grid; justify-items: end; }
.gc-dv { font-family: "EasyPOS Thaana", sans-serif; font-weight: 400; font-size: 3.4mm; margin-top: .6mm; }
.gc-bottom { align-items: flex-end; }
.gc-details { display: grid; gap: .7mm; min-width: 0; }
.gc-value { font-size: 5.6mm; font-weight: 800; letter-spacing: -.01em; line-height: 1; }
.gc-blank { font-size: 3.6mm; font-weight: 600; opacity: .9; }
.gc-code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 3.3mm; font-weight: 700; letter-spacing: .08em; }
.gc-terms { font-size: 2mm; opacity: .85; line-height: 1.25; max-width: 52mm; }
.gc-qr { flex: none; width: 17mm; height: 17mm; background: #fff; border-radius: 1.4mm; padding: .8mm; }
.gc-qr svg { width: 100%; height: 100%; display: block; }
.gc-classic { background: linear-gradient(135deg, #0f1c3f 0%, #1d3263 60%, #273f78 100%); }
.gc-classic .gc-greeting { color: #e9c766; text-transform: uppercase; letter-spacing: .12em; font-size: 3mm; }
.gc-classic .gc-value { color: #f3d98a; }
.gc-eid { background: linear-gradient(140deg, #064e3b 0%, #047857 55%, #0f766e 100%); }
.gc-eid .gc-greeting { color: #ffe28c; }
.gc-birthday { background: linear-gradient(135deg, #db2777 0%, #9333ea 60%, #6d28d9 100%); }
.gc-thanks { background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #c2410c 100%); }
.gc-minimal { background: #fff; color: #1d1d1f; border: .3mm solid #1d1d1f; }
.gc-minimal .gc-greeting { text-transform: uppercase; letter-spacing: .14em; font-size: 2.8mm; }
.gc-minimal .gc-qr { padding: 0; }
.gc-sheet { display: grid; grid-template-columns: repeat(2, 85.6mm); gap: 6mm 8mm; justify-content: center; align-content: start; page-break-after: always; break-after: page; }
.gc-sheet:last-child { page-break-after: auto; break-after: auto; }
.gc-cut { outline: .25mm dashed #9a9a9a; outline-offset: 1.5mm; border-radius: 3.2mm; }
/* On screen (preview in the print dialog) */
.gc-preview { display: grid; justify-content: center; padding: .5rem 0; }
.gc-preview .gc { transform-origin: top center; box-shadow: 0 10px 30px rgb(0 0 0 / 22%); }
.gc-designs { display: flex; flex-wrap: wrap; gap: .5rem; }
.gc-design-option { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; border-radius: 999px; background: var(--fill); cursor: pointer; font-size: .9rem; }
.gc-design-option:has(input:checked) { background: var(--brand); color: #fff; }
.gc-design-option input { margin: 0; accent-color: #fff; }
.form .gc-design-option, .gc-design-option { display: inline-flex; flex-direction: row; position: relative; }
.gc-design-option input { position: absolute; opacity: 0; pointer-events: none; }
.gc-design-option:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
