/* NHS-inspired public report styling — no NHS logo; not NHS-endorsed */

:root {
  --nhs-blue: #005EB8;
  --nhs-dark-blue: #003087;
  --nhs-bright-blue: #0072CE;
  --nhs-light-blue: #41B6E6;
  --nhs-green: #007F3B;
  --nhs-yellow: #FFEB3B;
  --nhs-red: #DA291C;
  --nhs-grey: #425563;
  --nhs-pale: #F0F4F5;
  --nhs-white: #FFFFFF;
  --text: #212B32;
  --border: #C8D0D4;
}

*, *::before, *::after { box-sizing: border-box; }

body.nhs-report {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--nhs-pale);
}

.nhs-report a { color: var(--nhs-blue); }
.nhs-report a:hover { color: var(--nhs-dark-blue); }

.nhs-report-header {
  background: linear-gradient(135deg, var(--nhs-dark-blue) 0%, var(--nhs-blue) 100%);
  color: var(--nhs-white);
  padding: 1.5rem 1.25rem 2rem;
}

.nhs-report-header .report-meta {
  font-size: 0.875rem;
  opacity: 0.92;
  margin: 0.25rem 0 0;
}

.nhs-report-header h1 {
  margin: 0.5rem 0 0.25rem;
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
}

.nhs-report-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem;
}

.nhs-caveat {
  background: #FFF8E1;
  border-left: 4px solid var(--nhs-yellow);
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
  border-radius: 0 4px 4px 0;
}

.nhs-caveat strong { color: #6B4E00; }

.nhs-warning {
  background: #FDEDEC;
  border-left: 4px solid var(--nhs-red);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 4px 4px 0;
}

.nhs-info {
  background: #E8F4FD;
  border-left: 4px solid var(--nhs-bright-blue);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  border-radius: 0 4px 4px 0;
}

.nhs-headline-reading {
  background: #E8F4FD;
  border-left: 4px solid var(--nhs-bright-blue);
  padding: 1rem 1.25rem;
  margin: 0.5rem 0 0;
  border-radius: 0 4px 4px 0;
}

.nhs-headline-reading .nhs-list-compact {
  margin: 0;
}

.nhs-findings-group {
  margin: 1.25rem 0 0;
}

.nhs-findings-group h3 {
  color: var(--nhs-blue);
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.nhs-finding-item {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.nhs-finding-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.nhs-finding-item h4 {
  color: var(--text);
  font-size: 1rem;
  margin: 0 0 0.35rem;
}

.nhs-finding-owner {
  font-size: 0.925rem;
  margin: 0.5rem 0 0;
  color: var(--nhs-grey);
}

.nhs-kfe-table--brief th,
.nhs-kfe-table--brief td {
  font-size: 0.925rem;
  vertical-align: top;
}

.nhs-section {
  background: var(--nhs-white);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.nhs-section h2 {
  color: var(--nhs-dark-blue);
  font-size: 1.25rem;
  margin: 0 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--nhs-light-blue);
}

.nhs-section h3 {
  color: var(--nhs-blue);
  font-size: 1.05rem;
  margin: 1rem 0 0.5rem;
}

.nhs-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.nhs-kpi {
  background: var(--nhs-pale);
  border-top: 3px solid var(--nhs-blue);
  padding: 0.85rem;
  border-radius: 4px;
  text-align: center;
}

.nhs-kpi-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--nhs-dark-blue);
  line-height: 1.2;
}

.nhs-kpi-label {
  display: block;
  font-size: 0.78rem;
  color: var(--nhs-grey);
  margin-top: 0.35rem;
}

.nhs-table-wrap {
  overflow-x: auto;
  margin: 0.75rem 0;
}

.nhs-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.nhs-table-wrap th {
  background: var(--nhs-dark-blue);
  color: var(--nhs-white);
  text-align: left;
  padding: 0.6rem 0.75rem;
  white-space: nowrap;
}

.nhs-table-wrap td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.nhs-table-wrap tr:nth-child(even) td { background: #FAFBFC; }

.nhs-chart {
  margin: 1rem 0;
}

.nhs-chart h3 {
  font-size: 0.95rem;
  color: var(--nhs-grey);
  margin-bottom: 0.75rem;
}

.nhs-bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 35%) 1fr;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.45rem;
}

.nhs-bar-label {
  font-size: 0.8rem;
  color: var(--nhs-grey);
  overflow: hidden;
  text-overflow: ellipsis;
}

.nhs-bar-track {
  background: #E2E8EA;
  border-radius: 3px;
  height: 1.1rem;
  overflow: hidden;
}

.nhs-bar-fill {
  background: var(--nhs-blue);
  height: 100%;
  min-width: 2px;
  border-radius: 3px 0 0 3px;
}

.nhs-bar-fill.alt { background: var(--nhs-bright-blue); }

.nhs-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  background: var(--nhs-pale);
  color: var(--nhs-grey);
  border: 1px solid var(--border);
}

