:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d8e0eb;
  --text: #172033;
  --muted: #65758b;
  --blue: #1778d4;
  --blue-dark: #0e5da8;
  --red: #ef2d73;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
a { color: inherit; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.brand { font-weight: 800; }
.nav { display: flex; gap: 10px; flex-wrap: wrap; }
.nav a, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.btn.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}
.btn.danger { color: #b42318; }
.shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 18px 14px 40px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 12px 32px rgba(20,34,56,.06);
}
.hero {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}
.hero h1, .section h2 { margin: 0; }
.hero p, .hint { margin: 0; color: var(--muted); line-height: 1.7; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.field {
  display: grid;
  gap: 6px;
}
.field label {
  font-size: 13px;
  color: #334155;
  font-weight: 800;
}
input, select, textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  background: #fff;
}
textarea { min-height: 90px; resize: vertical; }
.section {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}
.test-list { display: grid; gap: 10px; }
.test-group {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.test-group h3 {
  margin: 0;
  font-size: 17px;
  color: #0f3f6f;
}
.test-row {
  display: grid;
  grid-template-columns: minmax(150px,1fr) 110px 100px;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcff;
}
.custom-tests {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}
.custom-test-row {
  background: #fff;
}
.result-preview {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #64748b;
  font-weight: 800;
}
.result-preview.positive { color: #c1121f; background: #fff5f5; border-color: #fecaca; }
.other-sample-field { display: none; }
.draft-status { margin-top: 8px; }
.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.checkline input { width: 18px; min-height: 18px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.notice {
  padding: 12px 14px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
}
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th, .data-table td { border-bottom: 1px solid var(--line); padding: 10px 8px; text-align: left; white-space: nowrap; }
.data-table th { color: #475569; font-size: 13px; background: #f8fafc; }

.report-page {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 28px;
  background: #fff;
  color: #000;
}
.report-title { position: relative; text-align: center; margin-bottom: 18px; padding-bottom: 12px; border-bottom: 2px solid #155c96; }
.report-logo { position: absolute; left: 0; top: 0; width: 170px; height: auto; }
.report-title h1 { margin: 0 0 6px; font-size: 30px; font-weight: 900; }
.report-title p { margin: 0; color: #334155; }
.report-section { margin-top: 18px; }
.report-section h2 { margin: 0 0 10px; font-size: 21px; }
.report-table { width: 100%; border-collapse: collapse; }
.report-table th, .report-table td { border: 1px solid #8bb6e6; padding: 10px; line-height: 1.65; }
.report-table th { background: #eaf4ff; text-align: center; font-weight: 800; }
.report-table .group-row td { background: #f6fbff; color: #0f3f6f; font-weight: 800; text-align: left; }
.conclusion-box { border: 1px solid #8bb6e6; padding: 12px; line-height: 1.8; }
.image-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.image-card { border: 1px solid #8bb6e6; min-height: 210px; padding: 10px; text-align: center; }
.image-card img { max-width: 100%; max-height: 300px; object-fit: contain; }
.stamp {
  position: relative;
  width: 210px;
  height: 126px;
  margin: 6px auto;
  color: var(--red);
}
.stamp img { width: 100%; height: 100%; object-fit: contain; display: block; }
.stamp svg { width: 100%; height: 100%; display: block; }
.stamp-date { text-align: center; font-weight: 800; margin-top: -34px; color: #111; }
.print-actions { display: flex; gap: 10px; justify-content: center; margin: 18px 0; }

@media (max-width: 720px) {
  .grid, .image-grid { grid-template-columns: 1fr; }
  .test-row { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .panel { border-radius: 0; border-left: 0; border-right: 0; }
  .shell { padding: 12px 0 30px; }
}
@media print {
  body { background: #fff; }
  .topbar, .print-actions { display: none !important; }
  .report-page { width: 100%; padding: 0; box-shadow: none; }
  .report-section { break-inside: avoid; }
}
