/* Metanyx trading dashboard. Source: Metanyx-AI/metanyx.ai, final green/black brand tokens. */
:root {
  --bg: #050806; --panel: #0a100c; --panel-2: #101a13; --text: #f5f8f5; --muted: #91a097; --line: #243329;
  --accent: #b6ff3b; --accent-soft: #182713; --accent-text: #071007;
  --brand-gradient: linear-gradient(110deg, #159447 0%, #55c936 48%, #b6ff3b 100%);
  --ok: #6ddd9e; --ok-bg: #102a1c; --warn: #f6c66d; --warn-bg: #30230f; --bad: #ff8e86; --bad-bg: #341916;
  --danger-text: #071007; --shadow: 0 1px 3px rgb(0 0 0 / .3);
  --radius: 10px; --sidebar: 236px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f3f6f3; --panel: #ffffff; --panel-2: #edf3ee; --text: #102017; --muted: #52665a; --line: #d7e2da;
  --accent: #356b0c; --accent-soft: #e9f5da; --accent-text: #ffffff;
  --ok: #17653c; --ok-bg: #e7f6ec; --warn: #8a4b08; --warn-bg: #fff3da; --bad: #b42318; --bad-bg: #ffebe9;
  --danger-text: #ffffff; --shadow: 0 1px 3px rgb(16 32 23 / .08);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text);
  font: 14px/1.5 "Segoe UI", Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; margin: .25rem 0 1.25rem; }
h2 { font-size: 1rem; font-weight: 650; margin: 1.25rem 0 .6rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
[hidden] { display: none !important; }

/* Shell: a sidebar grouped like the CLI, a slim top bar, the page. */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--panel); border-right: 1px solid var(--line); padding: 1rem .75rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 700; font-size: 1rem; color: var(--text); padding: .25rem .5rem 1rem; }
.brand:hover { text-decoration: none; }
.brand-mark { display: block; width: 40px; height: 40px; flex: 0 0 40px; }
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 1.2rem; font-weight: 750; letter-spacing: .015em; line-height: 1.2; white-space: nowrap; }
.brand-name .nyx { color: var(--accent); }
.brand-tagline { color: var(--muted); font: 9px/1.6 ui-monospace, Consolas, monospace; letter-spacing: .08em; white-space: nowrap; }
.brand-product { margin: .5rem 0 0; font: 10px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.sidebar nav a.active { box-shadow: inset 2px 0 var(--accent); }
::selection { background: var(--accent); color: var(--accent-text); }
.sidebar nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav-group { margin: .9rem .5rem .3rem; font-size: .7rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sidebar nav a { display: block; padding: .38rem .6rem; border-radius: 8px; color: var(--text); font-weight: 500; }
.sidebar nav a:hover { background: var(--panel-2); text-decoration: none; }
.sidebar nav a.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.sidebar-foot form { margin: 0; }
.sidebar-foot button { width: 100%; }
.wallet { font-size: .8rem; color: var(--muted); padding: 0 .5rem; }
.account-switch { margin: 0; }
.notice { background: var(--warn-bg); border-radius: 8px; padding: .6rem .85rem; }
.account-switch label { display: flex; align-items: center; gap: .4rem; font-size: .8rem; color: var(--muted); }
.account-switch select { max-width: 16rem; }
.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: .75rem; min-height: 52px;
  padding: .5rem 1.5rem; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); }
.topbar-status { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .9rem; flex: 1; font-size: .85rem; color: var(--muted); }
.topbar-status strong { color: var(--text); font-variant-numeric: tabular-nums; }
.menu-toggle { display: none; }
.wallet-chip { margin-left: auto; display: inline-flex; align-items: center; gap: .45rem; padding: .3rem .75rem; white-space: nowrap;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); font-size: .8rem; }
.wallet-chip:hover, .wallet-chip[aria-current] { border-color: var(--accent); }
.wallet-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--ok); flex: none; }
.wallet-dot.off { background: var(--muted); }
.wallet-role { color: var(--muted); font-size: .72rem; }
main { width: 100%; max-width: 1360px; margin: 0 auto; padding: 1.25rem 1.5rem 3rem; }
main.bare { max-width: none; padding: 0; }

