/* MedLens — clinical instrument aesthetic
   Palette: deep ink header, clinical teal primary, amber timeline nodes,
   IBM Plex Mono for every identifier / count (the "data readout" texture). */

:root {
  --ink:      #0e1b2a;
  --ink-2:    #16293c;
  --paper:    #f3f6f8;
  --surface:  #ffffff;
  --teal:     #0e7c86;
  --teal-deep:#0a5a62;
  --teal-wash:#e5f1f2;
  --amber:    #dc8a2b;
  --amber-wash:#fbf0dd;
  --slate:    #5b6b7a;
  --slate-2:  #8494a1;
  --line:     #dde4ea;
  --line-2:   #eef2f5;
  --good:     #2b9a66;
  --warn:     #b9822a;
  --bad:      #c0453b;
  --shadow:   0 1px 2px rgba(14,27,42,.06), 0 8px 24px rgba(14,27,42,.06);
  --radius:   14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace; }

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

/* ---- Header / instrument panel ---------------------------------------- */

.masthead {
  background: linear-gradient(160deg, var(--ink) 0%, var(--ink-2) 100%);
  color: #eaf1f5;
  padding: 30px 22px 34px;
  border-bottom: 3px solid var(--teal);
}
.masthead-inner { max-width: 1120px; margin: 0 auto; }

.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700; font-size: 22px; letter-spacing: -.01em;
}
.brand .lens {
  width: 30px; height: 30px; border-radius: 8px;
  background: radial-gradient(circle at 32% 30%, #4bd0d9 0%, var(--teal) 45%, var(--teal-deep) 100%);
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.18);
  position: relative; flex: none;
}
.brand .lens::after {
  content: ''; position: absolute; inset: 9px;
  border: 2px solid rgba(255,255,255,.55); border-radius: 50%;
}
.brand small {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 400; font-size: 11px; color: #7fb9bf;
  letter-spacing: .18em; text-transform: uppercase; margin-left: 2px;
}
.tagline { color: #9db4c0; margin: 8px 0 22px; font-size: 14px; }

/* ---- Search bar -------------------------------------------------------- */

.searchbar { display: flex; gap: 10px; max-width: 720px; }
.searchbar .field {
  flex: 1; display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 0 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
}
.searchbar .field svg { flex: none; color: var(--slate-2); }
.searchbar input {
  flex: 1; border: 0; outline: 0; background: transparent;
  padding: 15px 0; font-size: 16px; color: var(--ink);
  font-family: inherit;
}
.btn-search {
  border: 0; border-radius: 12px; cursor: pointer;
  background: var(--teal); color: #fff;
  font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 15px;
  padding: 0 24px; transition: background .15s ease;
}
.btn-search:hover { background: var(--teal-deep); }
.btn-search:disabled { opacity: .55; cursor: default; }

.examples { margin-top: 14px; font-size: 13px; color: #8fa8b4; }
.examples button {
  border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.05);
  color: #cfe0e7; border-radius: 999px; padding: 4px 12px; margin: 0 6px 6px 0;
  cursor: pointer; font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  transition: background .15s ease;
}
.examples button:hover { background: rgba(255,255,255,.14); }

/* ---- Main column ------------------------------------------------------- */

main { max-width: 1120px; margin: 0 auto; padding: 26px 22px 80px; }

/* ---- Layout: main column + news sidebar -------------------------------- */

.layout { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: start; }
.layout.has-news { grid-template-columns: minmax(0, 1fr) 320px; }
.main-col { min-width: 0; }
.side-col { display: none; }
.layout.has-news .side-col { display: block; }
.side-col .panel { position: sticky; top: 16px; margin-bottom: 0; }
.side-col .news-list { max-height: calc(100vh - 160px); overflow-y: auto; }

@media (max-width: 900px) {
  .layout.has-news { grid-template-columns: 1fr; }
  .side-col .panel { position: static; }
  .side-col .news-list { max-height: none; }
}

/* ---- Fetch console ----------------------------------------------------- */

.console {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px; margin-bottom: 26px;
}
.console-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 14px;
}
.console-head h2 {
  margin: 0; font-family: 'Space Grotesk', sans-serif; font-size: 15px;
  font-weight: 600; letter-spacing: .01em;
}
.console-head .pct { font-size: 20px; font-weight: 600; color: var(--teal-deep); }

