/* ==========================================================================
   FEATURON - Pipette Operations Stylesheet (PSRF, PFSR, PCR)
   A4 Dimensions: 210mm x 297mm
   ========================================================================== */

@page {
  size: A4 portrait;
  margin: 5mm 6mm;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #e2e8f0;
  font-family: 'Barlow', Arial, sans-serif;
  color: #0f172a;
  font-weight: 500;
  font-size: 11.5px;
  line-height: 1.25;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Floating Action Toolbar */
.tools {
  width: 210mm;
  margin: 12px auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.tools button, .tools a {
  background: #0d9488;
  color: #fff;
  border: none;
  padding: 7px 14px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  border-radius: 5px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.tools button:hover, .tools a:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.tools .btn-secondary { background: #475569; }
.tools .btn-new { background: #0284c7; }
.tools .btn-save { background: #059669; }
.tools .btn-convert { background: #7c3aed; }
.tools .btn-calib { background: #2563eb; }
.tools .btn-danger { background: #dc2626; }

.tools .fetch-box {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.tools .fetch-input {
  border: none;
  padding: 7px 10px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  width: 150px;
  outline: none;
}

.tools .btn-fetch {
  background: #0f766e;
  border-radius: 0;
  box-shadow: none;
  padding: 7px 12px;
}

/* Main A4 Document Canvas */
.page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 20px auto;
  background: #fff;
  padding: 10mm 12mm;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
}

/* Header Section */
.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 8px;
  border-bottom: 2px solid #0f172a;
}

.logo, .logo-green {
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: 28px;
  font-weight: 800;
  color: #047A3D !important;
  letter-spacing: -0.5px;
  line-height: 1;
}

.logo .dot, .logo-green .dot {
  color: #6FB426 !important;
}

.tagline {
  font-size: 10px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.tech {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #0d9488;
  line-height: 1.3;
  text-align: center;
}

.contact {
  text-align: right;
  font-size: 10px;
  line-height: 1.4;
  color: #334155;
}

.contact-line {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  margin-bottom: 2px;
}

.contact-line svg {
  width: 12px;
  height: 12px;
  fill: #0d9488;
  flex-shrink: 0;
}

.contact-line input {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  text-align: right;
  width: 130px;
  padding: 0;
}

/* Banners */
.banner {
  margin: 10px 0 8px 0;
  padding: 6px 12px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 1px;
  text-align: center;
  color: #fff;
  border-radius: 4px;
}

.banner-psrf { background: #0f766e; }
.banner-pfsr { background: #047A3D; }
.banner-pcr  { background: #1d4ed8; }

.banner-subtitle {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: #e0e7ff;
  margin-top: 2px;
}

/* Document Meta Bar */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.meta-item {
  display: flex;
  flex-direction: column;
}

.meta-label {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 2px;
}

.meta-item input, .meta-item select {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
}

/* Sections */
.form-section {
  margin-bottom: 10px;
}

.section-header {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #0f172a;
  padding: 3px 6px;
  background: #f1f5f9;
  border-left: 3px solid #0d9488;
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-3col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.field-group {
  margin-bottom: 6px;
}

.field-label {
  display: block;
  font-size: 9.5px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 5px 8px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 11.5px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #0f172a;
}

.field-input:focus, .field-select:focus, .field-textarea:focus {
  border-color: #0d9488;
  outline: none;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15);
}

.field-textarea {
  resize: vertical;
  min-height: 48px;
}

/* Tables */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin-bottom: 8px;
}

.doc-table th {
  background: #f1f5f9;
  color: #334155;
  font-weight: 700;
  padding: 5px 6px;
  text-align: left;
  border: 1px solid #cbd5e1;
  font-size: 10.5px;
  text-transform: uppercase;
}

.doc-table td {
  padding: 4px 6px;
  border: 1px solid #cbd5e1;
  vertical-align: middle;
}

.doc-table input, .doc-table select {
  width: 100%;
  padding: 4px 6px;
  font-size: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  background: #fff;
}

.doc-table .col-num { width: 32px; text-align: center; }
.doc-table .col-del { width: 32px; text-align: center; }

.btn-row-del {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 3px;
  padding: 2px 6px;
  font-size: 10px;
  cursor: pointer;
  font-weight: 700;
}
.btn-row-del:hover { background: #fecaca; }

.btn-add-item {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px dashed #0d9488;
  border-radius: 4px;
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.btn-add-item:hover { background: #ccfbf1; }

/* Status Badges */
.badge-pass {
  background: #dcfce7;
  color: #15803d;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #86efac;
  display: inline-block;
  text-align: center;
}

.badge-fail {
  background: #fee2e2;
  color: #b91c1c;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid #fca5a5;
  display: inline-block;
  text-align: center;
}

/* Signatures */
.sig-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
}

.sig-box {
  border: 1px solid #e2e8f0;
  border-radius: 5px;
  padding: 8px 10px;
  background: #f8fafc;
}

.sig-box-title {
  font-size: 10px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.sig-line {
  border-top: 1px solid #94a3b8;
  padding-top: 4px;
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #64748b;
}

/* ISO 8655 Calibration Realtime Highlight */
.calib-summary-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.calib-summary-title {
  font-size: 12px;
  font-weight: 700;
  color: #1e40af;
}

.calib-summary-eval {
  font-size: 14px;
  font-weight: 800;
  padding: 4px 14px;
  border-radius: 4px;
}

/* Document Footer */
.footer {
  border-top: 1px solid #cbd5e1;
  padding-top: 6px;
  margin-top: 8px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 9.5px;
  color: #64748b;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer .flogo {
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: 15px;
  font-weight: 800;
  color: #047A3D !important;
  letter-spacing: -0.3px;
}

.footer .flogo .dot {
  color: #6FB426 !important;
}

/* ==========================================================================
   2-PAGE CALIBRATION CERTIFICATE (ISO 17025 / ISO 8655 EXACT LAYOUT)
   ========================================================================== */

.page-break {
  page-break-after: always;
  break-after: page;
  height: 0;
  display: block;
}

.cert-page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 20px auto;
  background: #fff;
  padding: 8mm 10mm;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-sizing: border-box;
  font-family: 'Barlow', Arial, sans-serif;
  color: #000;
  font-size: 10.5px;
  line-height: 1.25;
}

.cert-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 4px;
}

.cert-brand {
  display: flex;
  flex-direction: column;
}

.cert-logo {
  font-family: 'Barlow Condensed', sans-serif !important;
  font-size: 34px;
  font-weight: 900;
  color: #047A3D !important;
  letter-spacing: -0.5px;
  line-height: 0.95;
}

.cert-logo .dot {
  color: #6FB426 !important;
}

.cert-sub-brand {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #0f172a;
  margin-top: 3px;
  text-transform: uppercase;
}

.cert-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-cert-no {
  font-size: 10.5px;
  font-weight: 700;
  color: #000;
}

.cert-doc-heading {
  text-align: center;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #000;
  margin: 6px 0 8px 0;
}

.cert-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 6px;
}

.cert-cust-col {
  flex: 1.1;
}

.cert-cust-title {
  font-weight: 800;
  font-size: 11px;
  margin-bottom: 2px;
}

.cert-input-line {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  padding: 2px 4px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  color: #000;
  margin-bottom: 2px;
  box-sizing: border-box;
}

.cert-dates-col {
  flex: 1;
}

.cert-dates-tbl {
  width: 100%;
  border-collapse: collapse;
}

.cert-dates-tbl td {
  padding: 1.5px 3px;
  font-size: 10.5px;
  border: none;
}

.cert-dates-tbl td:first-child {
  font-weight: 700;
  color: #000;
  width: 120px;
  white-space: nowrap;
}

.cert-dates-tbl input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  padding: 1.5px 4px;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
}

/* Date field - matches service_report / calendar_picker pattern */
.cert-dates-tbl .date-field {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 100%;
}

.cert-dates-tbl .date-display {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid #cbd5e1;
  border-radius: 2px;
  padding: 1.5px 4px;
  width: 100%;
  background: #fff;
  cursor: pointer;
}

.cert-dates-tbl .date-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.cert-dates-tbl .calendar-button {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
}

.cert-dates-tbl .calendar-button svg {
  width: 12px;
  height: 12px;
  fill: #047A3D;
}

@media print {
  .cert-dates-tbl .date-picker-input,
  .cert-dates-tbl .calendar-button {
    display: none !important;
  }
  .cert-dates-tbl .date-display {
    border: none !important;
    background: transparent !important;
  }
}

.cert-statement {
  font-size: 9.5px;
  line-height: 1.35;
  color: #000;
  text-align: justify;
  margin: 5px 0 6px 0;
}

.cert-sec-title {
  font-size: 11px;
  font-weight: 800;
  color: #000;
  margin: 5px 0 3px 0;
}

.cert-border-tbl {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 5px;
  font-size: 10px;
}

.cert-border-tbl th, .cert-border-tbl td {
  border: 1px solid #000;
  padding: 2.5px 5px;
  vertical-align: middle;
}

.cert-border-tbl th {
  background: #f8fafc;
  font-weight: 700;
  text-align: center;
  color: #000;
}

.cert-border-tbl td.lbl {
  font-weight: 700;
  background: #fafafa;
  width: 145px;
  white-space: nowrap;
}

.cert-border-tbl input {
  width: 100%;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  font-weight: 600;
  color: #000;
  padding: 0;
}

.cert-border-tbl input:focus {
  outline: 1px solid #047A3D;
  background: #f0fdf4;
}

.cert-notes {
  font-size: 9px;
  line-height: 1.35;
  color: #000;
  margin: 4px 0 6px 0;
}

.cert-notes div {
  margin-bottom: 1px;
}

.cert-status-line {
  font-size: 11.5px;
  font-weight: 800;
  color: #000;
  margin: 5px 0 8px 0;
}

.cert-status-line .pass {
  color: #15803d;
}

.cert-signatures {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 10px;
  padding-bottom: 4px;
}

.cert-sig-box {
  width: 180px;
}

.cert-sig-box.right {
  text-align: right;
}

.cert-sig-title {
  font-size: 10px;
  font-weight: 700;
  color: #000;
  margin-bottom: 4px;
}

.cert-sig-script {
  font-family: 'Brush Script MT', 'Dancing Script', cursive, sans-serif;
  font-size: 20px;
  color: #1e3a8a;
  min-height: 24px;
  line-height: 1;
}

.cert-sig-name {
  font-size: 10px;
  font-weight: 700;
  color: #000;
  margin-top: 2px;
}

.cert-sig-role {
  font-size: 9px;
  color: #475569;
}

.cert-stamp-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cert-seal-empty {
  width: 90px;
  height: 70px;
}

.cert-page-num {
  font-size: 9px;
  color: #475569;
  margin-top: 4px;
}

.cert-footer-line {
  border-top: 1px solid #000;
  padding-top: 4px;
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: #000;
}

/* Page 2 Annexure 3-Column Tables */
.annexure-meta-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 3px;
  padding: 4px 8px;
  margin-bottom: 8px;
  font-size: 9.5px;
  gap: 6px 12px;
}

.annexure-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 8px;
}

.run-panel {
  border: 1px solid #000;
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.run-panel-head {
  background: #047A3D;
  color: #fff;
  font-weight: 800;
  font-size: 10.5px;
  padding: 4px 6px;
  text-align: center;
  letter-spacing: 0.5px;
}

.run-weigh-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 9.5px;
}

.run-weigh-tbl th, .run-weigh-tbl td {
  border-bottom: 1px solid #cbd5e1;
  padding: 2px 4px;
  text-align: center;
}

.run-weigh-tbl th {
  background: #f1f5f9;
  font-weight: 700;
  color: #334155;
  font-size: 9px;
}

.run-weigh-tbl input {
  width: 100%;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  text-align: right;
  padding: 1px 3px;
  font-family: inherit;
  font-size: 9.5px;
  font-weight: 600;
}

.run-weigh-tbl input:focus {
  border-color: #047A3D;
  background: #f0fdf4;
}

.run-eval-box {
  background: #f8fafc;
  border-top: 1px solid #000;
  padding: 4px 6px;
  font-size: 9.5px;
}

.run-eval-row {
  display: flex;
  justify-content: space-between;
  padding: 1.5px 0;
  border-bottom: 1px dotted #e2e8f0;
}

.run-eval-row:last-child {
  border-bottom: none;
}

.run-eval-lbl {
  font-weight: 700;
  color: #334155;
}

.run-eval-val {
  font-weight: 800;
  color: #0f172a;
}

/* Print Overrides */
@media print {
  @page {
    size: A4 portrait;
    margin: 5mm 6mm;
  }

  html, body {
    background: #fff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }

  .tools, .no-print, .page-break, .btn-row-del, .btn-add-item, #custSuggestions, #psrfSuggestions {
    display: none !important;
  }

  .page {
    width: 100% !important;
    min-height: auto !important;
    max-height: 285mm !important;
    margin: 0 !important;
    padding: 3mm 6mm !important;
    box-shadow: none !important;
    border: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .cert-page {
    width: 100% !important;
    height: 285mm !important;
    max-height: 285mm !important;
    min-height: 275mm !important;
    margin: 0 !important;
    padding: 2mm 5mm 3mm 5mm !important;
    box-shadow: none !important;
    border: none !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    overflow: hidden !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .cert-page.page-1 {
    page-break-before: avoid !important;
    break-before: avoid !important;
    page-break-after: always !important;
    break-after: page !important;
  }

  .cert-page.page-2 {
    page-break-before: auto !important;
    break-before: auto !important;
    page-break-after: avoid !important;
    break-after: avoid !important;
  }

  /* Compact spacing for Page 1 in print to guarantee 100% fit on 1 page */
  .cert-doc-heading {
    margin: 3px 0 4px 0 !important;
    font-size: 15px !important;
  }
  .cert-meta-row {
    margin-bottom: 3px !important;
  }
  .cert-statement {
    margin: 3px 0 4px 0 !important;
    font-size: 9px !important;
    line-height: 1.25 !important;
  }
  .cert-sec-title {
    margin: 3px 0 2px 0 !important;
    font-size: 10px !important;
  }
  .cert-border-tbl {
    margin-bottom: 3px !important;
    font-size: 9.5px !important;
  }
  .cert-border-tbl th, .cert-border-tbl td {
    padding: 1.5px 4px !important;
    border-color: #000 !important;
  }
  .cert-notes {
    margin: 2px 0 3px 0 !important;
    font-size: 8.5px !important;
    line-height: 1.25 !important;
  }
  .cert-status-line {
    margin: 2px 0 4px 0 !important;
    font-size: 10px !important;
  }
  .cert-signatures {
    margin-top: 4px !important;
    padding-bottom: 2px !important;
  }
  .cert-seal-empty {
    height: 48px !important;
    width: 75px !important;
  }
  .cert-sig-space {
    height: 32px !important;
  }
  .cert-footer-line {
    margin-top: 3px !important;
    padding-top: 2px !important;
    font-size: 8.5px !important;
  }

  /* Page 2 Annexure print compactness */
  .annexure-meta-strip {
    padding: 2px 6px !important;
    margin-bottom: 4px !important;
    font-size: 9px !important;
  }
  .annexure-grid {
    gap: 6px !important;
    margin-bottom: 4px !important;
  }
  .run-panel {
    border-color: #000 !important;
  }
  .run-panel-head {
    padding: 2px 4px !important;
    font-size: 9.5px !important;
  }
  .run-weigh-tbl th, .run-weigh-tbl td {
    padding: 1px 3px !important;
    font-size: 9px !important;
    border-color: #000 !important;
  }
  .run-eval-box {
    padding: 2px 4px !important;
    font-size: 9px !important;
  }
  .run-eval-row {
    padding: 0.8px 0 !important;
  }

  input, select, textarea {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-weight: 600 !important;
    color: #000 !important;
  }
  .cert-input-line {
    border: none !important;
    padding: 0 !important;
  }
  .print-only {
    display: inline !important;
  }
}

.print-only {
  display: none;
}