/* Controls */
button, a.button { font: inherit; font-weight: 550; padding: .42rem .9rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); cursor: pointer; box-shadow: var(--shadow); }
button:hover, a.button:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); text-decoration: none; }
button[type=submit], button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button:disabled { cursor: not-allowed; opacity: .5; }
button.danger:not(:disabled) { border-color: color-mix(in srgb, var(--bad) 45%, var(--line)); color: var(--bad); }
input, select, textarea { font: inherit; padding: .42rem .6rem; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible, textarea:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
summary { cursor: pointer; font-weight: 600; }

/* Surfaces */
.banner { background: var(--warn-bg); color: var(--warn); padding: .5rem 1rem; text-align: center; font-weight: 600; }
.alert { background: var(--bad-bg); color: var(--bad); padding: .65rem .9rem; border-radius: 8px; }
.muted, .updated { color: var(--muted); }
.updated { font-size: .78rem; text-align: right; margin: .75rem 0 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; }
.nowrap { white-space: nowrap; }
.live, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem;
  margin-bottom: 1rem; box-shadow: var(--shadow); transition: opacity .2s; }
.live.stale { opacity: .55; }
.live > h2:first-child, .panel > h2:first-child { margin-top: 0; }
.scroll { overflow-x: auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .25rem 0 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .7rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { color: var(--muted); font-weight: 600; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; background: var(--panel-2); }
thead th:first-child { border-top-left-radius: 8px; } thead th:last-child { border-top-right-radius: 8px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.preview { max-width: 32rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.kv th { width: 40%; color: var(--muted); font-weight: 500; background: none; text-transform: none; letter-spacing: 0; font-size: .9rem; }
table.kv td { overflow-wrap: anywhere; }  /* Wallet addresses and ids wrap instead of widening the page. */
.gain-text { color: var(--ok); } .loss-text { color: var(--bad); }

/* Cards, pills, stats */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .75rem .9rem; display: flex; flex-direction: column; gap: .2rem; }
.card span { color: var(--muted); font-size: .75rem; font-weight: 550; text-transform: uppercase; letter-spacing: .04em; }
.card strong { font-size: 1.2rem; font-weight: 650; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.card.ok { background: var(--ok-bg); border-color: transparent; } .card.ok strong { color: var(--ok); }
.card.warn { background: var(--warn-bg); border-color: transparent; } .card.warn strong { color: var(--warn); }
.card.bad { background: var(--bad-bg); border-color: transparent; } .card.bad strong { color: var(--bad); }
.metrics .card:not(.warn) { background: var(--panel); }
.pill { display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 650; }
.pill::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.market-spot { background: var(--accent-soft); color: var(--accent); }
.pill.market-perp, .pill.market-carry { background: var(--warn-bg); color: var(--warn); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-bottom: 1rem; }
.filters label { display: flex; flex-direction: column; gap: .2rem; color: var(--muted); font-size: .85rem; }
.json { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; overflow-x: auto; }
.login { max-width: 380px; margin: 14vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 2rem; display: flex; flex-direction: column; gap: .9rem; box-shadow: var(--shadow); }
.login label { display: flex; flex-direction: column; gap: .25rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 5; left: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-block; }
  main { padding: 1rem; }
  .topbar { padding: .5rem 1rem; }
}
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } main { padding: .75rem; } }

