/* App shell and dashboard views. Layered over styles.css (the synopsis card), same tokens:
   slate paper, deep teal ink, five-step indigo pipeline ramp, marigold for "yours".
   New ramps: a single-hue teal sequential ramp for evidence heatmaps (h1..h5), and a diverging
   coral / neutral / green ramp for prioritisation factors (-1..1). */
:root {
  --nav-w: 232px;
  --nav-bg: #0f2e34;
  --nav-ink: #cfe0df;
  --nav-dim: #86a3a5;
  --nav-hi: #ffffff;
  --nav-active: rgba(255, 255, 255, .08);
  --h0: #eef2f1; --h1: #d2e7e3; --h2: #a3cfc7; --h3: #5fa99d; --h4: #2f7f74; --h5: #135a52;
  --h-ink-dark: #ffffff;
  --pw2: #e7836a; --pw1: #f5c6b8; --p0: #e6ebea; --pg1: #b9dfcb; --pg2: #4fa77c;
  --open: #2a7353; --open-wash: #e3f1ea; --crowd: #8a4a9e; --crowd-wash: #f1e6f5;
  --shadow-1: 0 1px 2px rgba(18, 52, 59, .06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nav-bg: #0a1a1d; --nav-ink: #c6d8d8; --nav-dim: #7f9a9c; --nav-active: rgba(255, 255, 255, .07);
    --h0: #1b3034; --h1: #1d4a45; --h2: #23675f; --h3: #2f8a7d; --h4: #55b3a3; --h5: #9fe0d3; --h-ink-dark: #0b1d20;
    --pw2: #d9694f; --pw1: #6b3a2f; --p0: #263c41; --pg1: #295a43; --pg2: #5fbf8f;
    --open: #6cc39a; --open-wash: #183b2c; --crowd: #c99ad8; --crowd-wash: #3a2443;
  }
}
:root[data-theme="dark"] {
  --nav-bg: #0a1a1d; --nav-ink: #c6d8d8; --nav-dim: #7f9a9c; --nav-active: rgba(255, 255, 255, .07);
  --h0: #1b3034; --h1: #1d4a45; --h2: #23675f; --h3: #2f8a7d; --h4: #55b3a3; --h5: #9fe0d3; --h-ink-dark: #0b1d20;
  --pw2: #d9694f; --pw1: #6b3a2f; --p0: #263c41; --pg1: #295a43; --pg2: #5fbf8f;
  --open: #6cc39a; --open-wash: #183b2c; --crowd: #c99ad8; --crowd-wash: #3a2443;
}

html, body { overflow-x: hidden; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--sheet); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); min-height: 100vh;
  background: linear-gradient(to right, var(--nav-bg) var(--nav-w), transparent var(--nav-w)); }
