/* ═══════════════════════════════════════════
   Tools — standalone widget pages.

   Each /tools/<slug>.html is a single-purpose, indexable version of
   one engine module from the full dashboard. The chrome here matches
   the in-app design language (Overview / Risks / Plan): one typeface
   (JetBrains Mono), 1080px column, small uppercase section labels,
   semantic color only. The widget itself is the hero — page chrome
   stays out of its way.

   Page anatomy:
     1. tools-topbar  — 56px band: brand · breadcrumb · "open dashboard"
     2. tools-view    — 1080px column for everything below
     3. tools-header  — view-title + one-line sub + tiny source line
     4. tools-body    — the widget, unframed
     5. tools-method  — single-section-title paragraph, inline links
     6. tools-related — compact row of sibling tools
     7. tools-foot    — minimal footer
   ═══════════════════════════════════════════ */

/* Override the html/body locks that the SPA imposes — tools pages are
   regular scrolling documents. */
html.tools, html.tools body {
  height: auto;
  overflow: auto;
  background: var(--bg-page);
}

.tools {
  font-family: var(--font-mono);
  color: var(--text-primary);
  background: var(--bg-page);
  min-height: 100vh;
  padding-top: 56px;
}

/* ── Topbar ─────────────────────────────────────────────────────────── */
.tools-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 max(var(--space-lg), calc((100% - 1200px) / 2 + var(--space-lg)));
  gap: var(--space-md);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.tools-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 5px;
  color: var(--accent);
  text-decoration: none;
  font-family: var(--font-mono);
}
.tools-brand svg { color: var(--accent); }

.tools-breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
}
.tools-breadcrumb a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 160ms;
}
.tools-breadcrumb a:hover { color: var(--accent); }
.tools-breadcrumb-sep { color: var(--border); font-weight: 400; }
.tools-breadcrumb-current { color: var(--text-secondary); }

.tools-topbar-spacer { flex: 1; }

.tools-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: color 160ms, border-color 160ms;
}
.tools-cta:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.tools-cta-arrow { font-size: 12px; }

/* ── View container ────────────────────────────────────────────────── */
.tools-view {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg) var(--space-3xl);
  width: 100%;
}

.tools-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}
.tools-header-text {
  min-width: 0;
  flex: 1;
}
.tools-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tools-title-icon {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex: none;
}
.tools-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0;
}
.tools-sub {
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  max-width: 68ch;
}
.tools-header-source {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  white-space: nowrap;
}

.tools-body {
  margin-top: var(--space-md);
}

/* ── Section title (matches in-app .section-title) ─────────────────── */
.tools-section-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
}

/* In-widget sub-section label — sits above a chart, list, or bignum
   block inside a tool. Smaller than .tools-section-title because it
   labels a piece of the tool, not a page section. */
.tools-pv-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

/* ── Method section ────────────────────────────────────────────────────
   Tertiary by design — the tool is the headline, sources are the receipt.
   Rendered as a <details> element so the page stays uncluttered for
   first-time visitors but the evidence is one click away. */
.tools-method {
  margin-top: var(--space-3xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}
.tools-method[open] .tools-method-caret { transform: rotate(90deg); }

.tools-method-summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  user-select: none;
  transition: color 140ms;
}
.tools-method-summary::-webkit-details-marker { display: none; }
.tools-method-summary:hover { color: var(--text-secondary); }
.tools-method-caret {
  font-size: 9px;
  transition: transform 160ms ease;
  display: inline-block;
}

.tools-method-body {
  margin-top: 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  max-width: 72ch;
}
/* Inline <code> (baseProb, years, sources …) stays monospace — the
   instrument register persists even inside Inter prose. */
.tools-method-body code { font-family: var(--font-mono); }
.tools-method-body a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 140ms, border-color 140ms;
}
.tools-method-body a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tools-method-body p { margin: 0 0 10px; }
.tools-method-body p:last-child { margin-bottom: 0; }

/* Split method: prose on left, references rail on right. */
.tools-method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 48px;
  margin-top: 14px;
}
.tools-method-grid .tools-method-body {
  margin-top: 0;
  max-width: none;
}
@media (max-width: 880px) {
  .tools-method-grid { grid-template-columns: 1fr; gap: 28px; }
}

.tools-method-aside {
  border-left: 1px solid var(--border);
  padding-left: 24px;
}
.tools-method-aside-head {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 12px;
}
.tools-method-aside-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tools-ref {
  display: block;
  padding: 10px 0;
  border-top: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition: background 120ms, padding 120ms;
}
.tools-method-aside-list li:first-child .tools-ref { border-top: 0; }
.tools-ref:hover {
  background: var(--bg-surface);
  padding-left: 8px;
  padding-right: 8px;
  margin-left: -8px;
  margin-right: -8px;
}
.tools-ref-tag {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 4px;
}
.tools-ref-title {
  display: block;
  font-family: var(--font-sans);
  font-size: 12.5px;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
}
.tools-ref-role {
  display: block;
  font-family: var(--font-sans);
  font-size: 11.5px;
  letter-spacing: -0.01em;
  color: var(--text-dim);
  line-height: 1.45;
}
.tools-ref:hover .tools-ref-title { color: var(--accent); }

/* ── Related tools rail ────────────────────────────────────────────── */
.tools-related {
  margin-top: var(--space-2xl);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--border);
}
.tools-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-sm);
}
.tools-related-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  text-decoration: none;
  color: inherit;
  transition: border-color 160ms, color 160ms;
}
.tools-related-card:hover {
  border-color: var(--accent);
}
.tools-related-card-name {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-primary);
  transition: color 160ms;
}
.tools-related-card:hover .tools-related-card-name {
  color: var(--accent);
}
.tools-related-card-sub {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-dim);
}

