:root {
  color-scheme: light;
  --surface-0: #f5f7fb;
  --surface-1: #ffffff;
  --surface-2: #eef2f8;
  --border: #dfe5ee;
  --border-strong: #cbd4e1;
  --grid: #edf0f5;
  --text-primary: #162033;
  --text-secondary: #536176;
  --text-muted: #7d899b;
  --accent: #2457d6;
  --accent-hover: #1947bd;
  --accent-soft: #eaf0ff;
  --series-1: #2457d6;
  --series-2: #e8783e;
  /* the parts of a book, after the book (1) and its benchmark (2) */
  --series-3: #1a9e77;
  --series-4: #7a5af8;
  --series-5: #c98a00;
  --series-6: #d6457e;
  --series-7: #5f7d95;
  --good: #008300;
  --critical: #d03b3b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgb(20 32 55 / .04), 0 4px 14px rgb(20 32 55 / .04);
  --shadow-md: 0 16px 40px rgb(20 32 55 / .10);
}
/* Dark: the system's choice, unless the visitor picked light with the theme button (data-theme on
   <html>, see base.html), or dark whatever the system says. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-0: #0d1220;
    --surface-1: #151c2c;
    --surface-2: #1c2639;
    --border: #29344a;
    --border-strong: #3a4861;
    --grid: #222d41;
    --text-primary: #f5f7fb;
    --text-secondary: #b6c0d0;
    --text-muted: #8490a4;
    --accent: #6d91ff;
    --accent-hover: #86a3ff;
    --accent-soft: #1b2b58;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #2bb58c;
    --series-4: #9a82fa;
    --series-5: #e0a31a;
    --series-6: #e7699a;
    --series-7: #8aa3b8;
    --good: #3fae3f;
    --critical: #e66767;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-0: #0d1220;
  --surface-1: #151c2c;
  --surface-2: #1c2639;
  --border: #29344a;
  --border-strong: #3a4861;
  --grid: #222d41;
  --text-primary: #f5f7fb;
  --text-secondary: #b6c0d0;
  --text-muted: #8490a4;
  --accent: #6d91ff;
  --accent-hover: #86a3ff;
  --accent-soft: #1b2b58;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #2bb58c;
  --series-4: #9a82fa;
  --series-5: #e0a31a;
  --series-6: #e7699a;
  --series-7: #8aa3b8;
  --good: #3fae3f;
  --critical: #e66767;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--surface-0);
  color: var(--text-primary);
}
main { max-width: 1400px; margin: 0 auto; padding: 20px 16px 48px; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 15px; margin: 0 0 12px; }
h3 { font-size: 13px; margin: 16px 0 8px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.subtitle { color: var(--text-secondary); margin: 0 0 20px; }
.muted { color: var(--text-muted); }

.topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 16px; background: var(--surface-1); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar nav { display: flex; gap: 4px; }
.topbar nav a {
  color: var(--text-secondary); text-decoration: none; padding: 6px 12px; border-radius: 6px;
}
.topbar nav a.active, .topbar nav a:hover { background: var(--surface-0); color: var(--text-primary); }

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.layout { display: grid; grid-template-columns: 384px 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: 1fr; } }
.layout > * { min-width: 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.two-col { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 16px; align-items: start; }
.two-col.wide-right { grid-template-columns: minmax(0,1fr) minmax(0,2fr); }
@media (max-width: 900px) { .two-col, .two-col.wide-right { grid-template-columns: 1fr; } }

label { display: block; font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
input, select {
  width: 100%; padding: 7px 9px; font: inherit; color: var(--text-primary);
  background: var(--surface-0); border: 1px solid var(--border); border-radius: 6px;
}
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.row.three { grid-template-columns: 1fr 1fr 1fr; }
.field { margin-bottom: 10px; }

.filter { border-top: 1px solid var(--border); padding: 10px 0 2px; }
.filter > .toggle { display: flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; margin-bottom: 8px; }
.filter > .toggle input { width: auto; }
.filter > .toggle .hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }
.filter .params { display: none; }
.filter.on .params { display: block; }
.filter.on .params.row { display: grid; }  /* side by side, as .row */
.filter.on .params[hidden] { display: none; }