.nav {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--nav-bg); color: var(--nav-ink);
  display: flex; flex-direction: column; padding: 20px 14px 18px; z-index: 30;
}
.nav .brand { display: flex; align-items: center; gap: 12px; color: var(--nav-hi); text-decoration: none; font: 700 16px/1.05 var(--display); padding: 4px 8px 22px; letter-spacing: -0.01em; }
.nav .brand .mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: conic-gradient(from 210deg, #e8a33d 0 22%, #8090d4 22% 58%, #4fa77c 58% 100%);
  box-shadow: inset 0 0 0 6px var(--nav-bg);
}
.nav nav { display: flex; flex-direction: column; gap: 2px; }
.nav nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; text-decoration: none;
  font: 500 14px/1.2 var(--text); color: var(--nav-ink);
}
.nav nav a svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.nav nav a:hover { background: var(--nav-active); color: var(--nav-hi); }
.nav nav a[aria-current] { background: var(--nav-active); color: var(--nav-hi); font-weight: 600; box-shadow: inset 3px 0 0 #e8a33d; }
.nav nav a[aria-current] svg { opacity: 1; }
.nav .badge { margin-left: auto; font: 700 11px/1 var(--text); background: #e8a33d; color: #3b2604; border-radius: 999px; padding: 3px 7px; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 12px 8px; }
.nav-foot { margin-top: auto; padding: 16px 10px 0; font-size: 11px; line-height: 1.6; color: var(--nav-dim); }
/* Collapse / expand (app.js initRail): the expanded nav or a 68px icon rail, remembered per browser. Desktop only;
   below 900px the nav is the off-canvas drawer. */
.nav-rail-btn { align-self: flex-end; width: 32px; height: 32px; margin: -8px -4px 4px 0; border: 0; border-radius: 8px;
  background: transparent; color: var(--nav-dim); cursor: pointer; display: grid; place-items: center; flex: none; }
.nav-rail-btn:hover { background: var(--nav-active); color: var(--nav-hi); }
.nav-rail-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@media (min-width: 901px) {
  .shell.rail { --nav-w: 68px; }
  .shell.rail .nav { padding: 20px 10px 18px; }
  .shell.rail .nav-rail-btn { align-self: center; margin: -8px 0 8px; }
  .shell.rail .nav-rail-btn .chev { transform: scaleX(-1); transform-origin: 11.5px 10px; }
  .shell.rail .nav .brand { padding: 4px 0 18px; justify-content: center; }
  .shell.rail .nav .brand span:not(.mark) { display: none; }
  .shell.rail .nav nav a { font-size: 0; gap: 0; justify-content: center; padding: 10px 0; position: relative; }
  .shell.rail .nav nav a svg { width: 20px; height: 20px; }
  .shell.rail .nav .badge { position: absolute; top: 3px; right: 5px; font-size: 9px; padding: 2px 4px; margin: 0; }
  .shell.rail .nav-sep { margin: 10px 4px; }
  .shell.rail .nav-foot { display: none; }
}
@media (max-width: 900px) { .nav-rail-btn { display: none; } }
.frame { min-width: 0; display: flex; flex-direction: column; }
.bar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 12px 32px; background: color-mix(in srgb, var(--paper) 86%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-2);
}
.bar .search { flex: 1; max-width: 680px; position: relative; }
.bar .search input { padding: 10px 44px 10px 16px; background: var(--sheet); box-shadow: var(--shadow-1); }
.bar .search kbd { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 11px var(--text); color: var(--ink-3); border: 1px solid var(--rule); border-radius: 5px; padding: 1px 6px; }
.bar .who { margin-left: auto; display: flex; align-items: center; gap: 10px; text-align: left; }
.who .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--text); background: var(--yours); color: #3b2604; }
.who .who-t { display: flex; flex-direction: column; line-height: 1.2; }
.who .who-t small { color: var(--ink-3); font-size: 12px; }
.who .who-pub { font-size: 13px; color: var(--ink-2); padding: 5px 10px; border: 1px dashed var(--rule); border-radius: 999px; }
.menu { display: none; width: 38px; height: 38px; border: 1px solid var(--rule); background: var(--sheet); border-radius: 10px; cursor: pointer; padding: 0; position: relative; }
.menu span, .menu span::before, .menu span::after { position: absolute; left: 10px; right: 10px; height: 2px; background: var(--ink); border-radius: 2px; content: ""; }
.menu span { top: 18px; } .menu span::before { top: -6px; left: 0; right: 0; } .menu span::after { top: 6px; left: 0; right: 0; }
.scrim { position: fixed; inset: 0; background: rgba(5, 20, 23, .45); z-index: 25; }
main { max-width: 1280px; width: 100%; padding: 28px 32px 56px; }
.foot { max-width: 1280px; padding: 0 32px 40px; }

/* ---------------------------------------------------------------- buttons, fields */
.btn {
  display: inline-flex; align-items: center; gap: 6px; font: 600 13px/1 var(--text); padding: 9px 14px; border-radius: 999px;
  background: var(--ink); color: var(--sheet); border: 1px solid var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--ink-3); filter: none; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: default; }
