/* ToxoEntityNet portal: design tokens and shell.
 * Release 2026-10 visual refresh: one sans family, one border colour, one
 * accent; sections are separated by rules, not cards. Token names are read
 * by every module stylesheet; change values here only. */
:root {
  --ink: #1f2a30;
  --ink-soft: #56656c;
  --muted: #56656c;
  --line: #d9dfe2;
  --line-soft: #eef1f2;
  /* Form-control outline only (inputs, selects, buttons need >= 3:1 contrast). */
  --line-strong: #a9b5ba;
  --surface: #ffffff;
  --surface-soft: #f6f7f8;
  --surface-tint: #e8f2f2;
  --navy: #1f2a30;
  --navy-deep: #1f2a30;
  --teal: #0a6e74;
  --teal-dark: #08575c;
  --teal-soft: #e8f2f2;
  --orange: #9a5b13;
  --orange-soft: #fbf5ec;
  --red: #a33a36;
  --shadow: none;
  --shadow-menu: 0 2px 6px rgba(0, 0, 0, 0.12);
  --focus-ring: rgb(10 110 116 / 30%);
  --radius: 3px;
  --sans: "Source Sans 3", "Source Sans Pro", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans);
  --mono: "DejaVu Sans Mono", Menlo, Consolas, monospace;
  /* Aliases kept for module stylesheets (entry, methods, tools, plugins). */
  --accent: var(--teal);
  --rule: var(--line);
  --label: var(--ink-soft);
  --page-width: 1320px;
  --page-gutter: 24px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
}

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

