:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #14171c;
  --muted: #5d6673;
  --accent: #2456d6;
  --accent-soft: #e6edfc;
  --up: #0f8a4b;
  --up-soft: #e3f4ea;
  --down: #c8313b;
  --down-soft: #fbe7e8;
  --warn: #9a6400;
  --ind-a: #c26a00;
  --ind-b: #7c3aed;
  --ind-c: #0e7490;
  --ind-band: #5b7cc4;
  --cmp-1: #d6336c;
  --cmp-2: #2456d6;
  --cmp-3: #0e7490;
  --cmp-4: #b45309;
  --cmp-5: #7c3aed;
  --cmp-6: #5f6b7a;
  --cmp-7: #9c6644;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1116;
    --surface: #161a21;
    --surface-2: #1d222b;
    --border: #2a303b;
    --text: #e8ebf0;
    --muted: #98a2b3;
    --accent: #7ea2ff;
    --accent-soft: #1c2742;
    --up: #45c27c;
    --up-soft: #15291f;
    --down: #ff6b74;
    --down-soft: #331a1d;
    --warn: #e0b04f;
    --ind-a: #f5a524;
    --ind-b: #b197fc;
    --ind-c: #3fc6dd;
    --ind-band: #8ea8e8;
    --cmp-1: #f06595;
    --cmp-2: #7ea2ff;
    --cmp-3: #3fc6dd;
    --cmp-4: #f5a524;
    --cmp-5: #b197fc;
    --cmp-6: #aab4c3;
    --cmp-7: #d4a373;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.num { font-family: "JetBrains Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 13px; }

.top { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.logo { color: var(--accent); }
.updated { color: var(--muted); font-size: 13px; text-align: right; }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; vertical-align: 1px; }
.live-dot.on { background: var(--up); box-shadow: 0 0 0 0 var(--up); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--up) 60%, transparent); } 70%, 100% { box-shadow: 0 0 0 6px transparent; } }
@media (prefers-reduced-motion: reduce) { .live-dot.on { animation: none; } }

.hero { padding: 36px 0 20px; }
.hero h1 { font-size: clamp(26px, 4vw, 36px); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.02em; }
.hero p { margin: 0; color: var(--muted); max-width: 640px; }

.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 16px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 7px 14px; font: inherit; font-size: 14px; cursor: pointer;
}
.tab:hover { border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.summary { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: center; padding: 18px 20px; }
.summary h2 { margin: 0; font-size: 20px; }
.summary .region { color: var(--muted); font-size: 13px; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-weight: 600; }
.summary .spark { margin-left: auto; }

.table-wrap { overflow-x: auto; margin-top: 12px; }
.subhead { margin: 28px 0 0; }
.subhead h3 { margin: 0 0 2px; font-size: 18px; }
.subhead p { margin: 0; color: var(--muted); font-size: 14px; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 11px 9px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); }
th:first-child, td:first-child, th:nth-child(2), td:nth-child(2) { text-align: left; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
.rank { color: var(--muted); width: 36px; }
.co { display: flex; flex-direction: column; max-width: 240px; }
.co .nm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.co .tk { color: var(--muted); font-size: 12px; }
.up { color: var(--up); }
.down { color: var(--down); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.buy { background: var(--up-soft); color: var(--up); }
.pill.sell { background: var(--down-soft); color: var(--down); }
.score { display: inline-flex; align-items: center; gap: 8px; }
.bar { width: 48px; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }

section { margin-bottom: 40px; }
.section-head h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.section-head p { margin: 0 0 16px; color: var(--muted); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.card { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.card .nm { font-weight: 600; }
.card .tk { color: var(--muted); font-size: 12px; }
.card ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.card .meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }

.watch { display: grid; gap: 8px; }
.watch-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr) auto; gap: 12px; align-items: center; padding: 12px 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.tag.earn { background: var(--surface-2); color: var(--warn); }

.method ul { padding-left: 18px; color: var(--muted); }
.disclaimer { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); color: var(--muted); font-size: 14px; }
.foot { color: var(--muted); font-size: 13px; padding-bottom: 32px; }
.empty { padding: 20px; color: var(--muted); }

@media (max-width: 640px) {
  .summary .spark { margin-left: 0; }
  .watch-row { grid-template-columns: 1fr; gap: 6px; }
  .updated { font-size: 12px; }
}


/* top menu */
.brand { color: inherit; text-decoration: none; }
.menu { display: flex; gap: 4px; margin-right: auto; margin-left: 20px; }
.menu a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 8px; }
.menu a:hover { color: var(--text); background: var(--surface-2); }
.menu a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

