@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

:root {
  --bg: #f3f7f7;
  --surface: #ffffff;
  --surface-soft: #edf4f3;
  --ink: #102638;
  --muted: #617481;
  --line: #d4e2e1;
  --accent: #087d78;
  --accent-strong: #075d5d;
  --orange: #ff7a4f;
  --low: #3979d3;
  --normal: #16815d;
  --high: #d0513d;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; color: var(--ink); background: radial-gradient(circle at 88% 0%, rgba(80, 190, 174, .15), transparent 28rem), var(--bg); font-family: "DM Sans", sans-serif; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.reference-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 76px; padding: 12px clamp(18px, 4vw, 58px); border-bottom: 1px solid rgba(16, 38, 56, .09); background: rgba(250, 253, 252, .9); backdrop-filter: blur(18px); }
.reference-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; }
.reference-brand > span:last-child { display: grid; }
.reference-brand strong { font-family: "Space Grotesk", sans-serif; line-height: 1; }
.reference-brand small { margin-top: 4px; color: var(--muted); font-size: .65rem; letter-spacing: .11em; text-transform: uppercase; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: white; background: linear-gradient(145deg, var(--accent), var(--accent-strong)); font-family: "Space Grotesk", sans-serif; font-weight: 800; box-shadow: 0 8px 20px rgba(7, 93, 93, .2); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle, .back-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface); font-size: .74rem; font-weight: 800; text-decoration: none; cursor: pointer; }
.theme-toggle:hover, .theme-toggle:focus-visible, .back-button:hover, .back-button:focus-visible { border-color: var(--accent); outline: none; }
.back-button { color: white; border-color: var(--accent-strong); background: var(--accent-strong); }

main { width: min(1260px, 100%); margin: auto; padding: clamp(38px, 6vw, 82px) clamp(18px, 4vw, 58px) 70px; }
.reference-hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: clamp(28px, 7vw, 92px); align-items: end; }
.eyebrow { margin: 0 0 16px; color: var(--accent); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: clamp(2.8rem, 6vw, 5.8rem); letter-spacing: -.065em; line-height: .92; }
h1 em { color: var(--accent); font-style: normal; }
.hero-copy { max-width: 680px; margin: 24px 0 0; color: var(--muted); font-size: clamp(.95rem, 1.2vw, 1.08rem); line-height: 1.7; }
.hero-summary { display: grid; grid-template-columns: repeat(3, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 18px 45px rgba(29, 75, 75, .08); }
.hero-summary div { min-width: 0; padding: 22px 10px; text-align: center; }
.hero-summary div + div { border-left: 1px solid var(--line); }
.hero-summary strong { display: block; color: var(--accent); font-family: "Space Grotesk", sans-serif; font-size: 1.8rem; }
.hero-summary span { display: block; margin-top: 4px; color: var(--muted); font-size: .66rem; line-height: 1.3; }

.reference-workspace { margin-top: clamp(42px, 7vw, 82px); }
.reference-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.search-field { display: flex; align-items: center; gap: 10px; width: min(620px, 100%); }
.search-field > span { color: var(--accent); font-size: 1.4rem; }
.search-field input { width: 100%; padding: 10px 2px; border: 0; outline: 0; color: var(--ink); background: transparent; }
.clear-button { flex: 0 0 auto; min-height: 38px; padding: 0 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--accent-strong); background: var(--surface); font-size: .72rem; font-weight: 800; cursor: pointer; }
.group-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 12px; }
.group-filters button { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: .72rem; font-weight: 800; cursor: pointer; }
.group-filters button.active { color: white; border-color: var(--accent); background: var(--accent); }
.status-legend { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 24px; color: var(--muted); font-size: .7rem; }
.status-legend span { display: inline-flex; align-items: center; gap: 6px; }
.status-legend i { width: 8px; height: 8px; border-radius: 50%; }
.status-legend .low { background: var(--low); }.status-legend .normal { background: var(--normal); }.status-legend .high { background: var(--high); }

