/* LamiOmicsDB pathway system v4
   Extends the approved Botanical Editorial Atlas shell without changing
   homepage, species, gene, tree, tool or document page styling. */

.page-pathway-system {
  --pathway-rule: var(--line);
  --pathway-rule-strong: var(--line-strong);
  --pathway-paper: var(--surface);
  --pathway-paper-soft: var(--surface-soft);
  --pathway-gutter: 24px;
  background: var(--page);
}

.page-pathway-system main { min-width: 0; }
.page-pathway-system code,
.page-pathway-system .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.page-pathway-system em { font-family: var(--font-editorial); }
.page-pathway-system .numeric { text-align: right; font-variant-numeric: tabular-nums; }
.page-pathway-system .mt-16 { margin-top: 16px; }
.page-pathway-system .mt-24 { margin-top: 24px; }
.page-pathway-system a:not(.button):not(.icon-button):hover { color: var(--gold-800); }

/* Shared pathway sub-navigation */
.pathway-context-navigation {
  position: sticky;
  z-index: 45;
  top: calc(var(--header-primary-height) + var(--header-nav-height));
  min-height: 44px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.pathway-context-navigation-inner {
  min-height: 44px;
  display: flex;
  align-items: stretch;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pathway-context-navigation-inner::-webkit-scrollbar { display: none; }
.pathway-context-navigation a {
  position: relative;
  flex: 0 0 auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pathway-context-navigation a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: -1px;
  height: 2px;
  background: var(--gold-600);
  transform: scaleX(0);
  transform-origin: center;
}
.pathway-context-navigation a:hover { color: var(--ink); }
.pathway-context-navigation a.is-active { color: var(--gold-800); }
.pathway-context-navigation a.is-active::after { transform: scaleX(1); }

/* Breadcrumb and page identity */
.pathway-breadcrumbs {
  min-height: 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 12px;
}
.pathway-breadcrumbs a { color: var(--muted); }
.pathway-breadcrumbs span[aria-current="page"] { color: var(--ink-soft); }
.pathway-breadcrumbs code { font-size: 12px; }

.pathway-page-head,
.pathway-research-head {
  position: relative;
  padding: 34px 0 28px;
  overflow: hidden;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--lavender-75) 72%, var(--surface)) 0%, var(--surface) 58%, color-mix(in srgb, var(--gold-75) 50%, var(--surface)) 100%);
  border-bottom: 1px solid var(--line-gold);
}
html[data-theme="dark"] .pathway-page-head,
html[data-theme="dark"] .pathway-research-head {
  background:
    radial-gradient(circle at 88% 20%, rgba(228, 186, 93, .08), transparent 25%),
    linear-gradient(120deg, var(--surface-soft), var(--surface));
}
.pathway-page-head::after,
.pathway-research-head::after {
  content: "";
  position: absolute;
  right: clamp(-120px, -5vw, -35px);
  bottom: -42%;
  width: 360px;
  aspect-ratio: 1;
  opacity: .075;
  pointer-events: none;
  background: url("../illustrations/genome-ring-light.e7f3b8efa5ec.svg") center / contain no-repeat;
}
html[data-theme="dark"] .pathway-page-head::after,
html[data-theme="dark"] .pathway-research-head::after { background-image: url("../illustrations/genome-ring-dark.2d5dc1fcab48.svg"); opacity: .11; }
.pathway-head-grid,
.pathway-research-title {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 32px;
}
.pathway-kicker {
  margin: 0 0 5px;
  color: var(--gold-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .11em;
  line-height: 1.4;
  text-transform: uppercase;
}
.pathway-page-head h1,
.pathway-research-head h1 {
  max-width: 940px;
  margin: 0;
  color: var(--ink);
  font-family: var(--font-editorial);
  font-size: clamp(34px, 4vw, 56px);
  font-weight: 500;
  letter-spacing: -.035em;
  line-height: 1.05;
}
.pathway-page-head h1 code,
.pathway-research-head h1 code { font-family: var(--font-mono); font-size: .82em; letter-spacing: -.025em; }
.pathway-lead {
  max-width: 850px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}
.pathway-family-full-name {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-family: var(--font-editorial);
  font-size: 20px;
  font-weight: 600;
}
.pathway-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.pathway-head-actions .button { white-space: nowrap; }
.pathway-taxonomy-line,
.pathway-family-state-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 13px;
  color: var(--muted);
  font-size: 13px;
}
.pathway-family-state-row > span:not(.status) {
  padding-left: 9px;
  border-left: 1px solid var(--line-strong);
}
.pathway-candidate-id {
  max-width: 100% !important;
  font-family: var(--font-mono) !important;
  font-size: clamp(28px, 3.5vw, 46px) !important;
  overflow-wrap: anywhere;
}
.pathway-compact-head { padding-block: 26px; }
.pathway-compact-head h1 { font-size: clamp(30px, 3.4vw, 46px); }

/* Metric strip */
.pathway-metric-strip {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 26px 0 0;
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.pathway-metric-strip > div {
  min-width: 0;
  padding: 13px 16px 14px;
  border-left: 1px solid var(--line);
}
.pathway-metric-strip > div:first-child { border-left: 0; }
.pathway-metric-strip dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}
.pathway-metric-strip dd {
  margin: 4px 0 0;
  color: var(--ink);
  font-family: var(--font-editorial);
  font-size: 23px;
  font-weight: 600;
  line-height: 1.05;
  overflow-wrap: anywhere;
}
.pathway-metric-strip dd .status { font-family: var(--font-ui); }

