:root {
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --bg: #f7f6f3; --panel: #ffffff; --text: #2a2926; --muted: #6f6c65; --line: #e6e3dc;
  --accent: #2f6fd6; --accent-ink: #ffffff; --pos: #1e8f5c; --neg: #c8404f; --warn: #b7800f;
  --soft: #f0eee9; --best: rgba(30, 143, 92, .12);
}
/* dark theme: follows the system ("auto"), or forced with data-theme="dark"; data-theme="light" forces light */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1e1c; --panel: #272624; --text: #e8e5de; --muted: #a29e96; --line: #393734;
    --accent: #6ea3f0; --pos: #55c290; --neg: #ee7e89; --warn: #e0ae4f; --soft: #302f2c; --best: rgba(85, 194, 144, .14);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1f1e1c; --panel: #272624; --text: #e8e5de; --muted: #a29e96; --line: #393734;
  --accent: #6ea3f0; --pos: #55c290; --neg: #ee7e89; --warn: #e0ae4f; --soft: #302f2c; --best: rgba(85, 194, 144, .14);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
.theme-btn { background: none; border: 1px solid var(--line); border-radius: 999px; width: 30px; height: 28px; padding: 0;
  color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.theme-btn:hover { color: var(--text); border-color: var(--accent); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
h1 { font-family: var(--serif); font-size: 27px; line-height: 1.25; margin: 6px 0 4px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 15.5px; margin: 0 0 12px; font-weight: 650; }
.mt { margin-top: 20px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 650; }
.pos { color: var(--pos); } .neg { color: var(--neg); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

header.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 56px; padding: 8px 32px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.logo { color: var(--pos); }
nav { display: flex; gap: 4px; flex-wrap: wrap; }
nav button, .gear { background: none; border: 0; padding: 7px 12px; border-radius: 8px; color: var(--muted); cursor: pointer; font: inherit; }
nav button:hover, .gear:hover { color: var(--text); }
nav button.on, .gear.on { background: var(--soft); color: var(--text); font-weight: 600; }
nav.groups { flex: 1; }
.top-right { display: flex; align-items: center; gap: 8px; }
.ai-pill { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); text-decoration: none; white-space: nowrap; }
.ai-pill:hover { color: var(--text); border-color: var(--accent); }
.ai-pill.off { color: var(--neg); border-color: var(--neg); }
.subnav { position: sticky; top: 56px; z-index: 4; display: flex; gap: 2px; flex-wrap: wrap; padding: 0 24px;
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 32px; }
.subnav button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 9px 12px 8px; color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; }
.subnav button:hover { color: var(--text); }
.subnav button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.subnav .pill, nav .pill { margin-left: 5px; }
.eng { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 5px; color: #fff; letter-spacing: .02em; }
.eng-v1 { background: #6b7385; } .eng-v2 { background: #2f7de1; } .eng-v3 { background: #9b59d0; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.metric.click { cursor: pointer; } .metric.click:hover { border-color: var(--accent); }
ul.plain { list-style: none; padding-left: 0; } ul.plain li { padding: 3px 0; }
li.click { cursor: pointer; } li.click:hover span { color: var(--accent); }
@media (max-width: 720px) { .subnav { top: auto; position: static; padding: 0 12px; } header.top { padding: 10px 12px; } }
.pill { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); font-size: 11px; text-align: center; }

main { max-width: 1320px; margin: 0 auto; padding: 28px 32px 80px; }
.head-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head-row p { margin: 2px 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions.bottom { justify-content: flex-end; margin-top: 8px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px 24px; margin-bottom: 18px; }
.card.flush { padding: 0; } .pad { padding: 18px 22px 0; margin: 0 0 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid2 > .card { margin-bottom: 0; } .grid2 { margin-bottom: 14px; }
.scroll { overflow-x: auto; }

button { font: inherit; cursor: pointer; }
.primary { background: var(--accent); color: var(--accent-ink); border: 0; padding: 8px 16px; border-radius: 8px; font-weight: 600; }
.primary:disabled { opacity: .5; cursor: default; }
.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); padding: 7px 12px; border-radius: 8px; }
.ghost:hover { background: var(--soft); }
.ghost.sm { padding: 3px 8px; font-size: 12px; }
button.link { background: none; border: 0; padding: 0 0 0 6px; color: var(--accent); font-weight: 500; }
details > summary { cursor: pointer; margin: 14px 0 6px; }
.fold { cursor: pointer; user-select: none; }
.fold:hover { color: var(--accent); }
.chev { display: inline-block; width: 14px; margin-right: 4px; color: var(--muted); transition: transform .15s; }
.chev.open { transform: rotate(90deg); }
.ghost.danger { color: var(--neg); }
.ghost:disabled { opacity: .4; cursor: default; }

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span, .field .lbl { font-size: 12px; font-weight: 600; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.field.changed .lbl { color: var(--accent); }
.help { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
/* one look for every text-like control (text, password, number, date, search, select, textarea) */
input:not([type=checkbox]):not([type=radio]), select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--bg); color: var(--text); font: inherit; line-height: 1.4; }
input:not([type=checkbox]):not([type=radio]), select { height: 36px; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input:disabled, select:disabled { opacity: .6; cursor: not-allowed; }
input[type=date] { color-scheme: light dark; }
/* browser autofill would otherwise paint password fields white/yellow */
input:-webkit-autofill { -webkit-box-shadow: 0 0 0 40px var(--bg) inset; -webkit-text-fill-color: var(--text); caret-color: var(--text); }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch i { width: 34px; height: 20px; border-radius: 10px; background: var(--line); position: relative; transition: .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .15s; }
.switch input:checked + i { background: var(--pos); }
.switch input:checked + i::after { left: 17px; }

.chips-actions { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--bg); color: var(--muted); padding: 4px 9px; border-radius: 14px; font-size: 12px; display: inline-flex; gap: 5px; align-items: baseline; }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip small { font-size: 10px; opacity: .8; }

table { border-collapse: collapse; width: 100%; }
th, td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:hover td { background: color-mix(in srgb, var(--soft) 55%, transparent); }
th.sortable { cursor: pointer; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--soft); }
td.name span { display: block; font-weight: 600; } td.name small { display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.mini td, table.mini th { padding: 7px 10px; }
table.ladder { max-width: 720px; } table.ladder input { max-width: 130px; }
.ladder-foot { display: flex; gap: 14px; align-items: center; margin-top: 8px; }
td.best { background: var(--best); font-weight: 700; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: var(--soft); color: var(--muted); white-space: nowrap; }
.badge.running { background: rgba(47, 125, 225, .15); color: var(--accent); }
.badge.done { background: rgba(31, 157, 98, .14); color: var(--pos); }
.badge.failed { background: rgba(214, 69, 93, .14); color: var(--neg); }
.badge.queued { background: rgba(201, 138, 18, .15); color: var(--warn); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; }
.metric span { font-size: 12.5px; } .metric b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; } .metric small { font-size: 12px; line-height: 1.45; }
.chart { position: relative; height: 300px; } .chart.short { height: 200px; }
.bar-row { display: grid; grid-template-columns: 40px 1fr 110px; gap: 10px; align-items: center; margin-bottom: 6px; font-size: 13px; }
.bar { height: 10px; background: var(--soft); border-radius: 5px; overflow: hidden; } .bar i { display: block; height: 100%; background: var(--pos); }
.error { background: rgba(214, 69, 93, .1); color: var(--neg); border: 1px solid rgba(214, 69, 93, .35); padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; white-space: pre-wrap; }
pre.log { max-height: 360px; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 11.5px; white-space: pre-wrap; margin: 0; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 9px 16px; border-radius: 10px; font-size: 13px; z-index: 20; }
a { color: var(--accent); text-decoration: none; }

@media (max-width: 760px) {
  header.top, main { padding-left: 16px; padding-right: 16px; }
  .grid2 { grid-template-columns: 1fr; }
  .fields { grid-template-columns: 1fr 1fr; }
}

/* Runs + Compare use the full window width so the tables fit without horizontal scrolling */
main.wide { max-width: none; }
table.runs th, table.runs td { padding: 9px 10px; }
table.runs td.name { min-width: 220px; }
table.runs td.name span { white-space: normal; }

/* AI reports + loops */
.head-row.tight { margin-bottom: 8px; align-items: center; }
.analyze-row { display: flex; gap: 8px; margin-bottom: 12px; }
.analyze-row input { flex: 1; }
textarea { resize: vertical; }
.report { border-top: 1px solid var(--line); padding: 12px 0; }
.report-head { display: flex; gap: 10px; align-items: baseline; cursor: pointer; }
.report-head b { flex: 1; font-weight: 600; }
.report h3, .iter h3 { font-size: 13px; margin: 14px 0 6px; }
.md { line-height: 1.55; overflow-x: auto; }
.md h2 { font-size: 15px; margin: 18px 0 6px; }
.md h3 { font-size: 14px; margin: 14px 0 4px; }
.md table { width: auto; margin: 8px 0; font-size: 13px; }
.md code { background: var(--soft); padding: 1px 4px; border-radius: 4px; font-size: 12.5px; }
.md ul, .md ol { padding-left: 22px; }
.conclusion { border-color: var(--accent); }
.badge.stopped { background: var(--soft); color: var(--muted); }
.mini-bar { display: inline-block; width: 70px; vertical-align: middle; }
.iter { border-top: 1px solid var(--line); }
.iter.best { background: var(--best); }
.iter-head { display: flex; gap: 12px; align-items: center; padding: 10px 18px; cursor: pointer; flex-wrap: wrap; }
.iter-head:hover { background: var(--soft); }
.it-no { font-weight: 700; min-width: 42px; }
.star { color: var(--pos); font-size: 16px; }
.iter-changes { flex: 1; color: var(--muted); font-size: 12.5px; min-width: 200px; }
.iter-body { padding: 0 18px 14px; }
@media (max-width: 760px) { .analyze-row { flex-direction: column; } }

.help-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.help-row .help { flex: 1; }

/* glossary */
.gl-tools { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 58px; z-index: 3; }
.gl-cat { font-size: 16px; margin: 22px 0 10px; }
.gl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
.gl-card { margin: 0; scroll-margin-top: 170px; transition: box-shadow .3s, border-color .3s; }
.gl-card.flash { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(74, 144, 240, .35); }
.gl-card h3 { font-size: 15px; margin: 0 0 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gl-card header { margin-bottom: 10px; }
.gl-card header p { margin: 0; }
.gl-card dl { margin: 0; display: grid; gap: 4px; }
.gl-card dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-top: 6px; }
.gl-card dd { margin: 0; line-height: 1.5; }
.gl-example { background: var(--soft); border-left: 3px solid var(--pos); padding: 6px 10px; border-radius: 0 6px 6px 0; font-variant-numeric: tabular-nums; }
a.info { font-size: 12px; text-decoration: none; opacity: .7; }
a.info:hover { opacity: 1; }
@media (max-width: 760px) { .gl-grid { grid-template-columns: 1fr; } .gl-tools { top: 0; position: static; } }

/* export buttons */
a.btn { display: inline-flex; align-items: center; text-decoration: none; color: var(--text); }
.export { display: inline-flex; }
.export a.btn:first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.export a.sm-link { border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0; color: var(--muted); font-size: 12.5px; }

/* signals */
.board td.fam { padding: 4px 3px; text-align: center; }
.fam-h { text-align: center; font-size: 11px; padding: 7px 3px; }
.fam-dot { display: inline-block; min-width: 28px; padding: 2px 4px; border-radius: 6px; font-size: 11px; font-weight: 700; background: var(--soft); color: var(--muted); }
.prob-bar { display: inline-block; width: 70px; vertical-align: middle; }
.prob-bar i { background: var(--muted); }
.prob-bar i.hot { background: var(--pos); }
tr.fired td { background: var(--best); }
.sig-detail { border-top: 1px solid var(--line); padding: 14px 18px; }
.sig-detail h3 { font-size: 13px; margin: 14px 0 6px; }
.bar-row.wide3 { grid-template-columns: 170px 1fr 60px; }
.cards.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.badge.ev { margin-left: 6px; }
tr.best td { background: var(--best); }

.news-shift { font-size: 11px; margin-left: 4px; font-weight: 600; }
.badge.catalyst { background: rgba(155, 89, 208, .16); color: #9b59d0; }

/* behind the scenes */
.docs code { background: var(--soft); padding: 1px 6px; border-radius: 5px; font-size: 13.5px; }
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flow-col { display: flex; flex-direction: column; gap: 8px; }
.flow-box { border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 10px 12px; min-width: 120px; max-width: 170px; }
.flow-box b { display: block; font-size: 13px; }
.flow-box small { color: var(--muted); font-size: 11.5px; line-height: 1.35; display: block; margin-top: 2px; }
.flow-box.hot { border-color: var(--pos); background: var(--best); }
.flow-arrow { color: var(--muted); font-size: 18px; }
.steps { padding-left: 20px; } .steps li { margin-bottom: 8px; }
.feat-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px 22px; }
.feat-groups h3 { font-size: 13px; margin: 10px 0 2px; } .feat-groups p { margin: 0 0 4px; } .feat-groups ul { margin: 0; padding-left: 18px; }
@media (max-width: 760px) { .flow-arrow { transform: rotate(90deg); } .flow { flex-direction: column; align-items: stretch; } .flow-box { max-width: none; } }

/* modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 30; background: rgba(5, 8, 14, .62); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; overflow-y: auto; }
.modal { width: min(1180px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .45); }
.modal .sig-detail { border-top: 0; padding: 18px 22px 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap;
  padding-bottom: 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0 0 4px; font-size: 18px; }
.modal-head p { margin: 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
tr.selected td { background: var(--soft); }

/* news engine (V3) */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.filters select, .filters input[type=search] { width: auto; min-width: 140px; }
.cal-day { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.cal-day ul { margin: 0; padding-left: 16px; }
.cal-date { font-weight: 600; font-size: 13px; }
.short-scroll { max-height: 320px; overflow-y: auto; }
.card.dive { border-left: 3px solid var(--accent); margin: 14px 0; }
ul.checks { list-style: none; padding-left: 0; } ul.checks li { padding: 2px 0; }
.spend-master { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; padding: 10px 12px; margin: 6px 0 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--soft); }
.spend-master.off { border-color: var(--neg); }
table.spend td { vertical-align: top; }

/* ---- documentation (How it works): sidebar + reading column + "On this page" ---- */
main[data-view="behind"] { max-width: none; padding-top: 12px; }
.docs { display: grid; grid-template-columns: 248px minmax(0, 860px) 210px; justify-content: center; gap: 48px; align-items: start; }
.docs-nav { position: sticky; top: 116px; max-height: calc(100vh - 136px); overflow-y: auto; padding: 8px 12px 20px 0; border-right: 1px solid var(--line); }
.docs-group-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 20px 0 6px 10px; }
.docs-group:first-child .docs-group-title { margin-top: 6px; }
.docs-nav a { display: block; padding: 6px 10px; margin: 1px 0; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 14.5px; line-height: 1.4; }
.docs-nav a:hover { background: var(--soft); }
.docs-nav a.on { background: var(--soft); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.docs-toc { position: sticky; top: 116px; border-left: 1px solid var(--line); padding: 6px 0 6px 16px; }
.docs-toc .docs-group-title { margin: 0 0 8px; }
.docs-toc a { display: block; color: var(--muted); font-size: 13.5px; padding: 4px 0; text-decoration: none; line-height: 1.4; }
.docs-toc a:hover { color: var(--text); }
.docs-crumb { font-size: 13.5px; color: var(--muted); margin: 8px 0 18px; }
.docs-crumb span + span::before { content: "›"; margin: 0 8px; color: var(--muted); font-weight: 400; }
.doc-sec { padding: 4px 0 36px; margin-bottom: 36px; border-bottom: 1px solid var(--line); scroll-margin-top: 124px; }
.doc-sec h1 { font-size: 38px; margin: 2px 0 12px; }
.doc-sec h2 { font-family: var(--serif); font-size: 28px; line-height: 1.25; font-weight: 600; margin: 4px 0 16px; letter-spacing: -.01em; }
.doc-sec h3 { font-size: 17.5px; margin: 30px 0 10px; font-weight: 650; scroll-margin-top: 124px; }
.doc-sec p, .doc-sec li { font-size: 15.5px; line-height: 1.75; }
.doc-sec li { margin-bottom: 6px; }
.doc-sec li.small, .doc-sec ul.small li, .doc-sec p.small { font-size: 14.5px; }
.doc-kicker { color: var(--accent); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; margin: 0; }
.doc-lead { font-size: 18px; line-height: 1.65; color: var(--muted); margin: 0 0 22px; }
.doc-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin: 8px 0 22px; }
.doc-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.doc-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.doc-card .eng { align-self: flex-start; } .doc-card b { font-size: 16px; } .doc-card span:last-child { color: var(--muted); font-size: 14px; line-height: 1.55; }
.callout { border-left: 3px solid var(--accent); background: var(--soft); padding: 12px 16px; border-radius: 8px; margin: 20px 0; font-size: 15px; }
.doc-sec ol { list-style: none; counter-reset: step; padding-left: 0; }
.doc-sec ol > li { counter-increment: step; position: relative; padding-left: 46px; margin: 0 0 16px; }
.doc-sec ol > li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--soft); display: flex; align-items: center; justify-content: center; font-size: 13.5px; font-weight: 650; }
.doc-sec .scroll { border: 1px solid var(--line); border-radius: 12px; margin: 10px 0 16px; }
.doc-sec .scroll table tr:last-child td { border-bottom: 0; }
.doc-sec .card, .doc-sec .grid2 > div { background: transparent; }
@media (max-width: 1280px) { .docs { grid-template-columns: 230px minmax(0, 1fr); gap: 36px; } .docs-toc { display: none; } }
@media (max-width: 860px) { .docs { grid-template-columns: 1fr; } .docs-nav { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--line); } }

