/* OSHA Shop Manager - print layouts (Arabic invoices, receipts, labels, reports) */
#print-root { display: none; }

.preview-scroll { max-height: 70vh; overflow: auto; background: #e9ebef; padding: 14px; border-radius: 10px; }
.preview-paper { background: #fff; margin: 0 auto; box-shadow: 0 6px 24px rgba(0, 0, 0, .15); }
.preview-paper .p-a4 { width: 186mm; padding: 8mm; margin: 0 auto; }
.preview-paper .p-receipt { width: 76mm; margin: 0 auto; padding: 4mm; }
.preview-paper .p-labels { width: 194mm; margin: 0 auto; padding: 4mm; }

.p-a4, .p-receipt, .p-labels {
  color: #111; background: #fff;
  font-family: Tahoma, "Segoe UI", "Noto Naskh Arabic", "Arial", sans-serif;
  line-height: 1.45;
}
.p-a4 { font-size: 11pt; }
.p-a4 .p-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; border-bottom: 2px solid #111; padding-bottom: 5mm; }
.p-brand { display: flex; gap: 4mm; align-items: center; }
.p-logo { width: 20mm; height: 20mm; display: grid; place-items: center; overflow: hidden; }
.p-logo img { max-width: 100%; max-height: 100%; }
.p-logo-text { background: #111; color: #e8a33d; font-weight: 800; font-size: 12pt; letter-spacing: .06em; border-radius: 3mm; }
.p-brand-text h1 { font-size: 19pt; margin: 0; letter-spacing: .02em; }
.p-brand-en { font-size: 9.5pt; color: #444; letter-spacing: .08em; }
.p-brand-small { font-size: 8.5pt; color: #555; }
.p-doc { text-align: left; min-width: 52mm; }
.p-doc h2 { font-size: 15pt; margin: 0 0 2mm; color: #111; }
.p-meta-row { display: flex; justify-content: space-between; gap: 6mm; font-size: 9pt; border-bottom: 1px dotted #bbb; padding: 1mm 0; }
.p-meta-row span { color: #555; }
.p-info { display: flex; justify-content: space-between; gap: 6mm; font-size: 9.5pt; margin: 4mm 0; }
.p-info span { color: #555; }
.p-table { width: 100%; border-collapse: collapse; margin: 4mm 0; font-size: 9.5pt; }
.p-table th, .p-table td { border: 1px solid #333; padding: 1.8mm 2mm; text-align: center; }
.p-table th { background: #eee; font-weight: 700; font-size: 9pt; }
.p-table .p-name { text-align: right; }
.p-table td.p-name { text-align: right; }
.p-totals-wrap { display: flex; justify-content: flex-start; margin-top: 3mm; }
.p-totals { width: 78mm; border: 1px solid #333; }
.p-totals > div { display: flex; justify-content: space-between; padding: 1.6mm 2.5mm; border-bottom: 1px solid #ddd; font-size: 9.5pt; }
.p-totals > div:last-child { border-bottom: 0; }
.p-totals .p-grand { background: #f0f0f0; font-weight: 700; font-size: 11pt; }
.p-totals .p-due { color: #a11; font-weight: 700; }
.p-note { font-size: 9pt; margin-top: 3mm; border-top: 1px dotted #999; padding-top: 2mm; }
.p-sign { display: flex; justify-content: space-between; gap: 20mm; margin: 10mm 0 5mm; font-size: 9pt; }
.p-sign > div { flex: 1; border-top: 1px solid #333; padding-top: 2mm; text-align: center; }
.p-foot { border-top: 1px solid #333; margin-top: 4mm; padding-top: 2mm; text-align: center; font-size: 8.5pt; color: #444; }
.p-thanks { font-size: 10pt; font-weight: 700; color: #111; margin-bottom: 1mm; }
.p-foot-line { font-size: 8pt; }
.p-sub { font-size: 9pt; color: #555; margin: 3mm 0; }

/* 80mm thermal receipt */
.p-receipt { width: 72mm; font-size: 9.5pt; }
.r-head { text-align: center; margin-bottom: 2mm; }
.r-logo { max-width: 18mm; max-height: 18mm; }
.r-shop { font-size: 15pt; font-weight: 800; }
.r-shop-en { font-size: 8.5pt; letter-spacing: .12em; color: #333; }
.r-small { font-size: 7.5pt; color: #444; }
.r-title { text-align: center; font-size: 10pt; font-weight: 700; border-top: 1px dashed #333; border-bottom: 1px dashed #333; padding: 1mm 0; margin: 2mm 0; }
.r-meta { display: flex; justify-content: space-between; font-size: 8pt; }
.r-sep { border-top: 1px dashed #333; margin: 2mm 0; }
.r-line { margin-bottom: 1.6mm; }
.r-name { font-size: 8.6pt; font-weight: 700; }
.r-calc { display: flex; justify-content: space-between; font-size: 8.4pt; }
.r-tot { display: flex; justify-content: space-between; font-size: 8.8pt; padding: .4mm 0; }
.r-tot.big { font-size: 12pt; font-weight: 800; border-top: 1px solid #333; border-bottom: 1px solid #333; padding: 1.2mm 0; margin: .8mm 0; }
.r-barcode { text-align: center; margin: 2mm 0 1mm; }
.r-barcode svg { width: 58mm; height: 12mm; }
.r-thanks { text-align: center; font-size: 8.5pt; font-weight: 700; margin-top: 1mm; }

/* barcode labels: 3 x 8 on A4 */
.p-labels { display: grid; grid-template-columns: repeat(3, 63.5mm); gap: 0; }
.lbl {
  width: 63.5mm; height: 38mm; padding: 1.6mm 2mm; box-sizing: border-box;
  border: 1px dashed #bbb; display: flex; flex-direction: column; overflow: hidden;
  page-break-inside: avoid; break-inside: avoid;
}
.lbl-shop { font-size: 6.5pt; letter-spacing: .18em; color: #555; text-align: center; }
.lbl-name { font-size: 8pt; font-weight: 700; text-align: center; line-height: 1.15; height: 6mm; overflow: hidden; }
.lbl-meta { font-size: 7pt; color: #333; text-align: center; height: 3.4mm; }
.lbl-code { flex: 1; display: grid; place-items: center; }
.lbl-code svg { width: 52mm; height: 10mm; }
.lbl-foot { display: flex; justify-content: space-between; font-size: 7.5pt; font-weight: 700; }
.lbl-foot span { font-family: "Courier New", monospace; font-weight: 400; letter-spacing: .02em; }

/* generic report rows */
.p-table-plain { margin-top: 4mm; }
.p-row { display: flex; border-bottom: 1px solid #ddd; padding: 1.6mm 2mm; font-size: 9pt; }
.p-row span { flex: 1; text-align: right; }
.p-row span:first-child { text-align: right; }
.p-row-head { background: #eee; font-weight: 700; border-bottom: 1px solid #333; }

/* ---------- print ---------- */
@page { size: A4; margin: 0; }
@page a4page { size: A4; margin: 0; }
@page receiptpage { size: 80mm auto; margin: 0; }
@page labelpage { size: A4; margin: 0; }

.p-a4 { page: a4page; }
.p-receipt { page: receiptpage; }
.p-labels { page: labelpage; }

@media print {
  html, body { background: #fff !important; margin: 0 !important; padding: 0 !important; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block !important; }
  #print-root .p-a4 { width: 210mm; padding: 12mm; box-sizing: border-box; font-size: 10.5pt; }
  #print-root .p-receipt { width: 80mm; padding: 4mm; box-sizing: border-box; }
  #print-root .p-labels { width: 210mm; padding: 8mm; box-sizing: border-box; }
  .p-table th { background: #eee !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .p-totals .p-grand { background: #f0f0f0 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .lbl { border-color: #ddd; }
}

/* printed documents in English (LTR) */
[dir="ltr"] .p-table .p-name, [dir="ltr"] .p-table td.p-name { text-align: left; }
[dir="ltr"] .p-row span, [dir="ltr"] .p-row span:first-child { text-align: left; }
[dir="ltr"] .p-doc { text-align: right; }
