/* Chord Agents on Monad: violet-black grounds, Geist, dark default and light on toggle.
   Monad purple (#6E54FF on buttons, #836EF9 for the mark) drives actions and selection; green and red only say up and down. */
:root, [data-theme="dark"] {
  --bg: hsl(250 24% 4.5%); --fg: hsl(250 30% 96%); --card: hsl(250 20% 7.5%); --muted: hsl(250 16% 11.5%); --muted-fg: hsl(250 9% 66%);
  --border: hsl(250 14% 19%); --border-soft: hsla(250, 14%, 19%, .65); --primary: #6E54FF; --primary-fg: #ffffff;
  --primary-line: hsl(250 24% 4.5%); --hi: #3DDC97; --purple: #A594FF; --monad: #836EF9; --accent: hsl(252 55% 17%); --secondary: hsl(250 14% 15%);
  --bad: hsl(356 82% 66%); --bubble: hsl(252 26% 14%);
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #FBFAF9; --fg: hsl(252 30% 8%); --card: #ffffff; --muted: hsl(252 40% 97%); --muted-fg: hsl(252 8% 40%);
  --border: hsl(252 18% 88%); --border-soft: hsla(252, 18%, 88%, .9); --primary: #6E54FF; --primary-fg: #ffffff;
  --primary-line: #ffffff; --hi: #0A8A56; --purple: #5B3FE6; --monad: #836EF9; --accent: hsl(252 100% 96%); --secondary: hsl(252 35% 93%);
  --bad: hsl(356 72% 46%); --bubble: hsl(252 100% 97%);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 16px/1.5 Geist, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.mono, kbd, code, pre { font-family: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace; }
i[data-i] { display: inline-flex; width: 18px; height: 18px; flex: none; }
i[data-i] svg { width: 100%; height: 100%; }
[hidden] { display: none !important; }

.app { display: grid; grid-template-columns: 64px 288px 1fr; gap: 4px; height: 100dvh; padding: 4px; }
.app.noside { grid-template-columns: 64px 1fr; }
.app.noside .side { display: none; }

/* left icon rail */
.rail { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 0; }
.logo { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border-soft); background: var(--card); color: var(--fg); margin-bottom: 6px; }
.railbtn { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted-fg); }
.railbtn:hover { background: var(--muted); color: var(--fg); }
.railitem { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 60px; padding: 4px 0 8px; border: 0; background: none; color: var(--muted-fg); font-size: 12.5px; text-decoration: none; }
.railitem .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.railitem:hover .ic { background: var(--muted); color: var(--fg); }
.railitem.active { color: var(--fg); }
.railitem.active .ic { background: var(--accent); color: var(--purple); }
[data-theme="light"] .railitem.active .ic { background: var(--primary); color: var(--primary-fg); }
.railfoot { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }

/* chats sidebar */
.side { display: flex; flex-direction: column; gap: 10px; padding: 10px; background: var(--card); border: 1px solid var(--border-soft); border-radius: 12px; min-height: 0; }
.newchat { display: flex; align-items: center; justify-content: center; gap: 8px; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: transparent; font-size: 15px; }
.newchat:hover { background: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 11px; border-radius: 10px; background: var(--muted); color: var(--muted-fg); }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 14.5px; color: var(--fg); }
.search input::placeholder { color: var(--muted-fg); }
.threads { flex: 1; overflow-y: auto; min-height: 0; margin: 0 -4px; padding: 0 4px; }
.threads .grp { font-size: 12.5px; color: var(--muted-fg); margin: 10px 6px 4px; }
.threads .t { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 9px; }
.threads .t:hover, .threads .t.on { background: var(--muted); }
.threads .t b { display: block; font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.threads .t small { color: var(--muted-fg); font-size: 12px; }
.threads .empty { margin: 40px 8px; text-align: center; color: var(--muted-fg); font-size: 14px; }
.sidenote { margin: 0 4px; font-size: 12.5px; color: var(--muted-fg); }
.sidecard { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--border-soft); border-radius: 10px; font-size: 13.5px; color: var(--muted-fg); }
.sidecard b { display: flex; align-items: center; gap: 8px; color: var(--fg); font-weight: 500; font-size: 14.5px; }
.sidecard b i { color: var(--purple); width: 16px; height: 16px; }
.sidecard.click { cursor: pointer; }
.sidecard.click:hover { border-color: var(--border); background: var(--muted); }

/* top bar + stage */
.mainwrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 10px 0 18px; background: var(--card); border: 1px solid var(--border-soft); border-radius: 12px; }
.title { font-weight: 500; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--muted); font-size: 14.5px; white-space: nowrap; }
.tb:hover { background: var(--secondary); }
.tb.sq { width: 38px; padding: 0; justify-content: center; }
.tb.menu { display: none; }
.tb kbd { font-size: 11px; color: var(--muted-fg); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.tb.credits { color: var(--purple); font-weight: 500; }
.tb.credits.static, .tb.credits.static:hover { cursor: default; background: var(--muted); }
.tb.credits .ushort { display: none; font-size: 18px; line-height: 1; }
.tb.primary { background: var(--primary); color: var(--primary-fg); font-weight: 600; padding: 0 16px; }
.tb.primary:hover { filter: brightness(.95); }
.tb.signin i { width: 17px; height: 17px; }
.tb.signin.on { color: var(--hi); }
.tb.signin.loading i { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.tb.signin .lbl { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.stage { position: relative; flex: 1; min-height: 0; background: var(--card); border: 1px solid var(--border-soft); border-radius: 12px; overflow: hidden; }

/* home */
.home { height: 100%; overflow-y: auto; padding: 64px 24px 40px; display: flex; flex-direction: column; align-items: center; }
.agentpill { display: inline-flex; align-items: center; gap: 9px; height: 36px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--muted); font-size: 14.5px; font-weight: 500; }
.agentpill i { width: 15px; height: 15px; color: var(--muted-fg); }
.home h1 { display: flex; align-items: center; gap: 20px; margin: 36px 0 30px; font-size: 42px; line-height: 1.15; font-weight: 600; letter-spacing: -.02em; text-align: center; }
.mascot { display: inline-flex; width: 52px; height: 52px; flex: none; }
.mascot svg { width: 100%; height: 100%; }
.composer { background: var(--card); border: 1px solid var(--border); border-radius: 16px; }
[data-theme="dark"] .composer { background: hsl(252 14% 8.5%); }
.composer.big { width: 100%; max-width: 820px; padding: 14px 14px 12px 16px; }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; resize: none; background: transparent; font-size: 15.5px; line-height: 1.5; color: var(--fg); }
.composer textarea::placeholder { color: var(--muted-fg); }
.composer.big textarea { min-height: 82px; }
.crow { display: flex; align-items: center; gap: 4px; margin-top: 6px; }
.ctool { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 10px; white-space: nowrap; border: 0; border-radius: 9px; background: transparent; font-size: 14.5px; color: var(--fg); }
.ctool i { width: 16px; height: 16px; color: var(--muted-fg); }
.ctool:hover { background: var(--muted); }
.send { margin-left: auto; width: 36px; height: 36px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--secondary); color: var(--muted-fg); }
.composer.ready .send { background: var(--primary); color: var(--primary-fg); }
.cats { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; max-width: 820px; margin-top: 24px; }
.cat { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px; border: 1px solid var(--border); border-radius: 999px; background: transparent; font-size: 15px; color: var(--fg); }
.cat i { width: 15px; height: 15px; color: var(--muted-fg); }
.cat.on { border-color: var(--purple); }
.cat.on i { color: var(--purple); }
.sheet .muted a { color: var(--purple); text-underline-offset: 2px; }
.sugs { width: 100%; max-width: 820px; margin-top: 16px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.sug { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 16px; border: 0; border-top: 1px solid var(--border); background: transparent; text-align: left; font-size: 15px; color: var(--fg); }
.sug:first-child { border-top: 0; }
.sug:hover { background: var(--muted); }
.sug > span:not(.spill) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sug i { width: 15px; height: 15px; color: var(--muted-fg); }

/* chat */
.chat { height: 100%; display: flex; flex-direction: column; }
.scroller { flex: 1; overflow-y: auto; min-height: 0; display: flex; justify-content: center; gap: 28px; padding: 28px 24px 24px; }
.thread { width: 100%; max-width: 860px; min-width: 0; }
.toc { position: sticky; top: 0; align-self: flex-start; width: 250px; flex: none; padding: 16px; border: 1px solid var(--border); border-radius: 12px; }
.toc b { display: block; font-weight: 600; font-size: 16px; margin-bottom: 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc li { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14.5px; color: var(--muted-fg); cursor: pointer; }
.toc li span.n { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--muted); font-size: 12px; }
.toc li.on { color: var(--purple); }
.toc li.on span.n { background: var(--accent); color: var(--purple); }
@media (max-width: 1280px) { .toc { display: none !important; } }

.uq { display: flex; justify-content: flex-end; margin: 6px 0 22px; }
.uq div { max-width: 78%; padding: 12px 16px; border-radius: 14px; background: var(--bubble); border: 1px solid var(--border-soft); white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15.5px; }
.bot { display: grid; grid-template-columns: 34px 1fr; gap: 14px; margin-bottom: 34px; }
.bot .av { width: 34px; height: 34px; }
.bot .av svg { width: 100%; height: 100%; }
.bbody { min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 10px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: transparent; font-size: 13.5px; color: var(--fg); }
.pill i { width: 15px; height: 15px; }
.pill .ok { color: var(--hi); }
.pill .spin { animation: spin 1s linear infinite; color: var(--hi); }
@keyframes spin { to { transform: rotate(360deg); } }
.pill .dots { display: inline-flex; }
.pill .dots b { width: 16px; height: 16px; margin-left: -5px; border-radius: 50%; background: var(--secondary); border: 1.5px solid var(--card); display: grid; place-items: center; font-size: 9px; font-weight: 600; color: var(--muted-fg); }
/* live work + steps (getchord.xyz/ask layout) */
.thread::after { content: ""; display: block; height: 72px; } /* a flex scroller drops its bottom padding: the last line never sits on the composer */
.wv:empty { display: none; }
.wv, .steps { display: flex; flex-direction: column; gap: 7px; margin: 2px 0 14px; }
.wtime { font-size: 12.5px; color: var(--muted-fg); }
.wtime span { font-family: "Geist Mono", monospace; font-variant-numeric: tabular-nums; }
.think { font-size: 12.5px; color: var(--muted-fg); max-width: 640px; }
.think.live { animation: pulse 1.4s ease-in-out infinite; font-weight: 500; }
.think p { margin: 2px 0 0; font-weight: 400; white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
details.thought { font-size: 12.5px; color: var(--muted-fg); max-width: 640px; margin: 0 0 6px; }
details.thought summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; }
details.thought summary::before { content: "›"; font-size: 15px; transition: transform .15s; }
details.thought[open] summary::before { transform: rotate(90deg); }
details.thought p { margin: 6px 0 0; padding-left: 12px; border-left: 2px solid var(--border); white-space: pre-wrap; max-height: 280px; overflow-y: auto; line-height: 1.45; }
.sspin { width: 14px; height: 14px; flex: none; animation: spin 1s linear infinite; }
.slbl { flex: none; }
.svia { flex: none; font: 500 10.5px "Geist Mono", monospace; text-transform: uppercase; letter-spacing: .04em; color: var(--purple); }
.schip { display: inline-flex; align-items: center; gap: 5px; min-width: 0; padding: 2px 7px; border: 1px solid var(--border); border-radius: 7px; font-size: 12px; color: var(--muted-fg); }
.schip svg { width: 11px; height: 11px; flex: none; }
.schip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.serr { margin: -3px 0 0 14px; font-size: 12.5px; color: var(--bad); }
.scards { display: flex; flex-direction: column; gap: 6px; margin: 2px 0 4px 14px; }
.sgrid { display: flex; flex-wrap: wrap; gap: 8px; }
.tcard { display: block; width: 100%; max-width: 340px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--fg); text-decoration: none; }
a.tcard[href]:hover, a.pcard[href]:hover { border-color: var(--purple); }
.tch { display: flex; align-items: center; gap: 10px; padding: 11px 12px 0; }
.tch .tlogo { width: 36px; height: 36px; }
.tcn { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.tcn b, .tcn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tcn b { font-size: 13.5px; } .tcn small { font-size: 11.5px; color: var(--muted-fg); }
.tcp { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.tcp small { font-size: 11px; color: var(--muted-fg); } .tcp b { font: 600 13px "Geist Mono", monospace; }
.tcp .up { color: var(--hi); } .tcp .down { color: var(--bad); }
.tcf { display: grid; gap: 8px; margin-top: 10px; padding: 9px 12px 10px; border-top: 1px solid var(--border); }
.tcf span { display: flex; flex-direction: column; min-width: 0; } .tcf small { font-size: 11px; color: var(--muted-fg); } .tcf b { font: 500 12.5px "Geist Mono", monospace; }
.tcard:not(:has(.tcf)) .tch { padding-bottom: 11px; }
.pcard { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 230px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); color: var(--fg); text-decoration: none; font-size: 12px; }
.pcard .pa { display: flex; align-items: center; gap: 6px; min-width: 0; } .pcard .pa img { width: 16px; height: 16px; border-radius: 50%; }
.pcard .pa small, .pcard > small { color: var(--muted-fg); }
.pcard .pt { color: var(--fg); opacity: .85; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.lcard { display: flex; align-items: flex-start; gap: 8px; max-width: 540px; padding: 4px; border-radius: 8px; color: var(--fg); text-decoration: none; }
a.lcard[href]:hover { background: var(--muted); }
.lcard .lf { width: 16px; height: 16px; flex: none; margin-top: 2px; display: grid; place-items: center; border-radius: 4px; background: var(--secondary); font-size: 10px; font-weight: 600; color: var(--muted-fg); }
.lcard .lt { min-width: 0; display: flex; flex-direction: column; } .lcard .lt b, .lcard .lt small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lcard .lt b { font-size: 12.5px; font-weight: 400; } .lcard .lt small { font-size: 11.5px; color: var(--muted-fg); }
.follow:empty, .acts:empty { display: none; }
.follow { margin-top: 26px; }
.follow .fh { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.follow button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 0; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--fg); text-align: left; font-size: 14.5px; opacity: .88; }
.follow button:hover { opacity: 1; color: var(--hi); }
.follow button span { flex: 1; min-width: 0; }
.follow button svg { width: 14px; height: 14px; flex: none; color: var(--muted-fg); }
.acts { display: flex; gap: 4px; margin-top: 14px; }
.acts button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted-fg); }
.acts button:hover { background: var(--muted); color: var(--fg); }
.acts button.on { color: var(--hi); }
.acts button svg { width: 15px; height: 15px; }
.steps { padding: 4px 0 4px 14px; border-left: 2px solid var(--border); }
.steps li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; padding: 4px 0; font-size: 13.5px; color: var(--muted-fg); }
.steps .via { font: 500 11px "Geist Mono", monospace; text-transform: uppercase; letter-spacing: .04em; color: var(--purple); }
.steps .lbl { color: var(--fg); }
.steps .det { font: 12px "Geist Mono", monospace; overflow-wrap: anywhere; }
.steps .ms { margin-left: auto; font: 12px "Geist Mono", monospace; }
.steps li.run .lbl::after { content: " …"; }
.steps li.bad .lbl { color: var(--bad); }
.thinking { display: flex; align-items: center; gap: 8px; color: var(--muted-fg); font-size: 14.5px; }
.thinking i { color: var(--hi); }