.nhs-tag.ok { background: #E6F4EA; color: var(--nhs-green); border-color: #B7DFC3; }
.nhs-tag.warn { background: #FFF8E1; color: #6B4E00; border-color: #F0E082; }
.nhs-tag.miss { background: #FDEDEC; color: var(--nhs-red); border-color: #F5C6C0; }

.nhs-report-footer {
  background: var(--nhs-dark-blue);
  color: var(--nhs-white);
  padding: 1.5rem 1.25rem;
  margin-top: 2rem;
  font-size: 0.875rem;
}

.nhs-report-footer a { color: var(--nhs-light-blue); }

.nhs-report-nav {
  background: var(--nhs-white);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}

.nhs-report-nav a { margin-right: 1rem; }

.nhs-list-compact {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.nhs-list-compact li { margin-bottom: 0.35rem; }

.nhs-source-links {
  background: var(--nhs-pale);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1rem 0;
  font-size: 0.9rem;
}

.nhs-audit-summary {
  font-size: 0.85rem;
  overflow-x: auto;
}

.nhs-audit-summary table { min-width: 640px; }

.nhs-audit-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.5rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--nhs-white);
}

.nhs-audit-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--nhs-dark-blue);
}

.nhs-audit-dl {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
}

.nhs-audit-dl dt {
  font-weight: 600;
  margin-top: 0.5rem;
  color: var(--nhs-grey);
}

.nhs-audit-dl dd {
  margin: 0.15rem 0 0;
}

.nhs-audit-note {
  font-size: 0.85rem;
  color: var(--nhs-grey);
  margin-top: 1rem;
}

.nhs-agent-box {
  background: #E8F4FD;
  border-left: 4px solid var(--nhs-bright-blue);
  padding: 1rem 1.25rem;
  margin: 0;
  border-radius: 0 4px 4px 0;
}

.nhs-prompt-excerpt {
  font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  line-height: 1.5;
  background: var(--nhs-pale);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0 0;
  white-space: pre-wrap;
  overflow-x: auto;
}

.nhs-agent-process ol {
  margin: 0.5rem 0 0;
  padding-left: 1.35rem;
}

.nhs-agent-process li {
  margin-bottom: 0.4rem;
}

.nhs-cannot-conclude {
  background: #FFF8E1;
  border-left: 4px solid var(--nhs-yellow);
  padding: 1rem 1.25rem;
  margin: 0;
  border-radius: 0 4px 4px 0;
}

.nhs-cannot-conclude ul {
  margin: 0.5rem 0 0;
  padding-left: 1.25rem;
}

.nhs-verify-block .nhs-verify-intro {
  margin-bottom: 1rem;
}

.nhs-verify-block details.nhs-verify-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.75rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--nhs-white);
}

.nhs-verify-block details.nhs-verify-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--nhs-dark-blue);
}

details.nhs-support-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.75rem 0 0;
  padding: 0.5rem 0.75rem;
  background: var(--nhs-white);
}

details.nhs-support-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--nhs-dark-blue);
  font-size: 0.95rem;
}

.nhs-support-details-body {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.nhs-support-details-body .nhs-section {
  border: none;
  padding: 0;
  margin: 0;
}

.nhs-data-meta {
  margin-top: 0.75rem;
}

.nhs-agent-box p {
  margin: 0 0 0.65rem;
}

.nhs-agent-box p:last-child {
  margin-bottom: 0;
}

.nhs-metric-commentary {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.nhs-metric-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  background: var(--nhs-pale);
}

.nhs-metric-card-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.nhs-metric-card dl {
  margin: 0;
  font-size: 0.9rem;
}

.nhs-metric-card dt {
  font-weight: 600;
  color: var(--nhs-dark-blue);
  margin-top: 0.65rem;
}

.nhs-metric-card dt:first-child {
  margin-top: 0;
}

.nhs-metric-card dd {
  margin: 0.15rem 0 0;
}

.nhs-agent-flag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.nhs-agent-flag--strength {
  background: #E6F4EA;
  color: #007F3B;
}

.nhs-agent-flag--review {
  background: #FFF8E1;
  color: #6B4E00;
}

.nhs-agent-flag--watch {
  background: #E8F4FD;
  color: #003087;
}

.nhs-agent-flag--definition {
  background: #F0F4F5;
  color: var(--nhs-grey);
}

.key-figures-explained {
  border-left: 4px solid var(--nhs-green);
}

.nhs-kfe-table {
  font-size: 0.875rem;
  width: 100%;
  min-width: 60rem;
  border-collapse: collapse;
}

.nhs-kfe-table th[scope="row"] {
  background: var(--nhs-white);
  font-weight: 600;
  color: var(--nhs-dark-blue);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 9rem;
  max-width: 14rem;
}

.nhs-kfe-table tr:nth-child(even) th[scope="row"] {
  background: #FAFBFC;
}

.nhs-kfe-table td,
.nhs-kfe-table th {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.nhs-kfe-table td:nth-child(6),
.nhs-kfe-table td:nth-child(7) {
  max-width: 16rem;
}

.nhs-trend-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
}

.nhs-trend-badge--improving {
  background: #E6F4EA;
  color: #007F3B;
}

.nhs-trend-badge--worsening {
  background: #FDEDEC;
  color: #DA291C;
}

.nhs-trend-badge--stable {
  background: #E8F4FD;
  color: #003087;
}

.nhs-trend-badge--unclear {
  background: #FFF8E1;
  color: #6B4E00;
}

.nhs-trend-badge--na {
  background: #F0F4F5;
  color: var(--nhs-grey);
}

.nhs-trend-badge--validation {
  background: var(--nhs-white);
  color: var(--nhs-blue);
  border: 1px solid var(--nhs-bright-blue);
}

.nhs-comparator-label {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.35rem;
  border-radius: 2px;
  background: var(--nhs-pale);
  color: var(--nhs-grey);
  margin-right: 0.25rem;
  vertical-align: baseline;
}

.nhs-human-check {
  font-style: italic;
  color: var(--nhs-grey);
  font-size: 0.85rem;
}

.nhs-bp-questions li {
  margin-bottom: 1rem;
}

.nhs-bp-expl {
  margin: 0.35rem 0 0;
  font-size: 0.9rem;
  color: var(--nhs-grey);
  font-weight: normal;
}

.nhs-trend-section {
  border-left: 4px solid var(--nhs-dark-blue);
  padding-left: 1rem;
}

.nhs-period-caption {
  font-size: 0.875rem;
  color: var(--nhs-grey);
  margin: 0.35rem 0 0.75rem;
}

.nhs-period-caption strong {
  color: var(--text);
}

.nhs-period-extract {
  font-size: 0.8rem;
  color: var(--nhs-grey);
}

.nhs-scope-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--nhs-dark-blue);
  background: #E8F4FD;
  border: 1px solid var(--nhs-bright-blue);
  border-radius: 4px;
  padding: 0.35rem 0.65rem;
  margin: 0.5rem 0 1rem;
}