/* ── Foot ──────────────────────────────────────────────────────────── */
.tools-foot {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.tools-foot a {
  color: var(--text-dim);
  text-decoration: none;
  margin-right: 14px;
}
.tools-foot a:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════════
   Tools INDEX page — expansive list of widgets, each row previews
   what the tool actually shows.
   ═══════════════════════════════════════════════════════════════════ */
.tools-index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  max-width: 1040px;
}
.tools-index-list > li { margin: 0; }

.tools-index-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: var(--space-xl);
  align-items: stretch;
  padding: 28px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-page);
  text-decoration: none;
  color: inherit;
  transition: border-color 200ms, box-shadow 200ms, transform 200ms;
}
.tools-index-row:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-card);
  transform: translateY(-1px);
}

.tools-index-preview {
  position: relative;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--accent);
  overflow: hidden;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.tools-index-preview svg {
  width: 100%;
  height: 100%;
  max-height: 170px;
  display: block;
}

.tools-index-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  gap: 8px;
}
.tools-index-name {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 2px 0 0;
  line-height: 1.1;
  transition: color 200ms;
}
.tools-index-row:hover .tools-index-name { color: var(--accent); }

.tools-index-sub {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  margin: 6px 0 0;
  max-width: 56ch;
}
.tools-index-meta {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
}
.tools-index-go {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  transition: color 200ms;
  white-space: nowrap;
}
.tools-index-arrow {
  display: inline-block;
  transition: transform 200ms;
}
.tools-index-row:hover .tools-index-go { color: var(--accent); }
.tools-index-row:hover .tools-index-arrow { transform: translateX(3px); }

@media (max-width: 720px) {
  .tools-index-row {
    grid-template-columns: 1fr;
    gap: var(--space-md);
    padding: 20px;
  }
  .tools-index-preview { min-height: 140px; }
  .tools-index-preview svg { max-height: 140px; }
  .tools-index-name { font-size: 18px; }
}

/* "Also from the engine" rail — sits below the two main tools and
   points at the credibility (Method) and SEO (Reference) surfaces
   without pretending they're peer tools. */
.tools-index-aside {
  margin-top: 36px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
}
.tools-index-aside-label {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.tools-index-aside-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.tools-index-aside-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 140ms, transform 140ms;
}
.tools-index-aside-link:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.tools-index-aside-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-primary);
}
.tools-index-aside-link:hover .tools-index-aside-name { color: var(--accent); }
.tools-index-aside-sub {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════════
   Widget primitives.
   The widget surface is unframed — the view container is its frame.
   Internal data layouts use semantic mono typography throughout, never
   a second display face. Cyan only where it means leverage.
   ═══════════════════════════════════════════════════════════════════ */
.tools-widget-loading {
  padding: 48px 0;
  text-align: center;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ── Shared pill input ─────────────────────────────────────────────── */
.pv-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 140ms, color 140ms, background 140ms;
}
button.pv-pill { font-family: var(--font-mono); }
button.pv-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
button.pv-pill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pv-pill--active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ── Tool I · Life Expectancy ─────────────────────────────────────── */
.pv-le {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 36px;
  align-items: stretch;
}
@media (max-width: 880px) { .pv-le { grid-template-columns: 1fr; } }

.pv-le-form {
  padding: 12px 22px 22px;
  border: 1px solid rgba(8, 145, 178, 0.35);
  border-radius: var(--radius-sm);
  background: transparent;
  position: relative;
}
/* Make the input panel obviously an input: a small floating label sits
   on the top edge of the panel ("YOUR INPUTS"), and a cyan-tinted border
   telegraphs "interactive" without competing with the output. */
.pv-le-form::before {
  content: 'YOUR INPUTS';
  position: absolute;
  top: -7px;
  left: 16px;
  padding: 1px 10px;
  background: var(--bg-page);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1;
}
.pv-le-field {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.pv-le-field:last-child { border-bottom: 0; }
.pv-le-field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 10px;
}
.pv-le-field-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-dim);
  opacity: 0.85;
}
.pv-le-field-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pv-le-input {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--text-primary);
  font-weight: 600;
  letter-spacing: 0.3px;
}
input.pv-le-input--editable {
  appearance: none;
  -webkit-appearance: none;
  width: 80px;
  padding: 2px 4px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  outline: none;
  transition: border-color 140ms;
}
input.pv-le-input--editable:focus {
  border-bottom-color: var(--accent);
}
input.pv-le-input--editable::-webkit-outer-spin-button,
input.pv-le-input--editable::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input.pv-le-input--editable[type="number"] { -moz-appearance: textfield; }

.pv-le-output {
  position: relative;
  padding: 28px 28px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
}
.pv-le-output-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 22px;
  gap: var(--space-lg);
}
.pv-le-bignum {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 64px;
  letter-spacing: -2px;
  color: var(--text-primary);
  line-height: 1;
}
.pv-le-bignum sub {
  font-size: 14px;
  letter-spacing: 1.6px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-weight: 600;
  margin-left: 10px;
  vertical-align: baseline;
  text-transform: uppercase;
}
.pv-le-bignum-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-top: 10px;
}

/* Single-line comparison strip — anchors the bignum against a national
   reference (all-races baseline for the same sex/age) so the number lands
   with context. Sign-tinted but quiet. */
