/* catalystwire design system. Colours are the original catalystwire palette, unchanged.
   Type and layout follow the house editorial system: high-contrast serif headlines in sentence case,
   small bold tracked capitals for eyebrows, a clean sans for body, 1px hairline rules, strict grid. */

:root {
  --accent: #3b82f6;
  --accent-soft: color-mix(in oklch, var(--accent) 16%, transparent);
  --accent-dim: color-mix(in oklch, var(--accent) 38%, transparent);
  --up: #1fd6a3;
  --up-soft: color-mix(in oklch, var(--up) 14%, transparent);
  --down: #ff5470;
  --down-soft: color-mix(in oklch, var(--down) 14%, transparent);
  --bg-0: #07080a;
  --bg-1: #0b0d11;
  --bg-2: #111419;
  --bg-3: #171b22;
  --bg-hover: #1c2129;
  --line: #20262f;
  --line-soft: #181d24;
  --text-0: #eef1f6;
  --text-1: #aab2c0;
  --text-2: #6b7480;
  --text-3: #474f5a;
  --scroll-thumb: #232a33;
  --scroll-thumb-hover: #2e3744;

  --font-display: "Instrument Serif", "Iowan Old Style", "Times New Roman", serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Inter", system-ui, sans-serif;

  --gutter: 40px;
  --gap: 24px;
  --r: 4px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --up: #0a9c72;
  --down: #e23857;
  --bg-0: #f3f5f8;
  --bg-1: #ffffff;
  --bg-2: #eef1f5;
  --bg-3: #e4e8ee;
  --bg-hover: #e9edf3;
  --line: #dde2ea;
  --line-soft: #eceff4;
  --text-0: #0d1117;
  --text-1: #3c4654;
  --text-2: #69727f;
  --text-3: #9aa3af;
  --scroll-thumb: #cbd2dc;
  --scroll-thumb-hover: #b3bcc8;
  color-scheme: light;
}
@media (max-width: 1100px) { :root { --gutter: 28px; --gap: 20px; } }
@media (max-width: 640px)  { :root { --gutter: 16px; --gap: 16px; } }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-0); color: var(--text-0); }
body {
  font-family: var(--font-ui); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss03";
}
#root { min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: 6px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); }