.nhs-priority-callout {
  background: #FFF8E1;
  border-left: 4px solid #F0AD00;
  padding: 0.85rem 1rem;
  margin: 0.75rem 0 1rem;
  border-radius: 0 4px 4px 0;
  font-size: 0.925rem;
}

.nhs-priority-callout strong {
  color: #6B4E00;
}

.nhs-priority-callout ul {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
}

.nhs-bottom-line {
  background: var(--nhs-white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--nhs-green);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 0 4px 4px 0;
}

.nhs-bottom-line h2 {
  margin-top: 0;
  font-size: 1.1rem;
  color: var(--nhs-dark-blue);
}

.nhs-why-useful {
  background: #F7FAFB;
  border: 1px solid var(--border);
  padding: 1rem 1.25rem;
  margin: 1rem 0 1.5rem;
  border-radius: 4px;
}

.nhs-why-useful h2 {
  margin-top: 0;
  font-size: 1.05rem;
  color: var(--nhs-blue);
}

.nhs-standard-cite {
  display: block;
  font-size: 0.75rem;
  font-style: normal;
  color: var(--nhs-grey);
  margin-top: 0.25rem;
}

.nhs-standard-cite a {
  color: var(--nhs-grey);
  text-decoration: underline;
}

.nhs-validation-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.2rem 0.45rem;
  border-radius: 3px;
  line-height: 1.3;
  max-width: 12rem;
  white-space: normal;
}

.nhs-validation-badge--unclear {
  background: #FFF8E1;
  color: #6B4E00;
}

.nhs-validation-badge--review {
  background: #E8F4FD;
  color: #003087;
}

.nhs-validation-badge--validation {
  background: var(--nhs-white);
  color: var(--nhs-blue);
  border: 1px solid var(--nhs-bright-blue);
}

.nhs-validation-badge--na {
  background: #F0F4F5;
  color: var(--nhs-grey);
}

.nhs-kfe-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.5rem 0 1rem;
}

.nhs-trend-caveats {
  margin-top: 1rem;
  font-size: 0.9rem;
}

@media (max-width: 600px) {
  .nhs-bar-row { grid-template-columns: 1fr; }
  .nhs-kpi-row { grid-template-columns: 1fr 1fr; }

  .nhs-kfe-table {
    min-width: 0;
    font-size: 0.8rem;
  }

  .nhs-kfe-table thead {
    display: none;
  }

  .nhs-kfe-table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.5rem;
    background: var(--nhs-white);
  }

  .nhs-kfe-table th[scope="row"] {
    display: block;
    max-width: none;
    min-width: 0;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
    margin-bottom: 0.35rem;
  }

  .nhs-kfe-table td {
    display: block;
    padding: 0.35rem 0;
    border-bottom: none;
  }

  .nhs-kfe-table td::before {
    content: attr(data-label);
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--nhs-grey);
    margin-bottom: 0.15rem;
  }

  .nhs-scope-badge,
  .nhs-priority-callout,
  .nhs-bottom-line {
    font-size: 0.9rem;
  }
}
