:root {
  --bg: #f6f6f7; --card: #ffffff; --text: #111214; --muted: #6b6f76; --line: #ebecee; --soft: #f3f3f5;
  --brand: #f97316; --brand2: #ea580c; --brandsoft: #fff1e6; --onbrand: #ffffff;
  --up: #16a34a; --down: #e11d48; --flat: #8b9099;
  --upbg: #e8f7ee; --downbg: #fde8ee; --flatbg: #f1f2f4;
  --accent: #6366f1;
  --ma: #f97316; --ma50: #b4b8bf; --av1: #3b82f6; --av2: #e11d48; --av3: #16a34a; --fib: #8b5cf6;
  --shadow: 0 1px 2px rgba(16, 18, 20, .04), 0 4px 16px rgba(16, 18, 20, .05);
  --radius: 16px;
}
/* Black screen: chosen with the toggle (data-theme), otherwise follows the device setting */
:root[data-theme="dark"] {
    --bg: #000000; --card: #0d0e10; --text: #f2f3f5; --muted: #8e939b; --line: #202227; --soft: #16171a;
    --brand: #fb8a3c; --brand2: #f97316; --brandsoft: #2a1a0e; --onbrand: #160b03;
    --up: #34d399; --down: #fb7185; --flat: #8e939b;
    --upbg: #0f2a1f; --downbg: #34151d; --flatbg: #1c1e22;
    --accent: #818cf8;
    --ma: #fb8a3c; --ma50: #4b4f57; --av1: #60a5fa; --av2: #fb7185; --av3: #34d399; --fib: #a78bfa;
    --shadow: 0 1px 2px rgba(0,0,0,.6);
    color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
      --bg: #000000; --card: #0d0e10; --text: #f2f3f5; --muted: #8e939b; --line: #202227; --soft: #16171a;
      --brand: #fb8a3c; --brand2: #f97316; --brandsoft: #2a1a0e; --onbrand: #160b03;
      --up: #34d399; --down: #fb7185; --flat: #8e939b;
      --upbg: #0f2a1f; --downbg: #34151d; --flatbg: #1c1e22;
      --accent: #818cf8;
      --ma: #fb8a3c; --ma50: #4b4f57; --av1: #60a5fa; --av2: #fb7185; --av3: #34d399; --fib: #a78bfa;
      --shadow: 0 1px 2px rgba(0,0,0,.6);
      color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 19px; margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 16px; margin: 0 0 2px; }
h3 { font-size: 14px; margin: 18px 0 6px; }
.muted { color: var(--muted); }
p.muted { margin: 0 0 12px; font-size: 13px; }

/* header */
.top { position: relative; z-index: 5; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); }
.topin { max-width: 1600px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 28px; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 46px; height: 46px; border-radius: 13px; box-shadow: 0 4px 14px rgba(249, 115, 22, .35); }
.brandname { margin: 0; line-height: 0; }
/* Wordmark is exactly as tall as the icon. */
.brand { --mark: 48px; }
.wordmark { height: var(--mark); width: auto; display: block; }
.wordmark .w1 { fill: var(--text); }
.wordmark .w2 { fill: var(--brand); }
.brand .logo { width: var(--mark); height: var(--mark); display: block; }
@media (max-width: 900px) { .brand { --mark: 40px; } }
.brand .sub { color: var(--muted); font-size: 12px; }
.status { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.status #asof { display: inline-flex; align-items: center; gap: 7px; color: var(--text); font-weight: 600; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; }
.status #asof::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px var(--upbg); }
.plaid { display: none; }

/* tabs: floating glass bar, line icons, sliding orange highlight */
.navwrap { position: sticky; top: 0; z-index: 6; padding: 14px 28px 6px; max-width: 1600px; margin: 0 auto;
  background: linear-gradient(var(--bg) 70%, transparent); }
.tabs { position: relative; display: flex; gap: 2px; padding: 5px; overflow-x: auto; scrollbar-width: none;
  background: color-mix(in srgb, var(--card) 88%, transparent); backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 2px rgba(16,18,20,.04), 0 10px 30px -12px rgba(16,18,20,.18); }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; color: var(--muted);
  padding: 9px 14px; font: inherit; font-size: 13.5px; font-weight: 600; letter-spacing: -.005em; cursor: pointer; white-space: nowrap; border-radius: 11px;
  transition: color .2s ease, transform .15s ease; }