.pv-le-context {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.4px;
}
.pv-le-context-delta {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  letter-spacing: 0.2px;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.2;
}
.pv-le-context-delta--pos { color: var(--green); background: rgba(22, 163, 74, 0.08); }
.pv-le-context-delta--neg { color: var(--red); background: rgba(220, 38, 38, 0.08); }
.pv-le-context-delta--neu { color: var(--text-secondary); background: var(--bg-surface); }
.pv-le-context-vs {
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.pv-le-context-anchor {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.pv-le-context-anchor::before {
  content: '(';
  color: var(--text-dim);
  font-weight: 400;
}
.pv-le-context-anchor::after {
  content: ')';
  color: var(--text-dim);
  font-weight: 400;
}
.pv-le-meta {
  text-align: right;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}
.pv-le-meta-year {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 26px;
  color: var(--text-secondary);
  letter-spacing: 0.3px;
  margin-top: 8px;
}

.pv-le-curve-wrap {
  position: relative;
}
.pv-le-curve {
  width: 100%;
  height: 200px;
  display: block;
  cursor: crosshair;
}

/* Hover tooltip — floats above the survival curve, follows the cursor.
   Hidden until the user mouses into the chart. */
.pv-le-tooltip {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  background: var(--bg-page);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 100ms ease, transform 100ms ease;
  z-index: 2;
  min-width: 132px;
}
.pv-le-tooltip--on { opacity: 1; transform: translateY(0); }
.pv-le-tt-head {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.pv-le-tt-sep { color: var(--text-dim); margin: 0 2px; }
.pv-le-tt-prob {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
  line-height: 1;
}
.pv-le-tt-unit {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  margin-left: 2px;
  letter-spacing: 0.6px;
}
.pv-le-tt-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-left: 6px;
}

/* Breakdown card — how the number is composed */
.pv-le-breakdown {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.pv-le-br-head {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 10px;
}
.pv-le-br-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(60px, auto);
  gap: 16px;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12.5px;
}
.pv-le-br-row:last-child { border-bottom: 0; }
.pv-le-br-label {
  color: var(--text-primary);
  letter-spacing: 0.2px;
}
.pv-le-br-source {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.8px;
  text-transform: uppercase;
  white-space: nowrap;
}
.pv-le-br-value {
  text-align: right;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.pv-le-br-row--base .pv-le-br-value { color: var(--text-primary); }
.pv-le-br-row--pos  .pv-le-br-value { color: var(--green); }
.pv-le-br-row--neg  .pv-le-br-value { color: var(--red); }
@media (max-width: 700px) {
  .pv-le-br-row { grid-template-columns: 1fr auto; }
  .pv-le-br-source { display: none; }
}

/* ── Mortality Profile (merged LE + Top Killers) ──────────────────── */
.mp-layout {
  display: grid;
  grid-template-columns: 290px 1fr;
  gap: 36px;
  align-items: start;
}
@media (max-width: 880px) { .mp-layout { grid-template-columns: 1fr; } }

.mp-output {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.mp-section-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mp-section-eyebrow {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
}
.mp-section-title {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}

/* The merged form uses .pv-le-form chrome; in the mp layout we want it
   to behave like a sidebar (stay aligned to the top while output grows). */
.mp-form { align-self: start; }

/* The killers grid lives inside .mp-output rather than at the page top,
   so dial the bottom margin that .tk-controls/etc. would normally apply
   from a stand-alone tk page. */
.mp-killers { margin-top: 0; }

/* ── Tool II · Top Killers ────────────────────────────────────────── */
.tk-controls {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 16px 22px;
  margin-bottom: 28px;
  border: 1px solid rgba(8, 145, 178, 0.35);
  border-radius: var(--radius-sm);
  background: transparent;
  position: relative;
}
.tk-controls::before {
  content: 'YOUR INPUTS';
  position: absolute;
  top: -7px;
  left: 16px;
  padding: 1px 10px;
  background: var(--bg-page);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1;
}
.tk-control-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 22px;
  border-right: 1px solid var(--border);
  min-width: 0;
}
.tk-control-row:first-child { padding-left: 0; }
.tk-control-row:last-child {
  border-right: 0;
  padding-right: 0;
  flex: 1;
}
.tk-control-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 9.5px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.tk-field-icon {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  color: var(--text-dim);
  opacity: 0.85;
}
.tk-chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tk-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.4px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-page);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 140ms, color 140ms, background 140ms;
}
.tk-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.tk-chip--on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.tk-age-control {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

@media (max-width: 880px) {
  .tk-controls {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 22px 18px;
  }
  .tk-control-row {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 10px 0;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .tk-control-row:first-child { padding-left: 0; }
  .tk-control-row:last-child {
    padding-right: 0;
    border-bottom: 0;
  }
  .tk-control-label { min-width: 140px; }
}
.tk-age-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.tk-age-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
.tk-age-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
.tk-age-readout {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
  gap: 32px;
  align-items: start;
}
@media (max-width: 880px) {
  .tk-grid { grid-template-columns: 1fr; }
}

.tk-list-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.tk-list-meta {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}

.tk-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.tk-row {
  display: grid;
  grid-template-columns: 28px 28px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 11px 12px;
  margin: 0 -10px;
  border: 0;
  background: none;
  text-align: left;
  font-family: var(--font-mono);
  color: inherit;
  cursor: pointer;
  border-radius: 4px;
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: inset 2px 0 0 transparent;
  transition: background 160ms, box-shadow 160ms;
}
.tk-row:hover {
  background: var(--bg-surface);
  box-shadow: inset 2px 0 0 var(--accent);
}
.tk-row--sel,
.tk-row--sel:hover {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}
.tk-row:last-child { border-bottom: 0; }
.tk-rank {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-dim);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.tk-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}
.tk-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.tk-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.tk-bar {
  position: relative;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
}
.tk-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 2px;
  background: var(--bar-color, var(--accent));
  transition: width 280ms cubic-bezier(0.2, 0.7, 0.2, 1);
}
.tk-share {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  min-width: 60px;
  text-align: right;
}
.tk-share-pct {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 2px;
  letter-spacing: 1px;
  font-weight: 500;
  text-transform: uppercase;
}

.tk-stream-wrap {
  display: flex;
  flex-direction: column;
}
.tk-selected {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.tk-selected-detail {
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
  margin: 6px 0 8px;
}
.tk-selected-peak {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
}
.tk-selected-peak strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ── Tool IV · Longevity Budget ───────────────────────────────────── */
.lb-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 36px;
  padding: 4px 0 24px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
@media (max-width: 820px) {
  .lb-head { grid-template-columns: 1fr; gap: 24px; }
}

.lb-headline {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 52px;
  letter-spacing: -1.5px;
  line-height: 1;
  color: var(--text-primary);
}
.lb-headline sub {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  font-weight: 600;
  margin-left: 6px;
  vertical-align: baseline;
  text-transform: uppercase;
}
.lb-headline-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  margin-top: 10px;
  font-weight: 600;
}
.lb-head-meta {
  display: flex;
  gap: 24px;
  margin-top: 22px;
}
.lb-head-meta-cell { display: inline-flex; flex-direction: column; gap: 4px; }
.lb-head-meta-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.lb-head-meta-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}

