/* ==========================================================================
   MODERN LAYER: the finish over the base sheets. Rounded cards on a cool-grey ground, one lime
   accent that only marks "selected" and the brand, Manrope with tabular figures, data drawn as
   small graphics (sparklines, score meters, change chips). Loaded last, so it wins.
   No glow, no gradient text, no neon: depth is one soft structural shadow.
   ========================================================================== */

@font-face {
  font-family: "Manrope";
  src: url("/static/fonts/Manrope-Variable.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* --- Tokens ----------------------------------------------------------------------------- */
:root, [data-theme="light"] {
  --bg: #eef0ec;
  --bg-panel: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f3f5ef;
  --bg-card-subtle: #f5f6f2;
  --fg: #11151a;
  --fg-muted: #46515c;
  --fg-dim: #5c6772;
  --line: #dde1d8;
  --line-subtle: #e8ebe3;
  --line-strong: #b4bcae;

  --masthead: #0e1116;
  --masthead-fg: #f4f6f1;
  --masthead-dim: #aeb7b0;

  --brand: #c7f23d;
  --brand-ink: #0e1116;
  --brand-soft: #eaf8b9;

  --accent: #2457c5;
  --accent-hover: #1a43a0;
  --accent-text: #2457c5;
  --accent-subtle: #e6eefc;
  --accent-border: #b5c9f0;

  --buy: #0a8654;
  --buy-subtle: #e1f4ea;
  --buy-border: #a9dcc3;
  --sell: #cf2a45;
  --sell-subtle: #fce6ea;
  --sell-border: #f1b4bf;
  --mid: #94560a;
  --mid-subtle: #fcefd2;
  --mid-border: #ebcd91;
  --good: #0a8654;

  --table-header-bg: transparent;
  --table-hover: #f3f6ee;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-card: 0 1px 2px rgba(17, 21, 26, 0.05), 0 12px 30px -16px rgba(17, 21, 26, 0.2);
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0a0d11;
  --bg-panel: #141921;
  --bg-card: #141921;
  --bg-card-hover: #1b222c;
  --bg-card-subtle: #10151b;
  --fg: #eef1f4;
  --fg-muted: #b0bac4;
  --fg-dim: #8f9aa6;
  --line: #242c37;
  --line-subtle: #1c232d;
  --line-strong: #3b4553;

  --masthead: #06080b;
  --brand-soft: #2a3310;

  --accent: #8fb4ff;
  --accent-hover: #b6cdff;
  --accent-text: #8fb4ff;
  --accent-subtle: #17233b;
  --accent-border: #2f4a7d;

  --buy: #3ed598;
  --buy-subtle: #12291f;
  --buy-border: #25523c;
  --sell: #ff6b84;
  --sell-subtle: #341a22;
  --sell-border: #6b303d;
  --mid: #f0b44a;
  --mid-subtle: #30260f;
  --mid-border: #66511f;
  --good: #3ed598;

  --table-hover: #19202a;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.4), 0 14px 32px -16px rgba(0, 0, 0, 0.6);
}

body { font-feature-settings: "tnum" 1, "cv11" 1; letter-spacing: -0.005em; }
::selection { background: var(--brand); color: var(--brand-ink); }
h1, h2, .page-title, .panel-title { letter-spacing: -0.025em; }

/* --- Masthead ----------------------------------------------------------------------------- */
.topbar { height: 64px; padding: 0 28px; gap: 24px; }
.brand { align-items: center; gap: 12px; }
.brand-mark { display: block; flex: none; }
.brand-name { font-size: 18px; font-weight: 800; letter-spacing: -0.03em; }
.brand-sub { display: none; }
.topbar-nav { gap: 4px; align-items: center; align-self: center; }
.nav-link {
  height: 38px; padding: 0 16px; border-radius: 999px; border: 0; font-size: 14px; font-weight: 600;
  color: var(--masthead-dim); transition: background 0.18s ease, color 0.18s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.09); color: var(--masthead-fg); }
.nav-link.on { background: var(--brand); color: var(--brand-ink); border: 0; }
.nav-link.on:hover { background: var(--brand); color: var(--brand-ink); }
.nav-menu { align-items: center; }
.nav-menu-list {
  top: calc(100% + 10px); border: 1px solid var(--line); border-radius: 16px; padding: 8px;
  box-shadow: 0 18px 44px -12px rgba(8, 10, 14, 0.45);
}
.nav-menu-list a { border-radius: 10px; padding: 9px 12px; font-weight: 500; }
.nav-menu-list a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; }
[data-theme="dark"] .nav-menu-list a[aria-current="page"] { color: var(--brand); }
.nav-mega-head { color: var(--fg-dim); }
.ticker-search { height: 40px; border-radius: 999px; padding: 0 14px; background: rgba(255, 255, 255, 0.1); }
.ticker-search:focus-within { background: #fff; }
.theme-toggle-btn { width: 40px; height: 40px; border-radius: 999px; border-color: #3a424d; }

/* --- Trade tape --------------------------------------------------------------------------- */
.tape { height: 38px; background: #151a21; border-bottom: 0; }
.tape-label, .tape-pause { background: #151a21; color: #b9c2cc; border-color: #262d37; }
.tape-label { font-weight: 700; padding-left: 28px; }
.tape-pause:hover { color: #fff; }
.tape-item { color: #aeb7c1; border-right: 0; padding: 0 14px; }
.tape-item:hover { background: #1d242d; }
.tape-item b { color: #fff; }
.tape-buy .tape-arrow, .tape-buy .tape-val { color: #3ed598; }
.tape-sell .tape-arrow, .tape-sell .tape-val { color: #ff6b84; }
.tape-who { color: #7f8a96; }

/* --- Page frame --------------------------------------------------------------------------- */
.main-container, main { padding-top: 32px; }
.page-title { font-size: 34px; font-weight: 800; line-height: 1.1; margin-bottom: 8px; }
.lede { font-size: 15px; color: var(--fg-muted); }
.page-header { margin-bottom: 24px; }

/* --- Cards -------------------------------------------------------------------------------- */
.filters-card, form.filters {
  background: var(--bg-panel); border: 1px solid var(--line-subtle); border-radius: var(--radius-lg);
  padding: 16px 20px; box-shadow: var(--shadow-card);
}
.content-panel, .card-head.verdict + .kpi-strip { border-top: 0; }
.content-panel {
  background: var(--bg-panel); border: 1px solid var(--line-subtle); border-radius: var(--radius-lg);
  padding: 24px 28px; box-shadow: var(--shadow-card);
}
.card-head { border-bottom: 0; padding-bottom: 8px; }
.table-wrap {
  border: 1px solid var(--line-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
  background: var(--bg-panel);
}
.label-text, form.filters label:not(.check):not(.check-label) { font-size: 12.5px; font-weight: 700; color: var(--fg-dim); }
.filter-select, form.filters select {
  border-radius: 12px; border-color: var(--line); padding: 9px 32px 9px 12px; font-weight: 600; font-size: 13.5px;
  background: var(--bg-card-subtle);
}
.filter-select:hover { border-color: var(--line-strong); }
.filter-select:focus { border-color: var(--fg); background: var(--bg-panel); }
.checkbox-box { border-radius: 6px; }

/* --- Tables ------------------------------------------------------------------------------- */
.grid th {
  background: var(--bg-panel); border-bottom: 1px solid var(--line); padding: 14px 16px 12px;
  font-size: 12.5px; font-weight: 700; color: var(--fg-dim);
}
.grid td { padding: 14px 16px; border-bottom: 1px solid var(--line-subtle); font-size: 14px; }
.grid tbody tr { transition: background 0.15s ease; }
.grid tbody tr:hover { background: var(--table-hover); }
.table-row-clickable:hover .ticker-badge, .row-link:hover .ticker-badge { text-decoration: underline; }
.ticker-badge { color: var(--fg); font-weight: 800; font-size: 14px; letter-spacing: -0.01em; }
.ticker-badge:hover { color: var(--fg); }
.company-name, .sector-cell { color: var(--fg-muted); }
.lead-name { font-weight: 700; }
.role-badge { font-size: 12.5px; }

.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; flex: none;
  font-size: 13px; font-weight: 800; color: hsl(var(--h, 90) 38% 22%); background: hsl(var(--h, 90) 55% 88%);
}
[data-theme="dark"] .avatar { color: hsl(var(--h, 90) 70% 82%); background: hsl(var(--h, 90) 30% 20%); }
.company-cell, .sym-cell { gap: 12px; }
.sym-cell { display: inline-flex; align-items: center; }
.sym-cell a { font-weight: 800; color: var(--fg); }
.mkt-grid td.mkt-sym a { color: var(--fg); }

/* --- Score: number plus a meter ---------------------------------------------------------- */
.score-cell { display: grid; gap: 6px; width: 64px; }
.score-pill, .score {
  min-width: 44px; padding: 2px 10px; border-radius: 10px; font-size: 15px; font-weight: 800; border: 0;
  background: var(--bg-card-subtle); color: var(--fg-muted);
}
.score-pill[data-band="high"], .score[data-band="high"] { background: var(--buy-subtle); color: var(--buy); }
.score-pill[data-band="mid"], .score[data-band="mid"] { background: var(--mid-subtle); color: var(--mid); }
.meter { display: block; height: 4px; border-radius: 4px; background: var(--line-subtle); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--fg-dim); transform-origin: left; animation: grow 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.meter[data-band="high"] > i { background: var(--buy); }
.meter[data-band="mid"] > i { background: var(--mid); }

/* --- Chips -------------------------------------------------------------------------------- */
.tag { border-radius: 999px; padding: 1px 10px; font-weight: 700; border-color: transparent; background: var(--bg-card-subtle); }
.tag-warning { background: var(--mid-subtle); color: var(--mid); }
.tag-check { background: var(--sell-subtle); color: var(--sell); }
.tag-offering { background: var(--accent-subtle); color: var(--accent-text); }
.side { padding: 2px 10px; border-radius: 999px; font-weight: 800; }
.side-P { background: var(--buy-subtle); }
.side-S { background: var(--sell-subtle); }
.chip {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-weight: 700; font-size: 13px;
  font-variant-numeric: tabular-nums; background: var(--bg-card-subtle);
}
.chip.up { background: var(--buy-subtle); color: var(--buy); }
.chip.down { background: var(--sell-subtle); color: var(--sell); }
.mkt-grid td.up .chip { background: var(--buy-subtle); color: var(--buy); }
.mkt-grid td.down .chip { background: var(--sell-subtle); color: var(--sell); }
.mkt-badge { border-radius: 999px; padding: 2px 10px; font-weight: 800; background: var(--brand-soft); color: var(--brand-ink); border-color: transparent; }
[data-theme="dark"] .mkt-badge { color: var(--brand); }
.badge-count { font-weight: 700; color: var(--fg); }

/* --- KPI tiles ---------------------------------------------------------------------------- */
.kpi-strip, .stats-grid, .stats { gap: 14px; border: 0; margin-bottom: 22px; }
.kpi, .stat-card, .stats div {
  background: var(--bg-panel); border: 1px solid var(--line-subtle); border-radius: var(--radius-lg);
  padding: 18px 20px; box-shadow: var(--shadow-card); gap: 4px;
}
.kpi + .kpi { padding-left: 20px; border-left: 1px solid var(--line-subtle); }
.kpi-label, .stat-label { font-size: 13px; font-weight: 700; color: var(--fg-dim); }
.kpi-val, .stat-val { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-val.kpi-date { font-size: 16px; padding-top: 8px; }
.kpi-val.kpi-name { font-size: 18px; padding-top: 6px; }
.kpi-sub { font-size: 13px; }

/* --- Controls ----------------------------------------------------------------------------- */
.ranges, .mkt-tabs, .seg {
  display: inline-flex; gap: 2px; padding: 4px; border: 0; border-radius: 999px; background: var(--line-subtle); overflow: visible;
}
.range-btn, .ranges button, .mkt-tabs button, .mkt-tabs a, .seg-opt span {
  border: 0; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 700; color: var(--fg-muted);
  background: transparent; transition: background 0.18s ease, color 0.18s ease;
}
.ranges button:hover, .mkt-tabs button:hover, .mkt-tabs a:hover, .seg-opt:hover span { background: rgba(127, 135, 120, 0.16); color: var(--fg); }
.range-btn.on, .ranges button.on, .ranges button[aria-pressed="true"], .mkt-tabs button[aria-pressed="true"],
.mkt-tabs a[aria-current="page"], .seg-opt input:checked + span {
  background: var(--brand); color: var(--brand-ink); font-weight: 800;
}
.seg-opt + .seg-opt { border-left: 0; }
.mkt-refresh, .filters-toggle {
  border-radius: 999px; border: 1px solid var(--line); background: var(--bg-panel); padding: 8px 18px; font-weight: 700;
}
.mkt-refresh:hover:not(:disabled) { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.mkt-cta { background: var(--brand); color: var(--brand-ink); border-radius: 999px; padding: 9px 20px; font-weight: 800; }
.mkt-cta:hover { background: var(--brand); color: var(--brand-ink); filter: brightness(0.95); }
.install-panel { border-radius: var(--radius-lg); border: 1px solid var(--line-subtle); background: var(--bg-panel); box-shadow: var(--shadow-card); padding: 22px 26px; }
.pager-link { font-weight: 700; }

/* --- Cluster detail ----------------------------------------------------------------------- */
.ticker-badge-lg { font-size: 34px; font-weight: 800; letter-spacing: -0.035em; }
.company-heading, h1 { font-size: 30px; font-weight: 600; letter-spacing: -0.03em; }
.bigscore-card { border-radius: var(--radius-lg); border: 0; padding: 16px 22px; box-shadow: var(--shadow-card); background: var(--bg-panel); }
.bigscore-card[data-band="high"] { background: var(--buy-subtle); }
.bigscore-card[data-band="mid"] { background: var(--mid-subtle); }
.bigscore-val, .bigscore { font-size: 54px; font-weight: 800; letter-spacing: -0.04em; }
.score-split div { border-radius: 14px; border: 1px solid var(--line-subtle); box-shadow: var(--shadow-card); }
.score-split dd { font-size: 22px; font-weight: 800; }
.verdict-reason { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.factor-bar-bg { height: 10px; border-radius: 10px; background: var(--line-subtle); }
.factor-bar-fill { border-radius: 10px; background: var(--fg); animation: grow 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.factor-bar-fill.factor-low { background: var(--mid); }
.warning-callout { border-radius: 14px; }
.source-item { border-bottom-color: var(--line-subtle); }

/* --- Quote pages -------------------------------------------------------------------------- */
.q-head {
  background: var(--bg-panel); border: 1px solid var(--line-subtle); border-radius: var(--radius-lg); padding: 24px 28px;
  box-shadow: var(--shadow-card); margin-bottom: 18px;
}
.q-price { font-size: 46px; font-weight: 800; letter-spacing: -0.04em; }
.q-change { font-size: 18px; font-weight: 800; padding: 4px 12px; border-radius: 999px; background: var(--bg-card-subtle); margin-left: 8px; vertical-align: middle; }
#quote-page .q-change.up, #cluster-market .q-change.up { background: var(--buy-subtle); }
#quote-page .q-change.down, #cluster-market .q-change.down { background: var(--sell-subtle); }
.q-tabs { border-bottom: 0; gap: 4px; margin: 0 0 20px; padding: 4px; background: var(--line-subtle); border-radius: 999px; width: fit-content; max-width: 100%; }
.q-tabs a { border: 0; margin: 0; border-radius: 999px; padding: 8px 16px; font-weight: 700; color: var(--fg-muted); }
.q-tabs a:hover { background: rgba(127, 135, 120, 0.16); color: var(--fg); }
.q-tabs a[aria-current="page"] { background: var(--brand); color: var(--brand-ink); font-weight: 800; }
.q-chart-panel, .q-stats, .q-perf, .q-insider, .q-about, .q-body > .q-section, .q-stat-groups .q-section, .q-toolbar + div > .q-section {
  background: var(--bg-panel); border: 1px solid var(--line-subtle); border-radius: var(--radius-lg); box-shadow: var(--shadow-card);
}
.q-chart-panel { padding: 18px 20px 12px; margin-bottom: 18px; }
.q-stats, .q-perf, .q-insider, .q-about { padding: 8px 24px 18px; margin-bottom: 18px; }
.q-perf .q-section, .q-insider .q-section, .q-about .q-section { margin: 0; padding: 16px 0 0; border: 0; box-shadow: none; background: none; }
.q-body > .q-section, .q-stat-groups .q-section { padding: 18px 24px 14px; margin-bottom: 18px; }
.q-stats-grid { border-top: 0; padding-top: 12px; }
.q-h2 { border-top: 0; padding-top: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 10px; }
.q-pairs > div { padding: 10px 0; }
.q-pairs dd { font-weight: 700; }
.q-range-move { font-weight: 800; }
.q-legend { color: var(--fg-dim); }
.market-panel .q-stats { box-shadow: none; border-color: var(--line-subtle); }

/* --- Market overview strip ---------------------------------------------------------------- */
.overview { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 0 0 24px; }
.overview[hidden] { display: none; }
.ov-card {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: end; padding: 14px 16px;
  background: var(--bg-panel); border: 1px solid var(--line-subtle); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card); color: var(--fg); text-decoration: none; transition: transform 0.2s ease;
}
.ov-card:hover { transform: translateY(-2px); text-decoration: none; color: var(--fg); }
.ov-name { font-size: 13px; font-weight: 700; color: var(--fg-dim); grid-column: 1 / -1; }
.ov-price { font-size: 20px; font-weight: 800; letter-spacing: -0.03em; }
.ov-move { font-size: 13px; font-weight: 800; padding: 1px 9px; border-radius: 999px; justify-self: start; background: var(--bg-card-subtle); }
.ov-move.up { background: var(--buy-subtle); color: var(--buy); }
.ov-move.down { background: var(--sell-subtle); color: var(--sell); }
.ov-spark { grid-column: 2; grid-row: 2 / span 2; width: 74px; height: 30px; }
.ov-spark path { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; stroke: var(--fg-dim); }
.ov-spark.up path { stroke: var(--buy); }
.ov-spark.down path { stroke: var(--sell); }

/* --- Row sparklines in tables ------------------------------------------------------------- */
.row-spark { width: 92px; height: 30px; display: block; }
.row-spark path { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; stroke: var(--fg-dim); }
.row-spark.up path { stroke: var(--buy); }
.row-spark.down path { stroke: var(--sell); }

/* --- Footer ------------------------------------------------------------------------------- */
.app-footer { background: var(--masthead); border-top: 0; color: var(--masthead-dim); margin-top: 56px; }
.footer-content, .footer-badge { color: var(--masthead-dim); }

/* --- Motion: one entrance per page load, then state changes only ------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes results-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.kpi, .stat-card, .overview .ov-card, .filters-card, .table-wrap, .content-panel, .q-head, .q-chart-panel {
  animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.kpi:nth-child(2), .ov-card:nth-child(2) { animation-delay: 0.05s; }
.kpi:nth-child(3), .ov-card:nth-child(3) { animation-delay: 0.1s; }
.kpi:nth-child(4), .ov-card:nth-child(4) { animation-delay: 0.15s; }
.ov-card:nth-child(5) { animation-delay: 0.2s; }
.ov-card:nth-child(6) { animation-delay: 0.25s; }
.table-wrap { animation-delay: 0.12s; }
#results > * { animation-name: results-in; animation-duration: 0.2s; }
@media (prefers-reduced-motion: reduce) {
  .kpi, .stat-card, .ov-card, .filters-card, .table-wrap, .content-panel, .q-head, .q-chart-panel, .meter > i, .factor-bar-fill { animation: none; }
  .ov-card { transition: none; }
}

@media (max-width: 860px) {
  .topbar { height: auto; padding: 10px 16px 6px; }
  .nav-link { height: 36px; }
  .page-title { font-size: 28px; }
  .q-price { font-size: 38px; }
  .q-head, .content-panel { padding: 18px; }
}
@media (max-width: 720px) {
  #results .grid tbody tr { border-radius: 16px; box-shadow: var(--shadow-card); border-color: var(--line-subtle); padding: 8px 16px; }
  .kpi, .kpi + .kpi, .kpi:nth-child(even) { padding: 14px 16px; border-left: 1px solid var(--line-subtle); }
  .kpi-val { font-size: 24px; }
  .q-tabs { border-radius: 18px; }
}

/* Fit ten columns in the content width without a sideways scroll at 1440 */
.grid th, .grid td { padding-left: 12px; padding-right: 12px; }
.grid th:first-child, .grid td:first-child { padding-left: 20px; }
.grid th:last-child, .grid td:last-child { padding-right: 20px; }
.company-name { max-width: 150px; }
.insider-cell { gap: 6px; }
.lead-name { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.row-spark { width: 84px; }

/* Lists: keep the Today sparkline inside the card */
.mkt-grid th, .mkt-grid td { padding-left: 10px; padding-right: 10px; }
.mkt-grid th:first-child, .mkt-grid td:first-child { padding-left: 20px; }
.mkt-grid th:last-child, .mkt-grid td:last-child { padding-right: 20px; }
.mkt-grid td:nth-child(2) { max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.mkt-grid .row-spark { width: 72px; }

/* Phones: the overview becomes one swipeable row instead of six stacked cards */
@media (max-width: 720px) {
  .overview { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 12px; padding: 2px 2px 14px; margin-right: -16px; }
  .overview[hidden] { display: none; }
  .ov-card { flex: 0 0 188px; scroll-snap-align: start; }
}

/* --- Audit fixes -------------------------------------------------------------------------- */
/* The dot belongs between a name and a role, not in a column of its own. */
.role-badge::before { content: none; }
.lead-name + .role-badge::before { content: "\00b7  "; color: var(--fg-dim); }
/* Ten columns fit the card at 1440 */
.sector-cell { display: inline-block; max-width: 128px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
.company-name { max-width: 120px; }
.lead-name { max-width: 150px; }
.row-spark { width: 72px; }
.grid th, .grid td { padding-left: 10px; padding-right: 10px; }
/* A table inside a card is not a second card */
.q-section .table-wrap { border: 0; box-shadow: none; border-radius: 0; background: none; margin: 0 -24px; }
.q-section .grid th { background: transparent; }
.q-section .table-wrap .grid th:first-child, .q-section .table-wrap .grid td:first-child { padding-left: 24px; }
.q-section .table-wrap .grid th:last-child, .q-section .table-wrap .grid td:last-child { padding-right: 24px; }
.q-perf .table-wrap { margin: 0 -24px; }
.q-insider:empty, .q-about:empty, .q-perf:empty { display: none; }
/* Range buttons scroll instead of running off a phone */
.q-chart-bar { min-width: 0; }
.q-chart-bar .ranges { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.q-chart-bar .ranges::-webkit-scrollbar { display: none; }
.q-chart-bar .ranges button { flex: none; }
.mkt-grid tbody tr:has(a:not(.mkt-badge)) { cursor: pointer; }
@media (prefers-reduced-motion: reduce) { #results > * { animation: none; } }

/* --- Error page --------------------------------------------------------------------------- */
.error-page { max-width: 640px; padding: 48px 0 24px; }
.error-status { margin: 0 0 6px; font-size: 64px; font-weight: 800; letter-spacing: -0.05em; line-height: 1; color: var(--line-strong); }
.error-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.mkt-cta.mkt-cta-quiet { background: var(--bg-panel); color: var(--fg); border: 1px solid var(--line); font-weight: 700; }
.mkt-cta.mkt-cta-quiet:hover { background: var(--bg-card-hover); color: var(--fg); filter: none; }

.q-change:empty { display: none; }
.q-quote[hidden] { display: none; }

/* Freshness banner and footer links */
.stale-banner { margin: 12px 28px 0; }
.stale-banner .tag { flex: none; white-space: nowrap; }
.footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-links a { color: var(--masthead-dim); text-decoration: underline; }
.footer-links a:hover { color: var(--masthead-fg); }
@media (max-width: 720px) { .stale-banner { margin: 10px 14px 0; } }

/* Account forms */
.form-card { display: grid; gap: 12px; max-width: 420px; margin: 4px 0 24px; justify-items: start; }
.form-label { font-weight: 700; font-size: 13.5px; }
.text-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg-panel); color: inherit; font: inherit;
}
.text-input:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.form-note { font-size: 12.5px; color: var(--fg-muted); margin: 0; }
.account-link { white-space: nowrap; }

/* Watchlist */
.watch-form { display: inline-flex; margin: 0; }
.watch-entries { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 8px; }
.watch-entries li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.watch-entries form { margin: 0 0 0 auto; }
.link-button { background: none; border: 0; padding: 0; color: var(--fg-muted); text-decoration: underline; cursor: pointer; font: inherit; }
.link-button:hover { color: inherit; }
.watch-add { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.export-row { margin: -6px 0 14px; text-align: right; }
.export-note { margin-left: 6px; font-size: 12px; color: var(--fg-muted); }

/* Outcomes */
.insider-record { display: block; font-size: 12.5px; color: var(--fg-muted); text-decoration: underline; margin-top: 2px; }
.insider-record:hover { color: inherit; }
.outcome-line { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; margin: 0 0 14px; }
.outcome-item { white-space: nowrap; }