.linkbtn { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.field input, .field select, .field textarea, select {
  font: 500 14px var(--text); color: var(--ink); background: var(--sheet); border: 1px solid var(--rule); border-radius: 9px; padding: 8px 10px; width: 100%;
}
.field textarea { resize: vertical; line-height: 1.45; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--ink); width: 15px; height: 15px; }
.tag.good { background: var(--good-wash); color: var(--good); }
.dim { color: var(--ink-3); }
.note { font-size: 12px; color: var(--ink-3); margin: 10px 0 0; max-width: 90ch; }
code { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--paper); padding: 1px 5px; border-radius: 4px; }
.x { border: 0; background: none; color: var(--ink-3); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.x:hover { color: var(--warn); background: var(--warn-wash); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--ink-2); padding: 32px 0; font-size: 14px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule); border-top-color: var(--ink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

/* ---------------------------------------------------------------- page heads, KPIs, layout */
.eyebrow { font: 600 12px var(--text); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 8px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(26px, 3.4vw, 40px); line-height: 1.06; max-width: 24ch; }
.page-head .sub { color: var(--ink-2); margin: 8px 0 0; max-width: 70ch; }
.page-head .ids { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }
.head-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.head-tools .field { min-width: 220px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 4px; }
.kpi { background: var(--sheet); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi b { font: 700 26px/1.1 var(--display); letter-spacing: -0.01em; }
.kpi span { font-size: 12px; color: var(--ink-3); }
.kpi small { font-size: 11px; color: var(--ink-3); }
.kpi.warn b { color: var(--warn); }
.kpi.yours { box-shadow: inset 3px 0 0 var(--yours), var(--shadow); }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 24px; }
.two > .section, .two > div > .section { margin-top: 28px; }
.section.slim { padding: 18px 28px; }
.section.slim > header { margin-bottom: 0; }
.sub-h { font: 600 14px var(--text); margin: 0 0 10px; }
/* Scrollers are positioned so absolutely positioned descendants (.sr labels, rotated headers) stay inside them
   instead of widening the page. */
.tbl-wrap { overflow-x: auto; position: relative; }
.heat-wrap, .matrix-wrap { position: relative; }
.tbl small { display: block; font-size: 12px; color: var(--ink-3); font-weight: 400; }
.th-sort { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; gap: 4px; }
.th-sort i { font-style: normal; color: var(--ink); }
.filters { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin-bottom: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
ul.chips li a { display: inline-block; padding: 4px 10px; border-radius: 999px; background: var(--paper); font-size: 13px; text-decoration: none; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* ---------------------------------------------------------------- workspace tabs */
/* Folder tabs: each tab is a raised tag; the selected one joins the panel below it.
   The baseline is an inset shadow on the strip, so the selected tab's own background covers it
   without negative margins (which overflow-x scrolling would clip). */
.tabs { display: flex; align-items: flex-end; gap: 6px; margin: 26px 0 0; padding: 0 14px;
  box-shadow: inset 0 -1px 0 var(--rule); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; position: relative; padding: 9px 20px 9px; font: 600 14px var(--text); color: var(--ink-2);
  text-decoration: none; white-space: nowrap; background: var(--rule-2); border: 1px solid var(--rule); border-bottom: 0;
  border-radius: 10px 10px 0 0; transition: background .12s, color .12s; }
.tabs a:hover { color: var(--ink); background: color-mix(in srgb, var(--rule-2) 55%, var(--paper)); }
.tabs a:focus-visible { outline: 2px solid var(--ink); outline-offset: -4px; }
.tabs a[aria-selected="true"] { color: var(--ink); background: var(--paper); padding-top: 12px; z-index: 1;
  box-shadow: 0 -3px 8px rgba(18, 52, 59, .07); }
.tabs a[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--paper); }
.tabs + #tab-body { border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 14px 14px; padding: 22px 22px 6px; }
@media (max-width: 640px) {
  .tabs { padding: 0 6px; gap: 4px; }
  .tabs.more-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
  .tabs.more-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 28px), transparent); }
  .tabs.more-l.more-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, transparent, #000 28px, #000 calc(100% - 28px), transparent); }
  .tabs a { padding: 8px 13px; font-size: 13px; }
  .tabs a[aria-selected="true"] { padding-top: 10px; }
  .tabs + #tab-body { padding: 14px 10px 4px; border-radius: 0 0 10px 10px; }
}

/* ---------------------------------------------------------------- evidence heatmap */
.heat-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 64px 0 4px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 13px; min-width: 100%; }
.heat th { font-weight: 600; text-align: left; }
.heat th.dis { min-width: 220px; max-width: 320px; padding: 6px 10px 6px 0; vertical-align: middle; }
.heat th.dis a { text-decoration: none; }
.heat th.dis a:hover { text-decoration: underline; }
.heat th.dis small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; }
.heat thead th, .heat tr:first-child th { vertical-align: bottom; }
.heat .hcol, .heat .pcol { height: 128px; width: 34px; min-width: 34px; padding: 0 0 6px; position: relative; }
.heat .hcol span, .heat .pcol span { position: absolute; left: 50%; bottom: 8px; transform-origin: 0 50%; transform: rotate(-60deg); white-space: nowrap; font: 500 12px var(--text); color: var(--ink-2); }
.heat .pcol span { color: var(--ink); font-weight: 600; }
.heat .hcol.off span { text-decoration: line-through; color: var(--ink-3); }
.heat td.num { text-align: right; padding: 0 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.heat td.num small { display: block; font-size: 11px; }
.heat td.num small.up { color: var(--good); } .heat td.num small.down { color: var(--warn); }
.heat td.hc { width: 34px; height: 30px; border-radius: 4px; background: var(--h0); position: relative; }
.heat td.hc:focus-visible { outline-offset: 0; }
.heat td.hc.h1 { background: var(--h1); } .heat td.hc.h2 { background: var(--h2); } .heat td.hc.h3 { background: var(--h3); }
.heat td.hc.h4 { background: var(--h4); } .heat td.hc.h5 { background: var(--h5); }
.heat td.hc.off { background-image: repeating-linear-gradient(135deg, transparent 0 3px, rgba(255, 255, 255, .6) 3px 5px); opacity: .55; }
.heat td.pc { text-align: center; padding: 0 6px; white-space: nowrap; }
.heat tr.mine th.dis { box-shadow: inset 3px 0 0 var(--yours); padding-left: 8px; }
.pubdot { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; border-radius: 999px; font: 700 11px var(--text); background: var(--stage-1); color: var(--ink); }
.pubdot.s3, .pubdot.s4 { background: var(--stage-4); color: var(--on-s4); }
.pubdot.s2 { background: var(--stage-2); color: var(--on-s2); }
.ws-flag { display: inline-block; font: 700 11px var(--text); color: var(--open); background: var(--open-wash); padding: 2px 8px; border-radius: 999px; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; font-size: 12px; color: var(--ink-3); }
.legend i { width: 20px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.h1 { background: var(--h1); } .legend i.h2 { background: var(--h2); } .legend i.h3 { background: var(--h3); } .legend i.h4 { background: var(--h4); } .legend i.h5 { background: var(--h5); }
.legend i.pw2 { background: var(--pw2); } .legend i.pw1 { background: var(--pw1); } .legend i.p0 { background: var(--p0); } .legend i.pg1 { background: var(--pg1); } .legend i.pg2 { background: var(--pg2); }
.legend i.good { background: var(--good-wash); box-shadow: inset 0 0 0 1px var(--good); } .legend i.warn { background: var(--warn-wash); box-shadow: inset 0 0 0 1px var(--warn); }
.legend i.open { background: var(--open-wash); box-shadow: inset 0 0 0 1px var(--open); } .legend i.crowd { background: var(--crowd-wash); box-shadow: inset 0 0 0 1px var(--crowd); }
.legend .sep { width: 14px; }
.weights { margin: 0 0 16px; border: 1px solid var(--rule-2); border-radius: 12px; padding: 0 14px; }
.weights summary { cursor: pointer; padding: 11px 0; font: 600 13px var(--text); }
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 22px; padding: 4px 0 10px; }
.wrow { display: grid; grid-template-columns: 1fr 96px 30px; gap: 10px; align-items: center; font-size: 13px; }
.wrow small { display: block; color: var(--ink-3); font-size: 11px; }
.wrow.off { opacity: .45; }
.wrow input { accent-color: var(--ink); width: 100%; }
.wrow output { font-variant-numeric: tabular-nums; text-align: right; color: var(--ink-2); }
.wfoot { display: flex; gap: 10px; padding: 6px 0 14px; }

/* ---------------------------------------------------------------- tooltip, toast */
.tip {
  position: absolute; left: 0; top: 0; z-index: 60; pointer-events: none; max-width: 280px; background: var(--ink); color: var(--sheet);
  font: 500 12px/1.45 var(--text); padding: 7px 10px; border-radius: 8px; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .4);
}
.tip b { font-weight: 700; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 70; transition: .2s;
  background: var(--ink); color: var(--sheet); padding: 10px 16px; border-radius: 999px; font: 600 13px var(--text); box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--warn); color: #fff; }

