/* ──────────────────────────────────────────────────────────────
   KG-RAG · Care Matching — pastel dashboard, editorial display
   Display: Instrument Serif (italic for accents)
   Body: Geist
   Mono: Geist Mono
   ────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surface */
  --bg:        #F4EFE6;      /* warm off-white */
  --bg-grain: rgba(0,0,0,.018);
  --paper:    #FFFFFF;
  --ink:      #131311;
  --ink-soft: rgba(19,19,17,.62);
  --ink-mute: rgba(19,19,17,.38);
  --line:     rgba(19,19,17,.10);
  --line-strong: rgba(19,19,17,.18);

  /* Pastel cards */
  --cream:   #EFD9A5;
  --cream-2: #F0E0B6;
  --sage:    #C7D6CC;
  --sage-2:  #D8E2DA;
  --coral:   #EDC0A4;
  --lilac:   #D6CDE3;
  --rose:    #ECC9C5;
  --butter:  #F4E78F;

  /* Tech / AI accent */
  --lime:    #D4F26B;        /* the tech accent */
  --lime-2:  #BCE254;
  --black:   #0E0E0C;

  /* Sizes */
  --r-card: 22px;
  --r-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(40,30,15,.05), 0 1px 0 rgba(255,255,255,.6) inset;
  --shadow-md: 0 8px 24px -8px rgba(40,30,15,.12), 0 1px 0 rgba(255,255,255,.6) inset;
  --shadow-lg: 0 24px 60px -20px rgba(40,30,15,.18), 0 1px 0 rgba(255,255,255,.6) inset;
  --shadow-float: 0 14px 40px -16px rgba(40,30,15,.22);
}

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  font-feature-settings: 'ss01' on, 'cv11' on;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle paper grain */
body::before {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(circle at 20% 0%, rgba(239, 217, 165, .35), transparent 50%),
    radial-gradient(circle at 100% 100%, rgba(199, 214, 204, .25), transparent 50%);
}
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.92' numOctaves='2' /%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .04 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' /%3E%3C/svg%3E");
  opacity: .35;
}

main, section, nav, footer { position: relative; z-index: 1; }

/* ── Top bar ───────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 36px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 500; }
.brand-mark {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 4px rgba(212,242,107,.55);
}
.brand-name { letter-spacing: -0.02em; }
.brand-divider { color: var(--ink-mute); }
.brand-sub { color: var(--ink-soft); font-weight: 400; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 500;
  font-family: 'Geist Mono', monospace;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ink-mute);
}
.status-pill.ok .status-dot {
  background: var(--lime);
  box-shadow: 0 0 0 3px rgba(212,242,107,.4);
  animation: pulse-dot 2.4s infinite;
}
.status-pill.error .status-dot { background: #E66565; }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 6px rgba(212,242,107,.0); } }
.topbar-meta { font-family: 'Geist Mono', monospace; font-size: 12px; color: var(--ink-mute); }

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  padding: 60px 36px 80px;
  position: relative;
  min-height: 520px;
}
.hero-copy {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 2;
  padding: 40px 0 20px;
}
.hero-eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  margin-bottom: 18px;
}
.hero-title {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: clamp(48px, 8vw, 96px);
  line-height: 0.96;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 22px;
}
.hero-title em {
  font-style: italic;
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink) 60%, #5a5a55 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
}
.hero-title em::before {
  content: '';
  position: absolute;
  left: -3%; right: -3%;
  bottom: 8%;
  height: 24%;
  background: var(--lime);
  z-index: -1;
  border-radius: 4px;
  transform: skew(-2deg) translateY(2px);
  opacity: .55;
}
.hero-sub {
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.55;
  max-width: 540px;
  margin: 0 auto 32px;
}
.hero-stats {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-md);
}
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.stat-num {
  font-family: 'Instrument Serif', serif;
  font-size: 28px;
  line-height: 1;
  font-weight: 400;
}
.stat-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
}
.stat-divider { width: 1px; height: 22px; background: var(--line); }

/* Floating cards */
.float-card {
  position: absolute;
  border-radius: var(--r-card);
  padding: 18px 20px;
  box-shadow: var(--shadow-float);
  z-index: 1;
  animation: float-in .8s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes float-in {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
}
.float-cream {
  background: var(--cream);
  color: var(--ink);
}
.float-sage { background: var(--sage); color: var(--ink); }
.float-dark {
  background: var(--black);
  color: #f3f0e6;
}
.float-tl { top: 70px; left: 5%; transform: rotate(-3deg); width: 200px; animation-delay: .1s; }
.float-tr { top: 90px; right: 4%; transform: rotate(3deg); width: 230px; animation-delay: .25s; }
.float-bl { bottom: 60px; left: 8%; transform: rotate(-2deg); width: 190px; animation-delay: .4s; }

.float-card:hover { transform: rotate(0) scale(1.02); transition: transform .4s; }

.float-label {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: .6;
  margin-bottom: 8px;
}
.float-number {
  font-family: 'Instrument Serif', serif;
  font-size: 56px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.float-meta { font-size: 12px; opacity: .7; line-height: 1.3; }

.dark-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--lime);
  color: var(--black);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 10px;
}
.dark-msg { font-size: 13px; line-height: 1.45; opacity: .92; }