/* news page */
.news-head { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 14px; flex-wrap: wrap; }
.news-head h2 { margin: 0; font-size: 22px; }
.news-head .region { color: var(--muted); font-size: 14px; }
.story { display: flex; gap: 16px; padding: 16px; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.story:hover { border-color: var(--accent); transform: translateY(-1px); }
.story img { width: 132px; height: 88px; object-fit: cover; border-radius: 8px; flex: none; background: var(--surface-2); }
.story-body { min-width: 0; }
.story h3 { margin: 6px 0 4px; font-size: 16px; line-height: 1.35; }
.story p { margin: 0; color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.story-meta { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.story-meta span:first-child { font-weight: 600; color: var(--text); }
.story.lead { margin-bottom: 12px; }
.story.lead img { width: 280px; height: 170px; }
.story.lead h3 { font-size: 22px; }
.story.lead p { -webkit-line-clamp: 3; }
.story-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 12px; }
.news + .disclaimer { margin-bottom: 32px; }
@media (max-width: 640px) {
  .menu { margin-left: 8px; }
  .menu a { padding: 6px 8px; font-size: 13px; }
  .top-inner .updated { display: none; }
  .story, .story.lead { flex-direction: column; }
  .story img, .story.lead img { width: 100%; height: 160px; }
  .story-grid { grid-template-columns: 1fr; }
}

.muted { color: var(--muted); }

/* stock lookup page */
.lookup { position: relative; max-width: 640px; margin-bottom: 16px; }
.lookup input { width: 100%; font: inherit; font-size: 16px; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.lookup input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 4; list-style: none; margin: 0; padding: 6px; }
.results li { display: flex; flex-direction: column; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.results li[aria-selected="true"], .results li:hover { background: var(--surface-2); }
.results .nm { font-weight: 600; }
.results .tk { color: var(--muted); font-size: 12px; }
.quote { padding: 18px 20px; margin-bottom: 24px; }
.quote-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.quote-head h2 { margin: 0; font-size: 22px; }
.quote-head .region { color: var(--muted); font-size: 13px; }
.quote-price { text-align: right; }
.quote-price .big { font-size: 26px; font-weight: 600; }
.quote-price .tk { color: var(--muted); font-size: 12px; }
.quote-price .after-hours { margin-top: 4px; font-size: 13px; }
.ranges { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0 8px; }
.ranges .tab { padding: 5px 12px; font-size: 13px; }
.chart { position: relative; touch-action: pan-y; }
.chart svg { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .base { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .axis { fill: var(--muted); font: 11px "JetBrains Mono", ui-monospace, monospace; }
.tip { position: absolute; pointer-events: none; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; box-shadow: 0 4px 12px rgba(0,0,0,.12); font-size: 13px; white-space: nowrap; }
.tip .tk { color: var(--muted); font-size: 12px; }
/* technical indicators */
.ind-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
.ind-group { color: var(--muted); font-size: 12px; font-weight: 600; margin: 0 2px 0 4px; }
.ind-group:first-child { margin-left: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.sw { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--c); }
.sw.dash { border-top-style: dashed; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); min-height: 18px; margin-bottom: 2px; }
.legend[hidden] { display: none; }
.leg { display: inline-flex; align-items: center; gap: 6px; }
.leg b { color: var(--text); font-weight: 500; font-size: 12px; }
.chart .ind { fill: none; stroke: var(--c); stroke-width: 1.5; stroke-linejoin: round; }
.chart .ind.cmp { stroke-width: 1.75; }
.chart .ind.dash { stroke-dasharray: 5 3; }
.chart .ind.bb { --c: var(--ind-band); stroke-width: 1; }
.chart .ind.bb.mid { stroke-dasharray: 2 3; }
.chart .bb-fill { fill: var(--ind-band); fill-opacity: .08; }
.chart .vbar.up { fill: var(--up); fill-opacity: .45; }
.chart .vbar.down { fill: var(--down); fill-opacity: .45; }
.chart .rsi-zone { fill: var(--ind-b); fill-opacity: .07; }
.chart.drawing { touch-action: none; cursor: crosshair; }
.chart.drawing .tip { display: none; }
.chart.erasing { cursor: default; }
.chart.erasing .dr { cursor: pointer; }
.chart.erasing .dr:hover { opacity: .45; }
.chart .dr { --c: var(--accent); }
.chart .dr.hi { --c: var(--up); }
.chart .dr.lo { --c: var(--down); }
.chart .dl { stroke: var(--c); stroke-width: 1.5; }
.chart .dr.hi .dl, .chart .dr.lo .dl { stroke-dasharray: 6 4; }
.chart .hit { stroke: transparent; stroke-width: 12; }
.chart:not(.erasing) .dr { pointer-events: none; }
.chart .dot { fill: var(--c); }
.chart .dz { fill: var(--c); fill-opacity: .12; stroke: var(--c); stroke-width: 1; }
.chart .dtag-bg { fill: var(--surface); stroke: var(--c); stroke-width: 1; }
.chart .dtag { fill: var(--c); font: 11px "JetBrains Mono", ui-monospace, monospace; }
.chart .dtag.note { fill: var(--text); font-family: Inter, system-ui, sans-serif; }
.draw-note { position: absolute; width: 190px; padding: 4px 8px; font: 13px Inter, system-ui, sans-serif; border: 1px solid var(--accent); border-radius: 6px; background: var(--surface); color: var(--text); }
.chip:disabled { opacity: .45; cursor: default; }
.chart .plabel { fill: var(--muted); font: 11px "JetBrains Mono", ui-monospace, monospace; white-space: pre; }
.ind-note { color: var(--muted); font-size: 12px; margin-top: 4px; }
.explain { padding: 0; margin: -8px 0 24px; }
.explain summary { cursor: pointer; padding: 14px 20px; font-weight: 600; list-style-position: inside; }
.explain summary:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: var(--radius); }
.explain[open] summary { border-bottom: 1px solid var(--border); }
.explain-intro { margin: 14px 20px 0; color: var(--muted); font-size: 14px; max-width: 760px; }
.explain-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 14px 20px 20px; }
.explain-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface-2); }
.explain-card.on { border-color: var(--accent); background: var(--accent-soft); }
.explain-card h3 { margin: 0 0 6px; font-size: 15px; }
.explain-card p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; }
.explain-card p:last-child { margin-bottom: 0; }
@media (max-width: 640px) {
  .explain summary { padding: 12px 14px; }
  .explain-intro { margin: 12px 14px 0; }
  .explain-grid { grid-template-columns: 1fr; padding: 12px 14px 14px; }
}
.quote-stats { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); gap: 10px 28px; }
.co .nm a, a.co-link { color: inherit; text-decoration: none; }
.co .nm a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 640px) {
  .quote { padding: 14px; }
  .quote-price { text-align: left; }
  .menu a { padding: 6px 6px; font-size: 12px; }
  .brand { font-size: 15px; }
}
.card .nm a, .watch-row .nm a { color: inherit; text-decoration: none; } .card .nm a:hover, .watch-row .nm a:hover { color: var(--accent); text-decoration: underline; }
@media (max-width: 480px) {
  .brand-text { display: none; }
  .menu { margin-left: 4px; }
  .menu a { white-space: nowrap; }
}