h1 { font-size: 24px; line-height: 1.25; }
h2 { font-size: 18px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; }

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select,
input[type="search"] {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

button {
  padding: 5px 10px;
  color: var(--teal);
  line-height: 1.35;
  cursor: pointer;
}

button:hover:not(:disabled) {
  border-color: var(--teal);
  background: var(--surface);
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 1px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

a {
  color: var(--teal);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code,
kbd,
samp {
  font-family: var(--mono);
  font-size: 0.92em;
}

small {
  font-size: 12px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Utility strip ---------- */
.utility-bar {
  color: #d5dde0;
  background: var(--navy-deep);
}

.utility-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(var(--page-width), calc(100% - 2 * var(--page-gutter)));
  min-height: 28px;
  margin: 0 auto;
  font-size: 12px;
  line-height: 1.3;
}

.utility-inner b {
  font-weight: 600;
  font-style: italic;
}

.release-stats {
  overflow: hidden;
  margin-left: auto;
  color: #b9c6cb;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.utility-note {
  color: #b9c6cb;
}

/* ---------- Header: wordmark, global search, navigation ---------- */
.database-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 12px 32px;
  padding: 14px max(var(--page-gutter), calc((100% - var(--page-width)) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: block;
  color: var(--teal-dark);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-copy strong,
.brand-copy small {
  display: block;
}

.brand-copy strong {
  color: var(--teal-dark);
  font: 600 22px/1.15 var(--sans);
  letter-spacing: 0;
}

.brand-copy small {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
}

.global-search {
  position: relative;
  width: 100%;
  max-width: 720px;
}

.search-shell {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr) auto;
  height: 36px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-shell:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.search-shell select,
.search-shell input,
.search-shell button {
  height: 100%;
  border: 0;
  border-radius: 0;
}

.search-shell select {
  min-width: 0;
  padding: 0 8px;
  color: var(--ink);
  border-right: 1px solid var(--line);
  background: var(--surface-soft);
  cursor: pointer;
  font-size: 13px;
  font-weight: 400;
}

.search-shell input {
  min-width: 0;
  padding: 0 10px;
  outline: none;
  font-size: 14px;
}

.search-shell button {
  padding: 0 18px;
  color: #fff;
  background: var(--teal);
  font-weight: 600;
}

.search-shell button:hover:not(:disabled) {
  background: var(--teal-dark);
}

.search-examples {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.text-button {
  padding: 0 3px;
  color: var(--teal);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: inherit;
}

.text-button:hover:not(:disabled) {
  text-decoration: underline;
  background: transparent;
}

/* Quick-search dropdown under the search box. */
.search-results {
  position: absolute;
  top: 37px;
  left: 0;
  z-index: 40;
  width: 100%;
  max-height: min(520px, 70vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-menu);
}

.search-results:empty {
  display: none;
}

.search-hit {
  display: block;
  width: 100%;
  padding: 7px 12px;
  color: var(--ink);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--surface);
}

.search-hit:hover:not(:disabled) {
  background: var(--surface-soft);
}

/* Dropdown hits are links (open in new tab, URL on hover); underline only the name. */
a.search-hit,
a.search-hit:hover {
  text-decoration: none;
}

a.search-hit:hover .search-hit-heading strong,
a.search-hit:focus-visible .search-hit-heading strong {
  color: var(--teal);
  text-decoration: underline;
}

.search-hit:focus-visible {
  position: relative;
  z-index: 1;
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
  background: var(--surface-soft);
}

.search-results-summary {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 12px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 12px;
}

.search-results-summary strong {
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.search-hit-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.search-hit-heading strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
}

.search-type-badge {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

.search-hit strong,
.search-hit small {
  display: block;
}

.search-hit .search-hit-id {
  overflow: hidden;
  color: var(--ink-soft);
  font: 12px/1.45 var(--mono);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-hit .search-hit-function {
  color: var(--ink);
  font-size: 12.5px;
}

.search-hit-meta {
  display: block;
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 12px;
}

.search-hit-meta i {
  font-style: normal;
}

.search-hit-meta i + i::before {
  content: " · ";
}

.search-empty {
  padding: 12px;
}

.search-empty strong,
.search-empty small {
  display: block;
}

.search-empty strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.search-empty small {
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.search-hit small {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.45;
}

.search-results > .muted,
.search-results > .error {
  margin: 0;
  padding: 10px 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 2px 4px;
}

.header-actions a,
.header-actions button {
  padding: 4px 8px;
  color: var(--teal);
  border: 0;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  white-space: nowrap;
}

.header-actions a:hover,
.header-actions button:hover:not(:disabled) {
  color: var(--teal-dark);
  background: transparent;
  text-decoration: underline;
}

/* The Agent drawer toggle is a plain navigation item, not a coloured button. */
.header-actions .agent-toggle,
.header-actions .agent-toggle:hover:not(:disabled) {
  color: var(--teal);
  border: 0;
  background: transparent;
  font-weight: 400;
}

/* ---------- Breadcrumb ---------- */
.record-navigation {
  width: min(var(--page-width), calc(100% - 2 * var(--page-gutter)));
  margin: 0 auto;
  padding: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.record-navigation > span {
  margin: 0 4px;
}

#returnSearchButton {
  margin-right: 16px;
  padding: 0;
  font-size: 13px;
}

/* ---------- Entry title block ---------- */
.record-ribbon {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 24px;
  width: min(var(--page-width), calc(100% - 2 * var(--page-gutter)));
  margin: 0 auto;
  padding: 10px 0 0;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.record-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 12px;
  min-width: 0;
}

.record-heading h1 {
  flex: 1 0 100%;
  order: 0;
  margin: 0 0 2px;
  overflow-wrap: anywhere;
  color: var(--ink);
  font: 600 24px/1.25 var(--sans);
  letter-spacing: 0;
}

.record-heading > p {
  order: 1;
  max-width: 1050px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
}

/* Entity type: small secondary text after the identifiers line. */
.record-kicker {
  display: flex;
  order: 2;
  align-items: baseline;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
}

.record-kicker:has(#recordType:empty) {
  display: none;
}

/* A thin rule separates the type from the identifiers (no generated text). */
.record-kicker {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  line-height: 1.1;
}

.status-pill {
  padding: 0 5px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  font-size: 12px;
  letter-spacing: 0;
}

.record-badges {
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  order: 3;
  gap: 6px;
  margin-top: 6px;
}

.record-badges:empty {
  display: none;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding-top: 4px;
}

.record-actions button,
.record-actions .primary-link {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  color: var(--teal);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.3;
  text-decoration: none;
  white-space: nowrap;
}

.record-actions button:hover:not(:disabled),
.record-actions .primary-link:hover {
  border-color: var(--teal);
  text-decoration: none;
}

.record-actions button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 600;
}

.record-stat-strip {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.record-stat-strip:empty {
  display: none;
}

.record-stat {
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 18px 6px 0;
  margin-right: 18px;
  color: var(--ink-soft);
  border-right: 1px solid var(--line-soft);
  font-size: 13px;
}

.record-stat:last-child {
  border-right: 0;
}

.record-stat b {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---------- Tabs ---------- */
.workspace-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 0;
  margin-top: 10px;
  overflow-x: auto;
}

.workspace-tab {
  flex: 0 0 auto;
  margin-bottom: -1px;
  padding: 7px 14px 6px;
  color: var(--ink-soft);
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
}

.workspace-tab:hover:not(:disabled) {
  color: var(--teal);
  border-bottom-color: var(--line);
  background: transparent;
}

.workspace-tab.active,
.workspace-tab.active:hover:not(:disabled) {
  color: var(--ink);
  border-bottom-color: var(--teal);
  font-weight: 600;
}

/* ---------- Page body ---------- */
.database-main {
  width: min(var(--page-width), calc(100% - 2 * var(--page-gutter)));
  min-height: 560px;
  margin: 0 auto;
  padding: 18px 0 40px;
}

.record-workspace {
  min-height: 520px;
}

/* Home, search, tools and download pages reuse the ribbon for the page title. */
.record-ribbon.welcome-ribbon {
  padding-bottom: 10px;
  background: var(--surface);
}

.welcome-ribbon .record-actions,
.welcome-ribbon .record-badges,
.welcome-ribbon .record-kicker {
  display: none;
}

.welcome-ribbon .record-stat-strip {
  margin-top: 6px;
}

.welcome-portal {
  display: grid;
  gap: 16px;
}

/* ---------- Record layout (non-protein records, network) ---------- */
.record-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  align-items: start;
  gap: 32px;
}

.record-main-column,
.record-side-column {
  display: grid;
  gap: 24px;
  min-width: 0;
}

/* ---------- Sections: rule-separated, no cards ---------- */
.database-section {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 10px;
  padding: 0 0 5px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.section-heading h2,
.section-heading h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.3;
}

.section-heading p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.section-count {
  flex: 0 0 auto;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Wide tables scroll inside the section instead of widening the page. */
.section-body {
  padding: 0;
  overflow-x: auto;
  overflow-wrap: break-word;
}

.section-body > :first-child {
  margin-top: 0;
}

.section-body > :last-child {
  margin-bottom: 0;
}

.function-summary {
  margin: 0;
  color: var(--ink);
  font: 15px/1.6 var(--sans);
}

.lead-summary {
  padding-left: 0;
  border-left: 0;
}

.confidence-line {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-top: 10px;
}

.confidence-chip {
  padding: 0;
  color: var(--ink-soft);
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 13px;
}

.confidence-chip b {
  color: var(--ink);
  font-weight: 600;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 32px;
}

.feature-card,
.feature-card.accent {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.feature-card h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
}

.feature-card p {
  margin: 2px 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.feature-card .value-large {
  color: var(--ink);
  font: 600 15px/1.4 var(--sans);
}

.key-fact-list {
  display: grid;
  gap: 0;
  font-size: 13px;
}

.key-fact {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  line-height: 1.45;
}

.key-fact:last-child {
  border-bottom: 0;
}

.key-fact span {
  overflow-wrap: anywhere;
}

.key-fact span:first-child {
  color: var(--ink-soft);
}

.key-fact span:last-child {
  color: var(--ink);
}

.relationship-bars {
  display: grid;
  gap: 6px;
}

.relationship-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.8fr) minmax(120px, 2fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.relationship-track {
  height: 6px;
  overflow: hidden;
  border-radius: 0;
  background: var(--line-soft);
}

.relationship-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 0;
  background: var(--teal);
}

.relationship-row b {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.annotation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0 32px;
}

.annotation-card {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  min-height: 0;
  padding: 5px 0;
  color: var(--teal);
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: none;
}

.annotation-card:hover:not(:disabled) {
  border-bottom-color: var(--line-soft);
  text-decoration: underline;
}

.annotation-card span {
  color: inherit;
  font-size: 13px;
  line-height: 1.4;
}

.annotation-card b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.record-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.record-toolbar input,
.record-toolbar select {
  min-height: 32px;
  padding: 4px 8px;
  font-size: 13px;
}

.record-toolbar input {
  flex: 1;
  min-width: 150px;
}

.record-toolbar .toolbar-result {
  width: 100%;
  margin-left: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
}

.evidence-records,
.alias-record-list {
  display: grid;
  gap: 0;
}

.evidence-records {
  margin-top: 10px;
}

.alias-record-list {
  max-height: 680px;
  padding-right: 4px;
  overflow-y: auto;
}

.source-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px 32px;
}

.source-group {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.source-group h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.source-group p {
  margin: 2px 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.record-loading {
  display: grid;
  gap: 12px;
  padding: 24px 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.skeleton {
  width: 62%;
  height: 16px;
  border-radius: 2px;
  background: var(--line-soft);
  animation: shimmer 1.4s ease-in-out infinite alternate;
}

.skeleton.wide {
  width: 88%;
  height: 22px;
}

.skeleton.short {
  width: 40%;
}

@keyframes shimmer {
  to { opacity: 0.5; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton { animation: none; }
}

/* ---------- Network workspace ---------- */
.network-workspace {
  display: grid;
  grid-template-columns: 300px minmax(540px, 1fr) 360px;
  gap: 12px;
  height: max(690px, calc(100vh - 265px));
  min-height: 690px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--surface);
  box-shadow: none;
}

.filter-panel,
.inspector-panel {
  overflow-y: auto;
}

.filter-panel {
  padding: 12px 14px;
}

.panel-title-row,
.detail-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.panel-title-row h2,
.detail-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
}

.section-eyebrow {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

.panel-count,
.mode-badge {
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

.control-section,
.filter-group {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.control-section.first {
  margin-top: 12px;
}

.section-label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.wide-select {
  width: 100%;
  padding: 5px 6px;
}

.microcopy,
.muted {
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.microcopy {
  margin: 6px 0 0;
}

.field-grid {
  display: grid;
  gap: 8px;
}

.field-grid.three {
  grid-template-columns: 0.75fr 0.9fr 1.15fr;
}

.field-grid label,
.range-label,
.small-label {
  color: var(--ink-soft);
  font-size: 12px;
}

.field-grid select,
.field-grid .graph-bound-input {
  display: block;
  width: 100%;
  margin-top: 3px;
  padding: 4px 5px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-size: 13px;
}

.graph-bound-input.invalid {
  color: var(--red);
  border-color: var(--red);
  background: var(--surface);
}

.range-label {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.range-label output {
  color: var(--ink);
  font-weight: 600;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

.filter-group summary {
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 6px;
  margin-top: 10px;
}

.check-grid label,
.claim-controls label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--ink);
  font-size: 12.5px;
}

.check-grid input,
.claim-controls input {
  margin: 0;
  accent-color: var(--teal);
}

.swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #809198;
}

.swatch.association { background: #668fa8; }
.swatch.metabolism { background: #3e9b6c; }
.swatch.transport { background: #df8a37; }
.swatch.regulation { background: #c35879; }
.swatch.vulnerability { background: #d15343; }
.swatch.complex { background: #98745e; }
.swatch.phenotype { background: #ac872f; }
.swatch.human_context { background: #ae6967; }
.swatch.localization { background: #3ba49c; }
.swatch.structure { background: #687acc; }
.swatch.provenance_or_crossref { background: #a5afb3; }

.claim-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.claim-controls label:last-child {
  grid-column: 1 / -1;
}

.prediction-filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

.prediction-filter-actions button {
  padding: 2px 8px;
  font-size: 12px;
}

.prediction-type-controls {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.prediction-type-controls label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: none;
  cursor: pointer;
}

.prediction-type-controls label:has(input:checked) {
  background: var(--teal-soft);
}

.prediction-type-controls input {
  margin: 0;
  accent-color: var(--teal);
}

.prediction-type-controls span {
  display: grid;
  min-width: 0;
}

.prediction-type-controls b {
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
}

.prediction-type-controls small {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prediction-type-controls em {
  color: var(--ink-soft);
  font-size: 12px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.small-label {
  display: block;
  margin: 10px 0 4px;
}

#contextInput {
  width: 100%;
  padding: 5px 7px;
  font-size: 13px;
}

/* Filled accent buttons: only the Search actions (header, batch query). */
.primary-wide {
  width: 100%;
  margin-top: 10px;
  padding: 6px 10px;
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
  font-size: 13px;
  font-weight: 600;
}

.primary-wide:hover:not(:disabled) {
  border-color: var(--teal-dark);
  background: var(--teal-dark);
}

.network-action-row .primary-wide {
  margin-top: 10px;
  color: var(--teal);
  border-color: var(--teal);
  background: var(--surface);
}

.network-action-row .primary-wide:hover:not(:disabled) {
  color: var(--teal-dark);
  border-color: var(--teal-dark);
  background: var(--surface);
}

.network-scale-hint {
  margin-top: 12px;
  padding: 0;
  color: var(--ink-soft);
  border: 0;
  border-radius: 0;
  background: none;
  font-size: 12.5px;
  line-height: 1.45;
}

.network-scale-hint.large-query {
  color: var(--orange);
  border: 0;
  background: none;
}

.network-action-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}

.cancel-wide {
  width: 100%;
  padding: 6px 10px;
  color: var(--red);
  border-color: var(--line-strong);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
}

.interpretation-note {
  margin-top: 14px;
  padding: 10px 0 0;
  color: var(--ink-soft);
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  background: none;
  font-size: 12.5px;
  line-height: 1.5;
}

.interpretation-note strong {
  color: var(--ink);
}

.interpretation-note p {
  margin: 4px 0 0;
}

.graph-panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}

.graph-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 14px;
  min-height: 52px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.graph-heading {
  flex: 1 1 260px;
  min-width: 0;
}

.graph-heading strong,
.graph-heading > span:last-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-heading strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.graph-heading > span:last-child {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 12px;
}

.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 6px;
}

.toolbar-actions button,
.toolbar-actions select {
  padding: 4px 8px;
  font-size: 12.5px;
  white-space: nowrap;
}

.compact-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--ink-soft);
  font-size: 12px;
}

.button-group {
  display: flex;
}

.button-group button {
  min-width: 30px;
  border-radius: 0;
}

.button-group button:first-child {
  border-radius: var(--radius) 0 0 var(--radius);
}

.button-group button:last-child {
  margin-left: -1px;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.graph-metrics {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  min-height: 30px;
  padding: 5px 12px;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 12px;
}

.graph-metrics b {
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.graph-metrics .metric-emphasis b {
  color: var(--ink);
}

.graph-metrics #metricCoverage {
  margin-left: auto;
  text-align: right;
}

.canvas-wrap {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

#networkCanvas {
  display: block;
  touch-action: none;
}

.empty-state,
.loading-state {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  text-align: center;
  transform: translate(-50%, -50%);
}

.empty-state {
  width: min(430px, 80%);
  color: var(--ink-soft);
}

.empty-state h2 {
  margin: 6px 0 4px;
  color: var(--ink);
  font: 600 16px var(--sans);
}

.empty-state p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.empty-mark {
  display: none;
}

.loading-state {
  padding: 6px 12px;
  color: #fff;
  border-radius: var(--radius);
  background: rgb(31 42 48 / 90%);
  font-size: 12.5px;
}

.canvas-legend {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px 12px;
  max-width: calc(100% - 20px);
  padding: 4px 8px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 0;
  background: rgb(255 255 255 / 94%);
  font-size: 12px;
}

.canvas-legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.node-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #849298;
}

.node-dot.parasite_protein { background: #337c9e; }
.node-dot.molecule { background: #3f9d68; }
.node-dot.human_protein { background: #a76576; }
.node-dot.phenomenon { background: #c08a36; }
.node-dot.other { background: #8371ad; }

.inspector-panel {
  padding: 12px 14px;
}

.detail-panel {
  padding-top: 8px;
  overflow-wrap: anywhere;
}

.detail-panel h2 {
  margin: 4px 0;
  color: var(--ink);
  font: 600 16px/1.3 var(--sans);
}

.detail-panel h3 {
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.detail-panel p {
  margin: 5px 0;
  font-size: 13px;
  line-height: 1.5;
}

.detail-id {
  color: var(--ink-soft);
  font: 12px/1.45 var(--mono);
}

/* ---------- Tags: square, bordered, never pills ---------- */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 6px 0;
}

.tag,
.tag.score,
.tag.transporter {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  font-size: 12px;
  line-height: 1.5;
}

/* ---------- External links: plain link lists ---------- */
.external-link-section {
  margin-top: 12px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: none;
}

.external-link-section summary {
  padding: 6px 0;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.external-link-section summary small {
  display: block;
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 400;
}

.external-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 0 24px;
  padding: 0 0 6px;
}

.external-link,
.external-link.exact,
.external-link.literature,
.external-link.search,
.external-link.database {
  display: block;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: none;
  text-decoration: none;
}

.external-link:hover {
  background: none;
}

.external-link:hover strong {
  text-decoration: underline;
}

.external-link strong,
.external-link small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.external-link strong {
  color: var(--teal);
  font-size: 13px;
  font-weight: 400;
  white-space: nowrap;
}

.external-link small {
  margin-top: 0;
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
}

/* Decorative "↗" markers in link labels are not shown; links name their target. */
.external-link span[aria-hidden="true"],
.external-text-link span[aria-hidden="true"],
.summary-links span[aria-hidden="true"] {
  display: none;
}

.inline-external-links {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  margin-top: 4px;
}

.external-text-link,
.external-text-link.literature,
.external-text-link.search {
  color: var(--teal);
  border-bottom: 0;
  font-size: 13px;
}

.external-text-link:hover {
  text-decoration: underline;
}

.kv-grid {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 4px 10px;
  margin: 8px 0;
  font-size: 13px;
}

.kv-grid dt {
  color: var(--ink-soft);
}

.kv-grid dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

/* Record lists: rows separated by rules. */
.record-list {
  display: grid;
  gap: 0;
}

.record,
.record.transport,
.record.metabolism,
.record.association,
.record.regulation,
.record.vulnerability,
.record.complex,
.record.phenotype,
.record.human_context,
.record.localization,
.record.structure {
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: none;
}

.record strong,
.record small {
  display: block;
}

.record strong {
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
}

.record small {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.5;
}

.record button {
  margin-top: 5px;
  padding: 2px 8px;
  font-size: 12.5px;
}

.count-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.count-table td {
  padding: 5px 4px;
  border-bottom: 1px solid var(--line-soft);
}

.count-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Notices: a left rule and plain text, no tinted boxes. */
.warning,
.error,
.notice {
  padding: 4px 0 4px 10px;
  border: 0;
  border-left: 3px solid var(--line);
  border-radius: 0;
  background: none;
  font-size: 13px;
  line-height: 1.5;
}

.notice {
  color: var(--ink);
}

.warning {
  color: var(--orange);
  border-left-color: var(--orange);
}

.error {
  color: var(--red);
  border-left-color: var(--red);
}

/* ---------- Footer ---------- */
.database-footer {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(var(--page-gutter), calc((100% - var(--page-width)) / 2));
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 13px;
}

.database-footer strong,
.database-footer span {
  display: block;
}

.database-footer strong {
  color: var(--ink);
  font: 600 14px var(--sans);
}

.database-footer p {
  max-width: 720px;
  margin: 0;
  text-align: right;
  line-height: 1.5;
}

/* ---------- Help dialog ---------- */
.help-dialog {
  width: min(820px, calc(100% - 30px));
  max-width: 820px;
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-menu);
}

.help-dialog::backdrop {
  background: rgb(31 42 48 / 45%);
}

.help-dialog form {
  position: relative;
  padding: 20px 24px;
}

.help-dialog h2 {
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  font: 600 18px var(--sans);
}

.help-dialog h3 {
  margin: 14px 0 4px;
  font-size: 15px;
}

.help-dialog p {
  margin: 4px 0;
  line-height: 1.5;
}

.help-dialog ol {
  margin: 4px 0;
  padding-left: 20px;
}

.help-dialog li {
  margin: 0 0 5px;
  color: var(--ink);
  line-height: 1.5;
}

.dialog-close {
  position: absolute;
  top: 14px;
  right: 16px;
  padding: 2px 8px;
  font-size: 13px;
}

.dialog-note {
  margin: 14px 0 0;
  padding: 8px 0 0;
  color: var(--ink-soft);
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  background: none;
  font-size: 12.5px;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  max-width: 360px;
  padding: 8px 12px;
  color: #fff;
  border-radius: var(--radius);
  background: var(--ink);
  box-shadow: var(--shadow-menu);
  font-size: 13px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1390px) {
  .network-workspace {
    grid-template-columns: 270px minmax(500px, 1fr) 330px;
  }

  .toolbar-actions .compact-field {
    display: none;
  }
}

@media (max-width: 1150px) {
  .database-header {
    grid-template-columns: auto 1fr;
  }

  .global-search {
    grid-row: 2;
    grid-column: 1 / -1;
    max-width: none;
  }

  .header-actions {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
  }

  .record-ribbon {
    grid-template-columns: 1fr;
  }

  .record-actions {
    justify-content: flex-start;
    margin-top: 8px;
    padding-top: 0;
  }
}

@media (max-width: 1100px) {
  .record-layout {
    grid-template-columns: 1fr;
  }

  .record-side-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .network-workspace {
    grid-template-columns: 245px minmax(460px, 1fr);
  }

  .inspector-panel {
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 30;
    width: min(390px, calc(100% - 24px));
    max-height: 70vh;
    box-shadow: var(--shadow-menu);
  }
}

@media (max-width: 780px) {
  :root {
    --page-gutter: 12px;
  }

  .utility-inner {
    gap: 8px;
  }

  .release-stats {
    max-width: 55%;
  }

  .database-header {
    display: block;
    padding: 10px var(--page-gutter);
  }

  .header-actions {
    justify-content: flex-start;
    margin: 6px 0 0 -8px;
  }

  .global-search {
    margin-top: 8px;
  }

  .search-shell {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 34px 36px;
    height: auto;
  }

  .search-shell select {
    grid-column: 1 / -1;
    grid-row: 1;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .search-shell input {
    grid-column: 1;
    grid-row: 2;
  }

  .search-shell button {
    grid-column: 2;
    grid-row: 2;
  }

  .search-results {
    top: 72px;
  }

  .record-heading h1 {
    font-size: 21px;
  }

  .record-stat-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .record-stat {
    flex: 0 0 auto;
  }

  .workspace-tab {
    padding: 7px 10px 6px;
  }

  .database-main {
    padding-top: 12px;
  }

  .feature-grid,
  .record-side-column {
    grid-template-columns: 1fr;
  }

  .record-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .record-toolbar input,
  .record-toolbar select {
    width: 100%;
  }

  .network-workspace {
    display: block;
    height: auto;
    min-height: 0;
  }

  .filter-panel {
    margin-bottom: 10px;
  }

  .graph-panel {
    height: 72vh;
    min-height: 560px;
  }

  .graph-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .graph-metrics #metricCoverage {
    width: 100%;
    margin-left: 0;
    text-align: left;
  }

  .database-footer {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .database-footer p {
    text-align: left;
  }
}

/* Keyboard access: skip link (hidden until focused) and a visible search focus ring. */
.skip-link {
  position: absolute;
  left: 8px;
  top: -40px;
  z-index: 1000;
  padding: 6px 10px;
  background: var(--surface);
  color: var(--teal);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 8px;
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
#main:focus { outline: none; }
#searchInput:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
