/* The global layer, loaded after style.css: one type scale, one spacing scale, tabular figures, the same radii and borders,
   skeletons instead of "Loading…", token monograms, and fixed heights where live data lands (no layout shift).
   Scope: the Ask app (rail, chats sidebar, top bar, home, chat and answer) plus w- utilities. The Agents screens keep their
   own b- / ag- / mk- rules in style.css; the density layer for them (one-line tape, (i) popovers, chips) is at the end of this
   file. Colours are style.css tokens only. */
:root {
  --fs-11: 11px; --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-15: 15px; --fs-17: 17px; --fs-20: 20px; --fs-28: 28px; --fs-40: 40px;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 20px; --sp-6: 24px; --sp-8: 32px;
  --r-xs: 6px; --r-sm: 8px; --r-md: 10px; --r-lg: 12px; --r-xl: 16px;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ── utilities ─────────────────────────────────────────────────────────────────────────────────────────────────────── */
.w-sk { display: inline-block; height: 10px; min-width: 16px; border-radius: 5px; vertical-align: middle; background: linear-gradient(90deg, var(--muted) 0%, var(--secondary) 50%, var(--muted) 100%); background-size: 200% 100%; animation: wsk 1.3s linear infinite; }
@keyframes wsk { to { background-position: -200% 0; } }
.w-num, .fig { font-variant-numeric: tabular-nums; }
@keyframes wpulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .w-sk, .wtime .wdot, .think.live { animation: none; } }

/* token pictures: the monogram (two letters on the token's own hue) shows while the image loads and stays if it fails */
.tlogo[style*="--mh"] { background: hsl(var(--mh) 30% 20%); }
.tlogo[style*="--mh"] b { color: hsl(var(--mh) 55% 80%); font-size: .9em; letter-spacing: -.03em; }
[data-theme="light"] .tlogo[style*="--mh"] { background: hsl(var(--mh) 55% 91%); }
[data-theme="light"] .tlogo[style*="--mh"] b { color: hsl(var(--mh) 45% 30%); }
.tlogo img[data-tl] { opacity: 0; transition: opacity .16s; }
.tlogo img[data-tl].on { opacity: 1; }

/* ── rail, chats sidebar, top bar ──────────────────────────────────────────────────────────────────────────────────── */
.railitem { font-size: var(--fs-12); }
.newchat { font-size: var(--fs-14); font-weight: 500; border-radius: var(--r-md); }
.search input { font-size: var(--fs-14); }
.threads .grp { margin: 14px 10px 4px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .07em; }
.threads .t { padding: 7px 10px; border-radius: var(--r-sm); }
.threads .t b { font-size: 13.5px; }
.threads .t small { font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.sidenote { font-size: var(--fs-12); }
.sidecard { font-size: var(--fs-13); line-height: 1.45; border-radius: var(--r-md); }
.sidecard b { font-size: var(--fs-14); }
.topbar { height: 56px; }
.title { font-size: var(--fs-14); }
.tb { font-size: var(--fs-14); }
.tb.credits { min-width: 0; font-variant-numeric: tabular-nums; }
.tb.credits .w-cr { width: 96px; }

/* ── home ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
.home { padding-top: 56px; }
.agentpill { height: 32px; font-size: var(--fs-13); border-radius: var(--r-md); }
.home h1 { margin: 32px 0 26px; font-size: var(--fs-40); letter-spacing: -.028em; }
.composer textarea { font-size: var(--fs-15); }
.ctool { font-size: var(--fs-14); }
.cats { gap: 6px; margin-top: 20px; }
.cat { height: 32px; padding: 0 12px; gap: 6px; font-size: var(--fs-14); }
.cat:hover { background: var(--muted); }
/* suggestions: compact cards, two a row; a lone last card takes the full row */
.sugs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 12px; border: 0; border-radius: 0; overflow: visible; }
.sug, .sug:first-child { display: flex; align-items: flex-start; gap: 10px; min-height: 66px; padding: 12px 12px 12px 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: transparent; font-size: var(--fs-14); line-height: 1.5; transition: border-color .12s, background-color .12s; }
.sug:hover { background: var(--muted); border-color: color-mix(in srgb, var(--purple) 50%, var(--border)); }
.sug:last-child:nth-child(odd) { grid-column: 1 / -1; min-height: 0; }
.sug .sgt { flex: 1; min-width: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.sug .spill { height: 22px; margin: 0 2px 0 0; padding: 0 8px 0 2px; vertical-align: -5px; gap: 5px; font-size: var(--fs-13); }
.sug .spill .tlogo { width: 18px; height: 18px; font-size: 8px; }
.sug .spill small { max-width: 120px; }
.sug .fig { font-weight: 600; }
.sug > i { margin-top: 2px; width: 14px; height: 14px; color: var(--muted-fg); }
.sug:hover > i { color: var(--fg); }
.sug.sk { flex-direction: column; justify-content: center; gap: 9px; cursor: default; }
.sug.sk:hover { background: transparent; border-color: var(--border); }
.sug.sk .w-sk { height: 10px; }

/* ── chat ──────────────────────────────────────────────────────────────────────────────────────────────────────────── */
.uq div { padding: 10px 14px; font-size: var(--fs-15); line-height: 1.5; }
.pills { gap: 6px; margin: 2px 0 10px; }
.pill { height: 30px; padding: 0 11px; font-size: var(--fs-13); }
.chips { gap: 6px; margin: 0 0 12px; }
.chip { height: 30px; font-size: var(--fs-13); }
.chip .cp { font-size: var(--fs-12); font-variant-numeric: tabular-nums; }
.chip .up, .chip .down { font: 500 11.5px var(--mono); }
details.thought, .think { font-size: var(--fs-12); }

/* live work header: a live dot, then the running clock in fixed-width digits (the line never jumps) */
.wtime { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--muted-fg); }
.wtime .wdot { width: 6px; height: 6px; border-radius: 50%; background: var(--hi); animation: wpulse 1.2s ease-in-out infinite; }
.wtime .wt { min-width: 38px; font: 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--fg); }