.md { font-size: 15.5px; line-height: 1.62; overflow-wrap: anywhere; }
.md p { margin: 0 0 12px; }
.md h2, .md h3 { font-size: 19px; line-height: 1.3; margin: 22px 0 10px; font-weight: 600; letter-spacing: -.01em; scroll-margin-top: 16px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 4px 0; }
.md b, .md strong { font-weight: 600; }
.md code { font-size: 13.5px; padding: 1px 6px; border-radius: 6px; background: var(--muted); }
.md .tbl { overflow-x: auto; margin: 8px 0 16px; border: 1px solid var(--border); border-radius: 12px; }
.md table { border-collapse: collapse; width: 100%; font-size: 14.5px; font-variant-numeric: tabular-nums; }
.md th { text-align: left; font-weight: 500; font-size: 13.5px; color: var(--muted-fg); padding: 10px 14px; border-bottom: 1px solid var(--border); }
.md td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.md tr:last-child td { border-bottom: 0; }
.srcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.src { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; font: 500 12.5px "Geist Mono", monospace; color: var(--fg); text-decoration: none; }
a.src:hover { border-color: var(--purple); color: var(--purple); }
.meta { margin-top: 10px; font: 12.5px "Geist Mono", monospace; color: var(--muted-fg); }
.err { color: var(--bad); }

.composer.dock { display: flex; align-items: flex-end; gap: 10px; margin: 0 auto 18px; width: calc(100% - 48px); max-width: 860px; padding: 10px 10px 10px 16px; }
.composer.dock textarea { min-height: 26px; max-height: 180px; padding: 6px 0; }

/* sheets */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.55); display: grid; place-items: center; padding: 16px; }
.card { width: 100%; max-width: 520px; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 20px; }
.card.wide { max-width: 720px; }
.cardHead { display: flex; align-items: center; gap: 10px; }
.cardHead h2 { margin: 0; font-size: 21px; letter-spacing: -.01em; }
.x { margin-left: auto; border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted-fg); }
.muted { color: var(--muted-fg); font-size: 14.5px; }
.opt { border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin: 10px 0; }
.opt .addr { display: flex; gap: 8px; align-items: center; margin-top: 6px; font: 12.5px "Geist Mono", monospace; overflow-wrap: anywhere; }
.opt .addr button { flex: none; border: 1px solid var(--border); background: transparent; border-radius: 8px; padding: 3px 8px; font-size: 12px; }
.field { display: block; margin: 12px 0 8px; font-size: 13.5px; color: var(--muted-fg); }
.field input { display: block; width: 100%; margin-top: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--muted); font: 13px "Geist Mono", monospace; outline: 0; }
.field input:focus { border-color: var(--purple); }
.row { display: flex; gap: 8px; }
.row select { border: 1px solid var(--border); border-radius: 10px; padding: 0 10px; background: var(--muted); }
.card .primary { flex: 1; border: 0; border-radius: 10px; background: var(--primary); color: var(--primary-fg); padding: 11px; font-weight: 600; }
.msg { min-height: 20px; font-size: 14px; margin: 10px 0 0; }
.msg.ok { color: var(--hi); } .msg.bad { color: var(--bad); }
.card .ghost { flex: 1; border: 1px solid var(--border); border-radius: 10px; background: transparent; padding: 10px; font-weight: 500; }
.card .ghost:hover { background: var(--muted); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--purple); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.mono { font-family: "Geist Mono", monospace; }
pre { margin: 12px 0; padding: 14px; border-radius: 12px; background: var(--muted); border: 1px solid var(--border); font-size: 12.5px; line-height: 1.55; overflow-x: auto; white-space: pre; }