.mini-graph { color: var(--black); margin: 4px 0 10px; }
.mini-graph svg { width: 100%; height: 60px; }

/* ── Pipeline strip ────────────────────────────────────────── */
.pipeline-strip {
  margin: 0 36px 60px;
  padding: 28px 32px;
  background: var(--paper);
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  position: relative;
}
.pipe-rail {
  position: absolute;
  left: 64px; right: 64px; top: 50%;
  height: 1px;
  background: linear-gradient(to right, var(--line), var(--line-strong), var(--line));
  transform: translateY(-50%);
  z-index: 0;
}
.pipe-step {
  flex: 1;
  padding: 8px 4px;
  text-align: left;
  z-index: 1;
  position: relative;
  background: var(--paper);
  transition: transform .3s;
}
.pipe-num {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.pipe-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.pipe-desc {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.pipe-pulse {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-mute);
  opacity: .35;
}
.pipe-step.active .pipe-pulse {
  background: var(--lime);
  box-shadow: 0 0 0 4px rgba(212,242,107,.4), 0 0 12px rgba(212,242,107,.6);
  animation: pipe-pulse 1.4s infinite;
}
.pipe-step.done .pipe-pulse {
  background: var(--lime-2);
  opacity: 1;
}
.pipe-step.done .pipe-pulse::after {
  content: '✓';
  position: absolute;
  inset: 0;
  font-size: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--black);
  font-weight: 700;
}
@keyframes pipe-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }

.pipe-step.active {
  transform: translateY(-2px);
}
.pipe-step.active .pipe-name { color: var(--ink); }

/* ── Panel ─────────────────────────────────────────────────── */
.panel {
  margin: 0 36px 36px;
  background: var(--paper);
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  position: relative;
}
.panel-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 32px 36px 24px;
  border-bottom: 1px solid var(--line);
}
.panel-eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-mute);
  margin-bottom: 6px;
}
.panel-title {
  font-family: 'Instrument Serif', serif;
  font-weight: 400;
  font-size: 36px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.panel-time {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--ink-mute);
}

.panel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.panel-col {
  padding: 28px 36px;
}
.panel-col + .panel-col {
  border-left: 1px solid var(--line);
}

/* Fields */
.field { margin-bottom: 22px; }
.field-label {
  display: block;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  margin-bottom: 8px;
}
.field-control {
  position: relative;
}
select, input[type="number"] {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #FAF7EF;
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: all .2s;
}
select:focus, input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23131311' stroke-width='1.5' d='M1 1.5L6 6.5L11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 42px;
}
.field-info {
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.4;
  min-height: 16px;
}
.field-info strong { color: var(--ink); font-weight: 500; }

