/* Quote / invoice sheet. Mirrors the DRAP quote layout (A4). */
.sheet {
  --red: #b3122d;
  --navy: #1f4e79;
  --rule: #b2b2b2;
  --stripe: #e6e6e6;
  box-sizing: border-box;
  width: 210mm;
  min-height: 297mm;
  padding: 7mm 12mm 5mm;
  margin: 0 auto;
  background: #fff;
  color: #000;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 8.6pt;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
}
.sheet *, .sheet *::before, .sheet *::after { box-sizing: border-box; }
.sheet p { margin: 0; }

/* Header */
.sh-top { display: grid; grid-template-columns: 1fr 84mm; column-gap: 6mm; }
.sh-logo { width: 50mm; height: auto; display: block; margin: 0 0 2mm 2mm; }
.sh-co { color: var(--navy); font-size: 8.4pt; }
.sh-co p { margin: 0 0 1.7mm; }
.sh-co p:last-child { margin: 0; }
.sh-title { text-align: right; color: var(--red); font-weight: 700; font-size: 24pt; line-height: 1; margin: 0 0 7mm; }
.sh-meta { display: grid; grid-template-columns: 1fr 58mm; row-gap: 0; align-items: stretch; }
.sh-meta dt { white-space: nowrap; text-align: right; padding: 1.3mm 3.5mm 0 0; font-size: 8.4pt; }
.sh-meta dd { margin: 0; border: 1px solid var(--rule); border-top-width: 0; padding: 1.1mm 4mm; min-height: 5.6mm; font-size: 8.4pt; }
.sh-meta dd:first-of-type { border-top-width: 1px; }

/* Customer + description */
.sh-parties { display: grid; grid-template-columns: 66mm 1fr; column-gap: 23mm; margin-top: 1.4mm; }
.sh-bar { background: var(--red); color: #fff; font-weight: 700; font-size: 10pt; padding: 1.3mm 4mm; }
.sh-cust { padding: 3mm 0 0 4mm; font-size: 8.4pt; }
.sh-cust p { margin: 0 0 1.7mm; min-height: 1em; }
.sh-desc-box { border: 1px solid var(--rule); border-top: 0; min-height: 25mm; padding: 2mm 4mm; font-size: 8.4pt; white-space: pre-line; }

/* Items */
.sh-items { width: 100%; border-collapse: collapse; margin-top: 2.6mm; font-size: 8.6pt; table-layout: fixed; }
.sh-items th { background: var(--red); color: #fff; font-weight: 700; text-align: left; padding: 1.1mm 2mm; font-size: 8.6pt; border-left: 1px solid #fff; }
.sh-items th:first-child { padding-left: 4mm; border-left: 0; }
.sh-items th.c { text-align: center; }
.sh-items td { padding: 0 2mm; height: 3.7mm; line-height: 1.1; border-left: 1px solid var(--rule); vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sh-items td:first-child { border-left: 1px solid var(--rule); padding-left: 4mm; white-space: normal; }
.sh-items td:last-child { border-right: 1px solid var(--rule); }
.sh-items tbody tr:nth-child(odd) td { background: var(--stripe); }
.sh-items tbody tr:last-child td { border-bottom: 1px solid var(--rule); }
.sh-items .n { text-align: right; }
.sh-items col.q { width: 16mm; }
.sh-items col.c { width: 28mm; }
.sh-items col.t { width: 32mm; }

/* Notes + totals */
.sh-bottom { display: grid; grid-template-columns: 1fr 74mm; column-gap: 0; margin-top: 2.6mm; }
.sh-notes { border: 1px solid var(--rule); border-top: 0; padding: 1.6mm 1mm 1.4mm; font-size: 5.9pt; line-height: 1.32; min-height: 30mm; }
.sh-notes ol { margin: 0; padding-left: 3.2mm; }
.sh-totals { display: grid; grid-template-columns: 1fr 9mm 32mm; align-content: start; padding: 0.6mm 0 0 15mm; font-size: 10pt; row-gap: 0; }
.sh-totals > span { padding: 0.9mm 0; min-height: 5.4mm; }
.sh-totals .v { text-align: right; padding-right: 2mm; }
.sh-totals .box { border: 1px solid var(--rule); }
.sh-totals .box-l { border: 1px solid var(--rule); border-right: 0; padding-left: 1mm; }
.sh-totals .box-r { border: 1px solid var(--rule); border-left: 0; }
.sh-totals .grand { font-weight: 700; padding-top: 2.6mm; }

/* Footer */
.sh-foot { text-align: center; font-size: 8pt; margin-top: 3.5mm; }
.sh-foot p { margin: 0 0 0.3mm; }
.sh-confirm { margin-top: 5mm !important; }
.sh-sign { display: grid; grid-template-columns: 52mm 56mm 1fr; column-gap: 15mm; margin-top: 2.6mm; text-align: left; }
.sh-sign span { border: 1px solid var(--rule); color: #b2b2b2; font-size: 8pt; padding: 3mm 0.6mm 0.4mm; }
.sh-thanks { font-size: 12.4pt; font-weight: 700; margin-top: 2.6mm !important; }
.sh-enq { margin-top: 2.5mm !important; }
.sh-addr { border-top: 1px solid #000; margin-top: 2.6mm; padding-top: 2.6mm; }
.sh-addr p { margin-bottom: 2.2mm; }
.sh-spacer { flex: 1 1 auto; }

@media print {
  @page { size: A4; margin: 0; }
  .sheet { margin: 0; box-shadow: none !important; min-height: 0; height: 296.5mm; overflow: hidden; }
  .sheet + .sheet { break-before: page; }
  .sheet.long { height: auto; overflow: visible; }
  .sh-items tr { break-inside: avoid; }
  .sh-items tbody tr, .sh-items th { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .sh-bar, .sh-items th, .sh-items td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
