/* neurodigineration network page — interactive cross-disease graph.
 * Dark scientific aesthetic to read as a "data instrument," not a website.
 * Three layers: header (status), full-bleed canvas (D3), slide-in detail panel. */

:root {
  /* Dark theme is the default — matches the data-instrument aesthetic. */
  --bg: #0b0f14;
  --bg-2: #11161d;
  --panel: #161d27;
  --panel-2: #1c2532;
  --ink: #e8edf2;
  --ink-soft: #b6bfca;
  --mute: #7a8593;
  --rule: #243042;
  --rule-strong: #2f3d52;
  --accent: #56b1ff;
  --accent-soft: rgba(86, 177, 255, 0.18);
  --gold: #f6c453;
  --gold-soft: rgba(246, 196, 83, 0.16);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.18);
  --warn: #f97316;
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, 0.18);
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-2: 0 12px 36px rgba(0, 0, 0, 0.55);
  --canvas-glow: rgba(86, 177, 255, 0.06);
}

/* Light-theme override — adopts the arminbayati.com palette so when the
 * SME flips to light mode the network reads as part of the personal site
 * (warm paper background, crimson accent, DM Serif Display / IBM Plex). */
[data-theme="light"] {
  --bg: #fafaf7;            /* arminbayati paper */
  --bg-2: #f4f3ef;          /* arminbayati section-bg */
  --panel: #ffffff;          /* arminbayati card */
  --panel-2: #f4f3ef;
  --ink: #0f1419;            /* arminbayati ink */
  --ink-soft: #1f2937;
  --mute: #6b7280;           /* arminbayati mid */
  --rule: #d4d0c8;           /* arminbayati warm rule */
  --rule-strong: #b8b2a6;
  --accent: #c0392b;         /* arminbayati crimson */
  --accent-soft: #e74c3c20;
  --gold: #b45309;
  --gold-soft: #fff5d6;
  --ok: #15803d;
  --ok-soft: #dcfce7;
  --warn: #b45309;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;
  --shadow-1: 0 1px 2px rgba(15, 20, 25, 0.06);
  --shadow-2: 0 12px 36px rgba(15, 20, 25, 0.10);
  --canvas-glow: rgba(192, 57, 43, 0.04);
}

/* Brand fonts in light mode — match arminbayati.com */
[data-theme="light"] body {
  font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
[data-theme="light"] code,
[data-theme="light"] .mono,
[data-theme="light"] .node-label {
  font-family: 'IBM Plex Mono', 'SF Mono', Menlo, Consolas, monospace;
}
[data-theme="light"] .brand .logo,
[data-theme="light"] .panel h2,
[data-theme="light"] .help-overlay h4 {
  font-family: 'DM Serif Display', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 0.92em; background: var(--panel-2); padding: 1px 5px; border-radius: 3px; }
button { font: inherit; color: inherit; }

/* ===== Header ===== */
header.site {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: linear-gradient(180deg, rgba(11,15,20,0.95) 0%, rgba(11,15,20,0.78) 100%);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
/* In light mode the header uses the paper palette so the body and header
 * read as a single page rather than dark-on-light strip. */
[data-theme="light"] header.site {
  background: linear-gradient(180deg, rgba(250, 250, 247, 0.96) 0%, rgba(250, 250, 247, 0.82) 100%);
  border-bottom-color: var(--rule);
}
[data-theme="light"] header.site .brand,
[data-theme="light"] header.site .brand a {
  color: var(--ink);
}
[data-theme="light"] nav.site-nav a { color: var(--ink-soft); }
[data-theme="light"] nav.site-nav a:hover { color: var(--accent); }
header.site .row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand .logo {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--accent); color: #0b0f14;
  display: grid; place-items: center;
  font-family: Georgia, serif; font-weight: 700; font-size: 18px;
}
.brand .name { font-size: 17px; }
.brand .name em { font-style: normal; color: var(--mute); font-weight: 500; font-size: 13px; margin-left: 6px; }
.pill {
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--panel); color: var(--ink-soft); font-weight: 600;
}
.pill.trained { background: var(--gold-soft); color: var(--gold); border-color: transparent; }
.pill.default { background: var(--panel); color: var(--mute); }
.spacer { flex: 1; }
nav.site-nav { display: flex; gap: 14px; font-size: 13.5px; }
nav.site-nav a { color: var(--ink-soft); }
nav.site-nav a:hover { color: var(--accent); }

