/* ============================================================
   Print styles — quotation / order documents.
   #print-root is hidden on screen; when printing, ONLY it shows.
   Direction comes from #print-root[dir], independent of the app.
   ============================================================ */

#print-root {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 20mm;              /* ~2 cm standard business margins */
  }

  /* show only the document */
  body > *:not(#print-root) {
    display: none !important;
  }
  #print-root {
    display: block !important;
  }

  html, body {
    background: #fff !important;
    color: #1a2333 !important;
    font-size: 12pt;          /* readable body text */
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* A4 business document (also used by the on-screen preview sheet) */
.doc {
  font-family: 'Plus Jakarta Sans', 'Noto Sans Arabic', Arial, sans-serif;
  color: #1a2333;
  background: #fff;
  font-size: 12pt;
  line-height: 1.5;
}
.doc[dir='rtl'] {
  font-family: 'Noto Sans Arabic', 'Plus Jakarta Sans', Arial, sans-serif;
}

/* --- header: brand/logo left, document reference right --- */
.doc-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 14px;
  border-bottom: 2.5px solid #0b5ed7;
}
.doc-brand { display: flex; flex-direction: column; gap: 8px; }
.doc-brand img.doc-logo { height: 30px; width: auto; }
.doc-company .co-name { font-weight: 800; font-size: 12.5pt; color: #063a8c; }
.doc-company .co-sub { font-size: 9.5pt; color: #5d6d87; }

.doc-title { text-align: end; }
.doc-title h1 {
  font-size: 20pt;
  font-weight: 800;
  color: #0b5ed7;
  margin: 0 0 6px;
  letter-spacing: 0.02em;
}
.doc-refs { border-collapse: collapse; margin-inline-start: auto; font-size: 10.5pt; }
.doc-refs td { padding: 1px 0; }
.doc-refs .k { color: #5d6d87; font-weight: 600; padding-inline-end: 12px; text-align: start; }
.doc-refs .v { font-weight: 800; text-align: end; }

/* --- prepared-for line --- */
.doc-billto {
  margin: 16px 0 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.doc-billto .k {
  font-size: 9.5pt;
  color: #5d6d87;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.doc-billto .client { font-size: 14pt; font-weight: 800; }

/* --- line-items table --- */
table.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11pt;
}
.doc-table col.c-no { width: 8%; }
.doc-table col.c-desc { width: 48%; }
.doc-table col.c-qty { width: 14%; }
.doc-table col.c-price { width: 15%; }
.doc-table col.c-amt { width: 15%; }
.doc-table th {
  background: #eef4ff;
  color: #063a8c;
  font-weight: 800;
  font-size: 10pt;
  text-align: start;
  padding: 9px 10px;
  border-bottom: 2px solid #0b5ed7;
}
.doc-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #e3eaf6;
  vertical-align: top;
}
.doc-table tbody tr:nth-child(even) td { background: #fafcff; }
.doc-table tr { break-inside: avoid; }
.doc-table .num-cell {
  text-align: end;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.doc-table .desc .art {
  font-weight: 800;
  color: #063a8c;
  margin-inline-end: 6px;
}
.doc-table .desc .dn { font-weight: 600; }
.doc-table .desc .sub,
.doc-table .num-cell .sub {
  display: block;
  font-size: 8.5pt;
  color: #6b7a92;
  font-weight: 600;
  margin-top: 2px;
}
.doc-table .amount { font-weight: 800; }

/* --- totals --- */
.doc-summary { display: flex; justify-content: flex-end; margin-top: 14px; }
.doc-totals {
  border-collapse: collapse;
  min-width: 250px;
  font-size: 11.5pt;
  break-inside: avoid;
}
.doc-totals td { padding: 5px 0; }
.doc-totals td:first-child { color: #5d6d87; padding-inline-end: 28px; }
.doc-totals .grand td {
  border-top: 2px solid #0b5ed7;
  padding-top: 9px;
  font-size: 13.5pt;
  font-weight: 800;
  color: #063a8c;
}

/* --- footer: notes + signature --- */
.doc-foot {
  margin-top: 34px;
  padding-top: 12px;
  border-top: 1px solid #cdd9ec;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  font-size: 9pt;
  color: #5d6d87;
  break-inside: avoid;
}
.doc-foot .notes { max-width: 60%; line-height: 1.6; }
.doc-foot .sig { min-width: 190px; text-align: center; }
.doc-foot .sig .line {
  border-top: 1px solid #1a2333;
  margin-bottom: 4px;
  height: 34px;
}
.doc-foot .sig > div:last-child { color: #1a2333; font-weight: 700; }

/* numbers always LTR inside the document too */
.doc bdi,
.doc .ltr {
  direction: ltr;
  unicode-bidi: isolate;
}