.field-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 24px;
  align-items: start;
}

/* Tag pills */
.tag-group {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.tag {
  border: none;
  padding: 9px 16px;
  border-radius: var(--r-pill);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .25s;
  letter-spacing: -0.01em;
  position: relative;
}
.tag-rehab  { background: var(--cream); color: #6b4d12; }
.tag-care   { background: var(--sage);  color: #2c4538; }
.tag-house  { background: var(--lilac); color: #463560; }
.tag-escort { background: var(--coral); color: #6b2f1a; }
.tag-nurse  { background: var(--rose);  color: #6b2334; }
.tag-comp   { background: var(--butter);color: #5a4912; }
.tag::after {
  content: '';
  position: absolute; inset: 0;
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  transition: border-color .25s;
}
.tag.active::after { border-color: var(--ink); }
.tag:hover { transform: translateY(-1px); }

/* Stepper */
.stepper {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #FAF7EF;
  overflow: hidden;
}
.stepper button {
  width: 36px; height: 44px;
  border: none; background: transparent;
  font-size: 18px; cursor: pointer;
  color: var(--ink-soft);
  transition: background .15s;
}
.stepper button:hover { background: rgba(0,0,0,.04); color: var(--ink); }
.stepper input {
  width: 56px;
  text-align: center;
  border: none;
  background: transparent;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
}

/* Presets */
.preset-row { display: flex; flex-wrap: wrap; gap: 6px; }
.preset {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .2s;
}
.preset:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.preset.active {
  background: var(--ink);
  color: #f3f0e6;
  border-color: var(--ink);
}

/* Weights */
.weights-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 18px;
}
.weights-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-mute);
  margin-top: 4px;
}
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 12px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all .2s;
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

.weights {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.w-row {
  display: grid;
  grid-template-columns: 80px 1fr 48px;
  align-items: center;
  gap: 14px;
}
.w-name {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.w-val {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right,
    var(--lime) 0%, var(--lime) var(--p, 30%),
    rgba(0,0,0,.08) var(--p, 30%), rgba(0,0,0,.08) 100%);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: grab;
  transition: transform .15s;
}
input[type="range"]::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type="range"]::-moz-range-thumb {
  width: 18px; height: 18px;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 50%;
  cursor: grab;
}

/* Panel footer */
.panel-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 22px 36px;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.015));
  border-top: 1px solid var(--line);
}
.footer-meta {
  display: flex; align-items: center; gap: 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
}
.meta-key { color: var(--ink-mute); }
.meta-val { color: var(--ink); font-weight: 500; }
.meta-sep { color: var(--ink-mute); }

.cta {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 16px 28px;
  border: none;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #f3f0e6;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: all .25s cubic-bezier(.2,.8,.2,1);
}
.cta::before {
  content: '';
  position: absolute; inset: 0;
  background: var(--lime);
  transform: translateX(-101%);
  transition: transform .35s cubic-bezier(.4,.8,.3,1);
}
.cta:hover::before { transform: translateX(0); }
.cta:hover { color: var(--black); }
.cta-arrow, .cta-label { position: relative; z-index: 1; transition: transform .25s; }
.cta:hover .cta-arrow { transform: translate(2px, -2px) rotate(8deg); }
.cta:disabled {
  opacity: .55; cursor: not-allowed;
}
.cta:disabled::before { transform: translateX(-101%); }

/* ── Live section ──────────────────────────────────────────── */
.live {
  margin: 0 36px 36px;
  padding: 32px 36px;
  background: var(--paper);
  border-radius: var(--r-card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.live-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px;
}
.live-elapsed {
  font-family: 'Instrument Serif', serif;
  font-size: 32px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.live-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
}
.live-card {
  background: #FAF7EF;
  border-radius: 18px;
  padding: 20px;
  border: 1px solid var(--line);
}
.live-card.live-milvus { background: linear-gradient(135deg, #FAF7EF 0%, var(--sage-2) 100%); }
.live-card.live-neo4j  { background: linear-gradient(135deg, #FAF7EF 0%, var(--cream-2) 100%); }
.live-card.live-log {
  grid-column: span 2;
  background: var(--black);
  color: #d8d6cd;
  border-color: var(--black);
}
.live-card-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px;
}
.card-eyebrow {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  margin-bottom: 4px;
}
.live-log .card-eyebrow { color: rgba(255,255,255,.4); }
.card-title {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.live-log .card-title { color: #f3f0e6; }
.card-stat {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  background: var(--paper);
  border: 1px solid var(--line);
}
.live-log .card-stat {
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.1);
  color: #d8d6cd;
  display: inline-flex; align-items: center; gap: 6px;
}
.live-pulse span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--lime);
  animation: pulse-dot 1.5s infinite;
}
.viz-wrap {
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255,255,255,.5);
}
.viz-svg { width: 100%; height: 200px; display: block; }
.card-foot {
  display: flex; justify-content: space-between;
  margin-top: 10px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
}

.log {
  height: 180px;
  overflow-y: auto;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  line-height: 1.7;
  padding-right: 8px;
}
.log::-webkit-scrollbar { width: 5px; }
.log::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.log-line { display: flex; gap: 12px; padding: 2px 0; }
.log-line .ts { color: rgba(255,255,255,.35); flex-shrink: 0; }
.log-line .msg { flex: 1; }
.log-line.info .msg { color: #d8d6cd; }
.log-line.success .msg { color: var(--lime); }
.log-line.warn .msg { color: #f5b663; }

/* ── Results ───────────────────────────────────────────────── */
.results {
  margin: 0 36px 60px;
}
.results-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 24px;
  padding: 0 4px;
}
.results-meta {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--ink-soft);
  text-align: right;
  line-height: 1.6;
}
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}
.result-card {
  background: var(--paper);
  border-radius: var(--r-card);
  padding: 26px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform .35s cubic-bezier(.2,.8,.2,1), box-shadow .35s;
  animation: float-in .6s cubic-bezier(.2,.8,.2,1) both;
}
.result-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.result-card[data-rank="1"] { background: var(--cream); }
.result-card[data-rank="2"] { background: var(--sage); }
.result-card[data-rank="3"] { background: var(--paper); }
.result-card[data-rank="4"] { background: var(--lilac); }
.result-card[data-rank="5"] { background: var(--rose); }
.result-card[data-rank="1"]::before {
  content: '';
  position: absolute;
  top: -20px; right: -20px;
  width: 80px; height: 80px;
  background: var(--lime);
  border-radius: 50%;
  filter: blur(40px);
  opacity: .5;
}

.rcard-rank {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px;
}
.rank-num {
  font-family: 'Instrument Serif', serif;
  font-size: 64px;
  line-height: .85;
  letter-spacing: -0.04em;
}
.rank-num em { font-style: italic; color: rgba(0,0,0,.5); }
.rank-cert {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(0,0,0,.1);
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.rcard-name {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}
.rcard-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 18px;
}
.rcard-score {
  font-family: 'Instrument Serif', serif;
  font-size: 90px;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: 18px;
  font-variant-numeric: tabular-nums;
}
.rcard-score em {
  font-style: italic;
  font-size: 36px;
  color: rgba(0,0,0,.4);
  vertical-align: super;
}

.kg-bars {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}
.kg-bar {
  display: flex; flex-direction: column; gap: 4px;
}
.kg-bar-track {
  height: 32px;
  border-radius: 6px;
  background: rgba(0,0,0,.08);
  position: relative;
  overflow: hidden;
}
.kg-bar-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 0%;
  background: var(--ink);
  border-radius: 6px;
  transition: height 1s cubic-bezier(.2,.8,.2,1);
}
.result-card[data-rank="1"] .kg-bar-fill { background: var(--ink); }
.kg-bar-label {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  text-align: center;
  text-transform: uppercase;
}
.kg-bar-val {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-align: center;
  font-weight: 500;
}

.rcard-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.r-tag {
  display: inline-flex; align-items: center;
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: rgba(0,0,0,.08);
  font-size: 11px;
  line-height: 1.3;
}
.r-tag.risk {
  background: rgba(220, 80, 50, .15);
  color: #8a2a16;
}

.rcard-meta {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,.08);
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
}
.rcard-meta div { display: flex; flex-direction: column; }
.rcard-meta label { color: var(--ink-mute); letter-spacing: 0.05em; margin-bottom: 2px; }
.rcard-meta span { font-size: 13px; font-weight: 500; }