/* Theme toggle button + generic header buttons (✦ suggest-open, etc.) */
.theme-toggle,
.header-btn {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 14px;
  transition: color 0.15s, border-color 0.15s, transform 0.05s, background 0.15s;
}
.theme-toggle:hover,
.header-btn:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle:active,
.header-btn:active { transform: scale(0.94); }
.header-btn.active { background: var(--accent); color: white; border-color: transparent; }
.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: inline; }
[data-theme="light"] .theme-toggle .sun { display: inline; }
[data-theme="light"] .theme-toggle .moon { display: none; }

/* Disease filter chips: their own row under the header controls */
.disease-filters {
  display: flex; gap: 4px; flex-wrap: wrap;
  order: 10; flex-basis: 100%;
}
.disease-filters button {
  padding: 4px 10px;
  font-size: 11.5px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--panel);
  color: var(--ink-soft);
  cursor: pointer;
  transition: all 0.12s;
}
.disease-filters button.active { color: var(--ink); border-color: transparent; }
.disease-filters button:hover { color: var(--ink); }

/* Edge-kind legend (rendered inside the floating .legend-body) */
.edge-legend {
  display: flex; flex-direction: column; gap: 1px;
  font-size: 11px; color: var(--ink-soft);
}
.edge-legend .item {
  display: flex; align-items: center; gap: 7px;
  background: none; border: none; padding: 3px 4px; border-radius: 5px;
  cursor: pointer; text-align: left; font-size: 11px; color: inherit;
}
.edge-legend .item:hover { background: var(--panel-2); }
.edge-legend .item.static { cursor: default; }
.edge-legend .item.off { opacity: 0.38; }
.edge-legend .item.off .lbl { text-decoration: line-through; }
.edge-legend .item .lbl { flex: 1; }
.edge-legend .item .count { font-family: 'SF Mono', Menlo, monospace; font-size: 10px; color: var(--mute); }
.edge-legend .swatch {
  width: 16px; height: 2.5px; border-radius: 1px;
}

/* Floating, collapsible legend panel on the left side of the canvas. */
.left-stack {
  position: fixed;
  top: calc(var(--header-h, 56px) + 14px);
  left: 12px;
  z-index: 30;
  display: flex; flex-direction: column; gap: 8px;
  width: 270px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - var(--header-h, 56px) - 90px);
  overflow-y: auto;
  pointer-events: none; /* only the cards themselves catch clicks */
}
.left-stack > * { pointer-events: auto; }
.legend-float {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  padding: 6px;
  font-size: 11.5px;
  color: var(--ink-soft);
  max-width: 260px;
  user-select: none;
}
.legend-float .legend-toggle {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; cursor: pointer; padding: 4px 8px;
  color: var(--ink-soft); font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.02em; text-transform: uppercase;
  width: 100%; text-align: left;
}
.legend-float .legend-toggle .caret {
  transition: transform 0.18s;
  font-size: 10px;
}
.legend-float .legend-toggle[aria-expanded="true"] .caret { transform: rotate(90deg); }
.legend-float .legend-body {
  padding: 4px 8px 6px;
  display: flex; flex-direction: column; gap: 8px;
  width: 250px;
}
.legend-hint { font-size: 10.5px; color: var(--mute); }
.legend-stats { font-size: 10.5px; color: var(--mute); border-top: 1px solid var(--rule); padding-top: 6px; line-height: 1.45; }
.legend-float .legend-body[hidden] { display: none; }
.legend-float .legend-note {
  font-size: 10.5px; color: var(--mute);
  display: flex; align-items: center; gap: 6px;
  border-top: 1px solid var(--rule); padding-top: 6px;
}
.legend-float .tangential-swatch {
  display: inline-block; width: 24px; height: 0;
  border-top: 1.5px dotted currentColor;
}