.lb-stack-card { display: flex; flex-direction: column; gap: 14px; }
.lb-stack-wrap { position: relative; }
.lb-stack {
  display: flex;
  border-radius: 4px;
  overflow: hidden;
  height: 24px;
  border: 1px solid var(--border);
  background: transparent;
}
.lb-stack-seg {
  height: 100%;
  border-right: 1px solid var(--bg-page);
  transition: width 240ms ease-out, filter 140ms;
  cursor: pointer;
}
.lb-stack-seg:hover { filter: brightness(1.08) saturate(1.1); }
.lb-stack-seg:last-child { border-right: 0; }
.lb-stack-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* Stack-segment hover tooltip — mirrors the LE survival-curve tooltip:
   floats above the bar, cyan-bordered, white bg. */
.lb-stack-tooltip {
  position: absolute;
  left: 0;
  top: -56px;
  pointer-events: none;
  background: var(--bg-page);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 100ms ease, transform 100ms ease;
  z-index: 2;
  min-width: 140px;
  white-space: nowrap;
}
.lb-stack-tooltip--on { opacity: 1; transform: translateY(0); }
.lb-stack-tt-head {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 3px;
}
.lb-stack-tt-val {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.2px;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 2px;
}
.lb-stack-tt-unit {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.lb-stack-tt-sub {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-left: 8px;
}

/* Context line under the bignum — anchors the reachable number to the
   demographic ceiling. Sign-tinted but quiet, mirrors .pv-le-context. */
.lb-head-context {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.4px;
}
.lb-head-context-delta {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  letter-spacing: 0.2px;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.2;
}
.lb-head-context-delta--pos { color: var(--green); background: rgba(5, 150, 105, 0.08); }
.lb-head-context-delta--neg { color: var(--amber); background: rgba(217, 119, 6, 0.08); }
.lb-head-context-delta--neu { color: var(--text-secondary); background: var(--bg-surface); }
.lb-head-context-vs {
  text-transform: uppercase;
  letter-spacing: 1.4px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.lb-head-context-anchor {
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.lb-head-context-anchor::before {
  content: '(';
  color: var(--text-dim);
  font-weight: 400;
}
.lb-head-context-anchor::after {
  content: ')';
  color: var(--text-dim);
  font-weight: 400;
}

.lb-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 18px;
}
.lb-legend-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.3px;
  color: var(--text-secondary);
}
.lb-legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lb-legend-name { flex: 1; }
.lb-legend-gain {
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  font-weight: 600;
}
.lb-legend-row--met .lb-legend-name { color: var(--text-dim); }
.lb-legend-row--met .lb-legend-gain {
  color: var(--text-dim);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 10px;
}

.lb-section-label {
  margin-top: 28px;
  margin-bottom: 14px;
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
}

.lb-levers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid var(--border);
  border-left: 1px solid var(--border);
}
@media (max-width: 760px) { .lb-levers { grid-template-columns: 1fr; } }

.lb-lever {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-page);
  transition: background 160ms;
}
/* Banked levers get a tiny green keyline on the inside-left edge, no
   heavy gray fill — the panel stays white, the state is denoted by the
   "Banked" tag and a dimmer name. */
.lb-lever--met {
  background: var(--bg-page);
  box-shadow: inset 2px 0 0 rgba(5, 150, 105, 0.45);
}
.lb-lever--met .lb-lever-name { color: var(--text-secondary); }
.lb-lever--met .lb-lever-icon { opacity: 0.5; }

.lb-lever-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.lb-lever-name-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lb-lever-swatch {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lb-lever-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-dim);
  opacity: 0.85;
}
.lb-lever-name {
  font-size: 13px;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  font-weight: 500;
}
.lb-lever-gain {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.lb-lever-gain-unit {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-left: 2px;
  font-weight: 600;
}
.lb-lever-state-met {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--green);
  font-weight: 600;
}

.lb-lever-control {
  min-height: 28px;
  display: flex;
  align-items: center;
}

.lb-chip-group {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.lb-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.3px;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-page);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 140ms, color 140ms, background 140ms;
}
.lb-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.lb-chip--on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.lb-slider-row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}
.lb-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  background: var(--bg-surface);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.lb-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
.lb-slider::-moz-range-thumb {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-page);
  box-shadow: 0 0 0 1px var(--accent);
  cursor: pointer;
}
.lb-slider-readout {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  min-width: 60px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lb-lever-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 10.5px;
  letter-spacing: 0.4px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
}
.lb-lever-current { color: var(--text-secondary); font-weight: 500; }
.lb-lever-goal { color: var(--text-dim); }

.lb-footnote {
  margin-top: 18px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
  letter-spacing: 0.2px;
}

/* ── Action Plan (evolution of Longevity Budget) ──────────────────── */
.ap-levers-wrap { margin-top: 28px; }