.progress-track {
  height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden;
}
.progress-fill {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--teal) 0%, #35a7b0 100%);
  border-radius: 999px; transition: width .35s cubic-bezier(.4,0,.2,1);
}
.progress-fill.indeterminate {
  width: 35% !important; transition: none;
  animation: indet 1.2s ease-in-out infinite;
}
@keyframes indet {
  0%   { margin-left: -35%; }
  100% { margin-left: 100%; }
}

.gauges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.gauge {
  display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 11px; font-size: 13px; background: #fbfcfd;
  transition: border-color .2s ease, background .2s ease;
}
.gauge .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--slate-2); flex: none;
}
.gauge .label { font-weight: 500; }
.gauge .meta {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--slate);
}
.gauge.running { border-color: var(--teal); background: var(--teal-wash); }
.gauge.running .dot { background: var(--teal); animation: pulse 1s infinite ease-in-out; }
.gauge.ok       .dot { background: var(--good); }
.gauge.empty    .dot { background: var(--slate-2); }
.gauge.skipped  { opacity: .6; }
.gauge.skipped  .dot { background: var(--slate-2); }
.gauge.error    .dot { background: var(--bad); }
.gauge.error    { border-color: #eab8b3; background: #fcf1f0; }

@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.5); opacity: .5; } }

/* ---- Overview strip ---------------------------------------------------- */

.overview {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 22px;
}
.stat { background: var(--surface); padding: 16px 18px; }
.stat .k { font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .1em;
           text-transform: uppercase; color: var(--slate); }
.stat .v { font-family: 'Space Grotesk', sans-serif; font-size: 26px; font-weight: 600;
           margin-top: 4px; letter-spacing: -.01em; }
.stat .v small { font-size: 14px; color: var(--slate); font-weight: 500; }

/* mini per-year sparkbars */
.sparks { display: flex; align-items: flex-end; gap: 3px; height: 34px; margin-top: 6px; }
.sparks .bar { flex: 1; background: var(--teal); border-radius: 2px 2px 0 0; min-height: 3px; opacity: .8; }
.sparks .bar:last-child { background: var(--amber); }

/* ---- Synthesis panel --------------------------------------------------- */

.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 24px; margin-bottom: 22px;
}
.panel > h2 {
  margin: 0 0 4px; font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 600;
}
.panel .sub { color: var(--slate); font-size: 13px; margin-bottom: 14px; }
.panel.synthesis { border-left: 3px solid var(--teal); }

/* ---- About / explainer panel ------------------------------------------ */