/* ── Footer ────────────────────────────────────────────────── */
.foot {
  display: flex; justify-content: space-between; align-items: center;
  padding: 30px 36px;
  border-top: 1px solid var(--line);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.foot-mark { color: var(--lime); font-size: 16px; }

/* ── Drawers (per-stage hits) ──────────────────────────────── */
.drawer {
  margin-top: 14px;
  border-top: 1px dashed rgba(0,0,0,.12);
  padding-top: 10px;
}
.drawer summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  user-select: none;
  transition: color .2s;
}
.drawer summary::-webkit-details-marker { display: none; }
.drawer summary:hover { color: var(--ink); }
.drawer-label { text-transform: uppercase; }
.drawer-count {
  background: rgba(0,0,0,.08);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 10px;
  color: var(--ink);
}
.drawer-chev {
  margin-left: auto;
  font-size: 16px;
  transition: transform .25s;
  color: var(--ink-mute);
}
.drawer[open] .drawer-chev { transform: rotate(90deg); }

.hits-list, .kg-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
  margin-top: 8px;
  padding: 4px 2px;
}
.hits-list::-webkit-scrollbar,
.kg-list::-webkit-scrollbar { width: 4px; }
.hits-list::-webkit-scrollbar-thumb,
.kg-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 2px; }

