/* kb.css — knowledge base + retrieval playground.
 *
 * Additive and self-contained: every selector is kb-prefixed and every colour
 * comes from the shell's own custom properties, so this inherits the console's
 * light palette instead of fighting it. No existing rule is redefined.
 */

/* ---- stat tiles ---------------------------------------------------------- */
.kb-tiles{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:14px}
.kb-tile{flex:1;min-width:104px;background:var(--surface-2);border:1px solid var(--line);
  border-radius:12px;padding:12px 14px}
.kb-tile .n{font-size:21px;font-weight:600;letter-spacing:-.02em;color:var(--ink)}
.kb-tile .l{font-size:10.5px;color:var(--faint);text-transform:uppercase;
  letter-spacing:.05em;margin-top:3px}

/* ---- forms --------------------------------------------------------------- */
.kb-form{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin:12px 0 4px}
.kb-form input,.kb-form select{flex:1;min-width:130px;padding:9px 11px;border-radius:10px;
  border:1px solid var(--line);background:var(--surface);color:var(--ink);
  font-family:var(--font);font-size:13px}
.kb-form input:focus,.kb-form select:focus{outline:none;border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(59,110,246,.12)}
.kb-form input[type=number]{max-width:84px;flex:0 0 auto}
.kb-form input[type=file]{padding:7px;background:var(--surface-2)}
.kb-btn{background:var(--surface);color:var(--ink);border:1px solid var(--line);
  border-radius:10px;padding:9px 16px;font-family:var(--font);font-size:13px;
  font-weight:500;cursor:pointer;white-space:nowrap}
.kb-btn:hover{background:var(--surface-2)}
.kb-btn.kb-primary{background:var(--accent);color:#fff;border-color:transparent;
  font-weight:600;box-shadow:0 4px 12px rgba(59,110,246,.25)}
.kb-btn.kb-primary:hover{background:var(--accent-ink)}
.kb-note{font-size:11.5px;color:var(--faint);margin-top:8px;line-height:1.55}

