@font-face {
  font-family: "Source Sans 3";
  src: url("fonts/SourceSans3.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("fonts/SourceSerif4.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #fcf9f4;
  --surface: #ffffff;
  --ink: #261e1b;
  --muted: #6b5d56;
  --accent: #c2413b;
  --accent-hover: #a3322d;
  --tint: #fdf0e6;
  --line: #eae0d5;
  --control-border: #9c8a82;
  --error: #9c2b33;
  --plot: #261e1b;
  --plot-text: #fdf0e6;
  --plot-muted: #6b5d56;
  --radius: 10px;
  --gutter: clamp(16px, 4vw, 48px);
  --sans: "Source Sans 3", "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.55 var(--sans);
}

main { flex: 1; }
.wrap {
  width: min(calc(100% - var(--gutter) - var(--gutter)), 74rem);
  margin-inline: auto;
}

h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  line-height: 1.12;
  letter-spacing: -0.032em;
}
h2 { font-size: clamp(1.65rem, 2.8vw, 2.125rem); }
h3 { font-size: 1.45rem; }
a { color: var(--accent); }
button, input, select { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: var(--gutter);
  padding: 8px 14px;
  transform: translateY(calc(-100% - 16px));
  border-radius: var(--radius);
  background: var(--surface);
}
.skip-link:focus { transform: translateY(0); }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.brand img { width: 46px; height: 46px; }
.site-nav, .tool-nav { display: flex; gap: 4px; }
.site-nav a, .tool-nav a {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 8px 15px;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 1.0625rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}
.site-nav a:hover, .site-nav a[aria-current="page"] {
  background: var(--tint);
  color: var(--accent);
}

.hero-band {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(115deg, #fff8ef, #fceee5 58%, #f8efe6);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(28px, 4.35vw, 64px);
  padding-block: clamp(46px, 5.2vw, 76px);
}
.eyebrow {
  margin-bottom: 14px;
  color: var(--accent);
  font-weight: 650;
  font-size: 0.875rem;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(2.9rem, 4.3vw, 4.1rem);
  line-height: 1.05;
  letter-spacing: -0.052em;
  text-wrap: balance;
}
.intro {
  max-width: 52ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: clamp(1.06rem, 1.5vw, 1.25rem);
  line-height: 1.55;
}
.hero-actions, .form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}
.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  /* A <button> keeps the browser's own grey face unless the background is
     stated. On the dark hero plate that grey box swallows the light text,
     so every variant sets its own background explicitly. */
  background: transparent;
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.button span { font-size: 1.15em; line-height: 1; }
.primary { background: var(--accent); color: var(--surface); }
.primary:hover { background: var(--accent-hover); }
.secondary { border-color: var(--control-border); color: var(--accent); }
.secondary:hover { background: var(--surface); }
.button:disabled {
  background: var(--tint);
  color: var(--muted);
  cursor: default;
}
/* The run button leads back to a current result; a soft ring marks it
   without competing with the red fill or the keyboard focus outline. */
