:root {
  --green: #2f641e;
  --green-dark: #245018;
  --purple: #34224f;
  --purple-mid: #625893;
  --purple-soft: #d5d2df;
  --purple-pale: #f3f1f7;
  --grey-100: #f6f6f7;
  --grey-200: #e9e9ec;
  --grey-300: #d4d2d8;
  --grey-700: #5c5864;
  --white: #ffffff;
  --text: #1f1d24;
  --radius: 8px;
  --shadow: 0 8px 22px rgba(31, 29, 36, 0.08);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--text);
  background: var(--white);
  line-height: 1.5;
}

a { color: var(--green); }
a:hover { color: var(--green-dark); }

button, select, input, a.button {
  font: inherit;
}

.top-panel {
  background: var(--green);
  color: var(--white);
}

.top-panel__inner {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) 1fr 1fr;
  gap: 1.5rem;
  max-width: 1260px;
  margin: 0 auto;
  padding: 1.35rem 1.5rem 1.2rem;
}

.selector-panel, .info-panel {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: .8rem;
  align-items: start;
}

.panel-icon {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  color: var(--green);
  background: var(--white);
  border-radius: 50%;
  font-weight: 700;
}

.panel-icon i {
  font-size: 1rem;
}

.top-panel h1,
.top-panel h2 {
  margin: 0 0 .45rem;
  font-size: 1.05rem;
  line-height: 1.2;
}

.top-panel p {
  margin: 0 0 .8rem;
}

select,
.hospital-search {
  width: 100%;
  padding: .65rem .75rem;
  border: 2px solid transparent;
  border-radius: 3px;
  background: var(--white);
  color: var(--text);
}

.hospital-combobox {
  position: relative;
  width: 100%;
  max-width: 390px;
}

.hospital-combobox__field {
  position: relative;
  display: flex;
  align-items: stretch;
}

.hospital-search {
  padding-right: 2.8rem;
}

.hospital-combobox__toggle {
  position: absolute;
  top: 2px;
  right: 2px;
  bottom: 2px;
  display: inline-grid;
  width: 2.4rem;
  place-items: center;
  border: 0;
  border-left: 1px solid var(--grey-300);
  border-radius: 0 3px 3px 0;
  color: var(--purple);
  background: var(--white);
  cursor: pointer;
}

.hospital-options {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  margin: 0;
  padding: .35rem 0;
  overflow-y: auto;
  border: 1px solid var(--grey-300);
  border-radius: 4px;
  color: var(--text);
  background: var(--white);
  box-shadow: var(--shadow);
  list-style: none;
}

.hospital-option {
  padding: .65rem .85rem;
  cursor: pointer;
}

.hospital-option:hover,
.hospital-option[aria-selected="true"] {
  color: var(--white);
  background: var(--green);
}

.hospital-option--empty {
  color: var(--grey-700);
  cursor: default;
}

.hospital-option--empty:hover {
  color: var(--grey-700);
  background: var(--white);
}

.input-help {
  margin: .35rem 0 0;
  font-size: .85rem;
  opacity: .9;
}

.hospital-help-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .55rem;
  padding: 0;
  border: 0;
  color: var(--white);
  background: transparent;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.hospital-help-panel {
  max-width: 390px;
  margin-top: .55rem;
  padding: .7rem .8rem;
  border-left: 4px solid var(--white);
  border-radius: 3px;
  color: var(--text);
  background: var(--white);
}

.hospital-help-panel p {
  margin: 0;
}

select:focus,
.hospital-search:focus,
.hospital-combobox__toggle:focus,
button:focus,
a:focus {
  outline: 3px solid #f9d949;
  outline-offset: 2px;
}

.button {
  display: inline-block;
  padding: .55rem .8rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 700;
}

.button--light {
  color: var(--green-dark);
  background: var(--white);
}

.metric-nav {
  border-bottom: 1px solid var(--grey-300);
  background: var(--white);
}

.metric-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: .5rem;
  max-width: 1260px;
  margin: 0 auto;
  padding: .75rem .75rem .6rem;
}

