:root {
  --bg: #f3f6f4;
  --bg-2: #ebf0ed;
  --ink: #13241f;
  --muted: #4c5d57;
  --accent: #2d7b63;
  --line: #d4e0d9;
  --card: #ffffff;
  --chip: #e1efe8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(1200px 500px at 10% -10%, #ffffff 0%, var(--bg) 56%, var(--bg-2) 100%);
  font-family: "Manrope", system-ui, -apple-system, sans-serif;
  line-height: 1.5;
}

.shell {
  width: min(1240px, 95vw);
  margin: 0 auto;
}

.top-bar {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 24px 0 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  font-family: "Fraunces", serif;
  font-size: 1.3rem;
  font-weight: 700;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 11px;
}

.top-nav {
  display: flex;
  gap: 16px;
  font-weight: 600;
}

.top-nav a {
  text-decoration: none;
  color: var(--muted);
}

.hero {
  padding: 24px 0 22px;
}

.eyebrow {
  display: inline-block;
  margin: 0;
  padding: 7px 12px;
  border-radius: 999px;
  background: #dceee5;
  color: #23513f;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 10px 0 8px;
  font-family: "Fraunces", serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.1;
}

.lead {
  margin: 0;
  max-width: 900px;
  color: var(--muted);
}

.data-disclaimer {
  margin: 14px 0 0;
  max-width: 900px;
  padding: 10px 12px;
  border: 1px solid #d6e6de;
  border-radius: 12px;
  background: #f7fbf9;
  color: #2f4640;
  font-size: 0.95rem;
}

.data-disclaimer a {
  color: #1f5f4a;
  font-weight: 700;
}

.data-disclaimer a:hover,
.data-disclaimer a:focus-visible {
  text-decoration: underline;
}

.controls {
  display: grid;
  grid-template-columns: minmax(220px, 2fr) minmax(160px, 1fr) minmax(160px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(4px);
}

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

.controls span {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: #355248;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 12px;
  background: #fff;
}

.ghost {
  height: 44px;
  border: 1px solid #b8ccc2;
  border-radius: 12px;
  background: #fff;
  color: #234f3f;
  font-weight: 700;
  cursor: pointer;
}

.results-meta {
  padding: 14px 2px 8px;
  color: var(--muted);
  font-weight: 600;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 350px) 1fr;
  gap: 16px;
  padding: 4px 0 36px;
  min-height: 560px;
}

.tree-panel,
.detail-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 8px 18px rgba(17, 35, 29, 0.08);
}

.tree-panel {
  overflow: auto;
}

.tree-container {
  padding: 12px;
}

.tree-empty {
  color: var(--muted);
  padding: 14px;
}

.tree-group {
  border-bottom: 1px solid #e8f0ec;
  padding: 7px 0 11px;
}

.tree-group:last-child {
  border-bottom: 0;
}

.tree-summary {
  font-weight: 700;
  color: #244f3f;
  cursor: pointer;
  list-style: none;
}

.tree-summary::-webkit-details-marker {
  display: none;
}

.tree-summary::before {
  content: "▸";
  margin-right: 8px;
  color: #3f6659;
}

details[open] > .tree-summary::before {
  content: "▾";
}

.tree-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.tree-item {
  width: 100%;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 10px;
  text-align: left;
  padding: 8px 10px;
  cursor: pointer;
  color: #1f3c33;
  font-size: 0.94rem;
}

.tree-item:hover,
.tree-item:focus-visible {
  background: #f1f8f4;
  border-color: #d7e9df;
  outline: none;
}

.tree-item.active {
  background: #e8f5ef;
  border-color: #b9ddcb;
  font-weight: 700;
}

.detail-panel {
  padding: 16px;
}

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

.detail-card {
  display: grid;
  gap: 14px;
}

.card-head {
  display: grid;
  gap: 8px;
  position: relative;
  padding-right: 40px;
}

.print-trigger {
  position: absolute;
  top: 0;
  right: 0;
  width: 34px;
  height: 34px;
  border: 1px solid #c9dcd2;
  border-radius: 10px;
  background: #f7fbf9;
  color: #264f40;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  line-height: 1;
}

.print-trigger:hover,
.print-trigger:focus-visible {
  background: #eaf5ef;
  border-color: #abcdbd;
  outline: none;
}

.print-trigger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.category-chip {
  margin: 0;
  display: inline-block;
  width: fit-content;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--chip);
  color: #245541;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.test-name {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.4rem;
  line-height: 1.2;
}

.card-block {
  border-top: 1px solid #e6efea;
  padding-top: 10px;
}

.card-block h3 {
  margin: 0 0 6px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #355248;
}

.card-block p {
  margin: 0;
  color: #2f4640;
}

.long-desc {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  white-space: pre-line;
}

.coding-block dl {
  margin: 0;
  display: grid;
  gap: 8px;
}

.coding-block div {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  align-items: baseline;
}

.coding-block dt {
  color: #4d665f;
  font-weight: 700;
  font-size: 0.86rem;
}

.coding-block dd {
  margin: 0;
}

.refs-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 7px;
}

.refs-list a {
  color: #255846;
  text-decoration: none;
  font-weight: 600;
}

.refs-list a:hover,
.refs-list a:focus-visible {
  text-decoration: underline;
}

.error-box {
  border: 1px solid #efb3b3;
  background: #fff4f4;
  color: #7d2222;
  padding: 14px;
  border-radius: 12px;
}

.is-hidden {
  display: none;
}

@media (max-width: 960px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }

  .search-wrap {
    grid-column: 1 / -1;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .tree-panel {
    max-height: 340px;
  }
}

@media (max-width: 640px) {
  .top-nav {
    display: none;
  }

  .controls {
    grid-template-columns: 1fr;
  }
}
