/* Featuron Multi-Instrument Consolidated Report Stylesheet
   Precision A4 Print Layout with High-Density 2-15 Row Tabular Formatting */

:root {
  --primary: #047A3D;
  --primary-dark: #004d26;
  --primary-light: #e6f4ea;
  --lime-dot: #6FB426;
  --text-dark: #0f172a;
  --text-muted: #475569;
  --border-color: #cbd5e1;
  --bg-subtle: #f8fafc;
  --pass-color: #047A3D;
  --pass-bg: #dcfce7;
  --fail-color: #b91c1c;
  --fail-bg: #fee2e2;
  --warn-color: #d97706;
  --warn-bg: #fef3c7;
}

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

body {
  font-family: 'Barlow', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: #e2e8f0;
  color: var(--text-dark);
  line-height: 1.35;
  font-size: 11px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* Floating Screen Tools */
.screen-tools {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #0f172a;
  color: #fff;
  padding: 8px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.btn-tool {
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  padding: 6px 14px;
  border-radius: 6px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}

.btn-tool:hover {
  background: #334155;
  border-color: #64748b;
  color: #fff;
}

.btn-tool.btn-print {
  background: #047A3D;
  border-color: #047A3D;
  color: #fff;
  margin-left: auto;
}

.btn-tool.btn-print:hover {
  background: #036331;
}

.tool-divider {
  width: 1px;
  height: 20px;
  background: #334155;
}

.mode-badge {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  color: #6ee7b7;
  letter-spacing: 0.3px;
}

.selection-pill {
  background: #334155;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

/* A4 Printable Document Container */
.a4-document {
  width: 210mm;
  min-height: 297mm;
  margin: 16px auto;
  background: #ffffff;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10mm 12mm 8mm 12mm;
  position: relative;
}

.doc-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Header Section */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--primary);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.logo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 38px;
  font-weight: 900;
  color: var(--primary);
  line-height: 0.9;
  letter-spacing: -0.5px;
}

.logo .dot {
  color: var(--lime-dot);
}

.tagline {
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.4px;
  margin-top: 2px;
}

.tech-pillars {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  line-height: 1.15;
  letter-spacing: 1px;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  padding: 0 16px;
}

.contact-info {
  font-size: 10px;
  text-align: right;
  color: var(--text-dark);
}

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

.contact-line svg.icon {
  width: 12px;
  height: 12px;
  fill: var(--primary);
}

/* Document Title Banner */
.banner {
  background: var(--primary);
  color: #fff;
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 16px;
  font-weight: 800;
  text-align: center;
  padding: 4px 10px;
  letter-spacing: 1.2px;
  border-radius: 2px;
  margin-bottom: 6px;
}

/* Document Metadata Strip */
.meta-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 4px 8px;
  margin-bottom: 6px;
}

.meta-col {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
}

.meta-col label {
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.meta-input {
  border: 1px solid transparent;
  background: transparent;
  font-family: 'Barlow', sans-serif;
  font-size: 11px;
  color: var(--text-dark);
  font-weight: 500;
  width: 100%;
  padding: 1px 4px;
  border-radius: 2px;
}

.meta-input.bold {
  font-weight: 700;
  color: var(--primary-dark);
}

.meta-input:hover, .meta-input:focus {
  background: #fff;
  border-color: var(--border-color);
  outline: none;
}

/* Customer Details Box */
.customer-info-box {
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 4px 8px;
  margin-bottom: 6px;
  background: #ffffff;
}

.cust-row {
  display: flex;
  gap: 12px;
  margin-bottom: 2px;
}

.cust-row:last-child {
  margin-bottom: 0;
}

.cust-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
}

.cust-field.field-grow {
  flex: 1;
}

.cust-field .lbl {
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}

.cust-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-family: 'Barlow', sans-serif;
  font-size: 11px;
  color: var(--text-dark);
  padding: 1px 4px;
}

.cust-input.bold {
  font-weight: 700;
}

.cust-input:hover, .cust-input:focus {
  background: #f8fafc;
  border-color: var(--border-color);
  outline: none;
}