/* Strategy Studio uses static editing surfaces beside independently refreshed diagnostics. */
[hidden] { display: none !important; }
.studio-hero { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 0 1.5rem; }
.studio-hero h1 { font-size: 2rem; letter-spacing: -.04em; margin: .4rem 0; }
.eyebrow { color: var(--accent); font-size: .72rem; font-weight: 700; letter-spacing: .12em; margin: 0; }
.studio-layout { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 1.2rem; align-items: start; }
.studio-panel { padding: 1.4rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); min-width: 0; }
.studio-panel h2 { margin-top: 0; }
.studio-panel input, .studio-panel select { min-width: 0; width: 100%; }
.studio-panel label { display: flex; flex-direction: column; gap: .4rem; font-weight: 600; }
.studio-panel small { font-weight: 400; color: var(--muted); }
.module-list { display: grid; gap: .7rem; margin-top: 1rem; }
.module-card { display: grid; gap: .5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 10px; color: var(--text); }
.module-card:hover { text-decoration: none; border-color: var(--accent); }
.module-card.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--panel)); }
.module-card .muted { font-size: .85rem; }
.module-meta { font-size: .75rem; color: var(--accent); }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.section-heading h2 { margin: .3rem 0; font-size: 1.25rem; }
.studio-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 1.2rem; margin: 1.3rem 0; }
.studio-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 1rem 0; }
.studio-actions label { flex: 1; }
.simulation-note { color: var(--muted); background: var(--bg); padding: .9rem; border-radius: 8px; font-size: .85rem; }
.studio-panel .live-confirm { display: flex; flex-direction: row; align-items: start; padding: 1rem; background: var(--warn-bg); color: var(--warn); border-radius: 8px; }
.live-confirm input { width: auto; margin-top: .25rem; }
button.live-launch[type=submit] { background: var(--bad); border-color: var(--bad); color: var(--danger-text); }
button:disabled { cursor: wait; opacity: .55; }
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.presets { border-top: 1px solid var(--line); padding-top: 1rem; }
summary { cursor: pointer; font-weight: 600; }
.run-library { margin-top: 1.2rem; }
.strategy-buttons { display: flex; flex-wrap: wrap; gap: .35rem; min-width: 210px; margin: .4rem 0; }
.strategy-buttons button { padding: .3rem .55rem; }
.strategy-buttons button:disabled { cursor: default; }
[data-control-feedback]:empty { display: none; }
[data-control-feedback] { max-width: 30rem; overflow-wrap: anywhere; }
@media (max-width: 800px) { .studio-layout { grid-template-columns: 1fr; } .module-list { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } }
@media (max-width: 520px) { .studio-fields { grid-template-columns: 1fr; } .studio-panel { padding: 1rem; } .studio-hero { align-items: start; } }

/* Irreversible actions and the library panel. */
button.danger:not(:disabled) { border-color: var(--bad); color: var(--bad); }
.library-add { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }
.library-add form { display: grid; gap: .7rem; margin-top: .7rem; }
.studio-panel label.inline { flex-direction: row; align-items: center; font-weight: 400; }
.studio-panel label.inline input { width: auto; }

/* Strategy READMEs and a run's settings form. */
.strategy-readme, .run-settings { margin: 1rem 0; }
.strategy-readme summary, .run-settings summary { cursor: pointer; font-weight: 600; }
.readme { max-width: 72rem; }
.readme h2, .readme h3, .readme h4 { margin: 1.2rem 0 .4rem; }
.readme pre { overflow-x: auto; padding: .75rem; border-radius: 6px; background: var(--panel-alt, rgba(127,127,127,.12)); }
.readme code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85em; }
.readme table { margin: .5rem 0; }

/* Reports: signal green leads; other series and loss/warning colours stay distinct. */
:root {
  --series-1: #b6ff3b; --series-2: #70c9f5; --series-3: #c5a0ff; --series-4: #f6c66d;
  --series-5: #f49bc1; --series-6: #6ddd9e; --series-7: #b7c7bd; --series-8: #ff8e86;
  --series-other: #91a097; --gain: #6ddd9e; --loss: #ff8e86;
}
:root[data-theme="light"] {
  --series-1: #356b0c; --series-2: #12618f; --series-3: #7448ab; --series-4: #8a4b08;
  --series-5: #a83269; --series-6: #17653c; --series-7: #52665a; --series-8: #b42318;
  --series-other: #65756b; --gain: #17653c; --loss: #b42318;
}
.report-filters { display: flex; flex-wrap: wrap; align-items: end; gap: .5rem 1rem; margin-bottom: 1rem; }
.report-filters label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.report-filters label.inline { flex-direction: row; align-items: center; }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 1rem; margin: 1rem 0; }
.chart-box { margin: 0; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); min-width: 0; }
.chart-box figcaption { font-weight: 600; margin-bottom: .5rem; }
.chart { width: 100%; height: auto; display: block; }
.donut-box { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; }
.donut-box figcaption { flex-basis: 100%; }
.donut { max-width: 200px; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis-zero { stroke: var(--muted); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--panel); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--muted); fill-opacity: .25; }
.chart .bar:hover, .chart .slice:hover { opacity: .8; }
.chart .slice { stroke: var(--panel); stroke-width: 2; }
.legend { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .85rem; }
.donut-box .legend { flex-direction: column; margin: 0; }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .4rem; vertical-align: -1px; }