/* ---- progress ------------------------------------------------------------ */
.kb-progress{margin-top:12px}
.kb-bar{height:6px;background:var(--line-2);border-radius:4px;overflow:hidden}
.kb-bar i{display:block;height:100%;background:var(--accent);transition:width .25s ease}
.kb-msg{font-size:12.5px;color:var(--sub);margin-top:7px;line-height:1.55}
.kb-ok{color:#1f9d45}
.kb-err{color:var(--red);font-size:12.5px;margin-top:7px;line-height:1.55}

/* ---- job cards ----------------------------------------------------------- */
.kb-job{border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:12px;
  background:var(--surface-2)}
.kb-job-head{display:flex;justify-content:space-between;align-items:baseline;gap:10px}
.kb-job-head b{font-size:13.5px;letter-spacing:-.01em;word-break:break-all}
.kb-corp{display:inline-block;font-size:10.5px;color:var(--sub);border:1px solid var(--line);
  border-radius:20px;padding:1px 9px;margin-left:8px;background:var(--surface);
  white-space:nowrap}
.kb-when{font-size:11px;color:var(--faint);white-space:nowrap}

.kb-phases{display:flex;gap:5px;flex-wrap:wrap;margin:11px 0 4px}
.kb-ph{font-size:10.5px;padding:2.5px 10px;border-radius:20px;border:1px solid var(--line);
  color:var(--faint);background:var(--surface)}
.kb-ph.done{color:#1f9d45;border-color:rgba(52,199,89,.4);background:rgba(52,199,89,.08)}
.kb-ph.active{color:#fff;background:var(--accent);border-color:transparent;font-weight:600}
.kb-phases.kb-failed{color:var(--red);font-size:12.5px;font-weight:500}

/* ---- key/value tables ---------------------------------------------------- */
.kb-kv{width:100%;font-size:12.5px;border-collapse:collapse;margin-top:7px}
.kb-kv td{padding:3.5px 10px 3.5px 0;vertical-align:top;line-height:1.55;color:var(--ink)}
.kb-kv td:first-child{color:var(--faint);white-space:nowrap;width:158px}

.kb-est,.kb-cov{border:1px solid var(--line);border-radius:11px;padding:12px;margin-top:11px;
  background:var(--surface)}
.kb-est.kb-gate{border-color:rgba(255,159,10,.55);background:rgba(255,159,10,.07)}
.kb-est-head{font-size:12px;font-weight:600;letter-spacing:-.01em;color:var(--ink)}
.kb-usd{font-weight:700;color:#b26a00}
.kb-gate-actions{margin-top:12px;display:flex;gap:8px;align-items:center;flex-wrap:wrap}

.kb-pill{display:inline-block;font-size:10.5px;border-radius:20px;padding:1.5px 9px;
  margin-left:7px;font-weight:600}
.kb-pill.good{background:rgba(52,199,89,.14);color:#1f9d45}
.kb-pill.warn{background:rgba(255,159,10,.16);color:#b26a00}

/* ---- playground ---------------------------------------------------------- */
.kb-abstain{border-left:3px solid var(--amber)}
.kb-abstain-h{font-weight:700;color:#b26a00;letter-spacing:.02em;margin-bottom:7px;
  font-size:13px}
.kb-hit{margin-bottom:12px}
.kb-hit-weak{border-left:3px solid var(--amber);opacity:.85}
.kb-hit-h{display:flex;align-items:center;flex-wrap:wrap;gap:5px;font-size:13px;
  margin-bottom:9px;letter-spacing:-.01em}
.kb-ranks{width:100%;font-size:11.5px;border-collapse:collapse;margin:9px 0}
.kb-ranks th{text-align:left;color:var(--faint);font-weight:500;padding:2px 12px 4px 0;
  text-transform:uppercase;font-size:9.5px;letter-spacing:.05em;
  border-bottom:1px solid var(--line-2)}
.kb-ranks td{padding:5px 12px 2px 0;font-variant-numeric:tabular-nums;font-family:var(--mono);
  font-size:11px;color:var(--ink)}
.kb-strong{font-weight:700;color:var(--accent)}
.kb-text{white-space:pre-wrap;font-size:12.5px;line-height:1.6;background:var(--surface-2);
  border:1px solid var(--line);border-radius:9px;padding:11px;max-height:300px;
  overflow:auto;color:var(--ink)}
.kb-parent{margin-top:9px}
.kb-parent summary{cursor:pointer;font-size:11.5px;color:var(--sub);margin-bottom:7px}
.kb-parent summary:hover{color:var(--accent)}

/* ---- playground: synthesised answer (real RAG pipeline) ------------------ */
.kb-running{color:var(--sub);font-size:13px}
.kb-sec-h{font-size:12px;font-weight:700;letter-spacing:.02em;text-transform:uppercase;
  color:var(--faint);margin-bottom:11px;display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.kb-ans{border:1px solid var(--line);background:var(--surface)}
/* white claim/source cards pop out of the darker section fill = separation */
.kb-ans.kb-abstain{border-left-color:var(--amber)}

/* supported-rate badge — the operator's evaluation signal */
.kb-badge{font-size:11px;font-weight:700;border-radius:20px;padding:2px 11px;letter-spacing:0;
  text-transform:none}
.kb-badge.good{background:rgba(52,199,89,.16);color:#1f9d45}
.kb-badge.bad{background:rgba(255,59,48,.14);color:var(--red)}

/* claims = the synthesised answer, sentence by sentence, with verdicts */
.kb-claims{margin:0;padding-left:22px;display:flex;flex-direction:column;gap:11px}
.kb-claim{font-size:13.5px;line-height:1.62;color:var(--ink);padding-left:6px}
.kb-claim.bad{border-left:3px solid var(--red);margin-left:-6px;padding-left:11px;
  background:rgba(255,59,48,.05);border-radius:0 8px 8px 0;padding-top:4px;padding-bottom:6px}
.kb-claim-t{margin-right:6px}
.kb-vdt{font-size:9.5px;font-weight:700;text-transform:uppercase;letter-spacing:.04em;
  border-radius:5px;padding:1px 6px;vertical-align:1px;white-space:nowrap}
.kb-vdt.good{background:rgba(52,199,89,.13);color:#1f9d45}
.kb-vdt.bad{background:rgba(255,59,48,.15);color:var(--red)}
.kb-claim-note{font-size:11.5px;color:var(--red);margin-top:5px;line-height:1.5}
.kb-cref{color:var(--accent);cursor:pointer;font-weight:600;text-decoration:none;
  font-variant-numeric:tabular-nums}
.kb-cref:hover{text-decoration:underline}
.kb-ans code,.kb-text code{font-family:var(--mono);font-size:.92em;background:var(--surface-2);
  border:1px solid var(--line);border-radius:4px;padding:0 4px}

/* sources list — citation targets */
.kb-srcs{display:flex;flex-direction:column;gap:7px}
.kb-src{display:flex;gap:11px;align-items:flex-start;padding:9px 11px;border:1px solid var(--line);
  border-radius:10px;background:var(--surface-2);transition:background .35s ease,box-shadow .35s ease}
.kb-marker{flex:0 0 auto;width:22px;height:22px;border-radius:50%;background:var(--accent);color:#fff;
  font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;
  font-variant-numeric:tabular-nums}
.kb-src-t{font-size:13px;font-weight:600;color:var(--ink);display:flex;align-items:center;gap:7px;flex-wrap:wrap}
.kb-src-m{font-size:11px;color:var(--faint);margin-top:3px}
.kb-jumpc{font-size:11px;color:var(--accent);cursor:pointer;margin-top:5px;display:inline-block}
.kb-jumpc:hover{text-decoration:underline}
.kb-corp-strong{background:var(--accent);color:#fff;border-color:transparent;font-weight:600}

.kb-meta{display:flex;gap:7px;align-items:center;flex-wrap:wrap;margin-top:13px;
  padding-top:11px;border-top:1px solid var(--line-2)}
.kb-lat{font-size:11px;color:var(--faint);font-variant-numeric:tabular-nums;font-family:var(--mono)}
.kb-abstain-r{font-size:13px;color:var(--ink);margin-bottom:9px;line-height:1.55}
.kb-rhead .kb-sec-h{margin-bottom:9px}
.kb-warn{color:#b26a00}

/* flash when a marker scrolls its target into view */
.kb-flash{animation:kbflash 1.6s ease}
@keyframes kbflash{0%,30%{background:rgba(59,110,246,.18);box-shadow:0 0 0 3px rgba(59,110,246,.22)}
  100%{background:var(--surface-2);box-shadow:none}}

/* ---- synthesis prompt panel (editable source of truth) ---- */
.kb-prompt-panel{padding:0;overflow:hidden}
.kb-prompt-sum{cursor:pointer;list-style:none;padding:14px 16px;font-size:13px;font-weight:600;
  color:var(--ink);display:flex;align-items:center;gap:8px;user-select:none}
.kb-prompt-sum::-webkit-details-marker{display:none}
.kb-prompt-sum::before{content:"\25B8";color:var(--faint);font-size:12px;transition:transform .2s ease}
.kb-prompt-panel[open] .kb-prompt-sum::before{transform:rotate(90deg)}
.kb-prompt-panel[open] .kb-prompt-sum{border-bottom:1px solid var(--line-2)}
.kb-prompt-body{padding:14px 16px;display:flex;flex-direction:column;gap:11px}
.kb-prompt-note{line-height:1.55}
.kb-prompt-ph{font-size:12px;color:var(--sub)}
.kb-prompt-ph code,.kb-prompt-note code{font-family:var(--mono);font-size:.92em;background:var(--surface-2);
  border:1px solid var(--line);border-radius:4px;padding:1px 5px;color:var(--accent);font-weight:600}
.kb-prompt-ta{width:100%;min-height:340px;resize:vertical;box-sizing:border-box;
  font-family:var(--mono);font-size:12.5px;line-height:1.5;color:var(--ink);
  background:var(--surface-2);border:1px solid var(--line);border-radius:10px;padding:12px 13px;
  white-space:pre-wrap;overflow-wrap:break-word;word-break:break-word;overflow-x:hidden;overflow-y:auto;tab-size:2}
.kb-prompt-ta:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(59,110,246,.16)}
.kb-prompt-meta{font-size:11px;color:var(--faint);font-variant-numeric:tabular-nums}
.kb-prompt-actions{display:flex;gap:9px;flex-wrap:wrap}
.kb-prompt-status{font-size:12.5px;min-height:18px;line-height:1.5}
.kb-prompt-status.ok{color:#1a7f37;font-weight:600}
.kb-prompt-status.err{color:var(--red);font-weight:600}

.kb-section{margin:0 0 14px}
.kb-section-h{margin:14px 0 6px;padding:4px 0 5px;font-size:13px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:#1f2937;border-bottom:1px solid #e5e7eb}
.kb-section .kb-claims{margin-top:4px}

/* ---- work-up builder: shared case bar + run modes ------------------------ */
.kb-case{margin-bottom:14px}
.kb-runbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-top:10px}
.kb-btn.kb-runall{background:var(--accent-ink,#1f4fd6);color:#fff;border-color:transparent;font-weight:600}
.kb-btn.kb-runall:hover{filter:brightness(1.08)}
.kb-btn.kb-runall:disabled{opacity:.6;cursor:progress}
.kb-btn.kb-sm{padding:5px 11px;font-size:12px;border-radius:9px}
.kb-btn.kb-danger{color:var(--red);border-color:rgba(255,59,48,.35)}
.kb-btn.kb-danger:hover{background:rgba(255,59,48,.08)}

/* ---- work-up builder: two-column rail + workspace ------------------------ */
.kb-pg-grid{display:grid;grid-template-columns:224px 1fr;gap:16px;align-items:start}
@media (max-width:820px){.kb-pg-grid{grid-template-columns:1fr}}
.kb-rail{position:sticky;top:12px;border:1px solid var(--line);border-radius:14px;
  background:var(--surface-2);padding:10px;display:flex;flex-direction:column;gap:4px}
.kb-rail-h{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--faint);
  font-weight:700;padding:2px 4px 6px}
.kb-rail-list{display:flex;flex-direction:column;gap:3px}
.kb-railitem{display:flex;align-items:center;gap:8px;width:100%;text-align:left;cursor:pointer;
  border:1px solid transparent;border-radius:9px;padding:7px 9px;background:transparent;
  color:var(--sub);font-family:var(--font);font-size:12.5px;line-height:1.35}
.kb-railitem:hover{background:var(--surface);color:var(--ink)}
.kb-railitem.on{background:var(--surface);border-color:var(--accent);color:var(--ink);font-weight:600}
.kb-railord{flex:none;min-width:19px;height:19px;display:inline-flex;align-items:center;justify-content:center;
  font-size:10.5px;font-variant-numeric:tabular-nums;color:var(--faint);border:1px solid var(--line);
  border-radius:6px;background:var(--surface)}
.kb-railitem.on .kb-railord{color:var(--accent);border-color:var(--accent)}
.kb-raillbl{flex:1}
.kb-rail-actions{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px;padding-top:8px;border-top:1px solid var(--line)}
.kb-pg-main{min-width:0}

/* ---- work-up builder: the per-section editor ----------------------------- */
.kb-sec-editor{border:1px solid var(--line);border-radius:14px;background:var(--surface-2);
  padding:14px;margin-bottom:14px}
.kb-sec-title{display:flex;align-items:center;gap:9px;flex-wrap:wrap;font-size:15px;color:var(--ink);
  margin-bottom:8px}
.kb-sec-title .kb-corp{margin-left:0}
.kb-sec-toolbar{margin-left:auto;display:flex;gap:6px}
.kb-fld-l{display:block;font-size:11px;text-transform:uppercase;letter-spacing:.04em;color:var(--faint);
  font-weight:700;margin:12px 0 5px}
.kb-fld-l .kb-note{display:inline;text-transform:none;letter-spacing:0;font-weight:400;margin:0}
.kb-sec-editor .kb-prompt-ta{min-height:150px}
.kb-hint-in{width:100%;box-sizing:border-box;border:1px solid var(--line);border-radius:9px;
  padding:9px 11px;font-family:var(--mono);font-size:12px;background:var(--surface);color:var(--ink)}
.kb-hint-in:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(59,110,246,.16)}

/* ---- work-up builder: stacked full work-up output ------------------------ */
.kb-workup-head{margin-top:16px}
.kb-workup-sec{margin-top:14px}
.kb-workup-lbl{font-size:13px;font-weight:700;letter-spacing:.03em;text-transform:uppercase;
  color:var(--accent-ink,#1f4fd6);margin:0 0 6px;padding:0 2px}


/* ---- Layer-1 case analysis panel ------------------------------------------ */
.kb-analyze{margin-bottom:14px}
.kb-an-use{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;color:var(--muted);cursor:pointer}
.kb-an-use input{margin:0}
.kb-an-prompt-wrap{margin-top:10px;padding-top:10px;border-top:1px solid var(--line)}
.kb-frame{margin-top:12px}
.kb-frame-meta{margin-bottom:10px}
.kb-an-block{margin:0 0 14px}
.kb-an-h{font-size:12px;font-weight:700;letter-spacing:.04em;text-transform:uppercase;color:var(--muted);margin:0 0 6px}
.kb-an-ul{margin:0;padding-left:18px}
.kb-an-ul li{margin:0 0 7px;line-height:1.5}
.kb-an-sub{color:var(--muted);font-size:12.5px}
.kb-an-why{color:var(--ink);opacity:.8;font-size:12.5px;margin-top:2px}
.kb-most{padding:8px 11px;border-left:3px solid var(--accent);background:var(--surface-2);border-radius:6px}
.kb-symp{padding:8px 0;border-bottom:1px solid var(--line)}
.kb-symp:last-child{border-bottom:none}
.kb-symp-n{font-weight:600;text-transform:capitalize;margin-bottom:4px}
.kb-socrow{display:flex;flex-wrap:wrap;gap:5px}
.kb-soc{font-size:11.5px;background:var(--surface-2);border:1px solid var(--line);border-radius:5px;padding:2px 7px;color:var(--ink)}
.kb-soc b{color:var(--muted);font-weight:600;text-transform:uppercase;font-size:10px;letter-spacing:.03em;margin-right:4px}
.kb-cite{color:var(--accent);cursor:pointer;font-size:11.5px;font-weight:600}
.kb-cite:hover{text-decoration:underline}
.kb-abstain{color:var(--muted);font-style:italic}


/* ---- collapsible case-analysis frame -------------------------------------- */
.kb-frame-d{margin:0}
.kb-frame-sum{list-style:none;cursor:pointer;display:flex;align-items:center;gap:9px;
  padding:2px 0;user-select:none;font-size:13px}
.kb-frame-sum::-webkit-details-marker{display:none}
.kb-frame-chev{width:0;height:0;border-left:6px solid var(--muted);
  border-top:5px solid transparent;border-bottom:5px solid transparent;
  transition:transform .15s ease;flex:none}
.kb-frame-d[open] .kb-frame-chev{transform:rotate(90deg)}
.kb-frame-sumtxt{font-weight:600;color:var(--ink)}
.kb-frame-hint{margin-left:auto;font-size:11px;color:var(--muted);font-weight:400}
.kb-frame-body{margin-top:12px}


/* ---- numbered stages (case / analysis / sections) ------------------------- */
.kb-stage{margin-bottom:16px}
.kb-stage-head{display:flex;gap:12px;align-items:flex-start;margin-bottom:13px}
.kb-stage-head-bare{margin:6px 2px 12px}
.kb-stage-num{flex:none;width:23px;height:23px;border-radius:50%;background:var(--accent);
  color:#fff;font-size:12px;font-weight:700;display:flex;align-items:center;justify-content:center;
  margin-top:1px}
.kb-stage-title{font-size:14.5px;font-weight:700;color:var(--ink);display:flex;align-items:center;
  gap:8px;letter-spacing:0;text-transform:none}
.kb-stage-tag{font-size:10px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;
  color:var(--accent);background:rgba(59,110,246,.12);border:1px solid rgba(59,110,246,.28);
  border-radius:5px;padding:1px 7px}
.kb-stage-desc{font-size:12px;color:var(--muted);line-height:1.5;margin-top:3px;max-width:74ch}


/* ---- playground app shell (sidebar + main workspace) ---------------------- */
.kb-app{display:grid;grid-template-columns:300px 1fr;gap:18px;align-items:start}
@media (max-width:900px){.kb-app{grid-template-columns:1fr}}
.kb-side{position:sticky;top:12px;display:flex;flex-direction:column;gap:14px;
  max-height:calc(100vh - 24px);overflow-y:auto;padding-right:2px}
@media (max-width:900px){.kb-side{position:static;max-height:none}}
.kb-side-block{border:1px solid var(--line);border-radius:14px;background:var(--surface);padding:13px}
.kb-side-h{font-size:10.5px;text-transform:uppercase;letter-spacing:.06em;color:var(--faint);
  font-weight:700;margin-bottom:10px}
.kb-case-ta{width:100%;box-sizing:border-box;min-height:78px;resize:vertical;border:1px solid var(--line);
  border-radius:10px;padding:9px 11px;font:inherit;font-size:13px;line-height:1.45;
  background:var(--surface-2);color:var(--ink)}
.kb-case-ta:focus{outline:none;border-color:var(--accent);box-shadow:0 0 0 3px rgba(59,110,246,.16)}
.kb-case-row{display:flex;gap:6px;margin-top:8px}
.kb-mini{flex:1;min-width:0;box-sizing:border-box;border:1px solid var(--line);border-radius:8px;
  padding:6px 8px;font:inherit;font-size:12px;background:var(--surface-2);color:var(--ink)}
.kb-mini:focus{outline:none;border-color:var(--accent)}
.kb-kbox{flex:none;width:54px}
.kb-block{width:100%;margin-top:10px;justify-content:center;display:flex}
.kb-navitem{display:flex;align-items:center;gap:9px;width:100%;box-sizing:border-box;text-align:left;
  border:1px solid transparent;background:transparent;border-radius:10px;padding:9px 10px;cursor:pointer;
  color:var(--ink);font:inherit;font-size:13px}
.kb-navitem:hover{background:var(--surface-2)}
.kb-navitem.on{background:rgba(59,110,246,.10);border-color:rgba(59,110,246,.30)}
.kb-nav-ic{color:var(--accent);font-size:10px}
.kb-nav-lbl{font-weight:600;flex:1}
.kb-nav-tag{font-size:9.5px;font-weight:700;letter-spacing:.04em;color:var(--accent);
  background:rgba(59,110,246,.12);border:1px solid rgba(59,110,246,.26);border-radius:5px;padding:1px 5px}
.kb-main{min-width:0}
.kb-view-runbar{display:flex;align-items:center;gap:11px;margin-bottom:13px;flex-wrap:wrap}
.kb-view-head{margin-bottom:13px}
.kb-view-title{font-size:15px;font-weight:700;display:flex;align-items:center;gap:9px;color:var(--ink)}


/* ==== impactful case-analysis blocks ====================================== */
.kb-an-block{margin:0 0 18px}
.kb-an-h{font-size:12px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);
  margin:0 0 10px;display:flex;align-items:center;gap:8px}
.kb-count{min-width:20px;text-align:center;font-size:11px;font-weight:700;color:var(--muted);
  background:var(--surface-2);border:1px solid var(--line);border-radius:20px;padding:0 7px}
.kb-count-danger{color:#b42318;background:rgba(217,45,32,.09);border-color:rgba(217,45,32,.25)}
.kb-who{margin-left:6px;font-size:12px;font-weight:600;color:var(--accent);background:rgba(59,110,246,.10);
  border-radius:6px;padding:1px 9px;text-transform:none;letter-spacing:0}

/* symptom cards */
.kb-sympgrid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:10px}
.kb-symp{padding:11px 13px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2)}
.kb-symp-n{font-weight:700;text-transform:capitalize;margin-bottom:7px;color:var(--ink);font-size:13.5px}

/* most-likely hero */
.kb-hero{margin:2px 0 18px;padding:15px 17px;border-radius:14px;
  background:linear-gradient(180deg,rgba(59,110,246,.13),rgba(59,110,246,.04));
  border:1px solid rgba(59,110,246,.30)}
.kb-hero-k{font-size:10.5px;font-weight:800;letter-spacing:.07em;text-transform:uppercase;color:var(--accent)}
.kb-hero-dx{font-size:20px;font-weight:800;color:var(--ink);margin-top:4px;line-height:1.18}
.kb-hero-why{font-size:12.5px;color:var(--muted);margin-top:7px;line-height:1.55;max-width:74ch}

/* differential ranked cards */
.kb-dcard{display:flex;gap:12px;align-items:flex-start;padding:12px 14px;border:1px solid var(--line);
  border-radius:12px;background:var(--surface);margin-bottom:8px}
.kb-dcard:hover{border-color:rgba(59,110,246,.35)}
.kb-drank{flex:none;width:24px;height:24px;border-radius:8px;background:var(--surface-2);border:1px solid var(--line);
  font-size:12.5px;font-weight:800;color:var(--muted);display:flex;align-items:center;justify-content:center;margin-top:1px}
.kb-dbody{min-width:0;flex:1}
.kb-dname{font-size:14.5px;font-weight:700;color:var(--ink);display:flex;align-items:center;gap:9px;flex-wrap:wrap}
.kb-dwhy{font-size:12.5px;color:var(--muted);margin-top:5px;line-height:1.55}
.kb-cov{font-size:10.5px;font-weight:700;border-radius:6px;padding:2px 9px;letter-spacing:.01em}
.kb-cov-all{color:#067647;background:rgba(6,118,71,.11);border:1px solid rgba(6,118,71,.30)}
.kb-cov-part{color:var(--muted);background:var(--surface-2);border:1px solid var(--line);font-weight:600}

/* red-flag danger block */
.kb-danger-block{background:rgba(217,45,32,.045);border:1px solid rgba(217,45,32,.18);border-radius:14px;padding:13px 14px}
.kb-an-h-danger{color:#b42318}
.kb-rfcard{border:1px solid var(--line);border-left:3px solid #d92d20;border-radius:9px;padding:10px 13px;
  margin-bottom:8px;background:var(--surface)}
.kb-rfcard:last-child{margin-bottom:0}
.kb-rfname{font-size:13.5px;font-weight:700;color:var(--ink)}
.kb-rfwhy{font-size:12.5px;color:var(--muted);margin-top:4px;line-height:1.55}

/* masquerader cards */
.kb-mcard{padding:10px 13px;border:1px dashed var(--line);border-radius:10px;margin-bottom:8px;background:var(--surface-2)}
.kb-mcard:last-child{margin-bottom:0}
.kb-mname{font-size:13.5px;font-weight:700;color:var(--ink)}

/* pitfalls */
.kb-pitfalls{margin:0;padding:0;list-style:none}
.kb-pitfalls li{position:relative;padding:7px 0 7px 24px;font-size:13px;line-height:1.55;border-bottom:1px solid var(--line)}
.kb-pitfalls li:last-child{border-bottom:none}
.kb-pitfalls li::before{content:"!";position:absolute;left:0;top:7px;width:16px;height:16px;border-radius:50%;
  background:rgba(181,71,8,.14);color:#b54708;font-size:10px;font-weight:800;
  display:flex;align-items:center;justify-content:center}

/* citation chips (both frame + section claims) */
.kb-cite{display:inline-block;color:var(--accent);cursor:pointer;font-size:11px;font-weight:700;
  background:rgba(59,110,246,.10);border-radius:5px;padding:0 5px;margin:0 1px;text-decoration:none}
.kb-cite:hover{background:rgba(59,110,246,.20)}

/* ==== section-answer polish =============================================== */
.kb-ans .kb-sec-h{font-size:14px}
.kb-section{margin:0 0 16px}
.kb-section-h{font-size:11.5px;font-weight:800;letter-spacing:.05em;text-transform:uppercase;color:var(--muted);
  margin:0 0 9px;padding-bottom:6px;border-bottom:1px solid var(--line)}
.kb-claims{margin:0;padding:0;list-style:none;display:flex;flex-direction:column;gap:8px}
.kb-claim{position:relative;padding:9px 12px;border:1px solid var(--line);
  border-radius:9px;background:var(--surface);font-size:13px;line-height:1.55;list-style:none}
.kb-claim.bad{background:rgba(247,144,9,.06);border:1px solid rgba(247,144,9,.38);border-left-width:1px;margin-left:0;padding-left:12px}
/* red-flag sections read RED, never green */
.kb-section-danger .kb-section-h{color:#b42318;border-bottom-color:rgba(217,45,32,.28)}
.kb-section-danger .kb-claim{border-left:3px solid #d92d20;background:rgba(217,45,32,.035)}
.kb-claim-t{color:var(--ink)}
.kb-vdt{display:inline-block;margin-left:8px;font-size:10px;font-weight:700;text-transform:uppercase;
  letter-spacing:.03em;border-radius:5px;padding:1px 6px;vertical-align:middle}
.kb-vdt.good{color:#067647;background:rgba(6,118,71,.10)}
.kb-vdt.bad{color:#b54708;background:rgba(247,144,9,.12)}
.kb-claim-note{font-size:11.5px;color:#b54708;margin-top:4px}


/* ---- collapsed Sources (expand on click; citation [n] auto-opens) --------- */
.kb-src-d{margin-top:14px;border-top:1px solid var(--line);padding-top:10px}
.kb-src-d>.kb-srcs{margin-top:10px}
.kb-src-sum{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;user-select:none;
  font-size:11.5px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
.kb-src-sum::-webkit-details-marker{display:none}
.kb-src-sum::before{content:"";width:0;height:0;border-left:5px solid var(--muted);
  border-top:4px solid transparent;border-bottom:4px solid transparent;transition:transform .15s ease}
.kb-src-d[open] .kb-src-sum::before{transform:rotate(90deg)}


/* ---- Bayesian differential panel ---- */
.kb-bayes .kb-an-h { color:#3730a3; }
.kb-brow { padding:8px 0; border-bottom:1px solid #eef0f5; }
.kb-brow:last-of-type { border-bottom:0; }
.kb-btop { display:flex; align-items:center; gap:8px; }
.kb-bdx { font-weight:600; color:#1f2430; }
.kb-bprob { margin-left:auto; font-variant-numeric:tabular-nums; font-size:13px; color:#556; white-space:nowrap; }
.kb-bpre { color:#8a93a3; }
.kb-bpost { font-weight:700; color:#3730a3; }
.kb-bbar { height:6px; background:#eef0f5; border-radius:4px; margin:5px 0 6px; overflow:hidden; }
.kb-bbar-fill { height:100%; background:linear-gradient(90deg,#6366f1,#818cf8); border-radius:4px; }
.kb-lrs { display:flex; flex-wrap:wrap; gap:5px; }
.kb-lrchip { font-size:11.5px; padding:1px 7px; border-radius:10px; border:1px solid transparent; font-variant-numeric:tabular-nums; }
.kb-lr-g { background:#e7f6ed; color:#186a3b; border-color:#bfe6cd; }
.kb-lr-m { background:#fbf2dd; color:#8a5a00; border-color:#f0deb0; }
.kb-lr-none { font-size:11.5px; color:#9aa2b1; font-style:italic; }
.kb-raw-warn { font-size:10.5px; background:#fdeaea; color:#9a2b2b; border:1px solid #f3c9c9; border-radius:8px; padding:0 6px; }
.kb-bayes-foot { margin-top:9px; font-size:11px; color:#8a93a3; line-height:1.5; }
.kb-bayes-foot .kb-lr-g { padding:0 4px; border-radius:5px; }
.kb-bayes-foot .kb-lr-m { padding:0 4px; border-radius:5px; }


/* ---- golden differential tiers ---- */
.kb-bayes-src { font-size:11.5px; color:#556; margin:-2px 0 8px; padding:5px 9px; background:#eef1fb; border-radius:6px; }
.kb-bayes-src b { color:#3730a3; font-weight:600; }
.kb-tier { font-size:10px; font-weight:700; letter-spacing:.3px; padding:1px 5px; border-radius:4px; }
.kb-tier-ML { background:#e7f6ed; color:#186a3b; }
.kb-tier-RF { background:#fdeaea; color:#b3261e; }
.kb-tier-MQ { background:#fbf2dd; color:#8a5a00; }
.kb-tier-PF { background:#eef0f5; color:#556; }


/* ---- evidence-gated differential ---- */
.kb-bstatus { font-size:10px; font-weight:600; padding:1px 6px; border-radius:8px; }
.kb-st-sc { background:#e7f6ed; color:#186a3b; }
.kb-st-rec { background:#fbf2dd; color:#8a5a00; }
.kb-st-no { background:#eef0f5; color:#98a1b0; }
.kb-bf { font-size:12.5px; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap; }
.kb-bf-up { color:#186a3b; }
.kb-bf-dn { color:#b3261e; }


/* ---- probability-mass differential (screenshot-2) ---- */
.kb-dz .kb-an-h { color:#1a1c22; }
.kb-metrics { display:grid; grid-template-columns:repeat(3,1fr); gap:1px; background:#e6e6ea; border:1px solid #e6e6ea; border-radius:9px; overflow:hidden; margin-bottom:16px; }
.kb-metric { background:#f6f7f9; padding:13px 15px; }
.kb-mv { font-size:26px; font-weight:600; letter-spacing:-.01em; line-height:1; color:#1a1c22; font-variant-numeric:tabular-nums; }
.kb-mv small { font-size:13px; color:#878c98; font-weight:500; }
.kb-mk { font-size:9.5px; letter-spacing:.13em; text-transform:uppercase; color:#878c98; margin-top:7px; }
.kb-posthead { display:flex; justify-content:space-between; align-items:baseline; margin-bottom:12px; flex-wrap:wrap; gap:6px; }
.kb-posthead h3 { font-size:17px; font-weight:600; color:#1a1c22; margin:0; }
.kb-posthead span { font-size:11px; color:#878c98; letter-spacing:.04em; font-variant-numeric:tabular-nums; }
.kb-ribbon { display:flex; height:44px; border-radius:9px; overflow:hidden; border:1px solid #f0f0f3; box-shadow:inset 0 0 0 1px #fff; margin-bottom:16px; }
.kb-seg { position:relative; display:flex; align-items:center; justify-content:center; color:#fff; overflow:hidden; border-right:1px solid rgba(255,255,255,.5); min-width:0; }
.kb-seg:last-child { border-right:0; }
.kb-seglab { font-size:11px; font-weight:600; white-space:nowrap; text-shadow:0 1px 2px rgba(0,0,0,.25); padding:0 6px; opacity:0; }
.kb-seg.show .kb-seglab { opacity:1; }
.kb-seg-tail { background:repeating-linear-gradient(45deg,#b6b8be,#b6b8be 6px,#c6c8ce 6px,#c6c8ce 12px); color:#1a1c22; }
.kb-seg-tail .kb-seglab { text-shadow:none; }
.kb-viewtoggle { display:inline-flex; background:#f6f7f9; border:1px solid #e6e6ea; border-radius:11px; padding:4px; gap:2px; margin-bottom:12px; }
.kb-viewtoggle button { font-size:11px; letter-spacing:.08em; text-transform:uppercase; font-weight:600; border:0; background:transparent; color:#878c98; padding:8px 14px; border-radius:8px; cursor:pointer; }
.kb-viewtoggle button.on { background:#1a1c22; color:#f6f7f9; }
.kb-dxrow { display:flex; align-items:center; gap:12px; padding:11px 12px; border-left:3px solid #ccc; border-bottom:1px solid #f0f0f3; }
.kb-dxrank { font-size:11px; color:#a4a9b4; min-width:16px; font-variant-numeric:tabular-nums; }
.kb-dxmid { flex:1; min-width:0; }
.kb-dxname { font-size:14px; font-weight:600; color:#1f2430; margin-bottom:5px; }
.kb-probrow { display:flex; align-items:center; gap:11px; }
.kb-probval { font-size:20px; font-weight:600; letter-spacing:-.01em; min-width:52px; color:#1a1c22; font-variant-numeric:tabular-nums; }
.kb-probval small { font-size:11px; color:#878c98; font-weight:500; }
.kb-probtrack { flex:1; height:7px; background:#f0f0f3; border-radius:99px; overflow:hidden; }
.kb-probfill { height:100%; border-radius:99px; display:block; }
.kb-tiergrp { margin-bottom:14px; }
.kb-tierhd { font-size:11px; font-weight:700; letter-spacing:.1em; text-transform:uppercase; padding:6px 12px; }
.kb-tierhd span { color:#a4a9b4; font-weight:600; }


/* ---- LR chain under each dx ---- */
.kb-chain { display:flex; flex-wrap:wrap; align-items:center; gap:5px; margin-top:7px; }
.kb-prior { font-size:11px; color:#878c98; letter-spacing:.03em; }
.kb-lrop { font-size:11px; padding:1px 6px; border-radius:8px; font-variant-numeric:tabular-nums; }
.kb-lrup { background:#e7f6ed; color:#186a3b; }
.kb-lrdn { background:#fdeaea; color:#b3261e; }
.kb-lrneu { background:#eef0f5; color:#66707e; }
.kb-gate { font-size:10.5px; background:#fff4e0; color:#8a5a00; border:1px solid #f0deb0; border-radius:8px; padding:0 6px; }


/* ---- L7/L8/L9 closure engines ---- */
.kb-closure { margin-top:16px; border-top:1px solid #e6e6ea; padding-top:12px; display:flex; flex-direction:column; gap:9px; }
.kb-cl-row { display:flex; flex-wrap:wrap; align-items:center; gap:7px; }
.kb-cl-lbl { font-size:10px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; padding:2px 8px; border-radius:7px; white-space:nowrap; }
.kb-cl-l7 { background:#fbeceb; color:#c0392b; }
.kb-cl-l8 { background:#fbf3e1; color:#b8860b; }
.kb-cl-l9 { background:#e9f5ee; color:#1f7a4d; }
.kb-cl-item { font-size:12px; color:#4a4e5a; }
.kb-cl-item b { color:#1a1c22; }
.kb-cl-item i { color:#878c98; font-style:italic; }


/* ---- clinical decision support ---- */
.kb-cds-ask { display:flex; flex-direction:column; gap:8px; margin-bottom:10px; }
.kb-cds-q { width:100%; min-height:64px; resize:vertical; padding:11px 13px; border:1px solid #d0cec8; border-radius:9px; font:inherit; font-size:14px; line-height:1.5; box-sizing:border-box; }
.kb-cds-q:focus { outline:2px solid #5b9dd9; border-color:#5b9dd9; }
.kb-cds-qshow { font-size:14px; font-weight:600; color:#1f2430; margin:2px 0 12px; display:flex; gap:8px; align-items:baseline; flex-wrap:wrap; }
.kb-cds-qshow span { font-size:10px; font-weight:700; letter-spacing:.1em; background:#eef1fb; color:#3730a3; border-radius:6px; padding:2px 7px; }
.kb-cds-qshow em { font-size:11px; font-weight:500; font-style:normal; color:#878c98; }