/* ===== Canvas ===== */
.canvas-frame {
  position: fixed; top: var(--header-h, 56px); left: 0; right: 0; bottom: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 50% 40%, var(--canvas-glow) 0%, transparent 70%),
    var(--bg);
}
#graph {
  width: 100%; height: 100%;
  cursor: grab;
}
#graph:active { cursor: grabbing; }

/* SVG-level styling */
.node-bg { fill: var(--panel); stroke: var(--rule); stroke-width: 1.5; transition: stroke 0.15s, fill 0.15s, filter 0.2s; }
.node-bg.dim { opacity: 0.18; }
.node-bg.highlighted { stroke-width: 2.5; filter: drop-shadow(0 0 8px currentColor); }
.node-label { font-family: 'SF Mono', Menlo, Consolas, monospace; font-weight: 600; fill: var(--ink); pointer-events: none; user-select: none; text-anchor: middle; }
.node-sub { font-size: 9.5px; fill: var(--ink-soft); pointer-events: none; user-select: none; text-anchor: middle; }
.node-label.dim, .node-sub.dim { opacity: 0.25; }

.edge { fill: none; transition: opacity 0.15s, stroke-width 0.15s; cursor: pointer; }
.edge.dim { opacity: 0.1; }
.edge.highlighted { stroke-width: 3.2 !important; opacity: 1 !important; }

/* Hover glow color (set per-node by JS via currentColor) */
.node-group { cursor: pointer; }
.node-group:hover .node-bg { filter: brightness(1.2); }

/* ===== Side panel ===== */
.panel {
  position: fixed; top: var(--header-h, 56px); right: 0; bottom: 0;
  width: 420px;
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border-left: 1px solid var(--rule);
  /* Shadow only when open — otherwise the blur bleeds back into the
     viewport from the off-screen panel and creates a dark strip on
     the right edge of the canvas. */
  box-shadow: none;
  padding: 22px 24px;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.18, 0.9, 0.3, 1), box-shadow 0.28s;
  z-index: 40;
}
.panel.open {
  transform: translateX(0);
  box-shadow: -8px 0 24px rgba(0,0,0,0.4);
}
.panel .close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--panel-2);
  color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center;
  font-size: 16px;
}
.panel .close:hover { color: var(--ink); border-color: var(--accent); }

.panel h2 {
  margin: 0 0 4px;
  font-family: Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.panel .sub {
  color: var(--mute); font-size: 13px;
  margin: 0 0 18px;
}

/* Edge-detail panel "from → to" header */
.edge-pair {
  display: flex; align-items: center; gap: 10px; margin: 0 0 12px;
  font-family: 'SF Mono', monospace; font-size: 16px;
  flex-wrap: wrap;
}
.edge-pair .arrow { color: var(--accent); font-size: 20px; }
.edge-pair .gene {
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
}
.edge-kind-pill {
  display: inline-block;
  font-size: 11px; padding: 3px 9px;
  border-radius: 999px; letter-spacing: 0.04em; text-transform: uppercase;
  font-weight: 600; margin-bottom: 12px;
}

.panel section.block {
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg-2);
  border: 1px solid var(--rule);
  border-radius: 10px;
}
.panel section.block h3 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 600;
}
.panel section.block p { margin: 0 0 8px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.55; }
.panel section.block p:last-child { margin-bottom: 0; }
.panel section.block ul { padding-left: 18px; margin: 0; }
.panel section.block li { margin: 3px 0; font-size: 13px; }
.panel section.block li a { color: var(--accent); font-family: 'SF Mono', monospace; }