/* trade view */
.tradev { height: 100%; overflow-y: auto; display: flex; justify-content: center; padding: 56px 20px 40px; }
.swapcard { width: 100%; max-width: 480px; align-self: flex-start; }
.sc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sc-head b { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin-right: auto; }
.chainbtn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: transparent; font-size: 14.5px; font-weight: 500; }
.chainbtn i { width: 15px; height: 15px; color: var(--muted-fg); }
.cdot { width: 9px; height: 9px; border-radius: 50%; background: var(--hi); }
.slip { display: flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--muted); }
.slip button { border: 0; background: transparent; border-radius: 8px; padding: 4px 9px; font-size: 13px; color: var(--muted-fg); }
.slip button.on { background: var(--card); color: var(--fg); }
.chainlist { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chainlist button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 1px solid var(--border); border-radius: 999px; background: transparent; font-size: 14px; }
.chainlist button.on { border-color: var(--purple); }
.chainlist small { color: var(--muted-fg); font-size: 12px; }
.box { border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; background: var(--muted); }
.box .lbl { font-size: 13.5px; color: var(--muted-fg); margin-bottom: 6px; }
.brow { display: flex; align-items: center; gap: 10px; }
.brow input, .brow .out { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 32px; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--fg); padding: 0; }
.brow .out { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brow .out.dim, .brow input::placeholder { color: var(--muted-fg); }
.tokbtn { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px 0 6px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); font-size: 16px; font-weight: 600; white-space: nowrap; flex: none; }
.tokbtn i { width: 15px; height: 15px; color: var(--muted-fg); }
.tlogo { position: relative; width: 30px; height: 30px; border-radius: 50%; background: var(--secondary); display: grid; place-items: center; font-size: 13px; font-weight: 600; overflow: hidden; flex: none; }
.tlogo b { font-weight: 600; color: var(--muted-fg); }
.tlogo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--secondary); }
.flip { display: grid; place-items: center; width: 40px; height: 40px; margin: -12px auto; position: relative; z-index: 1; border: 4px solid var(--card); border-radius: 12px; background: var(--secondary); }
.flip i { width: 18px; height: 18px; }
.details { margin-top: 12px; border: 1px solid var(--border); border-radius: 14px; padding: 6px 14px; font-size: 14px; }
.details div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.details span { color: var(--muted-fg); }
.details b { font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.details b.good { color: var(--hi); } .details b.warn { color: var(--bad); }
.warns { font-size: 13px; color: var(--muted-fg); margin-top: 8px; }
.warns p { margin: 4px 0; }
.go { width: 100%; height: 52px; margin-top: 14px; border: 0; border-radius: 14px; background: var(--primary); color: var(--primary-fg); font-size: 16.5px; font-weight: 600; }
.go:disabled { background: var(--secondary); color: var(--muted-fg); cursor: default; }
.txsteps { list-style: none; margin: 12px 0 0; padding: 0; font-size: 14px; }
.txsteps li { display: flex; gap: 9px; align-items: center; padding: 5px 0; color: var(--muted-fg); }
.txsteps li i { width: 16px; height: 16px; }
.txsteps li.now { color: var(--fg); } .txsteps li.now i { color: var(--purple); animation: spin 1s linear infinite; }
.txsteps li.done i { color: var(--hi); } .txsteps li.bad { color: var(--bad); }
.txsteps a { color: var(--purple); }
.fine { text-align: center; font-size: 12.5px; color: var(--muted-fg); margin-top: 14px; }
.card.picker { max-width: 440px; padding: 18px; }
.card.picker .search { margin: 12px 0 8px; }
.pick-list { max-height: 56vh; overflow-y: auto; margin: 0 -6px; }
.pick { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 8px; border: 0; border-radius: 10px; background: transparent; text-align: left; }
.pick:hover { background: var(--muted); }
.pick b { display: block; font-weight: 600; font-size: 15px; }
.pick small { color: var(--muted-fg); font-size: 12.5px; }
.pick .vchk { display: inline-flex; vertical-align: -2px; margin-left: 5px; color: var(--hi); }
.pick .vchk svg { width: 14px; height: 14px; }
.pick .addr { margin-left: auto; font: 11.5px "Geist Mono", monospace; color: var(--muted-fg); }
.sug .spill { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 26px; padding: 0 9px 0 3px; margin-right: 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; }
.sug .spill .tlogo { width: 20px; height: 20px; font-size: 9px; }
.sug .spill small { color: var(--muted-fg); font-size: 12px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sug.loading { color: var(--muted-fg); cursor: default; }
.clarify { margin: 8px 0 6px; padding: 14px; border: 1px solid var(--purple); border-radius: 14px; max-width: 640px; }
.clarify .cq { font-weight: 600; margin-bottom: 10px; }
.clarify .copts { display: flex; flex-direction: column; gap: 6px; }
.clarify .copts button { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: none; color: var(--fg); text-align: left; }
.clarify .copts button:hover, .clarify .copts button.on { border-color: var(--hi); }
.clarify .copts small { color: var(--muted-fg); font-size: 12.5px; }
.clarify .cother { display: flex; gap: 6px; margin-top: 8px; }
.clarify .cother input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted); outline: 0; }
.clarify .cother button, .clarify .cgo { padding: 8px 14px; border: 0; border-radius: 10px; background: var(--primary); color: var(--primary-fg); font-weight: 600; }
.clarify .cgo { margin-top: 8px; }
.sidenav { display: none; flex-direction: column; gap: 2px; margin: 8px 0 4px; }
.sidenav button, .sidenav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 10px; background: none; color: var(--fg); text-decoration: none; font-size: 14.5px; text-align: left; }
.sidenav button:hover, .sidenav a:hover { background: var(--muted); }
.sidenav i { width: 17px; height: 17px; color: var(--muted-fg); }
@media (max-width: 900px) { .sidenav { display: flex; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 10px 0 5px; border: 1px solid var(--border); border-radius: 999px; color: var(--fg); text-decoration: none; font-size: 13px; font-variant-numeric: tabular-nums; }
a.chip[href]:hover { border-color: var(--purple); }
.chip .tlogo { width: 22px; height: 22px; font-size: 10px; }
.chip .cp { font-family: "Geist Mono", monospace; font-size: 12.5px; }
.chip .up { color: var(--hi); font-size: 12px; } .chip .down { color: var(--bad); font-size: 12px; }
.viz.chart { padding-bottom: 8px; }
.viz.chart svg { display: block; width: 100%; height: 220px; }
.viz.chart text { font: 10.5px "Geist Mono", monospace; fill: var(--muted-fg); }
.viz.chart .grid { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.viz.chart .zero { stroke: var(--muted-fg); stroke-width: 1; opacity: .5; vector-effect: non-scaling-stroke; }
.viz .vleg { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 14px 0; font-size: 12.5px; color: var(--muted-fg); }
.viz .vleg.col { flex-direction: column; padding: 0; gap: 7px; }
.viz .vleg i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
.viz .vleg b { color: var(--fg); font-weight: 500; font-family: "Geist Mono", monospace; margin-left: 4px; }
.viz.donut .dw { display: flex; align-items: center; gap: 22px; padding: 6px 14px 8px; }
.viz.donut svg { width: 150px; height: 150px; flex: none; }
.md.drafting > :last-child::after { content: "▍"; margin-left: 2px; color: var(--hi); animation: pulse 1s steps(2) infinite; }
.threadacts { display: flex; gap: 6px; margin-left: 12px; }
.tb.ghost { background: transparent; color: var(--muted-fg); font-size: 13.5px; height: 32px; padding: 0 10px; }
.tb.ghost:hover { background: var(--muted); color: var(--fg); }
.tb.ghost i { width: 15px; height: 15px; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 9px 16px; border-radius: 10px; background: var(--fg); color: var(--bg); font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
.vizbox { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 4px; }
.viz { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.viz summary, .viz .vh { padding: 10px 14px; font-size: 13.5px; font-weight: 500; color: var(--muted-fg); cursor: pointer; }
.viz .vt { overflow-x: auto; }
.viz table { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.viz th { text-align: left; font-weight: 500; color: var(--muted-fg); padding: 8px 14px; border-top: 1px solid var(--border); white-space: nowrap; }
.viz td { padding: 8px 14px; border-top: 1px solid var(--border); white-space: nowrap; max-width: 420px; overflow: hidden; text-overflow: ellipsis; }
.viz td.r { text-align: right; }
.viz a { color: var(--fg); text-decoration: none; } .viz a:hover { color: var(--purple); }
.viz.posts .post { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; border-top: 1px solid var(--border); color: var(--fg); text-decoration: none; font-size: 14px; }
.viz.posts .post:hover { background: var(--muted); }
.viz.posts small { color: var(--muted-fg); font-size: 12.5px; }
.swapcards { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.swapc { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--muted); }
.swapc .t { flex: 1; min-width: 0; font-size: 14.5px; }
.swapc .t small { display: block; color: var(--muted-fg); font-size: 12.5px; }
.swapc button { border: 0; border-radius: 10px; background: var(--primary); color: var(--primary-fg); font-weight: 600; padding: 9px 14px; white-space: nowrap; }
.tb.trade-m { display: none; }

/* narrow screens: the rail and the chats panel give way to the stage */
@media (max-width: 900px) {
  .app, .app.noside { grid-template-columns: 1fr; padding: 0; gap: 0; }
  .rail { display: none; }
  .side { position: fixed; z-index: 15; left: 0; top: 0; bottom: 0; width: 288px; border-radius: 0 12px 12px 0; }
  .app.noside .side { display: none; }
  .app:not(.noside) .side { box-shadow: 0 0 0 100vmax rgba(0,0,0,.5); }
  .topbar, .stage { border-radius: 0; border-left: 0; border-right: 0; }
  .topbar { padding: 0 8px 0 12px; }
  .tb.search-btn .lbl, .tb.search-btn kbd, .tb.signin .lbl { display: none; }
  .tb.signin { width: 38px; padding: 0; justify-content: center; }
  .threadacts .lbl { display: none; }
  .threadacts { margin-left: 4px; }
  .tb.credits .unit { display: none; }
  .tb.credits .ushort { display: inline; }
  .topbar .tb { flex: none; }
  .tb.menu { display: inline-flex; }
  .tb.trade-m { display: inline-flex; }
  .tradev { padding: 22px 12px 32px; }
  .brow input, .brow .out { font-size: 26px; }
  .home { padding: 36px 16px 32px; }
  .home h1 { flex-direction: column; font-size: 30px; gap: 12px; margin: 24px 0 20px; }
  .ctool { padding: 0 7px; font-size: 14px; gap: 6px; }
  .composer.big { padding: 12px 10px 10px 14px; }
  .mascot { width: 40px; height: 40px; }
  .scroller { padding: 20px 16px; }
  .composer.dock { width: calc(100% - 24px); margin-bottom: 12px; }
  .uq div { max-width: 92%; }
  .bot { grid-template-columns: 1fr; }
  .bot .av { display: none; }
}
@media (max-width: 480px) {
  .tb.search-btn { display: none; } /* chat search stays in the sidebar, one tap away */
  .topbar { gap: 8px; }
  .topbar .tools { gap: 6px; }
}

/* bots view (bots.js): every class is b-prefixed; colours come from the tokens above */
.botsv { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 36px 28px 56px; }
.b-wrap { width: 100%; max-width: 1040px; margin: 0 auto; }
.b-i { display: inline-flex; width: 16px; height: 16px; flex: none; }
.b-i svg { width: 100%; height: 100%; }
.b-spin svg { animation: spin 1s linear infinite; }
.b-up { color: var(--hi); } .b-down { color: var(--bad); }
.b-nav { display: flex; align-items: center; gap: 10px; }
.b-tabs, .b-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--muted); }
.b-tabs button, .b-seg button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: transparent; border-radius: 8px; padding: 6px 13px; font-size: 14px; font-weight: 500; color: var(--muted-fg); white-space: nowrap; }
.b-tabs button:hover, .b-seg button:hover { color: var(--fg); }
.b-tabs button.on, .b-seg button.on { background: var(--card); color: var(--fg); box-shadow: 0 0 0 1px var(--border-soft); }
.b-seg .b-i { width: 15px; height: 15px; }
.b-seg button.on .b-i { color: var(--purple); }
.b-seg.sm button { padding: 4px 11px; font-size: 13px; }
.b-new { display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--primary); color: var(--primary-fg); font-size: 14.5px; font-weight: 600; white-space: nowrap; }
.b-new:hover, .b-cta:hover:not(:disabled) { filter: brightness(.95); }
.b-cta { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 50px; padding: 0 24px; border: 0; border-radius: 14px; background: var(--primary); color: var(--primary-fg); font-size: 16px; font-weight: 600; }
.b-cta:disabled { background: var(--secondary); color: var(--muted-fg); cursor: default; }
.b-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 13px; border: 1px solid var(--border); border-radius: 10px; background: transparent; font-size: 14px; font-weight: 500; color: var(--fg); white-space: nowrap; }
.b-btn:hover:not(:disabled) { background: var(--muted); }
.b-btn:disabled { opacity: .5; cursor: default; }
.b-btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.b-btn.pri { border-color: var(--purple); color: var(--purple); }
.b-btn.danger { color: var(--bad); }
.b-btn.danger:hover:not(:disabled) { border-color: var(--bad); background: transparent; }
.b-crumb button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 4px 0; margin-bottom: 12px; color: var(--muted-fg); font-size: 14px; }
.b-crumb button:hover { color: var(--fg); }
.b-warnt { color: var(--bad); font-size: 13px; }
.b-none { padding: 18px; border: 1px dashed var(--border); border-radius: 12px; color: var(--muted-fg); font-size: 14px; text-align: center; }
.b-errbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--border)); border-radius: 12px; color: var(--bad); font-size: 14px; }
.b-errbox > span { flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.b-errbox .b-btn { color: var(--fg); }
.b-skel { border-radius: 10px; background: linear-gradient(90deg, var(--muted) 0%, var(--secondary) 50%, var(--muted) 100%); background-size: 200% 100%; animation: bsk 1.3s linear infinite; }
@keyframes bsk { to { background-position: -200% 0; } }
.b-skrow { padding: 12px 14px; border-top: 1px solid var(--border-soft); }
.b-skrow:first-child { border-top: 0; }
.b-skrow .b-skel { height: 22px; }
.b-dim { opacity: .5; transition: opacity .2s; }

/* my bots */
.b-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.b-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); cursor: pointer; transition: border-color .15s; }
.b-card:hover, .b-card:focus-visible { border-color: var(--purple); outline: 0; }
.b-card.b-skc { cursor: default; border-style: dashed; }
.b-ch { display: flex; align-items: center; gap: 10px; min-width: 0; }
.b-cn { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.b-cn b, .b-cn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-cn b { font-weight: 600; font-size: 15px; }
.b-cn small { color: var(--muted-fg); font-size: 12.5px; }
.b-badge { flex: none; padding: 2px 7px; border: 1px solid var(--purple); border-radius: 6px; font: 600 10.5px/1.5 "Geist Mono", monospace; letter-spacing: .06em; color: var(--purple); }
.b-badge.live { border-color: var(--hi); color: var(--hi); }
.b-pnl { display: flex; align-items: baseline; gap: 8px; font-size: 27px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.b-pnl small { font-size: 12.5px; font-weight: 400; letter-spacing: 0; color: var(--muted-fg); }
.b-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
.b-figs span { display: flex; flex-direction: column; min-width: 0; }
.b-figs small { font-size: 11.5px; color: var(--muted-fg); }
.b-figs b { font: 500 13.5px "Geist Mono", monospace; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-cerr { padding: 8px 10px; border-radius: 9px; background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); font-size: 12.5px; overflow-wrap: anywhere; }
.b-cf { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; font-size: 12.5px; color: var(--muted-fg); }
.b-st { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; color: var(--fg); white-space: nowrap; }
.b-st i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-fg); }
.b-st.running i { background: var(--hi); box-shadow: 0 0 0 3px color-mix(in srgb, var(--hi) 22%, transparent); }
.b-st.error { color: var(--bad); } .b-st.error i { background: var(--bad); }
.b-st.paused, .b-st.stopped { color: var(--muted-fg); }

