:root {
  --ink: #3f3a50;
  --muted: #667383;
  --line: #dce6ee;
  --purple: #755391;
  --blue: #2f7bb7;
  --sky: #74b9d8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: #eef5f9;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.report-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.report-toolbar button,
.toolbar-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

.toolbar-link {
  background: #fff;
  color: var(--purple);
  border: 1px solid var(--line);
}

.report-page {
  width: min(980px, calc(100vw - 32px));
  margin: 24px auto;
  padding: 34px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(63, 58, 80, 0.12);
}

.loading-card {
  display: grid;
  place-items: center;
  min-height: 420px;
  gap: 14px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.loading-card img {
  width: 240px;
}

.loading-card a {
  color: var(--blue);
  font-weight: 900;
}

.report-header,
.patient-title,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.report-header {
  padding-bottom: 24px;
  border-bottom: 2px solid var(--line);
}

.report-header img {
  width: 210px;
  height: auto;
}

.report-header p,
.report-header h1,
.report-header span,
.patient-title p,
.patient-title h2,
.section-heading h3,
.section-heading p,
.category-block h4 {
  margin: 0;
}

.report-header p,
.patient-title p {
  color: var(--purple);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-header h1 {
  margin-top: 4px;
  color: var(--purple);
  font-size: 30px;
}

.report-header span,
.section-heading p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.patient-title {
  padding: 24px 0;
}

.patient-title h2 {
  margin-top: 4px;
  font-size: 26px;
}

.patient-title strong {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  padding: 0 12px;
  border-radius: 999px;
  background: #edf5fb;
  color: var(--blue);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 28px;
}

.info-item {
  display: grid;
  gap: 5px;
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.info-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.info-item strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.report-section {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  margin-top: 24px;
}

.section-heading {
  margin-bottom: 14px;
}

.section-heading h3 {
  color: var(--purple);
  font-size: 20px;
}

.compare-grid,
.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.photo-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.photo-figure {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  break-inside: avoid;
}

.photo-figure img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e7edf2;
}

.photo-figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.photo-figure figcaption strong {
  color: var(--ink);
}

.timeline-list {
  display: grid;
  gap: 10px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  break-inside: avoid;
}

.timeline-row > span {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.category-block {
  margin-top: 16px;
  break-inside: avoid;
}

.category-block h4 {
  margin-bottom: 10px;
  color: var(--purple);
}

.empty-box {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

@media (max-width: 760px) {
  .report-page {
    width: auto;
    margin: 0;
    padding: 20px;
    border-radius: 0;
  }

  .report-header,
  .patient-title,
  .section-heading {
    display: grid;
  }

  .info-grid,
  .compare-grid,
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .report-toolbar {
    display: none;
  }

  .report-page {
    width: auto;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .report-section,
  .photo-figure,
  .timeline-row,
  .category-block {
    break-inside: avoid;
  }
}