/* Rating block */
.rate-block {
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--bg-2) 100%);
  border: 1px solid var(--rule-strong);
  padding: 16px;
  border-radius: 12px;
  margin-top: 6px;
}
.rate-block h3 {
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold); font-weight: 700; margin: 0 0 12px;
}
.validity-row {
  display: flex; gap: 6px; margin-bottom: 14px;
}
.validity-row button {
  flex: 1; padding: 8px 6px;
  border-radius: 8px; border: 1px solid var(--rule);
  background: var(--panel); color: var(--ink-soft);
  font-size: 12px; font-weight: 600; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.04em;
  transition: all 0.12s;
}
.validity-row button:hover { border-color: var(--accent); color: var(--ink); }
.validity-row button.sel.yes      { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.validity-row button.sel.no       { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.validity-row button.sel.uncertain{ background: var(--gold-soft); color: var(--gold); border-color: transparent; }

.rate-dim {
  display: grid; grid-template-columns: 110px 1fr 24px; gap: 6px 12px;
  align-items: center; margin-bottom: 6px; font-size: 12px;
}
.rate-dim .lbl { color: var(--ink-soft); }
.rate-dim .stars { display: inline-flex; gap: 3px; }
.rate-dim .star {
  width: 22px; height: 22px;
  border-radius: 5px; border: 1px solid var(--rule);
  background: var(--panel); color: var(--mute);
  display: grid; place-items: center;
  font-size: 13px; cursor: pointer; transition: all 0.1s;
}
.rate-dim .star:hover { border-color: var(--accent); color: var(--accent); }
.rate-dim .star.selected { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.rate-dim .val { font-family: 'SF Mono', monospace; font-size: 10.5px; text-align: right; color: var(--mute); }

.rate-feedback {
  width: 100%; min-height: 60px;
  padding: 8px 10px;
  border-radius: 8px; border: 1px solid var(--rule);
  background: var(--bg); color: var(--ink);
  font: inherit; font-size: 13px;
  resize: vertical; margin: 10px 0 12px;
}
.rate-feedback:focus { border-color: var(--accent); outline: none; }

.rate-save {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--bg);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: filter 0.12s;
}
.rate-save:hover { filter: brightness(1.05); }
.rate-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* Node-detail variant: list of connected genes */
.connection-list {
  display: flex; flex-direction: column; gap: 4px;
}
.connection-list .conn {
  padding: 6px 10px;
  background: var(--panel-2);
  border: 1px solid var(--rule);
  border-radius: 6px;
  cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  transition: border-color 0.1s, transform 0.05s;
}
.connection-list .conn:hover { border-color: var(--accent); transform: translateX(2px); }
.connection-list .conn .gene { font-family: 'SF Mono', monospace; font-weight: 600; color: var(--ink); min-width: 70px; }
.connection-list .conn .arrow { color: var(--mute); }
.connection-list .conn .kind { color: var(--mute); font-size: 11px; margin-left: auto; }

/* ===== Floating controls (zoom) ===== */
.zoom-controls {
  position: fixed; left: 18px; bottom: 18px;
  display: flex; flex-direction: row; gap: 4px;
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 4px;
  z-index: 30;
  box-shadow: var(--shadow-1);
}
.zoom-controls button {
  width: 32px; height: 32px;
  border: none; border-radius: 5px;
  background: transparent; color: var(--ink-soft);
  font-size: 16px; cursor: pointer;
  display: grid; place-items: center;
}
.zoom-controls button:hover { background: var(--panel-2); color: var(--ink); }

/* ===== Help overlay ===== */
/* Hidden by default — opened from the "?" header button. Positioned in
 * the bottom-left so it doesn't overlap the floating Legend (top-left) or
 * the suggest box (bottom-right). */
.help-overlay {
  position: fixed; left: 18px; bottom: 70px; /* above the zoom controls */
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 12.5px;
  color: var(--ink-soft);
  max-width: 320px;
  box-shadow: var(--shadow-1);
  z-index: 30;
  transition: opacity 0.25s, transform 0.25s;
}
.help-overlay[hidden] { display: none !important; }
.help-overlay.fading { opacity: 0.3; }
.help-overlay h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold); }
.help-overlay kbd {
  font-family: 'SF Mono', monospace; font-size: 11px;
  padding: 1px 5px; border-radius: 3px;
  background: var(--bg-2); border: 1px solid var(--rule);
}
.help-overlay button.dismiss {
  background: transparent; border: 1px solid var(--rule);
  color: var(--mute); border-radius: 4px;
  padding: 2px 8px; margin-top: 8px;
  font-size: 10.5px; cursor: pointer;
}
.help-overlay button.dismiss:hover { color: var(--ink); }

