:root {
  --bg: #0b1220;
  --panel: #121b2d;
  --panel-2: #182339;
  --panel-3: #0d1524;
  --border: #26344f;
  --text: #e8edf5;
  --muted: #97a5bb;
  --accent: #4ea1ff;
  --good: #43c59e;
  --warn: #f3b562;
  --bad: #ef6f6c;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: radial-gradient(circle at top right, rgba(78,161,255,.08), transparent 30%), var(--bg); color: var(--text); }
.shell { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 50px 0 70px; }
.hero { display: flex; justify-content: space-between; gap: 30px; align-items: flex-start; margin-bottom: 30px; }
h1 { margin: 5px 0 10px; font-size: clamp(2rem, 4vw, 3.5rem); }
h2 { margin: 5px 0 0; }
h3 { margin: 0; font-size: 1rem; }
p { max-width: 780px; color: var(--muted); line-height: 1.6; }
.compact-copy { margin-top: 0; max-width: none; }
.eyebrow { font-size: .75rem; letter-spacing: .12em; color: var(--accent); font-weight: 700; }
.privacy-badge { display: flex; align-items: center; gap: 8px; color: var(--muted); border: 1px solid var(--border); background: var(--panel); padding: 10px 14px; border-radius: 999px; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--good); }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 16px; padding: 22px; margin-bottom: 22px; }
.actions, .ensemble-actions { display: flex; gap: 12px; align-items: center; }
button { appearance: none; border: 0; border-radius: 10px; padding: 12px 18px; background: var(--accent); color: white; font-size: .95rem; font-weight: 600; cursor: pointer; }
button.secondary { background: var(--panel-2); border: 1px solid var(--border); }
button.tiny { padding: 5px 8px; border-radius: 7px; font-size: .75rem; }
button:disabled { opacity: .45; cursor: not-allowed; }
.selected-folder { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.selected-folder .label, label { display: block; color: var(--muted); font-size: .8rem; margin-bottom: 7px; }
.warning { margin-top: 18px; border: 1px solid var(--warn); color: var(--warn); padding: 12px 14px; border-radius: 10px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 22px; }
.stat-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; min-width: 0; }
.stat-label { display: block; color: var(--muted); font-size: .85rem; margin-bottom: 7px; }
.stat-card strong { display: block; overflow: hidden; text-overflow: ellipsis; font-size: 1.7rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.status { color: var(--muted); font-size: .9rem; }
.source-info { padding: 10px 14px; border-radius: 8px; background: var(--panel-2); color: var(--muted); font-size: .85rem; margin-bottom: 16px; word-break: break-all; }
.vector-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 15px; }
input, select { background: var(--panel-3); border: 1px solid var(--border); color: var(--text); padding: 11px 13px; border-radius: 8px; font-size: .9rem; }
input:focus, select:focus { outline: none; border-color: var(--accent); }
#vectorSearch { flex: 1; min-width: 250px; }
#vectorCountLabel { color: var(--muted); font-size: .85rem; white-space: nowrap; }
.vector-table-wrap { max-height: 500px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: .86rem; vertical-align: top; }
th { color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--panel); z-index: 2; }
.vector-row { cursor: pointer; }
.vector-row:hover { background: rgba(78,161,255,.08); }
.vector-row.selected { background: rgba(78,161,255,.17); }
.controls-grid { display: grid; grid-template-columns: 2fr 1fr auto; gap: 20px; align-items: end; }
.selected-value { min-height: 42px; padding: 11px 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel-3); color: var(--text); }
.control-button { display: flex; align-items: end; }
#realizationSelect { width: 100%; }
.status-good { color: var(--good); }
.status-warn { color: var(--warn); }
.status-bad { color: var(--bad); }
details { width: 100%; }
summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
pre { background: #080e18; border: 1px solid var(--border); border-radius: 10px; padding: 16px; overflow: auto; max-height: 600px; font-size: .78rem; color: #b9c8dc; }
.footer-note { color: var(--muted); font-size: .85rem; text-align: center; padding-top: 8px; }
.hidden { display: none !important; }
.progress-track { width: 100%; height: 8px; margin-top: 18px; background: var(--panel-3); border-radius: 999px; overflow: hidden; }
.progress-bar { width: 0%; height: 100%; background: var(--accent); transition: width .12s ease; }
.progress-label { margin-top: 8px; }

.tabs-card { padding: 8px; }
.explorer-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.explorer-tab { background: transparent; color: var(--muted); border: 1px solid transparent; }
.explorer-tab:hover { background: var(--panel-2); color: var(--text); }
.explorer-tab.active { background: var(--panel-2); color: white; border-color: var(--border); }

.chart-toolbar { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.switch-control { display: flex; align-items: center; gap: 8px; margin: 0; cursor: pointer; color: var(--muted); font-size: .85rem; }
.switch-control input { appearance: none; width: 34px; height: 18px; margin: 0; background: #26344f; border: none; border-radius: 999px; position: relative; cursor: pointer; transition: .2s; padding: 0; }
.switch-control input::after { content: ""; position: absolute; width: 14px; height: 14px; top: 2px; left: 2px; border-radius: 50%; background: #fff; transition: .2s; }
.switch-control input:checked { background: var(--accent); }
.switch-control input:checked::after { transform: translateX(16px); }
#singleVectorChart, #ensembleChart { width: 100%; height: 520px; }
#histogramChart { width: 100%; height: 420px; }
.histogram-control, .heatmap-control { display: flex; gap: 8px; align-items: center; }
.histogram-control label, .heatmap-control label { margin: 0; }
#histogramBins, #heatmapTopN { width: 78px; }

.scorecard-config-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.config-panel { background: var(--panel-3); border: 1px solid var(--border); border-radius: 12px; padding: 15px; min-width: 0; }
.config-title-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.mini-actions { display: flex; gap: 5px; }
.filter-input { width: 100%; margin-bottom: 10px; }
.check-list { height: 275px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: #09111e; padding: 5px; }
.check-row { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 6px; color: var(--muted); font-size: .84rem; }
.check-row:hover { background: rgba(78,161,255,.07); }
.check-row input { width: auto; margin: 0; padding: 0; }
.inline-check { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.inline-check input { width: auto; margin: 0; }
.weights-panel input[type="range"] { width: 100%; padding: 0; border: none; accent-color: var(--accent); margin: 0 0 14px; }
.slider-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.slider-label output { color: var(--text); font-variant-numeric: tabular-nums; }
.score-run-btn { width: 100%; margin-top: 16px; }
.selection-summary { margin-top: 16px; color: var(--muted); font-size: .86rem; line-height: 1.5; }
#scoreRankingChart { height: 460px; }
#scoreHeatmapChart { min-height: 620px; }
#qcDistributionChart { height: 520px; }
#qcPlotKeySelect { min-width: 260px; }
.accepted-row td:first-child { border-left: 3px solid var(--good); }
.rejected-row { opacity: .55; }
.score-pill { display: inline-flex; min-width: 55px; justify-content: center; padding: 3px 7px; border-radius: 999px; background: var(--panel-2); font-variant-numeric: tabular-nums; }

@media (max-width: 950px) {
  .scorecard-config-grid { grid-template-columns: 1fr; }
  .check-list { height: 210px; }
}
@media (max-width: 800px) {
  .hero { flex-direction: column; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .vector-toolbar, .ensemble-actions { flex-direction: column; align-items: stretch; }
  .controls-grid { grid-template-columns: 1fr; }
  .explorer-tabs { grid-template-columns: 1fr; }
}


/* ============================================================
   v0.5b Smart shortlist
============================================================ */
.shortlist-config-grid { display: grid; grid-template-columns: 1.1fr 1.7fr 1fr 1fr auto; gap: 14px; align-items: end; }
.shortlist-config-grid select, .shortlist-config-grid input { width: 100%; }
.shortlist-run-cell { display: flex; align-items: end; }
.shortlist-run-cell button { white-space: nowrap; }
#shortlistComparisonChart { height: 520px; }
.shortlist-table tbody tr { cursor: pointer; }
.shortlist-table tbody tr:hover { background: rgba(78,161,255,.06); }
.shortlist-table tbody tr.shortlist-active { background: rgba(255,255,255,.06); }
.case-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 9px; border-radius: 999px; font-size: .78rem; font-weight: 700; letter-spacing: .02em; border: 1px solid var(--border); background: var(--panel-2); }
.case-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
@media (max-width: 1050px) {
  .shortlist-config-grid { grid-template-columns: 1fr 1fr; }
  .shortlist-run-cell { grid-column: 1 / -1; }
  .shortlist-run-cell button { width: 100%; }
}
@media (max-width: 700px) {
  .shortlist-config-grid { grid-template-columns: 1fr; }
  .shortlist-run-cell { grid-column: auto; }
}


/* ============================================================
   v0.6 Prediction envelope
============================================================ */
#predictionEnvelopeChart { height: 560px; }
#predictionHistogramChart { height: 420px; }
.prediction-note {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-3);
  margin-bottom: 18px;
}
.prediction-note strong { color: var(--text); }
.prediction-stats { margin-top: 22px; }