/* ---------- type ---------- */
.num, .mono { font-family: var(--font-ui); font-variant-numeric: tabular-nums; font-feature-settings: "tnum", "cv11", "ss03"; letter-spacing: -0.005em; }
.serif { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; }
.eyebrow { font-family: var(--font-ui); font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-2); line-height: 1.4; }
.eyebrow-sep { color: var(--text-3); padding: 0 8px; }
.h1 { font-family: var(--font-display); font-weight: 400; font-size: 44px; line-height: 1.08; letter-spacing: -0.015em; margin: 0; color: var(--text-0); }
.h2 { font-family: var(--font-display); font-weight: 400; font-size: 28px; line-height: 1.15; letter-spacing: -0.01em; margin: 0; color: var(--text-0); }
.h3 { font-family: var(--font-display); font-weight: 400; font-size: 22px; line-height: 1.2; margin: 0; color: var(--text-0); }
.lede { font-size: 15px; line-height: 1.6; color: var(--text-1); max-width: 720px; margin: 0; }
.small { font-size: 12.5px; color: var(--text-2); line-height: 1.5; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.up { color: var(--up); }
.down { color: var(--down); }
.accent { color: var(--accent); }
@media (max-width: 1100px) { .h1 { font-size: 36px; } .h2 { font-size: 24px; } }
@media (max-width: 640px)  { .h1 { font-size: 30px; } .h2 { font-size: 22px; } .lede { font-size: 14px; } }

/* ---------- shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; background: color-mix(in oklch, var(--bg-0) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar-row { display: flex; align-items: center; gap: 32px; height: 64px; padding: 0 var(--gutter); max-width: 1600px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-word { font-family: var(--font-display); font-size: 25px; line-height: 1; letter-spacing: -0.01em; color: var(--text-0); }
.brand-word em { font-style: normal; color: var(--accent); }
.brand-logo { display: block; height: 24px; width: auto; color: var(--text-0); }
.nav { display: flex; align-items: stretch; gap: 26px; height: 64px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 6px; height: 100%; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; transition: color .15s; }
.nav-item:hover { color: var(--text-0); }
.nav-item.active { color: var(--text-0); }
.nav-item.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: var(--text-0); }
.nav-caret { font-size: 9px; color: var(--text-3); transform: translateY(1px); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: var(--text-1); white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--up); box-shadow: 0 0 0 3px var(--up-soft); }
.status.off .status-dot { background: var(--down); box-shadow: 0 0 0 3px var(--down-soft); }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--r); color: var(--text-1); transition: border-color .15s, color .15s; }
.icon-btn:hover { border-color: var(--text-3); color: var(--text-0); }
.search { position: relative; width: 220px; }
.search input { width: 100%; height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r); background: transparent; color: var(--text-0); font: inherit; font-size: 12.5px; outline: none; transition: border-color .15s; }
.search input::placeholder { color: var(--text-3); }
.search input:focus { border-color: var(--text-3); }
.search-results { position: absolute; top: 40px; left: 0; right: 0; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 18px 40px rgba(0,0,0,.35); z-index: 60; overflow: hidden; }
.search-results button { width: 100%; display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; font-size: 13px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.search-results button:last-child { border-bottom: 0; }
.search-results button:hover { background: var(--bg-2); }

.menu { position: absolute; top: 58px; left: -16px; min-width: 300px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 24px 60px rgba(0,0,0,.45); padding: 8px 0; z-index: 70; }
.menu button { display: block; width: 100%; text-align: left; padding: 11px 18px; }
.menu button:hover { background: var(--bg-2); }
.menu-title { font-size: 13.5px; font-weight: 500; color: var(--text-0); }
.menu-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }

/* tablet and phone: nav drops to its own scrolling row */
@media (max-width: 1100px) {
  .topbar-row { flex-wrap: wrap; height: auto; padding-top: 14px; gap: 14px 20px; }
  .nav { order: 3; width: 100%; height: 44px; gap: 22px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line-soft); margin: 0 calc(var(--gutter) * -1); padding: 0 var(--gutter); width: calc(100% + var(--gutter) * 2); }
  .nav::-webkit-scrollbar { display: none; }
  .search { width: 180px; }
  .menu { position: fixed; top: auto; left: var(--gutter); right: var(--gutter); min-width: 0; }
}
@media (max-width: 640px) {
  .search { display: none; }
  .status .status-label { display: none; }
  .brand-word { font-size: 22px; }
  .brand-logo { height: 20px; }
}

.ticker { border-bottom: 1px solid var(--line); overflow: hidden; background: var(--bg-0); }
.ticker-track { display: flex; width: max-content; animation: vx-marquee 80s linear infinite; }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-item { display: flex; align-items: baseline; gap: 10px; padding: 10px 26px; border-right: 1px solid var(--line-soft); white-space: nowrap; font-size: 12.5px; }
.ticker-item .sym { font-weight: 600; color: var(--text-1); letter-spacing: .02em; }
@keyframes vx-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.page { width: 100%; max-width: 1600px; margin: 0 auto; padding: 40px var(--gutter) 72px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 28px; margin-bottom: 32px; border-bottom: 1px solid var(--line); }
.page-head .eyebrow { margin-bottom: 14px; }
.page-head-right { flex: 0 1 auto; min-width: 0; max-width: 100%; }
@media (max-width: 1100px) { .page-head-right { flex: 1 1 100%; } }
.page-head .lede { margin-top: 14px; }
@media (max-width: 640px) { .page { padding-top: 28px; } .page-head { padding-bottom: 20px; margin-bottom: 24px; } }

