:root {
  color-scheme: dark;
  --bg: #0a0e1a;
  --surface: #111827;
  --surface-2: #1a1f2e;
  --chart-bg: #0d1117;
  --border: #1e2a3a;
  --text: #e5e7eb;
  --text-2: #9ca3af;
  --text-3: #6b7280;
  --accent: #22c55e;
  --accent-soft: rgba(34, 197, 94, 0.12);
  --cyan: #06b6d4;
  --good: #22c55e;
  --bad: #ef4444;
  --warn: #eab308;
  --warn-bg: rgba(234, 179, 8, 0.15);
  --is-shade: rgba(34, 197, 94, 0.06);
  --os-shade: rgba(234, 179, 8, 0.08);
  --grid: #1e2a3a;
  --axis: #4b5563;
  --s1: #22c55e; --s2: #06b6d4; --s3: #eab308; --s4: #ef4444; --s5: #a855f7;
  --s6: #f97316; --s7: #ec4899; --s8: #14b8a6; --s9: #6366f1; --s10: #84cc16;
  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  --radius: 8px;
  --topbar-h: 48px;
  --bottombar-h: 60px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font-sans);
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-weight: 600; }
h2, h3, details.acc > summary, .chart-title {
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-2);
}
h2 { margin-bottom: 12px; }
h3 { font-size: 11px; margin-bottom: 8px; }
a { color: var(--cyan); }
button, select, input {
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  min-height: 32px;
}
select, input { font-size: 13px; }
input::placeholder { color: var(--text-3); }
button:focus-visible, select:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
input[type="checkbox"], input[type="radio"] { min-height: 0; width: 16px; height: 16px; margin: 0 6px 0 0; vertical-align: -3px; accent-color: var(--accent); box-shadow: none; }
button { cursor: pointer; font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
button:hover { background: var(--border); color: var(--text); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 600; }
button.primary:hover { filter: brightness(1.1); color: var(--bg); }
button.small { padding: 2px 8px; min-height: 26px; }
button.danger { color: var(--bad); }
button:disabled { opacity: 0.5; cursor: default; }
label.field { display: inline-flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-2); }
label.field > input, label.field > select { font-size: 13px; color: var(--text); }
.changed { font-weight: 700; }
.muted { color: var(--text-3); }
.strong { color: var(--text); font-weight: 600; }
.factor-body { display: flex; flex-direction: column; gap: 12px; }
.factor-rolling { display: flex; flex-direction: column; gap: 8px; }
.factor-rolling .chart.row { height: 440px; }
.factor-table table.tbl td.num, .factor-table table.tbl th.num { text-align: center; }
.factor-stats { display: flex; flex-wrap: wrap; gap: 4px 24px; margin-top: 8px; font-family: var(--font-mono); font-size: 12px; }
.factor-stats b { color: var(--text); font-weight: 600; }
.small { font-size: 12px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.amber { color: var(--warn); }
.hidden { display: none !important; }
.cyan { color: var(--cyan); }
.spacer { flex: 1; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

#topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand {
  flex: 0 0 auto; margin: 0 16px 0 0; text-decoration: none;
  font-family: var(--font-sans); font-weight: 700; font-size: 26px; letter-spacing: 0.02em; color: var(--text);
}
a.brand:hover { color: #fff; }
#tabs { display: flex; gap: 4px; height: 100%; }
#tabs a {
  display: flex; align-items: center;
  text-decoration: none; color: var(--text-2); padding: 0 14px; font-weight: 500; font-size: 13px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
#tabs a:hover { color: var(--text); }
#tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }
#engine-wrap { position: relative; display: flex; align-items: center; gap: 8px; margin-left: auto; }
#engine-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 12px; border-radius: 999px; font-family: var(--font-mono); font-size: 11px; color: var(--text-2); white-space: nowrap; }
#engine-toggle .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; }
#engine-toggle .dot.off { background: var(--bad); }
#engine-pill { display: none; position: absolute; right: 0; top: 40px; z-index: 25; border-radius: var(--radius); padding: 10px 12px; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 240px; box-shadow: 0 6px 20px rgba(0,0,0,0.5); }
#engine-pill.open { display: flex; }
#engine-pill button { margin-top: 6px; }
#engine-pill .kv { display: flex; gap: 6px; align-items: baseline; }
#engine-pill ul.loaded { list-style: none; margin: 0; padding: 0; }
#engine-pill ul.loaded li { color: var(--text); font-weight: 600; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; padding: 0; font-size: 14px; }
#logout[hidden] { display: none; }

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-card label.field { display: flex; }
.login-card input { width: 100%; }
.login-card button { min-height: 36px; font-size: 12px; }
.login-error { margin: 0; font-size: 12px; color: var(--bad); }
.login-error[hidden] { display: none; }
.pill {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 6px 3px 12px;
}
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); display: inline-block; }
.pill .dot.off { background: var(--bad); }
.pill .kv b { color: var(--text); font-weight: 600; }