/* Series slots, gain/loss and the 'other' fold. */
.chart .line.s1 { stroke: var(--series-1); } .chart .dot.s1, .chart .bar.s1, .chart .slice.s1, .swatch.s1 { fill: var(--series-1); background: var(--series-1); }
.chart .line.s2 { stroke: var(--series-2); } .chart .dot.s2, .chart .bar.s2, .chart .slice.s2, .swatch.s2 { fill: var(--series-2); background: var(--series-2); }
.chart .line.s3 { stroke: var(--series-3); } .chart .dot.s3, .chart .bar.s3, .chart .slice.s3, .swatch.s3 { fill: var(--series-3); background: var(--series-3); }
.chart .line.s4 { stroke: var(--series-4); } .chart .dot.s4, .chart .bar.s4, .chart .slice.s4, .swatch.s4 { fill: var(--series-4); background: var(--series-4); }
.chart .line.s5 { stroke: var(--series-5); } .chart .dot.s5, .chart .bar.s5, .chart .slice.s5, .swatch.s5 { fill: var(--series-5); background: var(--series-5); }
.chart .line.s6 { stroke: var(--series-6); } .chart .dot.s6, .chart .bar.s6, .chart .slice.s6, .swatch.s6 { fill: var(--series-6); background: var(--series-6); }
.chart .line.s7 { stroke: var(--series-7); } .chart .dot.s7, .chart .bar.s7, .chart .slice.s7, .swatch.s7 { fill: var(--series-7); background: var(--series-7); }
.chart .line.s8 { stroke: var(--series-8); } .chart .dot.s8, .chart .bar.s8, .chart .slice.s8, .swatch.s8 { fill: var(--series-8); background: var(--series-8); }
.chart .line.other { stroke: var(--series-other); } .chart .dot.other, .chart .bar.other, .chart .slice.other, .swatch.other { fill: var(--series-other); background: var(--series-other); }
.chart .line.gain { stroke: var(--gain); } .chart .dot.gain, .chart .bar.gain, .chart .slice.gain, .swatch.gain { fill: var(--gain); background: var(--gain); }
.chart .line.loss { stroke: var(--loss); } .chart .dot.loss, .chart .bar.loss, .chart .slice.loss, .swatch.loss { fill: var(--loss); background: var(--loss); }
.chart circle.slice { fill: none; }
.chart circle.slice.s1 { stroke: var(--series-1); }
.chart circle.slice.s2 { stroke: var(--series-2); }
.chart circle.slice.s3 { stroke: var(--series-3); }
.chart circle.slice.s4 { stroke: var(--series-4); }
.chart circle.slice.s5 { stroke: var(--series-5); }
.chart circle.slice.s6 { stroke: var(--series-6); }
.chart circle.slice.s7 { stroke: var(--series-7); }
.chart circle.slice.s8 { stroke: var(--series-8); }
.chart circle.slice.other { stroke: var(--series-other); }
.chart circle.slice.gain { stroke: var(--gain); }
.chart circle.slice.loss { stroke: var(--loss); }

/* Advanced launch parameters. */
.advanced-parameters { margin: 1rem 0; }
.advanced-parameters summary { cursor: pointer; font-weight: 600; }
.advanced-table td, .advanced-table th { vertical-align: middle; }
.advanced-table input:not([type=checkbox]), .advanced-table select { width: 100%; min-width: 8rem; }
.advanced-table tr:has(input[data-advanced-toggle]:checked) { background: var(--warn-bg); }