/* tables (grid rows: header + rows share the column template) */
.b-tbl { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.b-th, .b-fr, .b-pr, .b-lr, .b-tr { display: grid; gap: 10px; align-items: center; padding: 9px 14px; min-width: 0; }
.b-th { padding-top: 8px; padding-bottom: 8px; background: var(--muted); font-size: 12px; color: var(--muted-fg); }
.b-th > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-fr, .b-pr, .b-lr, .b-tr { border-top: 1px solid var(--border-soft); font-size: 13.5px; }
.b-th + .b-fr, .b-th + .b-pr, .b-th + .b-lr, .b-th + .b-tr { border-top: 0; }
.b-n { text-align: right; font: 13px "Geist Mono", monospace; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 0; }
.b-th .b-n { font: inherit; }
.b-more { display: block; width: 100%; padding: 10px; border: 0; border-top: 1px solid var(--border-soft); background: transparent; color: var(--muted-fg); font-size: 13.5px; }
.b-more:hover { background: var(--muted); color: var(--fg); }
.b-tok { display: flex; align-items: center; gap: 9px; min-width: 0; }
.b-tok > span:last-child { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.b-tok b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-tok small { font: 11.5px "Geist Mono", monospace; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-tok a, .b-src a, .b-tw a { color: inherit; text-decoration: none; }
.b-tok a:hover, .b-src a:hover, .b-tw a:hover { color: var(--purple); }
.tlogo.b-tl { width: 26px; height: 26px; font-size: 11.5px; }
.tlogo.b-tl.sm { width: 20px; height: 20px; font-size: 9.5px; }

/* fills tape */
.b-fills .b-th, .b-fr { grid-template-columns: 70px 46px minmax(0, 1.15fr) 78px 92px minmax(0, 1.25fr) 80px; }
.b-ft { display: flex; flex-direction: column; font: 12.5px/1.3 "Geist Mono", monospace; color: var(--muted-fg); white-space: nowrap; }
.b-ft small { font-size: 11px; color: var(--purple); }
.b-ft small.b-day { color: var(--muted-fg); }
.b-side { padding: 2px 0; border-radius: 6px; text-align: center; font: 600 10.5px/1.6 "Geist Mono", monospace; letter-spacing: .05em; }
.b-side.buy { color: var(--hi); background: color-mix(in srgb, var(--hi) 13%, transparent); }
.b-side.sell { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.b-side.m { display: none; }
.b-src { display: flex; gap: 8px; min-width: 0; font: 12.5px "Geist Mono", monospace; color: var(--muted-fg); white-space: nowrap; overflow: hidden; }
.b-src a { overflow: hidden; text-overflow: ellipsis; }
.b-src a.b-tx { flex: none; color: var(--purple); }
.b-skl { font: 500 11px "Geist Mono", monospace; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-fg); }
.b-fr.b-sk .b-side { background: var(--secondary); color: var(--muted-fg); }
.b-flash { animation: bflash 2.6s ease-out; }
@keyframes bflash { from { background: color-mix(in srgb, var(--hi) 18%, transparent); } to { background: transparent; } }

/* positions */
.b-pos .b-th, .b-pr { grid-template-columns: minmax(0, 1.7fr) repeat(4, minmax(0, 1fr)); }
.b-ppl { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.b-ppl small { font-size: 11.5px; opacity: .8; }

/* log */
.b-log { list-style: none; margin: 0; padding: 6px 0; border: 1px solid var(--border); border-radius: 12px; }
.b-log li { display: grid; grid-template-columns: 70px 7px minmax(0, 1fr); gap: 10px; align-items: start; padding: 6px 14px; font-size: 13.5px; }
.b-log time { display: flex; flex-direction: column; font: 12px/1.35 "Geist Mono", monospace; color: var(--muted-fg); white-space: nowrap; }
.b-log time small { font-size: 10.5px; opacity: .8; }
.b-log i { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: var(--muted-fg); opacity: .6; align-self: start; }
.b-log .warn i { background: #f5a524; opacity: 1; }
.b-log .error i { background: var(--bad); opacity: 1; }
.b-log .error span { color: var(--bad); }
.b-log span { overflow-wrap: anywhere; }
.b-log li.b-lmore { display: block; padding: 0; margin-top: 4px; }

/* leaderboard */
.b-you, .b-paused { flex: none; padding: 0 5px; border: 1px solid currentColor; border-radius: 5px; font: 600 10px/1.6 "Geist Mono", monospace; font-style: normal; letter-spacing: .05em; color: var(--hi); }

/* create */
.b-c2 { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.b-c2 h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.b-step { margin-top: 14px; padding: 18px; border: 1px solid var(--border); border-radius: 16px; min-width: 0; }
.b-sh { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.b-num { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent); font: 600 12.5px "Geist Mono", monospace; color: var(--purple); }
.b-sh h3 { margin: 1px 0 0; font-size: 16.5px; font-weight: 600; }
.b-sh p { margin: 2px 0 0; color: var(--muted-fg); font-size: 13.5px; }
.b-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.b-seln { margin-left: auto; font-size: 13px; color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.b-lbl { margin: 4px 0 -4px; font-size: 13.5px; font-weight: 500; }
.b-lbl ~ .b-lbl { margin-top: 18px; }
.b-trs .b-th, .b-tr { grid-template-columns: 20px minmax(0, 1.35fr) 62px 92px 70px 62px 54px minmax(0, 1.2fr); }
.b-tr { position: relative; cursor: pointer; }
.b-tr:hover { background: var(--muted); }
.b-tr.on { background: color-mix(in srgb, var(--purple) 10%, transparent); }
.b-tr.dis { cursor: not-allowed; }
.b-tr.dis > :not(.b-box) { opacity: .55; }
.b-tr input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.b-box { width: 18px; height: 18px; display: grid; place-items: center; border: 1.5px solid var(--border); border-radius: 5px; color: transparent; }
.b-box svg { width: 12px; height: 12px; }
.b-tr.on .b-box { border-color: var(--primary); background: var(--primary); color: var(--primary-fg); }
.b-tr input:focus-visible + .b-box { outline: 2px solid var(--purple); outline-offset: 2px; }
.b-tw { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.b-tw > span { display: flex; align-items: center; gap: 5px; font-size: 13.5px; font-weight: 500; }
.b-tw .b-i { width: 13px; height: 13px; color: var(--muted-fg); }
.b-tw small { font-size: 11.5px; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-tstats { display: contents; }
.b-best { display: flex; align-items: center; gap: 7px; min-width: 0; }
.b-best b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-best small { margin-left: auto; font: 12px "Geist Mono", monospace; white-space: nowrap; }
.b-best > small:only-child { color: var(--muted-fg); margin-left: 0; }
.b-add { display: flex; gap: 8px; margin-top: 12px; }
.b-add input { flex: 1; min-width: 0; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted); font-size: 13px; outline: 0; }
.b-add input:focus { border-color: var(--purple); }
.b-add input::placeholder { color: var(--muted-fg); font-family: Geist, ui-sans-serif, system-ui, sans-serif; }
.b-add .b-btn { height: 38px; }
.b-hint { margin: 6px 0 0; font-size: 12.5px; color: var(--muted-fg); }
.b-hint:empty { display: none; }
.b-hint.bad { color: var(--bad); }
.b-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.b-chips:empty { display: none; }
.b-chip { display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 3px 0 10px; border: 1px solid var(--purple); border-radius: 999px; font: 12.5px "Geist Mono", monospace; color: var(--fg); text-decoration: none; }
.b-chip button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; border-radius: 50%; background: none; color: var(--muted-fg); font-size: 16px; line-height: 1; }
.b-chip button:hover { background: var(--muted); color: var(--fg); }
.b-chip.ln { gap: 6px; padding: 0 10px; border-color: var(--border); }
.b-chip.ln .b-i { width: 12px; height: 12px; color: var(--muted-fg); }
.b-chip.ln:hover { border-color: var(--purple); }
.b-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.b-grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.b-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.b-field > span:first-child { font-size: 13.5px; font-weight: 500; }
.b-field small { font-size: 12px; color: var(--muted-fg); }
.b-in { display: flex; align-items: center; gap: 6px; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--muted); }
.b-in:focus-within { border-color: var(--purple); }
.b-in i { font-style: normal; color: var(--muted-fg); font-size: 14.5px; }
.b-in input { flex: 1; min-width: 0; padding: 0; border: 0; outline: 0; background: transparent; font: 500 15px "Geist Mono", monospace; color: var(--fg); }
.b-in input::placeholder { color: var(--muted-fg); font: 400 14.5px Geist, ui-sans-serif, system-ui, sans-serif; }
.b-namef { max-width: 480px; }
.b-namef input { font: 15px Geist, ui-sans-serif, system-ui, sans-serif; }
.b-togs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.b-tog { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: transparent; text-align: left; color: var(--fg); }
.b-tog:hover { background: var(--muted); }
.b-tog b { display: block; font-size: 14px; font-weight: 500; }
.b-tog small { display: block; margin-top: 1px; font-size: 12.5px; color: var(--muted-fg); }
.b-sw { position: relative; width: 36px; height: 21px; flex: none; margin-top: 1px; border: 1px solid var(--border); border-radius: 999px; background: var(--secondary); transition: background .15s, border-color .15s; }
.b-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--muted-fg); transition: transform .15s, background .15s; }
.b-tog[aria-checked="true"] .b-sw { border-color: var(--primary); background: var(--primary); }
.b-tog[aria-checked="true"] .b-sw::after { transform: translateX(15px); background: var(--primary-fg); }
.b-start { margin-top: 14px; padding: 18px; border: 1px solid var(--border-soft); border-radius: 16px; background: var(--muted); }
.b-msg { margin: 12px 0; font-size: 13.5px; color: var(--muted-fg); }
.b-msg:empty { margin: 8px 0; }
.b-msg.bad { color: var(--bad); }

/* backtest */
.b-btwait p { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; font-size: 13.5px; color: var(--muted-fg); }
.b-btres { display: flex; flex-direction: column; gap: 12px; transition: opacity .2s; }
.b-bth { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.b-bth b { font-size: 15px; font-weight: 600; }
.b-bth span { font-size: 13px; color: var(--muted-fg); }
.b-stale { display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 12px; border-radius: 10px; background: var(--accent); color: var(--fg); font-size: 13px; }
.b-stale .b-i { color: var(--purple); }
.b-tiles { display: grid; gap: 8px; }
.b-t5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.b-tile { min-width: 0; padding: 11px 13px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--muted); }
.b-tile small { display: block; font-size: 12px; color: var(--muted-fg); }
.b-tile b { display: block; margin-top: 2px; font-size: 19px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-tile span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--muted-fg); overflow-wrap: anywhere; }
.b-sech { display: flex; align-items: baseline; gap: 8px; margin: 4px 0 10px; }
.b-sech h3 { margin: 0; font-size: 16.5px; font-weight: 600; }
.b-sech small { font: 12.5px "Geist Mono", monospace; color: var(--muted-fg); }

/* equity chart (same look as the answer charts: recessive grid, 2px line) */
.b-chart { display: grid; grid-template-columns: 58px minmax(0, 1fr); padding: 12px 16px 10px 0; border: 1px solid var(--border); border-radius: 12px; }
.b-cth { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 0 0 10px 16px; font-size: 13.5px; font-weight: 500; color: var(--muted-fg); }
.b-cth span { font: 12.5px "Geist Mono", monospace; }
.b-cth b { font-weight: 600; }
.b-yax { position: relative; height: 200px; }
.b-yax span { position: absolute; right: 10px; transform: translateY(-50%); font: 10.5px "Geist Mono", monospace; color: var(--muted-fg); white-space: nowrap; }
.b-plot { position: relative; height: 200px; outline: 0; touch-action: pan-y; cursor: crosshair; }
.b-plot:focus-visible { box-shadow: 0 0 0 2px var(--purple); border-radius: 4px; }
.b-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.b-gl { stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.b-base { stroke: var(--muted-fg); stroke-width: 1; stroke-dasharray: 4 4; opacity: .55; vector-effect: non-scaling-stroke; }
.b-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.b-area { stroke: none; opacity: .08; }
.b-xh { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--muted-fg); opacity: .55; pointer-events: none; }
.b-dot { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; box-shadow: 0 0 0 2px var(--card); pointer-events: none; }
.b-tip { position: absolute; top: 4px; z-index: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); pointer-events: none; white-space: nowrap; }
.b-tip b { display: block; font: 600 13.5px "Geist Mono", monospace; }
.b-tip small { font-size: 11.5px; color: var(--muted-fg); }
.b-xax { display: flex; justify-content: space-between; gap: 8px; padding-top: 6px; font: 10.5px "Geist Mono", monospace; color: var(--muted-fg); white-space: nowrap; }

/* detail */
.b-dh { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.b-dt { flex: 1; min-width: 220px; }
.b-dt h2 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.015em; overflow-wrap: anywhere; }
.b-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; font-size: 13px; color: var(--muted-fg); }
.b-ctl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.b-confirm { font-size: 13.5px; font-weight: 500; }
.b-live { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.b-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-fg); }
.b-live.on { color: var(--hi); }
.b-live.on::before { background: var(--hi); animation: pulse 1.6s ease-in-out infinite; }
.b-live.retry::before, .b-live.connecting::before { background: #f5a524; }
.b-banner { display: flex; align-items: flex-start; gap: 9px; margin-top: 14px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; font-size: 14px; overflow-wrap: anywhere; }
.b-banner .b-i { margin-top: 2px; }
.b-banner.bad { border-color: color-mix(in srgb, var(--bad) 45%, var(--border)); color: var(--bad); }
.b-params { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 14px; }
.b-pk { margin-right: 4px; font-size: 13px; font-weight: 500; color: var(--muted-fg); }
.b-rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.b-rules span { padding: 3px 9px; border-radius: 999px; background: var(--muted); font-size: 12.5px; color: var(--muted-fg); }
.b-sec { margin-top: 28px; }

/* tablet / phone */
@media (max-width: 1100px) {
  .b-trs .b-th, .b-tr { grid-template-columns: 20px minmax(0, 1.3fr) 56px 86px 64px 56px 50px minmax(0, 1fr); gap: 8px; }
}
@media (max-width: 900px) {
  .botsv { padding: 22px 16px 44px; }
  .b-nav { width: 100%; }
  .b-t5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b-t5 .b-tile:first-child { grid-column: 1 / -1; }
  .b-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .b-th { display: none !important; }
  .b-tbl .b-fr, .b-tbl .b-pr, .b-tbl .b-lr, .b-tbl .b-tr { border-top: 1px solid var(--border-soft); }
  .b-tbl > :nth-child(2) { border-top: 0 !important; }
  /* trader picker: wallet + stats + best token stacked beside the checkbox */
  .b-tr { grid-template-columns: 20px minmax(0, 1fr) auto; grid-template-areas: "box w best" "box s s"; gap: 6px 10px; padding: 11px 12px; align-items: start; }
  .b-box { grid-area: box; margin-top: 1px; }
  .b-tw { grid-area: w; }
  .b-tstats { grid-area: s; display: flex; flex-wrap: wrap; gap: 3px 14px; }
  .b-tstats .b-n { text-align: left; font-size: 12.5px; }
  .b-tstats .b-n::before { content: attr(data-k) " "; font: 11.5px Geist, ui-sans-serif, system-ui, sans-serif; color: var(--muted-fg); }
  .b-best { grid-area: best; max-width: 150px; gap: 5px; padding-top: 1px; }
  .b-best b { font-size: 12.5px; }
  .b-best small { margin-left: 2px; font-size: 11.5px; }
  /* fills: two lines */
  .b-fr { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "tok tok amt amt" "ft src px pl"; gap: 4px 10px; padding: 10px 12px; }
  .b-fr > .b-side { display: none; } .b-fr > .b-tok { grid-area: tok; }
  .b-side.m { display: inline-block; flex: none; padding: 0 6px; font-size: 10px; } .b-fr > .b-amt { grid-area: amt; font-size: 13.5px; font-weight: 500; }
  .b-fr > .b-ft { grid-area: ft; flex-direction: row; gap: 5px; align-items: baseline; font-size: 11.5px; }
  .b-fr > .b-src { grid-area: src; font-size: 11.5px; }
  .b-fr > .b-px { grid-area: px; font-size: 11.5px; color: var(--muted-fg); }
  .b-fr > .b-pl { grid-area: pl; font-size: 12px; }
  .b-fr .b-tok small { display: none; }
  .tlogo.b-tl { width: 22px; height: 22px; font-size: 10px; }
  /* positions: token + PnL, then qty / cost / value */
  .b-pr { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "tok tok pl" "q c v"; gap: 8px 10px; padding: 11px 12px; }
  .b-pr > .b-tok { grid-area: tok; }
  .b-pr > .b-n:nth-child(2) { grid-area: q; } .b-pr > .b-n:nth-child(3) { grid-area: c; } .b-pr > .b-n:nth-child(4) { grid-area: v; }
  .b-pr > .b-ppl { grid-area: pl; }
  .b-pr > .b-n:not(.b-ppl) { display: flex; flex-direction: column; text-align: left; font-size: 12.5px; }
  .b-pr > .b-n:not(.b-ppl)::before { content: attr(data-k); font: 11px Geist, ui-sans-serif, system-ui, sans-serif; color: var(--muted-fg); }
  /* leaderboard: rank, bot (meta under the name), PnL */
  .b-log li { grid-template-columns: 58px 7px minmax(0, 1fr); gap: 8px; padding: 6px 12px; font-size: 13px; }
  .b-log time { font-size: 11.5px; }
  .b-togs { grid-template-columns: minmax(0, 1fr); }
  .b-grid.two { grid-template-columns: minmax(0, 1fr); }
  .b-step, .b-start { padding: 14px; }
  .b-sh { gap: 10px; }
  .b-cards { grid-template-columns: minmax(0, 1fr); }
  .b-chart { grid-template-columns: 50px minmax(0, 1fr); padding-right: 12px; }
  .b-yax, .b-plot { height: 170px; }
  .b-dh { gap: 12px; }
  .b-dt { min-width: 0; flex-basis: calc(100% - 60px); }
  .b-dt h2 { font-size: 21px; }
  .b-ctl { width: 100%; }
  .b-ctl .b-btn { flex: 1; }
  .b-confirm { width: 100%; }
  .b-seln { margin-left: 0; width: 100%; }
}
@media (max-width: 420px) {
  .b-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 10px; }
  .b-field small { font-size: 11.5px; }
  .b-c2 .b-seg { width: 100%; }
  .b-c2 .b-seg button { flex: 1; justify-content: center; }
}

