/* =========================================
   DOCUMENTS — receipt, sales invoice, purchase request, delivery receipt,
   receiving report (built in app.js; shown in modals and order previews)
   ========================================= */

/* =========================================
   RECEIPT
   ========================================= */
.receipt { padding: 30px; max-width: 550px; margin: 0 auto; background: #fff; }
.receipt-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 0.85rem; }
.receipt-row.total { font-weight: 800; font-size: 1rem; margin-top: 8px; color: var(--primary); }

/* Sales Invoice — mirrors the printed Y.Kash booklet (always black-on-white, like paper) */
.receipt.si { max-width: 720px; padding: 24px; color: #111; font-family: Arial, Helvetica, sans-serif; font-size: 11px; line-height: 1.3; }
.si table { width: 100%; border-collapse: collapse; }
.si td, .si th { border: 1px solid #222; padding: 4px 6px; color: #111; vertical-align: middle; }
.si .si-r { text-align: right; white-space: nowrap; }
.si .si-c { text-align: center; }
.si-head { text-align: center; margin-bottom: 10px; font-size: 10.5px; }
.si-company { font-size: 22px; font-weight: 900; letter-spacing: 0.3px; line-height: 1.15; margin-bottom: 2px; }
.si-title-row { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 4px; }
.si-title { font-size: 18px; font-weight: 900; font-family: Georgia, 'Times New Roman', serif; }
.si-title-sm { font-size: 14px; font-family: Arial, Helvetica, sans-serif; }
.si-no { color: #c62828; font-size: 15px; }
.si-no strong { font-family: 'Courier New', monospace; font-weight: 700; margin-left: 6px; }
.si-type-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: -1px; }
.si-types { display: flex; gap: 16px; font-size: 11px; }
.si-types label, .si-received label { display: inline-flex; align-items: center; gap: 5px; }
.si-box { display: inline-flex; align-items: center; justify-content: center; width: 12px; height: 12px; border: 1.5px solid #222; font-size: 10px; font-weight: 700; line-height: 1; }
.si-date { border: 1px solid #222; border-bottom: none; padding: 4px 8px; min-width: 200px; }
.si-date span, .si-party span { font-weight: 600; margin-right: 4px; }
.si-party td { height: 22px; }
.si-items { margin-top: -1px; }
.si-items th { font-weight: 700; font-size: 11px; text-align: center; padding: 6px; }
.si-items tbody td { height: 20px; border-top: none; border-bottom: 1px solid #555; }
.si-bottom { display: grid; grid-template-columns: 1fr 1.15fr; margin-top: -1px; }
.si-vat { align-self: start; }
.si-vat td { height: 22px; }
.si-totals td:first-child { text-align: right; font-size: 10.5px; }
.si-totals td:last-child { width: 38%; }
.si-totals .si-due td { font-weight: 800; font-size: 12px; }
.si-received { padding: 8px 12px 0 0; }
.si-line { border-bottom: 1px solid #222; min-height: 18px; margin-top: 6px; padding: 2px 0; font-style: italic; }
.si-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 28px; }
.si-meta { font-size: 10px; color: #444; }
.si-sign { text-align: center; font-weight: 600; min-width: 220px; }
.si-sign-line { border-bottom: 1px solid #222; min-height: 24px; margin-bottom: 4px; display: flex; align-items: flex-end; justify-content: center; font-size: 12px; font-weight: 700; text-transform: uppercase; padding-bottom: 2px; }
/* Multi-sheet documents: each .doc-page is one printed sheet */
.doc-pages { display: flex; flex-direction: column; gap: 16px; background: #fff; }
.doc-pages > .doc-page + .doc-page { border-top: 2px dashed #c7d0dc; padding-top: 32px; }
.si-no-wrap { text-align: right; }
.doc-page-no { font-size: 10px; font-weight: 700; color: #444; margin-top: 2px; letter-spacing: 0.3px; }
.doc-page { position: relative; overflow: hidden; }
.doc-watermark { position: absolute; top: 45%; left: 50%; transform: translate(-50%, -50%) rotate(-28deg); font-size: 96px; font-weight: 900; letter-spacing: 8px; color: rgba(220, 38, 38, 0.16); border: 8px solid rgba(220, 38, 38, 0.16); padding: 4px 28px; border-radius: 12px; pointer-events: none; white-space: nowrap; z-index: 2; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc-continued { margin-top: 10px; text-align: right; font-style: italic; font-weight: 700; font-size: 11px; color: #333; }

/* Purchase Request — mirrors the printed Y.Kash PR form */
.pr-brand { text-align: center; font-size: 11px; font-weight: 800; letter-spacing: 1.5px; color: #444; }
.pr-title { text-align: center; font-size: 22px; font-weight: 800; margin: 4px 0 2px; letter-spacing: 0.3px; }
.pr-ref { display: flex; justify-content: flex-end; gap: 16px; font-size: 10.5px; color: #333; margin-bottom: 8px; }
.pr-head-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; margin-bottom: 4px; }
.pr-field { display: flex; align-items: flex-end; gap: 6px; font-weight: 700; }
.pr-field .dr-fill { font-weight: 400; }
.pr-items th { font-weight: 700; font-size: 11px; text-align: center; padding: 5px; }
.pr-items tbody td { height: 21px; border-top: none; border-bottom: 1px solid #555; }
.pr-items tfoot td { height: 24px; }
.pr-items .pr-blank-foot { border: none; border-top: 1px solid #222; }
.pr-total-label { text-align: center; font-weight: 700; font-size: 11px; }
.pr-total { font-weight: 800; font-size: 12px; }
.pr-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 36px; }
.pr-signs { display: flex; gap: 28px; }
.pr-signs .si-sign { min-width: 180px; }

/* Delivery Receipt — mirrors the printed Y.Kash DR booklet */
.dr-title { font-size: 18px; font-weight: 900; letter-spacing: 0.5px; }
.dr-fields { display: grid; grid-template-columns: 1.7fr 1fr; gap: 4px 24px; margin: 8px 0 10px; }
.dr-field { display: flex; align-items: flex-end; gap: 6px; min-height: 22px; }
.dr-field > span:first-child { white-space: nowrap; font-family: Georgia, 'Times New Roman', serif; }
.dr-fill { flex: 1; border-bottom: 1px solid #222; padding: 0 4px 1px; min-height: 16px; }
.dr-items { border-top: 3px double #222; }
.dr-items td, .dr-items th { border-left: none; border-right: 1px solid #222; }
.dr-items td:last-child, .dr-items th:last-child { border-right: none; }
.dr-items th { font-family: Georgia, 'Times New Roman', serif; font-weight: 700; padding: 6px; }
.dr-items .dr-desc-head { letter-spacing: 3px; }
.dr-items tbody td { height: 22px; border-top: none; border-bottom: 1px solid #555; }
.dr-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-top: 14px; }
.dr-disclaimer { font-weight: 800; font-size: 10.5px; white-space: nowrap; }
.dr-received { margin-top: 8px; text-align: right; font-style: italic; font-weight: 700; font-family: Georgia, 'Times New Roman', serif; font-size: 10.5px; }
.dr-by { display: flex; align-items: flex-end; gap: 6px; font-weight: 700; }

@media (max-width: 640px) {
  .dr-fields, .pr-head-row { grid-template-columns: 1fr; }
  .pr-foot { flex-direction: column; align-items: stretch; }
  .pr-signs { justify-content: space-between; gap: 12px; }
  .pr-signs .si-sign { min-width: 0; flex: 1; }
  .dr-foot { flex-direction: column-reverse; align-items: stretch; }
  .dr-by { justify-content: flex-end; }
  .dr-disclaimer { white-space: normal; }
  .receipt.si { padding: 10px; font-size: 9.5px; }
  .si-company { font-size: 16px; }
  .si-bottom { grid-template-columns: 1fr; }
  .si-received { padding-right: 0; margin-bottom: 8px; }
  .si-date { min-width: 0; }
}

.rr-remarks { font-size: 10px; }