/* the harness as a vertical timeline: node · what it did · source · subject, the time on the right with a bar scaled to the
   slowest lookup; cards it found sit under it */
.wv, .steps { gap: 4px; }
.steps { margin: 0 0 16px; padding: 2px 0 4px; border-left: 0; }
.tlg { display: flex; flex-direction: column; }
.tl { position: relative; display: grid; grid-template-columns: 13px minmax(0, 1fr) auto; column-gap: 10px; align-items: start; padding: 4px 0; }
.tl:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 14px; height: 100%; width: 1px; background: var(--border); }
.tl-node { position: relative; z-index: 1; display: grid; place-items: center; width: 13px; height: 13px; margin-top: 4px; border-radius: 50%; }
.tl:not(.run) .tl-node { border: 1.5px solid var(--hi); background: var(--card); }
.tl:not(.run) .tl-node::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--hi); }
.tl.bad .tl-node { border-color: var(--bad); }
.tl.bad .tl-node::after { background: var(--bad); }
.tl.run .tl-node .sspin { width: 13px; height: 13px; }
.tl-main { min-width: 0; }
.tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; min-height: 21px; font-size: 13.5px; line-height: 1.4; }
.tl-head .slbl { color: var(--fg); }
.tl.run .tl-head .slbl { color: var(--muted-fg); }
.tl.bad .tl-head .slbl { color: var(--bad); }
.tl-head .svia { font: 500 10.5px var(--mono); letter-spacing: .05em; }
.tl-head .schip { max-width: 100%; height: 20px; padding: 0 7px; border-radius: var(--r-xs); font: 11.5px var(--mono); }
.tl-sum { margin-top: 1px; font: 11.5px/1.45 var(--mono); color: var(--muted-fg); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tl .serr { margin: 2px 0 0; }
.tl-ms { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; height: 21px; font: 11.5px var(--mono); color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.tl-ms b { min-width: 42px; font-weight: 400; text-align: right; }
.tl-ms i { position: relative; width: 56px; height: 3px; border-radius: 2px; background: var(--secondary); overflow: hidden; }
.tl-ms i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); border-radius: 2px; background: color-mix(in srgb, var(--purple) 80%, transparent); }
.tl-ms .w-sk { width: 56px; height: 3px; }
.tl > .scards { grid-column: 2 / -1; margin: 8px 0 4px; }
.tl-round { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 2px 23px; font: 500 10.5px var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--muted-fg); }
.tl-round:first-child { margin-top: 0; }
.tl-round b { font-weight: 500; color: var(--fg); }
.tcard { border-radius: var(--r-lg); }
.tcp b { font-size: 13.5px; }

/* the answer: prose, tables and charts on one column grid, the same border, radius and header row */
.md { font-size: var(--fs-15); line-height: 1.65; }
.md h2, .md h3 { font-size: 17px; margin: 22px 0 8px; }
.md .tbl { margin: 10px 0 16px; border-radius: var(--r-lg); }
.md table, .viz table { overflow-wrap: normal; }
.md table { font-size: 13.5px; line-height: 1.4; }
.md th { padding: 8px 12px; font-size: var(--fs-12); white-space: nowrap; background: var(--muted); }
.md td { padding: 8px 12px; }
.md th.r, .md td.r { text-align: right; }
.md td.r { font-variant-numeric: tabular-nums; }
.md td.addr { font: 12.5px var(--mono); }
.md td.up, .viz td.up { color: var(--hi); }
.md td.down, .viz td.down { color: var(--bad); }
.md tbody tr:hover td, .viz tr:hover td { background: color-mix(in srgb, var(--muted) 70%, transparent); }
.vizbox { gap: 12px; margin: 12px 0 8px; }
.viz { border-radius: var(--r-lg); background: var(--card); }
.viz summary, .viz .vh { display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 9px 14px; font-size: var(--fs-13); font-weight: 500; color: var(--fg); }
.viz .vh { cursor: default; }
.viz summary { list-style: none; }
.viz summary::-webkit-details-marker { display: none; }
.viz summary::before { content: "›"; flex: none; width: 10px; font-size: 16px; line-height: 1; color: var(--muted-fg); transition: transform .15s; }
.viz[open] summary::before { transform: rotate(90deg); }
.viz summary small { margin-left: auto; font: 11.5px var(--mono); color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.viz .vt1 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viz th { padding: 8px 14px; font-size: var(--fs-12); background: var(--muted); }
.viz th.r { text-align: right; }
.viz td { padding: 7px 14px; }
.viz td.r { font-variant-numeric: tabular-nums; }
.vlast { margin-left: auto; display: inline-flex; align-items: baseline; gap: 8px; flex: none; font-variant-numeric: tabular-nums; }
.vlast b { font: 600 17px var(--mono); letter-spacing: -.01em; color: var(--fg); }
.vlast small { font: 500 12px var(--mono); }
.vlast .up { color: var(--hi); }
.vlast .down { color: var(--bad); }
.viz.chart { padding-bottom: 6px; }
.vplot { position: relative; height: 200px; margin-right: 2px; touch-action: pan-y; }
.viz.chart .vplot svg { display: block; width: 100%; height: 200px; }
.viz.chart text { font: 10.5px var(--mono); fill: var(--muted-fg); }
.vxh { position: absolute; top: 10px; bottom: 24px; width: 1px; background: var(--muted-fg); opacity: .5; pointer-events: none; }
.vdot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border: 2px solid var(--card); border-radius: 50%; pointer-events: none; }
.vtip { position: absolute; top: 4px; z-index: 2; display: flex; flex-direction: column; gap: 2px; padding: 6px 9px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--card); font: 11.5px var(--mono); white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
.vtip small { color: var(--muted-fg); font-size: 11px; }
.vtip span { display: flex; align-items: center; gap: 6px; }
.vtip i { width: 7px; height: 7px; border-radius: 2px; }
.vtip b { font-weight: 500; color: var(--fg); }
.viz .vleg { font-size: var(--fs-12); }
.srcs { gap: 6px; margin-top: 6px; }
.src { height: 26px; font-size: var(--fs-12); }
.follow .fh { font-size: var(--fs-14); }
.follow button { font-size: var(--fs-14); padding: 10px 0; }
.meta { font-size: var(--fs-12); }