/* agent builder (builder.js) + its hooks in bots.js: every class is bb-prefixed; colours come from the tokens above */
.bb-host { container-type: inline-size; }
.bb-head { margin-bottom: 14px; }
.bb-head h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.bb-head p { margin: 4px 0 0; color: var(--muted-fg); font-size: 14px; }
.bb-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--card); }
.bb-ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.bb-ch h3 { margin: 0; font-size: 15px; font-weight: 600; }
.bb-lbl { display: block; margin: 16px 0 8px; font-size: 13.5px; font-weight: 500; }
.bb-err { display: block; color: var(--bad); font-size: 12.5px; overflow-wrap: anywhere; }
.b-field small.bb-err { color: var(--bad); }
.bb-err:empty { display: none; }
.bb-berr { margin: -4px 0 12px; font-size: 13px; }
.bb-bad > .b-in, .bb-list.bb-bad .b-in, .b-in.bb-bad, textarea.bb-bad { border-color: color-mix(in srgb, var(--bad) 70%, var(--border)); }
.bb-empty { margin: 0; padding: 12px; border: 1px dashed var(--border); border-radius: 10px; color: var(--muted-fg); font-size: 13.5px; text-align: center; }
.bb-txt input { font: 15px Geist, ui-sans-serif, system-ui, sans-serif; }
.bb-mono input { font: 500 13px "Geist Mono", ui-monospace, monospace; }