/* ---------------------------------------------------------------- prioritisation */
.matrix.prio td { min-width: 70px; font-variant-numeric: tabular-nums; }
.matrix td.pw2 { background: var(--pw2); color: #3a120a; font-weight: 600; }
.matrix td.pw1 { background: var(--pw1); color: var(--ink); }
.matrix td.p0 { background: var(--p0); color: var(--ink-2); }
.matrix td.pg1 { background: var(--pg1); color: var(--ink); }
.matrix td.pg2 { background: var(--pg2); color: #062418; font-weight: 600; }
.matrix td.pn { box-shadow: inset 0 0 0 1px var(--rule-2); color: var(--ink-3); }
.matrix th.cx, .matrix.prio td:nth-child(2) { font-weight: 700; }
.matrix .rule { font: 500 11px var(--text); color: var(--ink-3); text-align: center; min-width: 54px; }
.matrix.prio thead th.cx { color: var(--ink); }

/* ---------------------------------------------------------------- safety and context */
.mini-dial .dials { grid-template-columns: 1fr; max-width: 260px; margin: 0 0 12px; }
.placeholder { border: 1.5px dashed var(--yours); background: var(--yours-wash); border-radius: 12px; padding: 16px 18px; font-size: 14px; }
.placeholder p { margin: 6px 0 10px; color: var(--ink-2); }
.placeholder code { overflow-wrap: anywhere; }
.safety-ev { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)) !important; }
.safety-ev li { min-width: 0; overflow-wrap: anywhere; }
.div-bar { position: relative; height: 6px; background: var(--rule-2); border-radius: 3px; width: 120px; max-width: 100%; }
.div-bar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--ink-3); }
.div-bar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.div-bar i.pos { background: var(--h4); } .div-bar i.neg { background: var(--pw2); }
.bar-s { height: 6px; border-radius: 3px; background: var(--rule-2); position: relative; overflow: hidden; }
.bar-s i { position: absolute; inset: 0 auto 0 0; background: var(--h4); border-radius: 3px; }
td .bar-s { width: 90px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.dcard .bar-s i, .bars .bar-s i { background: var(--stage-3); }
.grains { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 8px 28px; }
.grains h3 { font: 600 14px var(--text); margin: 0 0 8px; }
.density .c { cursor: default; }
.track-cap { font-size: 12px; color: var(--ink-2); margin-top: 4px; }

/* ---------------------------------------------------------------- 5R and decisions */
.gov-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 22px; }
.r5-meter { display: flex; align-items: center; gap: 4px; margin-left: auto; font-size: 12px; color: var(--ink-3); }
.r5-meter i { width: 26px; height: 8px; border-radius: 3px; background: var(--rule-2); }
.r5-meter span { margin-left: 8px; }
.r5-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
@media (min-width: 1360px) { .r5-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.r5 { border: 1px solid var(--rule-2); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--sheet); }
.r5 header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.r5 h3 { font-size: 16px; }
.r5 .hint { font-size: 12px; color: var(--ink-3); margin: -4px 0 0; }
.r5-badge { font: 700 11px var(--text); padding: 3px 9px; border-radius: 999px; background: var(--rule-2); color: var(--ink-2); }
.r5 footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.r5-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.rating-strong .r5-badge, .r5-meter i.rating-strong { background: var(--pg2); color: #062418; }
.rating-moderate .r5-badge, .r5-meter i.rating-moderate { background: var(--pg1); color: var(--ink); }
.rating-weak .r5-badge, .r5-meter i.rating-weak { background: var(--pw1); color: var(--ink); }
.rating-gap .r5-badge, .r5-meter i.rating-gap { background: var(--pw2); color: #3a120a; }
.r5.rating-strong { box-shadow: inset 3px 0 0 var(--pg2); } .r5.rating-moderate { box-shadow: inset 3px 0 0 var(--pg1); }
.r5.rating-weak { box-shadow: inset 3px 0 0 var(--pw1); } .r5.rating-gap { box-shadow: inset 3px 0 0 var(--pw2); }
.dec-form { display: flex; flex-direction: column; gap: 12px; }
.sign-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sign-row select { width: auto; }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 88px; top: 6px; bottom: 6px; width: 2px; background: var(--rule-2); }
.timeline li { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 24px; padding: 6px 0 16px; position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 83px; top: 10px; width: 12px; height: 12px; border-radius: 50%; background: var(--sheet); box-shadow: inset 0 0 0 3px var(--ink-3); }
.timeline .when { font-size: 12px; color: var(--ink-3); text-align: right; padding-top: 2px; }
.timeline .what p { margin: 4px 0; color: var(--ink-2); }
.timeline .outcome { font: 700 11px var(--text); padding: 2px 8px; border-radius: 999px; margin-left: 6px; background: var(--rule-2); }
.timeline .out-go::before { box-shadow: inset 0 0 0 3px var(--good); } .timeline .out-go .outcome { background: var(--good-wash); color: var(--good); }
.timeline .out-no_go::before { box-shadow: inset 0 0 0 3px var(--warn); } .timeline .out-no_go .outcome { background: var(--warn-wash); color: var(--warn); }
.timeline .out-hold .outcome { background: var(--yours-wash); }
.timeline .out-redirect .outcome { background: var(--stage-0); }
.sig { font-size: 12px; margin-top: 6px; color: var(--good); font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.sig.unsigned { color: var(--ink-3); font-weight: 500; }
.sig select { width: auto; padding: 3px 6px; font-size: 12px; }

/* ---------------------------------------------------------------- feeds, watchlist */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 118px minmax(0, 1fr) auto; gap: 14px; padding: 11px 0; border-top: 1px solid var(--rule-2); font-size: 14px; align-items: start; }
.feed li:first-child { border-top: 0; padding-top: 2px; }
.feed .feed-k { font: 600 11px/1.3 var(--text); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); padding-top: 3px; }
.feed .feed-b .dim { font-size: 13px; margin-top: 2px; }
.feed .why { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.feed .feed-t { font-size: 12px; color: var(--ink-3); text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; white-space: nowrap; }
.feed.compact li { grid-template-columns: 82px minmax(0, 1fr) auto; padding: 8px 0; }
.feed li.al-association_score_moved .feed-k, .feed li.en-trial_start .feed-k { color: var(--stage-3); }
.feed li.al-disease_split .feed-k, .feed li.al-disease_obsoleted .feed-k { color: var(--warn); }
.feed li.en-new_disclosure .feed-k { color: var(--crowd); }
.watch-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; margin-bottom: 14px; }
.watch { list-style: none; margin: 0; padding: 0; }
.watch li { display: grid; grid-template-columns: minmax(0, 1fr) 140px auto; gap: 14px; align-items: center; padding: 10px 0; border-top: 1px solid var(--rule-2); font-size: 14px; }
.watch li:first-child { border-top: 0; }
.watch small { display: block; color: var(--ink-3); font-size: 12px; }
.x-sep { color: var(--ink-3); margin: 0 2px; }
.saved { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.saved li { display: flex; align-items: center; gap: 8px; background: var(--paper); border-radius: 999px; padding: 4px 6px 4px 14px; font-size: 13px; }
.saved small { color: var(--ink-3); }
.progs td { vertical-align: middle; }

/* ---------------------------------------------------------------- hubs, cards, bars */
.hub { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.hub-card { background: var(--sheet); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 22px; display: flex; flex-direction: column; gap: 12px; text-decoration: none; }
.hub-card h2 { font-size: 20px; }
.hub-card p { margin: 0; color: var(--ink-2); font-size: 14px; flex: 1; }
.hub-card.link:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3), var(--shadow); }
.hub-card .btn { align-self: flex-start; }
.hub-msg { margin: 0; min-height: 0; font-size: 13px; color: var(--ink-2); flex: none; }
.hub-msg:empty { display: none; }
.pick-big { display: flex; gap: 10px; max-width: 640px; margin-bottom: 8px; }
.pick-big .field { flex: 1; }
.pick-big input { padding: 12px 14px; font-size: 15px; }
.results li .r-label { font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.dcard { background: var(--sheet); border-radius: 12px; box-shadow: var(--shadow); padding: 14px 16px; text-decoration: none; display: flex; flex-direction: column; gap: 8px; }
.dcard b { font: 700 15px/1.25 var(--display); }
.dcard span { font-size: 12px; color: var(--ink-3); }
.dcard:hover { box-shadow: inset 0 0 0 1.5px var(--ink-3), var(--shadow); }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) 54px 90px; gap: 12px; align-items: center; padding: 6px 0; font-size: 14px; border-top: 1px solid var(--rule-2); }
.bars li:first-child { border-top: 0; }
.bars .num { text-align: right; font-variant-numeric: tabular-nums; }
.bars small { font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--rule); }
.dot.good { background: var(--good); box-shadow: none; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 110px; padding: 0 2px 18px; margin-bottom: 10px; border-bottom: 1px solid var(--rule-2); }
.cols .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.cols .col i { width: 100%; max-width: 34px; background: var(--h4); border-radius: 4px 4px 0 0; }
.cols .col span { position: absolute; bottom: -18px; font-size: 11px; color: var(--ink-3); }
.timeline li.rel-acquired_by::before, .timeline li.rel-merged_into::before { box-shadow: inset 0 0 0 3px var(--stage-3); }
.landing .eyebrow { margin-top: 12px; }
.landing p.note { font-size: 13px; margin-top: 24px; }

