/* STRATA design tokens: strict black / white / neutral gray. No hue anywhere. */
:root {
  --bg: #050505; --panel: #0e0e0e; --panel2: #161616; --raise: #1e1e1e; --line: #1f1f1f; --line2: #333;
  --mute: #8a8a8a; --dim: #b4b4b4; --fg: #ededed; --white: #fff;
  --font: "Inter", "Segoe UI", system-ui, sans-serif; --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --r: 8px; --gap: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 14px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--white); text-decoration-color: var(--line2); }
button, input, select, textarea { font: inherit; color: var(--fg); background: var(--panel2); border: 1px solid var(--line2); border-radius: var(--r); }
button, .btn { padding: 7px 14px; cursor: pointer; border-radius: 6px; }
.btn { display: inline-block; text-decoration: none; color: var(--fg); background: var(--panel2); border: 1px solid var(--line2); font-size: 14px; }
.btn:hover { border-color: var(--dim); }
button.lg { padding: 10px 20px; font-size: 15px; }
button:hover { border-color: var(--dim); }
button.primary { background: var(--white); color: #000; border-color: var(--white); font-weight: 600; }
button.primary:hover { background: #d4d4d4; }
button.ghost { background: transparent; border-color: transparent; color: var(--dim); }
button.ghost:hover, button.ghost.on { color: var(--white); border-color: var(--line2); }
button:disabled { opacity: .4; cursor: default; }
input, select, textarea { padding: 7px 10px; border-radius: 6px; }
textarea { width: 100%; font-family: var(--mono); font-size: 12px; }
:focus-visible { outline: 1px solid var(--white); outline-offset: 1px; }

#app { display: grid; grid-template-columns: 180px 1fr; grid-template-rows: 54px 1fr; height: 100vh; }
#top { grid-column: 1 / 3; display: flex; align-items: center; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
#brand { font-weight: 700; letter-spacing: .3em; font-size: 15px; width: 140px; }
#gsearch { flex: 1; max-width: 520px; position: relative; }
#gsearch input { width: 100%; }
#gresults { position: absolute; top: 34px; left: 0; right: 0; background: var(--panel2); border: 1px solid var(--line2); z-index: 50; max-height: 420px; overflow: auto; }
#gresults div { padding: 6px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
#gresults div:hover { background: var(--raise); }
#topstatus { margin-left: auto; display: flex; gap: 14px; color: var(--mute); font-size: 12px; }
#nav { border-right: 1px solid var(--line); overflow-y: auto; padding: 16px 10px; background: var(--bg); display: flex; flex-direction: column; gap: 2px; }
#nav .grp { color: var(--mute); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; padding: 12px 16px 4px; }
#nav a { display: block; padding: 10px 14px; color: var(--dim); text-decoration: none; border-radius: 6px; font-size: 15px; }
#nav .navfoot { margin-top: auto; padding: 14px; font-size: 11px; color: var(--mute); }
#nav a:hover { color: var(--white); }
#nav a.on { color: #000; background: var(--white); font-weight: 600; }
#main { overflow-y: auto; padding: 28px 36px 60px; }
#menu { display: none; }

h1 { font-size: 26px; font-weight: 600; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 600; margin: 0 0 12px; color: var(--white); }
h3 { font-size: 15px; margin: 0 0 6px; }
.sub { color: var(--mute); margin-bottom: 14px; }
.grid { display: grid; gap: var(--gap); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span2 { grid-column: span 2; } .span3 { grid-column: span 3; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.sp { justify-content: space-between; }
.kpi { font: 600 20px var(--mono); color: var(--white); }
.kl { color: var(--mute); font-size: 12px; }
.mono { font-family: var(--mono); }
.mute { color: var(--mute); } .dim { color: var(--dim); } .small { font-size: 12.5px; }
.tag { display: inline-block; border: 1px solid var(--line2); color: var(--dim); padding: 0 6px; border-radius: 2px; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
.tag.solid { background: var(--white); color: #000; border-color: var(--white); }
.tag.dash { border-style: dashed; }
.warnbox { border: 1px dashed var(--line2); padding: 10px 12px; color: var(--dim); border-radius: var(--r); margin: 8px 0; }
.soon { border: 1px dashed var(--mute); padding: 14px; text-align: center; color: var(--dim); border-radius: var(--r); }
.soon b { color: var(--white); letter-spacing: .14em; display: block; margin-bottom: 4px; font-size: 11px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--mute); font-weight: 500; border-bottom: 1px solid var(--line2); padding: 5px 6px; white-space: nowrap; position: sticky; top: 0; background: var(--panel); }
td { border-bottom: 1px solid var(--line); padding: 7px 8px; }
td.n, th.n { text-align: right; font-family: var(--mono); }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--panel2); }
.scroll { max-height: 420px; overflow: auto; }
.chart { width: 100%; height: 460px; }
.chart.sm { height: 220px; } .chart.md { height: 320px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { border: none; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--mute); }
.tabs button.on { color: var(--white); border-bottom-color: var(--white); }
.feed { font-size: 12px; max-height: 380px; overflow: auto; }
.feed div { padding: 5px 0; border-bottom: 1px solid var(--line); }
.feed .who { color: var(--white); font-weight: 600; margin-right: 6px; }
.empty { color: var(--mute); padding: 24px; text-align: center; border: 1px dashed var(--line2); border-radius: var(--r); }
.loading { color: var(--mute); padding: 18px; }
.loading::after { content: " ..."; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.err { border: 1px solid var(--dim); padding: 10px; color: var(--white); background: var(--panel2); border-radius: var(--r); white-space: pre-wrap; }
.mkt { display: flex; gap: 4px; }
.mkt button.on { background: var(--white); color: #000; }
.wl div { display: flex; justify-content: space-between; padding: 5px 6px; cursor: pointer; border-bottom: 1px solid var(--line); }
.wl div.on, .wl div:hover { background: var(--panel2); }
.md { line-height: 1.6; }
.md code { font-family: var(--mono); background: var(--panel2); padding: 0 4px; }
.md table { margin: 8px 0; }
.md a.wl { text-decoration: underline dotted; cursor: pointer; }
.check { display: flex; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.check .st { width: 46px; flex: none; font: 600 10px var(--mono); }
.st.pass { color: var(--white); } .st.warn { color: var(--dim); } .st.fail { color: var(--mute); text-decoration: line-through; }
.tree div { padding: 2px 0; cursor: pointer; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree div:hover, .tree div.on { color: var(--white); }
.tree .f { color: var(--mute); cursor: default; margin-top: 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.heat td { text-align: center; font-family: var(--mono); font-size: 11px; }
pre.code { background: #050505; border: 1px solid var(--line); padding: 10px; overflow: auto; max-height: 520px; font: 12px/1.5 var(--mono); }
pre.code .k { color: var(--white); font-weight: 700; } pre.code .c { color: var(--mute); font-style: italic; } pre.code .s { color: var(--dim); text-decoration: underline dotted var(--line2); }
.quiz label { display: block; padding: 3px 0; cursor: pointer; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--white); }
dialog { background: var(--panel); color: var(--fg); border: 1px solid var(--line2); max-width: 760px; width: 92vw; }
dialog::backdrop { background: rgba(0,0,0,.7); }

#aid { position: fixed; top: 54px; right: 0; bottom: 0; width: 400px; max-width: 100vw; background: var(--panel); border-left: 1px solid var(--line2); z-index: 60; display: flex; flex-direction: column; }
#aid[hidden] { display: none; }
#aimsgs { flex: 1; overflow-y: auto; padding: 10px 12px; }
#aimsgs .u { margin: 10px 0 4px; color: var(--white); font-weight: 600; }
#aimsgs .a { border-left: 2px solid var(--line2); padding-left: 8px; }
#aiform { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
#aiform textarea { font-family: var(--font); font-size: 13px; resize: none; }
.ailabel { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); border: 1px dashed var(--line2); padding: 1px 6px; display: inline-block; margin: 4px 0; }

/* ---- section layout */
.sechead { margin-bottom: 18px; }
.sechead .sub { margin: 0; }
.sectabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 26px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.sectabs a { padding: 7px 14px; border-radius: 20px; text-decoration: none; color: var(--dim); border: 1px solid var(--line2); font-size: 14px; }
.sectabs a:hover { color: var(--white); border-color: var(--dim); }
.sectabs a.on { background: var(--white); color: #000; border-color: var(--white); font-weight: 600; }
/* pages rendered inside a section keep their content but drop their own big title and long description */
.tabbody > h1, .tabbody > .sub, .tabbody > .row.sp:first-child h1, .tabbody > .row.sp:first-child .sub, .tabbody > div:first-child > h1:first-child + .sub { display: none; }
.tabbody > .row.sp:first-child h1 + .sub { display: none; }
/* ---- home + research building blocks */
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.hero .sub { margin: 4px 0 0; font-size: 15px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--gap); }
.tile { display: block; text-decoration: none; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; }
.tile:hover { border-color: var(--line2); background: var(--panel2); }
.big { font: 600 26px var(--mono); color: var(--white); margin: 4px 0; }
.item { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 16px; margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--fg); }
a.item:hover { background: var(--panel2); border-color: var(--line2); }
.pill { white-space: nowrap; font-size: 12.5px; padding: 4px 11px; border-radius: 20px; border: 1px solid var(--line2); color: var(--dim); }
.pill.good { background: var(--white); color: #000; border-color: var(--white); font-weight: 600; }
.pill.bad { color: var(--mute); border-style: dashed; }
.card { display: block; text-decoration: none; color: var(--fg); padding: 20px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.card:hover { background: var(--panel2); border-color: var(--line2); }
.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.step { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: flex; flex-direction: column; gap: 8px; }
.step .row { margin-top: auto; padding-top: 8px; }
.step .num { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line2); display: grid; place-items: center; font-size: 13px; color: var(--dim); }
.notice { margin-top: 16px; padding: 12px 16px; border-radius: var(--r); background: var(--panel2); color: var(--dim); }
section { min-width: 0; }
details > summary { cursor: pointer; color: var(--dim); }
details.more > summary { padding: 14px 18px; border: 1px solid var(--line2); border-radius: var(--r); font-size: 15px; color: var(--fg); list-style: none; }
details.more > summary::before { content: '+  '; color: var(--mute); }
details.more[open] > summary::before { content: 'â€“  '; }
details.more[open] > summary { margin-bottom: 8px; }

/* ---- AI researcher panel */
.airesearcher { border: 1px solid var(--line2); border-radius: var(--r); padding: 20px 22px; margin-bottom: 24px; background: linear-gradient(180deg, #121212, #0c0c0c); }

/* ---- tradingview generator */
.tv { max-width: 980px; }
.tv-step { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 16px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.tv-n { width: 32px; height: 32px; border-radius: 50%; background: var(--white); color: #000; display: grid; place-items: center; font-weight: 700; }
.tv-list { display: grid; gap: 6px; margin-top: 14px; max-height: 380px; overflow-y: auto; padding-right: 4px; }
.tv-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; color: var(--fg); }
.tv-item:hover { background: var(--panel2); border-color: var(--line2); }
.tv-item.on { border-color: var(--white); background: var(--raise); }
.tv-opts { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.tv-opts label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--dim); }
.tv-opts input[type=number] { width: 150px; }
.tv-opts label.chk { flex-direction: row; align-items: center; padding-bottom: 8px; }
.howto { margin: 18px 0; padding-left: 20px; color: var(--dim); line-height: 1.9; }

/* ---- academic center */
.courses { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.course { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 22px; display: flex; flex-direction: column; }
.path { list-style: none; counter-reset: p; padding: 0; margin: 16px 0 18px; flex: 1; }
.path li { counter-increment: p; display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.path li a { text-decoration: none; color: var(--dim); }
.path li a::before { content: counter(p); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line2); font-size: 11px; margin-right: 10px; color: var(--mute); }
.path li.done a { color: var(--white); }
.path li.done a::before { content: "âœ“"; background: var(--white); color: #000; border-color: var(--white); }
.path li a:hover { color: var(--white); }
.primary-btn { background: var(--white); color: #000; border-color: var(--white); font-weight: 600; text-align: center; }
.primary-btn:hover { background: #d8d8d8; }
.gloss { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.gl { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--dim); font-size: 13.5px; }
.gl b { display: block; color: var(--white); margin-bottom: 2px; }
.gl:hover { background: var(--panel2); }
.fc-wrap { margin-top: 30px; }
.fc-card { max-width: 560px; margin: 0 auto; min-height: 220px; padding: 30px; border: 1px solid var(--line2); border-radius: 14px; background: var(--panel); text-align: center; cursor: pointer; }
.fc-card.back { background: var(--panel2); text-align: left; }
.lesson-head { margin: 12px 0 18px; }
.stepper { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.stepper button { display: flex; align-items: center; gap: 8px; border-radius: 20px; background: transparent; color: var(--mute); }
.stepper button span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line2); font-size: 11px; }
.stepper button.done { color: var(--dim); }
.stepper button.done span { background: var(--dim); color: #000; border-color: var(--dim); }
.stepper button.on { color: #000; background: var(--white); border-color: var(--white); font-weight: 600; }
.stepper button.on span { border-color: #000; }
.lesson { max-width: 820px; min-height: 260px; font-size: 16px; line-height: 1.75; }
.lesson .lead { font-size: 21px; line-height: 1.55; color: var(--white); margin: 0 0 20px; }
.why, .warn-lesson { border-left: 3px solid var(--line2); padding: 6px 0 6px 18px; margin-top: 16px; }
.warn-lesson { border-color: var(--dim); }
pre.formula { font-size: 14px; white-space: pre-wrap; }
.q { margin-bottom: 26px; }
.opt { display: block; width: 100%; max-width: 560px; text-align: left; padding: 12px 16px; margin-bottom: 8px; font-size: 15px; border-radius: 8px; }
.opt.right { background: var(--white); color: #000; border-color: var(--white); }
.opt.wrong { border-style: dashed; color: var(--mute); text-decoration: line-through; }
.opt.off { opacity: .45; }
.qfb { font-size: 14px; color: var(--dim); min-height: 20px; }
.lesson-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 30px; padding-top: 18px; border-top: 1px solid var(--line); max-width: 820px; }
@media (max-width: 1100px) { .courses { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .gloss { grid-template-columns: 1fr; } }

/* ---- knowledge vault (Obsidian-like) */
.vault { display: grid; grid-template-columns: 250px minmax(0, 1fr) 280px; height: calc(100vh - 250px); min-height: 520px; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #0a0a0a; }
.vault-side { border-right: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; min-height: 0; background: #0c0c0c; }
.vtree { flex: 1; overflow-y: auto; font-size: 13.5px; }
.vt-f, .vt-n { padding: 4px 8px; border-radius: 5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vt-f { color: var(--dim); font-weight: 500; }
.vt-n { color: var(--mute); }
.vt-f:hover, .vt-n:hover { background: var(--panel2); color: var(--white); }
.vt-n.on { background: var(--raise); color: var(--white); }
.vault-foot { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 8px; }
.vault-main { min-width: 0; min-height: 0; overflow-y: auto; position: relative; }
.vault-right { border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; background: #0c0c0c; }
.vault-right h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--mute); margin: 16px 0 8px; }
.vault-right h3:first-child { margin-top: 0; }
.vlink { display: block; padding: 4px 6px; border-radius: 5px; text-decoration: none; color: var(--dim); font-size: 13.5px; cursor: pointer; }
.vlink:hover { background: var(--panel2); color: var(--white); }
.graph-wrap { position: absolute; inset: 0; }
.graph-wrap canvas { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
.graph-ctl { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 4px; }
.graph-ctl button { width: 34px; height: 34px; padding: 0; font-size: 16px; background: rgba(20,20,20,.9); }
.graph-hint { position: absolute; left: 14px; bottom: 10px; pointer-events: none; }
.local-graph { height: 220px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.local-graph canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.note { max-width: 760px; margin: 0 auto; padding: 22px 34px 60px; }
.note-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.note-body { font-size: 15.5px; line-height: 1.75; }
.note-body h2 { font-size: 26px; margin: 0 0 14px; }
.note-body h3 { font-size: 19px; margin: 26px 0 8px; }
.note-body p { margin: 0 0 12px; }
.note-body code { font-size: 13.5px; }
.note-body a.wl { color: var(--white); text-decoration: none; border-bottom: 1px solid var(--line2); }
.note-body a.wl:hover { border-color: var(--white); }
.note-edit { width: 100%; min-height: 60vh; background: transparent; border: 1px solid var(--line); font: 14.5px/1.7 var(--mono); padding: 14px; }
.props { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; margin-bottom: 20px; font-size: 13px; display: grid; gap: 3px; }
@media (max-width: 1100px) { .vault { grid-template-columns: 220px minmax(0, 1fr); } .vault-right { display: none; } }
@media (max-width: 760px) { .vault { grid-template-columns: 1fr; height: auto; } .vault-side { max-height: 260px; } .vault-main { min-height: 480px; } .note { padding: 16px; } }

@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } .steps { grid-template-columns: 1fr; } }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }
  #nav { display: none; position: fixed; top: 54px; left: 0; bottom: 0; width: 230px; z-index: 40; }
  #nav.open { display: block; }
  #menu { display: inline-block; }
  #brand { width: auto; } #topstatus { display: none; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; } .span2, .span3 { grid-column: auto; }
  #main { padding: 20px 16px 40px; } .tiles { grid-template-columns: 1fr 1fr; }
  .chart { height: 340px; }
}

@media print {
  body.printing #top, body.printing #nav, body.printing .sechead, body.printing .sectabs, body.printing .vault-side, body.printing .vault-right, body.printing .note-bar, body.printing #aid { display: none !important; }
  body.printing, body.printing #main { background: #fff !important; color: #000 !important; overflow: visible !important; height: auto !important; }
  body.printing #app { display: block; height: auto; }
  body.printing .vault { display: block; height: auto; border: none; background: #fff; }
  body.printing .vault-main { overflow: visible; }
  body.printing .note-body, body.printing .note-body * { color: #000 !important; }
  body.printing .note-body table td { border-color: #bbb; }
}

/* ---- live research indicator */
.livepill { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line2); border-radius: 20px; text-decoration: none; color: var(--dim); font-size: 13px; white-space: nowrap; }
.livepill:hover { color: var(--white); border-color: var(--dim); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--mute); flex: none; }
.big-dot { width: 14px; height: 14px; margin-right: 6px; }
[data-state="testing"] .dot, .dot[data-state="testing"], [data-state="writing ideas"] .dot, .dot[data-state="writing ideas"],
[data-state="reflecting"] .dot, .dot[data-state="reflecting"], [data-state="writing paper"] .dot, .dot[data-state="writing paper"], [data-state="scanning data"] .dot, .dot[data-state="scanning data"] { background: var(--white); animation: pulse 1.2s infinite; }
[data-state="waiting"] .dot, .dot[data-state="waiting"] { background: var(--dim); }
[data-state="paused"] .dot, .dot[data-state="paused"] { background: transparent; border: 1px dashed var(--dim); }
[data-state="off"] .dot, .dot[data-state="off"] { background: transparent; border: 1px solid var(--line2); }
@keyframes pulse { 50% { opacity: .25; } }
.livecard { border: 1px solid var(--line2); border-radius: var(--r); padding: 20px 22px; margin-bottom: 20px; background: var(--panel); }
.livestats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 16px 0 10px; }
.livestats .big { font-size: 22px; }
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--white); color: #000; padding: 14px 40px 14px 16px; border-radius: 10px; min-width: 280px; max-width: 380px; position: relative; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.toast a { color: #000; font-weight: 600; }
.toast .tclose { position: absolute; top: 6px; right: 6px; color: #000; }
@media (max-width: 760px) { .livestats { grid-template-columns: repeat(3, 1fr); } .livepill #livetxt { display: none; } }

/* ---- backtests list */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0 14px; }
.seg { display: flex; border: 1px solid var(--line2); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; background: transparent; color: var(--dim); }
.seg button.on { background: var(--white); color: #000; font-weight: 600; }
.seg button.on .mute { color: #555; }
.testcard { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 20px; align-items: center; padding: 14px 18px; margin-bottom: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--fg); }
.testcard:hover { background: var(--panel2); border-color: var(--line2); }
.tc-stats { display: flex; gap: 22px; text-align: right; }
.tc-stats b { font-size: 15px; }
@media (max-width: 900px) { .testcard { grid-template-columns: 1fr; } .tc-stats { text-align: left; } }

.mathsteps { padding-left: 22px; margin: 12px 0; } .mathsteps li { padding: 8px 0; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 14.5px; line-height: 1.6; }

/* ---- AI lab */
.ailab { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 18px; }
.ailab-side { border: 1px solid var(--line); border-radius: var(--r); padding: 12px; background: var(--panel); max-height: 820px; overflow-y: auto; }
.ailab-list { margin-top: 10px; }
.ai-idea { display: block; padding: 8px; border-radius: 6px; text-decoration: none; color: var(--dim); font-size: 13px; border-bottom: 1px solid var(--line); }
.ai-idea:hover { background: var(--panel2); color: var(--white); }
.ai-idea.on { background: var(--raise); color: var(--white); }
.ai-idea .tag { margin-top: 4px; }
.rulebox { margin: 12px 0; padding: 12px 14px; border: 1px solid var(--line2); border-radius: 8px; font-size: 14px; background: var(--panel); }
@media (max-width: 900px) { .ailab { grid-template-columns: 1fr; } .ailab-side { max-height: 240px; } }

/* ---- algorithm page */
.stagebar { display: flex; gap: 4px; flex-wrap: wrap; }
.stagebar div { flex: 1; min-width: 110px; padding: 7px 10px; font-size: 12px; text-align: center; border: 1px solid var(--line2); color: var(--mute); border-radius: 6px; }
.stagebar div.done { background: var(--white); color: #000; border-color: var(--white); font-weight: 600; }
.stagebar div.stop { border-style: dashed; color: var(--white); }

.graph-toggle { position: absolute; top: 12px; left: 14px; background: rgba(15,15,15,.85); padding: 6px 10px; border-radius: 6px; }