/* ===== Corner prompt — SME suggests a connection, Claude proposes ===== */
.suggest-card {
  position: fixed; right: 18px; bottom: 18px;
  width: 320px; max-width: calc(100vw - 36px);
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  padding: 12px 14px;
  z-index: 35;
  box-shadow: var(--shadow-2);
  transition: width 0.2s, padding 0.2s;
}
.suggest-card.collapsed {
  width: auto; padding: 8px 12px;
}
.suggest-card .head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  cursor: pointer;
}
.suggest-card .head h4 {
  margin: 0; font-size: 11px; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--gold);
  font-weight: 700; flex: 1;
}
.suggest-card .head .toggle,
.suggest-card .head .close {
  font-size: 14px; color: var(--mute);
  background: none; border: none; cursor: pointer;
  width: 22px; height: 22px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}
.suggest-card .head .toggle:hover,
.suggest-card .head .close:hover { color: var(--ink); background: var(--panel-2, rgba(0,0,0,0.04)); }
.suggest-card[hidden] { display: none !important; }
.suggest-card.collapsed .body { display: none; }
.suggest-card .body { display: block; }
.suggest-card .hint {
  font-size: 11.5px; color: var(--mute); margin-bottom: 8px;
}
.suggest-card textarea {
  width: 100%; min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  font: inherit; font-size: 13px;
  resize: vertical;
}
.suggest-card textarea:focus { border-color: var(--accent); outline: none; }
.suggest-card .row {
  display: flex; gap: 6px; margin-top: 8px; align-items: center;
}
.suggest-card .row button {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent); color: var(--bg);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.suggest-card .row button:disabled { opacity: 0.5; cursor: progress; }
.suggest-card .row .meta { font-size: 11px; color: var(--mute); margin-left: auto; }

/* Transient user-suggested edge styling */
.edge.user-edge { stroke-dasharray: 6 4; }

/* Tangential edges — author flagged them tentative; render dotted so the
 * SME can spot at a glance that these are candidates pending validation. */
.edge.tangential { stroke-dasharray: 2 3; opacity: 0.55; }
.edge.tangential.highlighted { opacity: 1; }

/* SME-accepted NEW edges (drafted on the train page, then accepted into
 * the graph) — dashed green so they stand out from curated solid/dotted. */
.edge.accepted {
  stroke-dasharray: 6 4;
  filter: drop-shadow(0 0 1.5px rgba(21, 128, 61, 0.55));
}
.edge.accepted.highlighted {
  opacity: 1 !important;
  filter: drop-shadow(0 0 3px rgba(21, 128, 61, 0.8));
}

/* ===== Toast (shared) ===== */
.toast-host {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 10px 16px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  max-width: 460px;
}
.toast.ok { background: var(--ok); }
.toast.warn { background: var(--warn); color: white; }
.toast.danger { background: var(--danger); color: white; }
.toast.bump { background: var(--accent); color: var(--bg); border: 2px solid var(--gold); }