button {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 6px; padding: 9px 14px;
  border: 1px solid var(--border); background: var(--surface-0); color: var(--text-primary);
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; width: 100%; }
button:disabled { opacity: .6; cursor: default; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.segmented button { border: 0; border-radius: 0; padding: 5px 10px; font-weight: 500; background: transparent; }
.segmented button.active { background: var(--surface-0); color: var(--accent); font-weight: 600; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .label { font-size: 12px; color: var(--text-secondary); }
.tile .value { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.tile .sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pos { color: var(--good); }
.neg { color: var(--critical); }

.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-box { position: relative; height: 320px; min-width: 0; }
.chart-box canvas { max-width: 100%; }
.chart-box.small { height: 140px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-secondary); }
.legend span::before {
  content: ""; display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px;
  background: var(--swatch);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--text-secondary); position: sticky; top: 0; background: var(--surface-1); }
th:first-child, td:first-child { text-align: left; }
.scroll { max-height: 420px; overflow: auto; }
td a { color: var(--accent); text-decoration: none; }

.status { padding: 10px 12px; border-radius: 6px; background: var(--surface-0); color: var(--text-secondary); }
.status.error { color: var(--critical); }
.empty { text-align: center; padding: 60px 16px; color: var(--text-muted); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 16px; }
.stats-grid div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--grid); padding: 5px 0; }
.stats-grid dt { color: var(--text-secondary); }
.stats-grid dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.range-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 6px; margin-bottom: 10px; }
.range-row select { grid-column: 1 / -1; }
.range-row select.range-choice { grid-column: 1 / 3; }
.range-row button { padding: 4px 10px; }
.inline-check { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--text-primary); }
.inline-check input { width: auto; }
a.button {
  display: inline-block; font-weight: 600; text-decoration: none; border-radius: 6px; padding: 7px 14px;
  border: 1px solid var(--border); background: var(--surface-0); color: var(--text-primary);
}
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.fav-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fav-actions button { padding: 7px 14px; }
button.delete.confirm { color: #fff; background: var(--critical); border-color: var(--critical); }
.card a:not(.button) { color: var(--accent); }
#table th[data-sort] { cursor: pointer; user-select: none; }
#table th[data-sort]:hover { color: var(--text-primary); }
#table td.name { text-align: left; max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--text-secondary); }
#table th:nth-child(2) { text-align: left; }

/* --- sign-in & landing page ------------------------------------------------------------- */
a.brand { color: var(--text-primary); text-decoration: none; }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.user-menu img { border-radius: 50%; }
.user-menu form { margin: 0; }
.user-name { color: var(--text-secondary); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-button { background: none; border: 0; padding: 4px 6px; color: var(--accent); font-weight: 500; cursor: pointer; }
.link-button:hover { text-decoration: underline; }


/* Google branding: white button, Google "G", Roboto-like label. */
.google-button {
  display: inline-flex; align-items: center; gap: 10px; padding: 7px 14px; border-radius: 6px;
  background: #fff; color: #1f1f1f; border: 1px solid #747775; text-decoration: none;
  font: 500 14px/1.2 Roboto, system-ui, sans-serif; white-space: nowrap;
}
.google-button:hover { background: #f2f2f2; }
.google-button.large { padding: 11px 20px; font-size: 16px; }
/* Sign in with Apple, as Apple's guidelines draw it: black, the Apple logo, white text. */
.apple-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 16px;
  border-radius: 6px; background: #000; color: #fff; font-weight: 600; text-decoration: none; border: 1px solid #000; }
.apple-button:hover { background: #222; color: #fff; }
.apple-button.large { padding: 11px 20px; font-size: 16px; }
.card a.google-button { color: #1f1f1f; }
.card a.apple-button { color: #fff; }
.signin-card { max-width: 440px; margin: 24px auto; }
.notice { padding: 8px 12px; border-radius: 6px; background: var(--surface-0); }
.sign-in-methods td:last-child { text-align: right; }
.signin-options { display: grid; gap: 10px; margin: 16px 0; }
.signin-options a { justify-content: center; }
.account-benefits { padding-left: 20px; line-height: 1.6; }
.account-benefits li + li { margin-top: 8px; }
.signin-return { display: inline-block; padding: 10px 0; }
.landing-account-invite { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.landing-account-invite p { max-width: 40em; font-size: 14px; line-height: 1.6; }
.landing-account-invite .button { min-height: 44px; }

.welcome {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  max-width: 1400px; margin: 16px auto 0; padding: 12px 16px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
}
@media (max-width: 1432px) { .welcome { margin: 16px 16px 0; } }

.hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: center; padding: 32px 0 40px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 24px; padding-top: 8px; } }
.hero h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.12; margin: 12px 0 16px; letter-spacing: -0.01em; }
.eyebrow {
  display: inline-block; font-size: 13px; font-weight: 600; color: var(--good);
  background: color-mix(in srgb, var(--good) 12%, transparent); padding: 4px 10px; border-radius: 999px;
}
.lead { font-size: 17px; color: var(--text-secondary); max-width: 38em; margin: 0 0 24px; }
.cta-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.cta-alt a, .data-note a { color: var(--accent); }
.fine-print { font-size: 12px; color: var(--text-muted); margin-top: 14px; }

.hero-visual { margin: 0; }
.hero-visual-head { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.hero-visual svg { width: 100%; height: auto; display: block; }
.hero-visual .axis { stroke: var(--grid); stroke-width: 1; }
.hero-visual polyline { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.hero-visual .strat { stroke: var(--series-1); }
.hero-visual .bench { stroke: var(--series-2); }
.hero-visual .legend { margin-top: 8px; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature h2 { font-size: 16px; margin-bottom: 6px; }
.feature p { margin: 0; color: var(--text-secondary); }
.how { margin-top: 16px; }
.how ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; color: var(--text-secondary); }
.how b { color: var(--text-primary); }
.data-note { max-width: 60em; margin: 24px 0 0; font-size: 13px; }
/* A page's description below its app (Backtest, Screener): for visitors who scroll and for search engines. */
/* As wide as the workspace above it: the topics side by side, the intro and the small print at a
   readable line length. */
.page-about { margin: 32px 0 0; }
.page-about h2 { margin-top: 0; }
.page-about > p { max-width: 80ch; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 4px 32px; margin: 4px 0 12px; }
.page-about h3 { margin: 18px 0 4px; font-size: 15px; text-transform: none; letter-spacing: normal; color: var(--text); }
.page-about p { margin: 0 0 8px; color: var(--text-secondary); line-height: 1.6; }
.page-about a { color: var(--accent); }
.final-cta { text-align: center; padding: 32px 0 8px; }
.final-cta h2 { font-size: 22px; }

/* --- feedback ----------------------------------------------------------------------------- */
dialog#feedback-dialog {
  width: min(520px, calc(100vw - 32px)); border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface-1); color: var(--text-primary); padding: 20px;
}
dialog#feedback-dialog::backdrop { background: rgb(0 0 0 / 0.35); }
dialog#feedback-dialog h2 { font-size: 17px; margin-bottom: 4px; }
dialog#feedback-dialog .segmented { display: flex; flex-wrap: wrap; }
dialog#feedback-dialog .segmented label {
  display: flex; align-items: center; gap: 6px; margin: 0; padding: 6px 10px; cursor: pointer;
  font-size: 13px; color: var(--text-primary);
}
dialog#feedback-dialog .segmented input { width: auto; }
dialog#feedback-dialog .segmented label:has(input:checked) { background: var(--surface-0); color: var(--accent); font-weight: 600; }
textarea {
  width: 100%; padding: 8px 10px; font: inherit; color: var(--text-primary); resize: vertical;
  background: var(--surface-0); border: 1px solid var(--border); border-radius: 6px;
}
textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.feedback-item { border-top: 1px solid var(--border); padding: 14px 0; display: grid; gap: 6px; }
.feedback-item:first-child { border-top: 0; }
.feedback-item .meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; font-size: 12px; color: var(--text-muted); }
.feedback-item .message { white-space: pre-wrap; overflow-wrap: anywhere; }
.feedback-item select { width: auto; padding: 3px 6px; font-size: 12px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-0); color: var(--text-secondary); }
.pill.idea { color: var(--accent); }
.pill.bug { color: var(--critical); }
.pill.pos { color: var(--good); }
.pill.neg { color: var(--critical); }
.announcement { border-top: 1px solid var(--border); padding: 12px 0; display: grid; gap: 4px; }
.announcement:first-of-type { border-top: 0; padding-top: 0; }
.announcement .meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--text-muted); }
.announcement p { margin: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-list { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.ai-details > summary { cursor: pointer; font-size: 12px; color: var(--accent); width: fit-content; }
.ai-details[open] { display: grid; gap: 6px; }
.ai-details h4 { font-size: 12px; margin: 4px 0 0; color: var(--text-secondary); }

/* --- language picker ---------------------------------------------------------------------- */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* --- help page ---------------------------------------------------------------------------- */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 900px) { .docs { grid-template-columns: 1fr; } }
.docs-toc { position: sticky; top: 72px; }
@media (max-width: 900px) { .docs-toc { position: static; } }
.docs-toc h3 { margin-top: 0; }
.docs-toc ol { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.docs-toc a { color: var(--text-secondary); text-decoration: none; }
.docs-toc a:hover { color: var(--accent); }
.docs-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; max-width: 52em; min-width: 0; }
.docs-body section { scroll-margin-top: 72px; }
.docs-body h2 { font-size: 17px; }
.docs-body p, .docs-body li, .docs-body dd { color: var(--text-secondary); }
.docs-body pre { margin: 0; padding: 12px 14px; overflow-x: auto; border-radius: 8px; background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.docs-body p { margin: 0 0 10px; }
.docs-body p:last-child { margin-bottom: 0; }
.docs-body ol, .docs-body ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; }
.docs-terms { margin: 0 0 12px; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 16px; }
.docs-terms dt { font-weight: 600; grid-column: 1; }
.docs-terms dd { margin: 0; grid-column: 2; min-width: 0; }
@media (max-width: 600px) { .docs-terms { grid-template-columns: minmax(0, 1fr); gap: 2px; } .docs-terms dt, .docs-terms dd { grid-column: 1; } .docs-terms dd { margin-bottom: 8px; } }
.ui-label { color: var(--text-primary); font-weight: 600; }

/* --- live strategies ---------------------------------------------------------------------- */
.pill.running { color: var(--good); }
button.confirm-action.confirm { color: #fff; background: var(--critical); border-color: var(--critical); }
.live-table { padding: 0; }
.live-table > table th, .live-table > table > tbody > tr > td { padding: 10px 12px; vertical-align: top; }
.live-table > table > tbody > tr.live-row > td { border-bottom: 1px solid var(--border); }
.live-name { text-align: left; min-width: 220px; max-width: 360px; white-space: normal; }
.live-name .toggle { padding: 0; font-weight: 600; font-size: 14px; color: var(--text-primary); text-align: left; }
.live-desc { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.live-sub { font-size: 12px; }
.live-actions { white-space: nowrap; }
.claude-hero { padding-bottom: 40px; }
.claude-chat { display: grid; gap: 12px; padding: 24px; margin: 0; }
.claude-q { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); font-size: 14px; line-height: 1.5; }
.claude-q::before { content: "› "; color: var(--accent); font-weight: 600; }
.how code { word-break: break-all; }
.mcp-url { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.mcp-url code { padding: 6px 10px; border-radius: 6px; background: var(--surface-2); word-break: break-all; }
.watch-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; max-width: 560px; }
.watch-add .live-add-search { flex: 1 1 240px; }
.watch-table td { vertical-align: middle; }
.watch-table .alert-input { width: 96px; padding: 5px 8px; font-size: 13px; }
.watch-sub { font-size: 11px; }
@media (max-width: 760px) {
  .watch-table thead { display: none; }
  .watch-table > table, .watch-table tbody { display: block; }
  .watch-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .watch-table td { display: block; padding: 0; border: 0; }
  .watch-table td.watch-name, .watch-table td.live-actions { grid-column: 1 / -1; }
  .watch-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-muted); }
}
.score-total { display: flex; align-items: baseline; gap: 6px; margin-bottom: 10px; }
.score-total b { font-size: 34px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.score-part { display: grid; grid-template-columns: 70px 1fr 32px; gap: 10px; align-items: center; font-size: 13px; margin-top: 6px; }
.score-part b { text-align: right; font-variant-numeric: tabular-nums; }
.score-bar { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.live-alerts { margin-top: 6px; font-size: 12px; color: var(--text-secondary); }
.live-actions button, button.small { padding: 4px 10px; font-size: 12px; }
tr.live-detail > td { background: var(--surface-0); border-bottom: 1px solid var(--border); text-align: left; white-space: normal; }
.live-detail-body { max-width: 720px; }
.live-holdings { width: auto; min-width: min(520px, 100%); margin-bottom: 12px; }
.live-holdings td { padding: 4px 10px 4px 0; }
.pill.added { color: var(--accent); }
.live-add { display: flex; gap: 8px; max-width: 420px; }
.live-add input { flex: 1; }
.live-status { font-size: 12px; min-height: 18px; margin-top: 6px; }
.live-removed, .live-changes, .live-note { font-size: 12px; margin: 8px 0 0; }
.chip { display: inline-block; padding: 1px 8px; border: 1px solid var(--border); border-radius: 999px; margin: 2px 2px 0 0; }
.chip .link-button { font-size: 12px; padding: 0 2px; }
/* Phones: each strategy as a small block of labelled values instead of a wide table row. */
@media (max-width: 700px) {
  .live-table thead { display: none; }
  .live-table > table, .live-table > table > tbody, .live-table > table > tbody > tr, .live-table > table > tbody > tr > td { display: block; }
  .live-table > table > tbody > tr.live-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px; border-bottom: 1px solid var(--border); }
  .live-table > table > tbody > tr.live-row > td { padding: 0; border: 0; text-align: left; white-space: normal; }
  .live-row > td.live-name, .live-row > td.live-actions { grid-column: 1 / -1; max-width: none; min-width: 0; }
  .live-row > td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-muted); }
  .live-table > table > tbody > tr.live-detail > td { padding: 12px; }
  .live-holdings { min-width: 0; width: 100%; }
  .live-holdings td:nth-child(2) { display: none; }  /* company names don't fit */
}