/* ---------------------------------------------------------------- triage */
.triage-in { background: var(--sheet); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.triage-in textarea { font: 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; border: 1px solid var(--rule); border-radius: 10px; padding: 10px 12px; resize: vertical; background: var(--paper); color: var(--ink); width: 100%; }
.tri-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tri-m thead th[rowspan] { text-align: left; vertical-align: bottom; position: sticky; left: 0; background: var(--sheet); z-index: 2; }
.tri-m th[scope="row"] { min-width: 150px; max-width: 220px; white-space: normal; overflow-wrap: anywhere; position: sticky; left: 0; background: var(--sheet); z-index: 1; }
.tri-m th[scope="row"] small { display: block; font-size: 11px; color: var(--ink-3); font-weight: 400; }
.tri-m th.grp-h { font: 600 11px var(--text); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); text-align: center; border-bottom: 1px solid var(--rule); }
.tri-m th.sub-th { font: 600 12px var(--text); color: var(--ink-2); white-space: nowrap; }
.tri-m td { min-width: 64px; font-size: 12px; padding: 6px; }
.tri-m td.open { background: var(--open-wash); color: var(--open); font-weight: 600; }
.tri-m td.crowd { background: var(--crowd-wash); color: var(--crowd); font-weight: 600; }
.tri-m tr.unres th { color: var(--warn); }
.tri-m td.topd { min-width: 150px; max-width: 200px; text-align: left; }
.tri-m td.topd small { display: block; font-weight: 500; color: inherit; opacity: .9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tri-m td.conflict { box-shadow: inset 0 0 0 1px var(--yours); }
.tri-m td.conflict sup { color: var(--ink-2); font-weight: 700; margin-left: 2px; }
.legend i.conflict-key { box-shadow: inset 0 0 0 1px var(--yours); background: var(--neutral-wash); }
/* horizontal scroll cue: a fade at the clipped edge, and a shadow under the frozen first column once scrolled */
.cue-wrap { position: relative; }
.cue-wrap::after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; width: 28px; pointer-events: none; opacity: 0;
  background: linear-gradient(to left, color-mix(in srgb, var(--ink) 16%, transparent), transparent); border-radius: 0 8px 8px 0; transition: opacity .15s; }
