/* Site chrome shared by both skins. Skin colours come from skins.css tokens;
   the --s-* aliases below map each skin's names onto one vocabulary. */

@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/plus-jakarta-sans-latin-wght-normal.7660bd9909fb.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght-normal.260c81a4759b.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-wght-normal.b058178d7f30.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

html[data-skin="explorer"] {
  --s-surface: var(--card);
  --s-surface-2: var(--card-2);
  --s-radius: 18px;
  --s-radius-sm: 12px;
  --s-num: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --s-gutter: 24px;
  --s-max: 1680px;
}
html[data-skin="terminal"] {
  --s-surface: var(--panel);
  --s-surface-2: var(--panel-2);
  --s-radius: 8px;
  --s-radius-sm: 6px;
  --s-num: var(--mono);
  --s-gutter: 14px;
  --s-max: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1 0 auto; }
img { max-width: 100%; height: auto; }

/* Only the header variant for the active skin is shown. */
html[data-skin="explorer"] [data-skin-only="terminal"],
html[data-skin="terminal"] [data-skin-only="explorer"] { display: none; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header layout additions (the rest comes from each skin). */
html[data-skin="explorer"] .fes-app .shell.shell-header { padding-bottom: 0; }
html[data-skin="explorer"] .fes-app .shell-header header.top { margin-bottom: 0; flex-wrap: wrap; }
html[data-skin="explorer"] .fes-app .shell.shell-app { padding-top: 20px; }
.site-header-terminal { position: sticky; top: 0; z-index: 30; }
html[data-skin="explorer"] .brand { text-decoration: none; color: inherit; }
html[data-skin="explorer"] .brand-name { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
html[data-skin="explorer"] .head-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
html[data-skin="terminal"] .logo { text-decoration: none; color: inherit; }
.view-switches { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
/* Links to the symbol pages and hubs, shown in both header variants. */
.site-nav { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
html[data-skin] .fes-app .site-nav a { padding: 6px 10px; border-radius: var(--s-radius-sm); color: var(--muted); font-size: 13px; font-weight: 700; text-decoration: none; white-space: nowrap; }
html[data-skin] .fes-app .site-nav a:hover { color: var(--ink); background: var(--s-surface-2); }
html[data-skin] .fes-app .site-nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }
html[data-skin="terminal"] .fes-app .site-nav a { padding: 5px 8px; font-family: var(--mono); font-size: 12px; font-weight: 600; }
/* ETF/Stock switch at the top of the tool's sidebar: full width, two equal halves. */
html[data-skin] .fes-app .asset-seg { display: flex; width: 100%; }
html[data-skin] .fes-app .asset-seg button { flex: 1; }
/* "Sign in" is the primary action (brand purple); "Sign out" keeps the quiet ghost style. */
html[data-skin] .fes-app .btn.js-account:not(.is-signed-in) { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
html[data-skin] .fes-app .btn.js-account:not(.is-signed-in):hover { background: var(--accent); color: var(--accent-ink); filter: brightness(1.08); }

/* Header menu. Wide screens: the controls sit inline and the wrappers vanish.
   Up to 900px: logo + menu icon button; the controls slide in from the right as a full-width panel
   (the GitHub/Stripe pattern), driven by site.js (aria-expanded, Escape, focus trap). */
.menu-toggle { display: none; }
.menu-row { display: contents; }
/* Links come first in the markup (menu order); inline they sit just before Sign in. */
.site-menu > .site-nav { order: 1; }
.site-menu > .js-account { order: 2; }
.menu-label { display: none; }
html[data-skin="terminal"] .fes-app .topbar-controls { display: flex; align-items: center; gap: 14px; }
@media (max-width: 900px) {
  html[data-skin] .fes-app .menu-toggle {
    display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; margin-left: auto; padding: 0;
    border: 1px solid var(--line); border-radius: var(--s-radius-sm); background: var(--s-surface); color: var(--ink);
    font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; touch-action: manipulation;
  }
  html[data-skin="terminal"] .fes-app .menu-toggle { width: 40px; height: 40px; }
  .menu-icon { position: relative; display: inline-block; width: 18px; height: 12px; }
  .menu-icon span { position: absolute; left: 0; width: 100%; height: 2px; border-radius: 2px; background: currentColor; transition: transform 160ms ease, opacity 160ms ease; }
  .menu-icon span:nth-child(1) { top: 0; }
  .menu-icon span:nth-child(2) { top: 5px; }
  .menu-icon span:nth-child(3) { top: 10px; }
  .menu-open .menu-icon span:nth-child(1) { transform: translateY(5px) rotate(45deg); }
  .menu-open .menu-icon span:nth-child(2) { opacity: 0; }
  .menu-open .menu-icon span:nth-child(3) { transform: translateY(-5px) rotate(-45deg); }
  html[data-skin="explorer"] .fes-app .shell-header header.top { flex-wrap: nowrap; }
  /* Room between the logo/menu button and the menu panel that opens under the header. */
  html[data-skin="explorer"] .fes-app .shell.shell-header { padding-bottom: 14px; }
  html[data-skin="explorer"] .fes-app .shell.shell-app { padding-top: 4px; }
  html[data-skin] .fes-app header .site-menu {
    position: fixed; left: 0; right: 0; bottom: 0; top: var(--menu-top, 64px); z-index: 60;
    display: flex; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 8px var(--s-gutter) 24px;
    background: var(--s-surface); border-top: 1px solid var(--line); overflow-y: auto; overscroll-behavior: contain;
    transform: translateX(100%); visibility: hidden;
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s linear 200ms;
  }
  html[data-skin] .fes-app .menu-open .site-menu {
    transform: none; visibility: visible;
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1), visibility 0s;
  }
  html[data-skin] .fes-app header .site-menu .site-nav { order: 0; flex-direction: column; align-items: stretch; gap: 0; margin: 0 0 8px; }
  html[data-skin] .fes-app header .site-menu .site-nav a {
    display: block; padding: 14px 4px; border-bottom: 1px solid var(--line); border-radius: 0; background: none;
    color: var(--ink); font-size: 18px; font-weight: 700;
  }
  html[data-skin] .fes-app header .site-menu .site-nav a[aria-current="page"] { color: var(--accent); }
  html[data-skin] .fes-app header .site-menu .menu-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; padding: 6px 4px;
    border-bottom: 1px solid var(--line);
  }
  html[data-skin] .fes-app header .site-menu .menu-label { display: inline; color: var(--muted); font-size: 14px; font-weight: 600; }
  html[data-skin] .fes-app header .site-menu .js-account { order: 0; justify-content: center; width: 100%; min-height: 48px; margin-top: 18px; }
  html.menu-locked, html.menu-locked body { overflow: hidden; }
}
.fes-app .btn { display: inline-flex; align-items: center; text-decoration: none; }

/* Page H1 + summary, server-rendered below the app for crawlers and readers. */
.insights .intro { margin-bottom: 36px; }
.insights .intro h1 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; letter-spacing: -0.01em; }

#app-root { position: relative; min-height: 640px; }
/* Draw the "i" as a mask so it sits on the true centre regardless of font metrics. */
.fes-app .info { font-size: 0 !important; }
.fes-app .info::before {
  content: "";
  display: block;
  transform: translateY(1px);
  width: 12px;
  height: 12px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='4.6' r='1.15'/%3E%3Crect x='7' y='6.8' width='2' height='5.4' rx='1'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='4.6' r='1.15'/%3E%3Crect x='7' y='6.8' width='2' height='5.4' rx='1'/%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
html[data-skin="terminal"] .fes-app .info::before { width: 11px; height: 11px; }
/* Slim, inset scrollbars so they don't get clipped by rounded corners. */
.fes-app .asset-list, .fes-app .table-wrap { scrollbar-gutter: stable; }
.fes-app ::-webkit-scrollbar { width: 10px; height: 10px; }
.fes-app ::-webkit-scrollbar-track { background: transparent; margin: 8px; }
.fes-app ::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 999px; background: var(--axis); background-clip: padding-box; }
.fes-app ::-webkit-scrollbar-thumb:hover { background-color: var(--faint); }
.fes-app ::-webkit-scrollbar-corner { background: transparent; }
@supports not selector(::-webkit-scrollbar) {
  .fes-app * { scrollbar-width: thin; scrollbar-color: var(--axis) transparent; }
}

/* Table pagination footer. */
.fes-app .table-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12.5px; }
.fes-app .table-pager:empty { display: none; }
.fes-app .pager-range { font-variant-numeric: tabular-nums; }
.fes-app .pager-pages { display: flex; align-items: center; gap: 2px; }
.fes-app .page-btn { min-width: 30px; height: 30px; padding: 0 8px; border: 0; border-radius: var(--s-radius-sm); background: none; color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; cursor: pointer; }
.fes-app .page-btn:hover:not(:disabled) { background: var(--s-surface-2); }
.fes-app .page-btn.current { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.fes-app .page-btn:disabled { color: var(--muted); opacity: 0.45; cursor: default; }
.fes-app .page-gap { padding: 0 4px; }
html[data-skin] .fes-app label.pager-size { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
html[data-skin] .fes-app .pager-size select { width: auto; height: 30px; }
html[data-skin="terminal"] .fes-app .table-pager { padding: 8px 12px; font-family: var(--mono); font-size: 11.5px; }
html[data-skin="terminal"] .fes-app .page-btn { min-width: 26px; height: 26px; }
html[data-skin="terminal"] .fes-app label.pager-size select { height: 26px; }

/* Symbols panel: header, search, top-N + Reset/Clear, list. */
.fes-app .picker-head .group-title, .fes-app .watch-head .section-title { margin: 0; }
.fes-app .picker-head, .fes-app .watch-head { margin-bottom: 10px; }
.fes-app .picker-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
html[data-skin] .fes-app label.top-label { display: inline-flex; align-items: center; gap: 8px; margin: 0; white-space: nowrap; }
html[data-skin] .fes-app select.top-select { width: auto; }
html[data-skin="explorer"] .fes-app select.top-select { height: 32px; border-radius: 10px; }
html[data-skin="terminal"] .fes-app select.top-select { height: 26px; }
.fes-app .picker-actions { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; }
.fes-app .link-btn { padding: 2px 0; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; }
.fes-app .link-btn:hover { text-decoration: underline; }
.fes-app .asset-more { display: block; width: 100%; padding: 12px; font-size: 13px; text-align: center; }
.notice { max-width: var(--s-max); margin: 12px auto; padding: 14px var(--s-gutter); color: var(--muted); }
.fes-app .chart-panel.is-loading #chartMount { opacity: 0.55; transition: opacity 150ms ease; }

/* Server-rendered insights: tables + FAQ. */
.site-container { width: 100%; max-width: var(--s-max); margin: 0 auto; padding: 0 var(--s-gutter); }
.insights { padding-top: 32px; padding-bottom: 24px; color: var(--ink); }
.insights section { margin-bottom: 36px; }
.insights h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.01em; }
.insights p { margin: 0 0 14px; max-width: 920px; color: var(--muted); line-height: 1.6; }
.insights .faq h3 { margin: 22px 0 6px; font-size: 16px; color: var(--ink); }
.insights .faq p { margin-bottom: 0; }
.table-note { font-size: 13px; }
.insights a, .prose a, .site-footer a { color: var(--accent); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--s-radius-sm); background: var(--s-surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.data-table th, .data-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
.data-table thead th { background: var(--s-surface-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table .num { text-align: right; font-family: var(--s-num); }
.data-table tbody th { font-weight: 500; color: var(--muted); max-width: 360px; overflow: hidden; text-overflow: ellipsis; }
.data-table .sym { font-weight: 700; color: var(--ink); margin-right: 6px; font-family: var(--s-num); }
.data-table .sym-name { font-size: 12.5px; }
.data-table abbr { text-decoration: none; cursor: help; }
.data-table .positive { color: var(--up); }
.data-table .negative { color: var(--down); }

/* Content pages. */
.content-wrap { padding-top: 24px; padding-bottom: 48px; }
.breadcrumb ol { display: flex; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.breadcrumb li + li::before { content: "/"; margin-right: 8px; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.prose { max-width: 760px; color: var(--ink); font-size: 16px; line-height: 1.7; }
.prose h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 8px; }
.prose h2 { font-size: 22px; line-height: 1.3; margin: 36px 0 10px; }
.prose h3 { font-size: 18px; margin: 26px 0 8px; }
.prose p, .prose ul, .prose ol { margin: 0 0 16px; }
.prose li { margin-bottom: 6px; }
.prose code { font-family: var(--s-num); font-size: 0.92em; background: var(--s-surface-2); padding: 1px 5px; border-radius: 4px; }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14.5px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--s-surface-2); }
.page-dates { color: var(--muted); font-size: 14px; margin-bottom: 28px !important; }

/* Symbol pages and hubs (/etf/, /stock/, /income-etfs/). */
.symbol-page { padding-top: 24px; padding-bottom: 48px; color: var(--ink); }
.symbol-head h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 6px; }
.symbol-name { margin: 0 0 14px; color: var(--muted); font-weight: 600; }
.symbol-page .lede { max-width: 860px; margin: 0 0 10px; font-size: 16.5px; line-height: 1.65; }
.symbol-page section { margin: 36px 0 0; }
.symbol-page h2 { margin: 0 0 8px; font-size: 20px; letter-spacing: -0.01em; }
.symbol-page h3 { margin: 20px 0 6px; font-size: 16px; }
.symbol-page section > p { max-width: 860px; margin: 0 0 14px; color: var(--muted); line-height: 1.6; }
.symbol-page a { color: var(--accent); }
.symbol-page .data-table { width: auto; min-width: 100%; }
.symbol-page .table-scroll { max-width: 100%; }
.symbol-page .table-note { margin-top: 10px; color: var(--muted); }
.per-year { color: var(--muted); font-size: 12px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 22px 0 0; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--s-radius-sm); background: var(--s-surface); min-width: 0; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-value { font-family: var(--s-num); font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-note { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.stat-value.positive, .chip-links .positive { color: var(--up); }
.stat-value.negative, .chip-links .negative { color: var(--down); }
.chip-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.chip-links a { display: inline-flex; gap: 8px; align-items: center; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--s-surface); color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; text-decoration: none; }
.chip-links a:hover { border-color: var(--accent); }
.chip-links .sym { font-weight: 700; font-family: var(--s-num); }
.symbol-notes ul { max-width: 860px; margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.6; }
.symbol-notes li { margin-bottom: 6px; }
.symbol-notes p { color: var(--muted); }
.data-table a.sym { text-decoration: underline dotted; text-decoration-color: var(--muted); text-underline-offset: 3px; }
.data-table a.sym:hover { color: var(--accent); text-decoration: underline; }
.insights .hub-links { margin-top: -4px; font-size: 14px; }

/* Compare chart on symbol pages; the chart itself is styled by skins.css (.fes-app). */
.symbol-page .symbol-chart { margin: 4px 0 12px; }
.symbol-chart .chart-head { align-items: center; }
.symbol-chart .compare-search { position: relative; flex: 1 1 240px; max-width: 360px; }
html[data-skin] .symbol-chart .fes-app #chartMount { min-height: 460px; }
.compare-options { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; min-width: 280px; max-height: 340px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: var(--card, var(--panel)); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg, var(--shadow)); }
.compare-options [role="option"] { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); font-size: 13px; cursor: pointer; }
.compare-options [role="option"][aria-selected="true"], .compare-options [role="option"]:hover { background: var(--field); }
.compare-options .sym { font-weight: 700; font-variant-numeric: tabular-nums; }
.compare-options .name { overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }
.compare-options .kind { color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.compare-none { padding: 10px; color: var(--muted); font-size: 13px; }
.compare-suggest { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.compare-suggest-label { color: var(--muted); font-size: 13px; font-weight: 600; }
.symbol-chart .fes-app .compare-chip { height: 30px; border: 1px solid var(--line); border-radius: 999px; background: var(--card, var(--panel)); color: var(--ink); padding: 0 12px; font-size: 12.5px; font-weight: 700; }
.symbol-chart .fes-app .compare-chip::before { content: "+ "; color: var(--muted); }
.symbol-chart .fes-app .compare-chip:hover { border-color: var(--accent); }
.symbol-chart .fes-app .compare-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.symbol-chart .fes-app .compare-chip.active::before { content: "✓ "; color: var(--accent); }
.symbol-chart .fes-app .compare-chip:disabled { opacity: 0.45; cursor: not-allowed; }
.symbol-chart .legend span.legend-item { cursor: default; }
@media (max-width: 700px) {
  .symbol-chart .compare-search { max-width: none; flex-basis: 100%; }
}

/* Footer. */
.site-footer { margin-top: 24px; border-top: 1px solid var(--line); background: var(--s-surface); color: var(--muted); font-size: 14px; }
.footer-grid { display: grid; grid-template-columns: minmax(0, 2fr) repeat(3, minmax(0, 1fr)); gap: 32px; padding-top: 32px; padding-bottom: 24px; }
.footer-name { color: var(--ink) !important; font-weight: 800; font-size: 17px; text-decoration: none; }
.footer-brand p { margin: 8px 0 0; max-width: 520px; line-height: 1.6; }
.footer-note { font-size: 13px; }
.footer-heading { margin: 0 0 10px; color: var(--ink); font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; }
.footer-nav ul { margin: 0; padding: 0; list-style: none; }
.footer-nav li { margin-bottom: 8px; }
.footer-nav a { color: var(--muted); text-decoration: none; display: inline-block; padding: 2px 0; }
.footer-nav a:hover { color: var(--accent); text-decoration: underline; }
.footer-bottom { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding-top: 14px; padding-bottom: 22px; border-top: 1px solid var(--line); font-size: 13px; }
.footer-bottom a { color: var(--muted); }

/* First-visit onboarding dialog. */
.onboarding {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--s-radius);
  background: var(--s-surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(10, 12, 24, 0.35);
  overflow: auto;
}
.onboarding::backdrop { background: rgba(10, 12, 24, 0.55); backdrop-filter: blur(3px); }
.onboarding-form { padding: 26px 26px 22px; }
.onboarding h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; outline: none; }
.onboarding-desc { margin: 6px 0 18px; color: var(--muted); }
.choice-group { margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.choice-group legend { padding: 0; margin-bottom: 10px; font-weight: 700; font-size: 14px; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.choice-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  height: 100%;
  padding: 14px;
  border: 2px solid var(--line);
  border-radius: var(--s-radius-sm);
  background: var(--s-surface-2);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.choice:hover .choice-body { border-color: var(--muted); }
.choice input:checked + .choice-body { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice input:focus-visible:not(:checked) + .choice-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; }
.choice-text { color: var(--muted); font-size: 13px; }
.choice-shot img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; border-radius: 6px; border: 1px solid var(--line); margin-bottom: 8px; background: var(--line); }
.badge { padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 700; }
.onboarding-actions { display: flex; justify-content: flex-end; }
.onboarding-submit {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--s-radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.onboarding-submit:hover { filter: brightness(1.08); }

/* Sign-up gate dialog (reuses the onboarding dialog frame). */
.gate { width: min(480px, calc(100vw - 32px)); }
.gate-body { position: relative; padding: 26px 26px 20px; }
.gate h2 { margin: 0; font-size: 22px; letter-spacing: -0.01em; outline: none; }
.gate .onboarding-desc[hidden] + .gate-perks { margin-top: 18px; }
.gate-perks { margin: 0 0 20px; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 14px; }
.gate-perks li { position: relative; padding-left: 26px; }
.gate-perks li::before { content: ""; position: absolute; left: 0; top: 2px; width: 16px; height: 16px; border-radius: 999px; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 8.3l2.2 2.2 4.8-5' fill='none' stroke='%237c74ff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 12px no-repeat; }
.gate-actions { display: grid; gap: 10px; }
.gate-actions form { margin: 0; }
.gate-foot { margin: 14px 0 0; color: var(--muted); font-size: 13.5px; text-align: center; }
.gate-foot a { color: var(--accent); font-weight: 600; }
.gate-close { display: block; margin: 10px auto 0; padding: 6px 10px; border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.gate-close:hover { color: var(--ink); text-decoration: underline; }
.fes-app .pager-unlock { margin-left: 8px; font-size: inherit; }

/* Buttons shared by the gate and the sign-in pages. */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--s-radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.auth-btn:hover { filter: brightness(1.08); }
.auth-btn-outline { background: transparent; border-color: var(--line); color: var(--ink); }
.auth-btn-outline:hover { background: var(--s-surface-2); filter: none; }
.auth-btn-google { background: #fff; border-color: #dadce0; color: #1f1f1f; }
.auth-btn-google:hover { background: #f8f9fa; filter: none; }
.g-icon { flex: none; }
/* Loading state (FES.setLoading): the label hides, a spinner takes its place. */
.auth-btn { position: relative; --spin: var(--accent-ink); }
.auth-btn-outline { --spin: var(--ink); }
.auth-btn-google { --spin: #1f1f1f; }
.auth-btn.is-loading { color: transparent !important; pointer-events: none; }
.auth-btn.is-loading > * { visibility: hidden; }
.auth-btn.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 18px;
  height: 18px;
  margin: auto;
  border: 2px solid var(--spin);
  border-right-color: transparent;
  border-radius: 999px;
  animation: auth-spin 700ms linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Sign-in pages (django-allauth templates in apps/accounts/templates). */
/* Centre the card in the space between header and footer. */
.page-auth main { display: flex; flex-direction: column; }
.auth-wrap { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; padding-top: 40px; padding-bottom: 56px; }
.auth-card { width: 100%; max-width: 440px; padding: 28px 26px; border: 1px solid var(--line); border-radius: var(--s-radius); background: var(--s-surface); color: var(--ink); font-size: 15px; line-height: 1.55; }
.auth-card h1 { margin: 0 0 6px; font-size: 24px; line-height: 1.25; letter-spacing: -0.02em; }
.auth-card h2 { margin: 22px 0 8px; font-size: 17px; }
.auth-card p { margin: 0 0 14px; }
.auth-card a { color: var(--accent); }
.auth-card a.auth-btn { color: var(--accent-ink); }
.auth-card a.auth-btn-outline { color: var(--ink); }
.auth-lede { color: var(--muted); }
.auth-small { color: var(--muted); font-size: 13.5px; }
.auth-google { margin: 18px 0 0; }
.auth-or { display: flex; align-items: center; gap: 12px; margin: 18px 0 !important; color: var(--muted); font-size: 13px; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-form { margin: 0 0 14px; }
.auth-form > div { display: flex; flex-direction: column; margin: 0 0 14px; }
.auth-form label { margin-bottom: 6px; font-weight: 600; font-size: 13.5px; }
.auth-form input[type="email"], .auth-form input[type="password"], .auth-form input[type="text"] {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--s-radius-sm);
  background: var(--s-surface-2);
  color: var(--ink);
  font: inherit;
}
.pw-wrap { position: relative; display: block; }
.auth-form .pw-wrap input { padding-right: 46px; }
.pw-toggle { position: absolute; top: 50%; right: 6px; display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; transform: translateY(-50%); }
.pw-toggle:hover { color: var(--ink); background: var(--line); }
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
/* as_div puts help text above the input; show it below. */
.auth-form .helptext { order: 3; margin-top: 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.auth-form .helptext ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; }
.auth-form .helptext li { position: relative; padding-left: 18px; transition: color 120ms ease; }
.auth-form .helptext li::before { content: ""; position: absolute; left: 3px; top: 0.5em; width: 7px; height: 7px; border-radius: 999px; background: var(--line); }
.auth-form .helptext li.is-ok { color: var(--up); }
.auth-form .helptext li.is-ok::before { left: 1px; top: 0.3em; width: 11px; height: 11px; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.auth-form .helptext li.is-bad { color: var(--down); }
.auth-form .helptext li.is-bad::before { background: currentColor; }
.auth-form .helptext a { font-size: 13px; }
.auth-form > div:has(> input[type="checkbox"]) { flex-direction: row-reverse; justify-content: flex-end; align-items: center; gap: 8px; }
.auth-form > div:has(> input[type="checkbox"]) label { margin: 0; font-weight: 500; }
.auth-form input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.errorlist { margin: 0 0 8px; padding: 10px 12px; list-style: none; border-radius: var(--s-radius-sm); background: var(--down-soft); color: var(--down); font-size: 13.5px; }
.auth-actions { display: grid; gap: 10px; }
.auth-card details { margin-top: 18px; }
.auth-card summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.auth-card table { width: 100%; border-collapse: collapse; margin-bottom: 14px; }
.auth-card th, .auth-card td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; }
.auth-card ul { padding-left: 18px; }
.auth-nav { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: -6px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  html[data-skin="explorer"] { --s-gutter: 16px; }
}
@media (max-width: 560px) {
  .choice-row { grid-template-columns: 1fr; }
  .choice-row-asset { grid-template-columns: 1fr 1fr; }
  .onboarding {
    width: calc(100vw - 24px);
    margin: max(16px, env(safe-area-inset-top)) auto max(16px, env(safe-area-inset-bottom));
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - max(16px, env(safe-area-inset-top)) - max(16px, env(safe-area-inset-bottom)));
  }
  .onboarding-form { padding: 24px 16px 0; }
  .onboarding-actions {
    position: sticky;
    bottom: 0;
    margin: 0 -16px;
    padding: 12px 16px 16px;
    background: var(--s-surface);
    border-top: 1px solid var(--line);
  }
  .onboarding-submit { width: 100%; }
  .gate { width: calc(100vw - 24px); }
  .gate-body { padding: 24px 16px 16px; }
  .auth-wrap { padding-top: 20px; }
  .auth-card { padding: 22px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media (prefers-reduced-motion: reduce) {
  .auth-btn.is-loading::after { animation-duration: 1.6s !important; }
}

/* Keep the 760px-minimum chart from widening the page on small screens. */
html[data-skin] .fes-app #chartMount { overflow-x: auto; }
html[data-skin] .fes-app .main { min-width: 0; }
@media (max-width: 1000px) {
  html[data-skin="explorer"] .fes-app .layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 960px) {
  html[data-skin="terminal"] .fes-app .app { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  html[data-skin="explorer"] .fes-app .seg { flex-wrap: wrap; max-width: 100%; border-radius: 16px; }
  /* Period picker: a compact 6 x 2 grid of square buttons in a softly rounded box. */
  html[data-skin="explorer"] .fes-app .seg[data-seg-for="timeframe"] { display: inline-grid; grid-template-columns: repeat(6, 40px); gap: 4px; padding: 5px; border-radius: 12px; }
  html[data-skin="explorer"] .fes-app .seg[data-seg-for="timeframe"] button { width: 40px; height: 40px; padding: 0; border-radius: 8px; }
  html[data-skin="terminal"] .fes-app .seg-scroll { max-width: 100%; }
  html[data-skin="terminal"] .fes-app .chart-controls { max-width: 100%; }
  html[data-skin="terminal"] .fes-app .panel-head { flex-wrap: wrap; }
}