/* --- popular strategies ------------------------------------------------------------------- */
.market-switch { margin-bottom: 16px; }
.market-switch a { padding: 6px 12px; text-decoration: none; color: var(--text-secondary); font-weight: 500; }
.market-switch a.active { background: var(--surface-1); color: var(--accent); font-weight: 600; }
.popular-table { padding: 0; }
.popular-table th, .popular-table td { padding: 10px 12px; }
.popular-name { text-align: left; white-space: normal; min-width: 240px; }
.popular-name a { font-weight: 600; font-size: 15px; }
.popular-name .muted { font-size: 12px; margin-top: 2px; }
.popular-bar { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.popular-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.popular-actions button { padding: 7px 14px; }
.popular-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; margin-top: 16px; }
@media (max-width: 900px) { .popular-layout { grid-template-columns: 1fr; } }
.popular-layout section p { color: var(--text-secondary); }
table.picks td { white-space: normal; }
table.picks td.muted { text-align: left; font-size: 12px; }
@media (max-width: 700px) {
  .popular-table thead { display: none; }
  .popular-table table, .popular-table tbody, .popular-table tr, .popular-table td { display: block; }
  .popular-table tr { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px 10px; padding: 12px; border-bottom: 1px solid var(--border); }
  .popular-table td { padding: 0; border: 0; text-align: left; white-space: normal; }
  .popular-table td.popular-name { grid-column: 1 / -1; min-width: 0; }
  .popular-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; color: var(--text-muted); margin-top: 6px; }
  .popular-table td[colspan] { grid-column: 1 / -1; }
}