.cue-wrap.more-r::after { opacity: 1; }
.cue-wrap.more-l .tri-m th[scope="row"], .cue-wrap.more-l .tri-m thead th[rowspan] { box-shadow: 8px 0 10px -8px color-mix(in srgb, var(--ink) 35%, transparent); }
.cue-hint { font-size: 12px; color: var(--ink-3); margin: 0 0 6px; }
.cue-hint[hidden] { display: none; }

/* ---------------------------------------------------------------- sponsors, organisations */
.spon-more { margin-top: 4px; font-size: 12px; }
.spon-more summary { cursor: pointer; color: var(--ink-2); }
.spon-more ul { list-style: none; margin: 4px 0 0; padding: 0; }
.spon-more li { padding: 1px 0; }
.org-kind { font: 600 10px/1 var(--text); letter-spacing: .03em; text-transform: uppercase; color: var(--ink-2); background: var(--rule-2); border-radius: 4px; padding: 2px 5px; margin-left: 4px; white-space: nowrap; }
.tag.warn[title] { cursor: help; }

/* ---------------------------------------------------------------- safety tab */
.safety-ev { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px 18px; font-size: 13px; }
.safety-ev li { padding: 4px 0; border-top: 1px solid var(--rule-2); }
.safety-ev li b { font-weight: 600; margin-right: 4px; }
.safety-ev li i { color: var(--ink-3); font-style: normal; font-size: 12px; display: block; }
.tbl td.na { color: var(--ink-3); text-align: right; }
.not-found { max-width: 60ch; }
.not-found .hero-actions { margin-top: 14px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .two { grid-template-columns: minmax(0, 1fr); }    /* not 1fr: its auto minimum let long content widen the page */
}
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; background: none; }
  .nav { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; transform: translateX(-100%); transition: transform .22s ease; height: 100%; }
  .nav.open { transform: none; box-shadow: 12px 0 40px rgba(0, 0, 0, .3); }
  .menu { display: block; flex: none; }
  .bar { padding: 10px 16px; gap: 10px; }
  .bar .who .who-t { display: none; }
  main { padding: 20px 16px 48px; }
  .foot { padding: 0 16px 32px; }
}
@media (prefers-reduced-motion: reduce) { .nav { transition: none; } .toast { transition: none; } }
@media (max-width: 640px) {
  .bar { grid-template-columns: none; }
  .bar .search kbd { display: none; }
  .bar .search input { font-size: 14px; padding-right: 14px; }
  #save-view { display: none; }
  .page-head h1 { font-size: 26px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi b { font-size: 22px; }
  .feed li, .feed.compact li { grid-template-columns: 1fr; gap: 3px; }
  .feed .feed-t { text-align: left; align-items: flex-start; flex-direction: row; }
  .watch-add { grid-template-columns: 1fr; }
  .watch li { grid-template-columns: minmax(0, 1fr) auto; }
  .watch li .w-stage { grid-column: 1; }
  .timeline::before { left: 6px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; padding-left: 26px; }
  .timeline li::before { left: 1px; }
  .timeline .when { text-align: left; }
  .heat th.dis { min-width: 150px; }
  .bars li { grid-template-columns: minmax(0, 1fr) 70px 44px; }
  .bars li small { display: none; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .pick-big { flex-direction: column; }
  .head-tools { width: 100%; }
  .head-tools .field { min-width: 0; flex: 1; }
  .r5-meter { margin-left: 0; }
  .grains { grid-template-columns: 1fr; }
  .tbl.progs td { padding: 4px 0; }
  .section.slim { padding: 16px; }
  .matrix-wrap.tri { margin: 0 -16px; padding: 0 16px; }
  /* stacked tables keep their column names: core.js labelTables() copies each header into data-label */
  .tbl td[data-label]::before { content: attr(data-label); display: block; font: 600 11px/1.3 var(--text); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); margin: 2px 0 1px; }
  .tbl td.num[data-label]::before { text-align: left; }
}

/* ---------------------------------------------------------------- structure thumbnails (web/js/structure/thumbs.js)
   One visual language for molecules and targets: a 96-unit tile, theme-aware ink, accents shared with the 3D viewer.
   Placeholders reserve their size, so lists never shift while thumbnails load. */
:root { --th-tile: #f4f7f6; --th-a: #2a9d8f; --th-b: #5b6ee1; --th-c: #e9a03b; --th-d: #d9604c; --th-e: #8f63d2; --th-f: #3a8fd0; --th-g: #6aa84f; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --th-tile: #1a2f33; --th-a: #4fbfae; --th-b: #8394e8; --th-c: #f0b257; --th-d: #ec8a72; --th-e: #b08fe3; --th-f: #6fb3e6; --th-g: #8cc56f; }
}
:root[data-theme="dark"] { --th-tile: #1a2f33; --th-a: #4fbfae; --th-b: #8394e8; --th-c: #f0b257; --th-d: #ec8a72; --th-e: #b08fe3; --th-f: #6fb3e6; --th-g: #8cc56f; }
.tvth { display: inline-block; flex: none; width: var(--s, 48px); height: var(--s, 48px); vertical-align: middle; color: var(--ink);
  border-radius: calc(var(--s, 48px) * .15); background: var(--rule-2); line-height: 0; }
.tvth[data-state="done"] { background: none; }
.tvth[data-state="loading"], .tvth[data-watch]:not([data-state]) { animation: tvth-pulse 1.4s ease-in-out infinite; }
.tvth[data-state="error"] { background: var(--rule-2); opacity: .6; }
/* Molecule thumbnails carry their modality (card.js molThumb): until the depiction is inlined, or if it fails,
   the data-free modality glyph shows instead of a blank tile. */
.tvth[data-glyph]:not([data-state="done"]) { background: var(--th-tile) var(--glyph) center / contain no-repeat; opacity: 1; animation: none; }
.tvth[data-glyph="igg"] { --glyph: url(/api/structure/glyph/igg?size=64); }
.tvth[data-glyph="small_molecule"] { --glyph: url(/api/structure/glyph/small_molecule?size=64); }
.tvth[data-glyph="protein"] { --glyph: url(/api/structure/glyph/protein?size=64); }
.tvth[data-glyph="peptide"] { --glyph: url(/api/structure/glyph/peptide?size=64); }
.tvth[data-glyph="oligonucleotide"] { --glyph: url(/api/structure/glyph/oligonucleotide?size=64); }
.tvth[data-glyph="adc"] { --glyph: url(/api/structure/glyph/adc?size=64); }
.tvth[data-glyph="gene_therapy"] { --glyph: url(/api/structure/glyph/gene_therapy?size=64); }
.tvth[data-glyph="cell_therapy"] { --glyph: url(/api/structure/glyph/cell_therapy?size=64); }
.tvth[data-glyph="vaccine"] { --glyph: url(/api/structure/glyph/vaccine?size=64); }
.tvth[data-glyph="enzyme"] { --glyph: url(/api/structure/glyph/enzyme?size=64); }
.tvth[data-glyph="other"] { --glyph: url(/api/structure/glyph/other?size=64); }
.tvth svg { width: 100%; height: 100%; display: block; }
@keyframes tvth-pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .tvth { animation: none !important; } }
.with-th { display: flex; gap: 10px; align-items: center; min-width: 0; }
.with-th > div { min-width: 0; }
.tbl td.mol .with-th small { display: block; }
.th-btn { border: 0; padding: 0; background: none; cursor: zoom-in; border-radius: 8px; line-height: 0; }
.th-btn:focus-visible { outline: 2px solid var(--focus); }
.hero-title { display: flex; gap: 16px; align-items: center; }
.hero-title .tvth { --s: 76px; }
.examples a.ex-th { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 12px; align-items: center; }
.examples a.ex-th .tvth { grid-row: span 2; }
.feed-b .with-th { align-items: flex-start; }
@media (max-width: 640px) { .hero-title .tvth { --s: 56px; } }

/* Pathogen layer (schema/370-376): organism badge on pathogen targets (core.js orgBadge, added by tlink wherever a
   target is linked) and the anti-infective approach tag. A rose hue kept apart from the indigo stage ramp, marigold
   "yours", green and coral; text on the washes is 4.5:1 or more in both themes. */
:root {
  --pathogen: #8a2d5a; --pathogen-wash: #f7e6ee;
  --appr-pathogen: #8a2d5a; --appr-host: #2f7f74; --appr-vaccine: #4f5fb8; --appr-microbiome: #765412;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --pathogen: #f2a8ca; --pathogen-wash: #3d1f2e;
    --appr-pathogen: #e88bb6; --appr-host: #55b3a3; --appr-vaccine: #8394e0; --appr-microbiome: #d6b46a;
  }
}
:root[data-theme="dark"] {
  --pathogen: #f2a8ca; --pathogen-wash: #3d1f2e;
  --appr-pathogen: #e88bb6; --appr-host: #55b3a3; --appr-vaccine: #8394e0; --appr-microbiome: #d6b46a;
}
.org-badge { display: inline-block; font-size: 11.5px; font-weight: 600; line-height: 1.5; padding: 0 7px; border-radius: 999px;
  text-decoration: none; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: baseline; }