/* Link-style operations (Clone) sit in the button row. */
.strategy-buttons a.button { display: inline-block; font: inherit; padding: .3rem .55rem; border-radius: 6px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); text-decoration: none; }
.strategy-buttons a.button:hover { border-color: var(--accent); }
.code-version { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; margin: 1rem 0; }
.code-version label.inline { display: flex; flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; }
/* Trade page */
.trade-desk { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.trade-form { border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.trade-form h2 { margin: 0; }
.trade-form label { display: flex; flex-direction: column; gap: .2rem; }
.trade-form.panic { border-color: var(--bad); }
.panic-log { max-height: 18rem; overflow: auto; white-space: pre-wrap; font-size: .8rem; margin: 0; }
.sidebar-foot button[type=submit].plain { background: var(--panel); color: var(--text); border-color: var(--line); }
/* The sidebar's column stays white the full height of long pages. */
.shell { background: linear-gradient(to right, var(--panel) calc(var(--sidebar) - 1px), var(--line) calc(var(--sidebar) - 1px), var(--line) var(--sidebar), transparent var(--sidebar)); }
.sidebar { border-right: 0; }
table.strategies td { white-space: nowrap; }
@media (max-width: 960px) { .shell { background: none; } .sidebar { border-right: 1px solid var(--line); } }
/* Grids never force a column wider than the screen; their tables scroll inside. */
.grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid > *, .chart-grid > * { min-width: 0; }
@media (max-width: 520px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .card strong { font-size: 1rem; }
  .live, .panel { padding: .9rem; }
}
/* Backtests */
.backtest-options { border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; margin: 1rem 0; background: var(--panel-2); }
.backtest-options legend { font-weight: 650; padding: 0 .4rem; }
.backtest-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem 1rem; margin: .75rem 0; align-items: start; }
.backtest-grid label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; }
.inline-options { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .3rem; }
.inline-options legend { font-weight: 600; padding: 0; margin-bottom: .3rem; }
.inline-options label.inline { flex-direction: row; align-items: center; gap: .4rem; font-weight: 500; }
.progress { height: 8px; border-radius: 999px; background: var(--line); overflow: hidden; margin: .5rem 0; }
.progress > span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.leg-head { display: flex; align-items: center; gap: .5rem; }
.compare td.best { font-weight: 700; }
/* A lone chart keeps its half width instead of stretching (and scaling its text) across the page. */
.chart-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }
table.compare { font-size: .88rem; }
table.compare th, table.compare td { padding: .45rem .5rem; white-space: nowrap; }
/* Claude in the Studio */
.claude-fab { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 20; border-radius: 999px; padding: .6rem 1.1rem;
  background: var(--accent); border-color: var(--accent); color: var(--accent-text); box-shadow: 0 6px 20px rgba(16, 24, 40, .18); }