/* Generic sections */
.pathway-section { padding: 40px 0; }
.pathway-section + .pathway-section { border-top: 1px solid var(--line); }
.pathway-boundary-section {
  background: color-mix(in srgb, var(--surface-soft) 74%, var(--page));
}
.pathway-data-section { padding-top: 34px; }
.pathway-section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
}
.pathway-section-heading.compact { margin-bottom: 13px; }
.pathway-section-heading h2 {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-editorial);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.2;
}
.pathway-section-heading p:not(.pathway-kicker) {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.text-action {
  color: var(--gold-800);
  font-size: 13px;
  font-weight: 700;
}
.text-action:hover { text-decoration: underline; text-underline-offset: 3px; }
.pathway-table-actions { display: flex; gap: 8px; }

/* Category rows and index */
.pathway-category-rows { border-top: 1px solid var(--line-strong); }
.pathway-category-row {
  min-height: 91px;
  display: grid;
  grid-template-columns: 50px minmax(260px, 1.35fr) minmax(340px, 1fr) 24px;
  align-items: center;
  gap: 18px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--line);
}
.pathway-category-row:hover { background: color-mix(in srgb, var(--surface-soft) 66%, transparent); }
.pathway-category-row > svg { width: 20px; height: 20px; color: var(--gold-700); }
.pathway-category-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line-gold);
  color: var(--gold-800);
  font-family: var(--font-mono);
  font-size: 12px;
}
.pathway-category-copy strong { display: block; color: var(--ink); font-family: var(--font-editorial); font-size: 18px; }
.pathway-category-copy small { display: block; max-width: 720px; margin-top: 4px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.pathway-category-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pathway-category-facts span { display: grid; gap: 2px; padding: 0 13px; border-left: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pathway-category-facts b { color: var(--ink-soft); font-family: var(--font-mono); font-size: 14px; }

.pathway-category-index { border-top: 1px solid var(--line-strong); }
.pathway-category-index-row {
  display: grid;
  grid-template-columns: 58px minmax(300px, 1.3fr) minmax(430px, 1fr) 135px;
  align-items: center;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.pathway-category-index-number { color: var(--gold-700); font-family: var(--font-mono); font-size: 16px; }
.pathway-category-index-copy h2 { margin: 0; color: var(--ink); font-family: var(--font-editorial); font-size: 23px; }
.pathway-category-index-copy p:last-child { margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.pathway-category-index-metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 0; }
.pathway-category-index-metrics > div { padding: 0 10px; border-left: 1px solid var(--line); }
.pathway-category-index-metrics dt { color: var(--muted); font-size: 10px; line-height: 1.35; }
.pathway-category-index-metrics dd { margin: 3px 0 0; color: var(--ink); font-family: var(--font-mono); font-size: 14px; }
.pathway-category-index-action { display: inline-flex; align-items: center; justify-content: flex-end; gap: 7px; color: var(--gold-800); font-size: 13px; font-weight: 700; }
.pathway-category-index-action svg { width: 17px; height: 17px; }

/* Filters */
.pathway-catalog-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}
.pathway-filter-panel {
  position: sticky;
  top: calc(var(--header-primary-height) + var(--header-nav-height) + 60px);
  max-height: calc(100vh - var(--header-primary-height) - var(--header-nav-height) - 84px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
}
.pathway-filter-panel-head {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
}
.pathway-filter-panel-head strong { color: var(--ink); font-size: 13px; }
.pathway-filter-panel-head button { display: none; width: 34px; height: 34px; place-items: center; color: var(--muted); background: transparent; border: 0; }
.pathway-filter-panel-head svg { width: 18px; height: 18px; }
.pathway-filter-form { display: grid; gap: 15px; padding: 14px; }
.pathway-filter-form label,
.pathway-filter-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.pathway-filter-form label > span,
.pathway-filter-form legend,
.pathway-inline-filter label > span,
.pathway-index-toolbar label > span,
.pathway-expression-controls label > span,
.pathway-compare-toolbar label > span {
  display: block;
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
}
.pathway-filter-form input,
.pathway-filter-form select,
.pathway-inline-filter input,
.pathway-inline-filter select,
.pathway-index-toolbar input,
.pathway-index-toolbar select,
.pathway-expression-controls input,
.pathway-expression-controls select,
.pathway-compare-toolbar input,
.pathway-compare-toolbar select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: 13px/1.35 var(--font-ui);
}
.pathway-check { min-height: 32px; display: flex !important; align-items: center; gap: 9px; cursor: pointer; }
.pathway-check input { width: 17px !important; min-height: 17px !important; margin: 0; }
.pathway-check span { margin: 0 !important; font-weight: 400 !important; }
.pathway-filter-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding-top: 2px; }
.pathway-filter-mobile-bar { display: none; }
.pathway-active-filter-summary,
.pathway-result-count {
  min-height: 36px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.pathway-active-filter-summary strong,
.pathway-result-count strong { color: var(--ink); font-size: 13px; }
.pathway-active-filter-summary span {
  padding: 3px 7px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
}

.pathway-inline-filter,
.pathway-index-toolbar,
.pathway-expression-controls,
.pathway-compare-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(155px, 210px)) auto auto;
  align-items: end;
  gap: 10px;
  margin: 0 0 16px;
  padding: 13px;
  background: var(--surface-soft);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
}
.pathway-index-toolbar { grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(150px, 210px)) auto auto; }
.pathway-candidate-toolbar { grid-template-columns: minmax(260px, 1fr) repeat(3, minmax(140px, 190px)) auto auto; }
.pathway-index-search { position: relative; }
.pathway-index-search > svg {
  position: absolute;
  left: 11px;
  bottom: 11px;
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.pathway-index-search input { padding-left: 36px; }

/* Data tables */
.pathway-table-region { min-width: 0; }
.pathway-table-shell,
.pathway-matrix-shell,
.pathway-heatmap-shell {
  width: 100%;
  overflow: auto;
  background: var(--surface);
  border-top: 1px solid var(--line-strong);
  border-bottom: 1px solid var(--line);
  scrollbar-color: var(--line-strong) transparent;
}
.pathway-scientific-table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  font-size: 13px;
}
.pathway-scientific-table th {
  position: sticky;
  z-index: 3;
  top: 0;
  height: 39px;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line-strong);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  text-align: left;
  white-space: nowrap;
}
.pathway-scientific-table td {
  min-height: 45px;
  padding: 9px 10px;
  color: var(--ink-soft);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.pathway-scientific-table tbody tr:last-child td { border-bottom: 0; }
.pathway-scientific-table tbody tr:hover td { background: color-mix(in srgb, var(--surface-soft) 70%, var(--surface)); }
.pathway-scientific-table .is-sticky {
  position: sticky;
  z-index: 2;
  left: 0;
  min-width: 210px;
  max-width: 290px;
  box-shadow: 1px 0 0 var(--line-strong);
}
.pathway-scientific-table thead .is-sticky { z-index: 5; background: var(--surface-soft); }
.pathway-scientific-table tbody .is-sticky { background: var(--surface); }
.pathway-scientific-table tbody tr:hover .is-sticky { background: color-mix(in srgb, var(--surface-soft) 70%, var(--surface)); }
.pathway-family-identity,
.pathway-species-identity { min-width: 0; display: grid; gap: 2px; }
.pathway-family-identity code { color: var(--ink); font-size: 13px; font-weight: 600; }
.pathway-family-identity span { color: var(--muted); font-size: 11px; line-height: 1.35; overflow-wrap: anywhere; }
.pathway-species-identity em { color: var(--ink); font-size: 14px; font-weight: 600; }
.pathway-species-identity small,
.pathway-secondary-line { display: block; margin-top: 2px; color: var(--muted-faint); font-size: 10px; line-height: 1.35; }
.pathway-evidence-mode {
  display: inline-block;
  padding: 3px 6px;
  color: var(--ink-soft);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-size: 10px;
  line-height: 1.2;
  white-space: nowrap;
}
.pathway-id-cell { min-width: 210px; display: grid; grid-template-columns: minmax(0, 1fr) 30px; align-items: center; gap: 5px; }
.pathway-id-cell > a { overflow: hidden; color: var(--ink); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.pathway-id-cell .icon-button { width: 30px; height: 30px; opacity: 0; }
.pathway-scientific-table tr:hover .pathway-id-cell .icon-button,
.pathway-id-cell .icon-button:focus-visible { opacity: 1; }
.pathway-no-locus { color: var(--muted-faint); }
.pathway-download-table .is-sticky { min-width: 260px; }
.pathway-download-table td code { display: block; max-width: 260px; margin-top: 5px; color: var(--muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pathway-checksum-cell { min-width: 180px; display: grid; grid-template-columns: minmax(0, 1fr) 32px; align-items: center; gap: 5px; }
.pathway-checksum-cell code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pathway-checksum-cell .icon-button { width: 31px; height: 31px; }

/* Pagination */
.pathway-pagination {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.pathway-pagination-actions { display: flex; align-items: center; gap: 9px; }
.pathway-page-index { min-width: 90px; text-align: center; }

/* Empty/loading states */
.pathway-empty-state {
  min-height: 240px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  padding: 30px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
}
.pathway-empty-state.compact { min-height: 130px; }
.pathway-empty-state > svg { width: 34px; height: 34px; color: var(--muted-faint); }
.pathway-empty-state h2,
.pathway-empty-state h3 { margin: 0; color: var(--ink); font-family: var(--font-editorial); }
.pathway-empty-state p { max-width: 620px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.pathway-loading-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.pathway-loading-state::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--gold-700);
  border-radius: 50%;
  animation: pathway-spin .7s linear infinite;
}
@keyframes pathway-spin { to { transform: rotate(1turn); } }

/* Species profile */
.pathway-class-composition { border-top: 1px solid var(--line-strong); }
.pathway-class-composition-row {
  min-height: 88px;
  display: grid;
  grid-template-columns: minmax(210px, .9fr) minmax(160px, 1fr) minmax(420px, 1.4fr) 40px;
  align-items: center;
  gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.pathway-class-composition-row h3 { margin: 0; color: var(--ink); font-family: var(--font-editorial); font-size: 17px; }
.pathway-class-composition-row dl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.pathway-class-composition-row dl > div { padding: 0 10px; border-left: 1px solid var(--line); }
.pathway-class-composition-row dt { color: var(--muted); font-size: 10px; line-height: 1.3; }
.pathway-class-composition-row dd { margin: 3px 0 0; color: var(--ink); font-family: var(--font-mono); font-size: 13px; }
.pathway-rate-meter { height: 6px; overflow: hidden; background: var(--surface-soft); border: 1px solid var(--line); }
.pathway-rate-meter span { display: block; width: clamp(4px, calc(var(--pathway-rate) * .55%), 100%); height: 100%; background: linear-gradient(90deg, var(--lavender-500), var(--gold-600)); }
.pathway-species-family-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: start; gap: 30px; }
.pathway-species-toc {
  position: sticky;
  top: calc(var(--header-primary-height) + var(--header-nav-height) + 64px);
  display: grid;
  border-top: 1px solid var(--line-strong);
}
.pathway-species-toc > strong { padding: 10px 0; color: var(--ink); font-size: 12px; }
.pathway-species-toc a { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pathway-species-toc a span { color: var(--muted-faint); font-family: var(--font-mono); }
.pathway-species-family-content { min-width: 0; }
.pathway-family-group { scroll-margin-top: calc(var(--header-primary-height) + var(--header-nav-height) + 64px); padding: 0 0 34px; }
.pathway-family-group + .pathway-family-group { padding-top: 30px; border-top: 1px solid var(--line-strong); }
.pathway-family-group > header { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 13px; }
.pathway-family-group > header h2 { margin: 0; color: var(--ink); font-family: var(--font-editorial); font-size: 23px; }
.pathway-family-group > header > div:last-child { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.pathway-boundary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }

/* Category and family detail */
.pathway-category-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 30px; }
.pathway-category-species-region { position: sticky; top: calc(var(--header-primary-height) + var(--header-nav-height) + 64px); }
.pathway-ranked-list { border-top: 1px solid var(--line-strong); }
.pathway-ranked-list a { min-height: 55px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pathway-ranked-list a > span:first-child { min-width: 0; display: grid; }
.pathway-ranked-list em { color: var(--ink); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pathway-ranked-list small { color: var(--muted); font-size: 10px; }
.pathway-ranked-list a > span:last-child { flex: 0 0 auto; color: var(--muted); font-size: 10px; text-align: right; }
.pathway-ranked-list b { display: block; color: var(--ink-soft); font-family: var(--font-mono); font-size: 12px; }
.pathway-family-overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; align-items: start; gap: 30px; }
.pathway-record-section { padding: 0 0 30px; }
.pathway-record-section + .pathway-record-section { padding-top: 28px; border-top: 1px solid var(--line-strong); }
.pathway-family-aside,
.pathway-candidate-record-aside,
.pathway-unavailable-aside { display: grid; gap: 15px; }
.pathway-family-aside > section,
.pathway-candidate-record-aside > section,
.pathway-unavailable-aside {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.pathway-family-aside h2,
.pathway-candidate-record-aside h2,
.pathway-unavailable-aside h2 { margin: 0 0 12px; color: var(--ink); font-family: var(--font-editorial); font-size: 18px; }
.pathway-family-aside dl,
.pathway-candidate-record-aside dl,
.pathway-unavailable-aside dl { margin: 0; }
.pathway-family-aside dl > div,
.pathway-candidate-record-aside dl > div,
.pathway-unavailable-aside dl > div { display: grid; grid-template-columns: 95px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.pathway-family-aside dl > div:first-child,
.pathway-candidate-record-aside dl > div:first-child,
.pathway-unavailable-aside dl > div:first-child { border-top: 0; }
.pathway-family-aside dt,
.pathway-candidate-record-aside dt,
.pathway-unavailable-aside dt { color: var(--muted); font-size: 11px; }
.pathway-family-aside dd,
.pathway-candidate-record-aside dd,
.pathway-unavailable-aside dd { margin: 0; color: var(--ink-soft); font-size: 12px; overflow-wrap: anywhere; }
.pathway-candidate-record-aside section > a { display: block; padding: 8px 0; border-top: 1px solid var(--line); color: var(--gold-800); font-size: 12px; }
.pathway-evidence-layer-list { border-top: 1px solid var(--line-strong); }
.pathway-evidence-layer-list > div { min-height: 69px; display: grid; grid-template-columns: 50px minmax(0, 1fr); align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.pathway-evidence-layer-list strong { display: block; color: var(--ink); font-size: 13px; }
.pathway-evidence-layer-list small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.pathway-evidence-shape { width: 44px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--ink-soft); font: 11px/1 var(--font-mono); }
.pathway-evidence-shape.is-stable { color: var(--status-stable); background: color-mix(in srgb, var(--status-stable) 7%, transparent); }
.pathway-evidence-shape.is-reference { color: var(--status-reference); background: var(--surface); }
.pathway-record-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; border-top: 1px solid var(--line-strong); }
.pathway-record-facts > div { display: grid; grid-template-columns: minmax(115px, .7fr) minmax(0, 1fr); gap: 12px; padding: 10px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pathway-record-facts > div:nth-child(2n) { border-right: 0; }
.pathway-record-facts dt { color: var(--muted); font-size: 11px; }
.pathway-record-facts dd { margin: 0; color: var(--ink-soft); font-size: 12px; overflow-wrap: anywhere; }
.pathway-delta-meter { height: 7px; margin-top: 14px; background: var(--surface-soft); border: 1px solid var(--line); }
.pathway-delta-meter span { display: block; width: var(--pathway-delta); height: 100%; background: var(--gold-600); }
.pathway-reference-only-state { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.pathway-reference-only-state .status-detail { flex: 1; }

/* Candidate detail */
.pathway-candidate-record-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 30px; }
.pathway-candidate-evidence-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 16px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.pathway-candidate-evidence-metrics > div { padding: 12px; border-left: 1px solid var(--line); }
.pathway-candidate-evidence-metrics > div:first-child { border-left: 0; }
.pathway-candidate-evidence-metrics span { display: block; color: var(--muted); font-size: 10px; }
.pathway-candidate-evidence-metrics strong { display: block; margin-top: 4px; color: var(--ink); font-family: var(--font-mono); font-size: 17px; overflow-wrap: anywhere; }
.pathway-motif-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 14px; border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.pathway-motif-grid > div { padding: 13px; border-left: 1px solid var(--line); }
.pathway-motif-grid > div:first-child { border-left: 0; }
.pathway-motif-grid strong { display: block; color: var(--ink); font-size: 12px; }
.pathway-motif-grid span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.pathway-motif-grid .is-present { border-top: 2px solid var(--status-available); }
.pathway-motif-grid .is-absent { border-top: 2px solid var(--status-unavailable); }

/* Comparison matrix */
.pathway-research-toolbar {
  position: sticky;
  z-index: 35;
  top: calc(var(--header-primary-height) + var(--header-nav-height) + 44px);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  border-bottom: 1px solid var(--line-strong);
  backdrop-filter: blur(12px);
}
.pathway-compare-toolbar,
.pathway-expression-controls { margin: 0; padding: 10px 0; background: transparent; border: 0; }
.pathway-compare-toolbar { grid-template-columns: 190px minmax(210px, 1fr) 210px auto auto auto; }
.pathway-species-selector { position: relative; }
.pathway-species-selector-panel {
  position: absolute;
  z-index: 80;
  top: calc(100% + 7px);
  right: 0;
  width: min(380px, calc(100vw - 32px));
  max-height: 430px;
  padding: 12px;
  overflow-y: auto;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-dialog);
}
.pathway-species-selector-panel > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 9px; border-bottom: 1px solid var(--line); }
.pathway-species-selector-panel > div button { width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: 0; }
.pathway-species-selector-panel label { min-height: 36px; display: flex; align-items: center; gap: 9px; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; }
.pathway-species-selector-panel input { width: 17px; height: 17px; }
.pathway-matrix-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; margin-bottom: 13px; }
.pathway-comparison-matrix { min-width: max-content; border-collapse: separate; border-spacing: 0; }
.pathway-comparison-matrix th,
.pathway-comparison-matrix td { min-width: 112px; height: 66px; padding: 7px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; }
.pathway-comparison-matrix thead th { position: sticky; z-index: 4; top: 0; background: var(--surface-soft); }
.pathway-comparison-matrix thead th em { display: block; max-width: 105px; margin: auto; color: var(--ink); font-size: 11px; line-height: 1.25; }
.pathway-comparison-matrix th.is-sticky { position: sticky; z-index: 5; left: 0; min-width: 190px; max-width: 190px; text-align: left; background: var(--surface-soft); box-shadow: 1px 0 0 var(--line-strong); }
.pathway-comparison-matrix tbody th.is-sticky { background: var(--surface); }
.pathway-comparison-matrix tbody th a { display: grid; gap: 2px; }
.pathway-comparison-matrix tbody th code { color: var(--ink); font-size: 12px; }
.pathway-comparison-matrix tbody th small { color: var(--muted); font-size: 10px; }
.pathway-matrix-cell { width: 100%; height: 100%; display: grid; place-items: center; align-content: center; gap: 3px; border: 1px solid transparent; }
.pathway-matrix-cell:hover { border-color: var(--gold-500); }
.pathway-matrix-shape { color: var(--status-unavailable); font-family: var(--font-mono); font-size: 18px; }
.pathway-matrix-cell.is-stable .pathway-matrix-shape { color: var(--status-stable); }
.pathway-matrix-cell.is-reference .pathway-matrix-shape { color: var(--status-reference); }
.pathway-matrix-cell small { color: var(--muted); font-size: 9px; }

/* Expression research view */
.pathway-research-head { padding-block: 20px; }
.pathway-research-head h1 { font-size: clamp(28px, 3vw, 42px); }
.pathway-research-title p:not(.pathway-kicker) { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.pathway-expression-controls { grid-template-columns: minmax(260px, 1fr) 190px minmax(200px, .8fr) auto auto; }
.pathway-expression-workspace { min-height: 560px; padding: 22px 0 38px; background: var(--page); }
.pathway-expression-workspace:fullscreen { padding: 16px; overflow: auto; background: var(--page); }
.pathway-expression-workspace:fullscreen > .page-shell { width: 100%; max-width: none; }
.pathway-expression-summary-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; align-items: stretch; gap: 18px; margin-bottom: 14px; }
.pathway-expression-summary { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); margin: 0; background: var(--surface); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); }
.pathway-expression-summary > div { min-width: 0; padding: 11px 12px; border-left: 1px solid var(--line); }
.pathway-expression-summary > div:first-child { border-left: 0; }
.pathway-expression-summary dt { color: var(--muted); font-size: 10px; }
.pathway-expression-summary dd { margin: 4px 0 0; color: var(--ink); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pathway-expression-inspector { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line-strong); }
.pathway-expression-inspector h2 { margin: 0; color: var(--ink); font-family: var(--font-editorial); font-size: 17px; }
.pathway-expression-inspector p:not(.pathway-kicker) { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.pathway-expression-inspector dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 8px 0 0; }
.pathway-expression-inspector dl > div { padding: 6px 0; border-top: 1px solid var(--line); }
.pathway-expression-inspector dt { color: var(--muted); font-size: 9px; }
.pathway-expression-inspector dd { margin: 2px 0 0; color: var(--ink); font: 11px/1.35 var(--font-mono); overflow-wrap: anywhere; }
.pathway-all-nd-alert { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; margin-bottom: 14px; padding: 13px 15px; color: var(--status-nd); background: color-mix(in srgb, var(--status-nd) 7%, var(--surface)); border: 1px solid color-mix(in srgb, var(--status-nd) 35%, var(--line)); border-left: 3px solid var(--status-nd); }
.pathway-all-nd-alert svg { width: 28px; height: 28px; }
.pathway-all-nd-alert strong { color: var(--ink); }
.pathway-all-nd-alert p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.pathway-heatmap-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 22px; min-height: 46px; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pathway-heatmap-legend > div { display: flex; align-items: center; gap: 7px; }
.pathway-scale-mineral-clay { width: 150px; height: 12px; background: linear-gradient(90deg, #2E6475, #A8C2C9, #F4F2EC 50%, #D9B89F, #8A5D42); border: 1px solid var(--line-strong); }
.pathway-nd-swatch,
.pathway-expression-cell.is-nd {
  background-color: #F4F0EC !important;
  background-image: repeating-linear-gradient(45deg, transparent 0 3px, #7A7069 3px 4px) !important;
}
.pathway-nd-swatch,
.pathway-unmapped-swatch { width: 21px; height: 14px; display: inline-block; border: 1px solid var(--line-strong); }
.pathway-unmapped-swatch,
.pathway-expression-cell.is-unmapped { background: var(--surface-soft); }
.pathway-expression-table { min-width: max-content; border-collapse: separate; border-spacing: 0; background: var(--surface); }
.pathway-expression-table th,
.pathway-expression-table td { padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pathway-expression-table thead th { position: sticky; z-index: 4; top: 0; width: 32px; min-width: 32px; height: 112px; background: var(--surface-soft); vertical-align: bottom; }
.pathway-expression-table thead th span { display: block; width: 98px; padding: 0 0 9px; color: var(--muted); font-size: 9px; text-align: left; transform: rotate(-55deg) translate(15px, -2px); transform-origin: left bottom; white-space: nowrap; }
.pathway-expression-table .pathway-expression-gene-head,
.pathway-expression-table tbody th { position: sticky; z-index: 5; left: 0; width: 230px; min-width: 230px; max-width: 230px; background: var(--surface-soft); box-shadow: 1px 0 0 var(--line-strong); }
.pathway-expression-table .pathway-expression-gene-head { z-index: 6; padding: 10px; height: 112px; color: var(--muted); font-size: 11px; text-align: left; vertical-align: bottom; }
.pathway-expression-table tbody th { padding: 7px 10px; text-align: left; }
.pathway-expression-table tbody th a { display: block; max-width: 210px; overflow: hidden; color: var(--ink); font: 10px/1.3 var(--font-mono); text-overflow: ellipsis; white-space: nowrap; }
.pathway-expression-table tbody th small,
.pathway-expression-table tbody th code { display: block; max-width: 210px; margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 8px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.pathway-expression-cell { width: 31px; height: 31px; display: block; padding: 0; background: var(--cell-color); border: 0; box-shadow: inset 0 0 0 1px rgba(24, 20, 34, .12); cursor: pointer; }
.pathway-expression-cell:hover,
.pathway-expression-cell.is-selected { position: relative; z-index: 2; outline: 2px solid var(--focus); outline-offset: -2px; }
.pathway-expression-cell.is-unmapped { cursor: default; }
.pathway-expression-caption { display: grid; gap: 5px; margin-top: 12px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.pathway-expression-caption p { margin: 0; }
.pathway-no-matrix-state { min-height: 480px; }

/* Evidence documentation */
.pathway-document-layout { display: grid; grid-template-columns: 210px minmax(0, 800px); justify-content: center; align-items: start; gap: 42px; }
.pathway-document-toc { position: sticky; top: calc(var(--header-primary-height) + var(--header-nav-height) + 64px); display: grid; border-top: 1px solid var(--line-strong); }
.pathway-document-toc strong { padding: 10px 0; color: var(--ink); font-size: 12px; }
.pathway-document-toc a { padding: 8px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.pathway-document-main > section { scroll-margin-top: calc(var(--header-primary-height) + var(--header-nav-height) + 64px); padding: 0 0 42px; }
.pathway-document-main > section + section { padding-top: 38px; border-top: 1px solid var(--line-strong); }
.pathway-document-main h2 { margin: 0 0 15px; color: var(--ink); font-family: var(--font-editorial); font-size: 27px; }
.pathway-document-main h3 { margin: 0; color: var(--ink); font-family: var(--font-editorial); font-size: 17px; }
.pathway-document-main > section > p:not(.pathway-kicker) { color: var(--muted); line-height: 1.65; }
.pathway-definition-list { border-top: 1px solid var(--line-strong); }
.pathway-definition-list > div { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 15px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.pathway-definition-shape { width: 44px; height: 36px; display: grid; place-items: center; color: var(--ink-soft); border: 1px solid var(--line-strong); font-family: var(--font-mono); }
.pathway-definition-list p { margin: 4px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.pathway-method-table { border-top: 1px solid var(--line-strong); }
.pathway-method-row { min-height: 74px; display: grid; grid-template-columns: 180px minmax(0, 1fr) 155px; align-items: center; gap: 18px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pathway-method-row > strong { color: var(--ink); font-size: 13px; }
.pathway-method-row > span:nth-child(2) { color: var(--muted); font-size: 12px; line-height: 1.5; }
.pathway-validation-groups { display: grid; gap: 25px; }
.pathway-validation-groups > div { border-top: 1px solid var(--line-strong); }
.pathway-validation-groups > div > h3 { padding: 10px 0; }
.pathway-validation-groups article { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.pathway-validation-icon { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line-strong); font-family: var(--font-mono); }
.pathway-validation-icon.is-complete { color: var(--status-available); }
.pathway-validation-icon.is-partial { color: var(--gold-800); }
.pathway-validation-icon.is-unavailable { color: var(--status-unavailable); }
.pathway-validation-groups article strong { color: var(--ink); font-size: 13px; }
.pathway-validation-groups article p { margin: 3px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.pathway-prose-block { color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.pathway-prose-block ul { padding-left: 20px; }
.pathway-limitation-list { display: grid; gap: 12px; }

/* Downloads */
.pathway-download-generated-list { border-top: 1px solid var(--line-strong); }
.pathway-download-generated-list article { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.pathway-download-generated-list article > div { min-width: 0; display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 13px; }
.pathway-file-format { width: 48px; height: 42px; display: grid; place-items: center; color: var(--gold-800); background: var(--gold-75); border: 1px solid var(--line-gold); font: 11px/1 var(--font-mono); }
.pathway-download-generated-list h3 { margin: 0; color: var(--ink); font-family: var(--font-editorial); font-size: 16px; }
.pathway-download-generated-list p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

/* Unavailable */
.pathway-unavailable-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 30px; }
.pathway-unavailable-main { display: grid; gap: 22px; }
.pathway-prose-block h2 { margin: 0 0 10px; color: var(--ink); font-family: var(--font-editorial); font-size: 24px; }
.pathway-prose-block p { color: var(--muted); }
.pathway-recommended-species { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); }
.pathway-recommended-species a { min-height: 78px; display: grid; grid-template-columns: minmax(0, 1fr) 20px; align-items: center; gap: 10px; padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.pathway-recommended-species a:nth-child(4n) { border-right: 0; }
.pathway-recommended-species em { display: block; color: var(--ink); font-size: 13px; }
.pathway-recommended-species span { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.pathway-recommended-species svg { width: 17px; height: 17px; color: var(--gold-700); }

/* Popovers */
.pathway-column-popover {
  position: fixed;
  z-index: 120;
  top: 160px;
  right: max(var(--page-gutter), calc((100vw - var(--content-max)) / 2));
  width: 260px;
  padding: 12px;
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-dialog);
}
.pathway-column-popover-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.pathway-column-popover-head button { width: 32px; height: 32px; display: grid; place-items: center; background: transparent; border: 0; }
.pathway-column-popover > label { min-height: 34px; display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: 12px; }
.pathway-column-popover input { width: 17px; height: 17px; }

/* Responsive */
@media (max-width: 1180px) {
  .pathway-metric-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pathway-metric-strip > div:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .pathway-metric-strip > div:nth-child(n+5) { border-top: 1px solid var(--line); }
  .pathway-category-row { grid-template-columns: 46px minmax(260px, 1fr) minmax(300px, .9fr) 22px; gap: 12px; }
  .pathway-category-index-row { grid-template-columns: 45px minmax(260px, 1fr) minmax(360px, 1.2fr) 120px; gap: 15px; }
  .pathway-category-index-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 8px; }
  .pathway-category-index-metrics > div:nth-child(4) { border-left: 0; }
  .pathway-inline-filter,
  .pathway-index-toolbar,
  .pathway-candidate-toolbar { grid-template-columns: minmax(230px, 1fr) repeat(2, minmax(150px, 190px)) auto; }
  .pathway-inline-filter > .text-action,
  .pathway-index-toolbar > .text-action,
  .pathway-candidate-toolbar > .text-action { align-self: center; }
  .pathway-candidate-evidence-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-candidate-evidence-metrics > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--line); }
  .pathway-candidate-evidence-metrics > div:nth-child(4) { border-top: 1px solid var(--line); }
  .pathway-expression-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pathway-expression-summary > div:nth-child(4) { border-left: 0; border-top: 1px solid var(--line); }
  .pathway-expression-summary > div:nth-child(n+5) { border-top: 1px solid var(--line); }
  .pathway-compare-toolbar { grid-template-columns: 170px minmax(180px, 1fr) 190px auto auto; }
  .pathway-compare-toolbar > .text-action { align-self: center; }
}

@media (max-width: 1024px) {
  .pathway-context-navigation { top: calc(var(--header-primary-height) + var(--header-nav-height)); }
  .pathway-head-grid,
  .pathway-research-title { grid-template-columns: 1fr; align-items: start; gap: 20px; }
  .pathway-head-actions { justify-content: flex-start; }
  .pathway-category-row { grid-template-columns: 44px minmax(0, 1fr) 22px; }
  .pathway-category-facts { grid-column: 2 / 3; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pathway-category-index-row { grid-template-columns: 44px minmax(0, 1fr) 120px; }
  .pathway-category-index-metrics { grid-column: 2 / 4; grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .pathway-catalog-layout { grid-template-columns: 1fr; }
  .pathway-filter-mobile-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
  .pathway-filter-mobile-bar > span { color: var(--muted); font-size: 12px; }
  .pathway-filter-panel {
    position: fixed;
    z-index: 130;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(390px, 100vw);
    max-height: none;
    transform: translateX(104%);
    transition: transform 180ms cubic-bezier(.2,0,0,1);
    box-shadow: var(--shadow-dialog);
  }
  .pathway-filter-panel.is-open { transform: translateX(0); }
  .pathway-filter-panel-head button { display: grid; }
  body.has-pathway-drawer::before { content: ""; position: fixed; z-index: 125; inset: 0; background: var(--backdrop); }
  body.has-pathway-drawer { overflow: hidden; }
  .pathway-filter-form { padding-bottom: 80px; }
  .pathway-category-detail-grid,
  .pathway-family-overview-grid,
  .pathway-candidate-record-layout,
  .pathway-unavailable-layout { grid-template-columns: 1fr; }
  .pathway-category-species-region { position: static; }
  .pathway-species-family-layout { grid-template-columns: 1fr; }
  .pathway-species-toc { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .pathway-species-toc > strong { grid-column: 1 / -1; }
  .pathway-species-toc a { padding-right: 12px; }
  .pathway-class-composition-row { grid-template-columns: minmax(200px, .8fr) minmax(130px, .6fr) minmax(0, 1.4fr) 38px; gap: 12px; }
  .pathway-class-composition-row dl { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 7px; }
  .pathway-class-composition-row dl > div:nth-child(3) { border-left: 0; }
  .pathway-expression-summary-grid { grid-template-columns: 1fr; }
  .pathway-document-layout { grid-template-columns: 1fr; justify-content: stretch; }
  .pathway-document-toc { position: static; grid-template-columns: repeat(3, minmax(0, 1fr)); border-bottom: 1px solid var(--line); }
  .pathway-document-toc strong { grid-column: 1 / -1; }
  .pathway-expression-controls,
  .pathway-compare-toolbar { display: flex; align-items: end; flex-wrap: wrap; }
  .pathway-expression-controls > label,
  .pathway-compare-toolbar > label { min-width: 170px; flex: 1; }
  .pathway-species-selector { flex: 0 0 auto; }
}

@media (max-width: 760px) {
  .pathway-context-navigation { top: var(--header-primary-height); }
  .pathway-context-navigation-inner { width: 100%; padding-inline: var(--page-gutter); }
  .pathway-context-navigation a { padding-inline: 10px; }
  .pathway-page-head,
  .pathway-research-head { padding: 24px 0 22px; }
  .pathway-page-head::after,
  .pathway-research-head::after { display: none; }
  .pathway-breadcrumbs { margin-bottom: 14px; white-space: nowrap; overflow: hidden; }
  .pathway-breadcrumbs > *:not(:last-child):not(:nth-last-child(2)) { display: none; }
  .pathway-breadcrumbs > :nth-last-child(2) { display: inline; }
  .pathway-page-head h1,
  .pathway-research-head h1 { font-size: clamp(29px, 9vw, 39px); }
  .pathway-lead { font-size: 14px; }
  .pathway-head-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; }
  .pathway-head-actions .button { width: 100%; }
  .pathway-metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 20px; }
  .pathway-metric-strip > div,
  .pathway-metric-strip > div:nth-child(4) { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .pathway-metric-strip > div:nth-child(odd) { border-left: 0; }
  .pathway-metric-strip > div:nth-child(-n+2) { border-top: 0; }
  .pathway-metric-strip dd { font-size: 19px; }
  .pathway-section { padding: 30px 0; }
  .pathway-section-heading { align-items: flex-start; flex-direction: column; gap: 9px; }
  .pathway-section-heading h2 { font-size: 23px; }
  .pathway-category-row { grid-template-columns: 38px minmax(0, 1fr) 18px; min-height: 0; padding: 14px 0; }
  .pathway-category-mark { width: 32px; height: 32px; }
  .pathway-category-copy strong { font-size: 16px; }
  .pathway-category-copy small { font-size: 11px; }
  .pathway-category-facts { grid-template-columns: 1fr 1fr; gap: 5px; }
  .pathway-category-facts span { padding: 5px 7px; border: 1px solid var(--line); }
  .pathway-category-facts span:last-child { grid-column: 1 / -1; }
  .pathway-category-index-row { grid-template-columns: 38px minmax(0, 1fr); padding: 19px 0; }
  .pathway-category-index-metrics { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-category-index-metrics > div { padding: 6px 7px; border: 1px solid var(--line); }
  .pathway-category-index-action { grid-column: 2 / 3; justify-content: flex-start; }
  .pathway-inline-filter,
  .pathway-index-toolbar,
  .pathway-candidate-toolbar { display: grid; grid-template-columns: 1fr 1fr; }
  .pathway-inline-filter > label:first-child,
  .pathway-index-toolbar > label:first-child,
  .pathway-candidate-toolbar > label:first-child { grid-column: 1 / -1; }
  .pathway-inline-filter .button,
  .pathway-index-toolbar .button,
  .pathway-candidate-toolbar .button { width: 100%; }
  .pathway-pagination { align-items: stretch; flex-direction: column; }
  .pathway-pagination-actions { justify-content: space-between; }
  .pathway-scientific-table .is-sticky { min-width: 170px; max-width: 190px; }
  .pathway-id-cell { min-width: 170px; }
  .pathway-id-cell .icon-button { opacity: 1; }
  .pathway-class-composition-row { grid-template-columns: minmax(0, 1fr) 34px; gap: 10px; padding: 15px 0; }
  .pathway-rate-meter { grid-column: 1 / 2; }
  .pathway-class-composition-row dl { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-species-toc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-family-group > header { align-items: flex-start; flex-direction: column; }
  .pathway-boundary-grid { grid-template-columns: 1fr; }
  .pathway-record-facts { grid-template-columns: 1fr; }
  .pathway-record-facts > div,
  .pathway-record-facts > div:nth-child(2n) { border-right: 0; }
  .pathway-candidate-evidence-metrics,
  .pathway-motif-grid { grid-template-columns: 1fr; }
  .pathway-candidate-evidence-metrics > div,
  .pathway-candidate-evidence-metrics > div:nth-child(3),
  .pathway-candidate-evidence-metrics > div:nth-child(4),
  .pathway-motif-grid > div { border-left: 0; border-top: 1px solid var(--line); }
  .pathway-candidate-evidence-metrics > div:first-child,
  .pathway-motif-grid > div:first-child { border-top: 0; }
  .pathway-reference-only-state { align-items: stretch; flex-direction: column; }
  .pathway-research-toolbar { top: calc(var(--header-primary-height) + 44px); }
  .pathway-expression-controls,
  .pathway-compare-toolbar { padding: 10px var(--page-gutter); margin-inline: calc(var(--page-gutter) * -1); overflow-x: auto; flex-wrap: nowrap; }
  .pathway-expression-controls > label,
  .pathway-compare-toolbar > label { min-width: 185px; flex: 0 0 185px; }
  .pathway-expression-controls .button,
  .pathway-compare-toolbar .button { flex: 0 0 auto; }
  .pathway-expression-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-expression-summary > div,
  .pathway-expression-summary > div:nth-child(4) { border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
  .pathway-expression-summary > div:nth-child(odd) { border-left: 0; }
  .pathway-expression-summary > div:nth-child(-n+2) { border-top: 0; }
  .pathway-heatmap-legend { align-items: flex-start; flex-direction: column; gap: 8px; }
  .pathway-expression-table .pathway-expression-gene-head,
  .pathway-expression-table tbody th { width: 145px; min-width: 145px; max-width: 145px; }
  .pathway-expression-table tbody th a,
  .pathway-expression-table tbody th small,
  .pathway-expression-table tbody th code { max-width: 128px; }
  .pathway-expression-table thead th { width: 29px; min-width: 29px; }
  .pathway-expression-cell { width: 28px; height: 28px; }
  .pathway-document-toc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-method-row { grid-template-columns: 1fr; gap: 7px; }
  .pathway-method-row > span:last-child { justify-self: start; }
  .pathway-recommended-species { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pathway-recommended-species a:nth-child(4n) { border-right: 1px solid var(--line); }
  .pathway-recommended-species a:nth-child(2n) { border-right: 0; }
  .pathway-download-generated-list article { align-items: stretch; flex-direction: column; }
  .pathway-download-generated-list article .button { align-self: flex-start; }
  .pathway-column-popover { top: 76px; left: 16px; right: 16px; width: auto; }
}

@media (max-width: 430px) {
  .pathway-head-actions { grid-template-columns: 1fr; }
  .pathway-inline-filter,
  .pathway-index-toolbar,
  .pathway-candidate-toolbar { grid-template-columns: 1fr; }
  .pathway-inline-filter > label:first-child,
  .pathway-index-toolbar > label:first-child,
  .pathway-candidate-toolbar > label:first-child { grid-column: auto; }
  .pathway-category-facts { grid-template-columns: 1fr; }
  .pathway-category-facts span:last-child { grid-column: auto; }
  .pathway-species-toc,
  .pathway-document-toc { grid-template-columns: 1fr; }
  .pathway-recommended-species { grid-template-columns: 1fr; }
  .pathway-recommended-species a,
  .pathway-recommended-species a:nth-child(2n),
  .pathway-recommended-species a:nth-child(4n) { border-right: 0; }
}

/* Reduced motion and print */
@media (prefers-reduced-motion: reduce) {
  .pathway-filter-panel,
  .pathway-context-navigation a::after { transition: none; }
  .pathway-loading-state::before { animation: none; border-top-color: var(--line-strong); }
}

@media print {
  .pathway-context-navigation,
  .pathway-head-actions,
  .pathway-filter-mobile-bar,
  .pathway-filter-panel,
  .pathway-index-toolbar,
  .pathway-inline-filter,
  .pathway-research-toolbar,
  .pathway-column-popover,
  .pathway-pagination,
  .site-footer { display: none !important; }
  .pathway-page-head,
  .pathway-research-head,
  .pathway-boundary-section { background: #fff !important; }
  .pathway-page-head::after,
  .pathway-research-head::after { display: none !important; }
  .pathway-table-shell,
  .pathway-matrix-shell,
  .pathway-heatmap-shell { overflow: visible; }
  .pathway-scientific-table,
  .pathway-comparison-matrix,
  .pathway-expression-table { min-width: 0; font-size: 9px; }
  .pathway-scientific-table .is-sticky,
  .pathway-comparison-matrix th.is-sticky,
  .pathway-expression-table .pathway-expression-gene-head,
  .pathway-expression-table tbody th { position: static; box-shadow: none; }
  .pathway-matrix-cell.is-stable .pathway-matrix-shape { color: #111; }
  .pathway-matrix-cell.is-reference .pathway-matrix-shape { color: #555; }
}

/* Pathway interaction states */
body.is-pathway-overlay-open { overflow: hidden; }
.pathway-species-limit-message {
  margin: 8px 12px 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.pathway-species-selector > button.has-selection-limit {
  border-color: var(--gold-600);
}
.pathway-expression-inspector-list {
  display: grid;
  gap: 0;
  margin: 13px 0 0;
}
.pathway-expression-inspector-list > div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.pathway-expression-inspector-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.pathway-expression-inspector-list dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.pathway-expression-cell.is-selected {
  position: relative;
  z-index: 2;
  outline: 3px solid var(--focus);
  outline-offset: 1px;
  box-shadow: inset 0 0 0 2px var(--surface-raised);
}
[data-copy-value].is-copied {
  border-color: var(--status-available);
  color: var(--status-available);
}
.pathway-copy-toast {
  min-width: 210px;
  padding: 11px 14px;
  color: var(--ink);
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--status-available);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  transition: opacity 180ms ease, transform 180ms ease;
}
.pathway-copy-toast.is-leaving { opacity: 0; transform: translateY(4px); }
.page-pathway-system form[aria-busy="true"] .is-loading {
  cursor: progress;
  opacity: .72;
}
.pathway-expression-workspace:fullscreen,
.is-pathway-pseudo-fullscreen {
  width: 100vw;
  height: 100vh;
  padding: 18px;
  overflow: auto;
  color: var(--ink);
  background: var(--page);
}
.is-pathway-pseudo-fullscreen {
  position: fixed;
  z-index: 1000;
  inset: 0;
}
body.is-pathway-pseudo-fullscreen-open { overflow: hidden; }
.pathway-expression-workspace:fullscreen .page-shell,
.is-pathway-pseudo-fullscreen .page-shell {
  width: 100%;
  max-width: none;
}

@media (prefers-reduced-motion: reduce) {
  .pathway-copy-toast { transition: none; }
}

/* Grid children that contain wide scientific tables must be allowed to shrink;
   the table itself scrolls inside its dedicated region. */
.pathway-category-family-region,
.pathway-category-species-region,
.pathway-category-detail-grid > *,
.pathway-family-layout > *,
.pathway-candidate-detail-layout > *,
.pathway-species-detail-layout > * { min-width: 0; }
