<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>REQUEST FOR QUOTATION - {{RFQ_NUMBER}}</title>
    <link href="https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=Source+Serif+4:wght@600;700&display=swap" rel="stylesheet" />

    <style>
      :root {
        --accent: #1a3a5c;
        --accent-light: #e8eef5;
        --border: #d0d7de;
        --text-dark: #111827;
        --text-mid: #374151;
        --text-muted: #6b7280;
        --bg-header: #f0f4f8;
      }

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

      body {
        background: #e9ecef;
        padding: 24px;
        font-family: 'Source Sans 3', Arial, sans-serif;
        color: var(--text-dark);
      }

      .page {
        width: 210mm;
        min-height: 297mm;
        margin: 0 auto;
        background: #fff;
        padding: 28px 32px 28px 32px;
        box-shadow: 0 2px 24px rgba(0,0,0,0.10);
      }

      /* ── HEADER ── */
      .header {
        display: flex;
        align-items: flex-start;
        gap: 20px;
        padding-bottom: 14px;
        border-bottom: 2.5px solid var(--accent);
        margin-bottom: 0;
      }

      .logo-wrap {
        flex-shrink: 0;
        width: 72px;
        height: 72px;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border);
        border-radius: 6px;
        overflow: hidden;
        background: #fff;
      }

      .logo-wrap img {
        width: 100%;
        height: 100%;
        object-fit: contain;
      }

      .logo-fallback {
        font-size: 11px;
        font-weight: 700;
        color: var(--accent);
        text-align: center;
        padding: 4px;
        line-height: 1.3;
      }

      .company-info {
        flex: 1;
        text-align: center;
      }

      .company-info .company-name {
        font-family: 'Source Serif 4', Georgia, serif;
        font-size: 19px;
        font-weight: 700;
        color: var(--accent);
        letter-spacing: 0.3px;
        line-height: 1.3;
        margin-bottom: 5px;
      }

      .company-info p {
        font-size: 12px;
        color: var(--text-mid);
        line-height: 1.6;
      }

      .company-info .meta-row {
        font-size: 11.5px;
        color: var(--text-muted);
        line-height: 1.6;
      }

      /* ── TITLE BAR ── */
      .title-bar {
        background: var(--accent);
        color: #fff;
        text-align: center;
        padding: 7px 0;
        font-family: 'Source Serif 4', Georgia, serif;
        font-size: 16px;
        font-weight: 700;
        letter-spacing: 3px;
        text-transform: uppercase;
        margin-bottom: 0;
      }

      /* ── ADDRESS BLOCK ── */
      .address-grid {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        border: 1px solid var(--border);
        border-top: none;
        margin-bottom: 16px;
      }

      .addr-cell {
        padding: 10px 12px;
        border-right: 1px solid var(--border);
      }

      .addr-cell:last-child {
        border-right: none;
      }

      .addr-label {
        font-size: 9.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1.2px;
        color: var(--text-muted);
        margin-bottom: 5px;
        display: block;
      }

      .addr-name {
        font-size: 13.5px;
        font-weight: 700;
        color: var(--accent);
        line-height: 1.4;
        margin-bottom: 3px;
      }

      .addr-body {
        font-size: 12px;
        color: var(--text-mid);
        line-height: 1.6;
      }

      /* Doc info table inside address cell */
      .doc-header-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 6px;
        padding-bottom: 5px;
        border-bottom: 1px solid var(--border);
      }

      .doc-type-tag {
        font-size: 9.5px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--text-muted);
      }

      .doc-type-val {
        font-size: 10px;
        font-weight: 700;
        color: var(--accent);
        background: var(--accent-light);
        padding: 2px 7px;
        border-radius: 3px;
        letter-spacing: 0.5px;
      }

      .doc-rows {
        width: 100%;
        border-collapse: collapse;
      }

      .doc-rows tr td {
        padding: 3.5px 0;
        font-size: 12px;
        color: var(--text-mid);
        line-height: 1.4;
        vertical-align: top;
        border: none;
      }

      .doc-rows tr td:last-child {
        text-align: right;
        font-weight: 600;
        color: var(--text-dark);
      }

      .status-pill {
        display: inline-block;
        background: #fef3c7;
        color: #92400e;
        font-size: 10px;
        font-weight: 700;
        padding: 1px 7px;
        border-radius: 10px;
        letter-spacing: 0.3px;
      }

      /* ── PRODUCT TABLE ── */
      .product-table {
        width: 100%;
        border-collapse: collapse;
        table-layout: fixed;
        margin-bottom: 0;
        font-size: 12.5px;
      }

      .product-table thead tr th {
        background: var(--accent);
        color: #fff;
        padding: 9px 10px;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.6px;
        border: 1px solid var(--accent);
      }

      .product-table tbody tr td {
        border: 1px solid var(--border);
        padding: 10px 10px;
        font-size: 12.5px;
        color: var(--text-mid);
        vertical-align: middle;
        line-height: 1.5;
      }

      .product-table tbody tr:nth-child(even) td {
        background: #fafbfc;
      }

      .product-table tbody tr:last-child td {
        border-bottom: 2px solid var(--accent);
      }

      /* column widths */
      .col-sl       { width: 5%; }
      .col-product  { width: 30%; }
      .col-uom      { width: 7%; }
      .col-qty      { width: 9%; }
      .col-rate     { width: 10%; }
      .col-disc     { width: 10%; }
      .col-gst      { width: 10%; }
      .col-value    { width: 19%; }

      .item-code {
        font-size: 11.5px;
        font-weight: 700;
        color: var(--accent);
        margin-bottom: 2px;
      }

      .item-name {
        font-size: 12.5px;
        font-weight: 500;
        color: var(--text-dark);
      }

      .item-desc {
        font-size: 11px;
        color: var(--text-muted);
        margin-top: 2px;
      }

      .text-center { text-align: center; }
      .text-right  { text-align: right; }
      .text-left   { text-align: left; }

      /* ── TERMS SECTION ── */
      .terms-section {
        margin-top: 20px;
        border: 1px solid var(--border);
        padding: 15px;
        background: #fafbfc;
      }

      .terms-section .panel-title {
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: var(--accent);
        margin-bottom: 7px;
        padding-bottom: 5px;
        border-bottom: 1px solid var(--accent-light);
      }

      .terms-section .terms-body {
        font-size: 12px;
        color: var(--text-mid);
        line-height: 1.9;
        font-weight: 500;
      }

      /* ── FOOTER ── */
      .footer {
        text-align: center;
        font-size: 11px;
        color: var(--text-muted);
        padding-top: 8px;
        margin-top: 20px;
        border-top: 1px solid var(--border);
        letter-spacing: 0.3px;
      }

      /* ── VENDOR INSTRUCTION ── */
      .instruction-box {
        background: #f0f9ff;
        border-left: 4px solid var(--accent);
        padding: 12px 15px;
        margin: 20px 0 0;
        font-size: 11.5px;
        color: var(--text-mid);
      }

      .instruction-box strong {
        color: var(--accent);
        display: block;
        margin-bottom: 6px;
      }

      /* ── PRINT ── */
      @media print {
        body { background: #fff; padding: 0; }
        .page {
          box-shadow: none;
          width: 100%;
          min-height: auto;
          padding: 16px 20px;
          margin: 0;
        }
      }
    </style>
  </head>

  <body>
    <div class="page">

      <!-- ── HEADER ── -->
      <div class="header">
        <div class="logo-wrap">
          <img
            src="{{COMPANY_LOGO}}"
            alt="Logo"
            onerror="this.style.display='none'; this.nextElementSibling.style.display='flex';"
          />
          <div class="logo-fallback" style="display:none;">{{COMPANY_SHORT}}</div>
        </div>

        <div class="company-info">
          <div class="company-name">{{COMPANY_NAME}}</div>
          <p>{{COMPANY_ADDRESS_LINE1}}</p>
          <p>{{COMPANY_ADDRESS_LINE2}}</p>
          <p class="meta-row">PAN: <strong>{{COMPANY_PAN}}</strong> &nbsp;|&nbsp; GSTIN: <strong>{{COMPANY_GST}}</strong> &nbsp;|&nbsp; CIN: <strong>{{COMPANY_CIN}}</strong></p>
          <p class="meta-row">{{COMPANY_EMAIL}} &nbsp;|&nbsp; {{COMPANY_PHONE}}</p>
        </div>
      </div>

      <!-- ── TITLE BAR ── -->
      <div class="title-bar">REQUEST FOR QUOTATION (RFQ)</div>

      <!-- ── ADDRESS GRID ── -->
      <div class="address-grid">

        <!-- To (Vendor) -->
        <div class="addr-cell">
          <span class="addr-label">To (Vendor)</span>
          <div class="addr-name">{{VENDOR_NAME}}</div>
          <div class="addr-body">
            GSTIN: {{VENDOR_GST}}<br />
            {{VENDOR_ADDRESS}}<br />
            Email: {{VENDOR_EMAIL}}
          </div>
        </div>

        <!-- Supply To -->
        <div class="addr-cell">
          <span class="addr-label">Supply To</span>
          <div class="addr-name">{{COMPANY_NAME}}</div>
          <div class="addr-body">
            {{SUPPLY_ADDRESS}}<br />
            GSTIN: {{COMPANY_GST}}
          </div>
        </div>

        <!-- Doc Details -->
        <div class="addr-cell">
          <div class="doc-header-row">
            <span class="doc-type-tag">Doc Type</span>
            <span class="doc-type-val">RFQ</span>
          </div>
          <table class="doc-rows">
            <tr>
              <td>RFQ No</td>
              <td><strong>{{RFQ_NUMBER}}</strong></td>
            </tr>
            <tr>
              <td>RFQ Date</td>
              <td>{{RFQ_DATE}}</td>
            </tr>
            <tr>
              <td>Deadline</td>
              <td>{{DEADLINE}}</td>
            </tr>
            <tr>
              <td>PR No</td>
              <td>{{PR_NUMBER}}</td>
            </tr>
            <tr>
              <td>Department</td>
              <td>{{DEPARTMENT}}</td>
            </tr>
            <tr>
              <td>Requested By</td>
              <td>{{REQUESTED_BY}}</td>
            </tr>
            <tr>
              <td>Status</td>
              <td><span class="status-pill">{{STATUS}}</span></td>
            </tr>
          </table>
        </div>

      </div>

      <!-- ── PRODUCT TABLE ── -->
      <table class="product-table">
        <thead>
          <tr>
            <th class="col-sl  text-center">Sl.</th>
            <th class="col-product text-left">Product / Description</th>
            <th class="col-uom text-center">UOM</th>
            <th class="col-qty text-center">Qty</th>
            <th class="col-rate text-right">Rate (₹)</th>
            <th class="col-disc text-right">Discount (%)</th>
            <th class="col-gst text-right">GST (%)</th>
            <th class="col-value text-right">Total (₹)</th>
          </tr>
        </thead>
        <tbody>
          {{ITEMS_ROWS}}
        </tbody>
      </table>

      <!-- ── TERMS & CONDITIONS ── -->
      <div class="terms-section">
        <div class="panel-title">Terms &amp; Conditions</div>
        <div class="terms-body">{{TERMS_CONTENT}}</div>
      </div>

      <!-- ── VENDOR INSTRUCTION ── -->
      <div class="instruction-box">
        <strong>📋 Instructions for Vendors:</strong>
        1. Please fill in your rates, discounts, and applicable GST for each item.<br />
        2. Submit your quotation online through our vendor portal.<br />
        3. Quotations must be submitted before the mentioned deadline.<br />
        4. For any clarifications, please contact the procurement department.<br />
        5. Incomplete or late submissions may not be considered.
      </div>

      <!-- ── FOOTER ── -->
      <div class="footer">
        This is a computer generated document and does not require a physical signature.<br />
        Thank you for your business partnership!
      </div>

    </div>
  </body>
</html>