/* describe → generate → questions */
.bb-desc .bb-lbl { margin-top: 0; font-size: 15px; font-weight: 600; }
.bb-desc textarea { display: block; width: 100%; min-height: 92px; resize: vertical; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--muted); font: 15px/1.5 Geist, ui-sans-serif, system-ui, sans-serif; color: var(--fg); outline: 0; }
.bb-desc textarea:focus { border-color: var(--purple); }
.bb-desc textarea::placeholder { color: var(--muted-fg); }
.bb-gbar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 10px; }
.bb-gbar small { font-size: 12.5px; color: var(--muted-fg); }
.bb-cerr, .bb-cok { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 0; font-size: 13.5px; overflow-wrap: anywhere; }
.bb-cerr { color: var(--bad); }
.bb-cok { color: var(--muted-fg); }
.bb-cok .b-i { color: var(--hi); }
.bb-cerr .b-i, .bb-cok .b-i { margin-top: 2px; }
.bb-qs { margin-top: 14px; padding: 14px; border: 1px solid color-mix(in srgb, var(--purple) 40%, var(--border)); border-radius: 12px; background: color-mix(in srgb, var(--purple) 5%, transparent); }
.bb-qh { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; }
.bb-qh .b-i { color: var(--purple); }
.bb-qh b { font-size: 14px; font-weight: 600; }
.bb-qh small { font-size: 12.5px; color: var(--muted-fg); }
.bb-q { margin-top: 12px; }
.bb-q label { display: block; margin-bottom: 6px; font-size: 13.5px; overflow-wrap: anywhere; }
.bb-q .b-in { height: 40px; background: var(--card); }
.bb-qo { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.bb-qo button { height: 28px; padding: 0 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--card); color: var(--fg); font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-qo button:hover { border-color: var(--purple); }
.bb-qbar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 12px; }
.bb-qmsg { font-size: 13px; color: var(--bad); }

/* templates */
.bb-tpls { margin-top: 22px; }
.bb-tlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.bb-tpl { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-width: 0; padding: 13px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); color: var(--fg); font: inherit; text-align: left; transition: border-color .15s, background .15s; }
.bb-tpl:hover { border-color: var(--purple); }
.bb-tpl:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
.bb-tpl.on { border-color: var(--purple); background: color-mix(in srgb, var(--purple) 7%, var(--card)); }
.bb-tpl.bb-tsk { cursor: default; border-style: dashed; }
.bb-tt { display: flex; align-items: center; gap: 9px; min-width: 0; }
.bb-tt b { flex: 1; min-width: 0; font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-tic { width: 28px; height: 28px; flex: none; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: var(--purple); }
.bb-tic .b-i { width: 15px; height: 15px; }
.bb-ton { display: inline-flex; align-items: center; gap: 4px; flex: none; font-size: 11.5px; font-weight: 600; color: var(--hi); }
.bb-ton .b-i { width: 12px; height: 12px; }
.bb-terr { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--border)); border-radius: 12px; color: var(--bad); font-size: 13.5px; }
.bb-terr span { flex: 1; min-width: 160px; overflow-wrap: anywhere; }
.bb-terr .b-btn { color: var(--fg); }
.bb-tpls .bb-cerr { margin: 0 0 10px; }