.ap-plan {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.ap-plan-head {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.ap-section { }
.ap-section-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
}
.ap-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ap-section-dot--priority { background: var(--red); }
.ap-section-dot--beyond   { background: var(--accent); }
.ap-section-dot--banked   { background: var(--green); opacity: 0.7; }

.ap-section-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0;
}
.ap-section-total {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}
.ap-section-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  letter-spacing: 0.1px;
}

.ap-section-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
}
.ap-section-body--compact {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
}

.ap-action {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ap-action--basic  { border-left: 3px solid var(--red); }
.ap-action--beyond { border-left: 3px solid var(--accent); }
.ap-action--banked {
  border-left: 3px solid var(--green);
  opacity: 0.7;
  background: var(--bg-surface);
}

.ap-action-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.ap-action-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.ap-action-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.ap-action-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-primary);
  line-height: 1.35;
}
.ap-action-gain {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.2px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ap-action-gain-unit {
  font-size: 11px;
  margin-left: 1px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}
.ap-action-banked {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--green);
  white-space: nowrap;
}

.ap-action-why {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
  letter-spacing: 0.1px;
}

.ap-action-refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ap-action-ref {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-dim);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  transition: color 140ms, border-color 140ms;
}
.ap-action-ref:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.ap-upsell {
  margin-top: 36px;
  padding: 22px 26px;
  border: 1px solid rgba(8, 145, 178, 0.35);
  border-radius: var(--radius-sm);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  flex-wrap: wrap;
}
.ap-upsell-body { flex: 1; min-width: 240px; }
.ap-upsell-title {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--text-primary);
}
.ap-upsell-sub {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.55;
}
.ap-upsell-cta {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  padding: 9px 16px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  transition: background 140ms, color 140ms;
  white-space: nowrap;
}
.ap-upsell-cta:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ── Tool V · Biomarker Lookup ────────────────────────────────────── */
.bl-shell {
  display: flex;
  flex-direction: column;
}

.bl-searchbar {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 18px;
  padding: 18px 20px 14px;
  border: 1px solid rgba(8, 145, 178, 0.35);
  border-radius: var(--radius-sm);
  background: transparent;
  transition: border-color 160ms, box-shadow 160ms;
}
.bl-searchbar::before {
  content: 'LOOK UP';
  position: absolute;
  top: -7px;
  left: 16px;
  padding: 1px 10px;
  background: var(--bg-page);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  line-height: 1;
}
.bl-searchbar:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.bl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.bl-field--marker { flex: 1; }
.bl-field--value  { flex: 0 0 auto; }
.bl-field-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}
.bl-field-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--text-dim);
  opacity: 0.85;
}
.bl-field-input {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bl-field-input--value { justify-content: flex-end; }
.bl-search-icon { color: var(--text-dim); flex-shrink: 0; }
.bl-search-input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  background: transparent;
  border: 0;
  outline: none;
  padding: 4px 0;
}
.bl-search-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}
.bl-search-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
}
.bl-value-input {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  width: 110px;
  text-align: right;
  background: transparent;
  border: 0;
  outline: none;
  padding: 2px 0;
}
.bl-value-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}
.bl-value-input::-webkit-outer-spin-button,
.bl-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bl-value-input[type="number"] { -moz-appearance: textfield; }
.bl-unit {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  font-weight: 600;
  min-width: 56px;
}

@media (max-width: 540px) {
  .bl-searchbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .bl-search-divider { display: none; }
  .bl-value-input { width: 100%; text-align: left; }
  .bl-field-input--value { justify-content: flex-start; }
}

