* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg: #0a0a0f; --panel: #12121e; --panel2: #1a1a2e; --border: #2a2a4a;
  --text: #e0e0e0; --muted: #8888aa; --accent: #4a8af4;
  --ok: #10b981; --pending: #6b7280; --error: #ef4444; --running: #fbbf24;
  --skip: #f59e0b; --demo: #f43f5e;
  --source: #6366f1; --engine: #3b82f6; --process: #f59e0b;
  --macro: #a855f7; --integration: #ef4444; --ranking: #f97316; --output: #10b981;
}
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh; font-size: 14px; }
code, pre, .num { font-family: 'SF Mono', ui-monospace, Menlo, monospace; }
.muted { color: var(--muted); }

header { display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; background: linear-gradient(135deg,#1a1a2e,#16213e 60%,#0f3460);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: baseline; gap: 12px; }
.brand h1 { font-size: 20px; font-weight: 700; color: #fff; }
.brand span { font-size: 12px; color: var(--muted); }
.header-actions { display: flex; align-items: center; gap: 14px; }
.pill { font-size: 12px; padding: 5px 12px; border-radius: 20px; background: var(--panel2);
  color: var(--muted); border: 1px solid var(--border); }
.pill.running { color: var(--running); border-color: var(--running); }
.pill.done { color: var(--ok); border-color: var(--ok); }
.pill.error { color: var(--error); border-color: var(--error); }

button { font-family: inherit; cursor: pointer; border-radius: 6px; font-size: 13px; }
button.primary { background: var(--accent); color: #fff; border: none; padding: 9px 16px; font-weight: 600; }
button.primary.sm { padding: 7px 12px; font-size: 12px; }
button.primary:hover { background: #3a7ae4; }
button:disabled { opacity: .5; cursor: not-allowed; }

main { display: grid;
  grid-template-columns: 230px minmax(300px,1fr) minmax(300px,380px) minmax(920px,1080px);
  gap: 14px; padding: 14px 18px; max-width: none; width: max-content; min-width: 100%;
  margin: 0; align-items: start; }

/* Horizontal scroll — main pipeline left, sentiment workspace on the right */
.workspace-scroll {
  overflow-x: auto; overflow-y: visible; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--border);
}
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.panel h2 { font-size: 14px; color: #fff; font-weight: 600; }
.config { position: sticky; top: 78px; }
.inspector { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow: auto; }

.config label { display: block; font-size: 12px; color: var(--muted); margin: 0 0 13px; }
.config input, .config select, .config textarea { width: 100%; margin-top: 5px; padding: 8px 10px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.config textarea { resize: vertical; font-family: 'SF Mono', monospace; font-size: 11.5px; }
.config label.checkbox { display: flex; align-items: center; gap: 8px; color: var(--text); }
.config label.checkbox input { margin-top: 0; width: auto; }
.config h2 { margin-bottom: 14px; }
.hint { font-size: 11px; color: var(--muted); line-height: 1.55; margin-top: 4px; }
.mode-banner { font-size: 12px; font-weight: 600; padding: 7px 10px; border-radius: 6px; margin-bottom: 13px; text-align: center; }
.mode-banner.demo { background: rgba(107,114,128,.15); color: #9ca3af; border: 1px solid var(--border); }
.mode-banner.live { background: rgba(16,185,129,.15); color: #34d399; border: 1px solid var(--ok); }

.field { margin: 0 0 13px; }
.field-label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field-help { display: block; font-size: 10.5px; color: var(--muted); line-height: 1.45; margin-top: 5px; }
.field-help b { color: #b8c0d8; font-weight: 600; }
.segmented { display: flex; gap: 0; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.segmented .seg { flex: 1; background: var(--panel2); color: var(--muted); border: none;
  padding: 8px 0; font-size: 12.5px; font-weight: 600; border-radius: 0; }
.segmented .seg.active { background: var(--accent); color: #fff; }
.segmented .seg:not(.active):hover { background: #20203a; color: var(--text); }
.run-btn { width: 100%; margin: 4px 0 14px; padding: 11px; }
details.adv { border-top: 1px solid var(--border); margin: 4px 0 12px; }
details.adv > summary { cursor: pointer; font-size: 12px; color: var(--accent); padding: 10px 0 4px;
  list-style: none; user-select: none; }
details.adv > summary::-webkit-details-marker { display: none; }
details.adv > summary::before { content: "⚙ "; }
details.adv[open] > summary { margin-bottom: 8px; }

.flow-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.summary { font-size: 12px; color: var(--muted); }
.flow-canvas { display: flex; flex-direction: column; gap: 8px; }

/* animated data-flow connectors between stage groups */
.flow-connector { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px; height: 26px; position: relative; }
.flow-connector .fc-line { position: relative; width: 2px; height: 16px; background: var(--border);
  border-radius: 2px; overflow: hidden; }
.flow-connector.done .fc-line { background: var(--ok); }
.flow-connector.flowing .fc-line { background: linear-gradient(180deg, var(--accent), #0d0d16); }
.flow-connector .fc-packet { position: absolute; left: -2px; top: -6px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); opacity: 0; }
.flow-connector.flowing .fc-packet { opacity: 1; animation: fc-flow .8s linear infinite; }
@keyframes fc-flow { from { top: -6px; } to { top: 16px; } }
.flow-connector .fc-arrow { font-size: 9px; line-height: 1; color: var(--border); margin-top: -2px; }
.flow-connector.done .fc-arrow { color: var(--ok); }
.flow-connector.flowing .fc-arrow { color: var(--accent); }
.flow-connector .fc-label { position: absolute; left: calc(50% + 12px); font-size: 9.5px;
  color: var(--muted); font-family: 'SF Mono', monospace; white-space: nowrap; }
.flow-connector.done .fc-label { color: #34d399; }
.flow-connector.flowing .fc-label { color: #93c5fd; }
/* Sentiment SMUL → Final ETF Scoring edge */
.flow-connector.fusion-edge { height: 38px; }
.flow-connector.fusion-edge .fc-line { background: linear-gradient(180deg, var(--process), var(--integration)); }
.flow-connector.fusion-edge.done .fc-line { background: linear-gradient(180deg, var(--ok), var(--integration)); }
.flow-connector.fusion-edge .fc-arrow { color: var(--integration); font-size: 10px; }
.flow-connector.fusion-edge.done .fc-arrow { color: var(--ok); }
.flow-connector .fc-label-primary { color: #fbbf24; font-weight: 600; left: calc(50% + 12px); top: 0; }
.flow-connector.fusion-edge.done .fc-label-primary { color: #34d399; }
.flow-connector .fc-label-formula { color: #93c5fd; left: calc(50% + 12px); top: 12px; font-size: 9px; }
.flow-connector .fc-label-rows { color: var(--muted); left: calc(50% + 12px); top: 24px; font-size: 8.5px; }
.flow-group { border: 1px solid var(--border); border-radius: 10px; padding: 9px 11px; background: #0d0d16; }
.group-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 7px; }
.engine-row { display: flex; flex-wrap: wrap; gap: 7px; }
.engine-card { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--border); border-left-width: 3px;
  min-width: 190px; flex: 1; cursor: pointer; transition: all .12s; }
.engine-card:hover { border-color: var(--accent); }
.engine-card.selected { outline: 2px solid var(--accent); background: #1d2440; }
.engine-card .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pending); flex-shrink: 0; }
.engine-card.ok .dot { background: var(--ok); }
.engine-card.error .dot { background: var(--error); }
.engine-card.running .dot { background: var(--running); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.engine-card .ec-main { display: flex; flex-direction: column; gap: 1px; flex: 1; min-width: 0; }
.engine-card .ec-label { font-size: 12.5px; color: var(--text); font-weight: 500; }
.engine-card .ec-name { font-size: 10px; color: var(--muted); }
.engine-card .ec-run { background: none; border: 1px solid var(--border); color: var(--muted);
  border-radius: 5px; padding: 3px 7px; font-size: 11px; }
.engine-card .ec-run:hover { border-color: var(--accent); color: var(--accent); }
.ec-fusion-tag {
  display: inline-block; margin-left: 6px; font-size: 9px; font-weight: 600;
  padding: 1px 6px; border-radius: 4px; vertical-align: middle;
  background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.25);
}
.ec-fusion-tag.outbound { background: rgba(245,158,11,.12); color: #fcd34d; border-color: rgba(245,158,11,.3); }

.insp-fusion-hint {
  font-size: 11.5px; line-height: 1.5; color: var(--text);
  background: linear-gradient(135deg, rgba(245,158,11,.08), rgba(239,68,68,.06));
  border: 1px solid rgba(245,158,11,.22); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px;
}
.insp-fusion-title { font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: #fcd34d; margin-bottom: 6px; }
.insp-fusion-hint code { font-size: 10.5px; }

.color-source .engine-card { border-left-color: var(--source); }
.color-engine .engine-card { border-left-color: var(--engine); }
.color-process .engine-card { border-left-color: var(--process); }
.color-macro .engine-card { border-left-color: var(--macro); }
.color-integration .engine-card { border-left-color: var(--integration); }
.color-ranking .engine-card { border-left-color: var(--ranking); }
.color-output .engine-card { border-left-color: var(--output); }

.insp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.insp-head h2 { font-size: 15px; }
.insp-desc { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 8px 0 12px; }
.insp-actions { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.insp-outputs { font-size: 11px; }
.insp-produced { font-size: 11.5px; color: #34d399; background: rgba(16,185,129,.08);
  border: 1px solid rgba(16,185,129,.25); border-radius: 6px; padding: 6px 10px; margin-bottom: 10px;
  font-family: 'SF Mono', monospace; }
.insp-detail { font-size: 11.5px; color: var(--running); background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.2); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }

/* Sentiment step guide (inspector) */
.sent-step-guide {
  margin: 0 0 14px; padding: 12px 14px;
  background: linear-gradient(180deg, rgba(99,102,241,.06) 0%, rgba(13,13,22,.4) 100%);
  border: 1px solid var(--border); border-radius: 10px;
}
.sent-guide-plain { font-size: 13px; line-height: 1.55; color: var(--text); margin: 0 0 12px; }
.sent-guide-io {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px;
}
@media (max-width: 720px) { .sent-guide-io { grid-template-columns: 1fr; } }
.sent-guide-block {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: 12px; line-height: 1.5; color: var(--text);
}
.sent-guide-block p { margin: 4px 0 0; color: var(--muted); }
.sent-guide-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--source); font-weight: 600;
}
.sent-guide-formula { margin-bottom: 10px; }
.sent-guide-formula pre {
  margin: 6px 0 0; padding: 10px 12px; font-size: 11px; line-height: 1.45;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: #08080f; border: 1px solid var(--border); border-radius: 8px;
  white-space: pre-wrap; color: #c4b5fd; overflow-x: auto;
}
.sent-guide-example {
  font-size: 12px; line-height: 1.5; margin-bottom: 8px; padding: 8px 10px;
  background: rgba(16,185,129,.06); border: 1px solid rgba(16,185,129,.15); border-radius: 8px;
}
.sent-guide-example p { margin: 4px 0 0; color: var(--muted); }
.sent-guide-meta { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.sent-guide-meta code { font-size: 10px; color: var(--text); }
.sent-guide-hint { margin-top: 12px; font-size: 12px; }
.sent-run-desc { margin-top: 0; padding-top: 10px; border-top: 1px solid var(--border); }
.sent-run-output-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600; margin-bottom: 8px;
}
.insp-body { display: flex; flex-direction: column; gap: 14px; }
.artifact-title { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 6px; }

.badge { padding: 3px 9px; border-radius: 4px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: rgba(16,185,129,.15); color: #34d399; }
.badge.pending { background: rgba(107,114,128,.15); color: #9ca3af; }
.badge.error { background: rgba(239,68,68,.15); color: #f87171; }
.badge.overweight { background: rgba(16,185,129,.15); color: #34d399; }
.badge.neutral_plus { background: rgba(74,138,244,.15); color: #60a5fa; }
.badge.neutral { background: rgba(107,114,128,.15); color: #9ca3af; }
.badge.underweight { background: rgba(239,68,68,.15); color: #f87171; }

.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 8px; max-height: 360px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 6px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase;
  position: sticky; top: 0; background: var(--panel); }
td.num { text-align: right; }
.shape { font-size: 11px; color: var(--muted); margin-top: 4px; }
pre.json { background: #0d0d16; border: 1px solid var(--border); border-radius: 8px; padding: 12px;
  font-size: 11.5px; color: #a5b4c8; overflow: auto; max-height: 360px; line-height: 1.5; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 12.5px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); font-family: 'SF Mono', monospace; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); gap: 8px; }
.metric { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.metric .m-label { font-size: 10.5px; color: var(--muted); }
.metric .m-value { font-size: 16px; font-weight: 700; color: #fff; margin-top: 3px; font-family: 'SF Mono', monospace; }
.empty { color: var(--muted); font-size: 13px; padding: 24px 10px; text-align: center; }
details.collapse { border: 1px solid var(--border); border-radius: 8px; background: #0d0d16; margin-bottom: 8px; }
details.collapse > summary { cursor: pointer; padding: 8px 11px; font-size: 12px; font-weight: 600;
  color: var(--text); list-style: none; user-select: none; display: flex; align-items: center; gap: 8px; }
details.collapse > summary::before { content: "▸"; color: var(--muted); font-size: 10px; transition: transform .12s; }
details.collapse[open] > summary::before { transform: rotate(90deg); }
details.collapse > summary::-webkit-details-marker { display: none; }
details.collapse > *:not(summary) { padding: 0 11px 11px; }
tr.ellipsis td { text-align: center; color: var(--muted); font-style: italic; background: #0d0d16; }
.narrative { font-size: 12px; color: var(--muted); line-height: 1.5; }

.navlink { color: var(--accent); text-decoration: none; font-size: 13px; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px; }
.navlink:hover { border-color: var(--accent); }
.history-main { display: flex; flex-direction: column; gap: 16px; padding: 16px 20px; max-width: 1500px; margin: 0 auto; }

/* Data Tables explorer */
.tables-layout { display: grid; grid-template-columns: 240px 1fr; gap: 14px; padding: 14px 18px;
  max-width: 1700px; margin: 0 auto; align-items: start; }
.tbl-sidebar { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow: auto; }
.tbl-item { display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 12.5px; color: var(--text);
  border: 1px solid transparent; }
.tbl-item:hover { background: var(--panel2); }
.tbl-item.active { background: #1d2440; border-color: var(--accent); }
.tbl-item .tbl-rows { font-size: 11px; color: var(--muted); font-family: 'SF Mono', monospace; }
.tbl-sidebar .group-title { margin: 12px 0 5px; }
.tbl-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.tbl-main .tbl-wrap { max-height: calc(100vh - 230px); }
@media (max-width: 1000px) { .tables-layout { grid-template-columns: 1fr; } .tbl-sidebar { position: static; max-height: none; } }
.fetch-bar { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin: 10px 0; }
.fetch-bar label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.fetch-bar input, .fetch-bar select { padding: 7px 9px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.hist-out { margin-top: 8px; }
.pager { display: flex; align-items: center; gap: 12px; margin-top: 10px; }

/* Sentiment workspace — 4th column, right of main pipeline inspector */
.sentiment-workspace {
  position: sticky; top: 78px; align-self: start;
  max-height: calc(100vh - 96px); overflow: auto;
  border-left: 3px solid var(--source);
  min-width: 920px;
}
.sent-workspace-head { margin-bottom: 10px; }
.sent-workspace-head h2 { color: var(--source); }
.sent-toolbar {
  display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end;
  padding: 10px 12px; background: #0d0d16; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 12px;
}
.sent-field { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); min-width: 120px; }
.sent-field input { padding: 7px 9px; background: var(--panel2); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.sent-actions { flex-direction: row; align-items: center; gap: 10px; min-width: auto; }
.sent-mode-pill { font-size: 11px; padding: 4px 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--panel2); }
.sent-mode-pill.live { color: #34d399; border-color: var(--ok); background: rgba(16,185,129,.1); }
.sent-mode-hint { font-size: 10px; }
.sent-field .field-help { font-size: 10px; color: var(--muted); line-height: 1.4; margin-top: 2px; max-width: 200px; }
.sent-setup-readonly {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  font-size: 11px; color: var(--muted); flex: 1; min-width: 200px;
}
.sent-setup-readonly strong { color: var(--text); font-weight: 600; }
.sent-setup-from { font-size: 10px; }
.sent-advanced { font-size: 11px; color: var(--muted); }
.sent-advanced summary { cursor: pointer; user-select: none; padding: 4px 0; }
.sent-advanced[open] { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; }
.sent-advanced .sent-field { min-width: 140px; }

.sent-workspace-grid {
  display: flex; flex-direction: column; gap: 14px; align-items: stretch;
}
.badge.running { background: rgba(251,191,36,.15); color: #fbbf24; }

.sentiment-workspace.is-running { border-color: var(--running); }
.sent-top-progress { margin: -4px 0 10px; border-radius: 4px; overflow: hidden; }
.sent-run-banner {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; margin-bottom: 10px; border-radius: 8px;
  background: rgba(251,191,36,.08); border: 1px solid rgba(251,191,36,.25);
  font-size: 12px; color: #fcd34d;
}
.sent-run-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--running);
  animation: pulse 1s infinite; flex-shrink: 0;
}
.sent-arch-diagram.is-running { border-color: rgba(251,191,36,.35); }
.sent-arch-box.running {
  border-left-color: var(--running) !important;
  animation: sent-box-pulse 1.2s ease-in-out infinite;
}
@keyframes sent-box-pulse {
  50% { box-shadow: 0 0 0 1px rgba(251,191,36,.2); background: #1f1a12; }
}
.sent-inspector-running .sent-run-progress { margin: 10px 0 12px; border-radius: 4px; overflow: hidden; }
.sent-run-steps { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.sent-run-step {
  display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted);
  padding: 4px 6px; border-radius: 5px;
}
.sent-run-step.active { color: #fcd34d; background: rgba(251,191,36,.08); }
.sent-run-step.done { color: var(--ok); }
.sent-run-step-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--pending); flex-shrink: 0;
}
.sent-run-step.active .sent-run-step-dot { background: var(--running); animation: pulse 1s infinite; }
.sent-run-step.done .sent-run-step-dot { background: var(--ok); }
.sent-run-wait { padding: 16px 8px; font-size: 12px; }

/* Failure debug — symbol-level pull errors */
.sent-failures {
  margin: 0 0 12px; padding: 10px 12px; border-radius: 8px;
  background: rgba(239,68,68,.06); border: 1px solid rgba(239,68,68,.35);
}
.sent-failures.compact { margin-bottom: 10px; padding: 8px 10px; }
.sent-failures-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.sent-failures-title { font-size: 12px; font-weight: 600; color: #fca5a5; }
.sent-failures-hint { font-size: 10.5px; line-height: 1.45; margin-bottom: 8px; }
.sent-failures-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow: auto; }
.sent-failures.compact .sent-failures-list { max-height: 160px; }
.sent-failure-card {
  background: #1a0f0f; border: 1px solid rgba(239,68,68,.25); border-radius: 6px; padding: 8px 10px;
}
.sent-failure-meta { font-size: 12px; margin-bottom: 4px; }
.sent-failure-win { font-size: 10.5px; }
.sent-failure-err {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 11px; line-height: 1.45;
  color: #fca5a5; white-space: pre-wrap; word-break: break-word; margin: 0;
}
.sent-arch-fail-hint {
  margin-top: 5px; font-size: 9.5px; color: #fca5a5; line-height: 1.35; text-align: left;
}
.sent-arch-box.error { border-left-color: var(--error); }
.sent-tbl-fail-note { display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: rgba(239,68,68,.08); border-bottom: 1px solid var(--border); font-size: 10.5px; }
.sent-outcomes-tbl { border-color: rgba(239,68,68,.3); }
tr.sent-row-failed { background: rgba(239,68,68,.06); }
tr.sent-row-failed td { border-bottom-color: rgba(239,68,68,.15); }
.sent-err-cell { max-width: 320px; white-space: normal; }
.sent-err-pre {
  font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 10.5px;
  line-height: 1.4; color: #fca5a5; margin: 0; white-space: pre-wrap; word-break: break-word;
}
.m-value.underweight { color: #f87171; }

.sent-arch-panel, .sent-flow-panel { min-width: 0; }
.sent-flow-label { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px;
  text-transform: uppercase; letter-spacing: .04em; }

/* Vertical architecture diagram — themed like flow-group / engine-card */
.sent-arch-diagram {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 12px 10px 16px; background: #0d0d16;
  border: 1px solid var(--border); border-radius: 10px;
}
.sent-arch-empty { padding: 28px 12px; text-align: center; width: 100%; }
.sent-arch-layer-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted); margin: 4px 0 8px; text-align: center; width: 100%;
}
.sent-arch-box {
  width: 100%; max-width: 640px;
  border: 1px solid var(--border); border-left-width: 3px; border-left-color: var(--source);
  border-radius: 8px; padding: 10px 14px; background: var(--panel2);
  cursor: pointer; text-align: center;
  transition: border-color .12s, background .12s;
}
.sent-arch-box:hover { border-color: var(--accent); }
.sent-arch-box.selected {
  outline: 2px solid var(--accent); background: #1d2440; border-color: var(--accent);
}
.sent-arch-box.compact {
  max-width: none; padding: 8px 7px; font-size: 11px; min-height: 100px;
  display: flex; flex-direction: column; justify-content: flex-start;
}
.sent-arch-box.ok { border-left-color: var(--ok); }
.sent-arch-box.error { border-left-color: var(--error); }
.sent-arch-box.running, .sent-arch-box.partial { border-left-color: var(--running); }
.sent-arch-box.pending { border-left-color: var(--pending); opacity: .9; }
.sent-arch-box-title { font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.sent-arch-box.compact .sent-arch-box-title { font-size: 11px; }
.sent-arch-box-sub { font-size: 10.5px; color: var(--muted); margin-top: 3px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px; }
.sent-arch-box-body { font-size: 10.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; }
.sent-arch-box-foot { font-size: 10px; margin-top: 6px; }
.sent-arch-list { list-style: none; margin: 6px 0 0; padding: 0; font-size: 11px; color: var(--muted); line-height: 1.55; }
.sent-arch-list li::before { content: "· "; color: var(--accent); }
.sent-arch-score { margin-top: 8px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.sent-arch-score-val { font-size: 14px; font-weight: 700; }
.sent-arch-score-val.mult { background: rgba(74,138,244,.15); color: #60a5fa; border: 1px solid rgba(74,138,244,.3); }
.sent-arch-score-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sent-arch-score-range { font-size: 9.5px; }
.sent-arch-row5 {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 7px;
  width: 100%; margin-bottom: 2px;
}
.sent-arch-vline {
  display: flex; flex-direction: column; align-items: center; padding: 3px 0; color: var(--muted);
}
.sent-arch-vline.tall { padding: 5px 0; }
.sent-arch-vline-stem { width: 1px; height: 12px; background: var(--border); }
.sent-arch-vline.tall .sent-arch-vline-stem { height: 16px; }
.sent-arch-vline-arrow { font-size: 10px; line-height: 1; opacity: .55; }
.sent-arch-hline {
  display: flex; align-items: center; justify-content: center; padding: 0 8px;
  color: var(--muted); font-size: 16px; flex-shrink: 0; opacity: .6;
}
.sent-arch-final-row {
  display: flex; align-items: stretch; justify-content: center; gap: 0;
  width: 100%; flex-wrap: wrap;
}
.sent-arch-final-row .sent-arch-box { flex: 1 1 240px; max-width: 320px; }
.sent-arch-box.multiplier-box { border-left-color: var(--accent); }
.sent-arch-box.multiplier-box.selected { outline-color: var(--accent); }

.sent-flow-canvas { display: flex; flex-direction: column; gap: 4px; }
.sent-flow-empty { padding: 28px 12px; }
.sent-flow-group .group-hint { font-size: 10.5px; margin: -4px 0 8px; line-height: 1.4; }
.sent-engine-row { flex-wrap: wrap; }
.sent-flow-connector { display: flex; justify-content: center; padding: 2px 0; color: var(--muted); }
.sent-flow-arrow { font-size: 14px; opacity: .6; }

.sent-step-card { min-width: 140px; max-width: 200px; flex: 1 1 140px; position: relative; }
.sent-step-card .sent-step-stage {
  font-size: 9px; color: var(--muted); font-family: 'SF Mono', monospace;
  background: var(--panel); border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 5px; flex-shrink: 0;
}
.sent-step-card.ok .dot { background: var(--ok); }
.sent-step-card.error .dot { background: var(--error); }
.sent-step-card.running .dot, .sent-step-card.partial .dot { background: var(--running); }
.sent-step-card.pending .dot { background: var(--pending); }

.sent-inspector { position: static; max-height: none; overflow: visible; }
.sent-metrics { margin-bottom: 12px; }
.sent-table-block { margin-top: 12px; }

/* Final SSOUT + SMUL summary table (architecture + inspector) */
.sent-final-outputs {
  margin: 10px 0 14px;
  padding: 12px 14px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.sent-final-outputs table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.sent-final-outputs th {
  text-align: left; padding: 6px 10px 8px 0;
  color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
}
.sent-final-outputs td { padding: 8px 10px 8px 0; border-top: 1px solid var(--border); vertical-align: middle; }
.sent-final-outputs tr:first-child td { border-top: none; }
.blend-reading { font-size: 11px; font-style: italic; }

/* Main pipeline — sentiment DB vs bundle banner */
.main-sent-banner {
  margin: 10px 0 12px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); font-size: 12.5px; line-height: 1.45;
}
.main-sent-banner.db { border-color: rgba(52, 211, 153, 0.35); background: rgba(52, 211, 153, 0.06); }
.main-sent-banner.bundle { border-color: rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.06); }
.main-sent-banner.insight-llm { border-color: rgba(56, 189, 248, 0.35); background: rgba(56, 189, 248, 0.06); }
.main-sent-banner.compact { padding: 6px 10px; }
.main-sent-title { font-weight: 600; font-size: 12px; margin-bottom: 4px; color: #e2e8f0; }
.main-sent-banner.compact .main-sent-title { margin-bottom: 0; }
.main-sent-banner p { margin: 0; color: var(--muted); }
.main-sent-final { margin-top: 0; margin-bottom: 12px; }

/* Blend waterfall — signal bars down to final score */
.blend-viz { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.blend-etf-block { margin-bottom: 16px; }
.blend-etf-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; flex-wrap: wrap; gap: 8px; }
.blend-final-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.blend-final-arrow { font-size: 12px; }
.badge.mult, .blend-mult { background: rgba(56, 189, 248, 0.15); color: var(--accent); }
.blend-etf-name { font-size: 15px; font-weight: 700; color: #fff; }
.blend-final { font-size: 13px; }
.blend-bars { display: flex; flex-direction: column; gap: 6px; }
.blend-row {
  display: grid; grid-template-columns: 72px 1fr 44px 52px 56px; gap: 8px; align-items: center;
  font-size: 11.5px;
}
.blend-sig-label { text-transform: capitalize; color: var(--muted); }
.blend-bar-track { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.blend-bar-fill { height: 100%; border-radius: 4px; transition: width .3s ease; }
.blend-bar-fill.overweight { background: var(--ok); }
.blend-bar-fill.neutral_plus { background: var(--accent); }
.blend-bar-fill.neutral { background: var(--muted); }
.blend-bar-fill.underweight { background: var(--error); }
.blend-sig-val { text-align: right; }
.blend-sig-w { font-size: 10px; }
.blend-sig-contrib { text-align: right; color: #b8c0d8; }
.blend-formula { font-size: 11px; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }

/* Persisted DB layer (collapsible) */
.sent-persisted { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 8px; }
.sent-persisted > summary { cursor: pointer; font-size: 12px; color: var(--accent); padding: 6px 0; list-style: none; }
.sent-persisted > summary::-webkit-details-marker { display: none; }
.sent-persisted-body { padding: 8px 0 4px; }
.sent-tab-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; align-items: center; }
.sent-tab-row .seg {
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.sent-tab-row .seg.active { background: var(--source); color: #fff; border-color: var(--source); }
.sent-tab-panel .tbl-wrap { max-height: 220px; }

/* Legacy sentiment column styles (kept for tables.html etc.) */
.sentiment-unit { position: sticky; top: 78px; max-height: calc(100vh - 96px); overflow: auto;
  border-color: var(--source); }
.unit-note { font-size: 11px; color: var(--source); border-left: 3px dashed var(--source);
  padding: 4px 0 4px 8px; margin: 6px 0 12px; line-height: 1.4; }
.sent-controls-v { display: flex; flex-direction: column; gap: 9px; margin-bottom: 12px; }
.sent-controls-v label { display: block; font-size: 12px; color: var(--muted); }
.sent-controls-v input { width: 100%; margin-top: 4px; padding: 7px 9px; background: var(--panel2);
  color: var(--text); border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.sent-controls-v .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sent-controls-v .btn-row { display: flex; gap: 8px; }
.sent-controls-v .btn-row button { flex: 1; }
button.ghosty { background: var(--panel2); border: 1px solid var(--border); color: var(--text); }
.sent-stages { display: flex; flex-direction: column; gap: 10px; }
.stage-card { border: 1px solid var(--border); border-radius: 10px; background: #0d0d16; padding: 11px; }
.stage-card-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #fff;
  font-weight: 600; margin-bottom: 9px; }
.stage-no { display: inline-flex; align-items: center; justify-content: center; min-width: 22px;
  height: 20px; padding: 0 5px; border-radius: 6px; background: var(--source); color: #fff;
  font-size: 11px; font-weight: 700; }
.m-value.overweight { color: #34d399; } .m-value.underweight { color: #f87171; }

@media (max-width: 1100px) {
  .sent-arch-row5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sent-arch-final-row { flex-direction: column; align-items: center; }
  .sent-arch-hline { transform: rotate(90deg); padding: 6px 0; }
  .blend-row { grid-template-columns: 64px 1fr 40px; }
  .blend-sig-w, .blend-sig-contrib { display: none; }
}

.backend-warn { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%);
  background: #1f0a0a; border: 1px solid var(--error); color: #fca5a5; padding: 12px 18px;
  border-radius: 10px; font-size: 13px; max-width: 640px; box-shadow: 0 8px 32px rgba(0,0,0,.6); }
.backend-warn code { background: #2a2a4a; padding: 2px 6px; border-radius: 4px; color: #fff; }
.backend-warn a { color: var(--accent); }

/* --- live run: progress bar, totals strip, card badge, activity log --- */
.progress { height: 3px; background: var(--panel2); overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg,var(--accent),#34d399);
  transition: width .25s ease; }
.totals-strip { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 20px 0; max-width: 1700px; margin: 0 auto; }
.total-chip { font-size: 11.5px; color: var(--muted); background: var(--panel); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 11px; }
.total-chip b { color: #fff; font-family: 'SF Mono', monospace; }
.engine-card .ec-badge { font-size: 9.5px; color: var(--muted); font-family: 'SF Mono', monospace; margin-top: 2px; }
.engine-card.pending .dot { background: var(--pending); }

.activity { margin: 0 auto 18px; max-width: 1700px; width: calc(100% - 36px); }
.activity .log { display: flex; flex-direction: column; gap: 3px; max-height: 230px; overflow: auto;
  font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 12px; }
.log-line { display: flex; align-items: center; gap: 9px; padding: 4px 8px; border-radius: 5px; }
.log-line:hover { background: var(--panel2); }
.log-line .log-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.log-line.pending .log-dot { background: var(--running); }
.log-line.error .log-dot { background: var(--error); }
.log-line .log-msg { color: #b8c0d8; }
.log-line.error .log-msg { color: #fca5a5; }

/* --- macro regime inspector card --- */
.regime-head { display: flex; align-items: center; gap: 10px; }
.regime-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.regime-cell { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px;
  padding: 9px 10px; display: flex; flex-direction: column; gap: 5px; }
.regime-model { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.regime-cell .badge { align-self: flex-start; }
.regime-bar { height: 5px; background: #0d0d16; border-radius: 3px; overflow: hidden; }
.regime-bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--pending); }
.regime-bar-fill.overweight { background: var(--ok); }
.regime-bar-fill.neutral_plus { background: #60a5fa; }
.regime-bar-fill.neutral { background: var(--muted); }
.regime-bar-fill.underweight { background: var(--error); }
.regime-score { font-size: 12px; font-family: 'SF Mono', monospace; color: var(--text); text-align: right; }

/* ---- provenance banner (anti-"is this fake") ---------------------------- */
.prov-banner { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  padding: 8px 16px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.prov-banner.demo { background: rgba(244,63,94,.12); border-bottom-color: var(--demo); }
.prov-banner.live { background: rgba(16,185,129,.10); border-bottom-color: var(--ok); }
.prov-mode { font-weight: 700; letter-spacing: .5px; padding: 1px 8px; border-radius: 4px; font-size: 11px; }
.prov-banner.demo .prov-mode { background: var(--demo); color: #fff; }
.prov-banner.live .prov-mode { background: var(--ok); color: #06281d; }
.prov-banner.demo .prov-text { color: #fda4b4; font-weight: 600; }
.prov-banner.live .prov-text { color: #6ee7b7; }
.prov-meta { color: var(--muted); font-size: 11.5px; }

/* ---- honest stage statuses: skipped / degraded ------------------------- */
.engine-card.skipped .dot, .engine-card.degraded .dot { background: var(--skip); }
.badge.skipped, .badge.degraded { background: rgba(245,158,11,.15); color: #fbbf24; }
.log-line.skipped .log-dot, .log-line.degraded .log-dot { background: var(--skip); }
.log-line.skipped .log-msg, .log-line.degraded .log-msg { color: #fcd34d; }
.flow-connector.done .fc-line { } /* unchanged */

/* ---- per-output lineage in the inspector ------------------------------- */
.insp-lineage { font-size: 11.5px; color: var(--muted); margin: 6px 0 2px;
  padding: 7px 10px; background: rgba(255,255,255,.02); border: 1px solid var(--border);
  border-radius: 6px; line-height: 1.6; }
.insp-lineage div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- download-dataset link --------------------------------------------- */
.navlink.download { color: var(--ok); border-color: rgba(16,185,129,.4); }
.navlink.download:hover { border-color: var(--ok); background: rgba(16,185,129,.08); }

/* ---- per-node download (CSV / JSON / TXT) ------------------------------ */
.insp-downloads { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin: 8px 0 2px; padding: 8px 10px; background: rgba(16,185,129,.05);
  border: 1px solid var(--border); border-radius: 6px; font-size: 11.5px; }
.insp-downloads .dl-lead { color: var(--muted); font-weight: 600; }
.dl-item { display: inline-flex; align-items: center; gap: 5px; }
.dl-item .dl-key { color: var(--text); font-family: 'SF Mono', monospace; font-size: 11px; }
.dl-fmt { color: var(--ok); text-decoration: none; text-transform: uppercase; font-size: 10px;
  font-weight: 700; letter-spacing: .3px; padding: 1px 5px; border: 1px solid rgba(16,185,129,.35);
  border-radius: 4px; }
.dl-fmt:hover { background: rgba(16,185,129,.12); border-color: var(--ok); }