.org-badge.pathogen { background: var(--pathogen-wash); color: var(--pathogen); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pathogen) 35%, transparent); }
.org-badge.nonhuman { background: var(--neutral-wash); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule); }
.org-badge:hover { text-decoration: underline; }
.tag.appr { font-size: 11px; padding: 0 7px; margin-left: 4px; background: transparent; box-shadow: inset 0 0 0 1px currentColor; }
.tag.appr-pathogen_directed { color: var(--appr-pathogen); }
.tag.appr-host_directed { color: var(--appr-host); }
.tag.appr-vaccine { color: var(--appr-vaccine); }
.tag.appr-microbiome { color: var(--appr-microbiome); }
.hero-org { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin: 2px 0 6px; font-size: 13px; }
.hero-org .org-badge { font-size: 13px; padding: 2px 10px; }

/* Sign-in gate (app.js renderSignin; api/tvapi/signin.py): shown instead of any view while signed out */
body.signed-out #search, body.signed-out #save-view { visibility: hidden; }
.signin { max-width: 560px; margin: 12vh auto 0; padding: 32px; background: var(--sheet); border-radius: 18px;
  box-shadow: var(--shadow); }
.signin h1 { margin: 6px 0 10px; }
.signin .btn { margin: 14px 0 6px; }
.signin .note { margin-top: 14px; }
@media (max-width: 600px) { .signin { margin-top: 24px; padding: 22px 18px; } }