/* Summary KPI Strip */
.summary-kpi-bar {
  display: flex;
  align-items: center;
  background: #0f172a;
  color: #fff;
  padding: 4px 10px;
  border-radius: 3px;
  margin-bottom: 6px;
  gap: 16px;
  font-size: 10px;
}

.kpi-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.kpi-label {
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-val {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 12px;
  font-weight: 800;
  color: #f1f5f9;
}

.kpi-pass .kpi-val {
  color: #4ade80;
}

.kpi-fail .kpi-val {
  color: #f87171;
}

.kpi-tag {
  background: #1e293b;
  border: 1px solid #334155;
  color: #38bdf8;
  padding: 1px 6px;
  border-radius: 3px;
  font-weight: 600;
  font-size: 9px;
  margin-left: auto;
}

/* Multi-Row Instruments Table */
.table-wrapper {
  margin-bottom: 8px;
  border: 1px solid var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}

.consolidated-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
  line-height: 1.25;
}

.consolidated-table thead th {
  background: #1e293b;
  color: #fff;
  font-family: 'Barlow', Arial, sans-serif;
  font-weight: 600;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 5px 6px;
  border: 1px solid #334155;
  text-align: left;
}

.consolidated-table th.col-check,
.consolidated-table td.col-check {
  width: 24px;
  text-align: center;
  padding: 4px 2px;
}

.consolidated-table th.col-sno,
.consolidated-table td.col-sno {
  width: 26px;
  text-align: center;
  font-weight: 700;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-color);
}

.consolidated-table th.col-thumb,
.consolidated-table td.col-thumb {
  width: 52px;
  text-align: center;
  padding: 3px 4px;
}

.consolidated-table th.col-details {
  width: 28%;
}

.consolidated-table th.col-activity {
  width: 26%;
}

.consolidated-table th.col-status {
  width: 15%;
}

.consolidated-table th.col-remarks {
  width: 18%;
}

.consolidated-table tbody tr {
  border-bottom: 1px solid var(--border-color);
  page-break-inside: avoid;
  transition: background 0.1s ease;
}

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

.consolidated-table tbody tr:hover {
  background: #f1f5f9;
}

.consolidated-table tbody tr.row-omitted {
  opacity: 0.38;
  background: #f1f5f9;
  text-decoration: line-through;
}

.consolidated-table tbody td {
  padding: 4px 6px;
  vertical-align: middle;
  border-right: 1px solid #e2e8f0;
}

.consolidated-table tbody td:last-child {
  border-right: none;
}

/* Thumbnail Styling */
.inst-thumb-wrap {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  margin: 0 auto;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.inst-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  image-rendering: -webkit-optimize-contrast;
}

.inst-no-thumb {
  font-size: 16px;
  opacity: 0.6;
}

/* Cell Specifics */
.inst-title {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 10.5px;
  margin-bottom: 1px;
}

.inst-subinfo {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.2;
}

.inst-subinfo b {
  color: var(--text-dark);
}

.inst-doc-ref {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  color: #7c3aed;
  background: #ede9fe;
  padding: 1px 4px;
  border-radius: 2px;
  display: inline-block;
  margin-top: 2px;
}

.activity-text {
  font-size: 9.5px;
  color: var(--text-dark);
  line-height: 1.25;
}

.activity-text textarea {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-family: 'Barlow', sans-serif;
  font-size: 9.5px;
  resize: none;
  min-height: 32px;
  color: var(--text-dark);
}

.activity-text textarea:hover, .activity-text textarea:focus {
  background: #fff;
  border-color: var(--border-color);
  outline: none;
}

/* Status Badges & Dropdown */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.status-pill.pass {
  background: var(--pass-bg);
  color: var(--pass-color);
  border: 1px solid #86efac;
}

.status-pill.fail {
  background: var(--fail-bg);
  color: var(--fail-color);
  border: 1px solid #fca5a5;
}