/* --- visitors: what an account adds ------------------------------------------------------- */
.signup-cta { margin-top: 10px; padding: 12px; border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-1)); border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border)); }
.signup-cta p { margin: 0 0 10px; font-size: 13px; color: var(--text-secondary); }
.result-cta { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; }
.result-cta p { margin: 0; font-size: 14px; }
.members-only { max-width: 44em; }
.members-only .lead { margin-top: 0; }
.members-only ul { color: var(--text-secondary); padding-left: 20px; display: grid; gap: 6px; margin: 0 0 16px; }
.try-button { padding: 11px 20px; font-size: 16px; }
.market-switch { flex-wrap: wrap; }

/* --- (i) beside a figure and its explanation (common.js) ------------------------------------ */
.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px; margin-left: 4px;
  padding: 0; border: 1px solid var(--border); border-radius: 50%; background: transparent; color: var(--text-secondary);
  font: italic 600 10px/1 Georgia, serif; vertical-align: middle; cursor: pointer; flex: none; }
.info-icon:hover, .info-icon[aria-expanded="true"] { color: var(--accent); border-color: var(--accent); }
.info-pop { position: fixed; z-index: 1000; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-1);
  border: 1px solid var(--border); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18); font-size: 13px; line-height: 1.45;
  color: var(--text-primary, inherit); }

/* --- valuation section (stock pages): a visitor sees a taste and a locked part ------------ */
.valuation h3 { font-size: 15px; margin: 18px 0 8px; }
.valuation-tiles { margin: 12px 0 8px; }
.valuation-pending { margin: 4px 0 14px; font-size: 14px; color: var(--text-secondary); }
.valuation-quarters th, .valuation-quarters td { text-align: right; white-space: nowrap; }
.valuation-quarters th:first-child, .valuation-quarters td:first-child, .valuation-quarters td:last-child { text-align: left; }
.valuation-list { margin: 0 0 8px; padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
.valuation-list .quote { font-size: 13px; }
.table-scroll { overflow-x: auto; }
.my-estimate { margin: 16px 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-1); }
.my-estimate h3:first-child { margin-top: 0; }
.estimate-table input { width: 7.5em; text-align: right; }
.estimate-result { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; margin: 12px 0; font-size: 14px; }
.card > .my-estimate { margin: 0; padding: 0; border: 0; background: none; }
.signin-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px;
  margin: 12px 0 4px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-0); }
.signin-strip p { margin: 0; flex: 1 1 320px; font-size: 14px; }

/* --- stock pages: the heading, the tabs between the overview and the sub-pages, and the tabs' tables */
.stock-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 4px 24px; }
.stock-head h1 { margin-bottom: 2px; }
.stock-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 14px; font-size: 15px; }
.stock-price b { font-size: 26px; }
.stock-actions { margin: 4px 0 14px; }
.stock-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--border); margin: 0 0 16px;
  scrollbar-width: none; }
.stock-tabs a { padding: 9px 14px; white-space: nowrap; color: var(--text-secondary); text-decoration: none; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.stock-tabs a:hover { color: var(--text-primary); }
.stock-tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.stock-summary { margin: 0 0 16px; max-width: 75ch; }
.tiles-heading { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 14px 0 8px; }
.split-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; margin: 16px 0; }
.split-cards > .card { margin: 0; }
.financials-table th, .financials-table td { text-align: right; white-space: nowrap; }
.financials-table th:first-child, .financials-table td:first-child { text-align: left; }
.financials-table tr.group th { text-align: left; padding-top: 14px; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-muted); }
.sector-table th, .sector-table td { text-align: right; white-space: nowrap; }
.sector-table th:nth-child(2), .sector-table td:nth-child(2) { text-align: left; }
.sector-table th[data-key] { cursor: pointer; user-select: none; }
.sector-table th[data-sorted="1"]::after { content: " ▲"; }
.sector-table th[data-sorted="-1"]::after { content: " ▼"; }
.sector-table tr.current td { background: var(--surface-0); font-weight: 600; }
.estimate-result input { width: 5em; margin-left: 6px; text-align: right; }
.estimate-note { display: grid; gap: 4px; font-size: 13px; color: var(--text-secondary); margin-bottom: 10px; }
.estimate-note textarea { width: 100%; resize: vertical; }
.locked { position: relative; margin-top: 4px; border-radius: var(--radius); overflow: hidden; }
.locked-content { filter: blur(6px); opacity: 0.6; user-select: none; pointer-events: none; }
.locked-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; padding: 16px; gap: 2px;
  background: color-mix(in srgb, var(--surface-1) 55%, transparent); }
.locked-overlay p { margin: 0 0 8px; max-width: 34em; font-size: 14px; }
.locked-cell { color: var(--text-secondary); cursor: help; }

/* --- ranking factors ---------------------------------------------------------------------- */
.factor-row { display: grid; grid-template-columns: minmax(0, 1fr) 56px 38px auto; gap: 6px; align-items: center; margin-bottom: 6px; }
.factor-row input[hidden], .factor-row button[hidden] { display: none; }
.factor-row:only-child { grid-template-columns: 1fr; }
.factor-row button { padding: 4px 10px; }
.factor-share { font-size: 12px; text-align: right; }

/* --- top bar ------------------------------------------------------------------------------ */
.brand { display: flex; align-items: center; gap: 8px; font-weight: 750; font-size: 17px; letter-spacing: -0.01em; }
.brand img { border-radius: 6px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 14px; }
.signin-link { color: var(--text-primary); text-decoration: none; font-weight: 500; padding: 6px 4px; }
.signin-link:hover { color: var(--accent); }
.try-free { padding: 7px 14px; }
.menu-toggle { display: none; padding: 5px 10px; font-size: 18px; line-height: 1; }
.nav-only-mobile { display: none; }

/* Dropdowns (language, account): <details> with a panel under the button. */
details.dropdown { position: relative; }
details.dropdown > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 5px 8px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface-0); font-size: 13px; font-weight: 600; user-select: none; }
details.dropdown > summary::-webkit-details-marker { display: none; }
details.dropdown[open] > summary, details.dropdown > summary:hover { border-color: var(--text-muted); }
details.account-menu > summary { padding: 2px 6px 2px 2px; border-radius: 999px; }
details.account-menu img, .avatar { width: 30px; height: 30px; border-radius: 50%; display: block; }
.avatar { display: grid; place-items: center; background: var(--accent); color: #fff; font-weight: 700; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; z-index: 20; display: grid; padding: 6px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); }
.dropdown-panel a, .dropdown-panel button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 6px;
  background: none; color: var(--text-primary); font: inherit; font-size: 14px; font-weight: 400; text-decoration: none; cursor: pointer; }