#banner {
  position: sticky; top: var(--topbar-h); z-index: 19;
  display: flex; align-items: flex-start; gap: 10px;
  margin: 8px 16px 0; padding: 8px 12px;
  background: var(--warn-bg); border: 1px solid var(--warn); border-radius: var(--radius);
  color: var(--text); white-space: pre-wrap; word-break: break-word;
}
#banner[hidden] { display: none; }
#banner.error { border-color: var(--bad); background: rgba(239, 68, 68, 0.12); }
#banner > span { flex: 1; }
#banner button { min-height: 24px; padding: 0 8px; }

#main { padding: 12px 16px 24px; max-width: 1600px; margin: 0 auto; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.grid-2 > *, .chart-grid > *, .bt-layout > * { min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 30px; padding: 3px 12px; background: var(--surface); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.active { background: var(--accent-soft); color: var(--accent); }
.status { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.status.jobs { display: flex; flex-direction: column; gap: 4px; min-height: 16px; }
.status.jobs:empty { display: none; }
.status.jobs .job-list { display: flex; flex-direction: column; gap: 2px; max-height: 64px; overflow-y: auto; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); }
.status.jobs .job { flex: 0 0 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status.validation { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.status.validation:empty { display: none; }
.status.validation .checks { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.status.validation .check { padding: 1px 6px; border-radius: 4px; border: 1px solid var(--border); cursor: help; }
.status.validation .check.pass { color: var(--good); }
.status.validation .check.fail { color: var(--bad); border-color: var(--bad); }
.status .state-done { color: var(--good); }
.status .state-error { color: var(--bad); }
.status .state-running, .status .state-loading, .status .state-queued { color: var(--cyan); }
.status .has-detail { cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.err-inline { color: var(--bad); font-size: 12px; }
.note { font-size: 12px; color: var(--text-2); background: var(--surface-2); padding: 6px 8px; border-radius: 4px; }

.tiles { display: grid; grid-template-columns: repeat(var(--tile-cols, 6), minmax(0, 1fr)); gap: 12px; }
.report { --tile-cols: 5; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.tile.wide { grid-column: span 2; }
.tile .k { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .v { font-family: var(--font-mono); font-size: 26px; font-weight: 700; line-height: 1.3; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .sub { font-family: var(--font-mono); font-size: 10px; color: var(--text-3); margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.dim .v { font-size: 13px; color: var(--text-2); font-weight: 500; white-space: normal; line-height: 1.6; }

.tbl-wrap { overflow-x: auto; max-width: 100%; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.tbl { border-collapse: separate; border-spacing: 0; width: 100%; font-family: var(--font-mono); font-size: 12px; }
table.tbl th, table.tbl td { padding: 6px 10px; white-space: nowrap; border-bottom: 1px solid var(--border); }
table.tbl th { position: sticky; top: 0; background: var(--surface-2); color: var(--text-2); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; text-align: left; cursor: pointer; user-select: none; z-index: 2; }
table.tbl th:hover { color: var(--cyan); }
table.tbl th.num, table.tbl td.num { text-align: right; }
table.tbl th.center, table.tbl td.center { text-align: center; }
table.tbl th .arrow { color: var(--accent); font-size: 9px; margin-left: 3px; }
table.tbl th.sortable-ghost { opacity: 0.4; }
table.tbl th.sortable-chosen { box-shadow: inset 3px 0 0 var(--cyan); }
table.tbl tbody tr:hover td { background: var(--surface-2); }
table.tbl tfoot td { font-weight: 600; background: var(--surface-2); border-top: 2px solid var(--border); }
table.tbl tbody tr.pinned td { font-weight: 600; background: var(--surface-2); border-bottom: 2px solid var(--border); }
table.tbl tfoot tr.sub td { font-weight: 400; color: var(--text-2); border-top: 0; }
table.tbl.sticky-first th:first-child, table.tbl.sticky-first td:first-child { position: sticky; left: 0; z-index: 3; background: var(--surface); }
table.tbl.sticky-first th:first-child { z-index: 4; background: var(--surface-2); }
table.tbl.sticky-first tfoot td:first-child { background: var(--surface-2); }
table.tbl.with-index th.idx, table.tbl.with-index td.idx { width: 44px; min-width: 44px; box-sizing: border-box; text-align: right; color: var(--text-3); cursor: default; }
table.tbl.with-index th.idx:hover { color: var(--text-3); }
table.tbl.sticky-first.with-index th:nth-child(2), table.tbl.sticky-first.with-index td:nth-child(2) { position: sticky; left: 44px; z-index: 3; background: var(--surface); }
table.tbl.sticky-first.with-index th:nth-child(2) { z-index: 4; background: var(--surface-2); }
table.tbl td.empty { color: var(--text-3); }
.tbl-wrap.scroll { max-height: 360px; overflow-y: auto; }
.tbl-wrap.compact table.tbl td, .tbl-wrap.compact table.tbl th { padding: 3px 6px; }
.tbl-wrap.compact table.tbl td { font-size: 11px; }

.chart { width: 100%; height: 380px; min-height: 200px; background: var(--chart-bg); border-radius: 6px; }
.chart.tall { height: 480px; }
.chart.eqdd { height: 560px; }
.corr-heat { overflow-x: auto; background: var(--chart-bg); border-radius: 6px; }
.chart.row { height: 300px; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.report-head .report-title { font-size: 15px; }
.report-head label.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); cursor: pointer; }
.report .empty, .bt-right .empty { padding: 48px 16px; text-align: center; color: var(--text-3); font-size: 13px; }

.chain { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; align-items: flex-start; }
.block-card { min-width: 230px; max-width: 280px; flex: 0 0 auto; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px; }
.block-card .hdr { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-bottom: 6px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.5px; color: var(--text-2); text-transform: uppercase; }
.block-card .hdr .ops { display: flex; gap: 2px; }
.block-card .hdr .ops button { min-height: 22px; padding: 0 6px; font-size: 12px; }
.block-card select { width: 100%; background: var(--surface); }
.block-card .doc { font-size: 11px; color: var(--text-3); margin: 4px 0 6px; }
.params { display: flex; flex-direction: column; gap: 4px; }
.params label { display: grid; grid-template-columns: 1fr 110px; align-items: center; gap: 6px; font-size: 12px; }
.params label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.params input[type="text"], .params input[type="number"] { min-height: 26px; padding: 2px 6px; font-size: 12px; width: 100%; background: var(--surface); font-family: var(--font-mono); }
.params .chk { justify-self: start; }
.add-block { flex: 0 0 auto; align-self: center; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0; }
.sim-variants .toolbar.run { margin-top: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags .tag { display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 0 10px; border-radius: 999px; font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }
.tags .tag .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.tags .tag.active { color: var(--text); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.chip { flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 8px; min-width: 150px; max-width: 260px; cursor: pointer; }
.chip.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.chip .top { display: flex; gap: 6px; align-items: center; }
.chip .top input { min-height: 24px; padding: 1px 6px; font-size: 12px; width: 100px; background: var(--surface); }
.chip .top .x { margin-left: auto; min-height: 22px; padding: 0 6px; }
.chip .diff { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); white-space: normal; word-break: break-all; }
.chip .diff b { color: var(--text); }
details.acc { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
details.acc > summary { cursor: pointer; padding: 8px 12px; font-weight: 600; }
details.acc > summary:hover { color: var(--text); }
details.acc > .body { padding: 0 12px 12px; }
details.fold { padding: 0; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary > h2 { margin: 0; }
details.fold > summary:hover > h2 { color: var(--text); }
details.fold > summary::after { content: ''; width: 7px; height: 7px; margin-right: 4px; border-right: 1.5px solid var(--text-3); border-bottom: 1.5px solid var(--text-3); transform: translateY(-2px) rotate(45deg); transition: transform 0.15s; }
details.fold[open] > summary::after { transform: translateY(2px) rotate(225deg); }
details.fold > .fold-body { width: auto; margin: 0 16px 16px; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 20px; font-family: var(--font-mono); font-size: 12px; }
.metrics-grid > .mcol { min-width: 0; }
.mrow { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.mrow .k { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mrow .v { text-align: right; flex: 0 0 auto; }
.mrow .v.empty { color: var(--text-3); }
.mrow .sub { display: block; font-size: 10px; color: var(--text-3); }

.bt-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.bt-left { position: sticky; top: calc(var(--topbar-h) + 12px); max-height: calc(100vh - var(--topbar-h) - 24px); overflow-y: auto; }
.bt-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.bt-head h2 { margin: 0; }
.bt-toggle { display: none; }
.bt-left .seg { align-self: stretch; }
.bt-left .seg button { flex: 1; }
.bt-left .pane input[type="search"] { width: 100%; min-width: 0; }
.bt-left .toolbar.actions { flex-wrap: nowrap; gap: 6px; }
.bt-left .toolbar.actions button { flex: 1; padding: 2px 4px; white-space: nowrap; }
.bt-left .pane > button.primary { align-self: stretch; }
.bt-left .list { display: flex; flex-direction: column; max-height: 400px; overflow-y: auto; }
.report-head > button { white-space: nowrap; }
.bt-row { display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 8px; border-radius: 4px; border-bottom: 1px solid var(--border); }
.bt-row:last-child { border-bottom: 0; }
label.bt-row { cursor: pointer; }
.bt-row .main { flex: 1; min-width: 0; cursor: pointer; }
.bt-row .main:hover .name { color: var(--cyan); }
.bt-row .name { font-size: 13px; font-weight: 500; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bt-row .metrics, .bt-members > .metrics { font-family: var(--font-mono); font-size: 10.5px; line-height: 1.5; color: var(--text-2); white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.bt-row:hover { background: var(--surface-2); }
.bt-row.active { background: var(--accent-soft); }
.bt-row.active .name { color: var(--accent); }
.bt-row.disabled { opacity: 0.5; }
.bt-row.disabled .main { cursor: not-allowed; }
.bt-row input[type="checkbox"], .bt-row input[type="radio"] { margin: 0; flex: 0 0 auto; }
.bt-members { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; gap: 10px; }
.bt-members h3 { margin: 0; }
.bt-members .list { max-height: 260px; }
.bt-body .divider { border-top: 1px solid var(--border); }
.bt-body .row > label.field { flex: 1 1 45%; }
.bt-body .row.full > label.field { flex: 1 1 100%; }
.bt-body .row > label.field > input, .bt-body .row > label.field > select { width: 100%; min-width: 0; }

.live-hdr { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.live-hdr .trader-pick { min-width: 170px; font-weight: 600; }
.live-status { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.card.positions { gap: 10px; }
.card.positions h2 { margin-bottom: 0; }
.exposure .bar-row { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.exposure .bar { flex: 1; height: 6px; border-radius: 3px; overflow: hidden; display: flex; background: var(--surface-2); }
.exposure .bar .long { background: var(--good); opacity: 0.75; }
.exposure .bar .short { background: var(--bad); opacity: 0.75; margin-left: auto; }
.exposure .net { margin-top: 4px; text-align: center; font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.totals { display: flex; flex-wrap: wrap; gap: 8px 56px; margin-top: 10px; padding: 12px 10px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); font-family: var(--font-mono); }
.totals .stat { display: flex; flex-direction: column; gap: 2px; }
.totals .k { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.5px; }
.totals .v { font-size: 13px; font-weight: 600; }
.funding-list { display: none; }
.funding-list .b { display: flex; justify-content: space-between; padding: 6px 8px; border-bottom: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; }

@media (max-width: 1100px) {
  .tiles { --tile-cols: 4; gap: 8px; }
  .tile { padding: 12px; }
  .tile .v { font-size: 22px; }
  .bt-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .tile.wide { grid-column: span 2; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  body { padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); }
  #topbar { justify-content: space-between; }
  .brand { margin-right: 0; }
  #tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0;
    background: var(--surface); border-top: 1px solid var(--border);
  }
  #tabs a { display: flex; align-items: center; justify-content: center; font-size: 14px; padding: 0; margin: 0; border-bottom: 0; border-top: 2px solid transparent; }
  #tabs a.active { border-top-color: var(--accent); background: rgba(34, 197, 94, 0.05); }
  #engine-toggle { width: 36px; padding: 0; justify-content: center; }
  #engine-toggle .sum { display: none; }
  #main { padding: 10px 16px 16px; }
  .tiles { --tile-cols: 2; gap: 8px; }
  .tile { padding: 12px; }
  .tile .k { font-size: 10px; }
  .totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 10px; margin-top: 6px; }
  .totals .v .pct { display: block; font-size: 11px; font-weight: 500; }
  .tile .v { font-size: 20px; }
  .chart, .chart.tall { height: 260px; }
  .chart.eqdd { height: 360px; }
  .chart.row { height: 260px; }
  .grid-2 { grid-template-columns: 1fr; }
  .factor-rolling .chart.row { height: 300px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .chain { flex-direction: column; overflow-x: visible; }
  .block-card { min-width: 0; max-width: none; width: 100%; }
  .add-block { align-self: stretch; }
  .bt-layout { grid-template-columns: 1fr; }
  .bt-left { position: static; max-height: none; overflow: visible; }
  .bt-toggle { display: inline-flex; }
  .bt-left:not(.open) .bt-body { display: none; }
  .bt-left:not(.open) .bt-head { margin-bottom: 0; }
  .bt-left .list { max-height: 300px; }
  .funding-list { display: block; }
  .row > label.field { flex: 1 1 45%; }
  .row > label.field > input, .row > label.field > select { width: 100%; }
}