/* ===== Gene search ===== */
.gene-search { position: relative; }
.gene-search input {
  width: 190px; padding: 6px 28px 6px 10px;
  border-radius: 8px; border: 1px solid var(--rule);
  background: var(--panel); color: var(--ink);
  font: inherit; font-size: 13px;
  transition: border-color 0.12s, width 0.18s;
}
.gene-search input:focus { outline: none; border-color: var(--accent); width: 240px; }
.gene-search .search-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: 'SF Mono', monospace; font-size: 10.5px; color: var(--mute);
  border: 1px solid var(--rule); border-radius: 4px; padding: 0 5px; pointer-events: none;
}
.gene-search input:focus + .search-kbd { display: none; }
.search-results {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 80;
  min-width: 300px; max-width: 90vw;
  list-style: none; margin: 0; padding: 4px;
  background: var(--panel); border: 1px solid var(--rule-strong);
  border-radius: 10px; box-shadow: var(--shadow-2);
}
.search-results li {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer; font-size: 12.5px;
}
.search-results li.active, .search-results li:hover { background: var(--accent-soft); }
.search-results li.empty { color: var(--mute); cursor: default; }
.search-results .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.search-results .sym { font-family: 'SF Mono', Menlo, monospace; font-weight: 700; min-width: 72px; }
.search-results .prot { color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== Checkbox rows + small buttons shared by the left cards ===== */
.check { display: flex; align-items: flex-start; gap: 6px; font-size: 11.5px; color: var(--ink-soft); cursor: pointer; flex-wrap: wrap; }
.check input { margin: 2px 0 0; accent-color: var(--accent); }
.verdict-key { flex-basis: 100%; padding-left: 20px; font-size: 10px; color: var(--mute); display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.vk { display: inline-block; width: 16px; height: 0; border-top: 2.5px solid; margin-right: 2px; }
.vk.yes { border-color: var(--ok); }
.vk.no { border-top-style: dotted; border-color: var(--danger); }
.vk.mixed { border-color: var(--gold); }
.link-btn { align-self: flex-start; background: none; border: none; padding: 0; color: var(--accent); font-size: 11px; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* ===== Path tracer card ===== */
.tool-card {
  background: var(--panel);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 10px 12px 12px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; gap: 8px;
}
.tool-card[hidden] { display: none; }
.tool-card .head { display: flex; align-items: center; }
.tool-card .head h4 { margin: 0; flex: 1; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); }
.tool-card .head .close { background: none; border: none; color: var(--mute); font-size: 15px; cursor: pointer; width: 22px; height: 22px; border-radius: 4px; }
.tool-card .head .close:hover { color: var(--ink); background: var(--panel-2); }
.tool-card .hint { font-size: 11px; color: var(--mute); line-height: 1.45; }
.path-inputs { display: flex; gap: 4px; align-items: center; }
.path-inputs input {
  flex: 1; min-width: 0; padding: 6px 8px;
  border-radius: 6px; border: 1px solid var(--rule);
  background: var(--bg); color: var(--ink);
  font-family: 'SF Mono', Menlo, monospace; font-size: 12.5px; text-transform: uppercase;
}
.path-inputs input::placeholder { text-transform: none; font-family: inherit; }
.path-inputs input:focus { outline: none; border-color: var(--accent); }
.path-inputs button { background: none; border: 1px solid var(--rule); color: var(--ink-soft); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; }
.path-inputs button:hover { border-color: var(--accent); color: var(--accent); }
.tool-card .primary {
  padding: 7px 12px; border-radius: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--bg);
  font-size: 12px; font-weight: 600; cursor: pointer;
}
[data-theme="light"] .tool-card .primary,
[data-theme="light"] .rate-save,
[data-theme="light"] .suggest-card .row button { color: #fff; }

/* ===== Verdict styling on edges ===== */
/* Confirmed edges turn solid even if the curator flagged them tentative:
 * the SME's validation is what the dotted style was waiting for. */
.edge.verdict-yes { stroke-dasharray: none; filter: drop-shadow(0 0 1.5px var(--ok)); }
.edge.verdict-no { stroke: var(--danger) !important; stroke-dasharray: 1.5 4; }
.edge.verdict-mixed { stroke: var(--gold) !important; }

/* ===== Panel additions ===== */
.panel .back-link {
  background: none; border: none; color: var(--accent); cursor: pointer;
  padding: 0; margin: 0 0 8px; font-size: 12.5px;
}
.panel .pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.panel .pill-row .edge-kind-pill { margin-bottom: 8px; }
.panel .kind-def { font-size: 12px; color: var(--mute); margin: 0 0 14px; }
.panel .node-stats { font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 14px; }
.panel .muted { color: var(--mute); }
.panel .small, .panel section.block p.small { font-size: 12px; }
.panel .quote { font-style: italic; }
.panel .warn-line { color: var(--warn); font-size: 12.5px; margin-top: 8px; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.chip-btn {
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--rule);
  background: var(--panel-2); color: var(--ink-soft); font-size: 12px; cursor: pointer; text-decoration: none;
}
.chip-btn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.conn-kind { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; margin: 10px 0 4px; }
.conn-kind:first-of-type { margin-top: 0; }
.connection-list .conn.hidden-kind { opacity: 0.45; }
.connection-list .conn .arrow { width: 12px; text-align: center; }
.connection-list .conn .gene { min-width: 0; margin-right: auto; }
.tag { font-size: 10px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--rule); color: var(--mute); }
.tag.tent { border-style: dotted; color: var(--gold); border-color: var(--gold); }
.verdict { font-weight: 700; font-size: 12px; width: 16px; text-align: center; }
.v-confirmed .verdict, .verdict.v-confirmed { color: var(--ok); }
.verdict.v-rejected { color: var(--danger); }
.verdict.v-contested { color: var(--gold); }
.verdict.v-uncertain { color: var(--mute); }
.verdict-block.v-confirmed { border-color: var(--ok); }
.verdict-block.v-rejected { border-color: var(--danger); }
.verdict-block.v-contested { border-color: var(--gold); }

.evidence .ev-part + .ev-part { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--rule); }
.evidence ul.refs { padding-left: 16px; margin: 4px 0 0; }
.evidence ul.refs li { font-size: 12.5px; margin: 4px 0; line-height: 1.4; }
.panel section.block .evidence ul.refs li a,
.evidence ul.refs li a { font-family: inherit; color: var(--ink); }
.evidence ul.refs li a:hover { color: var(--accent); }
.evidence .ref-meta { color: var(--mute); font-size: 11px; }
.evidence .ref-missing { color: var(--danger); }
.evidence .gene-links { margin-top: 10px; }
.evidence .gene-links a { font-family: 'SF Mono', Menlo, monospace; font-size: 11.5px; }