/* ---------- grid ---------- */
.grid { display: grid; gap: var(--gap); }
.cols-main-side { grid-template-columns: minmax(0, 1fr) 400px; align-items: start; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack { display: flex; flex-direction: column; gap: var(--gap); min-width: 0; }
@media (max-width: 1280px) { .cols-main-side { grid-template-columns: minmax(0, 1fr) 340px; } }
@media (max-width: 1100px) { .cols-main-side { grid-template-columns: minmax(0, 1fr); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px)  { .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px)  { .cols-2, .cols-3 { grid-template-columns: minmax(0, 1fr); } }

/* ---------- panels ---------- */
.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 22px; border-bottom: 1px solid var(--line); min-height: 58px; flex-wrap: wrap; }
.panel-body { padding: 20px 22px; }
.panel-body.flush { padding: 0; }
.panel-foot { padding: 12px 22px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--text-3); }
@media (max-width: 640px) { .panel-head { padding: 16px; } .panel-body { padding: 16px; } .panel-foot { padding: 10px 16px; } }

/* statistic */
.stat { padding: 22px; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r); min-width: 0; }
.stat-value { font-family: var(--font-display); font-size: 36px; line-height: 1.05; letter-spacing: -0.01em; margin-top: 12px; color: var(--text-0); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
@media (max-width: 1100px) { .stat-value { font-size: 32px; } }
@media (max-width: 640px)  { .stat { padding: 16px; } .stat-value { font-size: 28px; } }

/* tabs (sentence-case text tabs with underline) */
.tabs { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: 4px 0 8px; font-size: 13px; font-weight: 500; color: var(--text-2); white-space: nowrap; }
.tab:hover { color: var(--text-0); }
.tab.active { color: var(--text-0); }
.tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--text-0); }

/* segmented small control */
.seg { display: inline-flex; max-width: 100%; border: 1px solid var(--line); border-radius: var(--r); overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 0 0 auto; }
.seg button { padding: 6px 11px; font-size: 12px; font-weight: 500; color: var(--text-2); border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.active { color: var(--text-0); background: var(--bg-3); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); padding: 12px 22px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 16px 22px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; font-size: 13.5px; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; }
.table tbody tr.click { cursor: pointer; transition: background .12s; }
.table tbody tr.click:hover { background: var(--bg-2); }
@media (max-width: 1100px) { .table .hide-t { display: none; } }
@media (max-width: 640px)  { .table .hide-m { display: none; } .table th, .table td { padding-left: 16px; padding-right: 16px; } }

.asset { display: flex; align-items: center; gap: 12px; min-width: 0; }
.asset-mark { width: 4px; height: 28px; border-radius: 2px; flex: 0 0 auto; }
.asset-sym { font-weight: 600; font-size: 13.5px; color: var(--text-0); letter-spacing: .01em; }
.asset-name { font-size: 12px; color: var(--text-2); }

/* list rows */
.rows > * { border-bottom: 1px solid var(--line-soft); }
.rows > *:last-child { border-bottom: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 22px; }
@media (max-width: 640px) { .row { padding: 12px 16px; } }

/* bars and meters */
.meter { position: relative; height: 3px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.meter > span { position: absolute; top: 0; bottom: 0; left: 0; border-radius: 2px; }
.split { display: flex; height: 3px; border-radius: 2px; overflow: hidden; background: var(--bg-3); }
.split > span:first-child { background: var(--up); }
.split > span:last-child { background: var(--down); }

/* signal tag: words, not badges */
.tag { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tag.buy { color: var(--up); }
.tag.sell { color: var(--down); }
.tag.hold { color: var(--text-2); }

/* headlines */
.story { display: block; padding: 18px 22px; }
.story:hover .story-title { color: var(--accent); }
.story-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; }
.story-title { font-size: 15px; line-height: 1.45; color: var(--text-0); transition: color .15s; }
.story-impacts { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; }
.story-reason { margin-top: 6px; font-size: 12.5px; color: var(--text-1); line-height: 1.5; }
.story-original { margin-top: 6px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); font-style: italic; }
.story-original-label { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-right: 8px; }
@media (max-width: 640px) { .story { padding: 16px; } .story-title { font-size: 14.5px; } }

/* empty / notice */
.empty { padding: 36px 22px; text-align: center; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.notice { padding: 14px 18px; border: 1px solid var(--line); border-left: 2px solid var(--accent); border-radius: var(--r); font-size: 13px; color: var(--text-1); line-height: 1.55; background: var(--bg-1); }

.chart-box { height: 360px; }
@media (max-width: 1100px) { .chart-box { height: 320px; } }
@media (max-width: 640px)  { .chart-box { height: 260px; } }

.btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--r); font-size: 12.5px; font-weight: 500; color: var(--text-1); transition: border-color .15s, color .15s; }
.btn:hover { border-color: var(--text-3); color: var(--text-0); }