/* Weights info dropdown */
.weights-info {
  margin-top: 14px;
  border-top: 1px dashed rgba(0,0,0,.12);
  padding-top: 10px;
}
.weights-info summary {
  list-style: none;
  cursor: pointer;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-mute);
  user-select: none;
  transition: color .2s;
}
.weights-info summary::-webkit-details-marker { display: none; }
.weights-info summary:hover { color: var(--ink); }
.weights-info-arrow {
  margin-left: auto;
  font-size: 16px;
  transition: transform .25s;
  color: var(--ink-mute);
}
.weights-info[open] .weights-info-arrow { transform: rotate(90deg); }
.weights-info ul {
  margin-top: 10px;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.weights-info li { margin-bottom: 6px; }

/* Vector hit row */
.hit-row {
  display: grid;
  grid-template-columns: 24px 1fr 60px;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.55);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  align-items: center;
  animation: float-in .3s both;
}
.hit-rank { color: var(--ink-mute); text-align: right; }
.hit-name {
  font-family: inherit;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.hit-score {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
  font-weight: 500;
}

/* KG path row — with 5-dim breakdown */
.kg-row {
  background: rgba(255,255,255,.55);
  border-radius: 10px;
  padding: 10px 12px;
  animation: float-in .3s both;
}
.kg-row-head {
  display: grid;
  grid-template-columns: 24px 1fr 60px;
  gap: 10px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  align-items: center;
  margin-bottom: 8px;
}
.kg-row-head .hit-rank { color: var(--ink-mute); text-align: right; }
.kg-row-head .hit-name {
  font-family: inherit;
  color: var(--ink);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.kg-row-head .hit-score {
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
  font-weight: 500;
}
.kg-paths {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.kg-path {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.kg-path-bar {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(0,0,0,.08);
  overflow: hidden;
  position: relative;
}
.kg-path-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  width: var(--p, 0%);
  background: var(--ink);
  border-radius: 2px;
  transition: width .4s ease;
}
.kg-path-name {
  font-family: 'Geist Mono', monospace;
  font-size: 8.5px;
  color: var(--ink-mute);
  letter-spacing: 0.04em;
}
.kg-path-val {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  font-weight: 500;
}

/* Fusion leaderboard card */
.live-card.live-fusion {
  grid-column: span 2;
  background: linear-gradient(135deg, #FAF7EF 0%, var(--lilac) 100%);
}
.fusion-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
}
.fusion-list::-webkit-scrollbar { width: 4px; }
.fusion-list::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 2px; }
.fusion-empty {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--ink-mute);
  padding: 24px 12px;
  text-align: center;
}
.fusion-row {
  display: grid;
  grid-template-columns: 28px 1.6fr 0.7fr 0.7fr 0.8fr;
  align-items: center;
  gap: 12px;
  padding: 9px 14px;
  background: rgba(255,255,255,.65);
  border-radius: 12px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  animation: float-in .35s both;
}
.fusion-row:nth-child(1) { background: rgba(212,242,107,.45); }
.fusion-rank { color: var(--ink-mute); text-align: right; font-weight: 500; }
.fusion-name {
  font-family: 'Geist', sans-serif;
  font-weight: 500;
  color: var(--ink);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.fusion-cell { display: flex; flex-direction: column; gap: 2px; }
.fusion-cell-key {
  font-size: 9px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.fusion-cell-val {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.fusion-cell.fused .fusion-cell-val {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
}

/* Rerank verdicts in log card */
.verdicts {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}
.verdicts::-webkit-scrollbar { width: 4px; }
.verdicts::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }
.verdict {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: 'Geist Mono', monospace;
  animation: float-in .3s both;
}
.verdict-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.verdict-idx {
  font-size: 10px;
  color: rgba(255,255,255,.4);
}
.verdict-name {
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  color: #f3f0e6;
  font-weight: 500;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.verdict-score {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: #f3f0e6;
}
.verdict-delta {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  font-variant-numeric: tabular-nums;
}
.verdict-delta.up    { background: rgba(212,242,107,.18); color: var(--lime); }
.verdict-delta.down  { background: rgba(245, 182, 99, .18); color: #f5b663; }
.verdict-delta.flat  { background: rgba(255,255,255,.06); color: rgba(255,255,255,.5); }
.verdict-tags {
  display: flex; flex-wrap: wrap; gap: 4px;
  font-size: 10.5px;
}
.v-tag {
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: rgba(255,255,255,.07);
  color: #d8d6cd;
  line-height: 1.4;
}
.v-tag.risk {
  background: rgba(245, 182, 99, .14);
  color: #f5b663;
}
.v-tag.risk::before { content: '▲ '; }

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 880px) {
  .topbar, .pipeline-strip, .panel, .live, .results, .foot { margin-left: 16px; margin-right: 16px; }
  .topbar { padding: 16px; }
  .float-card { display: none; }
  .pipeline-strip { flex-direction: column; gap: 14px; padding: 22px; }
  .pipe-rail { display: none; }
  .panel-grid { grid-template-columns: 1fr; }
  .panel-col + .panel-col { border-left: none; border-top: 1px solid var(--line); }
  .panel-header, .panel-footer { padding-left: 22px; padding-right: 22px; }
  .panel-col { padding: 22px; }
  .live-grid { grid-template-columns: 1fr; }
  .live-card.live-log,
  .live-card.live-fusion { grid-column: span 1; }
  .fusion-row { grid-template-columns: 24px 1fr 60px; gap: 8px; }
  .fusion-row .fusion-cell:not(.fused) { display: none; }
  .hero-title { font-size: 56px; }
  .field-row { grid-template-columns: 1fr; }
}
