:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #12213b;
  --muted: #637083;
  --line: #dbe4f0;
  --blue: #174ebd;
  --blue-dark: #0b2f73;
  --blue-soft: #eaf1ff;
  --green: #15845b;
  --green-soft: #e8f7ef;
  --gold: #f4b400;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(17, 37, 72, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

main,
.app-header,
.app-footer {
  width: min(100% - 32px, 1240px);
  margin: 0 auto;
}

.app-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--blue-dark);
  font-size: 24px;
  font-weight: 900;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
}

.app-header nav {
  display: flex;
  gap: 20px;
  color: #41516a;
  font-size: 14px;
  font-weight: 800;
}

.app-header nav a:hover {
  color: var(--blue);
}

.summary-panel,
.search-shell,
.data-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.summary-panel {
  min-height: 250px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 28px;
  padding: 34px;
  background:
    linear-gradient(135deg, rgba(23, 78, 189, 0.95), rgba(11, 47, 115, 0.97)),
    var(--blue-dark);
  color: #fff;
}

.source-label {
  margin: 0 0 10px;
  color: #ffe194;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 830px;
  margin-bottom: 12px;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

.summary-panel p:not(.source-label) {
  max-width: 780px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 18px;
}

.load-status {
  min-width: 230px;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-weight: 800;
}

.load-status.ready {
  background: rgba(21, 132, 91, 0.24);
}

.load-status.error {
  background: rgba(180, 35, 24, 0.24);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 18px 0;
}

.stats-grid article {
  min-height: 116px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stats-grid span {
  color: var(--blue-dark);
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1;
  font-weight: 900;
}

.stats-grid strong {
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.search-shell {
  padding: 24px;
}

.search-header,
.section-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  margin-bottom: 18px;
}

.search-header h2,
.section-heading h2 {
  margin-bottom: 4px;
  color: var(--blue-dark);
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.1;
}

.search-header p,
.section-heading p,
.data-note {
  margin-bottom: 0;
  color: var(--muted);
}

.ghost-button,
.load-more {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.ghost-button:hover,
.load-more:hover {
  border-color: var(--blue);
}

.filters {
  display: grid;
  grid-template-columns: minmax(280px, 1.4fr) minmax(180px, 0.8fr) minmax(140px, 0.55fr) minmax(190px, 0.8fr);
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

label {
  display: grid;
  gap: 6px;
}

label span {
  color: #3e4d65;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #cdd8e8;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(23, 78, 189, 0.16);
}

.check-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.check-row span {
  text-transform: none;
  font-size: 14px;
}

.directory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.results-list {
  display: grid;
  gap: 12px;
}

.donor-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.donor-card:hover,
.donor-card.active {
  border-color: var(--blue);
  box-shadow: 0 12px 24px rgba(23, 78, 189, 0.1);
  transform: translateY(-1px);
}

.donor-card h3 {
  margin-bottom: 6px;
  color: var(--blue-dark);
  font-size: 20px;
  line-height: 1.2;
}

.meta-line,
.category-line,
.contact-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.meta-line {
  color: var(--muted);
  font-size: 14px;
}

.donor-card p {
  margin: 12px 0;
  color: #4f5d73;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 900;
}

.pill.green {
  background: var(--green-soft);
  color: var(--green);
}

.pill.gold {
  background: #fff2c2;
  color: #855c00;
}

.donor-metrics {
  min-width: 150px;
  display: grid;
  gap: 8px;
}

.metric-box {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  text-align: right;
}

.metric-box strong {
  display: block;
  color: var(--blue-dark);
  font-size: 18px;
}

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

.load-more {
  width: 100%;
  margin-top: 14px;
}

.detail-panel {
  position: sticky;
  top: 16px;
  min-height: 380px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.empty-detail {
  color: var(--muted);
}

.detail-panel h2 {
  margin-bottom: 8px;
  color: var(--blue-dark);
  font-size: 24px;
  line-height: 1.16;
}

.detail-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.detail-list div {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-list strong {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.detail-list span,
.detail-list a {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.detail-list a {
  color: var(--blue);
  font-weight: 800;
}

.data-section {
  margin-top: 18px;
  padding: 24px;
}

.category-grid,
.sample-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.category-card,
.sample-card {
  min-height: 160px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.category-card h3,
.sample-card h3 {
  margin-bottom: 10px;
  color: var(--blue-dark);
}

.category-card dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0;
}

.category-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.category-card dd {
  margin: 0;
  color: var(--blue-dark);
  font-size: 22px;
  font-weight: 900;
}

.sample-card ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.sample-card li {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sample-card li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.sample-card strong {
  display: block;
  color: var(--green);
}

.sample-card p {
  margin: 4px 0 0;
  color: #4f5d73;
  font-size: 14px;
}

.data-note {
  margin-top: 18px;
  padding: 14px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid var(--line);
}

.app-footer {
  padding: 32px 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

@media (max-width: 980px) {
  .summary-panel,
  .directory-layout,
  .filters,
  .stats-grid,
  .category-grid,
  .sample-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 680px) {
  main,
  .app-header,
  .app-footer {
    width: min(100% - 24px, 1240px);
  }

  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 0;
  }

  .app-header nav {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .summary-panel,
  .search-shell,
  .data-section {
    padding: 18px;
  }

  .search-header,
  .section-heading,
  .donor-card {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .donor-metrics {
    min-width: 0;
  }

  .metric-box {
    text-align: left;
  }
}