/* Dropdown */
.bl-search-dropdown {
  position: relative;
  margin-top: 6px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  max-height: 360px;
  overflow-y: auto;
  z-index: 20;
}
.bl-search-empty {
  padding: 16px 20px;
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}
.bl-search-opt {
  display: grid;
  grid-template-columns: 140px 1fr auto;
  gap: 14px;
  align-items: baseline;
  width: 100%;
  padding: 11px 18px;
  font-family: var(--font-mono);
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--border-subtle);
  transition: background 140ms;
}
.bl-search-opt:last-child { border-bottom: 0; }
.bl-search-opt:hover,
.bl-search-opt--active { background: var(--bg-surface); }
.bl-search-opt-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.bl-search-opt-full {
  font-size: 12px;
  color: var(--text-secondary);
}
.bl-search-opt-cat {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
@media (max-width: 700px) {
  .bl-search-opt { grid-template-columns: 1fr auto; }
  .bl-search-opt-full { display: none; }
}

/* Result panel */
.bl-result { margin-top: 24px; }
.bl-result-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.bl-result-eyebrow {
  font-size: 10px;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 6px;
}
.bl-result-title {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-primary);
  line-height: 1.25;
  margin: 0;
}
.bl-result-head-value {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.bl-bignum {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 42px;
  letter-spacing: -1.2px;
  color: var(--text-primary);
  line-height: 1;
}
.bl-bignum--placeholder { color: var(--text-dim); }
.bl-bignum-unit {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.2px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 8px;
  vertical-align: baseline;
}
.bl-sev {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 11px 4px 9px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  border: 1px solid;
  border-radius: 999px;
}
.bl-sev-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.bl-sev--green  { color: var(--green);  border-color: rgba(5,150,105,0.3); background: var(--green-bg); }
.bl-sev--yellow { color: var(--yellow); border-color: rgba(202,138,4,0.3); background: var(--yellow-bg); }
.bl-sev--amber  { color: var(--amber);  border-color: rgba(217,119,6,0.3); background: var(--amber-bg); }
.bl-sev--red    { color: var(--red);    border-color: rgba(220,38,38,0.3); background: var(--red-bg); }

/* Context callout — one-line anchor below the bignum / sev tag. */
.bl-context {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
  font-family: var(--font-mono);
}
.bl-context-delta {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  letter-spacing: 0.2px;
  padding: 2px 7px;
  border-radius: 3px;
  line-height: 1.2;
}
.bl-context-delta--pos { color: var(--green); background: rgba(22, 163, 74, 0.08); }
.bl-context-delta--neg { color: var(--red);   background: rgba(220, 38, 38, 0.08); }
.bl-context-delta--neu { color: var(--amber); background: rgba(217, 119, 6, 0.08); }
.bl-context-vs {
  text-transform: uppercase;
  letter-spacing: 1.3px;
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.bl-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 36px;
  align-items: start;
}
@media (max-width: 880px) {
  .bl-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* Gauge */
.bl-gauge {
  position: relative;
  margin: 14px 0 10px;
  padding-bottom: 56px;
}
.bl-gauge-track {
  height: 10px;
  border-radius: 5px;
  border: 1px solid var(--border);
  cursor: crosshair;
}
.bl-gauge-marker {
  position: absolute;
  top: -6px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.bl-gauge-marker-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 2px solid var(--text-primary);
  box-shadow: 0 2px 4px rgba(15,23,42,0.14);
}
.bl-gauge-marker-val {
  margin-top: 6px;
  padding: 1px 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
  background: var(--bg-page);
  border-radius: 2px;
  text-shadow:
     1px  0 0 var(--bg-page),
    -1px  0 0 var(--bg-page),
     0  1px 0 var(--bg-page),
     0 -1px 0 var(--bg-page);
}

/* Crosshair + small tooltip that follow the cursor across the gradient. */
.bl-gauge-hover {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 30px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 100ms ease;
}
.bl-gauge-hover-line {
  position: absolute;
  top: -2px;
  left: -1px;
  width: 1px;
  height: 14px;
  background: var(--text-secondary);
  opacity: 0.55;
}
.bl-gauge-hover-dot {
  position: absolute;
  top: 1px;
  left: -5px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bg-page);
  border: 2px solid var(--text-secondary);
}
.bl-gauge-tooltip {
  position: absolute;
  top: 34px;
  left: 0;
  min-width: 140px;
  pointer-events: none;
  padding: 7px 10px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px -6px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 100ms ease, transform 100ms ease;
  z-index: 2;
}
.bl-gauge-tooltip--on { opacity: 1; transform: translateY(0); }
.bl-gauge-tooltip--green  { border-color: rgba(5,150,105,0.45); }
.bl-gauge-tooltip--yellow { border-color: rgba(202,138,4,0.45); }
.bl-gauge-tooltip--amber  { border-color: rgba(217,119,6,0.45); }
.bl-gauge-tooltip--red    { border-color: rgba(220,38,38,0.45); }
.bl-gauge-tt-band {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 3px;
}
.bl-gauge-tooltip--green  .bl-gauge-tt-band { color: var(--green); }
.bl-gauge-tooltip--yellow .bl-gauge-tt-band { color: var(--yellow); }
.bl-gauge-tooltip--amber  .bl-gauge-tt-band { color: var(--amber); }
.bl-gauge-tooltip--red    .bl-gauge-tt-band { color: var(--red); }
.bl-gauge-tt-range {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  font-variant-numeric: tabular-nums;
}
.bl-gauge-ticks {
  position: absolute;
  inset: 14px 0 auto 0;
  height: 14px;
  pointer-events: none;
}
.bl-gauge-tick {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.4px;
  padding-top: 4px;
}
.bl-gauge-tick::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -4px;
  width: 1px;
  height: 4px;
  background: var(--border);
  transform: translateX(-50%);
}
.bl-gauge-legend {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.bl-gauge-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bl-gauge-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  border: 1px solid rgba(15,23,42,0.08);
}

.bl-meaning {
  margin: 22px 0 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* Section labels (inside result) */
.bl-sect-label {
  font-size: 12px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 600;
  margin-bottom: 12px;
}

/* Threats list */
.bl-threats { margin-top: 32px; }
.bl-threats-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bl-threat-row {
  display: grid;
  grid-template-columns: 160px 1fr 60px;
  gap: 14px;
  align-items: center;
  padding: 9px 10px;
  margin: 0 -10px;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: background 120ms;
}
.bl-threat-row:hover { background: var(--bg-surface); }
.bl-threat-row:last-child { border-bottom: 0; }
.bl-threat-name {
  font-size: 13px;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.bl-threat-bar {
  position: relative;
  height: 6px;
  background: var(--bg-surface);
  border-radius: 3px;
  overflow: hidden;
}
.bl-threat-bar > span {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 280ms cubic-bezier(0.2,0.7,0.2,1);
}
.bl-threat-years {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.bl-threats-foot {
  margin-top: 10px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.4px;
}
.bl-threats-foot strong {
  color: var(--accent);
  font-weight: 600;
}

/* Actions list */
.bl-actions { margin-top: 32px; }
.bl-actions-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bl-action-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  align-items: baseline;
  padding: 10px;
  margin: 0 -10px;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 4px;
  transition: background 120ms;
}
.bl-action-row:hover { background: var(--bg-surface); }
.bl-action-row:last-child { border-bottom: 0; }
.bl-action-priority {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-dim);
}
.bl-action-row--urgent      .bl-action-priority { color: var(--red); }
.bl-action-row--important   .bl-action-priority { color: var(--amber); }
.bl-action-row--recommended .bl-action-priority { color: var(--accent); }
.bl-action-row--ongoing     .bl-action-priority { color: var(--text-dim); }
.bl-action-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  letter-spacing: 0.2px;
}