/* data + models pages */
.filter-input { width: 220px !important; }
table.explain td { vertical-align: top; }
.chip-x { display: inline-flex; gap: 4px; align-items: center; margin-right: 4px; }
.model-title { font-family: var(--serif); font-size: 21px; font-weight: 600; display: flex; gap: 8px; align-items: center; }
.metric b.small-b { font-size: 15px; line-height: 1.35; }

/* coin pop-up */
.coin-link { cursor: pointer; text-decoration: underline dotted color-mix(in srgb, var(--muted) 60%, transparent); text-underline-offset: 3px; }
.coin-link:hover { color: var(--accent); }
.badge.coin-link { text-decoration: none; } .badge.coin-link:hover { outline: 1px solid var(--accent); }
.coin-backdrop { z-index: 40; }
.coin-modal { width: min(1240px, 100%); padding: 0; overflow: hidden; }
.coin-wrap { display: flex; flex-direction: column; }
.coin-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.coin-id { display: flex; align-items: center; gap: 12px; } .coin-id h2 { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.coin-id img { border-radius: 50%; }
.coin-price { display: flex; align-items: center; gap: 12px; } .coin-price b { font-size: 22px; font-variant-numeric: tabular-nums; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); display: inline-block; }
.live-dot.ws { background: var(--pos); box-shadow: 0 0 0 3px color-mix(in srgb, var(--pos) 25%, transparent); animation: pulse 2s infinite; }
.live-dot.poll { background: var(--warn); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--pos) 5%, transparent); } }
.coin-body { display: grid; grid-template-columns: 380px 1fr; min-height: 520px; }
.coin-side { border-right: 1px solid var(--line); padding: 14px 18px; overflow-y: auto; max-height: 76vh; }
.coin-tfs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 12px; }
.coin-tfs button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; background: var(--soft); border: 1px solid transparent;
  border-radius: 10px; color: var(--muted); cursor: pointer; font: inherit; font-size: 12.5px; }
