/* VesTRA z0.1 Molecule Explorer: light reading style.
   Loads after vestra.css (tokens --vx-*, top bar, footer, buttons, pills).
   The older variable names below are remapped onto the VesTRA tokens so the
   admin panel, which shares this file, follows the same palette. */

:root {
  --navy: #000000;
  --navy-2: #17171d;
  --page-bg: var(--vx-paper, #f5f3ee);
  --surface: var(--vx-surface, #ffffff);
  --border: var(--vx-line, #e2dfd6);
  --border-soft: var(--vx-line-soft, #ece9e1);
  --border-strong: #cfcbc0;

  --ink: var(--vx-ink, #17161a);
  --ink-2: var(--vx-muted, #5d5b64);
  --ink-3: var(--vx-faint, #8a8791);

  --accent: var(--vx-ink, #17161a);
  --accent-ink: var(--vx-blood-ink, #136c96);
  --accent-soft: var(--vx-blood-tint, #e3f3fb);

  --amber: var(--vx-tissue-ink, #a24f0e);
  --amber-soft: var(--vx-tissue-tint, #fdf0e3);
  --amber-strong: var(--vx-tissue-ink, #a24f0e);

  --yellow-soft: #fbf3dc;
  --yellow-ink: #7a5600;

  --green: #1f7a4d;
  --green-soft: #e3f3ea;
  --green-ink: #1c6340;

  --red-soft: #fbe7e4;
  --red-ink: #a12b1c;

  --purple: var(--vx-other-ink, #5b4bd6);
  --purple-soft: var(--vx-other-tint, #eeebff);

  --radius: var(--vx-radius, 16px);
  --radius-sm: 10px;
  --shadow: none;

  --font: var(--vx-font, "Geist", system-ui, -apple-system, "Segoe UI", sans-serif);
  --font-mono: var(--vx-mono, "Geist Mono", ui-monospace, Menlo, monospace);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-ink); }

.icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon.lg { width: 20px; height: 20px; }
.icon.sm { width: 14px; height: 14px; }

button { font-family: inherit; font-size: inherit; cursor: pointer; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--ink-3); }
.muted.light { font-weight: 400; color: var(--ink-2); }
.soft { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { text-align: right; }

code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
}
code.wrap { white-space: pre-wrap; word-break: break-all; font-size: 11.5px; }

:focus-visible { outline: 2px solid var(--vx-blood-accent, #2a9fd6); outline-offset: 2px; }

/* ---------------------------------------------------------------- shell */

.shell { min-height: 100vh; display: flex; flex-direction: column; }
.vx-explorer .vx-top { position: sticky; top: 0; }
.vx-explorer .vx-foot { margin-top: auto; }
.vx-nav-admin { color: #f3d27a !important; }

.content {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
  max-width: var(--vx-max, 1280px);
  margin: 0 auto;
  padding: 28px var(--vx-gutter, 32px) 72px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.vx-explorer .card { margin: 0; }
.tab-panel { display: none; }
.tab-panel.active { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* ---------------------------------------------------------------- old top bar (admin panel) */

.topbar { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
.topbar-inner { display: flex; align-items: center; gap: 1.75rem; padding: 0.7rem 1.25rem; max-width: 1600px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; background: #fff; color: #000; display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 1rem; flex-shrink: 0; }
.brand-text b { display: flex; align-items: center; gap: 0.35rem; font-size: 0.95rem; font-weight: 600; }
.brand-text span { display: block; font-size: 0.68rem; color: #8f8f9a; margin-top: 1px; }
.brand-text .brand-ver { display: inline-block; margin: 0; font-family: var(--font-mono); font-size: 0.6rem; color: #a4a4b0;
  border: 1px solid #2f2f3a; border-radius: 4px; padding: 0.1rem 0.35rem; }
.topnav { display: flex; align-items: center; gap: 1.4rem; flex-shrink: 0; }
.topnav a { color: #c6c6d0; font-size: 0.85rem; font-weight: 500; padding: 0.3rem 0; border-bottom: 2px solid transparent; }
.topnav a.active { color: #fff; border-bottom-color: #fff; }
.topnav a:hover { color: #fff; }
.topnav a.topnav-admin { color: #f3d27a; }

/* ---------------------------------------------------------------- buttons (shared with admin) */

.btn {
  display: inline-flex; align-items: center; gap: 0.4rem; min-height: 36px;
  border-radius: 999px; padding: 0 14px; font-size: 13px; font-weight: 600;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink);
}
.btn:hover { background: var(--page-bg); color: var(--ink); }
.btn.icon-only { padding: 0 10px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.primary .icon { color: #fff; }
.btn.primary:disabled { opacity: 0.6; cursor: default; }
.link-btn { border: 0; background: none; padding: 0; color: var(--ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.link-btn:hover { color: var(--accent-ink); }

/* ---------------------------------------------------------------- headings and crumbs */

.crumbs { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.crumbs a { color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); }
.crumbs span { color: var(--ink); }
.subtitle { color: var(--ink-2); font-size: 15px; margin: 0; }
.placeholder-panel {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 40px 24px; text-align: center; color: var(--ink-2); font-size: 15px;
}
.placeholder-panel a { font-weight: 600; text-decoration: underline; text-decoration-color: var(--border-strong); }
.placeholder-panel.loading { opacity: 0.8; }

/* ---------------------------------------------------------------- search results */

.sx-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 32px; }
.sx-title { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sx-title h1 { margin: 0; font-size: 44px; line-height: 1.02; font-weight: 600; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.sx-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.sx-filter {
  min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.sx-filter:hover { border-color: var(--ink); }
.sx-filter.on { background: var(--ink); border-color: var(--ink); color: #fff; }

.sx-body { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.sx-results {
  flex: 999 1 640px; min-width: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.sx-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 14px; }
.sx-table th {
  text-align: left; padding: 12px 10px; background: #faf9f6; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); white-space: nowrap;
}
.sx-table th.num, .sx-table td.num { text-align: right; }
.sx-table th:first-child, .sx-table td:first-child { padding-left: 16px; }
.sx-table th:last-child, .sx-table td:last-child { padding-right: 16px; }
.sx-table td { padding: 13px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.sx-table tbody tr:hover { background: #fcfbf8; }
.sx-table tr.residual td { color: var(--ink-2); }
.sx-mol { display: flex; flex-direction: column; gap: 2px; }
.sx-mol b { font-size: 15px; font-weight: 600; color: var(--ink); }
.sx-mol:hover b { color: var(--accent-ink); }
.sx-sub { font-size: 13px; color: var(--ink-2); }
.sx-sub .mono { font-size: 12px; }
.sx-foot { padding: 12px 16px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px;
  font-size: 13px; color: var(--ink-2); }
.sx-more { display: inline-flex; gap: 10px; align-items: center; }
.sx-empty { padding: 36px 20px; text-align: center; color: var(--ink-2); }
.table-note { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 12px 16px; color: var(--ink-2);
  font-size: 13px; line-height: 1.5; border-bottom: 1px solid var(--border-soft); }
.table-note .icon { flex: none; margin-top: 3px; }

.sx-map { flex: 1 1 320px; max-width: 420px; display: flex; flex-direction: column; border-radius: var(--radius);
  overflow: hidden; background: #000; color: var(--vx-text-dark, #ececf2); }
.sx-map-field { position: relative; height: 260px; overflow: hidden; }
.sx-map-field i { position: absolute; border-radius: 50%; }
.sx-dot, .sx-ping { position: absolute; left: 50%; top: 46%; border-radius: 50%; }
.sx-dot { width: 12px; height: 12px; margin: -6px 0 0 -6px; background: var(--vx-both, #fff1cf); box-shadow: 0 0 18px var(--vx-both, #fff1cf); }
.sx-ping { width: 30px; height: 30px; margin: -15px 0 0 -15px; border: 1px solid var(--vx-both, #fff1cf); animation: sx-ping 2.2s ease-out infinite; }
@keyframes sx-ping { 0% { transform: scale(0.7); opacity: 0.9; } 100% { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sx-ping { animation: none; } }
.sx-map-body { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--vx-line-dark, #1f1f27); }
.sx-map-body .vx-label { color: #8f8f9a; }
.sx-map-body h2 { margin: 0; font-size: 18px; font-weight: 600; color: #fff; letter-spacing: -0.01em; }
.sx-map-body p { margin: 0; font-size: 14px; line-height: 1.55; color: #a4a4b0; }
.sx-map-body .vx-btn { align-self: flex-start; }
.sx-map-body .vx-btn:hover { color: #000; background: #ececf2; }

.stage-dots { display: inline-flex; gap: 4px; vertical-align: middle; }
.stage-dots i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #e7e4dc; }
.stage-dots i.on { background: linear-gradient(135deg, var(--vx-tissue-accent, #ef8f3c), var(--vx-blood-accent, #2a9fd6)); }

/* ---------------------------------------------------------------- molecule header */

.mx-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px; }
.mx-title { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.mx-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; min-width: 0; }
.mx-name h1 { margin: 0; font-size: 56px; line-height: 1; font-weight: 600; letter-spacing: -0.04em; overflow-wrap: anywhere; }
.mx-fullname { font-size: 20px; color: var(--ink-2); }
.mx-pills { display: flex; flex-wrap: wrap; gap: 8px; font-family: var(--font-mono); font-size: 12px; }
.mx-pills .vx-pill { font-family: var(--font-mono); font-size: 12px; font-weight: 400; padding: 6px 10px; }
.chip { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; color: var(--ink); }
.side-other { background: var(--vx-other-tint, #eeebff); color: var(--vx-other-ink, #5b4bd6); }
.title-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.title-actions .vx-btn { font-weight: 500; }
.title-actions .vx-btn-outline:hover { border-color: var(--ink); color: var(--ink); }
.title-actions .vx-btn-ink:hover { color: #fff; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: thin; }
.tab {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; font-size: 14px;
  color: var(--ink-2); white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }

/* ---------------------------------------------------------------- assessment */

.mx-assess { display: flex; flex-direction: column; gap: 12px; }
.sec-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 20px; }
.sec-head h2 { margin: 0; font-size: 18px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.sec-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.as-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }
.as-card {
  padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 8px; min-width: 0;
}
.as-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 6px; }
.as-value { font-size: 32px; line-height: 1.05; font-weight: 600; letter-spacing: -0.03em; }
.as-desc { font-size: 14px; line-height: 1.5; color: var(--ink-2); }
.as-card ul { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.6; color: var(--ink-2); }
.as-card.tone-green { background: var(--vx-concordant-bg, #0f2a1f); border-color: var(--vx-concordant-bg, #0f2a1f); color: #e6fff2; }
.as-card.tone-green .as-label { color: var(--vx-concordant-label, #8fe3b6); }
.as-card.tone-green .as-desc { color: var(--vx-concordant-text, #c4ecd6); }
.as-card.tone-amber { background: var(--vx-tissue-tint, #fdf0e3); border-color: #f4d9bc; }
.as-card.tone-amber .as-value, .as-card.tone-amber .as-label { color: var(--vx-tissue-ink, #a24f0e); }
.as-card.tone-red { background: var(--red-soft); border-color: #f2cbc4; }
.as-card.tone-red .as-value, .as-card.tone-red .as-label { color: var(--red-ink); }
.as-card.tone-blue { background: var(--vx-blood-tint, #e3f3fb); border-color: #c4e3f3; }
.as-card.tone-blue .as-value, .as-card.tone-blue .as-label { color: var(--vx-blood-ink, #136c96); }
.as-card.tone-grey { background: #f0eee8; border-color: #e4e1d8; }
.as-card.tone-grey .as-value { color: var(--ink); }

/* info dot with a hover / focus tooltip */
.info-dot { color: inherit; opacity: 0.7; cursor: help; position: relative; display: inline-flex; align-items: center; outline: none;
  font-family: var(--font); text-transform: none; letter-spacing: 0; }
.info-dot:hover, .info-dot:focus { opacity: 1; }
.info-dot .tip {
  display: none; position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  width: min(300px, 80vw); padding: 10px 12px; border-radius: 10px; background: var(--ink); color: #fff;
  font-size: 12.5px; font-weight: 400; line-height: 1.45; text-align: left; white-space: normal; z-index: 30;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
.info-dot:hover .tip, .info-dot:focus .tip, .info-dot:focus-within .tip { display: block; }

/* ---------------------------------------------------------------- tissue / blood evidence */

.ev-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); gap: 14px; }
.ev-card {
  padding: 20px 22px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.ev-card.tissue { border-top: 4px solid var(--vx-tissue-accent, #ef8f3c); }
.ev-card.blood { border-top: 4px solid var(--vx-blood-accent, #2a9fd6); }
.ev-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.ev-dl { margin: 0; display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; font-size: 14px; }
.ev-dl.wide { grid-template-columns: 170px minmax(0, 1fr); }
.ev-dl dt { color: var(--ink-2); }
.ev-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.ev-dl dd a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
.ev-dl .pill { max-width: 100%; }
.why { margin-top: auto; padding: 12px 14px; border-radius: 12px; background: var(--page-bg); font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.why b { color: var(--ink); }

.wm { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: 14px; }
.wm-group { flex: 1 1 280px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.wm-group .vx-label { margin-right: 4px; }
.wm-tissue { flex-grow: 2; }
.wm-tissue .vx-label { color: var(--vx-tissue-ink, #a24f0e); }
.wm-blood .vx-label { color: var(--vx-blood-ink, #136c96); }
.wm-other .vx-label { color: var(--vx-other-ink, #5b4bd6); }
.wm-pill { padding: 5px 10px; border-radius: 999px; }
.wm-tissue .wm-pill { background: var(--vx-tissue-tint, #fdf0e3); }
.wm-blood .wm-pill { background: var(--vx-blood-tint, #e3f3fb); }
.wm-other .wm-pill { background: var(--vx-other-tint, #eeebff); }

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 1.25rem; min-width: 0;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 20px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head-left { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.005em; }
.vx-explorer .card-head-left > .icon { display: none; }
.card-head-meta { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); }
.card-note { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; margin: 14px 0 0; }
.section-note { font-size: 13px; color: var(--ink-2); margin: 0; }
.more-link { align-self: flex-start; display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; font-size: 14px; color: var(--ink); }
.more-link:hover { color: var(--accent-ink); }
.card > .more-link { margin-top: 6px; margin-bottom: -10px; }
.link-row { display: flex; flex-wrap: wrap; gap: 0 22px; margin-bottom: -10px; }
.empty-inline { padding: 14px 16px; color: var(--ink-2); font-size: 14px; background: var(--page-bg); border-radius: 12px; margin: 0; }
.empty-cell { text-align: center; color: var(--ink-3); padding: 22px 0; }
.why-text { font-size: 14.5px; color: var(--ink-2); line-height: 1.65; margin: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 14px; }

.info-box {
  display: flex; gap: 10px; background: var(--page-bg); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; color: var(--ink-2); line-height: 1.55; margin: 0 0 12px;
}
.info-box .icon { color: var(--ink-2); margin-top: 2px; }
.info-box.warn { background: var(--vx-tissue-tint, #fdf0e3); color: var(--vx-tissue-ink, #a24f0e); margin: 10px 0 0; }
.info-box.warn .icon { color: inherit; }

/* pills */
.pill {
  display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; vertical-align: middle;
  background: #f0eee8; color: var(--ink-2);
}
.pill.green { background: var(--green-soft); color: var(--green-ink); }
.pill.grey { background: #f0eee8; color: var(--ink-2); }
.pill.yellow { background: var(--vx-tissue-tint, #fdf0e3); color: var(--vx-tissue-ink, #a24f0e); }
.pill.red { background: var(--red-soft); color: var(--red-ink); }
.badge { display: inline-flex; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); }
.up-value { color: var(--vx-tissue-ink, #a24f0e); font-weight: 600; white-space: nowrap; }
.down-value { color: var(--vx-blood-ink, #136c96); font-weight: 600; white-space: nowrap; }

/* ---------------------------------------------------------------- seven stages */

.stage-bars { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.stage-bars li { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.stage-bars .bar { height: 8px; border-radius: 4px; background: var(--vx-stage-off, #ece9e1); }
.stage-bars li.on .bar { background: var(--vx-stage-on, linear-gradient(90deg, #ef8f3c, #2a9fd6)); }
.stage-bars .n { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); }
.stage-bars .t { font-size: 13px; line-height: 1.3; color: var(--ink-3); }
.stage-bars li.on .t { color: var(--ink); font-weight: 600; }
.stage-bars .st { font-size: 11.5px; line-height: 1.35; color: var(--ink-3); }

.stage-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 14px 0;
  border-bottom: 1px solid var(--border-soft); }
.stage-row:last-of-type { border-bottom: none; }
.stage-disc { width: 34px; height: 34px; border-radius: 999px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px; background: var(--vx-stage-off, #ece9e1); color: var(--ink-2); }
.stage-row.reached .stage-disc { background: linear-gradient(135deg, var(--vx-tissue-accent, #ef8f3c), var(--vx-blood-accent, #2a9fd6)); color: #fff; }
.stage-row > div > b { font-weight: 600; }
.stage-sub { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.stage-evidence { font-size: 13px; color: var(--ink-2); margin-top: 4px; overflow-wrap: anywhere; }
.stage-evidence .mono { font-size: 12px; color: var(--ink); }
.stage-verdicts { margin-top: 10px; border-left: 2px solid var(--border); padding-left: 12px; }
.stage-verdicts-head { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin-bottom: 6px; }
.verdict { margin: 6px 0 8px; font-size: 13px; }
.verdict-drug { font-weight: 600; margin-left: 4px; }
.verdict-src { color: var(--ink-3); margin-left: 4px; font-size: 12px; }
.verdict-text { color: var(--ink-2); margin-top: 3px; line-height: 1.45; }
.stage-row .pill { margin-top: 6px; }

/* ---------------------------------------------------------------- evidence table */

.filters { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.field label { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); margin-bottom: 6px; }
.field select {
  width: 100%; min-height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13px;
}
.reset-btn { min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap; }
.reset-btn:hover { border-color: var(--ink); }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
table.evidence { width: 100%; min-width: 860px; border-collapse: collapse; font-size: 13px; }
table.evidence th {
  text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--ink); font-family: var(--font-mono); font-size: 11px;
  font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
}
table.evidence td { padding: 11px 10px; border-bottom: 1px solid var(--border-soft); color: var(--ink); vertical-align: top; }
table.evidence th:first-child, table.evidence td:first-child { padding-left: 0; }
table.evidence th:last-child, table.evidence td:last-child { padding-right: 0; }
table.evidence th.num, table.evidence td.num { text-align: right; white-space: nowrap; }
table.evidence td.study { min-width: 180px; max-width: 260px; }
table.evidence td.study .muted { white-space: nowrap; }
table.evidence td.study a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 2px; }
table.evidence td.cmp { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.evidence td.file { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.evidence .pill { max-width: 150px; }
table.evidence th, table.evidence td { padding-left: 8px; padding-right: 8px; }
table.evidence.plain { min-width: 720px; }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 10px; color: var(--ink-2); font-family: var(--font-mono); font-size: 12px; }
.page-btn { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--ink); }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-btn:not(:disabled):hover { border-color: var(--ink); }

/* ---------------------------------------------------------------- key/value tables, tools, publications */

.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv tr { border-bottom: 1px solid var(--border-soft); }
.kv tr:last-child { border-bottom: none; }
.kv th, .kv td { text-align: left; padding: 9px 0; font-weight: 400; vertical-align: top; }
.kv th { color: var(--ink-2); width: 45%; padding-right: 16px; }
.kv td { color: var(--ink); text-align: right; overflow-wrap: anywhere; }
.kv td a { display: inline-flex; align-items: center; gap: 4px; }

.tool-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-soft); font-size: 14px; }
.tool-name { font-weight: 600; }
.tool-version { color: var(--ink-3); font-family: var(--font-mono); font-size: 11.5px; margin-left: 8px; }
.tool-desc { color: var(--ink-2); font-size: 13px; overflow-wrap: anywhere; }
.tool-link { color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap; }
.tool-more { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }

.lit-item { display: flex; flex-direction: column; gap: 4px; padding: 0 0 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-soft); }
.lit-item:last-of-type { border-bottom: none; margin-bottom: 0; }
.lit-cite { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.lit-title { font-size: 16px; font-weight: 600; line-height: 1.35; color: var(--ink); }
a.lit-title:hover { color: var(--accent-ink); }
.lit-doi { font-family: var(--font-mono); font-size: 11px; color: var(--ink-2); overflow-wrap: anywhere; }

.plain-list { margin: 0; padding: 0 0 0 18px; font-size: 14px; color: var(--ink); columns: 2 260px; column-gap: 32px; }
.plain-list li { margin-bottom: 4px; break-inside: avoid; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-row .chip { font-family: var(--font); font-size: 12.5px; }

/* ---------------------------------------------------------------- static pages */

.page { display: flex; flex-direction: column; gap: 18px; }
.page-head { display: flex; flex-direction: column; gap: 8px; }
.page-title { margin: 0; font-size: 56px; line-height: 1; font-weight: 600; letter-spacing: -0.04em; }
.page-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.page-tabs a { min-height: 40px; display: inline-flex; align-items: center; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; }
.page-tabs a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.page-intro { color: var(--ink-2); font-size: 17px; line-height: 1.6; max-width: 70ch; margin: 0; }
.page-card { padding: 24px 26px; }
.page-card .card-head-left { font-size: 20px; letter-spacing: -0.02em; }
.page .card p { max-width: 76ch; line-height: 1.65; margin: 0; }
.page .card p + p { margin-top: 12px; }
.page .card ol, .page .card ul { padding-left: 20px; line-height: 1.6; max-width: 76ch; margin: 0 0 12px; }
.page .card li + li { margin-top: 6px; }
.page table.kv th { width: 45%; }

/* ---------------------------------------------------------------- feedback widget */

.fb-button {
  position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border: none; border-radius: 999px; background: var(--ink); color: #fff;
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.fb-button:hover { background: #000; }
.fb-button .icon { color: #fff; }
.fb-panel {
  position: fixed; right: 20px; bottom: 76px; z-index: 61; width: min(380px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}
.fb-panel[hidden] { display: none; }
.fb-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.fb-head b { font-weight: 600; }
.fb-close { border: none; background: none; cursor: pointer; color: var(--ink-2); padding: 6px; line-height: 0; border-radius: 999px; }
.fb-close:hover { color: var(--ink); background: var(--page-bg); }
.fb-body { padding: 8px 18px 18px; }
.fb-label { display: block; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); margin: 12px 0 6px; }
.fb-body select, .fb-body textarea, .fb-body input[type="email"] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--surface);
}
.fb-body textarea { resize: vertical; min-height: 96px; }
.fb-context { margin: 10px 0 0; font-size: 11.5px; color: var(--ink-3); font-family: var(--font-mono); word-break: break-all; }
.fb-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.fb-msg { font-size: 13px; color: var(--ink-2); }
.fb-msg.err { color: var(--red-ink); }
.fb-thanks { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; }
.fb-thanks .icon { color: var(--green); flex-shrink: 0; margin-top: 3px; }
.fb-thanks p { margin: 0; font-size: 14px; color: var(--ink-2); }

/* ---------------------------------------------------------------- "opening" overlay */

.searching { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.88); animation: fade-in 0.25s ease-out; }
.searching[hidden] { display: none; }
.searching-box { text-align: center; padding: 32px 40px; border-radius: var(--radius); background: #08080b; border: 1px solid #1f1f27; }
.tube { width: 64px; height: 120px; display: block; margin: 0 auto 16px; }
.tube .glass { fill: none; stroke: #c6c6d0; stroke-width: 2.5; }
.tube .rim { stroke: #c6c6d0; stroke-width: 3; stroke-linecap: round; }
.tube .liquid { fill: var(--vx-blood, #4cc9ff); animation: fill 2.4s ease-in-out infinite; }
.tube .bubble { fill: rgba(255, 255, 255, 0.75); animation: rise 1.8s linear infinite; }
.tube .b2 { animation-delay: 0.5s; animation-duration: 2.2s; }
.tube .b3 { animation-delay: 1.1s; animation-duration: 1.6s; }
.searching-text { color: #fff; font-size: 17px; font-weight: 600; }
.searching-text b { color: var(--vx-both, #fff1cf); font-weight: 600; }
.searching-sub { margin-top: 6px; color: #8f8f9a; font-size: 14px; }
.is-searching .landing { visibility: hidden; pointer-events: none; }
@keyframes fill { 0% { transform: translateY(78px); } 50% { transform: translateY(6px); } 100% { transform: translateY(78px); } }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-70px); opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .tube .liquid, .tube .bubble { animation-duration: 6s; } }

/* ---------------------------------------------------------------- suggestions under a search box (suggest.js) */

.suggest { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; background: #fff; color: var(--ink);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22); overflow: hidden; text-align: left;
  font-family: var(--font); }
.suggest[hidden] { display: none; }
.suggest-row { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr) auto; gap: 0 12px; align-items: baseline;
  padding: 10px 14px; cursor: pointer; font-size: 14px; }
.suggest-row + .suggest-row { border-top: 1px solid var(--border-soft); }
.suggest-row.active { background: var(--page-bg); }
.suggest-row .s-name { font-weight: 600; color: var(--ink); white-space: nowrap; }
.suggest-row .s-sub { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-row .s-meta { color: var(--ink-3); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.suggest-empty { padding: 10px 14px; color: var(--ink-2); font-size: 13.5px; }

/* ---------------------------------------------------------------- narrow screens */

@media (max-width: 1080px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage-bars { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 16px; }
}
@media (max-width: 760px) {
  .sx-map { max-width: none; }
  .sx-title h1 { font-size: 34px; }
  .mx-name h1, .page-title { font-size: 40px; }
  .mx-fullname { font-size: 17px; }
}
@media (max-width: 640px) {
  .content { padding-top: 20px; gap: 18px; }
  .card, .ev-card, .as-card { padding: 16px; }
  .as-value { font-size: 26px; }
  .ev-dl, .ev-dl.wide { grid-template-columns: 104px minmax(0, 1fr); gap: 8px 10px; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stage-bars { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .stage-bars li { display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 8px; row-gap: 4px; }
  .stage-bars .bar { grid-column: 1 / -1; height: 6px; }
  .stage-bars .st { grid-column: 2; }
  .stage-row { grid-template-columns: 34px minmax(0, 1fr); }
  .stage-row > .pill { grid-column: 2; justify-self: start; margin-top: 0; }
  .title-actions { width: 100%; }
  .title-actions .vx-btn { flex: 1 1 0; }
  .sx-filter { min-height: 38px; padding: 0 13px; }
  .kv th { width: 50%; }
  .fb-button { right: 12px; bottom: 12px; padding: 0 14px; }
  .fb-button span { display: none; }
  .fb-panel { right: 16px; bottom: 66px; }
  .suggest-row { grid-template-columns: minmax(0, 1fr) auto; }
  .suggest-row .s-sub { display: none; }
  .page-card { padding: 18px; }
  .page-intro { font-size: 15.5px; }
}

/* ---------------------------------------------------------------- print report
   The app renders one tab at a time; the report renders all of them into
   #print-report and this block swaps which of the two the printer sees. */
#print-report { display: none; }

@media print {
  body.printing .shell,
  body.printing .fb-button,
  body.printing .fb-panel,
  body.printing .searching { display: none !important; }
  body.printing #print-report { display: block; }

  html, body { background: #fff; color: #17161a; font-size: 10pt; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  /* cover */
  .pr-cover { padding: 0 0 0.9rem; border-bottom: 2px solid #17161a; margin-bottom: 1rem; }
  .pr-brand { font-family: var(--font-mono); font-size: 8pt; letter-spacing: 0.08em; text-transform: uppercase; color: #5d5b64; margin-bottom: 0.5rem; }
  .pr-cover h1 { font-size: 30pt; font-weight: 600; letter-spacing: -0.03em; margin: 0 0 0.15rem; }
  .pr-sub { margin: 0 0 0.8rem; color: #5d5b64; font-size: 10.5pt; }
  .pr-facts { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.45rem; margin: 0.4rem 0 0.7rem; }
  .pr-fact { border: 1px solid #e2dfd6; border-radius: 8px; padding: 0.45rem 0.55rem; background: #f5f3ee; break-inside: avoid; }
  .pr-fact-label { font-family: var(--font-mono); font-size: 6.5pt; text-transform: uppercase; letter-spacing: 0.06em; color: #5d5b64; }
  .pr-fact-value { font-size: 12pt; font-weight: 600; color: #17161a; margin-top: 0.1rem; }
  .pr-fact-sub { font-size: 7.5pt; color: #5d5b64; margin-top: 0.1rem; }
  .pr-meta { font-family: var(--font-mono); font-size: 7.5pt; color: #5d5b64; margin: 0; word-break: break-all; }
  .pr-foot { margin-top: 1rem; font-size: 8pt; color: #5d5b64; }

  /* sections */
  .pr-section { margin: 0 0 1.1rem; }
  .pr-section.pr-break { break-before: page; }
  .pr-section h2 { font-size: 14pt; font-weight: 600; color: #17161a; margin: 0.6rem 0 0.55rem; padding-bottom: 0.25rem;
    border-bottom: 1px solid #e2dfd6; break-after: avoid; display: flex; align-items: baseline; gap: 0.5rem; }
  .pr-num { display: inline-block; min-width: 1.4em; font-family: var(--font-mono); font-size: 8pt; color: #fff; background: #17161a;
    border-radius: 4px; text-align: center; padding: 0.05rem 0.25rem; }
  .pr-note { font-size: 9pt; color: #5d5b64; margin: 0 0 0.5rem; }
  .pr-tools .grid-2 { grid-template-columns: 1fr 1fr; }

  /* cards flatten to plain blocks */
  .card, .ev-card, .as-card { box-shadow: none; border-radius: 8px; break-inside: avoid; margin: 0 0 0.6rem; padding: 0.6rem 0.75rem; }
  .card:has(table.evidence), .card:has(table.kv), .card:has(.stage-row), .card:has(.lit-item) { break-inside: auto; }
  .card-head { margin-bottom: 0.4rem; break-after: avoid; break-inside: avoid; }
  .card-head-left { font-size: 10.5pt; }
  .card-head-meta { font-size: 7.5pt; }
  .card-note, .stage-sub, .stage-evidence, .as-desc, .verdict-text, .why { font-size: 8.5pt; }
  .mx-assess { margin-bottom: 0.6rem; }
  .pr-section .sec-head h2 { display: none; }
  .sec-head h2 { font-size: 11pt; }
  .as-grid, .ev-pair, .grid-2, .grid-3 { display: grid; gap: 0.6rem; }
  .as-grid, .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .ev-pair, .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .as-value { font-size: 15pt; }
  .as-card ul { font-size: 8.5pt; }
  .ev-dl { grid-template-columns: 26% 1fr; font-size: 8.5pt; gap: 3px 8px; }
  .stage-bars { grid-template-columns: repeat(7, 1fr); gap: 0.35rem; }
  .stage-bars .t { font-size: 8pt; }
  .stage-bars .st { font-size: 7pt; }
  .stage-row { break-inside: avoid; padding: 0.4rem 0; }
  .lit-item, .stage-bars li { break-inside: avoid; }
  .lit-title { font-size: 10pt; }
  .wm { font-size: 8.5pt; gap: 0.4rem 1rem; }
  .wm-pill { padding: 1px 6px; }

  /* tables: full width, repeated headers, no row splits */
  .table-wrap { overflow: visible; }
  table { width: 100%; font-size: 8.5pt; border-collapse: collapse; }
  table.evidence { min-width: 0; table-layout: auto; font-size: 8pt; }
  table.evidence th, table.evidence td { padding: 0.28rem 0.3rem; vertical-align: top; white-space: normal; overflow-wrap: break-word; }
  table.evidence td.cmp, table.evidence td.study { max-width: none; min-width: 0; white-space: normal; }
  table.evidence td a { white-space: normal; }
  /* Study, Comparison, Sample, Platform, Detected, Direction, Effect, P value */
  table.evidence:not(.plain) th:nth-child(1), table.evidence:not(.plain) td:nth-child(1) { width: 22%; }
  table.evidence:not(.plain) th:nth-child(2), table.evidence:not(.plain) td:nth-child(2) { width: 18%; }
  table.evidence:not(.plain) th:nth-child(3), table.evidence:not(.plain) td:nth-child(3) { width: 13%; }
  table.evidence:not(.plain) th:nth-child(4), table.evidence:not(.plain) td:nth-child(4) { width: 13%; }
  table.evidence:not(.plain) th:nth-child(5), table.evidence:not(.plain) td:nth-child(5) { width: 13%; }
  table.evidence:not(.plain) th:nth-child(6), table.evidence:not(.plain) td:nth-child(6) { width: 7%; }
  table.evidence:not(.plain) th:nth-child(7), table.evidence:not(.plain) td:nth-child(7) { width: 7%; }
  table.evidence:not(.plain) th:nth-child(8), table.evidence:not(.plain) td:nth-child(8) { width: 7%; }
  table.evidence .pill { display: block; width: 100%; padding: 0.1rem 0.3rem; line-height: 1.25; font-size: 7pt; white-space: normal; }
  table.kv th { width: 34%; font-size: 8.5pt; }
  table.kv td { font-size: 8.5pt; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
  .pill { max-width: none; white-space: normal; font-size: 7.5pt; }
  code, code.wrap { font-size: 7.5pt; white-space: pre-wrap; word-break: break-all; }

  /* never in a report */
  .more-link, .link-row, .pagination, .filters, #evidence-filters, .info-dot, .title-actions, .tabs, .crumbs,
  .tool-link { display: none !important; }
  a { color: #17161a; text-decoration: none; }

  @page { size: A4; margin: 14mm 12mm 16mm; }
}