.triage-bar {
  display: flex; align-items: center; gap: 6px;
  margin: 0 0 12px; padding: 6px 8px;
  background: var(--accent-soft); border-radius: 8px;
  font-size: 12px; color: var(--ink);
}
.triage-bar span { flex: 1; }
.triage-bar button {
  background: var(--panel); border: 1px solid var(--rule); color: var(--ink-soft);
  border-radius: 6px; padding: 3px 9px; font-size: 11.5px; cursor: pointer;
}
.triage-bar button:hover { border-color: var(--accent); color: var(--accent); }

.path-route h3 { color: var(--ink-soft) !important; }
.path-steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.path-steps li {
  position: relative; padding: 8px 8px 8px 30px; margin: 0 0 4px;
  border: 1px solid var(--rule); border-radius: 8px; background: var(--panel-2);
  cursor: pointer; counter-increment: step;
}
.path-steps li::before {
  content: counter(step); position: absolute; left: 8px; top: 9px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  font-size: 10px; font-weight: 700; display: grid; place-items: center;
}
.path-steps li:hover { border-color: var(--accent); }
.path-steps .step-head { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 12.5px; }
.path-steps .gene { font-family: 'SF Mono', Menlo, monospace; font-weight: 700; }
.path-steps .dir { font-weight: 700; }
.path-steps .kind { font-size: 10.5px; margin-left: auto; }
.path-steps .step-note { font-size: 12px; color: var(--ink-soft); margin-top: 3px; line-height: 1.45; }

@media (max-width: 760px) {
  .panel { width: 100%; }
  header.site .row { gap: 6px; padding: 8px 10px; }
  .disease-filters { overflow-x: auto; flex-wrap: nowrap; }
  .gene-search input, .gene-search input:focus { width: 150px; }
  nav.site-nav { display: none; }
  .left-stack { width: auto; }
}