.dropdown-panel a:hover, .dropdown-panel button:hover { background: var(--surface-0); }
.dropdown-panel [aria-current] { color: var(--accent); font-weight: 600; }
.dropdown-panel form { margin: 0; }
.account-name { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px;
  overflow: hidden; text-overflow: ellipsis; }
.account-name .muted { font-weight: 400; font-size: 12px; }

/* Phones and small tablets: one row, the main menu behind ☰. */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; }
  .menu-toggle { display: block; }
  .topbar nav { display: none; order: 3; width: 100%; flex-direction: column; gap: 2px; padding: 6px 0 4px; border-top: 1px solid var(--border); }
  .topbar.nav-open nav { display: flex; }
  .topbar nav a { padding: 10px 8px; }
}
@media (max-width: 480px) {
  .signin-link { display: none; }
  .nav-only-mobile { display: block; }
  .lang-menu { display: none; }   /* in the footer */
}

/* --- footer ------------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); background: var(--surface-1); margin-top: 32px; }
.footer-inner { max-width: 1400px; margin: 0 auto; padding: 20px 16px 28px; display: flex; flex-wrap: wrap; gap: 16px 40px;
  align-items: flex-start; font-size: 13px; color: var(--text-secondary); }
.footer-about { flex: 1 1 320px; max-width: 520px; }
.footer-about p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }
.footer-contact { margin: 8px 0 0; font-style: normal; color: var(--text-muted); font-size: 12px; line-height: 1.6; }
.site-footer nav, .footer-languages { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; margin: 0; }
.site-footer a { color: var(--text-secondary); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.site-footer .link-button { padding: 0; font-size: 13px; color: var(--text-secondary); font-weight: 400; }
.footer-languages .link-button[aria-current] { color: var(--text-primary); font-weight: 600; }

/* Grid and button groups never wider than the screen: grid cells may shrink below their content
   (tables scroll inside .table-wrap), and segmented buttons wrap. */
.two-col > * { min-width: 0; }
.segmented { flex-wrap: wrap; max-width: 100%; }

/* --- the Claude assistant ----------------------------------------------------------------- */
.assistant-launch { position: fixed; right: 20px; bottom: 20px; z-index: 30; border-radius: 999px; padding: 10px 16px;
  background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 6px 20px rgb(0 0 0 / 0.18); }
body.assistant-open .assistant-launch { display: none; }
.assistant-panel { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: min(420px, calc(100vw - 32px));
  height: min(640px, calc(100vh - 100px)); display: flex; flex-direction: column; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 40px rgb(0 0 0 / 0.2); overflow: hidden; }