.coin-tfs button b { font-size: 13.5px; } .coin-tfs button.on { border-color: var(--accent); color: var(--text); }
.coin-facts td { padding: 8px 4px; } .coin-facts td:first-child { color: var(--muted); }
.coin-ours { margin-top: 14px; } .coin-ours h3 { margin: 0 0 8px; font-size: 14px; } .coin-ours > div, .coin-ours > p { margin: 0 0 7px; }
.coin-story:hover span:not(.badge):not(.eng) { color: var(--accent); }
.coin-links { display: flex; gap: 14px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.coin-chart-wrap { position: relative; padding: 12px 12px 6px; } .coin-chart { height: 480px; width: 100%; }
.coin-chart-note { position: absolute; left: 16px; bottom: 6px; margin: 0; }
@media (max-width: 900px) { .coin-body { grid-template-columns: 1fr; } .coin-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; } .coin-chart { height: 340px; } }
.coin-style { position: absolute; left: 16px; top: 10px; z-index: 3; display: flex; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.coin-style button { border: 0; background: transparent; padding: 3px 10px; font-size: 12px; border-radius: 6px; color: var(--muted); cursor: pointer; }
.coin-style button.on { background: var(--soft); color: var(--text); font-weight: 600; }
.coin-style-sep { width: 1px; background: var(--line); margin: 3px 2px; }
.coin-style button:disabled { opacity: .6; cursor: default; }
.spin { display: inline-block; animation: coinspin .8s linear infinite; }
@keyframes coinspin { to { transform: rotate(360deg); } }
/* ---- Coin story ---- */
.cs-search { display: flex; gap: 6px; align-items: center; }
.cs-search input { width: 180px; }
.cs-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: center; justify-content: space-between; padding: 14px 20px; }
.cs-head .coin-id h2 { margin: 0; }
.cs-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cs-controls .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.cs-controls .seg button { border: 0; background: transparent; padding: 4px 10px; border-radius: 6px; color: var(--muted); cursor: pointer; font-size: 13px; }
.cs-controls .seg button.on { background: var(--soft); color: var(--text); font-weight: 600; }
.cs-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; margin-bottom: 14px; }
.cs-grid > .card { margin-bottom: 0; }
.cs-chart-card { padding: 10px 10px 8px; }
.cs-chart { height: 460px; width: 100%; }
.cs-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 8px 0; }
.lg { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 3px; }
.lg-move { background: var(--accent); border-radius: 0; clip-path: polygon(50% 100%, 0 0, 100% 0); }
.lg-news { background: var(--pos); } .lg-sig { background: #7c5cd6; clip-path: polygon(50% 0, 0 100%, 100% 100%); border-radius: 0; }
.lg-ai { background: #7c5cd6; border-radius: 2px; }
.cs-side { max-height: 520px; overflow: auto; }
.cs-side h3 { margin-top: 4px; }
.cs-ev { border-left: 3px solid var(--line); padding: 6px 10px; margin: 6px 0; border-radius: 0 8px 8px 0; }
.cs-ev.click:hover, .cs-ev.on { background: var(--soft); }
.cs-ev p { margin: 4px 0 0; }
.cs-ev.k-move { border-left-color: var(--accent); } .cs-ev.k-news { border-left-color: var(--pos); }
.cs-ev.k-signal, .cs-ev.k-report { border-left-color: #7c5cd6; }
.cs-ev-t { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.cs-kind { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.cs-timeline { max-height: 720px; overflow: auto; margin-right: -8px; padding-right: 8px; }
.cs-chapters { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 14px; }
.cs-chapter { flex: 0 0 240px; text-align: left; display: flex; flex-direction: column; gap: 3px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; color: var(--text); font: inherit; }
.cs-chapter:hover { border-color: var(--accent); }
.cs-outlook { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.cs-outlook b { font-size: 18px; display: block; }
.badge.big { font-size: 14px; padding: 5px 12px; text-transform: capitalize; }
.cs-grade { margin: 4px 0 10px; font-weight: 600; }
.cs-bottom { align-items: start; }
@media (max-width: 980px) {
  .cs-grid { grid-template-columns: 1fr; } .cs-side { max-height: none; }
  .cs-bottom { grid-template-columns: 1fr; } .cs-chart { height: 360px; }
  .cs-search input { width: 120px; }
}
/* ---- "if entered" simulation ---- */
.sim-cell { border: 1px dashed transparent; background: transparent; font: inherit; font-weight: 600; color: var(--muted); padding: 2px 6px; border-radius: 6px; cursor: pointer; white-space: nowrap; }
.sim-cell.pos { color: var(--pos); } .sim-cell.neg { color: var(--neg); }
.sim-cell:hover { border-color: currentColor; background: var(--soft); }
.sim-total { margin: 10px 0 14px; }
.sim-backdrop { z-index: 45; }
.sim-amount input { font-size: 18px; font-weight: 600; width: 100%; }
.sim-quick { margin: 6px 0 10px; }
.sim-results { margin-top: 12px; }
.sim-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.sim-row > div:first-child { display: flex; flex-direction: column; gap: 2px; }
.sim-row .num { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; white-space: nowrap; }
.sim-row.main b { font-size: 16px; } .sim-row.main .num b { font-size: 20px; }
.sim-steps { margin: 6px 0 0; padding-left: 18px; }
.sim-extremes { display: flex; flex-direction: column; gap: 4px; margin: 12px 0 8px; }
.fee-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 7px; padding: 1px; gap: 1px; vertical-align: middle; margin-left: 4px; }
.fee-seg button { border: 0; background: transparent; padding: 2px 8px; border-radius: 5px; font-size: 12px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.fee-seg button.on { background: var(--soft); color: var(--text); font-weight: 600; }
.fee-row { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.fee-row + p { margin: 4px 0 0; }
/* ---- paper trading ---- */
.pw-tabs { margin-bottom: 14px; }
.pw-new-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.pw-cards .metric b { font-size: 22px; }
.pw-head { align-items: center; margin-bottom: 0; }
.pw-head h3 { margin: 0; }
.eq-chart { height: 260px; width: 100%; padding: 0 10px; box-sizing: border-box; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 0; margin-bottom: 4px; }
.tabs button { border: 0; background: transparent; padding: 8px 12px; color: var(--muted); cursor: pointer; font: inherit; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.pw-journal { border-left: 3px solid var(--line); padding: 6px 12px; margin: 8px 0; }
.pw-journal:hover { background: var(--soft); }
.pw-journal p { margin: 3px 0; }
.ticket-backdrop { z-index: 50; }
.ticket-modal { width: min(820px, 100%); padding: 0; max-height: 94vh; overflow-y: auto; }
.ticket-body { padding: 14px 20px 18px; }
.tk-sec { border-bottom: 1px solid var(--line); padding: 10px 0 12px; }
.tk-sec h4 { margin: 0 0 8px; font-size: 14px; }
.tk-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-top: 8px; }
.tk-row .field { flex: 1 1 200px; margin: 0; }
.tk-coin { display: flex; gap: 6px; } .tk-coin input { flex: 1; }
.tk-seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; padding: 2px; gap: 2px; }
.tk-seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; font: inherit; font-size: 13px; }
.tk-seg button.on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tk-preview { background: var(--soft); border-radius: 8px; padding: 6px 10px; margin: 8px 0 0; }
.tk-signal { background: var(--soft); border-radius: 8px; padding: 6px 10px; }
.tk-presets { margin-bottom: 8px; }
.tk-tps td { vertical-align: middle; }
.tk-num { width: 70px; padding: 3px 6px; } .tk-num.wide { width: 110px; }
.tk-tps select { padding: 3px 4px; }
.tk-tail { align-items: center; }
.tk-inline { display: flex; align-items: center; gap: 6px; flex: 0 1 auto !important; flex-direction: row; }
.tk-summary { display: flex; gap: 24px; flex-wrap: wrap; }
.tk-summary > div { display: flex; flex-direction: column; } .tk-summary b { font-size: 18px; }
.ticket-body textarea { width: 100%; box-sizing: border-box; }
.tk-actions { justify-content: flex-end; margin-top: 12px; }
.primary.buy { background: var(--pos); border-color: var(--pos); min-width: 180px; }
.sim-trade { width: 100%; margin: 10px 0 4px; }
@media (max-width: 700px) { .tk-summary { gap: 12px; } .tk-num { width: 56px; } }
/* ---- Lodestar brand + sign-in ---- */
.logo { fill: #d9a520; color: #d9a520; vertical-align: -3px; }
.user-btn { display: inline-flex; align-items: center; min-width: 28px; min-height: 28px; }
.me-pill { font-size: 11px; border: 1px solid var(--line); border-radius: 10px; padding: 2px 8px; color: var(--muted); }
.auth-screen { position: fixed; inset: 0; z-index: 200; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; overflow-y: auto; }
.auth-box { display: flex; flex-direction: column; align-items: center; gap: 10px; max-width: 460px; width: 100%; text-align: center; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 34px; font-weight: 600; }
.auth-tag { margin: 0 0 12px; }
.auth-note { max-width: 400px; margin: 12px auto 0; }
.auth-wait { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px 26px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.auth-foot { position: absolute; bottom: 12px; left: 16px; right: 16px; text-align: center; margin: 0; }