.metric-tab {
  min-height: 112px;
  padding: .9rem .75rem;
  border: 1px solid var(--grey-300);
  border-radius: 4px;
  color: var(--purple);
  background: var(--white);
  text-align: center;
  cursor: pointer;
}

.metric-tab[aria-selected="true"] {
  background: var(--purple-soft);
  border-color: var(--purple-soft);
}

.metric-tab[aria-disabled="true"] {
  opacity: .72;
}

.metric-tab__icon {
  display: block;
  margin-bottom: .45rem;
  font-size: 1.8rem;
  line-height: 1;
}

.metric-tab__icon i {
  color: var(--purple);
}

.metric-tab__label {
  display: block;
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.15;
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 0;
  justify-content: center;
  border-bottom: 1px solid var(--grey-200);
  background: var(--grey-100);
}

.section-nav a {
  padding: .9rem 1.4rem;
  color: var(--grey-700);
  text-decoration: none;
  font-size: .92rem;
}

.section-nav a:hover,
.section-nav a:focus {
  color: var(--purple);
  background: var(--white);
}

.page-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.2rem 1.5rem 3rem;
}


.content-section {
  padding: 1.5rem 0;
  scroll-margin-top: 70px;
}

.content-section--with-border {
  border-top: 1px solid var(--grey-300);
}

h2 {
  margin: 0 0 .75rem;
  color: var(--purple);
  font-size: 1.55rem;
  line-height: 1.15;
}

.metric-full-label {
  max-width: 850px;
  margin: 0 0 1rem;
  color: var(--green);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.25;
}

.prose p { margin: 0 0 .8rem; }

.content-list {
  margin: 0 0 1rem 1.2rem;
  padding: 0;
}

.content-list li {
  margin-bottom: .65rem;
}

.content-list ul {
  margin-top: .45rem;
  margin-bottom: 0;
}

.source-panel__detail {
  margin-top: .9rem;
}

.source-panel__detail > p {
  margin-bottom: .35rem;
}


.link-button {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-top: .55rem;
  padding: 0;
  border: 0;
  color: var(--green);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
}

.link-button::after {
  content: "▾";
  font-size: .9rem;
}

.link-button[aria-expanded="true"]::after { content: "▴"; }

.link-button:hover,
.link-button:focus,
.hospital-help-toggle:hover,
.hospital-help-toggle:focus {
  text-decoration: none;
}

.source-panel {
  margin-top: 1rem;
  padding: 1rem;
  border-left: 4px solid var(--green);
  background: var(--grey-100);
}

.section-heading-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: space-between;
}

.section-subtitle {
  margin: -.3rem 0 1.25rem;
  color: var(--purple);
  font-size: 1.2rem;
}

.empty-state {
  padding: 1rem;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  background: var(--grey-100);
}

.empty-state p { margin: .25rem 0 0; }

.result-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.4rem;
  margin: 1.2rem 0;
}

.result-card {
  min-height: 116px;
  padding: 1.1rem 1rem;
  border: 1px solid var(--grey-300);
  border-radius: 5px;
  background: var(--white);
  text-align: center;
}

.result-card--primary {
  border-color: var(--purple-soft);
  background: var(--purple-soft);
}

.result-card--muted {
  background: var(--grey-100);
}

.result-card__label {
  margin: 0 0 .35rem;
  color: var(--purple);
  font-size: .9rem;
  font-weight: 700;
}

.result-card__value {
  margin: 0;
  color: var(--purple);
  font-size: clamp(2.2rem, 7vw, 3.5rem);
  font-weight: 700;
  line-height: 1;
}

.result-card__meta {
  margin: .45rem 0 0;
  color: var(--grey-700);
  font-size: .82rem;
}


.data-notification {
  margin: .35rem 0 1rem;
  padding: .9rem 1rem;
  border-left: 4px solid var(--purple-mid);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--purple-pale);
}

.data-notification__body {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  gap: .55rem;
  align-items: start;
}

.data-notification__icon {
  margin-top: .2rem;
  color: var(--purple);
}

.data-notification p {
  margin: 0 0 .45rem;
}

.data-notification p:last-child {
  margin-bottom: 0;
}