.assistant-panel[hidden] { display: none; }
.assistant-panel header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.assistant-panel header b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.assistant-log { flex: 1; overflow-y: auto; padding: 14px; display: grid; gap: 10px; align-content: start; }
.assistant-msg { max-width: 92%; padding: 10px 12px; border-radius: 12px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.assistant-msg.user { justify-self: end; background: var(--accent); color: #fff; white-space: pre-wrap; }
.assistant-msg.claude { justify-self: start; background: var(--surface-0); }
.assistant-msg p { margin: 0 0 8px; } .assistant-msg p:last-child { margin-bottom: 0; }
.assistant-msg ul, .assistant-msg ol { margin: 0 0 8px; padding-left: 20px; }
.assistant-msg code { font-size: 12px; background: var(--surface-1); padding: 1px 4px; border-radius: 4px; }
.assistant-typing { color: var(--text-muted); font-style: italic; }
.assistant-card { margin: 10px 0; padding: 10px 12px; background: var(--surface-1); border: 1px solid var(--border); border-radius: 10px; }
.assistant-card p { margin: 4px 0 8px; font-size: 13px; color: var(--text-secondary); }
.assistant-card .assistant-act { width: auto; padding: 5px 14px; }
.assistant-card .assistant-act.link-button { padding: 0; }
.assistant-card .assistant-card-spec { font-size: 12px; color: var(--text-muted); }
.assistant-card-status { font-size: 13px; color: var(--pos, var(--text-secondary)); font-weight: 600; }
.assistant-stats { width: 100%; margin: 6px 0 8px; font-size: 13px; border-collapse: collapse; }
.assistant-stats th, .assistant-stats td { padding: 2px 4px; text-align: right; }
.assistant-stats th:first-child, .assistant-stats td:first-child { text-align: left; color: var(--text-secondary); }
.assistant-empty .assistant-build { justify-self: start; width: auto; margin-top: 4px; }
.assistant-empty { color: var(--text-secondary); font-size: 14px; display: grid; gap: 8px; }
.assistant-empty p { margin: 0 0 4px; }
.assistant-example { text-align: left; font-weight: 500; font-size: 13px; padding: 8px 10px; }
.assistant-form { display: flex; gap: 8px; padding: 10px 12px 4px; border-top: 1px solid var(--border); }
.assistant-form textarea { flex: 1; resize: none; font-size: 14px; }
.assistant-form button { width: auto; align-self: stretch; }
.assistant-note { margin: 0; padding: 4px 12px 10px; font-size: 11px; color: var(--text-muted); }
.assistant-ask { padding: 6px 12px; font-weight: 600; }
.assistant-status { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.assistant-status:empty { display: none; }
.assistant-status.unread { color: var(--accent); font-weight: 600; }
.assistant-min { font-size: 18px; line-height: 1; padding: 0 4px; }
/* Minimized: only the title bar, which shows what Claude is doing; a click opens it again. */
.assistant-panel.minimized { height: auto; width: min(320px, calc(100vw - 32px)); }
.assistant-panel.minimized header { border-bottom: 0; cursor: pointer; }
.assistant-panel.minimized #assistant-new, .assistant-panel.minimized .assistant-log,
.assistant-panel.minimized .assistant-form, .assistant-panel.minimized .assistant-note { display: none; }
@media (max-width: 600px) {
  .assistant-panel { right: 0; bottom: 0; width: 100vw; height: 85vh; border-radius: 14px 14px 0 0; }
  .assistant-panel.minimized { width: 100vw; height: auto; }
  .assistant-launch { right: 12px; bottom: 12px; }
}

/* Sharing a backtest */
.result-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.share-box { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.share-box label { display: block; margin-bottom: 6px; color: var(--text-secondary); }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.share-row input { flex: 1 1 220px; min-width: 0; }
.dropdown-panel .danger-link { color: var(--text-muted); font-size: 12px; }

/* --- books (favourites page) -------------------------------------------------------------- */
#book summary { cursor: pointer; }
.book-part { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--text-primary); }
.book-part input[type=checkbox] { width: auto; }
.book-part .book-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-part .book-weight { width: 72px; }

/* --- optimizer (backtest page) ------------------------------------------------------------ */
.optimizer { border-top: 1px solid var(--border); margin-top: 10px; padding-top: 8px; }
.optimizer summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.optimizer .opt-values { margin-top: 6px; }
tr.best td { font-weight: 600; background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* --- compare stocks ----------------------------------------------------------------------- */
.compare-form { display: grid; gap: 10px; margin-bottom: 16px; }
.compare-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.compare-chip { display: inline-flex; align-items: center; gap: 6px; }
.compare-chip .link-button { padding: 0 2px; font-size: 16px; line-height: 1; }
.compare-add { display: flex; gap: 8px; }
.compare-add .compare-search { flex: 1; min-width: 0; }
.compare-add button { width: auto; }
.compare-table td:first-child { color: var(--text-secondary); white-space: nowrap; }
.compare-table th a { color: inherit; }

/* --- saved universes (backtest page) ------------------------------------------------------ */
.universe-lists { display: flex; gap: 6px; margin-top: 6px; }
.universe-lists select, .universe-lists input { flex: 1; min-width: 0; }
.universe-lists button { width: auto; white-space: nowrap; }

/* --- formulas (backtest page) ------------------------------------------------------------- */
.formula-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) auto; gap: 6px; margin-bottom: 6px; }
.formula-row button { width: auto; padding: 0 10px; }
.formula-row [name=expr] { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

/* --- theme button (topbar) ---------------------------------------------------------------- */
.theme-toggle { display: flex; align-items: center; justify-content: center; width: 34px; height: 30px; padding: 0;
  border: 1px solid var(--border); border-radius: 8px; background: transparent; color: var(--text-secondary); cursor: pointer; }
.theme-toggle:hover { border-color: var(--text-muted); color: var(--text-primary); }
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .moon { display: none; }
:root[data-shown-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-shown-theme="dark"] .theme-toggle .moon { display: block; }

/* --- ticker search (common.js tickerSearch) ----------------------------------------------- */
.ticker-search { position: relative; }
.ticker-suggestions { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; margin: 4px 0 0; padding: 4px;
  list-style: none; max-height: 320px; overflow-y: auto; background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); }
.ticker-suggestions li { display: flex; gap: 8px; align-items: baseline; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.ticker-suggestions li span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticker-suggestions li b { white-space: nowrap; flex-shrink: 0; }
.ticker-suggestions li .muted { margin-left: auto; font-size: 12px; flex-shrink: 0; }
.ticker-suggestions li:hover, .ticker-suggestions li[aria-selected="true"] { background: var(--surface-0); }

/* --- the backtest form: name, tabs for its sections, summary and run --------------------- */
.strategy-form { padding-top: 14px; }
.strategy-form .form-head .field:last-child { margin-bottom: 12px; }
.form-tabs { display: flex; gap: 2px; margin: 0 -16px 14px; padding: 0 12px; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; }
.form-tabs::-webkit-scrollbar { display: none; }
.form-tabs [role=tab] { position: relative; display: flex; align-items: center; gap: 5px; flex: 0 0 auto; width: auto;
  padding: 8px 9px 10px; border: 0; border-radius: 0; background: none; color: var(--text-secondary); font-weight: 600;
  font-size: 13px; cursor: pointer; }
.form-tabs [role=tab]:hover { color: var(--text-primary); }
.form-tabs [role=tab][aria-selected="true"] { color: var(--text-primary); }
.form-tabs [role=tab][aria-selected="true"]::after { content: ""; position: absolute; left: 6px; right: 6px; bottom: -1px;
  height: 2px; border-radius: 2px; background: var(--accent); }
.form-tabs [role=tab]:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.tab-count { min-width: 17px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: #fff;
  font-size: 11px; line-height: 17px; text-align: center; }
.tab-count[hidden] { display: none; }
.form-section .section-lead { margin: 0 0 12px; color: var(--text-secondary); font-size: 13px; }
.form-section h3:first-of-type { margin-top: 4px; }
.formulas-box { margin: 10px 0 4px; border-top: 1px solid var(--border); padding-top: 10px; }
.formulas-box > summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
.form-foot { margin: 14px -16px -16px; padding: 12px 16px 16px; border-top: 1px solid var(--border);
  background: var(--surface-0); border-radius: 0 0 var(--radius) var(--radius); }
.strategy-summary { margin: 0 0 10px; font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.run-row { display: flex; gap: 8px; }
.run-row #run { flex: 1; }
.run-row #reset-form { width: auto; flex: 0 0 auto; }
.live-add-search { flex: 1; min-width: 0; }

/* Shared application shell and controls. */
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { min-height: 100vh; line-height: 1.55; -webkit-font-smoothing: antialiased; }
:root { --on-accent: #fff; --text-muted: #657388; }
:root[data-theme="dark"] { --on-accent: #101b33; --text-muted: #9ba7ba; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --on-accent: #101b33; --text-muted: #9ba7ba; } }
main { max-width: 1320px; padding: 32px 24px 64px; }
h1 { font-size: clamp(26px, 3vw, 34px); line-height: 1.2; letter-spacing: -.035em; margin-bottom: 10px; }
h2 { font-size: 17px; line-height: 1.4; letter-spacing: -.015em; }
h3 { font-size: 11px; letter-spacing: .08em; }
a { text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input:not([type=checkbox]):not([type=radio]), select, textarea { min-height: 40px; border-radius: 7px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
button, a.button { border-radius: 7px; }
button.primary, a.button.primary { color: var(--on-accent); }
button.primary:hover:not(:disabled), a.button.primary:hover { background: var(--accent-hover); }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 16px; padding: 10px 16px; color: var(--on-accent); background: var(--accent); border-radius: 6px; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.topbar { display: block; padding: 0 32px; background: var(--surface-1); border-color: var(--border); }
.topbar-inner { width: 100%; max-width: 1376px; min-height: 70px; margin: auto; display: flex; align-items: center; gap: 40px; }
.brand { font-size: 19px; gap: 9px; letter-spacing: -.04em; }
.brand img { width: 29px; height: 29px; }
.topbar nav { gap: 5px; }
.topbar nav a { font-size: 13px; padding: 9px 13px; border-radius: 7px; font-weight: 500; }
.topbar nav a.active { color: var(--accent); background: var(--accent-soft); }
.topbar-right { gap: 12px; }
.topbar .theme-toggle { width: 34px; height: 34px; padding: 8px; border: 0; background: none; }
.dropdown-panel { padding: 7px; border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.dropdown-panel .admin-links { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.account-links { background: var(--surface-1); border-bottom: 1px solid var(--border); }
.account-links nav { max-width: 1376px; margin: auto; padding: 8px 0; display: flex; gap: 24px; overflow: auto; }
.account-links a { color: var(--text-secondary); text-decoration: none; white-space: nowrap; font-size: 12px; padding: 3px 0; }
.account-links a[aria-current=page] { color: var(--accent); font-weight: 600; }
.card { box-shadow: var(--shadow-sm); }
td, th { padding: 9px 10px; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.tiles { gap: 14px; }
.tile { padding: 16px 18px; }
.tile .value { font-size: 25px; letter-spacing: -.025em; margin-top: 6px; }
.site-footer { margin-top: 28px; background: var(--surface-1); }
.footer-inner { max-width: 1376px; padding: 32px 24px; }
/* The public entry point uses the same restrained palette as the research workspace. */
.landing-page main { max-width: 1240px; }
.hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 64px; padding: 64px 0 72px; }
.hero h1 { max-width: 12em; font-size: clamp(36px, 4.5vw, 58px); line-height: 1.06; margin: 22px 0; letter-spacing: -.05em; }
.eyebrow { padding: 6px 10px; color: var(--accent); background: var(--accent-soft); font-size: 11px; }
.lead { font-size: 16px; line-height: 1.75; margin-bottom: 26px; }
.cta-row { gap: 12px; }
.cta-row .try-button { padding: 12px 18px; background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-size: 14px; }
.cta-row .google-button, .cta-row .apple-button { min-height: 46px; }
.cta-alt { flex-basis: 100%; font-size: 12px; margin-top: 4px; }
.fine-print { line-height: 1.7; margin-top: 18px; max-width: 42em; }
.hero-visual { padding: 28px; border-radius: 16px; box-shadow: var(--shadow-md); }
.hero-visual-head { align-items: flex-start; margin-bottom: 32px; }
.hero-visual-head > div { display: grid; gap: 7px; }
.visual-kicker { font-size: 10px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-secondary); }
.hero-visual-head b { font-size: 20px; letter-spacing: -.02em; }
.visual-badge { font-size: 10px; padding: 3px 7px; background: var(--surface-2); border-radius: 4px; color: var(--text-secondary); }
.hero-chart { margin: 0 -4px; }
.hero-visual .axis { stroke-dasharray: 3 5; }
.hero-visual .strategy-area { fill: url(#strategy-area); }
.hero-visual .chart-dot { fill: var(--surface-1); stroke: var(--series-1); stroke-width: 3; }
.hero-visual .legend { margin-top: 22px; font-size: 10px; justify-content: flex-end; }
.cta-row .demo-link { min-height: 46px; gap: 8px; padding: 12px 18px; }
.demo-link > span { font-size: 19px; line-height: 1; }
.product-demo { margin-bottom: 48px; scroll-margin-top: 94px; }
.demo-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.demo-heading h2 { font-size: clamp(24px, 3vw, 34px); letter-spacing: -.035em; margin: 10px 0; line-height: 1.2; }
.demo-heading p { color: var(--text-secondary); margin: 0; font-size: 15px; line-height: 1.7; }
.demo-try { flex-shrink: 0; font-size: 13px; font-weight: 600; padding-block: 8px; }
.demo-player { margin: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-1); box-shadow: var(--shadow-md); }
.demo-player video { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; background: #f5f7fb; }
.demo-player video:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.demo-player figcaption { padding: 14px 20px; font-size: 12px; line-height: 1.6; color: var(--text-secondary); border-top: 1px solid var(--border); }
.demo-transcript { margin-top: 18px; font-size: 13px; color: var(--text-secondary); }
.demo-transcript summary { width: fit-content; cursor: pointer; padding-block: 6px; color: var(--text-primary); }
.demo-transcript ol { max-width: 70em; padding-left: 22px; line-height: 1.8; }
.demo-transcript li + li { margin-top: 8px; }
@media (max-width: 600px) {
  .demo-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .demo-player { border-radius: 10px; }
  .demo-player figcaption { padding: 12px 14px; }
  .product-demo { margin-bottom: 32px; }
}
.features { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.feature { padding: 26px; }
.feature h2 { font-size: 17px; margin-bottom: 12px; }
.feature p { font-size: 13px; line-height: 1.75; }
.how { margin-top: 20px; padding: 28px; }
.how h2 { font-size: 22px; }
.how ol { grid-template-columns: repeat(3, minmax(0, 1fr)); list-style: none; padding: 0; gap: 28px; counter-reset: steps; }
.how li { padding-top: 48px; position: relative; counter-increment: steps; font-size: 13px; line-height: 1.75; }
.how li::before { content: counter(steps); position: absolute; top: 3px; left: 0; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: var(--accent); background: var(--accent-soft); font-weight: 600; }
.data-note { margin: 30px auto 0; text-align: center; line-height: 1.75; max-width: 76em; }
.final-cta { margin-top: 30px; padding: 40px 24px; border-radius: 14px; background: var(--accent-soft); }
.final-cta h2 { font-size: 26px; margin-bottom: 18px; }
/* Landing: counters, real strategy results, and the comparison with other ways to backtest. */
.landing-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 18px; margin: -24px 0 56px; padding: 22px 26px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-1); }
.landing-stats div { display: grid; gap: 4px; align-content: start; }
.landing-stats b { font-size: 28px; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.landing-stats span { font-size: 12px; line-height: 1.5; color: var(--text-secondary); }
.showcase { margin-bottom: 48px; }
.showcase-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.showcase-card { display: grid; gap: 8px; align-content: start; padding: 22px; color: inherit; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.showcase-card:hover, .showcase-card:focus-visible { border-color: var(--accent); box-shadow: var(--shadow-md); }
.showcase-name { font-weight: 600; font-size: 16px; }
.showcase-tagline { font-size: 12px; line-height: 1.6; color: var(--text-secondary); min-height: 3.2em; }
.showcase-card svg { width: 100%; height: 64px; margin: 6px 0; overflow: visible; }
.showcase-card polyline { fill: none; stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.showcase-card .strat { stroke: var(--series-1); }
.showcase-card .bench { stroke: var(--series-2); opacity: .8; }
.showcase-card dl { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.showcase-card dt { font-size: 11px; color: var(--text-muted); }
.showcase-card dd { margin: 2px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.showcase-period { font-size: 11px; color: var(--text-muted); }
.showcase-legend { margin-top: 14px; font-size: 11px; }
.showcase-note { font-size: 12px; margin-top: 8px; }
.compare-section { margin-top: 48px; }
.compare-section h2 { font-size: clamp(22px, 2.6vw, 30px); letter-spacing: -.03em; margin-bottom: 8px; }
.compare-section > p { margin: 0 0 18px; }
.compare-table { padding: 0; }
.compare-table table { width: 100%; border-collapse: collapse; font-size: 13px; }
.compare-table th, .compare-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
.compare-table tbody tr:last-child > * { border-bottom: 0; }
.compare-table thead th { font-size: 12px; color: var(--text-secondary); font-weight: 600; }
.compare-table tbody th { font-weight: 500; }
.compare-table .compare-us { background: var(--accent-soft); }
.compare-table thead .compare-us { color: var(--accent); }
.compare-yes { color: var(--good); }
.compare-no, .compare-some { color: var(--text-secondary); }
@media (max-width: 700px) {
  .landing-stats { margin-top: 0; padding: 18px; }
  .compare-table thead { display: none; }
  .compare-table tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  .compare-table tbody tr:last-child { border-bottom: 0; }
  .compare-table th, .compare-table td { display: block; padding: 3px 0; border: 0; }
  .compare-table tbody th { margin-bottom: 4px; }
  .compare-table td[data-label]::before { content: attr(data-label) ": "; color: var(--text-muted); }
  .compare-table .compare-us { background: none; }
}
@media (max-width: 1440px) { .account-links nav { margin-inline: 32px; } }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding: 32px 0 48px; }
  .hero h1 { max-width: 14em; }
  .hero-visual { width: min(560px, 100%); margin: auto; }
  .how ol { grid-template-columns: 1fr; }
  .how li { padding: 0 0 0 48px; min-height: 36px; }
}
@media (max-width: 820px) {
  .topbar { padding: 0 18px; }
  .topbar-inner { flex-wrap: wrap; gap: 0 10px; min-height: 62px; }
  .topbar nav { order: 3; width: 100%; padding: 8px 0 14px; }
  .topbar nav a { padding: 10px 12px; }
  .topbar-right { gap: 8px; }
  .account-links nav { margin-inline: 18px; gap: 20px; }
  main { padding: 24px 18px 48px; }
}
@media (max-width: 600px) {
  .brand { font-size: 18px; }
  .brand img { width: 26px; height: 26px; }
  .topbar .try-free { display: none; }
  .assistant-launch { width: 44px; height: 44px; padding: 0; right: 14px; bottom: 14px; font-size: 22px; }
  .assistant-launch-label { display: none; }
  .features { grid-template-columns: 1fr; }
  .hero h1 { font-size: 39px; }
  .hero-visual { padding: 22px; }
  .feature, .how { padding: 22px; }
  .row.three { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* Site search (common.js siteSearch): a box in the top bar; on narrow screens behind a button, as
   its own row under the bar when opened. Suggestions in a panel under the box. */
.site-search { position: relative; flex: 1 1 240px; max-width: 360px; margin: 0 0 0 auto; display: flex; align-items: center; }
.site-search input { width: 100%; padding: 8px 34px 8px 34px; font-size: 13px; border-radius: 8px; background: var(--surface-0); }
.site-search input::-webkit-search-cancel-button { display: none; }
.site-search-icon { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
.site-search-key { position: absolute; right: 9px; padding: 1px 6px; font: 11px/1.4 inherit; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 4px; pointer-events: none; }
.site-search.is-focused .site-search-key { display: none; }
.site-search + .topbar-right { margin-left: 0; }
.site-search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 340px; max-height: min(70vh, 560px);
  overflow: auto; z-index: 30; margin: 0; padding: 6px; list-style: none; background: var(--surface-1);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.site-search-results li[role=option] { border-radius: 8px; cursor: pointer; }
.site-search-results li[role=option] > a, .site-search-ask { display: block; padding: 8px 10px; color: var(--text-primary); text-decoration: none; font-size: 13px; }
.site-search-results li[aria-selected=true], .site-search-results li[role=option]:hover { background: var(--accent-soft); }
.site-search-results .muted { font-size: 12px; }
.site-search-text { display: block; margin-top: 2px; font-size: 12px; line-height: 1.45; color: var(--text-secondary);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.site-search-group { padding: 10px 10px 4px; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.site-search-none { padding: 10px; font-size: 13px; color: var(--text-secondary); }
.site-search-ask { color: var(--accent) !important; border-top: 1px solid var(--border); margin-top: 4px; border-radius: 0 0 8px 8px; }
.site-search-all > a { color: var(--accent) !important; font-weight: 600; }
.search-toggle { display: none; width: 34px; height: 34px; padding: 8px; border: 0; background: none; color: var(--text-secondary); cursor: pointer; }
.search-toggle svg { width: 18px; height: 18px; display: block; }
.search-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.search-group p { margin: 4px 0 0; font-size: 13px; line-height: 1.55; }
@media (max-width: 1100px) {
  .site-search { display: none; order: 4; flex-basis: 100%; max-width: none; margin: 0 0 12px; }
  body.search-open .site-search { display: flex; }
  .search-toggle { display: block; }
  .site-search + .topbar-right { margin-left: auto; }
  .site-search-results { min-width: 0; }
}
/* A run remains reachable while browsing other pages. */
.backtest-activity {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px max(20px, calc((100vw - 1440px) / 2));
  background: var(--accent-soft);
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.backtest-activity[hidden] { display: none; }
.backtest-activity > span { flex: 1; overflow-wrap: anywhere; }
.backtest-activity a { flex-shrink: 0; font-weight: 600; }
.backtest-activity button { padding: 4px 10px; min-height: 36px; }
.session-notice { margin-bottom: 16px; }
/* The terms of use on the page to accept them (accept_terms.html) */
.terms-box { max-height: 40vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0 16px; margin: 16px 0; }
.terms-box h2 { font-size: 16px; }
.terms-accept { display: flex; gap: 10px; align-items: flex-start; margin: 16px 0; font-weight: 600; }
.terms-accept input { margin-top: 3px; flex-shrink: 0; }

/* Cookie banner (base.html): above the Claude button until the visitor chooses. */
.consent-banner { position: fixed; left: 20px; right: 20px; bottom: 20px; z-index: 50; max-width: 720px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px 20px; padding: 14px 18px; background: var(--surface-1);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-md); }
.consent-banner[hidden] { display: none; }
.consent-banner p { margin: 0; flex: 1; font-size: 14px; color: var(--text-secondary); }
.consent-actions { display: flex; gap: 8px; flex-shrink: 0; }
.consent-actions button.primary { width: auto; }
@media (max-width: 600px) {
  .consent-banner { left: 16px; right: 16px; bottom: 16px; flex-direction: column; align-items: stretch; }
  .consent-actions button { flex: 1; }
}
