@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/IBMPlexSansArabic-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/IBMPlexSansArabic-Medium.ttf') format('truetype');
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/IBMPlexSansArabic-SemiBold.ttf') format('truetype');
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/IBMPlexSansArabic-Bold.ttf') format('truetype');
  font-weight: 700;
  font-display: swap;
}
.print-screen .lab-paper {
  width: 210mm;
  padding: 10mm;
  font-family: 'IBM Plex Sans Arabic', sans-serif;
  font-size: 9pt;
  line-height: 1.5;
  color: #172136;
}
.lab-report .paper-head {
  gap: 8mm;
  border-bottom: 0.6mm solid #022c22;
  padding-bottom: 5mm;
  margin-bottom: 4mm;
}
.report-identity {
  display: flex;
  gap: 3mm;
  flex: 1;
}
.print-screen .lab-report .paper-logo {
  width: 15mm;
  height: 15mm;
  background: #022c22;
  border: 0.3mm solid #047857;
  border-radius: 3mm;
}
.lab-report .paper-logo svg {
  width: 9mm;
  height: 9mm;
}
.print-screen .lab-report .paper-head h1 {
  font-size: 13.5pt;
  font-weight: 700;
  line-height: 1.4;
  color: #022c22;
  margin: 0;
}
.print-screen .lab-report .paper-head h2 {
  font-size: 9pt;
  color: #00634c;
  margin: 1mm 0;
}
.print-screen .lab-report .paper-head p {
  font-size: 7.5pt;
  color: #657a9a;
  margin: 0;
}
.lab-report .paper-reference {
  min-width: 0;
  width: 61mm;
  flex-shrink: 0;
  font-size: 9pt;
}
.lab-report .paper-label {
  border-radius: 1mm;
  padding: 1mm 2mm;
  font-size: 8.25pt;
  text-align: center;
  margin-bottom: 2mm;
}
.report-numeric,
.report-code {
  font-family: Consolas, 'Courier New', monospace;
  font-variant-numeric: tabular-nums;
}
.print-screen .lab-report .print-party-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0.25mm solid #dce5ef;
  border-radius: 3mm;
  padding: 4mm;
  gap: 4mm 8mm;
  background: #f8fafc;
  margin: 0 0 4mm;
}
.lab-report .print-party-grid label,
.report-signatures label {
  display: block;
  color: #8aa0bd;
  font-size: 7.5pt;
  font-weight: 400;
  margin: 0 0 1mm;
}
.lab-report .print-party-grid strong,
.lab-report .print-party-grid small {
  display: block;
  overflow-wrap: anywhere;
}
.lab-report .print-party-grid small {
  color: #657a9a;
  font-size: 7.5pt;
}
.lab-report .lab-section {
  margin: 0 0 4mm;
  border-color: #dce5ef;
  border-radius: 3mm;
}
.lab-report .report-table {
  table-layout: fixed;
  width: 100%;
  border-collapse: collapse;
  font-size: 9pt;
}
.lab-report .report-table th,
.lab-report .report-table td {
  padding: 2.5mm 2mm;
  border-bottom: 0.2mm solid #e8edf4;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  vertical-align: middle;
  text-align: center;
  line-height: 1.5;
}
.lab-report .report-table td:first-child {
  text-align: start;
}
.lab-report .report-table th {
  font-size: 8.25pt;
  font-weight: 700;
  color: #43536d;
  background: #f8fafc;
}
.lab-report .report-table td small {
  font-size: 7.5pt;
  color: #657a9a;
  display: block;
}
.lab-report .report-table td:last-child {
  color: #657a9a;
  font-size: 8.25pt;
}
.lab-report .report-table .report-category th {
  background: #205e50;
  color: white;
  text-align: start;
  padding: 1.5mm 3mm;
  font-size: 9pt;
}
.report-category small {
  float: inline-end;
  color: #b9e4d7;
  font-size: 7.5pt;
  font-weight: 400;
}
.lab-report .report-result-high {
  background: #fffbf2;
}
.lab-report .report-result-low {
  background: #f5fbff;
}
.lab-report .report-result-critical {
  background: #fff1f2;
}
.report-flag {
  display: inline-block;
  min-width: 21mm;
  max-width: 100%;
  border: 0.25mm solid #dce5ef;
  border-radius: 5mm;
  padding: 0.5mm 1.5mm;
  line-height: 1.35;
  color: #657a9a;
  background: #f8fafc;
}
.report-flag-normal {
  color: #00634c;
  background: #ecfdf5;
  border-color: #34d399;
}
.report-flag-high {
  color: #92400e;
  background: #fffbeb;
  border-color: #fbbf24;
}
.report-flag-low {
  color: #03608b;
  background: #f0f9ff;
  border-color: #7dd3fc;
}
.report-flag-critical {
  color: #9f1239;
  background: #fff1f2;
  border-color: #fda4af;
}
.report-panel {
  border: 0.25mm solid #dce5ef;
  border-radius: 3mm;
  background: #f8fafc;
  padding: 3mm 4mm;
  margin: 0 0 4mm;
}
.report-panel h3,
.lab-report .report-prescription h3 {
  font-size: 9pt;
  margin: 0 0 1mm;
  font-weight: 700;
}
.print-screen .report-panel p {
  margin: 0;
  font-size: 9pt;
  line-height: 1.7;
}
.report-interpretation {
  background: #fffbf2;
  border-color: #fcd34d;
}
.report-interpretation h3 {
  color: #78350f;
}
.report-interpretation h3::before {
  content: '●';
  color: #d97706;
  margin-inline-end: 2mm;
}
.lab-report .report-prescription h3 {
  background: #f1f5f9;
  color: #172136;
  padding: 2mm 3mm;
  margin: 0;
}
.report-context {
  font-size: 7.5pt;
}
.report-approval {
  border-top: 0.6mm solid #022c22;
  padding-top: 4mm;
  break-inside: avoid;
}
.report-signatures {
  display: grid;
  grid-template-columns: 1fr 30mm 1fr;
  align-items: center;
  gap: 8mm;
}
.report-signatures > div:last-child {
  text-align: end;
}
.report-signatures strong {
  display: block;
  overflow-wrap: anywhere;
}
.report-seal {
  border: 0.5mm solid #629b8f;
  color: #00634c;
  width: 26mm;
  height: 26mm;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 7.5pt;
  text-align: center;
}
.report-seal small {
  font-size: 6.5pt;
  color: #657a9a;
}
.report-seal-draft {
  border: 0;
  color: #92400e;
}
.lab-report .print-document-note {
  color: #657a9a;
  font-size: 7.5pt;
  margin: 3mm 0 0;
}
.lab-report .paper-footer-note {
  display: flex;
  justify-content: space-between;
  gap: 4mm;
  font-size: 7pt;
  color: #8aa0bd;
}
.report-warning,
.lab-report .report-table .report-repeat-warning th {
  color: #92400e;
  background: #fffbeb;
  border: 0.25mm solid #fbbf24;
  padding: 1mm 2mm;
  font-size: 8pt;
  text-align: center;
  margin-bottom: 2mm;
}
.report-repeat-warning {
  display: none;
}
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }
  .print-screen .lab-paper {
    padding: 0;
  }
  .print-screen .lab-report .print-party-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  .report-table thead {
    display: table-header-group;
  }
  .report-table tr,
  .report-identity {
    break-inside: avoid;
  }
  .report-panel h3 {
    break-after: avoid;
  }
  .report-repeat-warning {
    display: table-row;
  }
  .lab-report {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 16px;
}
.evidence-grid figure {
  margin: 0;
  border: 1px solid #dce5ef;
  border-radius: 10px;
  padding: 12px;
}
.evidence-grid img {
  width: 100%;
  height: 180px;
  object-fit: contain;
}
.evidence-grid p {
  overflow-wrap: anywhere;
}
.evidence-picker {
  margin-block: 20px;
}
.evidence-drop {
  width: 100%;
  padding: 28px 16px;
  border: 2px dashed #4b827c;
  border-radius: 12px;
  background: #f3faf7;
  color: #134e45;
  font: inherit;
  cursor: pointer;
}
.evidence-drop small {
  display: block;
  margin-top: 8px;
}
.evidence-drop.dragging,
.evidence-drop:focus-visible {
  background: #d9f4e7;
  outline: 3px solid #147a65;
  outline-offset: 3px;
}
.evidence-camera {
  margin-block: 16px;
}
.evidence-camera[hidden] {
  display: none;
}
.evidence-camera video {
  display: block;
  width: 100%;
  max-height: 340px;
  background: #102b30;
  border-radius: 12px;
}
.evidence-grid input,
.evidence-grid textarea {
  width: 100%;
  box-sizing: border-box;
}
.evidence-grid label {
  display: block;
  margin-block: 10px;
}
#evidence-upload .form-error {
  white-space: pre-line;
}
#examination-form fieldset {
  border: 0;
  padding: 0;
}
#examination-form details {
  margin-block: 12px;
}
#examination-form textarea {
  min-height: 85px;
  width: 100%;
}
#original-qr {
  display: block;
  margin: 12px auto;
}