.narrative-text {
  margin-top: 1rem;
  font-size: 1.05rem;
}

.comparison-panels {
  display: grid;
  gap: 1.7rem;
}

.comparison-panel h3 {
  margin: 0 0 .75rem;
  color: var(--purple);
  font-size: 1.05rem;
}

.range-wrap {
  margin: .35rem 0 .95rem;
  padding-top: .65rem;
}

.range-track {
  position: relative;
  height: 42px;
  overflow: visible;
  border: 1px solid var(--purple);
  border-radius: 4px;
  background: linear-gradient(90deg,
    #efeff2 0%, #efeff2 20%,
    #c8c4d9 20%, #c8c4d9 40%,
    #8d86bb 40%, #8d86bb 60%,
    #665d99 60%, #665d99 80%,
    #3d2a5c 80%, #3d2a5c 100%);
}

.range-marker {
  position: absolute;
  bottom: 6px;
  width: 24px;
  height: 24px;
  transform: translateX(-50%);
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 0 0 1px rgba(52, 34, 79, .25), var(--shadow);
}

.range-marker-label {
  position: absolute;
  bottom: 48px;
  transform: translateX(-50%);
  color: var(--purple);
  font-size: .82rem;
  font-weight: 700;
  white-space: nowrap;
}

.range-boundary {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  transform: translateX(-.5px);
  background: rgba(52, 34, 79, .85);
}

.range-labels {
  position: relative;
  height: 1.7rem;
  margin-top: .45rem;
  color: var(--purple);
  font-size: .82rem;
}

.range-label {
  position: absolute;
  top: 0;
  white-space: nowrap;
}

.range-label--left { transform: translateX(0); }
.range-label--centre { transform: translateX(-50%); }
.range-label--right { transform: translateX(-100%); }

.comparison-text {
  margin: 0;
  font-size: 1.03rem;
}

.resource-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.resource-card {
  display: flex;
  flex-direction: column;
  min-height: 160px;
  padding: 1.05rem;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  background: var(--white);
  box-shadow: var(--shadow);
}

.resource-card h3 {
  margin: 0 0 .6rem;
  color: var(--purple);
  font-size: 1rem;
}

.resource-card p {
  margin: 0 0 .9rem;
  color: var(--grey-700);
  font-size: .92rem;
}

.resource-card a {
  margin-top: auto;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .top-panel__inner,
  .metric-tabs,
  .result-cards,
  .resource-cards {
    grid-template-columns: 1fr;
  }

  .metric-tab {
    min-height: 0;
    display: grid;
    grid-template-columns: 42px 1fr;
    align-items: center;
    text-align: left;
  }

  .metric-tab__icon { margin: 0; }

  .section-nav {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .section-nav a {
    flex: 0 0 auto;
  }
}

@media print {
  .top-panel, .metric-nav, .section-nav, .link-button { display: none; }
  .page-shell { max-width: none; padding: 0; }
  .content-section { break-inside: avoid; }
}

/* v4 additions */
.hospital-option__name,
.hospital-option__org {
  display: block;
}

.hospital-option__name {
  font-weight: 700;
  line-height: 1.25;
}

.hospital-option__org {
  margin-top: .15rem;
  font-size: .82rem;
  line-height: 1.25;
  color: var(--grey-700);
}

.hospital-option:hover .hospital-option__org,
.hospital-option[aria-selected="true"] .hospital-option__org {
  color: rgba(255, 255, 255, .9);
}

.metric-tab {
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
}

.metric-tab:not([aria-selected="true"]):hover {
  background: var(--purple-pale);
}

.yes-no-wrap {
  margin: .35rem 0 .95rem;
}

.yes-no-track {
  display: flex;
  height: 42px;
  overflow: hidden;
  border: 1px solid var(--purple);
  border-radius: 4px;
  background: var(--grey-100);
}

.yes-no-track__yes {
  display: block;
  background: var(--purple);
}

.yes-no-track__no {
  display: block;
  background: var(--grey-100);
}

.yes-no-labels {
  display: flex;
  justify-content: space-between;
  margin-top: .45rem;
  color: var(--purple);
  font-size: .82rem;
  font-weight: 700;
}