.panel.explainer { border-left: 3px solid var(--ink); }
.explain-list { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.explain-list dt {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--slate); padding-top: 3px; white-space: nowrap;
}
.explain-list dd { margin: 0; font-size: 14.5px; color: #2a3742; }
.explain-list .prov { color: var(--slate-2); font-size: 12px; }
@media (max-width: 560px) {
  .explain-list { grid-template-columns: 1fr; gap: 2px 0; }
  .explain-list dt { padding-top: 8px; }
}

/* high-impact tag + filter checkbox */
.tag.hi { border-color: var(--bad); color: var(--bad); background: #fbeeed; font-weight: 600; }
.filters .grp.chk { cursor: pointer; user-select: none; }
.filters .grp.chk input { accent-color: var(--teal); }

/* ---- Validation panel -------------------------------------------------- */

.panel.validation { border-left: 3px solid var(--good); }
.v-headline {
  font-size: 12.5px; color: #245c3f; background: #e9f6ef;
  border-radius: 8px; padding: 9px 12px; margin-bottom: 14px;
}
.vbar {
  display: flex; height: 22px; border-radius: 7px; overflow: hidden;
  border: 1px solid var(--line); background: var(--line-2);
}
.vbar-seg {
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; font-weight: 600; color: #fff;
  min-width: 0;
}
.vbar-seg.tier-high     { background: var(--good); }
.vbar-seg.tier-moderate { background: var(--teal); }
.vbar-seg.tier-low      { background: var(--amber); }
.vbar-seg.tier-flagged  { background: var(--bad); }

.vchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.vchip {
  font-size: 12px; border-radius: 999px; padding: 3px 11px; border: 1px solid var(--line);
  color: var(--slate);
}
.vchip b { font-family: 'IBM Plex Mono', monospace; }
.vchip.tier-high     { border-color: #a9dcc0; color: #1d7a4d; }
.vchip.tier-moderate { border-color: #a8d6da; color: var(--teal-deep); }
.vchip.tier-low      { border-color: #edcd9a; color: #97640f; }
.vchip.tier-flagged  { border-color: #e7b2ac; color: var(--bad); }
.v-notes { margin: 12px 0 0; font-size: 12.5px; color: var(--slate); }

/* per-card confidence badge + flags */
.tag.conf { font-weight: 600; }
.tag.conf.tier-high     { border-color: var(--good); color: #1d7a4d; background: #eaf7f0; }
.tag.conf.tier-moderate { border-color: var(--teal); color: var(--teal-deep); background: var(--teal-wash); }
.tag.conf.tier-low      { border-color: var(--amber); color: #97640f; background: var(--amber-wash); }
.tag.conf.tier-flagged  { border-color: var(--bad); color: var(--bad); background: #fbeeed; }
.card-flags {
  margin-top: 9px; font-size: 12px; color: #9a5a15;
  background: #fdf6ea; border: 1px solid #f0e0c2; border-radius: 8px; padding: 6px 10px;
}
.card-flags .warn-ico { color: var(--warn); }

/* ---- News pane --------------------------------------------------------- */

.panel.news-pane { border-left: 3px solid var(--slate-2); }
.news-list { list-style: none; margin: 0; padding: 0; }
.news-item { padding: 11px 0; border-top: 1px solid var(--line-2); }
.news-item:first-child { border-top: 0; }
.news-item > a { font-family: 'Space Grotesk', sans-serif; font-size: 15px; font-weight: 600; }
.news-meta { font-size: 11px; color: var(--slate); margin-top: 3px; }
.news-sum { margin: 6px 0 0; font-size: 13px; color: #45535f; }

/* ---- Mind map ---------------------------------------------------------- */

.btn-mindmap { border-color: var(--teal); color: var(--teal-deep); font-weight: 600; }
.btn-mindmap:hover { background: var(--teal-wash); }

.mm-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: #0b1622; display: flex; flex-direction: column;
}
.mm-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; background: #12212f; border-bottom: 1px solid #24384b; color: #e8f1f5;
}
.mm-title { font-family: 'Space Grotesk', sans-serif; font-weight: 600; font-size: 15px; }
.mm-title #mm-term { color: #4bd0d9; text-transform: capitalize; }
.mm-count { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #7fb9bf; }
.mm-spacer { flex: 1; }
.mm-btn {
  border: 1px solid #2c4459; background: #1a2c3d; color: #cfe0e7;
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: background .15s ease;
}
.mm-btn:hover { background: #24394d; }
.mm-btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.mm-btn.primary:hover { background: var(--teal-deep); }

.mm-stage { flex: 1; overflow: hidden; position: relative; cursor: grab; }
.mm-stage:active { cursor: grabbing; }
.mm-stage svg { width: 100%; height: 100%; display: block; }
.mm-node { cursor: pointer; transition: opacity .12s ease; }
.mm-node:hover { opacity: .85; }
.mm-node.off { opacity: .12; }

.mm-link { transition: stroke-width .12s ease, opacity .12s ease; }
.mm-link.on { stroke-width: 2.4 !important; opacity: 1; }
.mm-link.off { opacity: .05; }

.mm-btn.active { background: var(--teal); border-color: var(--teal); color: #fff; }

.mm-line { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.mm-sep { width: 1px; height: 14px; background: #2c4459; display: inline-block; margin: 0 4px; }

.mm-legend {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 10px 16px; background: #12212f; border-top: 1px solid #24384b;
  color: #a9c2cd; font-size: 12px;
}
.mm-leg { display: flex; align-items: center; gap: 6px; }
.mm-dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.mm-note { color: #6f8794; font-family: 'IBM Plex Mono', monospace; font-size: 11px; }

.mm-tip {
  position: absolute; max-width: 260px; pointer-events: none;
  background: rgba(8,18,28,.96); border: 1px solid #2c4459; border-radius: 8px;
  padding: 9px 11px; color: #e8f1f5; font-size: 12px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.mm-tip strong { display: block; margin-bottom: 4px; font-size: 12.5px; }
.mm-tip span { display: block; color: #9db4c0; }

/* details drawer */
.mm-detail {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 340px; max-width: calc(100% - 24px);
  background: rgba(12,24,36,.97); border: 1px solid #2c4459; border-radius: 12px;
  color: #e8f1f5; overflow-y: auto; box-shadow: 0 12px 40px rgba(0,0,0,.5); z-index: 5;
}
.mm-d-head { padding: 16px 16px 12px; border-bottom: 1px solid #24384b; position: relative; }
.mm-d-ref { font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: #4bd0d9; }
.mm-d-close {
  position: absolute; top: 12px; right: 12px; border: 1px solid #2c4459; background: #1a2c3d;
  color: #cfe0e7; border-radius: 7px; width: 28px; height: 28px; cursor: pointer; font-size: 13px;
}
.mm-d-close:hover { background: #24394d; }
.mm-d-head h3 { margin: 6px 0 6px; font-family: 'Space Grotesk', sans-serif; font-size: 15px; line-height: 1.35; padding-right: 30px; }
.mm-d-meta { font-size: 12px; color: #9db4c0; }
.mm-d-open { display: inline-block; margin-top: 10px; font-size: 12.5px; color: #4bd0d9; }
.mm-d-sub {
  padding: 12px 16px 6px; font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  text-transform: uppercase; letter-spacing: .08em; color: #7fb9bf;
}
.mm-d-list { list-style: none; margin: 0; padding: 0 8px 12px; }
.mm-d-item {
  display: flex; gap: 10px; padding: 9px 8px; border-radius: 8px; cursor: pointer;
  border-top: 1px solid #1c2e40;
}
.mm-d-item:hover { background: #17293a; }
.mm-d-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; }
.mm-d-dot.cls-author { background: #c586d6; }
.mm-d-dot.cls-journal { background: #6aa9c9; }
.mm-d-dot.cls-topic { background: #3fae9e; }
.mm-d-title { font-size: 13px; line-height: 1.35; }
.mm-d-rel { font-size: 12px; color: #9db4c0; margin-top: 2px; }
.mm-d-rel b { color: #cfe0e7; font-weight: 600; }
.mm-d-empty { padding: 14px 16px; color: #9db4c0; font-size: 13px; }

@media (max-width: 560px) {
  .mm-bar { flex-wrap: wrap; }
  .mm-count { width: 100%; order: 3; }
}

.console-sub { margin: 10px 0 0; font-size: 12.5px; color: var(--slate); }

.ev-summary {
  font-size: 12.5px; color: var(--teal-deep); background: var(--teal-wash);
  border-radius: 8px; padding: 9px 12px; margin-bottom: 16px;
}
.synth-theme { margin-top: 16px; }
.synth-theme:first-of-type { margin-top: 6px; }
.synth-theme-h {
  margin: 0 0 4px; font-family: 'Space Grotesk', sans-serif; font-size: 13px;
  font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--slate);
  padding-bottom: 5px; border-bottom: 1px solid var(--line-2);
}
.stat-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber); margin-right: 7px; vertical-align: middle;
}

.synth-point { display: flex; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line-2); }
.synth-point:first-of-type { border-top: 0; }
.synth-point .ref {
  flex: none; width: 26px; height: 22px; border-radius: 6px;
  background: var(--teal-wash); color: var(--teal-deep);
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.synth-point p { margin: 0; font-size: 14.5px; }
.synth-point .cite { color: var(--slate); font-size: 12px; }

/* ---- Drug safety snapshot --------------------------------------------- */

.panel.snapshot { border-left: 3px solid var(--amber); }
.snap-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.snap-label dt {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; color: var(--amber); margin-top: 12px;
}
.snap-label dd { margin: 3px 0 0; font-size: 13.5px; color: #33424f; }
.snap-events { list-style: none; padding: 0; margin: 0; }
.snap-events li { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; font-size: 13px; }
.snap-events .name { flex: none; width: 150px; }
.snap-events .track { flex: 1; height: 8px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.snap-events .bar { height: 100%; background: var(--amber); border-radius: 999px; }
.snap-events .n { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--slate); width: 64px; text-align: right; }
.disclaimer {
  margin-top: 14px; font-size: 12px; color: var(--slate);
  background: var(--amber-wash); border-radius: 8px; padding: 10px 12px;
}

/* ---- Filters ----------------------------------------------------------- */

.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  margin-bottom: 18px;
}
.filters .grp { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--slate); }
.filters select, .filters input[type="search"] {
  font-family: inherit; font-size: 13px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.filters .spacer { flex: 1; }
.btn-ghost {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  font-family: inherit; transition: border-color .15s ease;
}
.btn-ghost:hover { border-color: var(--teal); }

/* ---- Timeline (signature) --------------------------------------------- */

.timeline { position: relative; padding-left: 46px; }
.timeline::before {
  content: ''; position: absolute; left: 15px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(180deg, var(--teal) 0%, var(--line) 100%);
}
.year-block { position: relative; margin-bottom: 12px; }
.year-node {
  position: absolute; left: -46px; top: 0;
  display: flex; align-items: center; gap: 10px;
}
.year-node .bead {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--amber); border: 3px solid var(--paper);
  box-shadow: 0 0 0 2px var(--amber); margin-left: 8px;
}
.year-node .yr {
  font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 18px;
}
.year-node .cnt { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--slate); }
.year-items { padding-top: 30px; display: flex; flex-direction: column; gap: 12px; }

/* ---- Paper card -------------------------------------------------------- */

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; box-shadow: var(--shadow);
  transition: border-color .15s ease, transform .1s ease;
}
.card:hover { border-color: var(--teal); }
.card-top { display: flex; gap: 10px; align-items: flex-start; }
.card .refnum {
  flex: none; font-family: 'IBM Plex Mono', monospace; font-size: 12px;
  color: var(--slate); padding-top: 2px; min-width: 30px;
}
.card h3 {
  margin: 0; font-size: 16px; font-weight: 600; line-height: 1.4;
  font-family: 'Space Grotesk', sans-serif; letter-spacing: -.005em;
}
.card h3 a { color: var(--ink); }
.card h3 a:hover { color: var(--teal-deep); }
.card .authors { color: var(--slate); font-size: 13px; margin: 5px 0 0; }
.card .venue { font-style: italic; }

.card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; align-items: center; }
.tag {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px;
  border-radius: 6px; padding: 3px 8px; border: 1px solid var(--line);
  color: var(--slate); background: #fafbfc;
}
.tag.ev { border-color: var(--teal); color: var(--teal-deep); background: var(--teal-wash); }
.tag.cite { border-color: var(--amber); color: #9a6416; background: var(--amber-wash); }
.tag.src { }
.tag.type-preprint { border-color: #c9a24b; color: #8a6410; background: #fbf3df; }
.tag.type-news { border-color: #b7c3cc; }
.tag.type-trial { border-color: #6aa9c9; color: #245c78; background: #e8f2f7; }

/* print header — hidden until printing */
#print-head { display: none; }

.card .abstract {
  margin: 12px 0 0; font-size: 13.5px; color: #3a4854; line-height: 1.6;
  max-height: 0; overflow: hidden; transition: max-height .25s ease;
}
.card.open .abstract { max-height: 800px; }
.card .toggle {
  margin-top: 8px; font-size: 12px; color: var(--teal-deep); cursor: pointer;
  font-family: 'IBM Plex Mono', monospace; user-select: none;
}
.card .toggle:hover { text-decoration: underline; }

/* ---- States ------------------------------------------------------------ */

.empty-state, .error-state {
  text-align: center; padding: 60px 20px; color: var(--slate);
}
.empty-state h2 { font-family: 'Space Grotesk', sans-serif; color: var(--ink); }
.hidden { display: none !important; }

.footnote { margin-top: 40px; font-size: 12px; color: var(--slate-2); text-align: center; }

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 680px) {
  .snap-grid { grid-template-columns: 1fr; }
  .searchbar { flex-direction: column; }
  .btn-search { padding: 13px; }
  .timeline { padding-left: 34px; }
  .year-node { left: -34px; }
  .snap-events .name { width: 110px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---- Print: a decorated, paginated literature survey ------------------- */

@media print {
  @page { margin: 15mm 14mm 18mm; }

  html, body { background: #fff !important; color: #12202e; font-size: 10.5pt; }

  /* force the accents to actually print in Chrome/Edge */
  #print-head, .v-headline, .vbar, .vbar-seg, .tag, .ev-summary,
  .year-node .bead, .panel, .tag.conf, .synth-theme-h {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }

  /* hide interactive chrome */
  .masthead, .console, .filters, .idle, .empty-state,
  .examples, .searchbar, .toggle, .footnote, .mm-overlay { display: none !important; }

  main { max-width: 100%; padding: 0; margin: 0; }
  .layout { display: block !important; }
  .side-col { display: block !important; }

  /* ---- decorated cover header ---- */
  #print-head {
    display: block !important; position: relative;
    padding: 16px 20px 16px; margin-bottom: 18px;
    border: 1px solid #0e7c86; border-top: 6px solid #0e7c86;
    border-radius: 6px;
  }
  #print-head::after {
    content: ''; position: absolute; left: 20px; right: 20px; bottom: 10px;
    height: 2px; background: #dc8a2b;
  }
  .ph-brand {
    font-family: 'IBM Plex Mono', monospace; font-size: 8pt;
    letter-spacing: .28em; text-transform: uppercase; color: #0a5a62;
  }
  .ph-title {
    font-family: 'Space Grotesk', sans-serif; font-size: 23pt; line-height: 1.1;
    margin: 6px 0 8px; text-transform: capitalize; color: #0e1b2a;
  }
  .ph-meta { font-size: 8.8pt; color: #40515f; padding-bottom: 10px; }
  .ph-ev {
    display: inline-block; font-size: 9pt; font-weight: 600; color: #0a5a62;
    background: #e5f1f2; border-radius: 5px; padding: 5px 10px; margin-top: 4px;
  }

  /* ---- section headings with accent underline ---- */
  .panel > h2 {
    font-size: 13pt; padding-bottom: 5px; margin-bottom: 8px;
    border-bottom: 2px solid #0e7c86;
  }
  .panel .sub { color: #5b6b7a; font-size: 8.6pt; }

  /* flatten panels; keep the coloured left rule as an accent */
  .panel {
    box-shadow: none !important; background: #fff !important;
    border: 1px solid #cfd8de; border-left-width: 3px;
    page-break-inside: avoid; margin-bottom: 12px; padding: 14px 16px;
  }
  .panel.explainer  { border-left-color: #0e1b2a; }
  .panel.validation { border-left-color: #2b9a66; }
  .panel.synthesis  { border-left-color: #0e7c86; }
  .panel.snapshot   { border-left-color: #dc8a2b; }
  .panel.news-pane  { border-left-color: #8494a1; }

  /* overview stat grid */
  .overview { page-break-inside: avoid; border: 1px solid #cfd8de; }
  .stat { background: #fff !important; }
  .stat .v { font-size: 14pt; }

  /* validation bar keeps its colours */
  .vbar { border: 1px solid #cfd8de; }
  .v-headline { background: #e9f6ef !important; color: #245c3f !important; }

  /* tags: keep evidence/high-impact/confidence colours, mute the rest */
  .tag { border: 1px solid #b9c4cc; color: #2a3742; background: #f5f7f8 !important; font-size: 8pt; }
  .tag.ev   { border-color: #0e7c86; color: #0a5a62; background: #e5f1f2 !important; }
  .tag.hi   { border-color: #c0453b; color: #c0453b; background: #fbeeed !important; }
  .tag.conf.tier-high     { border-color: #2b9a66; color: #1d7a4d; background: #eaf7f0 !important; }
  .tag.conf.tier-moderate { border-color: #0e7c86; color: #0a5a62; background: #e5f1f2 !important; }
  .tag.conf.tier-low      { border-color: #dc8a2b; color: #97640f; background: #fbf0dd !important; }
  .tag.conf.tier-flagged  { border-color: #c0453b; color: #c0453b; background: #fbeeed !important; }
  .card-flags { background: #fdf6ea !important; border: 1px solid #f0e0c2; }

  /* the chronological survey gets its own titled section */
  #results::before {
    content: 'Chronological literature survey';
    display: block; font-family: 'Space Grotesk', sans-serif; font-size: 14pt; font-weight: 600;
    margin: 6px 0 12px; padding-bottom: 5px; border-bottom: 2px solid #0e1b2a; color: #0e1b2a;
    page-break-after: avoid;
  }

  /* timeline + cards */
  .timeline::before { background: #b9c4cc !important; }
  .year-node .bead { background: #dc8a2b !important; box-shadow: 0 0 0 2px #dc8a2b !important; }
  .year-node .yr { font-size: 13pt; }
  .year-block, .card, .synth-point, .synth-theme { page-break-inside: avoid; }
  .card {
    box-shadow: none !important; border: 1px solid #d4dce2; border-radius: 6px;
    margin-bottom: 8px;
  }
  .card h3 { font-size: 11.5pt; }
  .card h3 a { color: #0e1b2a; text-decoration: none; }
  .card .abstract { max-height: none !important; overflow: visible !important; font-size: 8.8pt; color: #33424f; }

  /* show link targets so a paper copy stays traceable */
  .card h3 a[href]::after, .news-item > a[href]::after {
    content: ' (' attr(href) ')'; font-size: 7pt;
    font-family: 'IBM Plex Mono', monospace; color: #6a7a86; word-break: break-all;
  }

  /* printed footer line on the survey */
  #results::after {
    content: 'Generated by MedLens · aggregated open scholarly metadata & FDA data · verify each source before clinical use.';
    display: block; margin-top: 16px; padding-top: 8px; border-top: 1px solid #cfd8de;
    font-size: 7.5pt; color: #6a7a86; text-align: center;
  }
}