.loading { position: fixed; inset: 0; z-index: 90; background: var(--bg-0); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--bg-3); border-top-color: var(--text-1); display: inline-block; animation: vx-spin .8s linear infinite; }
@keyframes vx-spin { to { transform: rotate(360deg); } }
.fade-in { animation: vx-fade .35s ease both; }
@keyframes vx-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.flash-up { animation: vx-flash-up .6s ease-out; }
.flash-down { animation: vx-flash-down .6s ease-out; }
@keyframes vx-flash-up { 0% { color: var(--up); } 100% { color: inherit; } }
@keyframes vx-flash-down { 0% { color: var(--down); } 100% { color: inherit; } }
.skel { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: vx-skel 1.2s infinite; border-radius: 2px; }
@keyframes vx-skel { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.scroll-y { overflow-y: auto; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------ desk screens ------------------------------ */
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.field-hint { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.input, .select, .textarea { width: 100%; background: var(--bg-0); border: 1px solid var(--line); border-radius: var(--r); color: var(--text-0); font: inherit; font-size: 13.5px; padding: 10px 12px; outline: none; transition: border-color .15s; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--text-3); }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: vertical; min-height: 104px; line-height: 1.6; }
.select { appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--text-2) 50%), linear-gradient(135deg, var(--text-2) 50%, transparent 50%); background-position: calc(100% - 18px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.btn-primary { background: var(--text-0); border-color: var(--text-0); color: var(--bg-0); font-weight: 600; }
.btn-primary:hover { background: var(--text-1); border-color: var(--text-1); color: var(--bg-0); }
.btn-danger { color: var(--down); border-color: var(--line); }
.btn-danger:hover { color: var(--down); border-color: var(--down); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.filters .input, .filters .select { width: auto; }
.filter-search { flex: 1 1 240px; min-width: 200px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 30px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--text-1); transition: border-color .15s, color .15s, background .15s; }
.chip:hover { border-color: var(--text-3); color: var(--text-0); }
.chip.on { border-color: var(--text-3); background: var(--bg-3); color: var(--text-0); }
.profile-id { display: flex; align-items: center; gap: 14px; min-width: 0; }
.avatar-mark { width: 46px; height: 46px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--line); font-size: 14px; font-weight: 700; letter-spacing: .04em; color: var(--text-0); }
.drawer-scrim { position: fixed; inset: 0; background: rgba(3, 5, 8, .55); z-index: 80; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 440px; max-width: 100%; background: var(--bg-1); border-left: 1px solid var(--line); z-index: 81; display: flex; flex-direction: column; animation: vx-drawer .2s ease both; }
@keyframes vx-drawer { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1 1 auto; }
.drawer-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; margin: 0; }
.kv:last-child { border-bottom: 0; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; color: var(--text-0); text-align: right; }
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 96px; gap: 14px; align-items: center; font-size: 12.5px; }
.bar-label { color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label.watch { color: var(--text-0); font-weight: 600; }
.bar-track { position: relative; height: 8px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 2px; }
.bar-value { text-align: right; white-space: nowrap; color: var(--text-1); }
.day-chart { display: flex; align-items: flex-end; gap: 7px; height: 132px; }
.day-col { flex: 1 1 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; min-width: 0; }
.day-col .b { width: 100%; border-radius: 1px; }
.day-labels { display: flex; gap: 7px; margin-top: 8px; font-size: 10px; color: var(--text-3); }
.day-labels span { flex: 1 1 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend { display: flex; gap: 16px; margin-top: 16px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.donut-key { flex: 1 1 150px; min-width: 140px; }
.donut-key .kv dd { font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .bar-row { grid-template-columns: 92px minmax(0, 1fr) 74px; gap: 10px; }
  .filter-search { flex: 1 1 100%; }
  .drawer { width: 100%; }
}
.icon-btn.on { border-color: var(--text-3); color: var(--text-0); }

/* ------------------------------ all markets ------------------------------ */
.market-controls { display: flex; gap: 12px; flex-wrap: wrap; padding: 14px 22px; border-bottom: 1px solid var(--line-soft); }
.market-search { width: 220px; height: 34px; padding: 6px 12px; }
.venues { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.venue { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; }
@media (max-width: 640px) { .market-search { width: 100%; } .market-controls { padding: 12px 16px; } }

/* ------------------------------ agents ------------------------------ */
.story-link { display: block; }
.story-link:hover .story-title { color: var(--accent); }
.story:hover .story-title { color: inherit; }
.story .story-link:hover .story-title { color: var(--accent); }
.story-actions { margin-top: 10px; display: flex; gap: 14px; }
.story-action { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--text-2); padding: 3px 0; border-bottom: 1px solid transparent; transition: color .15s, border-color .15s; }
.story-action:hover { color: var(--accent); border-bottom-color: var(--accent); }
.link-btn { color: var(--accent); font: inherit; padding: 0; margin-left: 6px; }
.agent-scrim { z-index: 90; }
.agent-drawer { z-index: 91; width: 520px; }
.agent-answer { display: flex; flex-direction: column; gap: 18px; }
.agent-summary { margin: 0; font-family: var(--font-display, "Instrument Serif", serif); font-size: 21px; line-height: 1.35; color: var(--text-0); }
.agent-facts { margin: 0; }
.agent-facts td, .agent-facts th { padding-left: 0; }
.agent-section p { margin: 6px 0 0; font-size: 13.5px; line-height: 1.65; color: var(--text-1); }
.agent-heading { display: flex; gap: 10px; align-items: center; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); }
.agent-web { font-size: 10px; letter-spacing: .06em; color: var(--accent); border: 1px solid var(--accent-dim, var(--line)); border-radius: 999px; padding: 1px 7px; }
.agent-watch { margin: 8px 0 0; padding-left: 18px; font-size: 13.5px; line-height: 1.65; color: var(--text-1); }

/* ------------------------------ chat pop-up ------------------------------ */
.chat-fab { position: fixed; right: 22px; bottom: 22px; z-index: 70; height: 46px; padding: 0 18px; border-radius: 999px; background: var(--text-0); color: var(--bg-0); font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.35); display: inline-flex; align-items: center; justify-content: center; transition: transform .15s; }
.chat-fab:hover { transform: translateY(-1px); }
.chat-fab.open { width: 46px; padding: 0; }
.chat-panel { position: fixed; right: 22px; bottom: 80px; z-index: 71; width: 400px; height: min(620px, calc(100vh - 120px)); display: flex; flex-direction: column; background: var(--bg-1); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 24px 60px rgba(0,0,0,.45); animation: fadeIn .2s ease both; overflow: hidden; }
.chat-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.chat-context { display: flex; gap: 8px; align-items: center; padding: 8px 18px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; color: var(--text-1); background: var(--bg-2); min-width: 0; }
.chat-body { flex: 1 1 auto; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.chat-empty { margin: auto 0; }
.chat-suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chat-suggest .chip { height: auto; padding: 7px 12px; text-align: left; line-height: 1.35; }
.chat-msg { max-width: 88%; font-size: 13.5px; line-height: 1.6; padding: 10px 14px; border-radius: 6px; }
.chat-msg p { margin: 0; }
.chat-msg p + p { margin-top: 8px; }
.chat-msg.me { align-self: flex-end; background: var(--bg-3); color: var(--text-0); }
.chat-msg.desk { align-self: flex-start; border: 1px solid var(--line); color: var(--text-1); }
.chat-msg.err { border-color: var(--down); }
.chat-input { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.chat-input .input { flex: 1 1 auto; }
.chat-foot { padding: 0 14px 10px; font-size: 11px; color: var(--text-3); }
@media (max-width: 640px) {
  .chat-panel { right: 0; left: 0; bottom: 0; top: 0; width: auto; height: auto; border-radius: 0; z-index: 95; }
  .chat-fab { right: 16px; bottom: 16px; }
  .chat-fab.open { display: none; }
  .chat-fab-label { display: none; }
  .chat-fab { width: 50px; height: 50px; padding: 0; }
  .agent-drawer { width: 100%; }
}

/* markets table: compact on phones */
.v-s { display: none; }
@media (max-width: 640px) {
  .v-l { display: none; } .v-s { display: inline; }
  .venues { flex-wrap: nowrap; margin-top: 3px; gap: 4px; }
  .venue { padding: 0 6px; }
  .table.markets { table-layout: fixed; }
  .table.markets th, .table.markets td { padding-left: 8px; padding-right: 10px; }
  .table.markets th.col-star, .table.markets td:first-child { width: 30px; padding-left: 10px; padding-right: 0; }
  .table.markets .col-price { width: 34%; }
  .table.markets .col-ch { width: 24%; }
  .table.markets td { font-size: 13px; white-space: nowrap; }
  .table.markets .asset { gap: 8px; }
  .table.markets .asset > div { min-width: 0; overflow: hidden; }
  .table.markets .asset-name { overflow: hidden; text-overflow: ellipsis; }
  .market-controls .seg { display: flex; flex-wrap: wrap; gap: 6px; border: 0; overflow: visible; }
  .market-controls .seg button { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; }
  .market-controls .seg button:last-child { border-right: 1px solid var(--line); }
}

/* important information footer and first-visit notice */
.site-foot { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px var(--gutter) 96px; }
.site-foot-inner { max-width: 1100px; }
.site-foot-title { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 10px; }
.site-foot p { font-size: 12.5px; line-height: 1.65; color: var(--text-2); margin: 0 0 10px; }
.risk-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60; max-width: 720px; margin: 0 auto; display: flex; gap: 16px; align-items: center; padding: 16px 18px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,.35); }
.risk-notice p { margin: 0; font-size: 13px; line-height: 1.5; color: var(--text-1); }
.risk-notice .btn { flex: 0 0 auto; }
@media (max-width: 640px) { .risk-notice { flex-direction: column; align-items: stretch; bottom: 10px; left: 10px; right: 10px; } }

/* momentum */
.range-bar { position: relative; width: 96px; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--down), var(--line) 50%, var(--up)); }
.range-bar span { position: absolute; top: -4px; width: 2px; height: 14px; border-radius: 1px; background: var(--text-0); transform: translateX(-1px); }
.mo-why { margin-top: 6px; }
.mo-label-m { display: none; font-size: 11px; font-weight: 600; margin-top: 2px; }
.mo-breadth-head { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-bottom: 12px; }
.mo-breadth-head b { color: var(--text-0); margin-left: 4px; }
.mo-breadth-head b.up { color: var(--up); } .mo-breadth-head b.down { color: var(--down); }
.breadth { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--bg-3); }
.breadth i { display: block; height: 100%; }
@media (max-width: 640px) {
  .mo-label-m { display: block; white-space: nowrap; }
  .table.momentum th, .table.momentum td { padding-left: 10px; padding-right: 10px; }
  .table.momentum td { font-size: 13px; }
  .table.momentum .asset { gap: 8px; }
}

/* stocks */
.st-sym { font-weight: 600; font-size: 13.5px; color: var(--text-0); display: flex; align-items: center; gap: 8px; }
.st-ex { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.st-name { max-width: 320px; }
.st-select { width: auto; min-width: 170px; padding: 6px 10px; font-size: 12px; }
.st-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 22px 22px 12px; }
.st-kvs { display: flex; flex-direction: column; }
.st-kv { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.st-kv:last-child { border-bottom: 0; }
.st-kv span { color: var(--text-2); }
.st-kv b { color: var(--text-0); font-weight: 500; text-align: right; }
.search-kind { font-size: 10px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin: 0 4px; }
@media (max-width: 640px) {
  .table.stocks th, .table.stocks td { padding-left: 12px; padding-right: 12px; }
  .st-name { max-width: 150px; }
  .st-head { padding: 16px 16px 8px; }
}

.risk-notice .risk-copy { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.risk-notice .risk-record { font-size: 11.5px; line-height: 1.5; color: var(--text-3); }

/* desk helpers */
.suggest-box { margin-top: 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-2); }
.helper-grid { gap: 24px; }
.helper p { margin: 8px 0 14px; }