/* Sources */
.bl-sources { margin-top: 32px; }
.bl-sources-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bl-sources-list li {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  padding-left: 14px;
  position: relative;
}
.bl-sources-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 1px;
  background: var(--text-dim);
}
.bl-sources-list a {
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  transition: color 140ms, border-color 140ms;
}
.bl-sources-list a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* Side rail */
.bl-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.bl-side-card {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
}
.bl-side-card--surface { background: var(--bg-surface); }
.bl-side-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 8px;
}
.bl-side-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.3px;
  line-height: 1.25;
}
.bl-side-value--accent { color: var(--accent); }
.bl-side-sub {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.3px;
  line-height: 1.5;
}
.bl-side-cta {
  border-color: rgba(8,145,178,0.25);
  background: var(--accent-soft);
}
.bl-side-cta-copy {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 10px;
}
.bl-side-cta-link {
  font-size: 11px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
}
.bl-side-cta-link:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════════════
   Risk Graph — sources modal.
   Opened from a focal node's "View sources" affordance.
   ═══════════════════════════════════════════════════════════════════ */
.rg-srcs-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 80px 24px 40px;
  overflow-y: auto;
  animation: rg-srcs-fade-in 160ms ease;
}
body.rg-srcs-open { overflow: hidden; }
@keyframes rg-srcs-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.rg-srcs-panel {
  width: 100%;
  max-width: 640px;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  font-family: var(--font-mono);
  color: var(--text-primary);
  animation: rg-srcs-slide-in 200ms ease;
}
@keyframes rg-srcs-slide-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}
.rg-srcs-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--border);
}
.rg-srcs-head-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rg-srcs-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.rg-srcs-kind { color: var(--accent); }
.rg-srcs-kind-sep { opacity: 0.6; }
.rg-srcs-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin: 0;
  color: var(--text-primary);
}
.rg-srcs-desc {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-secondary);
}
.rg-srcs-close {
  appearance: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 140ms, border-color 140ms, background-color 140ms;
}
.rg-srcs-close:hover,
.rg-srcs-close:focus-visible {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-surface);
  outline: none;
}
.rg-srcs-body {
  padding: 16px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 60vh;
  overflow-y: auto;
}
.rg-srcs-empty {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}
.rg-srcs-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rg-srcs-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle, var(--border));
}
.rg-srcs-group-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.rg-srcs-group-meta {
  font-size: 11px;
  font-weight: 600;
  color: var(--leverage);
  letter-spacing: 0.4px;
}
.rg-srcs-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rg-srcs-list li { margin: 0; }
.rg-srcs-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-primary);
  text-decoration: none;
  border-radius: 5px;
  border: 1px solid transparent;
  transition: background-color 140ms, border-color 140ms, color 140ms;
}
.rg-srcs-link:hover,
.rg-srcs-link:focus-visible {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--accent);
  outline: none;
}
.rg-srcs-link--plain {
  color: var(--text-secondary);
  cursor: default;
}
.rg-srcs-link-label { flex: 1; }
.rg-srcs-link-arrow {
  font-size: 11px;
  color: var(--text-dim);
}
.rg-srcs-link:hover .rg-srcs-link-arrow,
.rg-srcs-link:focus-visible .rg-srcs-link-arrow {
  color: var(--accent);
}
@media (max-width: 600px) {
  .rg-srcs-backdrop { padding: 40px 12px 24px; }
  .rg-srcs-head { padding: 18px 18px 14px; }
  .rg-srcs-body { padding: 14px 18px 18px; }
  .rg-srcs-title { font-size: 14px; }
}

/* ═══════════════════════════════════════════════════════════════════
   Risk Graph — live force-directed graph (threats · levers · actions)
   ═══════════════════════════════════════════════════════════════════ */

.rg-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: stretch;
}
@media (max-width: 960px) {
  .rg-layout { grid-template-columns: 1fr; }
}

/* ── Graph canvas ── */
.rg-graph {
  position: relative;
  height: 640px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-page);
  overflow: hidden;
}
@media (max-width: 960px) {
  .rg-graph { height: 520px; }
}

.rg-svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
.rg-svg--panning { cursor: grabbing; }

/* ── Nodes ── */
.rg-node { cursor: pointer; transition: opacity 180ms ease; }
.rg-node-shape { transition: stroke-width 120ms ease, fill 120ms ease; }
.rg-node-label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  pointer-events: none;
  fill: var(--text-secondary);
}
.rg-node-label--inside { font-size: 9px; font-weight: 600; letter-spacing: 0.4px; text-transform: uppercase; }
.rg-node-label--below { font-size: 10px; font-weight: 500; }

.rg-node--hover .rg-node-shape,
.rg-node--selected .rg-node-shape {
  stroke-width: 2.4;
}
.rg-node--selected .rg-node-shape {
  filter: drop-shadow(0 0 0 var(--accent));
}
.rg-node--threat.rg-node--selected .rg-node-shape {
  filter: drop-shadow(0 0 6px rgba(217, 119, 6, 0.45));
}
.rg-node--lever.rg-node--selected .rg-node-shape {
  filter: drop-shadow(0 0 6px rgba(8, 145, 178, 0.45));
}
.rg-node--action.rg-node--selected .rg-node-shape {
  filter: drop-shadow(0 0 6px rgba(75, 85, 99, 0.45));
}

.rg-node--dim { opacity: 0.18; }
.rg-node--hidden { opacity: 0.05; pointer-events: none; }
.rg-node--match .rg-node-shape {
  stroke-width: 2.4;
}
.rg-node--dragging { cursor: grabbing; }

/* ── Edges ── */
.rg-edge {
  stroke: var(--text-dim);
  stroke-width: 1;
  opacity: 0.32;
  pointer-events: none;
  transition: opacity 180ms ease, stroke-width 120ms ease;
}
.rg-edge--al {
  stroke-dasharray: 2 3;
  opacity: 0.22;
}
.rg-edge--focus {
  opacity: 0.95;
  stroke-width: 1.6;
  stroke: var(--accent);
}
.rg-edge--dim { opacity: 0.07; }
.rg-edge--hidden { opacity: 0; }