/* editor */
.bb-edw { margin-top: 22px; scroll-margin-top: 12px; }
.bb-zero { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 26px 18px; border: 1px dashed var(--border); border-radius: 16px; text-align: center; }
.bb-zero p { max-width: 460px; margin: 0; font-size: 14px; color: var(--muted-fg); }
.bb-steps { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.bb-steps li { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px 4px 4px; border: 1px solid var(--border-soft); border-radius: 999px; font-size: 13px; color: var(--muted-fg); }
.bb-steps .b-num { width: 22px; height: 22px; font-size: 11.5px; }
.bb-undo { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; padding: 8px 10px 8px 12px; border-radius: 12px; background: var(--accent); font-size: 13.5px; }
.bb-undo > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bb-undo > .b-i { color: var(--hi); }
.bb-ed { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "side" "blocks"; gap: 12px; align-items: start; }
.bb-name { grid-area: name; max-width: 420px; }
.bb-side { grid-area: side; min-width: 0; }
.bb-blocks { grid-area: blocks; min-width: 0; }
.bb-stat { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.bb-stat .b-i { width: 13px; height: 13px; }
.bb-stat.ok { color: var(--hi); background: color-mix(in srgb, var(--hi) 12%, transparent); }
.bb-stat.bad { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.bb-stat.busy, .bb-stat.off { color: var(--muted-fg); background: var(--muted); }
.bb-plain { display: flex; flex-direction: column; gap: 9px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 13.5px; line-height: 1.45; }
.bb-plain li { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; }
.bb-plain li > span:only-child { grid-column: 1 / -1; }
.bb-plain b { font-size: 12px; font-weight: 600; line-height: 1.7; color: var(--purple); }
.bb-plain span { overflow-wrap: anywhere; }
.bb-warn, .bb-gerr { display: flex; flex-direction: column; gap: 6px; margin: 12px 0 0; padding: 10px 12px; list-style: none; border-radius: 10px; font-size: 13px; }
.bb-warn { background: color-mix(in srgb, #f5a524 12%, transparent); color: color-mix(in srgb, #f5a524 70%, var(--fg)); }
.bb-gerr { background: color-mix(in srgb, var(--bad) 10%, transparent); color: var(--bad); }
.bb-warn li, .bb-gerr li { display: flex; gap: 7px; }
.bb-warn .b-i, .bb-gerr .b-i { width: 14px; height: 14px; margin-top: 2px; }
.bb-warn span, .bb-gerr span { overflow-wrap: anywhere; }

/* blocks */
.bb-blk { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 16px; }
.bb-blk + .bb-blk { margin-top: 12px; }
.bb-blk .b-sh { margin-bottom: 12px; }
.bb-blk .b-grid, .bb-wide { margin-top: 14px; }
.bb-types { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.bb-type { display: flex; align-items: center; gap: 8px; min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; background: transparent; color: var(--muted-fg); font-size: 13.5px; font-weight: 500; text-align: left; }
.bb-type span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-type:hover { background: var(--muted); color: var(--fg); }
.bb-type.on { border-color: var(--purple); background: color-mix(in srgb, var(--purple) 9%, transparent); color: var(--fg); }
.bb-type.on .b-i { color: var(--purple); }
.bb-thint { margin: 8px 0 0; font-size: 13px; color: var(--muted-fg); }
.bb-sub { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.bb-sub .b-grid { margin-top: 0; }
.bb-subh { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 12px; }
.bb-subh b { font-size: 13.5px; font-weight: 500; }
.bb-seg { flex-wrap: wrap; max-width: 100%; }
.bb-list .b-add { margin-top: 0; }
.bb-sel { position: relative; padding-right: 30px; }
.bb-sel::after { content: ""; position: absolute; top: 50%; right: 13px; width: 7px; height: 7px; border-right: 1.6px solid var(--muted-fg); border-bottom: 1.6px solid var(--muted-fg); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.bb-sel select { flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; -webkit-appearance: none; appearance: none; font: 500 14.5px Geist, ui-sans-serif, system-ui, sans-serif; color: var(--fg); cursor: pointer; text-overflow: ellipsis; }
.bb-sel select option { background: var(--card); color: var(--fg); }
.bb-frows { display: flex; flex-direction: column; gap: 8px; }
.bb-frow { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .85fr) minmax(0, 1.3fr) 34px; grid-template-areas: "f o v x"; gap: 8px; align-items: center; min-width: 0; }
.bb-frow > .bb-err { grid-column: 1 / -1; margin-top: -2px; }
.bb-ff { grid-area: f; min-width: 0; } .bb-fo { grid-area: o; min-width: 0; } .bb-fv { grid-area: v; min-width: 0; } .bb-frow > .bb-x { grid-area: x; }
.bb-frow .b-in { height: 40px; padding-left: 11px; }
.bb-frow .bb-sel { padding-right: 28px; }
.bb-frow .bb-sel select { font-size: 14px; }
.bb-fv.two { display: flex; align-items: center; gap: 6px; }
.bb-fv.two .b-in { flex: 1; min-width: 0; }
.bb-fv em { flex: none; font-style: normal; font-size: 12.5px; color: var(--muted-fg); }
.bb-x { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted-fg); font-size: 20px; line-height: 1; }
.bb-x:hover { background: var(--muted); color: var(--bad); }
.bb-addf { margin-top: 10px; }
.bb-addf .b-i { width: 14px; height: 14px; }
.bb-chks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bb-chk { position: relative; display: flex; align-items: center; gap: 9px; min-width: 0; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; cursor: pointer; }
.bb-chk:hover { background: var(--muted); }
.bb-chk input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bb-box { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border: 1.5px solid var(--border); border-radius: 5px; color: transparent; }
.bb-box svg { width: 12px; height: 12px; }
.bb-chk input:checked + .bb-box { border-color: var(--primary); background: var(--primary); color: var(--primary-fg); }
.bb-chk input:focus-visible + .bb-box { outline: 2px solid var(--purple); outline-offset: 2px; }
.bb-chk:has(input:checked) { border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); }
.bb-g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.bb-togs { grid-template-columns: minmax(0, 1fr); }
.bb-segf .b-seg { align-self: flex-start; }
.b-grid > .bb-segf.bb-full { grid-column: 1 / -1; }

/* JSON drawer */
.bb-json { margin-top: 12px; border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.bb-jt { display: flex; align-items: center; gap: 9px; width: 100%; padding: 13px 16px; border: 0; background: transparent; color: var(--fg); font-size: 14.5px; font-weight: 500; text-align: left; }
.bb-jt:hover { background: var(--muted); }
.bb-jt > span { flex: 1; }
.bb-jt .b-i { color: var(--muted-fg); }
.bb-jt > .b-i:last-child { transition: transform .15s; }
.bb-jt[aria-expanded="true"] > .b-i:last-child { transform: rotate(90deg); }
.bb-jb { padding: 0 16px 16px; }
.bb-jb textarea { display: block; width: 100%; min-height: 320px; resize: vertical; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--muted); font: 12.5px/1.55 "Geist Mono", ui-monospace, monospace; color: var(--fg); white-space: pre; overflow: auto; overflow-wrap: normal; tab-size: 2; outline: 0; }
.bb-jb textarea:focus { border-color: var(--purple); }
.bb-jerr { margin: 8px 0 0; font-size: 13px; color: var(--bad); overflow-wrap: anywhere; }
.bb-jerr:empty { display: none; }
.bb-jbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; margin-top: 10px; }
.bb-jbar small { font-size: 12.5px; color: var(--muted-fg); }
.bb-bts { margin-top: 12px; }
.bb-bts .b-num .b-i { width: 14px; height: 14px; }

/* hooks in bots.js: build entry, custom agent lines, create option */
.bb-xd { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 0; padding: 14px 16px; list-style: none; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--muted); font-size: 13.5px; line-height: 1.45; }
.bb-xd li { overflow-wrap: anywhere; }
.bb-xd b { margin-right: 4px; font-weight: 600; color: var(--purple); }

/* wide container: blocks left, plain words sticky on the right */
@container (min-width: 880px) {
  .bb-ed { grid-template-columns: minmax(0, 1fr) 300px; grid-template-areas: "name side" "blocks side"; column-gap: 16px; }
  .bb-side { grid-row: 1 / span 2; position: sticky; top: 8px; }
}
@container (max-width: 640px) {
  .bb-types { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bb-g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bb-segf { grid-column: 1 / -1; }
  .bb-frow { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) 34px; grid-template-areas: "f f x" "o v v"; }
  .bb-frows { gap: 12px; }
  .bb-frow + .bb-frow { padding-top: 12px; border-top: 1px dashed var(--border); }
  .bb-name { max-width: none; }
}
@container (max-width: 560px) {
  .bb-tlist { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .bb-tlist::-webkit-scrollbar { display: none; }
  .bb-tpl { flex: 0 0 min(78%, 280px); scroll-snap-align: start; }
  .bb-card, .bb-blk { padding: 14px; }
  .bb-jb { padding: 0 14px 14px; }
  .bb-jb textarea { min-height: 260px; }
  .bb-chks { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .bb-seg3 button { flex: 1 1 auto; padding: 6px 8px; }
  .bb-seg3 .b-i { display: none; }
}

/* agents overview (bots.js): every class is ag-prefixed; only live data moves (count-up, row slide-in, value flash, pulse) */
.b-wrap.ag-wide { max-width: 1320px; }
.ag-cnt { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: var(--purple); font: 600 11.5px/20px "Geist Mono", monospace; text-align: center; }
.ag-cnt:empty { display: none; }
.b-st.running i { animation: pulse 1.6s ease-in-out infinite; }
.ag-home { container: aghome / inline-size; display: flex; flex-direction: column; gap: 14px; }
.ag-fv, .ag-kpi > b > span, .ag-smw b { padding: 0 3px; margin: 0 -3px; border-radius: 6px; }
.ag-pad { padding: 12px 14px; }
.ag-none { padding: 26px 18px; text-align: center; font-size: 13.5px; color: var(--muted-fg); }
.ag-skr { padding: 11px 14px; border-top: 1px solid var(--border-soft); }
.ag-skr:first-child { border-top: 0; }
.ag-skr .b-skel { height: 30px; }

/* hero */
.ag-kpi { display: flex; flex-direction: column; gap: 5px; min-width: 0; margin: 0; padding: 16px 18px 15px; border: 0; border-radius: 0; background: var(--card); color: var(--fg); font: inherit; text-align: left; }
.ag-kpi small { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 11.5px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-kpi > b { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 38px; font-weight: 600; line-height: 1.08; letter-spacing: -.03em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-kpi > b em { font-style: normal; font-size: 15px; font-weight: 600; letter-spacing: 0; }
.ag-kpi > span { font-size: 12.5px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--hi); animation: pulse 1.6s ease-in-out infinite; }

/* panels: tape + smart money */
.ag-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.ag-panel { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.ag-ph { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--border-soft); }
.ag-ph h2, .ag-sh h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.005em; white-space: nowrap; }
.ag-ph small { margin-left: auto; font-size: 12px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--muted-fg); white-space: nowrap; }
.ag-live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted-fg); }
.ag-live.on { color: var(--hi); }
.ag-live.on::before { background: var(--hi); animation: pulse 1.6s ease-in-out infinite; }
.ag-live.connecting::before, .ag-live.retry::before { background: #f5a524; }
.ag-live.paused { color: var(--fg); }
.ag-live.paused::before { background: var(--purple); }
.ag-tgl { margin-left: auto; height: 26px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: transparent; font-size: 12px; font-weight: 500; color: var(--muted-fg); white-space: nowrap; }
.ag-tgl:hover { color: var(--fg); }
.ag-tapew { position: relative; flex: 1; min-height: 0; }
.ag-tape { max-height: 440px; min-height: 96px; margin: 0; padding: 0; list-style: none; overflow-y: auto; scrollbar-width: thin; }
.ag-newn { position: absolute; z-index: 2; top: 8px; left: 50%; transform: translateX(-50%); height: 28px; padding: 0 13px; border: 0; border-radius: 999px; background: var(--fg); color: var(--bg); font: 600 12.5px "Geist Mono", monospace; box-shadow: 0 4px 14px rgba(0, 0, 0, .25); }
.ag-tr { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto 70px; grid-template-areas: "lg t1 tu tt" "lg t2 tp tp"; column-gap: 10px; row-gap: 2px; align-items: center; padding: 8px 14px; border-top: 1px solid var(--border-soft); cursor: pointer; }
.ag-tr:first-child { border-top: 0; }
.ag-tr:hover { background: var(--muted); }
.ag-tr > .tlogo { grid-area: lg; align-self: start; margin-top: 2px; }
.ag-t1 { grid-area: t1; display: flex; align-items: center; gap: 7px; min-width: 0; }
.ag-sym { flex: none; max-width: 46%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; font-weight: 600; }
.ag-rx { flex: none; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--purple); }
.ag-tu { grid-area: tu; font: 500 13px "Geist Mono", monospace; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ag-tp { grid-area: tp; font: 600 12.5px "Geist Mono", monospace; text-align: right; white-space: nowrap; }
.ag-tt { grid-area: tt; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted-fg); text-align: right; white-space: nowrap; }
.ag-bd { flex: none; padding: 1px 6px; border-radius: 5px; font: 600 10.5px/1.5 "Geist Mono", monospace; letter-spacing: .05em; white-space: nowrap; }
.ag-bd.buy { color: var(--hi); background: color-mix(in srgb, var(--hi) 14%, transparent); }
.ag-bd.sell, .ag-bd.err { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.ag-bd.skip { color: var(--muted-fg); background: var(--secondary); }
.ag-bd.warn { color: color-mix(in srgb, #f5a524 75%, var(--fg)); background: color-mix(in srgb, #f5a524 15%, transparent); }
.ag-tr.skip > .tlogo, .ag-tr.skip .ag-sym, .ag-tr.skip .ag-tu { opacity: .5; }
.ag-noskip .ag-tr.skip { display: none; }
.tlogo.b-tl.ag-tev { color: color-mix(in srgb, #f5a524 75%, var(--fg)); }
.ag-tev .b-i { width: 14px; height: 14px; }
.ag-tnone { padding: 30px 18px; text-align: center; font-size: 13.5px; color: var(--muted-fg); }
.ag-tsk { padding: 11px 14px; border-top: 1px solid var(--border-soft); }
.ag-tsk:first-child { border-top: 0; }
.ag-tsk .b-skel { height: 30px; }
.ag-smartp { container: agsmart / inline-size; }
.ag-smh, .ag-sm { display: grid; grid-template-columns: 30px minmax(0, 1fr) 66px 78px auto; column-gap: 10px; align-items: center; }
.ag-smh { padding: 6px 14px; border-bottom: 1px solid var(--border-soft); font-size: 11.5px; color: var(--muted-fg); }
.ag-smh:has(+ .ag-smartl > .ag-none), .ag-smh:has(+ .ag-smartl > .ag-pad) { display: none; }
.ag-smh span:first-child { grid-column: 1 / 3; }
.ag-smh span:nth-child(2), .ag-smh span:nth-child(3) { text-align: right; }
.ag-smartl { flex: 1; min-height: 0; max-height: 430px; overflow-y: auto; scrollbar-width: thin; }
.ag-sm { padding: 9px 14px; border-top: 1px solid var(--border-soft); }
.ag-sm:first-child { border-top: 0; }
.tlogo.b-tl.ag-lg { width: 30px; height: 30px; font-size: 12px; }
.ag-smn { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ag-smn b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; }
.ag-smn b.mono { font-size: 13px; }
.ag-smn small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; color: var(--muted-fg); }
.ag-smn a { color: inherit; text-decoration: none; }
.ag-smn a:hover { color: var(--purple); }
.ag-smw, .ag-smv { display: flex; flex-direction: column; align-items: flex-end; min-width: 0; line-height: 1.2; }
.ag-smw b { font: 600 20px "Geist Mono", monospace; letter-spacing: -.02em; }
.ag-smv b { font: 600 14px "Geist Mono", monospace; }
.ag-smw small, .ag-smv small { font-size: 11px; color: var(--muted-fg); white-space: nowrap; }
.ag-launch { height: 30px; padding: 0 10px; border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); font-size: 12.5px; }
.ag-launch .b-i { width: 13px; height: 13px; }
.ag-launch:hover:not(:disabled) { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
@container agsmart (max-width: 520px) {
  .ag-smh, .ag-sm { grid-template-columns: 30px minmax(0, 1fr) 64px 76px; }
  .ag-sm { grid-template-areas: "lg nm w v" "bt bt bt bt"; row-gap: 8px; padding: 10px 14px 12px; }
  .ag-sm > .tlogo { grid-area: lg; } .ag-smn { grid-area: nm; } .ag-smw { grid-area: w; } .ag-smv { grid-area: v; }
  .ag-launch { grid-area: bt; width: 100%; }
  .ag-ls { display: none; } .ag-ll { display: inline; }
}

/* sections */
.ag-sec { min-width: 0; margin-top: 12px; scroll-margin-top: 12px; }
.ag-sh { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.ag-sh h2 { font-size: 18px; letter-spacing: -.01em; }
.ag-sh small { font-size: 13px; color: var(--muted-fg); }
.ag-sh .b-seg, .ag-shb { margin-left: auto; }
.ag-shb { display: flex; gap: 8px; }
.ag-shb .b-i { width: 14px; height: 14px; }

/* leaderboard: a table on wide screens, cards on narrow ones */
.ag-mv { font: 600 10.5px "Geist Mono", monospace; font-style: normal; white-space: nowrap; }
.ag-mv.up { color: var(--hi); } .ag-mv.down { color: var(--bad); } .ag-mv.new { color: var(--purple); }
.ag-copy { height: 30px; padding: 0 10px; border-color: color-mix(in srgb, var(--primary) 55%, var(--border)); font-size: 12.5px; }
.ag-copy .b-i { width: 14px; height: 14px; }
.ag-copy:hover:not(:disabled), .ag-lr.top .ag-copy { background: var(--primary); border-color: var(--primary); color: var(--primary-fg); }
@container aghome (max-width: 900px) {
  .ag-copy { width: 100%; height: 36px; }
}

/* templates */
.ag-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ag-tc { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--card); }
.ag-tch { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ag-tch b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; font-weight: 600; }
.ag-run { display: inline-flex; align-items: center; gap: 5px; flex: none; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--hi); }
.ag-run i { width: 6px; height: 6px; border-radius: 50%; background: var(--hi); animation: pulse 1.6s ease-in-out infinite; }
.ag-thl { margin: 0; font-size: 13px; color: var(--muted-fg); }
.ag-thl b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.ag-tcf { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-top: auto; padding-top: 6px; }
.b-btn.ag-go { border-color: var(--primary); background: var(--primary); color: var(--primary-fg); font-weight: 600; }
.b-btn.ag-go:hover:not(:disabled) { background: var(--primary); filter: brightness(.95); }
.ag-go .b-i { width: 14px; height: 14px; }

/* my agents */
.ag-cpl { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; min-width: 0; }
.ag-cpl .ag-spk { width: 120px; flex: none; }
.ag-mempty { padding: 28px 20px; }
.ag-mempty p { margin-bottom: 16px; }
.ag-ebtns { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ag-ebtns .b-i { width: 15px; height: 15px; }

/* motion: data only */
@keyframes agin { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }
@keyframes agbuy { from { background: color-mix(in srgb, var(--hi) 16%, transparent); } to { background: transparent; } }
@keyframes agsell { from { background: color-mix(in srgb, var(--bad) 14%, transparent); } to { background: transparent; } }
@keyframes agfu { from { background: color-mix(in srgb, var(--hi) 28%, transparent); } to { background: transparent; } }
@keyframes agfd { from { background: color-mix(in srgb, var(--bad) 26%, transparent); } to { background: transparent; } }
.ag-in { animation: agin .35s ease-out; }
.ag-in.ag-inb { animation: agin .35s ease-out, agbuy 2.4s ease-out; }
.ag-in.ag-ins { animation: agin .35s ease-out, agsell 2.4s ease-out; }
.ag-fu { animation: agfu 1.6s ease-out; }
.ag-fd { animation: agfd 1.6s ease-out; }

/* notes under a replay */
.ag-notes { margin-top: 10px; font-size: 12.5px; color: var(--muted-fg); }
.ag-notes summary { cursor: pointer; }
.ag-notes summary:hover { color: var(--fg); }
.ag-notes ul { margin: 8px 0 0; padding-left: 18px; }
.ag-notes li { overflow-wrap: anywhere; }
.ag-notes li + li { margin-top: 4px; }
.b-btres .b-chart + .b-chart { margin-top: 0; }

/* agents home: wide container (tape beside smart money) and narrow (phones) */
@container aghome (min-width: 980px) {
  .ag-row { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
  .ag-row > .ag-panel { height: 548px; }
  .ag-tape { height: auto; position: absolute; inset: 0; }
  .ag-smartl { max-height: none; }
}
@container aghome (max-width: 640px) {
  .ag-kpi { padding: 13px 14px 12px; }
  .ag-kpi > b { font-size: 28px; gap: 6px; }
  .ag-kpi > b em { font-size: 12.5px; }
  .ag-kpi small { font-size: 10.5px; letter-spacing: .05em; }
  .ag-kpi > span { font-size: 11.5px; }
  .ag-tr { grid-template-columns: 24px minmax(0, 1fr) auto 62px; padding: 8px 12px; column-gap: 8px; }
  .ag-tpls { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: 16px; gap: 10px; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .ag-tpls::-webkit-scrollbar { display: none; }
  .ag-tc { flex: 0 0 min(84%, 320px); scroll-snap-align: start; }
  .ag-sh h2 { font-size: 17px; }
  .ag-shb { margin-left: 0; width: 100%; }
  .ag-shb .b-btn { flex: 1; }
  .ag-sh .b-seg { margin-left: 0; width: 100%; }
  .ag-sh .b-seg button { flex: 1; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  .ag-in, .ag-in.ag-inb, .ag-in.ag-ins, .ag-fu, .ag-fd, .ag-dot, .ag-run i, .ag-live.on::before, .b-st.running i { animation: none; }
}

/* ── Trust on Monad (trust.js): the agent's ERC-8004 identity and track record, the Trust tab, the home strip ── */
.tr-sec { margin-top: 24px; }
.tr-grid, .tr-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tr-tile { min-width: 0; padding: 11px 13px; border: 1px solid var(--border-soft); border-radius: 12px; background: var(--muted); }
.tr-tile small { display: block; font-size: 12px; color: var(--muted-fg); }
.tr-tile b { display: block; margin-top: 2px; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-tile span { display: block; margin-top: 4px; font-size: 12px; color: var(--muted-fg); overflow-wrap: anywhere; }
.tr-ln { color: var(--fg); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
.tr-ln:hover { text-decoration-color: var(--hi); }
.tr-verify { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.tr-res { font-size: 13px; color: var(--muted-fg); flex: 1; min-width: 220px; }
.tr-res.ok { color: var(--hi); }
.tr-res.bad { color: var(--bad); }
.tr-rate { display: flex; align-items: center; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.tr-rate small { color: var(--muted-fg); font-size: 12px; }
.tr-star { padding: 0 2px; border: 0; background: none; font-size: 22px; line-height: 1; color: var(--border); cursor: pointer; }
.tr-star.on { color: #f5b301; }
.tr-note { margin: 10px 0 0; font-size: 13px; color: var(--muted-fg); overflow-wrap: anywhere; }
.tr-fills, .tr-how { margin-top: 12px; font-size: 13px; }
.tr-fills summary, .tr-how summary { cursor: pointer; color: var(--muted-fg); }
.tr-how p { margin: 8px 0 0; color: var(--muted-fg); line-height: 1.55; }
.tr-tbl { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; }
.tr-tbl th, .tr-tbl td { padding: 7px 8px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; }
.tr-tbl th { font-weight: 500; color: var(--muted-fg); font-size: 12px; }
.tr-wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px 56px; }
.tr-head h1 { margin: 0; font-size: 30px; letter-spacing: -.02em; }
.tr-head p { margin: 8px 0 18px; max-width: 760px; color: var(--muted-fg); }
.tr-steps { margin: 4px 0 0; padding-left: 20px; color: var(--muted-fg); font-size: 14px; line-height: 1.7; }
@media (max-width: 760px) { .tr-grid, .tr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .tr-wrap { padding: 20px 16px 40px; } .tr-tbl { display: block; overflow-x: auto; } }