.reference-groups { display: grid; gap: 22px; }
.reference-group { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 12px 34px rgba(18, 60, 64, .055); }
.group-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.group-heading h2 { margin: 0; font-family: "Space Grotesk", sans-serif; font-size: 1rem; }
.group-heading span { color: var(--muted); font-size: .68rem; font-weight: 700; }
.reference-row { display: grid; grid-template-columns: minmax(210px, 1.3fr) minmax(130px, .7fr) minmax(150px, .75fr) 92px; align-items: center; gap: 16px; min-height: 78px; padding: 12px 20px; }
.reference-row + .reference-row { border-top: 1px solid var(--line); }
.test-name strong { display: block; font-size: .9rem; }
.test-name span { display: block; margin-top: 4px; color: var(--muted); font-size: .68rem; }
.range-value strong { color: var(--accent-strong); font-family: "Space Grotesk", sans-serif; font-size: .95rem; }
.range-value span { margin-left: 5px; color: var(--muted); font-size: .67rem; white-space: nowrap; }
.result-field { position: relative; }
.result-field input { width: 100%; min-height: 42px; padding: 0 48px 0 11px; border: 1px solid var(--line); border-radius: 9px; outline: none; color: var(--ink); background: var(--bg); }
.result-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.result-field small { position: absolute; top: 50%; right: 10px; color: var(--muted); font-size: .59rem; transform: translateY(-50%); }
.result-status { justify-self: end; min-width: 82px; padding: 7px 8px; border-radius: 999px; color: var(--muted); background: var(--surface-soft); font-size: .64rem; font-weight: 800; text-align: center; }
.result-status.low { color: var(--low); background: color-mix(in srgb, var(--low) 12%, transparent); }
.result-status.normal { color: var(--normal); background: color-mix(in srgb, var(--normal) 12%, transparent); }
.result-status.high { color: var(--high); background: color-mix(in srgb, var(--high) 12%, transparent); }
.empty-state { padding: 42px 20px; border: 1px dashed var(--line); border-radius: 14px; color: var(--muted); text-align: center; }
.reference-note { display: flex; gap: 13px; max-width: 980px; margin-top: 22px; padding: 16px 18px; border-left: 3px solid var(--orange); color: var(--muted); background: var(--surface); font-size: .75rem; line-height: 1.55; }
.reference-note > span { display: grid; place-items: center; flex: 0 0 22px; height: 22px; border-radius: 50%; color: white; background: var(--orange); font-weight: 800; }
.reference-note p { margin: 0; }

html[data-theme="dark"] { color-scheme: dark; --bg: #081116; --surface: #0f1d23; --surface-soft: #14262c; --ink: #e5efed; --muted: #9bafb3; --line: #294047; --accent: #69d1c6; --accent-strong: #3db5ab; --low: #79aaff; --normal: #79d9aa; --high: #ff9986; }
html[data-theme="dark"] body { background: radial-gradient(circle at 88% 0%, rgba(48, 158, 145, .12), transparent 28rem), var(--bg); }
html[data-theme="dark"] .reference-header { border-bottom-color: rgba(178, 216, 211, .1); background: rgba(8, 17, 22, .91); }
html[data-theme="dark"] .back-button { color: #071513; background: var(--accent); }
html[data-theme="dark"] .result-field input { background: #0a171c; }

@media (max-width: 820px) {
  .reference-hero { grid-template-columns: 1fr; align-items: start; }
  .reference-row { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; padding-block: 15px; }
  .test-name { grid-column: 1; }.range-value { grid-column: 2; text-align: right; }.result-field { grid-column: 1; }.result-status { grid-column: 2; }
}
@media (max-width: 560px) {
  .reference-header { align-items: center; padding-inline: 14px; }
  .reference-brand small, .theme-toggle [data-theme-label], .back-button > span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .theme-toggle { width: 40px; padding: 0; }.back-button { width: 40px; padding: 0; }
  main { padding-top: 38px; }
  .hero-summary div { padding: 17px 7px; }.hero-summary strong { font-size: 1.45rem; }
  .reference-toolbar { align-items: stretch; flex-direction: column; }.clear-button { align-self: flex-start; }
  .reference-row { grid-template-columns: 1fr; }
  .test-name, .range-value, .result-field, .result-status { grid-column: 1; text-align: left; }
  .result-status { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