.button.is-update:not(:disabled) { box-shadow: 0 0 0 3px #c2413b33; }

.hero-figure {
  padding: clamp(16px, 2.1vw, 26px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 18px 42px -26px #7a554073;
}
.hero-figure figcaption { margin-bottom: 10px; }
.figure-kicker, .figure-note { color: var(--muted); font-size: 0.86rem; }
.figure-kicker { display: block; margin-bottom: 2px; }
.hero-figure strong {
  display: block;
  font-size: clamp(1.12rem, 2.1vw, 1.4rem);
  font-weight: 600;
  line-height: 1.2;
}
.hero-figure img, .figures img { display: block; width: 100%; height: auto; }
.hero-figure img { transition: opacity 180ms ease; }
/* A roll spends a moment in R; dim the previous card so the click reads as
   work in progress instead of a frozen page. */
.hero-figure.is-rolling img { opacity: 0.45; }
.figure-note { margin-top: 10px; }

/* The card is a white plate on the warm band, so its controls take the
   page's own colours instead of the dark plate's light ones. */
.hero-figure .hero-actions { margin-top: 16px; }
.hero-figure .button.secondary {
  border-color: var(--control-border);
  background: var(--surface);
  color: var(--accent);
}
.hero-figure .button.secondary:hover { background: var(--tint); color: var(--accent-hover); }
.hero-figure .button:disabled {
  background: var(--tint);
  border-color: var(--line);
  color: var(--muted);
}
.hero-figure .hero-open { color: var(--accent); }
.hero-figure .hero-open:hover { color: var(--accent-hover); }
.hero-status { margin-top: 10px; font-size: 0.86rem; color: var(--muted); }
.hero-status:empty { display: none; }
.hero-status.error { color: var(--error); }

.coverage {
  display: grid;
  grid-template-columns: minmax(150px, 0.95fr) minmax(0, 3fr);
  align-items: center;
  gap: 24px;
  padding-block: 34px;
}
.coverage h2 { font-size: clamp(1.5rem, 2.1vw, 1.875rem); }
.coverage-status { color: var(--muted); }
.coverage-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}
.coverage-stats div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  gap: 6px;
  padding-inline: clamp(12px, 2vw, 24px);
  border-inline-start: 1px solid var(--line);
}
.coverage-stats dt { color: var(--muted); font-size: 0.94rem; line-height: 1.3; }
.coverage-stats dd {
  margin: 0;
  color: var(--accent);
  font: 500 clamp(2rem, 3.5vw, 2.75rem)/1 var(--serif);
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.workflows {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 32px;
  padding-block: 42px 64px;
  border-top: 1px solid var(--line);
}
.workflow-list { margin: 0; padding: 0; list-style: none; }
.workflow-list li + li { border-top: 1px solid var(--line); }
.workflow-list a {
  display: grid;
  grid-template-columns: minmax(145px, 1fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px 10px;
  color: var(--muted);
  text-decoration: none;
}
.workflow-list a:hover { background: var(--tint); }
.workflow-list strong { color: var(--ink); font-weight: 650; }
.workflow-list .arrow { color: var(--accent); font-size: 1.2rem; }

.page { padding-block: clamp(32px, 5vw, 64px) 64px; }
.page-heading { margin-bottom: 26px; }
.page-heading h1 { font-size: clamp(2.55rem, 5vw, 3.75rem); }
.page-heading .intro { margin-top: 10px; }
.metric-note {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--tint);
  color: var(--accent);
}
.analysis-page { padding-top: clamp(24px, 4vw, 48px); }
.analysis-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  margin-bottom: 18px;
}
.analysis-heading h1 { font-size: clamp(2rem, 4.5vw, 3rem); }
.tool-nav {
  width: fit-content;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tint);
}
.tool-nav a:hover, .tool-nav a[aria-current="page"] {
  background: var(--surface);
  color: var(--accent);
}
.pair-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.pair-modes a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-bottom: -1px;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}
.pair-modes a:hover, .pair-modes a[aria-current="page"] { color: var(--accent); }
.pair-modes a[aria-current="page"] { border-bottom-color: var(--accent); }
.tool-form {
  padding: clamp(18px, 3.2vw, 34px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.hint { margin: 8px 0 22px; color: var(--muted); }
.form-groups {
  --column-gap: clamp(20px, 3vw, 40px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px var(--column-gap);
  align-items: start;
}
.form-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  min-width: 0;
}
.group-title {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font: 650 1.0625rem/1.3 var(--sans);
  letter-spacing: normal;
}
.group-title, .full-field, .group-note, .form-filters { grid-column: 1 / -1; }
.group-field { min-width: 0; }
.form-filters { column-gap: var(--column-gap); }
.form-anchor, .form-datasets {
  grid-column: 1 / -1;
}
.form-anchor {
  grid-template-columns: minmax(15rem, 0.6fr) minmax(0, 1fr);
}
.form-anchor .group-title { grid-column: 1 / -1; }
.group-note { color: var(--muted); font-size: 0.91rem; }
label {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 5px;
  font-weight: 600;
}
.optional { color: var(--muted); font-size: 0.875rem; font-weight: 400; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
textarea { resize: vertical; }
input::placeholder { color: var(--muted); opacity: 1; }
.threshold-controls {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
}
.threshold-controls > span { color: var(--muted); }
.threshold-controls > input { font-variant-numeric: tabular-nums; }
.suggest-field { position: relative; }
.suggest-field input { padding-inline-end: 34px; }
.suggest-field::after {
  position: absolute;
  inset-block-start: 16px;
  inset-inline-end: 16px;
  width: 8px;
  height: 8px;
  border-inline-end: 1.5px solid var(--accent);
  border-block-end: 1.5px solid var(--accent);
  transform: rotate(45deg);
  pointer-events: none;
  content: "";
}
.suggest-popup {
  position: absolute;
  z-index: 2;
  inset: calc(100% + 6px) 0 auto;
  padding: 4px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px #2a1c1820;
}
.suggest-popup.above { inset-block: auto calc(100% + 6px); }
.suggest-popup ul {
  max-height: min(20rem, var(--suggest-space));
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  list-style: none;
}
.suggest-popup li, .suggest-popup p {
  padding: 8px 10px;
  overflow-wrap: anywhere;
}
.suggest-popup li {
  border-radius: 6px;
  cursor: pointer;
}
.suggest-popup li:hover, .suggest-popup li[aria-selected="true"] {
  background: var(--tint);
  color: var(--accent-hover);
}
.suggest-popup p { color: var(--muted); }
.suggest-foot { display: grid; }
.suggest-browse {
  padding: 9px 10px 7px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: start;
  cursor: pointer;
}
.suggest-browse:hover { background: var(--tint); color: var(--accent-hover); }

.anchor-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.91rem;
}
.anchor-meta .browse-link { margin-top: 0; white-space: nowrap; }
.anchor-warning {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 9px 12px 10px;
  border: 1px solid #e8c8c4;
  border-radius: var(--radius);
  background: #fdf4f2;
  color: var(--error);
  font-size: 0.91rem;
}
.anchor-choices { display: flex; flex-wrap: wrap; gap: 6px; }
.anchor-choice {
  min-height: 32px;
  padding: 2px 11px;
  border: 1px solid #e0b8b4;
  border-radius: 999px;
  background: var(--surface);
  color: var(--error);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}
.anchor-choice:hover { border-color: var(--error); background: #fbecea; }

.form-actions { gap: 12px 18px; margin-top: 22px; }
.status, .note { color: var(--muted); }
.status.error { color: var(--error); }
/* Waiting that is too short for a stage bar: a quiet spinner beside the
   words. The text carries the meaning, so the ring is hidden from readers. */
.status .spinner {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-right: 0.45em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -0.08em;
  animation: droma-spin 0.8s linear infinite;
}
@keyframes droma-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .status .spinner { animation: none; }
}
/* A task's stage and how far it is: the bar is a hint, the words say what
   is happening (reading, screening, pooling). */
.status progress {
  width: 9rem;
  height: 0.35rem;
  margin-right: 0.5rem;
  vertical-align: middle;
  accent-color: currentColor;
}
.results:empty { display: none; }
.results { margin-top: 28px; }
.results h3 { margin-bottom: 12px; }
.results .note { margin-top: 12px; }
/* A result computed under settings the form no longer holds. It stays — it
   still answers the question that was asked, and its downloads still work —
   but it recedes, and the line above it names what moved. */
.results.is-stale > :not(.stale-note) {
  opacity: 0.55;
  transition: opacity 120ms ease-out;
}
.stale-note {
  margin: 0 0 20px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--tint);
  color: var(--ink);
  font-size: 0.95rem;
}
.stale-note strong { font-weight: 650; }
@media (prefers-reduced-motion: reduce) {
  .results.is-stale > :not(.stale-note) { transition: none; }
}

.cross-query, .cross-scope, .cross-filters { display: grid; gap: 18px 20px; }
/* Scope first (metric, feature type, collection), then the anchors, then
   filters — a feature type or collection change re-scopes the feature field. */
.cross-scope { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 18px; }
.cross-query { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
.cross-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cross-scope .field-wide { grid-column: span 2; }
.cross-filters .group-note { grid-column: 1 / -1; }
.cross-filters, .cross-datasets { margin-top: 18px; }
.disclosure {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.disclosure > summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 15px;
  border-radius: var(--radius);
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
  width: 7px;
  height: 7px;
  border-top: 1.5px solid var(--accent);
  border-right: 1.5px solid var(--accent);
  transform: rotate(45deg);
  content: "";
}
.disclosure[open] > summary::before { transform: translateY(-2px) rotate(135deg); }
.disclosure > summary:hover { background: var(--tint); }
.disclosure-count {
  color: var(--muted);
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
}
.chip-row {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 18px 30px;
  padding: 12px 15px 16px;
  border-top: 1px solid var(--line);
}
.chip-group { min-width: 0; }
.chip-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
  margin-bottom: 6px;
}
.chip-label { font-weight: 650; }
.text-button {
  min-height: 32px;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-size: 0.93rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.text-button:disabled { color: var(--muted); cursor: default; }
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--control-border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: 600 0.9rem/1.2 var(--sans);
  cursor: pointer;
  user-select: none;
  transition: border-color 120ms ease, background-color 120ms ease,
    color 120ms ease;
}
.chip::before {
  content: "✓";
  width: 1.05em;
  height: 1.05em;
  flex: none;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78em;
  color: transparent;
  background: var(--tint);
  transition: color 120ms ease, background-color 120ms ease;
}
.chip:hover { border-color: var(--accent); color: var(--accent-hover); }
.chip[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--tint);
  color: var(--accent-hover);
}
.chip[aria-pressed="true"]::before {
  color: #ffffff;
  background: var(--accent);
}
.chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.table-frame {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
table {
  width: 100%;
  min-width: 39rem;
  border-collapse: collapse;
  font-size: 0.94rem;
}
#browse-result table { min-width: 44rem; }
th, td { padding: 10px 14px; text-align: left; vertical-align: top; }
th {
  background: var(--tint);
  color: var(--ink);
  font-weight: 650;
  white-space: nowrap;
}
td { border-top: 1px solid var(--line); overflow-wrap: anywhere; }
td:first-child { font-weight: 600; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
/* A button inside a table row (the "Inspect →" that carries one hit to the
   pair page) is sized to the row, not to a page-level control. */
td.action { white-space: nowrap; text-align: right; }
.button.row-action {
  min-height: 0;
  padding: 4px 10px;
  font-size: 0.86rem;
  white-space: nowrap;
}

/* Every table carries its own way of reading the rows: a keyword search, a
   dimension filter or a numeric cut, then the count of what is left. The
   controls sit above the rows they narrow and wrap before the table does. */
.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 14px;
  margin-bottom: 10px;
}
.table-toolbar-controls {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 12px;
}
.table-toolbar label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.table-toolbar input,
.table-toolbar select {
  width: auto;
  min-height: 36px;
  padding: 5px 9px;
  font-size: 0.9rem;
}
.table-search input { min-width: 15rem; }
.table-filter select,
.table-filter input { min-width: 8.5rem; }
.table-threshold { flex: 0 1 13.5rem; }
.table-threshold label { margin-bottom: 3px; }
.table-threshold .threshold-controls :is(input, select) { width: 100%; min-width: 0; }

/* The view selector of a screen result: it picks which rows the table holds,
   so it sits above the table and not among the table's own filters. */
.table-views {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.table-views label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.table-views select {
  width: auto;
  min-height: 36px;
  padding: 5px 9px;
  font-size: 0.9rem;
}
.table-toolbar .table-check {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding-bottom: 8px;
  color: var(--ink);
  font-size: 0.86rem;
}
.table-toolbar .table-check input {
  width: auto;
  min-height: 0;
  padding: 0;
}
.table-match {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.table-clear { flex: 0 0 auto; margin-bottom: 6px; }
.table-empty {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
/* A header is a button so a keyboard can sort without a pointer. The arrow
   is always there on a sortable column; the accent marks the active one. */
.table-sort {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 650;
  text-align: left;
  cursor: pointer;
}
th.num .table-sort { justify-content: flex-end; }
.table-sort:hover { color: var(--accent-hover); }
.table-sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.table-sort-icon { color: var(--muted); font-size: 0.78em; }
th[aria-sort="ascending"] .table-sort-icon,
th[aria-sort="descending"] .table-sort-icon { color: var(--accent); }
@media (max-width: 720px) {
  .table-toolbar { align-items: stretch; }
  .table-toolbar-controls { width: 100%; }
  .table-search { flex: 1 1 100%; }
  .table-search input { width: 100%; min-width: 0; }
  .table-filter { flex: 1 1 9rem; }
  .table-filter.table-threshold { flex-basis: 13.5rem; }
  .table-filter select,
  .table-filter input { width: 100%; min-width: 0; }
}
.figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 20px;
}
.figures figure {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.figures figcaption {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.94rem;
}
/* Every figure and result table carries its own download controls: three
   image formats plus the table it was drawn from. */
.figure-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
}
.figures figcaption + .figure-actions { border-top: 0; padding-top: 0; }
.figure-actions .button {
  padding: 5px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
/* Table downloads sit after the rows they export: the reader scans the
   table first, then saves it. Right-aligned so the control never floats
   above the data it belongs to. */
.table-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}
.table-actions .button {
  padding: 5px 10px;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}
.figure-status {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Whole-library figures on the Browse Data views: one figure per view,
   swapped by the plot-switch control, never re-rendered on filter changes. */
.view-figure {
  margin: 18px 0 26px;
  padding: clamp(14px, 2.4vw, 24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.view-figure h2 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }
.view-figure-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 4px;
}
.view-figure-head h2 { margin-inline-end: auto; }
.view-figure .figures { margin-top: 12px; }
/* figures() wraps its own .figures grid, so scope the column count by the
   placeholder id instead of the class */
#inventory-plots .figures,
#overlap-plots .figures,
#landscape-overlap .figures,
#landscape-moa .figures { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  #inventory-plots .figures figure,
  #overlap-plots .figures figure,
  #landscape-plots .figures figure { overflow-x: auto; }
  #inventory-plots .figures img,
  #overlap-plots .figures img,
  #landscape-plots .figures img { min-width: 900px; }
}

.pair-results, .batch-results { scroll-margin-top: 24px; }
.pair-summary, .pair-samples, .pair-details { margin-top: 30px; }
.pair-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 18px;
  margin-bottom: 12px;
}
.pair-section-head h4 {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 500;
  line-height: 1.2;
}
.pair-section-head p { margin-top: 3px; color: var(--muted); font-size: 0.92rem; }
.pair-section-head .button { padding: 6px 11px; font-size: 0.82rem; }
.pair-summary-body {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.pair-comparison { font-family: var(--serif); font-size: 1.42rem; line-height: 1.3; }
.pair-comparison span { padding: 0 3px; color: var(--accent); }
.pair-context { margin-top: 6px; color: var(--muted); font-size: 0.93rem; }
.pair-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 20px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfaf6;
}
.pair-stats > div { min-width: 0; padding: 13px 16px; }
.pair-stats > div + div { border-left: 1px solid var(--line); }
.pair-stats dt { color: var(--muted); font-size: 0.82rem; font-weight: 600; }
.pair-stats dd {
  margin: 4px 0 0;
  font-size: clamp(1.05rem, 1.7vw, 1.36rem);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  overflow-wrap: anywhere;
}
.pair-effect { color: var(--accent-hover); font-size: 0.95rem; font-weight: 700; }
.pair-interpretation, .pair-caveat { margin-top: 5px; color: var(--muted); font-size: 0.93rem; }
.pair-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 17px; }
.pair-groups > div { padding: 10px 13px; border-left: 2px solid var(--line); background: var(--paper); }
.pair-groups strong, .pair-groups span { display: block; }
.pair-groups span { color: var(--muted); font-size: 0.9rem; }
.pair-details dl { margin: 0; padding: 2px 15px 16px; }
.pair-details dl > div { display: grid; grid-template-columns: minmax(10rem, 1fr) 2fr; gap: 8px 20px; padding: 7px 0; border-top: 1px solid var(--line); }
.pair-details dt { color: var(--muted); font-weight: 600; }
.pair-details dd { margin: 0; }
@media (max-width: 720px) {
  .pair-summary-body { padding: 18px; }
  .pair-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pair-stats > div:nth-child(3) { border-left: 0; }
  .pair-stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .pair-groups { grid-template-columns: 1fr; }
  .pair-details dl > div { grid-template-columns: 1fr; gap: 2px; }
}
.pair-results .figures, .batch-results .figures {
  grid-template-columns: minmax(0, 1fr);
  max-width: 52rem;
  margin-block: 12px 16px;
}
#cross-plot-grid .figures { max-width: none; }
#clin-result .figures {
  grid-template-columns: minmax(0, 1fr);
  max-width: 60rem;
}
.result-query { font-size: 1.15rem; font-weight: 650; overflow-wrap: anywhere; }
.result-query span, .result-counts { color: var(--muted); font-size: 0.95rem; }
.result-query span { margin-inline-start: 8px; font-weight: 400; }
.result-counts { display: flex; flex-wrap: wrap; gap: 2px 18px; margin-top: 2px; }
.plot-switch {
  display: flex;
  flex-wrap: wrap;
  width: fit-content;
  gap: 4px;
  margin-top: 14px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tint);
}
.plot-switch button {
  min-height: 38px;
  padding: 5px 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  cursor: pointer;
}
.plot-switch button:hover, .plot-switch button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
}
.result-details { margin-top: 10px; }
.result-details-body { padding: 0 12px 12px; }
.table-pagination, .page-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.table-pagination { justify-content: space-between; margin-top: 10px; }
.table-pagination .button { min-height: 38px; padding: 5px 12px; font-size: 0.93rem; }
.page-jump { display: flex; align-items: center; gap: 6px; font-size: 0.93rem; color: var(--muted); }
.page-jump input {
  width: 4.5rem; min-height: 34px; padding: 4px 8px;
  border: 1px solid var(--control-border); border-radius: 8px;
  font: inherit; text-align: center;
}
.page-jump select {
  width: auto; min-height: 34px; padding: 4px 26px 4px 8px;
  border: 1px solid var(--control-border); border-radius: 8px;
}