/* ── narrow screens ────────────────────────────────────────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .home { padding-top: 32px; }
  .home h1 { font-size: var(--fs-28); margin: 20px 0 18px; }
  /* the chain categories scroll sideways in one row, edge to edge, instead of five rows above the fold */
  .cats { flex: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; width: calc(100% + 32px); max-width: none; margin: 16px -16px 0; padding: 0 16px; }
  .cats::-webkit-scrollbar { display: none; }
  .cat { flex: none; }
  .sugs { grid-template-columns: minmax(0, 1fr); }
  .sug, .sug:first-child { min-height: 0; }
  .tl-ms i, .tl-ms .w-sk { display: none; }
  .tl-ms b { min-width: 0; }
  .vlast b { font-size: var(--fs-15); }
}
@media (max-width: 480px) {
  .topbar { gap: 6px; padding: 0 6px 0 8px; }
  .topbar .tb { height: 34px; }
  .topbar .tb.sq, .topbar .tb.signin { width: 34px; }
  .threadacts { gap: 0; margin-left: 0; }
  .threadacts .tb.ghost { width: 32px; padding: 0; justify-content: center; }
  .tb.credits { padding: 0 9px; gap: 6px; }
  .tb.credits .w-cr { width: 22px; }
  .tb.primary { padding: 0 12px; }
  .viz summary, .viz .vh { padding: 9px 12px; }
}

/* ══ Agents (bots.js / builder.js): pictures, tape, builder, replay ══════════════════════════════════════════════════════ */


/* tape: BUY / SELL are the stars, single skips stay quiet, a run of skips folds into one line */
.ag-tr.fill { padding-top: 9px; padding-bottom: 9px; }
.ag-tr.fill > .tlogo { width: 28px; height: 28px; }
.ag-tr.fill .ag-sym { font-size: 14px; }
.ag-tr.fill .ag-tu { font-weight: 600; color: var(--fg); }
.ag-tr.skip { padding-top: 6px; padding-bottom: 6px; }
.ag-tr.skip > .tlogo { width: 22px; height: 22px; margin-left: 2px; font-size: 9.5px; }
.ag-skg { border-top: 1px solid var(--border-soft); }
.ag-skg:first-child { border-top: 0; }
.ag-skb { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 6px 14px 6px 50px; border: 0; background: transparent; color: var(--muted-fg); font-size: 12.5px; text-align: left; }
.ag-skb:hover { background: var(--muted); }
.ag-skn { flex: none; white-space: nowrap; }
.ag-skn b { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--fg); }
.ag-skw { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-skw::before { content: "·"; margin-right: 8px; }
.ag-skw i { margin-left: 3px; font: 500 11.5px var(--mono); font-style: normal; color: var(--fg); }
.ag-skb .ag-tt { flex: none; }
.ag-skc { display: inline-flex; flex: none; width: 13px; height: 13px; transition: transform .15s; }
.ag-skc svg { width: 100%; height: 100%; }
.ag-skg.open .ag-skc { transform: rotate(90deg); }
.ag-skl { margin: 0; padding: 0; list-style: none; background: color-mix(in srgb, var(--muted) 55%, transparent); }
.ag-noskip .ag-skg { display: none; }

/* chips */
.ag-chip { flex: none; max-width: 170px; padding: 1px 7px; border: 1px solid var(--border); border-radius: 6px; font: 500 11px/1.5 Geist, ui-sans-serif, system-ui, sans-serif; font-style: normal; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* builder: the five blocks as one pipeline, joined where the numbers line up */
.bb-blocks > .bb-blk + .bb-blk { position: relative; margin-top: 22px; }
.bb-blocks > .bb-blk + .bb-blk::before { content: ""; position: absolute; left: 28px; top: -23px; width: 2px; height: 22px; background: var(--border); }
.bb-blocks > .bb-blk + .bb-blk::after { content: ""; position: absolute; left: 25px; top: -7px; border: 4px solid transparent; border-top: 5px solid var(--border); }
.bb-steps { gap: 0; }
.bb-steps li + li { position: relative; margin-left: 20px; }
.bb-steps li + li::before { content: ""; position: absolute; left: -21px; top: 50%; width: 20px; height: 1px; background: var(--border); }
/* replay: one big number beside the equity curve, then what it was checked against */
.bb-rep { display: grid; grid-template-columns: minmax(220px, 300px) minmax(0, 1fr); gap: 14px; align-items: stretch; }
.bb-lead { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; }
.bb-lead > small { font: 500 11px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted-fg); }
.bb-big { font-size: 40px; font-weight: 600; line-height: 1.05; letter-spacing: -.035em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bb-on { font-size: 12.5px; color: var(--muted-fg); font-variant-numeric: tabular-nums; }
.bb-on b { font-weight: 600; }
.bb-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 6px 0 0; padding-top: 10px; border-top: 1px solid var(--border-soft); }
.bb-kv div { min-width: 0; }
.bb-kv dt { font-size: 11.5px; color: var(--muted-fg); }
.bb-kv dd { margin: 0; font: 500 15px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bb-sum { margin: auto 0 0; padding-top: 8px; font-size: 12px; line-height: 1.45; color: var(--muted-fg); }
.bb-eq { min-width: 0; }
.bb-eq > .b-chart, .bb-eq > .b-none { height: 100%; }
.bb-src { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--hi) 30%, var(--border)); border-radius: 10px; font-size: 12.5px; line-height: 1.5; color: var(--muted-fg); }
.bb-src .b-i { flex: none; width: 15px; height: 15px; margin-top: 1px; color: var(--hi); }
.bb-src b { font-weight: 600; color: var(--fg); }
.bb-more summary { cursor: pointer; font-size: 12.5px; color: var(--muted-fg); }
@media (max-width: 760px) {
  .bb-rep { grid-template-columns: minmax(0, 1fr); }
  .bb-big { font-size: 34px; }
  .bb-steps { flex-direction: column; align-items: flex-start; }
  .bb-steps li + li { margin: 10px 0 0; }
  .bb-steps li + li::before { left: 15px; top: -11px; width: 1px; height: 10px; }
}