.claude-panel { position: fixed; right: 1.25rem; bottom: 4.5rem; z-index: 21; width: min(460px, calc(100vw - 2rem)); height: min(640px, 75vh);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .22); overflow: hidden; }
.claude-panel.inline { position: static; width: 100%; height: 560px; box-shadow: none; }
.claude-panel header { display: flex; align-items: center; gap: .5rem; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.claude-panel header .muted { flex: 1; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.claude-panel header button { padding: .2rem .6rem; box-shadow: none; }
.claude-log { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .6rem; }
.claude-entry { padding: .55rem .75rem; border-radius: 10px; overflow-wrap: anywhere; font-size: .92rem; }
.claude-entry.user { align-self: flex-end; max-width: 85%; background: var(--accent-soft); }
.claude-entry.assistant { background: var(--panel-2); }
.claude-entry.tool { font-size: .8rem; padding: .3rem .6rem; border-left: 3px solid var(--line); border-radius: 0; }
.claude-entry.error { background: var(--bad-bg); color: var(--bad); }
.claude-tool { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-weight: 600; }
.claude-code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem; overflow-x: auto;
  font-size: .8rem; white-space: pre; }
pre.diff { max-height: 32rem; }
.claude-panel form { border-top: 1px solid var(--line); padding: .6rem .8rem; display: flex; flex-direction: column; gap: .4rem; }
.claude-panel textarea { width: 100%; resize: vertical; }
.claude-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
tr.changed td { background: var(--warn-bg); }

/* Local brand assets and a compact, responsive wallet sign-in. */
.login { width: calc(100% - 2rem); max-width: 430px; margin: 10vh auto; border-top: 2px solid var(--accent); }
.login .brand { padding: 0 0 1rem; border-bottom: 1px solid var(--line); }
.login h1 { margin: .5rem 0 0; font-size: 1.5rem; }
.login p { margin: 0; }
.login [data-wallet-connect] { min-height: 44px; margin-top: .5rem; }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* Charts over time (static/timechart.js): drag to zoom, a cursor readout and zoom buttons. */
.timechart-box figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.timechart-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; font-weight: 400; }
.timechart-tools button.small { padding: .15rem .55rem; min-width: 2rem; }
.timechart-tools label.small { font-size: .85rem; }
.timechart-range { font-size: .85rem; }
.timechart .timechart-hit { fill: transparent; cursor: crosshair; touch-action: none; }
.timechart .timechart-cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.timechart .timechart-select { fill: var(--series-2); fill-opacity: .18; stroke: var(--series-2); stroke-width: 1; pointer-events: none; }
.timechart-readout { font-size: .85rem; min-height: 1.3em; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.report-period { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: end; border: 1px solid var(--line); border-radius: 8px; padding: .35rem .75rem .6rem; margin: 0; }
.report-period legend { font-size: .85rem; color: var(--muted); padding: 0 .25rem; }
.timechart-legend button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; }
.timechart-legend button.off { opacity: .45; text-decoration: line-through; }
.timechart-legend button:focus-visible { outline: 2px solid var(--series-2); outline-offset: 2px; border-radius: 4px; }

/* The Orchestrator page's chat with its Claude (static/orchestrator_chat.js). */
.orc-chat { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); padding: .75rem 1rem; margin: 0 0 1rem; }
.orc-chat-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.orc-chat-head h2 { margin: 0; font-size: 1.1rem; }
.orc-chat-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.orc-chat-tools select { max-width: min(60vw, 26rem); }
.orc-chat-help { margin: .4rem 0 .6rem; font-size: .9rem; }
.orc-chat-log { max-height: 26rem; overflow-y: auto; display: flex; flex-direction: column; gap: .45rem; padding: .25rem 0; }
.orc-chat-log:empty { display: none; }
.orc-chat-entry { font-size: .92rem; overflow-wrap: anywhere; }
.orc-chat-entry.owner { align-self: flex-end; text-align: right; max-width: 85%; }
.orc-chat-bubble { display: inline-block; text-align: left; background: color-mix(in srgb, var(--series-2) 18%, transparent); border-radius: 10px; padding: .45rem .7rem; }
.orc-chat-entry.claude { max-width: 92%; }
.orc-chat-reply { border-left: 3px solid var(--series-1); padding: .1rem 0 .1rem .7rem; }
.orc-chat-reply p { margin: .3rem 0; }
.orc-chat-entry.action { font-size: .85rem; padding-left: .7rem; }
.orc-chat-entry.note { font-size: .88rem; padding-left: .7rem; }
.orc-chat-time { font-size: .75rem; margin-left: .35rem; }
.orc-chat-form { display: flex; gap: .5rem; align-items: flex-end; margin-top: .5rem; }
.orc-chat-form textarea { flex: 1; min-width: 0; resize: vertical; }
.orc-chat-status { min-height: 1.2em; margin: .35rem 0 0; font-size: .85rem; }
.narrow-number { width: 5em; }
fieldset.card { margin: 0; display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: center; }
fieldset.card legend { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 0 .25rem; }

/* Tabs (Running and Archive: All, Spot, Perp). */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 0 0 1rem; overflow-x: auto; }
.tabs a { padding: .5rem 1rem; border-radius: 8px 8px 0 0; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-bottom: 0; white-space: nowrap; }
.tabs a:hover { color: var(--text, inherit); background: var(--panel); }
.tabs a[aria-current="page"] { color: var(--text, inherit); background: var(--panel); border-color: var(--line); font-weight: 600; margin-bottom: -1px; }
