/* ==========================================================================
   1REY — Printable report / invoice document
   ========================================================================== */
#printRoot { display: none; }

.print-doc {
  direction: rtl;
  font-family: "Vazirmatn", Tahoma, sans-serif;
  color: #17171c;
  background: #fff;
  width: 100%;
  max-width: 194mm;
  margin: 0 auto;
  font-size: 10.5px;
  line-height: 1.9;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}
.print-doc * { box-sizing: border-box; }
.print-doc h1, .print-doc h2, .print-doc h3, .print-doc p { color: inherit; margin: 0; }

.pd-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 2px solid #c9973e;
}
.pd-head img { width: 42px; height: 42px; }
.pd-brand { line-height: 1.5; }
.pd-brand b { display: block; font-size: 14px; font-weight: 800; color: #17171c; }
.pd-brand span { display: block; font-size: 8px; color: #8a7a5a; }
.pd-head-right { margin-inline-start: auto; text-align: left; font-size: 8.5px; color: #6b6b74; line-height: 1.7; }
.pd-head-right b { color: #17171c; font-size: 9.5px; direction: ltr; display: block; }
.pd-demo { display: inline-block; margin-top: 2px; padding: 1px 4px; border: 1px solid #d9a441; border-radius: 3px; color: #8a6423; font-size: 7px; font-weight: 700; }

.pd-title { margin: 18px 0 4px; font-size: 18px; font-weight: 800; color: #17171c; }
.pd-sub { font-size: 9px; color: #77747a; margin-bottom: 14px; }

.pd-meta {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid #e3dccb;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 16px;
}
.pd-meta > div { padding: 7px 9px; border-inline-start: 1px solid #efe9db; }
.pd-meta > div:first-child { border-inline-start: 0; }
.pd-meta span { display: block; font-size: 7.5px; color: #8b8880; }
.pd-meta b { font-size: 9px; color: #17171c; font-weight: 700; }

.pd-section { margin-bottom: 14px; page-break-inside: avoid; }
.pd-section h2 {
  font-size: 10.5px;
  font-weight: 800;
  color: #17171c;
  padding-bottom: 5px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e9e2d3;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pd-section h2::before { content: ""; width: 14px; height: 2px; background: #c9973e; display: inline-block; }

.pd-table { width: 100%; border-collapse: collapse; font-size: 8.5px; }
.pd-table th {
  text-align: right;
  background: #faf7ef;
  color: #7b725d;
  font-weight: 600;
  padding: 5px 7px;
  border: 1px solid #ede6d7;
  font-size: 7.5px;
}
.pd-table td { padding: 5px 7px; border: 1px solid #f0ebe0; color: #2a2a30; }
.pd-table tr:nth-child(even) td { background: #fdfcf9; }
.pd-table .ok { color: #1c7d54; font-weight: 700; }
.pd-table .warn { color: #9a6b0d; font-weight: 700; }
.pd-table .bad { color: #b03838; font-weight: 700; }

.pd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: #ece5d6;
  border: 1px solid #ece5d6;
  border-radius: 6px;
  overflow: hidden;
}
.pd-grid > div { background: #fff; padding: 6px 9px; }
.pd-grid span { display: block; font-size: 7.5px; color: #8b8880; }
.pd-grid b { font-size: 8.8px; color: #17171c; font-weight: 600; }

.pd-ai {
  background: #fbf7ec;
  border: 1px solid #e8d9b6;
  border-radius: 7px;
  padding: 9px 11px;
  margin-bottom: 14px;
  page-break-inside: avoid;
}
.pd-ai h2 { border: 0; padding: 0; margin-bottom: 4px; font-size: 10px; }
.pd-ai .verdict { font-weight: 700; font-size: 9.5px; margin-bottom: 3px; color: #3d2f11; }
.pd-ai p { font-size: 8.5px; line-height: 1.9; color: #4b4a50; }
.pd-ai ul { margin: 5px 0 0; padding: 0; list-style: none; }
.pd-ai li { font-size: 8px; color: #665c46; margin-bottom: 2px; }
.pd-ai li::before { content: "•"; color: #c08f37; margin-inline-end: 4px; }

.pd-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #e9e2d3;
  padding-top: 10px;
  margin-top: 16px;
  page-break-inside: avoid;
}
.pd-qr { width: 66px; height: 66px; padding: 3px; border: 1px solid #e8dfcc; border-radius: 5px; background: #fff; flex: none; }
.pd-qr svg { width: 100%; height: 100%; }
.pd-verify { flex: 1; font-size: 8px; color: #6f6c66; line-height: 1.9; }
.pd-verify b { display: block; color: #17171c; font-size: 9px; margin-bottom: 2px; }
.pd-verify .ref { direction: ltr; color: #8a6423; font-weight: 700; display: inline-block; }
.pd-sign {
  width: 150px;
  flex: none;
  text-align: center;
  border: 1px dashed #d9cfba;
  border-radius: 5px;
  padding: 8px 6px 4px;
  font-size: 7.5px;
  color: #8b8880;
  line-height: 1.6;
}
.pd-sign .stamp {
  width: 58px;
  height: 58px;
  margin: 0 auto 3px;
  border: 1.5px solid #c9973e;
  border-radius: 50%;
  color: #b5852f;
  display: grid;
  place-items: center;
  font-size: 7px;
  font-weight: 800;
  transform: rotate(-7deg);
  line-height: 1.4;
}
.pd-copy { text-align: center; font-size: 7px; color: #a29d92; margin-top: 6px; }

/* ---------- invoice doc ---------- */
.pd-invoice-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 16px 0; }
.pd-invoice-title h1 { font-size: 20px; font-weight: 800; }
.pd-invoice-title p { font-size: 8.5px; color: #7e7b76; }
.pd-inv-badge {
  border: 1px solid #d8c9a6;
  background: #fbf7ec;
  color: #8a6423;
  border-radius: 5px;
  padding: 4px 10px;
  font-size: 8px;
  font-weight: 700;
}
.pd-party { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.pd-party > div { border: 1px solid #ece5d6; border-radius: 6px; padding: 8px 10px; }
.pd-party span { font-size: 7.5px; color: #8b8880; display: block; }
.pd-party b { font-size: 9.5px; color: #17171c; display: block; margin-bottom: 2px; }
.pd-party p { font-size: 8px; color: #6f6c66; }
.pd-totals { display: flex; justify-content: flex-end; margin-top: 10px; }
.pd-totals table { width: 250px; border-collapse: collapse; font-size: 8.5px; }
.pd-totals td { padding: 4px 8px; border-bottom: 1px solid #f0ebe0; }
.pd-totals td:last-child { text-align: left; font-weight: 600; }
.pd-totals tr.grand td { background: #fbf7ec; border-top: 1px solid #d8c9a6; font-weight: 800; font-size: 10px; color: #17171c; }
.pd-note { font-size: 8px; color: #77747a; border-top: 1px dashed #e3dccb; margin-top: 14px; padding-top: 8px; }

@media print {
  @page { size: A4; margin: 12mm; }
  html, body {
    background: #fff !important;
    color: #111 !important;
  }
  body::before, body::after { display: none !important; }
  body > *:not(#printRoot) { display: none !important; }
  #printRoot { display: block !important; }
  .print-doc { max-width: none; font-size: 10px; }
  .pd-section { page-break-inside: avoid; }
}