.evidence-caption-preview {
  display: block;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
  margin: 0 auto 16px;
  border: 1px solid #bfd0d3;
  padding: 8px;
  border-radius: 8px;
}
.clinic-logo-preview {
  max-width: 160px;
  max-height: 100px;
  object-fit: contain;
  border: 1px solid #bfd0d3;
  padding: 8px;
}

.saved-evidence {
  margin-block: 16px 24px;
}
.saved-evidence figure {
  background: #fff;
  min-width: 0;
}
.saved-evidence img {
  border: 1px solid #dce5ef;
  border-radius: 6px;
  background: #f7f9fc;
}
.saved-evidence textarea {
  min-height: 90px;
  resize: vertical;
}
.saved-evidence figcaption {
  overflow-wrap: anywhere;
}
.evidence-empty {
  padding: 16px;
  border: 1px dashed #aabfc3;
  border-radius: 8px;
  background: #f7fafb;
}

.visit-result-head {
  border-bottom: 1px solid #dce6ec;
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.visit-result-head h2 {
  margin-top: 0;
  overflow-wrap: anywhere;
}
.visit-status {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 0;
}
.visit-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.visit-fact {
  padding: 12px;
  background: #f7fafb;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.visit-fact dt {
  font-size: 12px;
  color: #64748b;
  margin-bottom: 6px;
}
.visit-fact dd {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-align: start;
}
.visit-report-details {
  margin-top: 20px;
  border-top: 1px solid #dce6ec;
  padding-top: 16px;
}
.visit-report-details > summary {
  cursor: pointer;
  font-weight: 700;
}
.examination-summary td,
.evidence-comment {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.visit-pdf-preview .pdf-pages {
  display: grid;
  gap: 24px;
  padding: 24px;
}
.visit-pdf-preview .pdf-page {
  width: min(100%, 794px);
  margin: 0 auto;
}
.visit-pdf-preview canvas {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 2px 15px #0002;
}
.visit-pdf-preview figcaption {
  direction: ltr;
  text-align: center;
  margin-bottom: 8px;
}
.visit-pdf-preview .pdf-state {
  font-size: 12px;
  margin: 6px 0 0;
}
@media (max-width: 600px) {
  .visit-facts {
    grid-template-columns: 1fr;
  }
  .visit-pdf-preview .pdf-pages {
    padding: 8px;
  }
  .visit-pdf-preview .print-toolbar {
    flex-wrap: wrap;
  }
}
@media print {
  body:has(.visit-pdf-preview) {
    margin: 0 !important;
  }
  .visit-pdf-preview .pdf-pages {
    display: block;
    padding: 0;
  }
  .visit-pdf-preview .pdf-page {
    width: 100%;
    margin: 0;
    break-after: page;
    break-inside: avoid;
  }
  .visit-pdf-preview .pdf-page:last-child {
    break-after: auto;
  }
  .visit-pdf-preview canvas {
    width: 100%;
    height: auto;
    box-shadow: none;
  }
}