.site-footer { border-top: 1px solid var(--line); }
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding-block: 22px;
  color: var(--muted);
  font-size: 0.93rem;
}
.footer-inner strong { margin-inline-end: 8px; color: var(--ink); }

@media (max-width: 850px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero h1 { max-width: 17ch; text-wrap: wrap; }
  .hero-figure { width: min(100%, 560px); }
  .coverage, .workflows { grid-template-columns: 1fr; }
  .coverage-stats div:first-child { padding-inline-start: 0; border: 0; }
  .workflows { gap: 10px; }
  .cross-scope, .cross-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .form-groups { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 580px) {
  .header-inner { min-height: 64px; gap: 8px; }
  .brand { gap: 6px; font-size: 1.15rem; letter-spacing: 0.05em; }
  .brand img { width: 36px; height: 36px; }
  .site-nav { gap: 1px; }
  .site-nav a { padding-inline: 8px; font-size: 1rem; }
  .hero { padding-block: 34px; }
  .hero h1 { font-size: clamp(2.25rem, 10vw, 2.9rem); }
  .hero-actions { margin-top: 20px; }
  .hero-actions .button { gap: 6px; padding-inline: 13px; }
  .coverage { gap: 16px; padding-block: 26px; }
  .coverage-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 18px; }
  .coverage-stats div:nth-child(odd) { padding-inline-start: 0; border: 0; }
  .workflows { padding-block: 28px 40px; }
  .workflow-list a { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding-inline: 0; }
  .workflow-list a span:not(.arrow) { grid-row: 2; }
  .workflow-list .arrow { grid-column: 2; grid-row: 1 / span 2; }
  .tool-nav { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-nav a { padding-inline: 5px; font-size: 0.92rem; }
  .form-group, .figures, .cross-scope, .cross-query, .cross-filters, .chip-row { grid-template-columns: minmax(0, 1fr); }
  .cross-chart .figures figure { overflow-x: auto; }
  .cross-chart img { min-width: 36rem; }
  .form-actions .status:not(:empty) { flex-basis: 100%; }
  .footer-inner strong { display: block; margin: 0; }
}

@media (max-width: 360px) {
  .header-inner { flex-wrap: wrap; gap: 4px; }
  .brand { gap: 4px; font-size: 1.05rem; }
  .brand img { width: 32px; height: 32px; }
  .site-nav a { padding-inline: 4px; font-size: 0.94rem; }
}

/* ---- Browse all picker ---- */
.browse-link { margin-top: 6px; }
.picker-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(16px, 6vh, 64px) var(--gutter);
  background: #2a1c1888;
  overflow-y: auto;
}
.picker {
  width: min(100%, 34rem);
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 18px 48px #2a1c1845;
}
.picker-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 12px;
}
.picker-head h2 { font-size: 1.35rem; }
.picker-scope { margin-top: 4px; color: var(--muted); font-size: 0.92rem; }
.picker-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.picker-close:hover { border-color: var(--accent); color: var(--accent); }
.picker-search { padding: 0 20px 12px; }
.picker-search input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  font: inherit;
  background: var(--paper);
  color: var(--ink);
}
.picker-list {
  flex: 1;
  min-height: 8rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-block: 1px solid var(--line);
  padding: 6px;
}
.picker-option {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.picker-option:hover, .picker-option:focus-visible {
  background: var(--tint);
  color: var(--accent-hover);
  outline: none;
}
.picker-option-name { font-weight: 600; overflow-wrap: anywhere; }
.picker-option-detail { flex: none; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.picker-foot { padding: 12px 20px 16px; }
.picker-status { min-height: 1.4em; color: var(--muted); font-size: 0.9rem; }
.picker-pages {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ---- Drug Feature ---- */
.df-form h2 { font-size: clamp(1.5rem, 2.3vw, 1.85rem); }
.df-form .form-groups { margin-top: 0; }
#df-scope:empty { display: none; }
#df-status:not(:empty) { margin-top: 12px; }

.df-results, .df-data { display: grid; grid-template-columns: minmax(0, 1fr); }
.df-results { gap: clamp(34px, 4.2vw, 60px); margin-top: 20px; }
.df-distribution { margin: 0; scroll-margin-top: 20px; }
.df-distribution h2 { font-size: clamp(1.5rem, 2.5vw, 2rem); }
.df-result-head, .df-plot-switch-row, .df-sample-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}
.df-result-head { justify-content: space-between; align-items: baseline; }
.df-context { margin-top: 4px; overflow-wrap: anywhere; }
.df-plot-switch-row { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.df-plot-switch-row .plot-switch { margin-top: 0; }
.df-plot-switch-row .plot-switch button:disabled {
  background: transparent;
  opacity: 0.55;
  cursor: default;
}
.df-plot-project { display: flex; align-items: center; gap: 8px; min-width: 0; }
.df-plot-project label, .df-sample-controls label { margin: 0; }
.df-plot-project select { width: auto; min-width: 0; max-width: 100%; }
#df-plot-status:not(:empty) { margin-top: 14px; }
#df-plot-status[data-busy] {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(10rem, 25vw, 18rem);
  border-radius: var(--radius);
  background: var(--tint);
}
.df-distribution .figures {
  grid-template-columns: minmax(0, 1fr);
  max-width: 52rem;
  margin: 16px auto 0;
}
.df-distribution .figure-image-scroll { overflow-x: auto; overscroll-behavior-inline: contain; }
.df-distribution .figure-image-scroll:focus-visible { outline-offset: -3px; }
.df-distribution .figure-image-scroll img { min-width: 38rem; }
.df-plot-scroll-note { display: none; }
.df-data { gap: 12px; padding-top: 30px; border-top: 1px solid var(--line); }
.df-data h2 { font-size: clamp(1.35rem, 2.1vw, 1.65rem); }
.df-data .result-details { margin-top: 0; }
#df-samples-title { scroll-margin-top: 24px; }
#df-sample-count { font-size: 0.93rem; }
#df-summary-count { font-size: 0.93rem; }
#df-summary td { white-space: nowrap; }
.df-sample-controls select { width: min(100%, 20rem); }
#drugfeature-result .result-details-body { padding: 0; }

@media (max-width: 700px) {
  .df-plot-scroll-note { display: block; margin-top: 12px; font-size: 0.93rem; }
  .df-distribution .figures { margin-top: 6px; }
}
@media (max-width: 580px) {
  .df-plot-switch-row .plot-switch { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .df-plot-switch-row .plot-switch button { min-height: 44px; padding-inline: 6px; }
  #df-summary th, #df-summary td { padding-inline: 10px; }
  .df-sample-controls { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  #df-sample-count { grid-column: 2; }
}

/* ---- Browse Data annotation views ---- */
.browse-form { margin: 18px 0 8px; }
.browse-status { margin: 10px 2px 0; }
.browse-status:empty { display: none; }
.browse-filters {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(0, 2fr);
  gap: 16px 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
@media (max-width: 720px) {
  .browse-filters { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  .picker { max-height: calc(100vh - 2rem); }
  .picker-option { flex-direction: column; gap: 2px; }
}

/* ---- Gene sets and enrichment ---- */
.collection-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.collection-row select { flex: 1 1 220px; min-width: 0; }
/* The add action is a control, not a paragraph link: match the select's
   height so the row reads as one field. */
.collection-add {
  flex: none;
  min-height: 44px;
  padding: 8px 14px;
  gap: 6px;
  font-size: 0.93rem;
  font-weight: 600;
  white-space: nowrap;
}
.collection-add:hover { background: var(--tint); }
.collection-manage { flex: none; white-space: nowrap; }
.collection-field { margin-top: 4px; }
.collection-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}
.collection-item:last-child { border-bottom: 0; }
.collection-meta { color: var(--muted); font-size: 0.85em; margin-left: 8px; }

#geneset-dialog, #feature-dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  max-width: 560px;
  width: calc(100vw - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  box-shadow: 0 18px 48px #2a1c1845;
}
#geneset-dialog::backdrop, #feature-dialog::backdrop { background: rgba(15, 23, 42, 0.45); }
.geneset-dialog-body { padding: 18px 20px 20px; display: grid; gap: 12px; }
.geneset-dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.geneset-dialog-head h2 { margin: 0; font-size: 1.35rem; }
.geneset-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.geneset-tabs [role="tab"] { flex: 1 1 auto; }
.geneset-tabs [aria-selected="true"] {
  border-color: var(--accent);
  background: var(--tint);
  color: var(--accent-hover);
}
#geneset-dialog label:not(.file-button), #feature-dialog label:not(.file-button) { display: block; font-weight: 600; font-size: 0.85rem; margin: 8px 0 4px; }
.geneset-format { margin: 0 0 10px; }
.geneset-format code { overflow-wrap: anywhere; }
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
#geneset-dialog .file-button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--control-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
}
#geneset-dialog .file-button:hover { background: var(--tint); }
#geneset-file:focus-visible + .file-button { outline: 2px solid var(--accent); outline-offset: 3px; }
.file-name { color: var(--muted); overflow-wrap: anywhere; }
.geneset-preview {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.2em;
}
.geneset-preview.error { color: var(--error); }
.geneset-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px 14px;
  flex-wrap: wrap;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---- Feature lists inside the Feature limit field ---- */
.feature-limit-row { display: flex; align-items: stretch; gap: 8px; }
.feature-limit-row input { flex: 1 1 auto; min-width: 0; }
.feature-limit-row .feature-choose { flex: none; white-space: nowrap; }
.feature-limit-note {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  min-height: 1.1em;
}
.feature-limit-note:empty { display: none; }
.feature-limit-note .text-button { font-size: 0.85rem; min-height: 0; }

#feature-dialog .feature-empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 6px 0 0;
}
#feature-dialog .feature-suggest {
  max-height: 220px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
#feature-dialog .picker-option.is-added { color: var(--muted); }
#feature-dialog .picker-option.is-added .picker-option-detail {
  color: var(--accent);
  font-weight: 600;
}
.feature-paste textarea { margin-top: 8px; }
.feature-paste-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.feature-selected-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.feature-selected-actions { display: flex; gap: 14px; }
/* The base chip shows a ✓; a selected name is removed by clicking it, so the
   affordance is ×. */
.feature-chip::before {
  content: "×";
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.05em;
}
.feature-chip:hover::before { color: var(--error); }
.feature-chip.is-unmatched { border-color: var(--error); color: var(--error); }
.feature-chip.is-unmatched::before { color: var(--error); }
.feature-check {
  min-height: 1.2em;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.feature-check.error { color: var(--error); }

/* The volcano's own settings, beside the figure they change. */
.plot-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px 18px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--tint);
}
.plot-settings-title {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.plot-settings label {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.plot-settings input,
.plot-settings select {
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  width: min(17rem, 100%);
}
.plot-settings input[type="number"] { width: 7.5rem; }
.plot-settings .plot-threshold { width: min(14.5rem, 100%); font-size: 0.85rem; }
.plot-settings .plot-threshold label { margin-bottom: 4px; }
.plot-settings .threshold-controls :is(input, select) { width: 100%; min-width: 0; }
.plot-settings input:disabled { opacity: 0.5; }
.plot-settings-status {
  flex-basis: 100%;
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.plot-settings-status.error { color: var(--error); }
.plot-settings-status:empty { display: none; }

.enrich-block {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  display: grid;
  gap: 10px;
}
.enrich-block h3 { margin: 0; font-size: 1rem; }
.enrich-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 720px) { .enrich-cards { grid-template-columns: minmax(0, 1fr); } }
.enrich-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
}
.enrich-card h4 { margin: 0; font-size: 0.95rem; }
.enrich-card p { margin: 0; color: var(--muted); font-size: 0.85rem; }
/* The two cards share one structure (title, one line, the run button), so the
   buttons sit on the card bottom together; the ORA card also holds the
   Both / Up / Down choice and its note above the button. */
.enrich-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.enrich-actions .button { flex: 1 1 auto; }
.enrich-direction {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0;
  padding: 0;
  border: 0;
}
.enrich-direction legend {
  float: left;
  margin-right: 2px;
  padding: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.enrich-direction label {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin: 0;
  font-size: 0.85rem;
}
.enrich-direction label:has(input:disabled) { opacity: 0.45; }
.enrich-direction input[type="radio"] {
  flex: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}
/* The sign convention of the screen: it explains the ORA genes choice, so it
   sits inside the ORA card, right under the radios. */
.enrich-side-note { font-size: 0.78rem; margin: 0; color: var(--muted); }
/* Why a test cannot run yet: the number it needs against the number the
   screen has, in the card of that test. */
.enrich-block .enrich-card p.enrich-why { color: var(--error); font-size: 0.8rem; }
.enrich-all { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.enrich-all .note { margin: 0; }
/* Results live in tabs (GSEA, ORA both, up, down): one panel shows at a time,
   always at the same place, so nothing has to be scrolled to compare them. */
.enrich-results { display: grid; gap: 12px; scroll-margin-top: 12px; }
.enrich-results:not(:has(.enrich-tab:not([hidden]))) { display: none; }
.enrich-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--line);
}
.enrich-tab {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: -1px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}
.enrich-tab[hidden] { display: none; }
.enrich-tab:hover { color: inherit; background: var(--bg); }
.enrich-tab[aria-selected="true"] {
  border-color: var(--line);
  background: var(--surface);
  color: inherit;
  font-weight: 650;
  box-shadow: 0 2px 0 var(--surface);
}
.enrich-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.enrich-tab-meta { font-size: 0.78rem; font-weight: 400; color: var(--muted); }
/* A result run with another setup than the figure's carries a dot. */
.enrich-tab[data-stale] .enrich-tab-title::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 6px;
  border-radius: 50%;
  background: var(--error);
  vertical-align: middle;
}
.enrich-panel[hidden] { display: none; }
.enrich-panel .enrich-status { margin: 0 0 10px; }
.enrich-status[data-stale] { color: var(--error); }
.enrich-result { display: grid; gap: 10px; min-width: 0; }
.enrich-result img { max-width: 100%; border-radius: var(--radius); }
/* The Show choice lives among the table's controls, or alone above a note. */
.table-views .table-view {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.table-toolbar .table-view select { min-width: 8.5rem; }