.tabs button svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.tabs button:hover { color: var(--text); }
.tabs button:active { transform: scale(.97); }
.tabs button.on { color: #fff; }
.tabs button.on svg { opacity: 1; }
.tabind { position: absolute; z-index: 0; top: 5px; bottom: 5px; left: 0; width: 0; border-radius: 11px;
  background: linear-gradient(135deg, #ff9a3c, #f05a0e); box-shadow: 0 6px 16px -4px rgba(240, 90, 14, .55), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .32s cubic-bezier(.3,.9,.3,1), width .32s cubic-bezier(.3,.9,.3,1); }
:root[data-theme="dark"] .tabs { box-shadow: 0 10px 30px -12px rgba(0,0,0,.8); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tabs { box-shadow: 0 10px 30px -12px rgba(0,0,0,.8); } }
@media (max-width: 900px) { .navwrap { padding: 10px 12px 4px; } .tabs button { padding: 8px 11px; font-size: 13px; } }

main { padding: 8px 28px 32px; max-width: 1600px; margin: 0 auto; }
.tab { display: none; }
.tab.on { display: block; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; overflow-x: auto; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid2 .card { margin-bottom: 0; }
@media (max-width: 900px) {
  .grid2 { grid-template-columns: 1fr; }
  .topin, main, .tabs { padding-left: 16px; padding-right: 16px; }
  .card { padding: 16px; }
  .brand .sub { display: none; }
}
.foot { text-align: center; color: var(--muted); font-size: 12px; padding: 0 0 32px; }

/* tables: compact, and the least important columns hide on narrower screens so nothing runs off */
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
th, td { padding: 7px 7px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
td.mk { white-space: normal; min-width: 130px; max-width: 230px; line-height: 1.3; }
td.mk .badge:first-of-type { margin-left: 6px; }
.nm2 { color: var(--muted); font-size: 11.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
td.wrap { white-space: normal; min-width: 180px; line-height: 1.35; }
td .fib { display: inline-block; line-height: 1.35; font-size: 12px; }
@media (max-width: 1500px) { .p4 { display: none; } }
@media (max-width: 1400px) { .p3 { display: none; } }
@media (max-width: 1100px) { .p2 { display: none; } }
th { font-size: 11px; color: var(--muted); font-weight: 600; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--card); letter-spacing: .02em; }
th:hover { color: var(--text); }
th[data-tip] { text-decoration: underline dotted; text-underline-offset: 3px; }
tbody tr:last-child td { border-bottom: 0; }
th.l, td.l { text-align: left; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover td { background: var(--soft); }
td b { font-weight: 650; }
td .nm { color: var(--muted); font-size: 12px; margin-left: 7px; }
td.rank { font-weight: 700; color: var(--muted); }
tbody tr:nth-child(-n+3) td.rank { color: var(--brand); }
.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--flat); }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }
.pill.up { background: var(--upbg); } .pill.down { background: var(--downbg); } .pill.flat { background: var(--flatbg); }
.badge { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; margin-left: 5px; border-radius: 6px; color: var(--muted); background: var(--flatbg); }
.badge.up { background: var(--upbg); color: var(--up); } .badge.down { background: var(--downbg); color: var(--down); }
.bar { display: inline-block; width: 44px; height: 6px; background: var(--flatbg); border-radius: 999px; position: relative; vertical-align: middle; margin-left: 6px; overflow: hidden; }
.bar i { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.fib { font-size: 12.5px; }
.fib b { font-weight: 650; }
.fib .hit { color: var(--up); font-weight: 700; }
.avd { display: inline-flex; gap: 5px; padding: 3px 4px; cursor: help; }

.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 12.5px; font-weight: 550; cursor: pointer; transition: all .15s; }
.chips button:hover { border-color: var(--brand); color: var(--brand); }
.chips button.on { background: var(--brand); border-color: var(--brand); color: var(--onbrand); }
.check { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.check input { accent-color: var(--brand); }
input[type=search] { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 12px; padding: 9px 14px; font: inherit; min-width: 260px; outline: none; }
input[type=search]:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brandsoft); }

/* overview */
.verdict { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 4px; }
.verdict.flat { color: var(--brand); }
.evi { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px 10px; align-items: center; margin-top: 12px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.up { background: var(--up); } .dot.down { background: var(--down); } .dot.flat { background: var(--flat); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.stat { background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.stat b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.stat > span { color: var(--muted); font-size: 12px; }
.prose { max-width: 860px; }
.prose li { margin-bottom: 5px; }

/* chart modal */
.modal { position: fixed; inset: 0; background: rgba(8, 9, 11, .5); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: flex; align-items: flex-start; justify-content: center; padding: 28px 12px; overflow-y: auto; z-index: 10; }
.modal[hidden] { display: none; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; width: min(1200px, 100%); padding: 22px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.phead { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.phead h2 { font-size: 20px; }
.close { border: 1px solid var(--line); background: var(--soft); color: var(--text); border-radius: 999px; padding: 6px 14px; cursor: pointer; font: inherit; font-weight: 550; }
.close:hover { border-color: var(--brand); color: var(--brand); }
.chartwrap { position: relative; }
canvas { width: 100%; height: 560px; display: block; }
@media (max-width: 700px) { canvas { height: 440px; } }
.tip { position: absolute; top: 6px; left: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 4px 9px; font-size: 12px; pointer-events: none; font-variant-numeric: tabular-nums; box-shadow: var(--shadow); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 8px 0 14px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.checks { display: grid; grid-template-columns: 12px 1fr; gap: 6px 10px; margin-top: 6px; align-items: center; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; margin: 10px 0; }
.kv div { background: var(--soft); border-radius: 12px; padding: 9px 12px; }
.kv span { display: block; color: var(--muted); font-size: 11px; font-weight: 550; }
.kv div.good { background: var(--upbg); }
.kv div.bad { background: var(--downbg); }

/* news */
.nday { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--brand); margin: 18px 0 4px; }
.nday:first-child { margin-top: 4px; }
.nitem { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ntime { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; }
.ntime span { display: block; color: var(--muted); font-weight: 400; font-size: 11.5px; }
.nbody a { color: var(--text); text-decoration: none; font-weight: 600; font-size: 14.5px; line-height: 1.35; }
.nbody a:hover { color: var(--brand); text-decoration: underline; }
.nbody a::after { content: " \2197"; color: var(--muted); font-weight: 400; font-size: 12px; }
.nmeta { margin-top: 3px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.nmeta b { color: var(--text); font-weight: 600; }
.ntag { background: var(--flatbg); border-radius: 6px; padding: 0 6px; font-size: 11px; }
@media (max-width: 600px) { .nitem { grid-template-columns: 1fr; gap: 2px; } }

/* paper trading */
.ptiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 10px 0 14px; }
.ptile { background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.ptile b { display: block; white-space: nowrap; font-size: 20px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; }
.ptile > span { display: block; font-size: 12px; font-weight: 600; margin-top: 2px; }
.ptile > em { display: block; font-style: normal; color: var(--muted); font-size: 11.5px; }
.pcurve { background: var(--soft); border-radius: 12px; padding: 12px 14px; }
.pclabel { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.curve { width: 100%; height: 160px; display: block; }
.cdates { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }

/* hover help */
.hover { position: fixed; z-index: 30; max-width: 320px; background: #16171a; color: #e9eaec; border: 1px solid #2a2c31; border-radius: 12px; padding: 10px 12px; font-size: 12.5px; line-height: 1.5; box-shadow: 0 12px 32px rgba(0,0,0,.3); pointer-events: none; }
.hover b { color: #fff; }
.hover[hidden] { display: none; }
/* Metals and Oil & Gas: commodities table full width, industry summary below it */
.tgrid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 20px; }
.tgrid .card { margin-bottom: 0; }
.card.wide.prose { max-width: none; }
table.learn tr.sub td { background: var(--soft); font-weight: 600; font-size: 12px; color: var(--muted); }
table.learn td b { color: var(--text); }

/* light / black toggle */
.status { flex-direction: row; align-items: center; gap: 10px; }
.status .stx { display: flex; flex-direction: column; align-items: flex-end; }
.themebtn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, color .15s; }
.themebtn:hover { border-color: var(--brand); color: var(--brand); }
.themebtn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.themebtn .moon { display: none; }
:root[data-mode="dark"] .themebtn .sun { display: none; }
:root[data-mode="dark"] .themebtn .moon { display: inline; }
@media (max-width: 900px) { .status .stx { display: none; } }
.ptiles.cmp { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.ptiles.cmp .ptile b { white-space: normal; }
