/* Malik Solar Tech Agency — Bill templates (Normal + Solar)
   Colors & layout matched from original proforma invoices */

:root {
  --teal: #008fb5;
  --dark: #222831;
  --red: #d7193f;
  --red-text: #be283a;
  --ink: #1e1e1e;
  --page-w: 210mm;
  --page-h: 297mm;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.bill-page {
  width: var(--page-w);
  min-height: var(--page-h);
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  color: #000;
  position: relative;
  padding: 14mm 12mm 18mm;
  overflow: hidden;
}

/* ===== HEADER ===== */
.bill-header-block {
  background: var(--teal);
}

.bill-header {
  display: flex;
  background: var(--teal);
  height: 21mm;
  align-items: stretch;
}

.bill-logo-wrap {
  width: 26mm;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 2mm 1.5mm;
}

.bill-logo-wrap img {
  max-width: 100%;
  max-height: 16mm;
  object-fit: contain;
  display: block;
}

.bill-contact {
  flex: 1;
  color: #fff;
  font-size: 8pt;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 3mm 0 1mm;
  line-height: 1.35;
}

.bill-contact-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0;
}

.bill-contact .icon {
  margin-right: 1.5mm;
  font-style: normal;
  font-weight: 400;
}

.bill-contact .sep {
  margin: 0 2.5mm;
  font-weight: 700;
}

.bill-contact .loc-line {
  font-weight: 400;
  margin-top: 0.5mm;
  padding-left: 0;
}

.bill-company {
  font-size: 17pt;
  font-weight: 700;
  color: #fff;
  background: var(--teal);
  margin-top: 0;
  letter-spacing: 0.2px;
  line-height: 1.15;
  padding: 2mm 3mm 2.5mm;
}

.bill-gstin-bar {
  background: var(--dark);
  color: #fff;
  font-size: 8pt;
  font-weight: 700;
  padding: 1.8mm 3mm;
  margin-top: 0;
}

/* ===== META ===== */
.bill-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 5mm;
  gap: 8mm;
}

.bill-meta-left .label-for {
  font-size: 14pt;
  font-weight: 700;
  margin-bottom: 1.5mm;
}

.bill-type-solar .bill-meta-left .label-for {
  font-size: 10pt;
}

.bill-meta-left .customer-name,
.bill-meta-left .customer-address {
  font-size: 10pt;
  font-weight: 700;
  line-height: 1.35;
}

.bill-meta-right {
  text-align: left;
  font-size: 10pt;
  font-weight: 700;
  line-height: 1.45;
  min-width: 48mm;
  padding-top: 1mm;
}

/* ===== TABLE ===== */
.bill-table-wrap {
  margin-top: 5mm;
}

.bill-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.bill-table th {
  background: var(--red);
  color: #fff;
  font-size: 8pt;
  font-weight: 700;
  padding: 2.2mm 1.5mm;
  text-align: center;
  vertical-align: middle;
  border: none;
}

.bill-table th.qty-h {
  line-height: 1.05;
}

.bill-table td {
  font-size: 8pt;
  padding: 2.2mm 1.5mm;
  vertical-align: middle;
  border: none;
  color: var(--ink);
}

.bill-table tbody tr {
  border-bottom: 0.3pt solid #e8e8e8;
}

.bill-table .col-num { width: 7%; text-align: center; }
.bill-table .col-item { width: 32%; text-align: left; font-weight: 700; }
.bill-table .col-hsn { width: 12%; text-align: center; font-weight: 400; }
.bill-table .col-qty { width: 9%; text-align: center; }
.bill-table .col-unit { width: 8%; text-align: center; }
.bill-table .col-price { width: 14%; text-align: center; }
.bill-table .col-gst { width: 10%; text-align: center; }
.bill-table .col-amt { width: 16%; text-align: right; padding-right: 3mm; }

.bill-type-normal .col-item { width: 34%; }
.bill-type-normal .col-amt { width: 18%; }

.bill-table .tfoot-row td {
  background: var(--red);
  color: #fff;
  font-weight: 700;
  padding: 1.8mm 1.5mm;
  border: none;
}

.bill-table .item-name {
  font-weight: 700;
  color: #1e1e1e;
  line-height: 1.25;
}

/* ===== SUMMARY / PAY TO ===== */
.bill-lower {
  display: flex;
  justify-content: space-between;
  margin-top: 6mm;
  gap: 6mm;
  align-items: flex-start;
}

.bill-payto {
  flex: 1;
  max-width: 58%;
}

.bill-payto h3 {
  color: var(--red-text);
  font-size: 11pt;
  font-weight: 700;
  margin-bottom: 2.5mm;
}

.bill-payto p {
  font-size: 10pt;
  font-weight: 700;
  line-height: 1.55;
}

.bill-summary {
  width: 48%;
  margin-left: auto;
}

.bill-type-solar .bill-summary {
  width: 42%;
  flex-shrink: 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 8pt;
  font-weight: 700;
  color: #141414;
  padding: 1.6mm 2mm;
}

.summary-row.grand {
  background: var(--red);
  color: #fff;
  margin-top: 0;
}

.bill-type-normal .bill-lower {
  justify-content: flex-end;
}

.bill-type-normal .bill-summary {
  width: 48%;
}

/* ===== WORDS / TERMS / SIGN ===== */
.bill-words {
  margin-top: 8mm;
}

.bill-words h3,
.bill-terms h3 {
  color: var(--red-text);
  font-size: 11pt;
  font-weight: 700;
  margin-bottom: 2mm;
}

.bill-words p {
  font-size: 11pt;
  font-weight: 700;
  line-height: 1.4;
}

.bill-type-solar .bill-words p {
  font-size: 10pt;
}

.bill-terms {
  margin-top: 5mm;
}

.bill-terms p {
  font-size: 10pt;
  font-weight: 700;
}

.bill-sign {
  margin-top: 6mm;
}

.bill-sign .for-line {
  font-size: 10pt;
  font-weight: 700;
}

.bill-sign .sig-img {
  display: block;
  height: 10mm;
  width: auto;
  margin: 2mm 0 1mm 2mm;
  object-fit: contain;
}

.bill-sign .auth {
  font-size: 9pt;
  font-weight: 700;
  margin-left: 3mm;
}

/* ===== FOOTER BAR ===== */
.bill-footer-bar {
  position: absolute;
  left: 12mm;
  right: 12mm;
  bottom: 10mm;
  height: 11.5mm;
  display: flex;
}

.bill-footer-bar .f-red {
  width: 40%;
  background: var(--red);
}

.bill-footer-bar .f-dark {
  width: 60%;
  background: var(--dark);
}

/* Hide empty payto on normal */
.bill-type-normal .bill-payto {
  display: none;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  html, body {
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
    background: #fff;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .bill-page {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    box-shadow: none;
    page-break-after: always;
  }
}
