/* Styling for the report body the model produces.
 *
 * The class names (patient-block, pr/pl/pv, section-heading, echo-list,
 * cath-table, diagnosis-block) are dictated by the system prompt in
 * lib/report-generator.js, so these rules are ported from the live
 * core/css/style.css to keep generated reports looking identical. */

.report-paper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-family: Arial, sans-serif;
  color: #111;
}

.report-paper__header img,
.report-paper__footer img { width: 100%; display: block; }

.report-body { padding: 14px 22px; }

.report-sig { padding: 12px 22px 18px; border-top: 1px solid #cdd6e0; margin-top: 16px; }
.report-sig p { font-size: 12px; color: #333; margin: 0 0 2px; }
.report-sig__image { max-height: 60px; width: auto; margin: 4px 0; }
.report-sig__name { font-weight: 700; font-size: 14px; color: var(--brand-primary); }
.report-sig__quals { font-size: 10px; color: #666; }

.report-body h2 {
  font-size: 14px; font-weight: 700; text-align: center; letter-spacing: 1px;
  color: var(--brand-primary); margin: 0 0 2px; text-transform: uppercase;
}
.report-body h4 {
  font-size: 11px; font-weight: 400; text-align: center; color: #666;
  margin: 0 0 12px; font-style: italic;
}

.report-body .patient-block {
  background: #f5f8fc; border-left: 3px solid var(--brand-primary);
  padding: 8px 12px; margin: 10px 0 14px;
}
.report-body .pr { display: flex; margin: 3px 0; font-size: 12px; flex-wrap: wrap; }
.report-body .pl { font-weight: 700; color: var(--brand-primary); min-width: 190px; flex-shrink: 0; }
.report-body .pv { color: #111; }

.report-body .salutation { font-size: 12px; color: #333; margin: 0 0 14px; font-style: italic; }
.report-body .section { margin: 0 0 12px; }
.report-body .section-heading {
  font-size: 11px; font-weight: 700; color: var(--brand-primary);
  text-transform: uppercase; letter-spacing: .7px;
  border-bottom: 1.5px solid var(--brand-primary); padding-bottom: 2px; margin-bottom: 6px;
}

.report-body ul { margin: 3px 0; padding-left: 16px; }
.report-body li { margin: 2px 0; font-size: 12px; }
.report-body ul.echo-list { list-style: none; padding-left: 0; }
.report-body ul.echo-list li { display: flex; margin: 3px 0; flex-wrap: wrap; }
.report-body .echo-label { font-weight: 600; color: #222; min-width: 220px; flex-shrink: 0; font-size: 11.5px; }
.report-body .echo-value { color: #111; font-size: 12px; }

.report-body .diagnosis-block {
  background: #fff8e1; border-left: 3px solid #e6a817; padding: 6px 12px; margin: 8px 0 12px;
}

.report-body table.cath-table { border-collapse: collapse; width: 100%; font-size: 11px; margin: 6px 0; }
.report-body table.cath-table th {
  background: var(--brand-primary); color: #fff; padding: 5px 8px; text-align: left; font-weight: 600;
}
.report-body table.cath-table td { border: 1px solid #ccd6e0; padding: 4px 8px; vertical-align: top; }
.report-body table.cath-table tr:nth-child(even) td { background: #f5f8fc; }
.report-body strong { font-weight: 700; }

/* Editing puts the body into contenteditable; make the target obvious. */
.report-body[contenteditable="true"] {
  outline: 2px dashed var(--brand-primary);
  outline-offset: 4px;
  background: #fffdf5;
}

.print-page { background: #fff; }
.report-paper--print { border: none; border-radius: 0; max-width: 210mm; margin: 0 auto; }

@media print {
  .report-paper { border: none; }
  .print-page { background: #fff; }
}

/* ------------------------- the prescription document --------------------- */
/* Everything below prints. A script is read by a pharmacist in a hurry: the
   date and the pre-authorisation number are what they look for first, then
   the medicines with their codes. */

.rx-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin: 0 0 10px;
}
.rx-head__right { text-align: right; flex-shrink: 0; }
.rx-date__label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #666;
}
.rx-date__value { font-size: 15px; font-weight: 700; color: #111; }

.rx-preauth {
  display: inline-block; padding: 5px 10px;
  border: 1px solid #cdd6e0; border-radius: 6px; background: #f5f8fb;
  font-size: 12px;
}
.rx-preauth__label { font-weight: 700; color: var(--brand-primary); }
.rx-preauth__value { font-weight: 700; letter-spacing: .03em; }

/* The medicine table. Codes are monospaced so a mistyped digit is visible. */
.rx-items { width: 100%; border-collapse: collapse; font-size: 12px; }
.rx-items th {
  text-align: left; padding: 6px 8px;
  border-bottom: 1px solid #111; font-size: 10px;
  letter-spacing: .06em; text-transform: uppercase; color: #333;
}
.rx-items td { padding: 7px 8px; border-bottom: 1px solid #e3e8ee; vertical-align: top; }
.rx-items__no { width: 26px; color: #666; }
.rx-items__name { font-weight: 700; }
.rx-items__code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }

.rx-notes__text {
  margin: 0; padding: 8px 10px;
  border-left: 3px solid var(--brand-primary); background: #f5f8fb;
  font-size: 12px; white-space: pre-wrap;
}

.report-sig__practice { font-size: 12px; font-weight: 700; color: #333; margin: 6px 0 0; }