/* snapshot strip */
.snap { margin-bottom: 24px; }
.markets, .snap-row { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 2px 2px 6px; }
.markets::-webkit-scrollbar, .snap-row::-webkit-scrollbar { display: none; }
.mkt { flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 128px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.mkt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.mkt-name { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.snap-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 10px; }
.snap-head h2 { margin: 0; font-size: 20px; }
.seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button { border: 0; background: none; color: var(--muted); font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.snapcard { flex: none; scroll-snap-align: start; width: 168px; padding: 12px; display: flex; flex-direction: column; gap: 4px; color: inherit; text-decoration: none; }
.snapcard:hover { border-color: var(--accent); }
.snapcard .tk { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snapcard .nm { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snap-chg { font-size: 22px; font-weight: 600; }
.snap-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; color: var(--muted); }
.snap-foot .num { font-size: 12px; }

/* phones: show only the key columns so tables fit without sideways scrolling */
@media (max-width: 640px) {
  .hero { padding: 20px 0 12px; }
  .hero h1 { font-size: 24px; }
  .hero p { font-size: 14px; }
  table.ranked, table.largest { min-width: 0; table-layout: fixed; }
  table.ranked :is(th, td):not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(6)),
  table.largest :is(th, td):not(:nth-child(1)):not(:nth-child(2)):not(:nth-child(3)):not(:nth-child(5)) { display: none; }
  table.ranked th:nth-child(1), table.largest th:nth-child(1) { width: 34px; }
  table.ranked th:nth-child(3) { width: 92px; } table.ranked th:nth-child(6) { width: 66px; }
  table.largest th:nth-child(3) { width: 96px; } table.largest th:nth-child(5) { width: 66px; }
  table.largest .bar { display: none; }
  th, td { padding: 10px 8px; }
  .co { max-width: none; min-width: 0; }
  .co .nm, .co .tk { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .summary { padding: 14px; gap: 10px 20px; }
  .summary .spark { display: none; }
  .table-wrap { overflow-x: hidden; }
}

/* ---- shared header: brand, quick search, status, then the page menu */
.top-inner { height: 56px; }
.jump { flex: 1; max-width: 360px; margin: 0 0 0 12px; }
.jump input { padding: 7px 12px; font-size: 14px; border-radius: 999px; box-shadow: none; background: var(--surface-2); }
.jump .results { min-width: 280px; }
.top .menu { display: flex; gap: 2px; margin: 0 auto; padding-top: 0; padding-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.top .menu::-webkit-scrollbar { display: none; }
.top .menu a { flex: none; white-space: nowrap; }
@media (max-width: 640px) {
  .jump { max-width: none; margin-left: 4px; }
  .top .menu a { padding: 6px 10px; font-size: 13px; }
  .top-inner .updated { display: none; }
}

/* buttons and inputs used by the tool pages */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 12px; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger:hover { border-color: var(--down); color: var(--down); }
.btn:disabled { opacity: .5; cursor: default; }
.btn:focus-visible, .field:focus-visible, .sort:focus-visible, .star:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field { font: inherit; font-size: 14px; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); min-width: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .lookup { flex: 1 1 260px; max-width: 420px; margin: 0; }
.toolbar .lookup input { font-size: 14px; padding: 8px 12px; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 13px; }

/* watchlist star */
.star { border: 0; background: none; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 4px; cursor: pointer; border-radius: 6px; }
.star[aria-pressed="true"] { color: #e3a008; }
.star:hover { background: var(--surface-2); }
.star span { font-size: 13px; margin-left: 4px; color: var(--text); }

/* generic sortable table */
.grid-table th { padding: 0; }
.grid-table th:not([aria-sort]) { padding: 11px 9px; }
.grid-table .sort { all: unset; display: block; box-sizing: border-box; width: 100%; padding: 11px 9px; cursor: pointer; text-align: inherit; }
.grid-table .sort i { font-style: normal; margin-left: 3px; font-size: 9px; }
.grid-table .sort:hover { color: var(--text); }
.grid-table th.left, .grid-table td.left { text-align: left; }
.grid-table td:first-child, .grid-table th:first-child { text-align: left; }
.grid-table td:nth-child(2), .grid-table th:nth-child(2) { text-align: right; }
.grid-table td.left, .grid-table th.left { text-align: left; }
.range52 { display: inline-flex; align-items: center; gap: 6px; }
.range52 .track { position: relative; width: 70px; height: 4px; border-radius: 2px; background: var(--surface-2); }
.range52 .track i { position: absolute; top: -3px; width: 2px; height: 10px; background: var(--accent); border-radius: 1px; }

/* watchlists page */
.list-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 12px; }
.list-tabs .tab .count { color: inherit; opacity: .7; margin-left: 4px; font-size: 12px; }
.wl-summary { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 14px 18px; margin-bottom: 12px; }
.x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 16px; padding: 2px 6px; border-radius: 6px; }
.x:hover { color: var(--down); background: var(--down-soft); }
.wl-table .co { max-width: 220px; }
.co-row { display: flex; align-items: center; gap: 2px; min-width: 0; }
.co-row .star { margin-left: -6px; flex: none; }
.card-tags { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.quote-head h2 .star { font-size: 16px; vertical-align: 2px; border: 1px solid var(--border); padding: 3px 8px; border-radius: 999px; }
@media (max-width: 640px) {
  .grid-table { min-width: 0; }
  .grid-table .hide-sm, #trend-wrap { display: none; }
  .grid-table .co { max-width: 46vw; }
  .table-wrap:has(.grid-table) { overflow-x: auto; }
}
@media (max-width: 640px) {
  .grid-table :is(th, td) { padding-left: 6px; padding-right: 6px; }
  .grid-table .sort { padding: 10px 6px; }
  .grid-table .co { max-width: 40vw; }
}

/* market movers */
.breadth { padding: 14px 18px; margin-bottom: 16px; }
.breadth-bar { height: 8px; border-radius: 4px; background: var(--down); overflow: hidden; margin-bottom: 12px; opacity: .85; }
.breadth-bar .up-part { display: block; height: 100%; background: var(--up); }
.toolbar .seg { overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.toolbar .seg button { flex: none; white-space: nowrap; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; }

/* stock screener */
.presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.presets .chip { font-size: 13px; padding: 5px 12px; }
.screen { padding: 14px 16px 4px; margin-bottom: 16px; }
.screen-head { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.screen-head label { display: inline-flex; gap: 6px; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 8px 16px; }
.filter { display: grid; grid-template-columns: minmax(110px, 1.3fr) minmax(60px, 1fr) auto minmax(60px, 1fr) 26px 26px; gap: 6px; align-items: center; }
.filter .field { width: 100%; padding: 6px 8px; }
.f-name { font-size: 14px; font-weight: 500; }
.f-help { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 10px; font-style: normal; cursor: help; vertical-align: 1px; }
.f-unit { font-size: 12px; }
.screen-tools { margin: 12px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); background: none !important; padding-left: 0 !important; padding-right: 0 !important; }
.screen .hint { margin: 0; }
.more { display: flex; justify-content: center; margin: 12px 0 24px; }
@media (max-width: 640px) {
  .filters { grid-template-columns: 1fr; }
  .screen-tools .field, .screen-tools .btn { flex: 1 1 auto; }
}

/* market heatmap */
:root { --heat-up: #10a35a; --heat-down: #d6343f; --heat-flat: #3b4250; }
.heat-wrap { padding: 6px; margin-bottom: 8px; }
.heat { position: relative; width: 100%; overflow: hidden; border-radius: 8px; background: var(--heat-flat); }
.heat-sec { position: absolute; box-sizing: border-box; border: 1px solid var(--surface); }
.heat-sec-name { display: block; height: 18px; padding: 1px 6px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-box { position: absolute; box-sizing: border-box; border: 1px solid rgba(0,0,0,.25); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; text-decoration: none; overflow: hidden; line-height: 1.1; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.heat-box:hover, .heat-box:focus-visible { outline: 2px solid #fff; outline-offset: -2px; z-index: 1; }
.hb-sym { font-weight: 700; white-space: nowrap; }
.hb-chg { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: .72em; margin-top: 2px; }
.heat-tip { position: fixed; z-index: 10; white-space: normal; max-width: 300px; line-height: 1.5; }
.heat-legend { display: flex; border-radius: 6px; overflow: hidden; }
.heat-legend span { font: 11px "JetBrains Mono", ui-monospace, monospace; color: #fff; padding: 3px 8px; text-shadow: 0 1px 1px rgba(0,0,0,.35); }

/* compare stocks */
#picked { gap: 6px; }
#picked .chip { cursor: default; padding-right: 2px; }
#picked .x { font-size: 13px; padding: 0 6px; }
#chart-panel .ranges { margin-top: 0; }
.compare-table { min-width: 560px; }
.compare-table th[scope="row"] { text-align: left; font-weight: 500; color: var(--muted); background: none; text-transform: none; letter-spacing: 0; font-size: 14px; }
.compare-table thead th { text-align: right; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
.compare-table thead th .tk { font-weight: 400; color: var(--muted); font-size: 12px; }
.compare-table thead .sw { display: inline-block; width: 12px; border-top-width: 3px; vertical-align: middle; }
.compare-table td { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 13px; }
.compare-table td.best { background: var(--accent-soft); font-weight: 700; }
@media (max-width: 640px) { .compare-table { min-width: 0; } .compare-table td, .compare-table th { padding: 8px 6px; white-space: normal; } }

/* paper trading */
.pf-summary { display: flex; flex-wrap: wrap; gap: 10px 28px; padding: 16px 20px; margin-bottom: 16px; align-items: flex-end; }
.big-stat .value { font-size: 26px; }
.pf-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; align-items: start; margin-bottom: 24px; }
.ticket { padding: 16px; display: flex; flex-direction: column; gap: 10px; position: sticky; top: 112px; }
.ticket h2 { margin: 0; font-size: 18px; }
.ticket label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ticket .field, .ticket .lookup input { width: 100%; }
.ticket .lookup { margin: 0; }
.ticket .lookup input { padding: 9px 12px; font-size: 15px; }
.ticket-stock { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 8px; background: var(--surface-2); min-height: 44px; }
.ticket-stock .tk { color: var(--muted); font-size: 12px; }
.ticket-px { font-size: 18px; font-weight: 600; }
.ticket-px .num { font-size: 18px; }
.ticket .side { display: grid; grid-template-columns: 1fr 1fr; }
.ticket .side button[aria-checked="true"] { background: var(--up); color: #fff; font-weight: 600; }
.ticket.selling .side button[aria-checked="true"] { background: var(--down); }
.ticket.selling .btn.primary { background: var(--down); border-color: var(--down); }
.ticket-est { display: flex; flex-direction: column; gap: 3px; font-size: 14px; }
.ticket-est .tk { color: var(--muted); font-size: 12px; }
.linkish { all: unset; color: var(--accent); cursor: pointer; text-decoration: underline; }
.btn.small { padding: 3px 10px; font-size: 13px; }
.x.armed { color: var(--down); font-size: 12px; }
.pf-main .subhead:first-child { margin-top: 0; }
.pf-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; }
.alloc { display: flex; gap: 16px; align-items: center; padding: 14px 16px; margin-top: 12px; }
.alloc-list { list-style: none; margin: 0; padding: 0; font-size: 13px; flex: 1; min-width: 0; }
.alloc-list li { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.alloc-list .num { margin-left: auto; }
#history { margin: 12px 0 0; }
.pf-tools { margin-top: 16px; }
.inline-ask { display: inline-flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .pf-grid, .pf-two { grid-template-columns: 1fr; }
  .ticket { position: static; }
}

/* calculators */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; margin-bottom: 24px; }
.calc { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.calc h2 { margin: 0; font-size: 18px; }
.calc > .hint { margin: 0; }
.calc-stock { margin: 0; max-width: none; }
.calc-stock input { font-size: 14px; padding: 8px 12px; }
.calc-in { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.calc-in label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.calc-in label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; }
.calc-in .field { width: 100%; }
.calc-res { border-top: 1px solid var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.calc-out { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--muted); }
.calc-out strong { color: var(--text); font-size: 14px; }
.calc-out strong.up { color: var(--up); } .calc-out strong.down { color: var(--down); }
.calc-out.lead { font-size: 15px; color: var(--text); padding-bottom: 4px; }
.calc-out.lead strong { font-size: 20px; }
.calc-chart { width: 100%; height: auto; margin-top: 8px; }
.calc-chart .axis { fill: var(--muted); font: 11px "JetBrains Mono", ui-monospace, monospace; }
.calc-chart .base { stroke: var(--muted); stroke-dasharray: 3 4; }
.calc .hint { margin: 4px 0 0; }
@media (max-width: 640px) { .calc-grid { grid-template-columns: 1fr; } }

/* earnings and dividend calendar */
#weeknav button { font-size: 15px; }
#weeknav #this { font-size: 13px; }
label.check { display: inline-flex; gap: 6px; align-items: center; }
.cal-week { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 8px; }
.cal-day { padding: 12px; min-height: 160px; }
.cal-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cal-day.past { opacity: .7; }
.cal-day h3 { margin: 0 0 8px; font-size: 14px; display: flex; gap: 6px; align-items: baseline; }
.cal-day h3 span { color: var(--muted); font-weight: 500; }
.cal-day h3 em { margin-left: auto; font-style: normal; font-size: 12px; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 1px 8px; }
.cal-day ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cal-day li { display: flex; align-items: center; gap: 6px; }
.cal-day li a { display: flex; gap: 6px; min-width: 0; flex: 1; color: inherit; text-decoration: none; padding: 3px 6px; margin: 0 -6px; border-radius: 6px; font-size: 13px; }
.cal-day li a:hover { background: var(--surface-2); }
.cal-day li b { flex: none; }
.cal-day li span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-day li i { font-style: normal; color: var(--up); font-size: 12px; }
.cal-day .hint, .cal-day .muted { font-size: 13px; margin: 6px 0 0; }
@media (max-width: 640px) { .cal-week { grid-template-columns: 1fr; } .cal-day { min-height: 0; } }

/* stock lookup: company and financials */
.fund { padding: 18px 20px; }
.fund-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fund-head h2 { margin: 0; font-size: 20px; }
.fund-actions { display: flex; gap: 6px; align-items: center; }
.fund-actions .star { font-size: 15px; border: 1px solid var(--border); padding: 3px 10px; border-radius: 8px; }
.fund-summary { margin: 12px 0; line-height: 1.6; max-width: 900px; }
.fund-profile { margin-bottom: 8px; }
.fund-profile .tags { margin-bottom: 8px; }
.fund-profile a.tag { text-decoration: none; }
.fund-desc summary { cursor: pointer; color: var(--muted); font-size: 14px; list-style: none; }
.fund-desc summary span { color: var(--accent); }
.fund-desc[open] summary { display: none; }
.fund-desc p { color: var(--muted); font-size: 14px; margin: 0; max-width: 900px; }
.fgroups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 24px; margin-top: 16px; }
.fgroup h3 { margin: 0 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fgroup dl { margin: 0; }
.fgroup dl div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.fgroup dl div[title] { cursor: help; }
.fgroup dt { color: var(--muted); }
.fgroup dd { margin: 0; text-align: right; }
.analyst-big { margin: 4px 0 8px; }
.rec-scale { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--up), var(--surface-2) 50%, var(--down)); }
.rec-scale i { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; background: var(--text); }
.rec-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin: 4px 0 14px; }
.tgt-track { position: relative; height: 8px; border-radius: 4px; background: var(--surface-2); margin-top: 8px; }
.tgt-range { position: absolute; top: 0; bottom: 0; background: var(--accent-soft); border: 1px solid var(--accent); border-radius: 4px; }
.tgt-mean, .tgt-now { position: absolute; top: -4px; width: 4px; height: 16px; margin-left: -2px; border-radius: 2px; }
.tgt-mean { background: var(--accent); } .tgt-now { background: var(--text); }
.tgt-labels { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.tgt-key { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.tgt-key.now { background: var(--text); } .tgt-key.mean { background: var(--accent); }
@media (max-width: 640px) { .fund { padding: 14px; } }

/* price alerts */
.alert-form { display: grid; grid-template-columns: minmax(200px, 1.4fr) minmax(150px, 1fr) 120px minmax(160px, 1.2fr) auto; gap: 8px; padding: 14px 16px; margin-bottom: 12px; align-items: center; }
.alert-form .lookup { margin: 0; max-width: none; }
.alert-form .lookup input { font-size: 14px; padding: 8px 12px; }
.alert-stock { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; }
.alert-stock a { color: inherit; text-decoration: none; }
.alert-stock .tk { color: var(--muted); font-size: 12px; }
.alert-stock .quick { display: flex; gap: 6px; flex-wrap: wrap; }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 20; display: flex; flex-direction: column; gap: 8px; max-width: min(360px, calc(100vw - 32px)); }
.toast { position: relative; background: var(--surface); border: 1px solid var(--accent); border-radius: 10px; padding: 12px 34px 12px 14px; box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 14px; line-height: 1.45; }
.toast a { color: var(--text); }
.toast .x { position: absolute; top: 6px; right: 6px; }
.toast .tk { color: var(--muted); font-size: 12px; }
@media (max-width: 900px) { .alert-form { grid-template-columns: 1fr 1fr; } .alert-form .lookup, .alert-form #note { grid-column: 1 / -1; } }
[hidden] { display: none !important; }

/* technical signals */
.toolbar .tabs { padding: 0; flex: 1 1 auto; min-width: 0; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; margin-bottom: 8px; }
.sig-card { padding: 14px; display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--muted); }
.sig-card.up { border-top-color: var(--up); } .sig-card.down { border-top-color: var(--down); } .sig-card.flat { border-top-color: var(--warn); }
.sig-card.on { box-shadow: 0 0 0 2px var(--accent); }
.sig-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sig-top h3 { margin: 0; font-size: 16px; }
.sig-count { font: 600 18px "JetBrains Mono", ui-monospace, monospace; }
.sig-card .hint { margin: 0; flex: 1; }
.sig-names { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; }
.sig-names a { color: var(--text); text-decoration: none; font-weight: 600; white-space: nowrap; }
.sig-names a:hover { color: var(--accent); }
.sig-names .num { font-weight: 400; font-size: 12px; }
.sig-card .btn { align-self: flex-start; }
.tag.sig-up { background: var(--up-soft); color: var(--up); } .tag.sig-down { background: var(--down-soft); color: var(--down); } .tag.sig-flat { background: var(--surface-2); color: var(--warn); }

/* Markets page: your stocks */
.mine { margin-bottom: 24px; }
.mine .snap-head { margin-top: 0; }
.pf-card { border-color: var(--accent); }
.pf-card .nm { font-size: 18px; }
.mkt-hours { font-size: 11px; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.mkt-hours i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.mkt-hours.open { color: var(--up); }
.mkt-hours.open i { background: var(--up); }

/* ---- Dividends */
.safe { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); cursor: help; white-space: nowrap; }
.safe.safe { background: var(--up-soft); color: var(--up); }
.safe.risk { background: var(--down-soft); color: var(--down); }
.safe.watch { background: color-mix(in srgb, #d99a00 18%, transparent); color: #a86f00; }
@media (prefers-color-scheme: dark) { .safe.watch { color: #f0b84a; } }
.num.strong { font-weight: 600; }
.table-wrap .hint.pad { padding: 10px 14px; margin: 0; }
.div-plan { padding: 18px 20px; margin: 24px 0; display: flex; flex-direction: column; gap: 12px; }
.div-plan h2 { margin: 0 0 4px; font-size: 18px; }
.div-plan .hint { margin: 0; }
.div-plan-head { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; align-items: flex-end; }
.div-plan-head > div:first-child { flex: 1 1 320px; }
.div-plan-in { display: flex; gap: 12px; }
.div-plan-in label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.div-plan-in input { width: 150px; }
.div-plan-stats .value { font-size: 20px; }
.div-basket { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.div-basket a { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; color: var(--text); text-decoration: none; font-size: 13px; }
.div-basket a:hover { border-color: var(--accent); }
.div-basket a b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.div-basket a span:last-child { grid-column: 1 / -1; font-size: 12px; }

/* ---- Analyst ratings */
.an-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; margin: 16px 0; }
@media (max-width: 860px) { .an-top { grid-template-columns: minmax(0, 1fr); } }
.an-top .panel { padding: 18px 20px; }
.an-top h2 { margin: 0 0 4px; font-size: 18px; }
.an-top .hint { margin: 0 0 12px; }
.an-bars { display: flex; flex-direction: column; gap: 8px; }
.an-bar { display: grid; grid-template-columns: 110px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.an-bar div { height: 14px; background: var(--surface-2); border-radius: 7px; overflow: hidden; }
.an-bar i { display: block; height: 100%; border-radius: 7px; background: var(--muted); }
.an-bar.sb i { background: var(--up); } .an-bar.b i { background: color-mix(in srgb, var(--up) 60%, var(--surface-2)); }
.an-bar.u i { background: color-mix(in srgb, var(--down) 60%, var(--surface-2)); } .an-bar.s i { background: var(--down); }
.an-bar b { text-align: right; }
.an-rate { display: inline-flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.an-scale { position: relative; width: 84px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--up), var(--surface-2) 50%, var(--down)); }
.an-scale i { position: absolute; top: -3px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--text); border: 2px solid var(--surface); }
.an-sec { width: 100%; font-size: 13px; }
.an-sec td, .an-sec th { padding: 6px 8px; }
.an-sec .muted { font-size: 12px; }
table.an-sec { min-width: 0; }
.an-sec th, .an-sec td { text-align: right; }
.an-sec th:first-child, .an-sec td:first-child { text-align: left; white-space: normal; }
.an-sec .an-rate { flex-direction: row; align-items: center; gap: 8px; }
@media (max-width: 560px) { .an-sec .an-scale { display: none; } }

/* ---- Backtest */
.bt-form { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px 28px; padding: 18px 20px; margin-bottom: 16px; }
@media (max-width: 760px) { .bt-form { grid-template-columns: minmax(0, 1fr); } }
.bt-form h2 { margin: 0 0 10px; font-size: 18px; }
.bt-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.bt-name { display: flex; flex-direction: column; min-width: 0; }
.bt-name .tk { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bt-w { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.bt-w input { width: 72px; text-align: right; }
.bt-add { margin: 12px 0 8px; max-width: none; }
.bt-weights { display: flex; align-items: center; gap: 12px; }
.bt-weights .hint { margin: 0; }
.bt-weights .hint.warn { color: #a86f00; }
.bt-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.bt-opts label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.bt-opts .field { width: 100%; }
#result { margin-bottom: 16px; }
#result .pad, #result .pad-t { margin: 0 0 10px; }
.stat .big-v { font-size: 22px; }
.stat .value span.up, .stat .value span.down { font-size: 12px; font-weight: 500; }
.bt-tables { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 860px) { .bt-tables { grid-template-columns: minmax(0, 1fr); } }
.pad-h { margin: 0; padding: 14px 16px 10px; font-size: 16px; }
table.bt-table { min-width: 0; }
.bt-table td:nth-child(2), .bt-table th:nth-child(2) { text-align: right; }
.plain-link { color: var(--text); font-weight: 600; text-decoration: none; } .plain-link:hover { color: var(--accent); }

/* ---- Similar companies on the lookup */
.peers { margin: 18px 0 8px; border-top: 1px solid var(--border); padding-top: 14px; }
.peers-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.peers-head h3 { margin: 0; font-size: 16px; }
.peers-head h3 .muted { font-weight: 400; font-size: 13px; margin-left: 6px; }
table.peer-table { min-width: 0; font-size: 13px; }
.peer-table td, .peer-table th { padding: 8px; }
.peer-table td:nth-child(2), .peer-table th:nth-child(2) { text-align: right; }
.peer-table td.left a { color: var(--text); text-decoration: none; display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.peer-table td.left a:hover b { color: var(--accent); }
.peer-table tr.me td { background: var(--surface-2); }
@media (max-width: 640px) { .peer-table .hide-sm { display: none; } .peer-table td.left a { max-width: 150px; } }
.peers .table-wrap { overflow-x: auto; }
@media (max-width: 640px) { .peer-table td.left .muted { display: none; } }

/* ---- Sector rotation grid */
#rotation { overflow-x: auto; }
table.rot-table { min-width: 620px; font-size: 13px; }
.rot-table td, .rot-table th { padding: 8px 10px; }
.rot-table td.rot-cell { font-family: "JetBrains Mono", ui-monospace, monospace; text-align: center; color: #fff; text-shadow: 0 1px 1px rgba(0,0,0,.35); border-left: 2px solid var(--surface); }
.rot-table th:not(.left) { text-align: center; }
.rot-table tr.total td { font-weight: 600; border-top: 2px solid var(--border); }

/* ---- Paper trading check-up */
.pf-check { padding: 16px 18px; display: flex; flex-direction: column; gap: 14px; }
.pf-check-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px 24px; }
.pf-bars h4 { margin: 0 0 6px; font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.pf-bar { display: grid; grid-template-columns: minmax(0, 110px) 1fr 40px; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 4px; }
.pf-bar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pf-bar div { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.pf-bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.pf-bar b { text-align: right; font-weight: 500; }
.pf-notes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.pf-notes li { padding: 8px 12px; border-radius: 8px; background: var(--surface-2); }
.pf-notes li.warn { background: var(--down-soft); }
.pf-notes li.good { background: var(--up-soft); }

/* ---- Grouped menu on wide screens, one scrolling row on narrow ones */
.top .menu .menu-wide, .top .menu .menu-flat { display: flex; gap: 2px; align-items: center; }
.top .menu .menu-flat { display: none; }
@media (max-width: 900px) {
  .top .menu .menu-wide { display: none; }
  .top .menu .menu-flat { display: flex; }
}
@media (min-width: 901px) { .top .menu { overflow: visible; } }
.menu-group { position: relative; }
.menu-btn { all: unset; cursor: pointer; color: var(--muted); font-size: 14px; font-weight: 500; padding: 6px 12px; border-radius: 8px; display: inline-flex; gap: 4px; align-items: center; }
.menu-btn i { font-style: normal; font-size: 10px; }
.menu-btn:hover, .menu-btn[aria-expanded="true"] { color: var(--text); background: var(--surface-2); }
.menu-btn.on { color: var(--accent); background: var(--accent-soft); }
.menu-btn:focus-visible { outline: 2px solid var(--accent); }
.menu-pop { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; min-width: 170px; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.menu-pop[hidden] { display: none !important; }
.menu-pop a { display: block; }

/* ---- Watchlist notes */
.wl-note { all: unset; cursor: pointer; color: var(--muted); font-size: 13px; padding: 2px 6px; border-radius: 6px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.wl-note:hover, .wl-note:focus-visible { background: var(--surface-2); color: var(--text); }
.wl-note.has { color: var(--text); }
.wl-dlg { width: min(460px, calc(100vw - 32px)); padding: 20px; color: var(--text); }
.wl-dlg::backdrop { background: rgba(0,0,0,.45); }
.wl-dlg h2 { margin: 0 0 2px; font-size: 18px; }
.wl-dlg form { display: flex; flex-direction: column; gap: 10px; }
.wl-dlg label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.wl-dlg textarea { resize: vertical; font: inherit; }
.wl-dlg .hint { margin: 0; }
.wl-dlg-btns { display: flex; justify-content: flex-end; gap: 8px; }

/* ---- Options strategy builder */
.op-setup { display: grid; grid-template-columns: minmax(0, 2fr) repeat(4, minmax(0, 1fr)); gap: 12px; padding: 16px 18px; align-items: end; margin-bottom: 12px; }
@media (max-width: 860px) { .op-setup { grid-template-columns: 1fr 1fr; } .op-setup .op-stock { grid-column: 1 / -1; } }
.op-setup label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.op-setup .field { width: 100%; }
.op-stock { margin: 0; max-width: none; }
.op-legs { margin: 12px 0 16px; }
table.op-table { min-width: 0; }
.op-table td, .op-table th { padding: 6px 8px; }
.op-table .field { width: 100%; min-width: 0; padding: 6px 8px; font-size: 14px; }
.op-table input.field { max-width: 100px; text-align: right; }
.op-leg-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; }
.op-leg-tools .hint { margin: 0 0 0 auto; }
.chart .op-spot { stroke: var(--muted); stroke-dasharray: 2 3; }
.chart .op-be { fill: var(--surface); stroke: var(--text); stroke-width: 1.5; }
#result { margin-bottom: 16px; }
@media (max-width: 640px) { .op-table .hide-sm { display: none; } }
.op-legs { overflow-x: auto; }
.op-table select.field { min-width: 76px; }
.op-table input.field { min-width: 64px; }
@media (max-width: 640px) { table.op-table { min-width: 400px; } }
.returns-row { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 10px; } .returns-row .tk { font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---- Daily brief */
.brief { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; margin-bottom: 16px; }
.brief-sec { padding: 18px 20px; line-height: 1.6; }
.brief-sec h2 { margin: 0 0 8px; font-size: 18px; }
.brief-sec h3 { margin: 0 0 4px; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.brief-sec p { margin: 0 0 8px; }
.brief-lead { font-size: 15px; }
.brief-list { margin: 0 0 8px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.brief-list .muted { font-size: 13px; }
.brief-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
@media (max-width: 520px) { .brief-two { grid-template-columns: 1fr; } }
.brief-movers { margin: 0; padding: 0; list-style: none; font-size: 14px; }
.brief-movers li { display: flex; gap: 6px; align-items: baseline; padding: 2px 0; }
.brief-movers .muted { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.brief-more { font-size: 13px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; margin: 8px 0 0 !important; }
.brief { align-items: start; } .brief-more a { color: var(--accent); text-decoration: none; } .brief-more a:hover { text-decoration: underline; }

/* ---- Market clock strip (every page) */
.mkt-clock { display: flex; gap: 6px; align-items: center; padding-top: 0; padding-bottom: 8px; overflow-x: auto; scrollbar-width: none; }
.mkt-clock::-webkit-scrollbar { display: none; }
.mc-label { flex: none; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-right: 2px; }
.mc { all: unset; flex: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: var(--muted); white-space: nowrap; }
.mc:hover { color: var(--text); border-color: var(--muted); }
.mc:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mc i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); opacity: .6; }
.mc.open i { background: var(--up); opacity: 1; box-shadow: 0 0 0 3px var(--up-soft); }
.mc b { font-weight: 600; }
.mc.on { color: var(--text); background: var(--surface-2); }
.mc.on.open { background: var(--up-soft); border-color: color-mix(in srgb, var(--up) 35%, transparent); }
.mc-t { color: var(--muted); }
.mc.open .mc-t { color: var(--up); }
.mc-t .num { font-variant-numeric: tabular-nums; color: inherit; font-weight: 600; }
/* Wide screens: show every market card at once (two rows of four) instead of a sideways scroll */
@media (min-width: 900px) {
  .markets { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; }
  .markets .mkt { min-width: 0; }
}

/* ---- earnings page */
.er-mine { margin: 12px 0 0; font-size: 14px; line-height: 1.8; }
.er-chart { padding: 14px 18px; margin-bottom: 8px; }
.er-chart h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); }
.er-bars { display: flex; gap: 4px; align-items: stretch; height: 130px; }
.er-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; background: none; border: 0; padding: 0; font: inherit; color: var(--muted); cursor: pointer; }
.er-bar:disabled { cursor: default; }
.er-bar i { display: block; width: 100%; max-width: 36px; min-height: 2px; border-radius: 3px 3px 0 0; background: var(--accent); opacity: .8; }
.er-bar:not(:disabled):hover i { opacity: 1; }
.er-bar.wkend i { background: var(--muted); opacity: .35; }
.er-n { font-size: 11px; }
.er-d { font-size: 11px; display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.er-d b { font-weight: 500; opacity: .7; }
.er-bars.many .er-n { font-size: 9px; }
@media (max-width: 640px) { .er-bars.many .er-n, .er-bars.many .er-d b { display: none; } .er-bars.many .er-bar:not(.lbl) .er-d { visibility: hidden; } .er-bars { gap: 2px; } }
.er-when { font-size: 12px; font-weight: 600; white-space: nowrap; padding: 2px 8px; border-radius: 999px; background: var(--surface-2, rgba(127,127,127,.12)); }
.er-when.pre { color: #b26b00; }
.er-when.post { color: var(--accent); }
.er-when.est { color: var(--muted); font-weight: 500; }
.er-day .subhead h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.er-day .table-wrap { margin-top: 10px; }

/* ---- who rates it (stock lookup) */
.ra { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.ra h3 { margin: 0 0 4px; font-size: 16px; }
.ra > .hint { max-width: 760px; margin: 0 0 12px; }
.ra-trend { display: grid; gap: 6px; margin-bottom: 14px; max-width: 620px; }
.ra-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.ra-legend span { display: inline-flex; align-items: center; gap: 5px; }
.ra-legend b { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.ra-mix { display: grid; grid-template-columns: 100px 1fr 32px; gap: 10px; align-items: center; font-size: 13px; }
.ra-mlabel { color: var(--muted); }
.ra-bar { display: flex; height: 20px; border-radius: 4px; overflow: hidden; gap: 1px; }
.ra-bar i { font-style: normal; font-size: 11px; color: #fff; display: flex; align-items: center; justify-content: center; min-width: 14px; font-weight: 600; }
.ra-n { text-align: right; color: var(--muted); }
.ra-sb { background: #0f7b45; } .ra-b { background: #3fae6a; } .ra-h { background: #9aa3ad; } .ra-s { background: #e0714f; } .ra-ss { background: #b3261e; }
.ra-table { min-width: 0; }
.ra-table td b { font-weight: 600; }
.ra-act { font-size: 12px; font-weight: 600; color: var(--muted); }
.ra-act.up { color: var(--up); } .ra-act.down { color: var(--down); } .ra-act.init { color: var(--accent); }
@media (max-width: 640px) { .ra-mix { grid-template-columns: 76px 1fr 26px; } .ra-table td, .ra-table th { white-space: normal; } }
.news-outlets { padding: 10px 12px; margin-bottom: 14px; }
.line-label { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-left: 4px; }
.line-label select { padding: 4px 8px; font-size: 12px; }

/* Ask page */
.ask { padding: 0; overflow: hidden; }
.ask-log { max-height: min(60vh, 560px); min-height: 220px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.ask-intro p { margin: 0 0 10px; color: var(--muted); }
.ask-msg { display: flex; }
.ask-msg.me { justify-content: flex-end; }
.ask-msg .bubble { max-width: min(680px, 88%); padding: 10px 14px; border-radius: 14px; line-height: 1.5; font-size: 14px; overflow-wrap: anywhere; }
.ask-msg.me .bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.ask-msg.bot .bubble { background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.ask-msg .bubble p { margin: 0 0 8px; }
.ask-msg .bubble p:last-of-type { margin-bottom: 0; }
.ask-msg .bubble.wait { color: var(--muted); font-style: italic; }
.ask-msg .bubble .hint { display: block; margin-top: 8px; }
.ask-page { display: inline-block; margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--accent); text-decoration: none; }
.ask-page:hover { text-decoration: underline; }
.ask-related { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.ask-related .chip, .ask-intro .chip { font-size: 12px; text-align: left; }
.ask-form { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.ask-form .field { flex: 1; }
.ask-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 16px 12px; flex-wrap: wrap; }
.ask-topics { margin-top: 18px; }
.ask-topic { border-top: 1px solid var(--border); }
.ask-topic summary { cursor: pointer; padding: 11px 16px; font-weight: 500; font-size: 14px; }
.ask-topic summary:hover { color: var(--accent); }
.ask-body { padding: 0 16px 14px; font-size: 14px; line-height: 1.55; color: var(--text); }
.ask-body p { margin: 0 0 8px; }

/* ---- page background: plain, with a faint grid that fades out down the page */
body { position: relative; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 420px at 15% -120px, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    radial-gradient(800px 380px at 90% -160px, color-mix(in srgb, var(--up) 9%, transparent), transparent 70%),
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 32px 32px;
  -webkit-mask-image: linear-gradient(180deg, #000 0, #000 260px, transparent 720px);
  mask-image: linear-gradient(180deg, #000 0, #000 260px, transparent 720px);
}
:root { --grid: rgba(36, 86, 214, .05); }
@media (prefers-color-scheme: dark) { :root { --grid: rgba(126, 162, 255, .05); } }

/* ---- header: ticker tape, graph-paper bar and logo, the same on every page */
.top {
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 0 / 16px 16px,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) 0 0 / 16px 16px,
    color-mix(in srgb, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(8px); backdrop-filter: saturate(1.4) blur(8px);
}
.brand { gap: 10px; }
.logo { display: inline-flex; color: inherit; }
.logo-mark { display: block; width: 32px; height: 32px; filter: drop-shadow(0 1px 2px rgba(15, 27, 61, .25)); }
.brand-text { font-weight: 800; font-size: 19px; letter-spacing: -.02em; }
.brand-text b { color: var(--up); font-weight: 800; }
.top .mc:not(.on) { background: var(--surface); }

.tape { background: #0b0f17; color: #cbd5e1; border-bottom: 2px solid #f5b301; overflow: hidden; white-space: nowrap; font: 600 12px/28px "JetBrains Mono", ui-monospace, monospace; }
.tape-run { display: inline-flex; animation: tape 90s linear infinite; will-change: transform; }
.tape:hover .tape-run, .tape:focus-within .tape-run { animation-play-state: paused; }
.tape-set { display: inline-flex; flex: none; }
.tape .tk { display: inline-flex; gap: 7px; align-items: baseline; padding: 0 16px; color: inherit; text-decoration: none; border-right: 1px solid #1f2937; }
.tape a.tk:hover b { text-decoration: underline; }
.tape .tk b { color: #fff; font-weight: 700; }
.tape .tk.ix b { color: #f5b301; }
.tape .tk .num { font-size: 12px; }
.tape .tk i { font-style: normal; }
.tape .tk .u { color: #4ade80; }
.tape .tk .d { color: #f87171; }
@keyframes tape { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .tape { overflow-x: auto; scrollbar-width: none; }
  .tape-run { animation: none; }
  .tape-set[aria-hidden] { display: none; }
}