.status-pill.open {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.status-pill.completed {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.status-select {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 8.5px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  background: #fff;
  cursor: pointer;
  width: 100%;
}

.remarks-input {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  font-family: 'Barlow', sans-serif;
  font-size: 9.5px;
  color: var(--text-dark);
  padding: 2px;
}

.remarks-input:hover, .remarks-input:focus {
  background: #fff;
  border-color: var(--border-color);
  outline: none;
}

/* Signatures & Legal Verification Section */
.signatures-section {
  margin-top: auto;
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  page-break-inside: avoid;
}

.cert-declaration {
  background: var(--bg-subtle);
  border: 1px dashed var(--border-color);
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.25;
  margin-bottom: 6px;
}

.cert-declaration b {
  color: var(--text-dark);
}

.sig-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.sig-box {
  border: 1px solid var(--border-color);
  border-radius: 3px;
  padding: 6px 8px;
  background: #fff;
}

.sig-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 3px;
  margin-bottom: 4px;
}

.sig-title {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 10px;
  font-weight: 700;
  color: var(--primary-dark);
  text-transform: uppercase;
}

.btn-clear-sig {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 2px;
  cursor: pointer;
}

.btn-clear-sig:hover {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.canvas-wrap {
  width: 100%;
  height: 55px;
  border: 1px solid #e2e8f0;
  border-radius: 2px;
  background: #fff;
  margin-bottom: 4px;
  cursor: crosshair;
}

.sig-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.sig-meta-fields {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sig-input {
  border: 1px solid transparent;
  background: transparent;
  font-family: 'Barlow', sans-serif;
  font-size: 10px;
  color: var(--text-dark);
  padding: 1px 4px;
  border-radius: 2px;
}

.sig-input.bold {
  font-weight: 700;
}

.sig-input:hover, .sig-input:focus {
  background: #f8fafc;
  border-color: var(--border-color);
  outline: none;
}

.sig-sub-row {
  display: flex;
  gap: 6px;
}

.stamp-note {
  font-size: 8.5px;
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  border-top: 1px dotted #e2e8f0;
  padding-top: 2px;
  margin-top: 2px;
}

/* Footer Section */
.footer {
  border-top: 1px solid var(--border-color);
  padding-top: 6px;
  margin-top: 8px;
  font-size: 9px;
  color: var(--text-muted);
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.flogo {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: var(--primary);
}

.flogo .dot {
  color: var(--lime-dot);
}

/* Lightbox Modal */
.lightbox-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  z-index: 2000;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.lightbox-backdrop.active {
  display: flex;
}

.lightbox-content {
  background: #fff;
  border-radius: 8px;
  max-width: 600px;
  width: 95%;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  animation: lbPop 0.15s ease-out;
}

@keyframes lbPop {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.lightbox-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #0f172a;
  color: #fff;
}

.lightbox-title {
  font-family: 'Barlow', Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
}

.lightbox-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.lightbox-close:hover {
  color: #fff;
}

.lightbox-body {
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  max-height: 480px;
}

.lightbox-body img {
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox-footer {
  padding: 8px 14px;
  background: #f8fafc;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lightbox-subtext {
  font-size: 11px;
  color: #64748b;
}

.btn-lightbox-close {
  background: #e2e8f0;
  border: 1px solid #cbd5e1;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

/* PRINT MEDIA QUERIES (Exact A4 Formatting) */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm 8mm 10mm;
  }

  body {
    background: #ffffff !important;
    font-size: 10px;
  }

  .screen-tools,
  .no-print,
  .btn-clear-sig,
  .calendar-button,
  .lightbox-backdrop {
    display: none !important;
  }

  .a4-document {
    width: 100% !important;
    min-height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .consolidated-table th.col-check,
  .consolidated-table td.col-check {
    display: none !important;
  }

  .consolidated-table tr.row-omitted {
    display: none !important;
  }

  /* High contrast borders and crisp text */
  .consolidated-table,
  .consolidated-table th,
  .consolidated-table td {
    border-color: #94a3b8 !important;
  }

  .meta-input,
  .cust-input,
  .sig-input,
  .remarks-input {
    border: none !important;
    padding: 0 !important;
  }

  .canvas-wrap {
    border-color: #cbd5e1 !important;
  }

  .summary-kpi-bar {
    background: #0f172a !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .banner {
    background: var(--primary) !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}