/* ── Legend ── */
.rg-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  display: flex;
  gap: 14px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 3px;
  pointer-events: none;
}
.rg-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.rg-legend-dot { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.rg-legend-dot--threat {
  background: var(--amber-bg);
  border: 1.5px solid var(--amber);
}
.rg-legend-dot--lever {
  background: var(--bg-page);
  border: 1.5px solid var(--accent);
}
.rg-legend-dot--action {
  background: var(--bg-page);
  border: 1.3px solid var(--text-dim);
  border-radius: 2px;
  transform: rotate(45deg);
  width: 8px;
  height: 8px;
}

/* ── Hint ── */
.rg-hint {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-size: 10.5px;
  letter-spacing: 0.3px;
  color: var(--text-dim);
  pointer-events: none;
  user-select: none;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  opacity: 0.85;
}
@media (max-width: 720px) { .rg-hint { display: none; } }

/* ── Tooltip ── */
.rg-tooltip {
  position: absolute;
  z-index: 5;
  pointer-events: none;
  transform: translate(-50%, -100%);
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-width: 240px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  font-size: 11.5px;
  line-height: 1.35;
  opacity: 0;
  transition: opacity 120ms ease;
}
.rg-tooltip[aria-hidden="false"] { opacity: 1; }
.rg-tip-kind {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
}
.rg-tip-label {
  font-weight: 600;
  color: var(--text-primary);
}
.rg-tip-meta {
  font-size: 11px;
  color: var(--text-dim);
}

/* ── Right rail ── */
.rg-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* ── Find / search input — cyan-bordered "YOUR INPUTS" pattern ── */
.rg-find {
  position: relative;
  border: 1px solid rgba(8, 145, 178, 0.35);
  border-radius: 4px;
  padding: 14px 12px 12px;
  background: transparent;
}
.rg-find-label {
  position: absolute;
  top: -7px;
  left: 10px;
  background: var(--bg-page);
  padding: 0 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  text-transform: uppercase;
}
.rg-find-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.rg-find-icon {
  flex: 0 0 14px;
  width: 14px;
  height: 14px;
  color: var(--text-dim);
}
.rg-find-input {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
  padding: 4px 0;
  min-width: 0;
}
.rg-find-input::placeholder { color: var(--text-dim); }
.rg-find-clear {
  background: none;
  border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
}
.rg-find-clear:hover { color: var(--text-secondary); background: var(--bg-surface); }

.rg-find-results {
  list-style: none;
  margin: 10px -12px -12px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  max-height: 240px;
  overflow-y: auto;
}
.rg-find-empty {
  font-size: 11.5px;
  color: var(--text-dim);
  padding: 8px 14px;
}
.rg-find-result {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 7px 14px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.rg-find-result:hover { background: var(--bg-surface); }
.rg-find-result-kind {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
  flex: 0 0 auto;
  color: var(--text-dim);
}
.rg-find-result-kind--threat { color: var(--amber); border-color: var(--amber); }
.rg-find-result-kind--lever { color: var(--accent); border-color: var(--accent); }
.rg-find-result-kind--action { color: var(--text-secondary); border-color: var(--border); }
.rg-find-result-label {
  font-size: 12px;
  color: var(--text-primary);
}

/* ── Filter chips ── */
.rg-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.rg-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--bg-page);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-secondary);
  cursor: pointer;
  transition: opacity 120ms ease, color 120ms ease, border-color 120ms ease;
}
.rg-filter:hover { color: var(--text-primary); }
.rg-filter[aria-pressed="false"] {
  opacity: 0.45;
  text-decoration: line-through;
}
.rg-filter-dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
}
.rg-filter--threat .rg-filter-dot {
  background: var(--amber-bg);
  border: 1.4px solid var(--amber);
}
.rg-filter--lever .rg-filter-dot {
  background: var(--bg-page);
  border: 1.4px solid var(--accent);
}
.rg-filter--action .rg-filter-dot {
  background: var(--bg-page);
  border: 1.2px solid var(--text-dim);
  border-radius: 1px;
  transform: rotate(45deg);
  width: 8px;
  height: 8px;
}

/* ── Detail card ── */
.rg-detail {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 16px 14px;
  background: var(--bg-page);
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-size: 12px;
  line-height: 1.5;
}
.rg-detail-empty {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text-dim);
}
.rg-detail-empty-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.rg-detail-empty-body {
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
}
.rg-detail-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rg-detail-kind {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 2px;
  align-self: flex-start;
}
.rg-detail-kind--threat { color: var(--amber); border-color: var(--amber); }
.rg-detail-kind--lever { color: var(--accent); border-color: var(--accent); }
.rg-detail-kind--action { color: var(--text-secondary); border-color: var(--border); }
.rg-detail-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-primary);
}
.rg-detail-sub {
  font-size: 11.5px;
  color: var(--text-dim);
}
.rg-detail-desc {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}
.rg-detail-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rg-detail-sec-head {
  margin: 0 0 2px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.rg-detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.rg-detail-list li { margin: 0; }
.rg-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  margin: 0 -8px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--text-primary);
  border-radius: 2px;
}
.rg-detail-row:hover { background: var(--bg-surface); }
.rg-detail-row-name { flex: 1; min-width: 0; }
.rg-detail-row-meta {
  font-size: 11px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.rg-detail-row-pri {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--text-dim);
}
.rg-detail-row-pri--urgent { color: var(--red); border-color: var(--red); }
.rg-detail-row-pri--soon { color: var(--amber); border-color: var(--amber); }
.rg-detail-row-pri--pharmaceutical { color: var(--accent); border-color: var(--accent); }
.rg-detail-srcs-btn {
  margin-top: auto;
  padding: 8px 12px;
  background: none;
  border: 1px solid var(--accent);
  border-radius: 3px;
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 120ms ease;
}
.rg-detail-srcs-btn:hover { background: var(--accent-soft); }