/* skipped runs on the tape */
.ag-skb { position: relative; }
.ag-skc { position: absolute; left: 21px; top: 50%; margin-top: -6.5px; }
@container aghome (max-width: 640px) {
  .ag-skb { flex-wrap: wrap; row-gap: 2px; }
  .ag-skw { order: 3; flex-basis: 100%; white-space: normal; }
  .ag-skw::before { content: none; }
  .ag-skb .ag-tt { margin-left: auto; }
}

/* ══ Agents, terminal density: numbers carry the screen; notes sit behind (i); one line per tape row ═══════════════════ */
/* PAPER and replay as chips */
.ag-pp { display: inline-flex; align-items: center; flex: none; height: 18px; padding: 0 6px; border: 1px solid color-mix(in srgb, var(--purple) 55%, var(--border)); border-radius: 5px; font: 600 10px/1 var(--mono); font-style: normal; letter-spacing: .07em; color: var(--purple); white-space: nowrap; }
.ag-rp { display: inline-flex; align-items: center; flex: none; height: 17px; margin: 0 6px; padding: 0 5px; border: 1px solid var(--border); border-radius: 4px; font: 500 10px/1 var(--mono); font-style: normal; letter-spacing: .02em; color: var(--muted-fg); white-space: nowrap; vertical-align: 2px; }
.b-bth > .ag-rp { margin-left: 0; }
/* (i): a popover anchored to the full width of its host, never wider than it (no sideways scroll on a phone) */
.ag-i { display: inline-flex; flex: none; vertical-align: middle; }
.ag-i > summary { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; list-style: none; color: var(--muted-fg); cursor: pointer; }
.ag-i > summary::-webkit-details-marker { display: none; }
.ag-i > summary:hover, .ag-i[open] > summary { color: var(--fg); background: var(--muted); }
.ag-i > summary:focus-visible { outline: 2px solid var(--purple); outline-offset: 1px; }
.ag-i > summary svg { width: 15px; height: 15px; }
.ag-ip { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); max-width: 560px; max-height: 340px; overflow: auto; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); box-shadow: 0 12px 32px rgba(0, 0, 0, .35); font: 400 12.5px/1.55 Geist, ui-sans-serif, system-ui, sans-serif; letter-spacing: 0; text-transform: none; text-align: left; white-space: normal; color: var(--muted-fg); overflow-wrap: anywhere; cursor: auto; }
[data-theme="light"] .ag-ip { box-shadow: 0 12px 32px rgba(20, 16, 40, .14); }
.ag-ip p { margin: 0; }
.ag-ip p + p { margin-top: 6px; }
.ag-ip ul { margin: 0; padding-left: 16px; }
.ag-ip li + li { margin-top: 4px; }
.ag-ip b { color: var(--fg); font-weight: 500; }
.ag-ipr { display: flex; gap: 6px; }
.ag-ipr .b-i { width: 13px; height: 13px; margin-top: 3px; color: color-mix(in srgb, #f5a524 80%, var(--fg)); }
.b-head, .b-sh, .b-sech, .ag-sh, .ag-ph, .ag-tc, .b-stn, .b-bth, .bb-ch, .bb-tplh, .lc-traph, .mk-c, .ag-ih, .b-dh { position: relative; }
/* hero: four numbers, one tiny figure where it carries a number */
.ag-kpi > b em.ag-ks { font-size: 15px; font-weight: 500; color: var(--muted-fg); letter-spacing: 0; }
.ag-ksub { font: 12px var(--mono); color: var(--muted-fg); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-kpi { gap: 6px; padding-bottom: 14px; }
/* tape: badge · picture · token · size · reaction · PnL · age, one line */
.ag-tr { grid-template-columns: 40px 22px minmax(0, 1fr) auto 44px 64px 30px; grid-template-areas: "bd lg t1 tu rx tp tt"; column-gap: 8px; row-gap: 0; padding: 7px 14px; }
.ag-tr > .ag-bd { grid-area: bd; justify-self: start; }
.ag-tr > .tlogo, .ag-tr.fill > .tlogo, .ag-tr.skip > .tlogo { grid-area: lg; align-self: center; width: 22px; height: 22px; margin: 0; font-size: 9.5px; }
.ag-tr .ag-t1 { grid-area: t1; gap: 8px; }
.ag-tr .ag-sym, .ag-tr.fill .ag-sym { flex: 0 1 auto; max-width: none; min-width: 0; font-size: 13.5px; }
.ag-tw { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted-fg); }
.ag-tr .ag-tu { grid-area: tu; font-size: 12.5px; }
.ag-tr > .ag-rx { grid-area: rx; font: 600 12px var(--mono); text-align: right; white-space: nowrap; color: var(--purple); }
.ag-tr .ag-tp { grid-area: tp; font-size: 12.5px; }
.ag-tr .ag-tt { grid-area: tt; font: 12px var(--mono); }
.ag-tr.fill { padding-top: 8px; padding-bottom: 8px; }
.ag-tr.skip { padding-top: 6px; padding-bottom: 6px; }
.ag-tr.skip .ag-tw { opacity: .85; }
.ag-tr.event .ag-tw { color: var(--fg); opacity: .8; }
.ag-skb { min-height: 32px; padding-left: 54px; }
.ag-skc { left: 22px; }
.ag-skw i.ag-skm { margin-left: 6px; color: var(--muted-fg); }
.ag-skb .ag-tt { font: 12px var(--mono); }
.ag-tnone { padding: 22px 18px; }
/* smart money: token · wallets · move · (+) */
.ag-smh, .ag-sm { grid-template-columns: 28px minmax(0, 1fr) 48px 84px 30px; }
.ag-smh span:nth-child(3) { grid-column: 4; }
.ag-sm { padding: 8px 14px; }
.ag-smn a { color: inherit; text-decoration: none; }
.ag-smn small { font: 11.5px var(--mono); }
.ag-launch { width: 30px; padding: 0; }
.ag-none { padding: 22px 16px; }
@container agsmart (max-width: 520px) {
  .ag-smh, .ag-sm { grid-template-columns: 28px minmax(0, 1fr) 44px 80px 30px; }
  .ag-sm { grid-template-areas: none; row-gap: 0; padding: 8px 12px; }
  .ag-sm > .tlogo, .ag-smn, .ag-smw, .ag-smv, .ag-launch { grid-area: auto; }
  .ag-launch { width: 30px; }
}
/* leaderboard: one line per row, chips for LIVE and a stopped agent, the copy button an icon */
.ag-chip.live { font-family: var(--mono); font-weight: 600; letter-spacing: .04em; color: var(--hi); border-color: color-mix(in srgb, var(--hi) 45%, var(--border)); }
.ag-chip.st { color: var(--muted-fg); border-style: dashed; }
/* templates: title, replay number, Start · Edit; the line and the risk behind (i) */
.ag-tc { gap: 10px; }
.ag-tch .ag-i { margin-left: -2px; }
.ag-trf { display: inline-flex; flex: none; color: color-mix(in srgb, #f5a524 80%, var(--fg)); }
.ag-trf .b-i { width: 14px; height: 14px; }
.ag-thl { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 0; font-size: 12.5px; }
.ag-thl b { font-size: 20px; }
.ag-thm { font: 12px var(--mono); color: var(--muted-fg); }
.ag-tcf { gap: 8px; padding-top: 0; }
.ag-tcf .b-btn { height: 32px; padding: 0 12px; font-size: 13px; }
.ag-tcf .b-i { width: 14px; height: 14px; }
/* my agents */
.ag-mempty { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; padding: 14px 16px; text-align: left; }
.ag-mempty .ag-ebtns { justify-content: flex-start; }
.b-cf time { font: 12px var(--mono); }
.b-card .b-figs { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 10px; }
/* steps: number · title · (i); the start box: PAPER · message · (i) · button */
.b-sh { align-items: center; margin-bottom: 12px; }
.b-sh > div { min-width: 0; }
.b-sh h3 { margin: 0; }
.b-stn { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-bottom: 12px; }
.b-stn .b-msg, .b-stn .b-msg:empty { flex: 1; min-width: 0; margin: 0; font-size: 13px; }
.b-start { padding: 14px 16px; }
.b-sech { align-items: center; }
.b-field[title] > span:first-child { cursor: help; }
.b-tog[title] { cursor: pointer; }
.b-tog { align-items: center; padding: 10px 14px; }
.b-tile b em.ag-of { margin-left: 2px; font-size: 13px; font-weight: 500; font-style: normal; color: var(--muted-fg); letter-spacing: 0; }
.b-tile span { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.b-skl { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; padding: 1px 6px; border: 1px dashed var(--border); border-radius: 5px; font: 500 10.5px/1.5 var(--mono); letter-spacing: 0; text-transform: none; }
.b-fr.b-sk > .b-pl { opacity: 1; }
.b-src a.b-tx { font-size: 13px; }
.b-tw small, .b-pr .b-tok small { font: 11.5px var(--mono); }
.b-rules span { font: 12px var(--mono); }
.b-rules.bb-xs { align-items: center; }
.bb-xsum { padding: 3px 9px; border-radius: 999px; background: var(--muted); font-size: 12.5px; color: var(--fg); }
.bb-xdd { margin-top: 0; }
.bb-xdd[open] { flex-basis: 100%; }
.b-meta > span[title] { font: 12.5px var(--mono); }
.ag-smw b { font-size: 16px; }
.ag-thl { column-gap: 6px; }
.ag-thl .ag-rp { margin: 0; }
@container aghome (max-width: 640px) {
  .ag-kpi > b { flex-wrap: wrap; row-gap: 0; }
  .ag-tr { grid-template-columns: 36px 20px minmax(44px, 1fr) auto auto auto 26px; column-gap: 6px; padding: 7px 12px; }
  .ag-tr > .tlogo, .ag-tr.fill > .tlogo, .ag-tr.skip > .tlogo { width: 20px; height: 20px; }
  .ag-tr .ag-tu, .ag-tr .ag-tp { font-size: 12px; }
  .ag-tr > .ag-rx { font-size: 11.5px; }
  .ag-tr .ag-tw { flex: 1 1 0; }
  .ag-skb { flex-wrap: nowrap; padding-left: 44px; }
  .ag-skc { left: 18px; }
  .ag-skw { order: 0; flex: 1 1 auto; flex-basis: auto; white-space: nowrap; }
  .ag-skw::before { content: "·"; }
}
/* builder: compact head, templates as one-line cards, a one-line summary with plain words behind a toggle */
.bb-head.b-sech { gap: 10px; margin: 0 0 12px; }
.bb-head.b-sech h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.bb-desc .bb-lbl { font-size: 13px; color: var(--muted-fg); font-weight: 500; }
.bb-desc textarea { min-height: 72px; }
.bb-gbar small { font: 11.5px var(--mono); letter-spacing: .04em; cursor: help; }
.bb-tpls { margin-top: 16px; }
.bb-tlist { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.bb-tpl { gap: 4px; padding: 10px 12px; border-radius: 12px; }
.bb-tsum { font: 12px var(--mono); color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bb-trf { display: inline-flex; flex: none; color: color-mix(in srgb, #f5a524 80%, var(--fg)); }
.bb-trf .b-i { width: 13px; height: 13px; }
.bb-sumln { margin: 8px 0 0; font: 12.5px var(--mono); color: var(--fg); overflow-wrap: anywhere; }
.bb-pld { margin-top: 8px; }
.bb-pld .bb-plain { margin-top: 8px; }
.bb-tpln summary { display: inline-flex; align-items: center; gap: 5px; }
.bb-tpln summary .b-i { width: 13px; height: 13px; color: color-mix(in srgb, #f5a524 80%, var(--fg)); }
.bb-tpln p { margin: 6px 0 0; }
.bb-blk .b-sh { margin-bottom: 10px; }
.bb-src { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 8px 12px; }
.bb-src > span { display: inline-flex; align-items: center; gap: 6px; color: var(--fg); font-weight: 500; }
.bb-src .ag-notes { margin: 0; }
.bb-src .ag-notes[open] { flex-basis: 100%; }
.bb-lead > small.bb-rph { text-transform: none; letter-spacing: 0; }
.bb-on { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.bb-on > span { white-space: nowrap; }
.bb-rph .ag-rp { margin: 0; }
.bb-sum { font-family: var(--mono); }
.bb-zero .bb-steps { margin-bottom: 12px; }
/* field labels */
.b-field > span:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; min-width: 0; }
.b-field > span:first-child > small.b-fh { flex: none; font: 11px var(--mono); color: var(--muted-fg); text-decoration: none; }
.b-rules.bb-xs { margin-top: 14px; }
.b-log li.b-lx { cursor: pointer; }
.b-log li.b-lx:hover { background: var(--muted); }
.b-tile > span span { display: inline; margin: 0; }

/* agent avatars (mascot.js) */
.agm { display: block; }
.ag-tr { grid-template-columns: 20px 40px 22px minmax(0, 1fr) auto 44px 64px 30px; grid-template-areas: "av bd lg t1 tu rx tp tt"; }
.ag-tr > .agm { grid-area: av; align-self: center; }
.b-ch > .agm { align-self: center; }
.b-dh > .agm { align-self: center; }
@container aghome (max-width: 640px) {
  .ag-tr { grid-template-columns: 18px 36px 20px minmax(44px, 1fr) auto auto auto 26px; grid-template-areas: "av bd lg t1 tu rx tp tt"; }
}

/* field checks while typing (create, LP, publish): the message under the box */
.b-field > small.bb-err { margin-top: 2px; font-size: 12px; }
/* custom agents' fills: the trigger in the source column */
.b-trg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-field > small:not(.bb-err):has(+ small.bb-err:not(:empty)) { display: none; } /* the check replaces the hint while it says something */
.ag-wr { margin-left: 6px; } /* "13/20 wallets read" next to the replay tag */

/* the same move by several copies of one agent: one tape row with ×N */
.ag-dup { flex: none; margin-left: 6px; padding: 0 5px; border-radius: 4px; font: 600 10.5px var(--mono); font-style: normal; color: var(--muted-fg); background: var(--muted, rgba(127,127,127,.12)); }

/* ══ Agents: Smart traders (#agents/traders), the board behind the copy form ══════════════════════════════════════════════ */
/* header: the boards as tabs next to Leaderboard; the one on screen is marked; never wider than the page */
.b-nav { flex-wrap: wrap; justify-content: flex-end; row-gap: 8px; }
@media (max-width: 600px) {
  /* a phone: the three boards on one row, My agents · New agent on the next */
  .b-nav { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
  .b-nav > .ag-navb, .b-nav > .b-new { min-width: 0; height: 34px; padding: 0 8px; gap: 6px; font-size: 13px; overflow: hidden; }
  .b-nav > [data-go="board"], .b-nav > [data-go="traders"], .b-nav > [data-go="lps"] { grid-column: span 2; }
  .b-nav > [data-go="mine"], .b-nav > .b-new { grid-column: span 3; }
}
@media (max-width: 440px) {
  .b-nav > [data-go="board"] .b-i, .b-nav > [data-go="traders"] .b-i, .b-nav > [data-go="lps"] .b-i { display: none; }
}

/* the board screens: header (title · count · (i) · window · picks), then one table */
.ag-stv { container: agboard / inline-size; display: flex; flex-direction: column; gap: 12px; }
.ag-stv > .ag-sec { margin-top: 0; }
.ag-st-sh small { display: inline-flex; align-items: center; gap: 0; font: 12.5px var(--mono); font-variant-numeric: tabular-nums; }
.ag-st-sh small .ag-rp { margin: 0 0 0 8px; vertical-align: 0; cursor: help; }
.ag-st-ctl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin-left: auto; }
.ag-st-sh .ag-st-ctl .b-seg { margin-left: 0; }
.ag-st-pick { display: inline-flex; align-items: center; gap: 8px; }
.ag-st-seln { min-width: 34px; font: 12.5px var(--mono); font-variant-numeric: tabular-nums; text-align: right; color: var(--muted-fg); }
.ag-st-clr.off { visibility: hidden; }
.ag-st-cn { min-width: 136px; }
.ag-st-cn .b-i { width: 14px; height: 14px; }
.ag-st-cn:disabled { border-color: var(--border); background: transparent; color: var(--muted-fg); }

/* the table: a fixed row height, tabular numbers, signed colours */
.ag-st-tbl { border: 1px solid var(--border); border-radius: 14px; background: var(--card); overflow: hidden; }
.ag-st-h, .ag-st-r, .ag-sl-h, .ag-sl-r { display: grid; column-gap: 10px; align-items: center; min-width: 0; padding: 0 14px; }
.ag-st-h, .ag-st-r { grid-template-columns: 24px 26px minmax(150px, .8fr) 94px 64px 54px 50px 50px 44px minmax(0, 1.2fr) 62px 76px; }
.ag-st-h, .ag-sl-h { min-height: 34px; background: var(--muted); font-size: 12px; color: var(--muted-fg); }
.ag-st-h > span, .ag-sl-h > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ag-st-h .b-n, .ag-sl-h .b-n { font: inherit; }
.ag-st-r, .ag-sl-r { min-height: 48px; border-top: 1px solid var(--border-soft); font-size: 13.5px; }
.ag-st-h + .ag-st-r, .ag-sl-h + .ag-sl-r { border-top: 0; }
.ag-st-r:hover, .ag-sl-r:hover { background: var(--muted); }
.ag-st-r.on { background: color-mix(in srgb, var(--purple) 9%, transparent); }
.ag-st-xs { display: contents; }
.ag-st-skr { display: flex; align-items: center; height: 48px; padding: 0 14px; border-top: 1px solid var(--border-soft); }
.ag-st-h + .ag-st-skr, .ag-sl-h + .ag-st-skr { border-top: 0; }
.ag-st-skr .b-skel { flex: 1; height: 22px; }
/* tick · rank */
.ag-st-ck { position: relative; display: grid; place-items: center; width: 24px; height: 28px; cursor: pointer; }
.ag-st-ck input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ag-st-ck .b-box { width: 17px; height: 17px; }
.ag-st-ck.dis { cursor: not-allowed; opacity: .4; }
.ag-st-r.on .b-box { border-color: var(--primary); background: var(--primary); color: var(--primary-fg); }
.ag-st-ck input:focus-visible + .b-box { outline: 2px solid var(--purple); outline-offset: 2px; }
.ag-st-rk { font: 600 12.5px var(--mono); font-variant-numeric: tabular-nums; color: var(--muted-fg); text-align: right; }
.top > .ag-st-rk { color: var(--fg); }
/* wallet: monogram · address (Monadscan) · copy */
.ag-st-w { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ag-st-w > .tlogo { flex: none; }
.ag-st-wa { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ag-st-wl { display: flex; align-items: center; gap: 3px; min-width: 0; }
.ag-st-wl > a { display: inline-flex; align-items: center; gap: 4px; min-width: 0; overflow: hidden; color: var(--fg); text-decoration: none; font: 500 13px var(--mono); white-space: nowrap; }
.ag-st-wl > a .b-i { width: 11px; height: 11px; color: var(--muted-fg); }
.ag-st-wl > a:hover, .ag-st-wl > a:hover .b-i { color: var(--purple); }
.ag-st-sub { display: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 11px var(--mono); color: var(--muted-fg); }
.ag-st-ca { display: grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted-fg); cursor: pointer; }
.ag-st-ca svg { width: 13px; height: 13px; }
.ag-st-ca:hover, .ag-st-ca:focus-visible { background: var(--secondary); color: var(--fg); outline: 0; }
.ag-st-ca.ok { color: var(--hi); }
/* the numbers */
.ag-st-pnl { font-size: 14.5px; font-weight: 600; letter-spacing: -.01em; }
.top > .ag-st-pnl { font-size: 15.5px; }
.ag-st-last { font-size: 12px; color: var(--muted-fg); }
.ag-st-best { display: flex; align-items: center; gap: 7px; min-width: 0; padding-left: 8px; }
.ag-st-best b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.ag-st-best small { margin-left: auto; font: 12px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-st-best > small:only-child { margin-left: 0; color: var(--muted-fg); }
.ag-st-cp { display: flex; justify-content: flex-end; }
.ag-st-cp .ag-copy { gap: 6px; }

/* a narrower column: tighter gaps; a laptop column folds tokens / positions and hold under the address; a phone gets cards
   like the leaderboard's phone rows */
@container agboard (max-width: 1000px) {
  .ag-st-h, .ag-st-r, .ag-sl-h, .ag-sl-r { column-gap: 8px; padding: 0 12px; }
}
@container agboard (min-width: 821px) and (max-width: 940px) {
  .ag-st-h, .ag-st-r { grid-template-columns: 24px 26px minmax(150px, 1fr) 94px 64px 54px 50px minmax(0, 1fr) 62px 76px; }
  .ag-st-mid { display: none; }
  .ag-st-sub { display: block; }
}
@container agboard (max-width: 820px) {
  .ag-st-h, .ag-sl-h, .ag-sl-th { display: none; }
  .ag-st-r, .ag-sl-r { column-gap: 8px; row-gap: 3px; align-items: center; min-height: 0; padding: 9px 12px; }
  /* a card: rank · wallet · PnL · copy on top, the numbers and the best token / pools under it at full width */
  .ag-st-r { grid-template-columns: 22px 18px minmax(0, 1fr) auto auto; grid-template-areas: "ck rk w pnl cp" "ck xs xs xs xs" "ck best best last last"; }
  .ag-st-ck { grid-area: ck; align-self: start; width: 22px; height: 26px; }
  .ag-st-rk { grid-area: rk; text-align: left; }
  .ag-st-w { grid-area: w; }
  .ag-st-pnl { grid-area: pnl; }
  .ag-st-cp { grid-area: cp; }
  .ag-st-xs { grid-area: xs; display: flex; flex-wrap: wrap; gap: 0 10px; margin-top: 1px; }
  .ag-st-xs .b-n { text-align: left; font-size: 12px; }
  .ag-st-xs .b-n::before { content: attr(data-k) " "; font: 11.5px Geist, ui-sans-serif, system-ui, sans-serif; color: var(--muted-fg); }
  .ag-st-best { grid-area: best; padding-left: 0; }
  .ag-st-last { grid-area: last; }
  .ag-st-cp .ag-copy { width: 30px; padding: 0; }
  .ag-st-cpt { display: none; }
  .ag-st-skr { height: 90px; }
  .ag-sl-tr > .ag-st-rk { grid-area: rk; align-self: start; padding-top: 5px; } .ag-sl-tr > .ag-st-w { grid-area: w; } .ag-sl-tp { grid-area: pnl; }
  .ag-sl-io { grid-area: io; text-align: left; } .ag-sl-tw { grid-area: win; } .ag-sl-v { grid-area: v; }
}
@container agboard (max-width: 520px) {
  .ag-st-ctl { flex: 1 1 100%; justify-content: space-between; margin-left: 0; }
  .ag-st-seln { display: none; }
  .ag-st-cn { min-width: 0; }
  .ag-st-wl > a .b-i { display: none; }
  .top > .ag-st-pnl { font-size: 15px; }
  .ag-st-xs { column-gap: 9px; }
  .ag-st-xs .b-n, .ag-st-xs .b-n::before { font-size: 11.5px; }
}

/* board pages: 20 rows a page */
.ag-pg { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.ag-pg-n { color: var(--muted-fg); font-variant-numeric: tabular-nums; font-size: 12.5px; }
.ag-pg-bs { display: flex; gap: 4px; flex-wrap: wrap; }
.ag-pg-b { min-width: 34px; height: 34px; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card); color: var(--fg); font-size: 13px; font-variant-numeric: tabular-nums; cursor: pointer; }
.ag-pg-b svg { width: 15px; height: 15px; }
.ag-pg-b:hover:not(:disabled):not(.on) { background: var(--muted); }
.ag-pg-b.on { background: var(--fg); color: var(--bg); border-color: var(--fg); font-weight: 600; cursor: default; }
.ag-pg-b:disabled { opacity: .35; cursor: default; }
.ag-pg-b:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }
@media (max-width: 520px) { .ag-pg { justify-content: center; } .ag-pg-n { width: 100%; text-align: center; } }
