:root {
  --font: "Plus Jakarta Sans Variable", "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --bg: #f3f4fa;
  --text: #141726;
  --muted: #6b7185;
  --line: rgba(20, 23, 38, 0.08);
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --glass-border: rgba(255, 255, 255, 0.75);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 18px 40px -22px rgba(36, 28, 110, 0.28), 0 2px 6px -2px rgba(36, 28, 110, 0.08);
  --accent: #4f3cc9;
  --accent-2: #7c6cf2;
  --accent-soft: rgba(79, 60, 201, 0.1);
  --up: #15803d;
  --up-soft: rgba(22, 163, 74, 0.12);
  --down: #dc2626;
  --down-soft: rgba(220, 38, 38, 0.1);
  --warn: #c2410c;
  --warn-soft: rgba(234, 88, 12, 0.12);
  --tag: rgba(20, 23, 38, 0.06);
  --grid: rgba(20, 23, 38, 0.06);
  --flow-up: 22, 163, 74;
  --flow-down: 220, 38, 38;
  --flow-accent: 79, 60, 201;
  --flow-neutral: 148, 155, 175;
  --flow-blend: source-over;
  --blob-1: #a99bff;
  --blob-2: #7de3d1;
  --blob-3: #ffb3d6;
  --blob-4: #9cc8ff;
  --blob-opacity: 0.55;
  color-scheme: light;
}

body.dark {
  --bg: #090b14;
  --text: #eef0fa;
  --muted: #9097b0;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(22, 25, 42, 0.58);
  --glass-strong: rgba(30, 34, 56, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 24px 50px -24px rgba(0, 0, 0, 0.7);
  --accent: #8b7cff;
  --accent-2: #b3a8ff;
  --accent-soft: rgba(139, 124, 255, 0.16);
  --up: #34d399;
  --up-soft: rgba(52, 211, 153, 0.14);
  --down: #f87171;
  --down-soft: rgba(248, 113, 113, 0.14);
  --warn: #fb923c;
  --warn-soft: rgba(251, 146, 60, 0.14);
  --tag: rgba(255, 255, 255, 0.07);
  --grid: rgba(255, 255, 255, 0.06);
  --flow-up: 52, 211, 153;
  --flow-down: 248, 113, 113;
  --flow-accent: 139, 124, 255;
  --flow-neutral: 120, 128, 155;
  --flow-blend: lighter;
  --blob-1: #3b2f9e;
  --blob-2: #0f5c55;
  --blob-3: #6b1f4b;
  --blob-4: #1b3d78;
  --blob-opacity: 0.5;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  transition: background-color .4s ease, color .3s ease;
}
a { color: var(--accent); }
h1, h2, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }

/* ---------- Liquid background ---------- */
.liquid-bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(90px); opacity: var(--blob-opacity); mix-blend-mode: normal;
  animation: drift 26s ease-in-out infinite alternate;
}
.b1 { background: var(--blob-1); top: -18vmax; left: -10vmax; }
.b2 { background: var(--blob-2); top: 20vh; right: -16vmax; animation-duration: 32s; animation-delay: -8s; }
.b3 { background: var(--blob-3); bottom: -22vmax; left: 18vw; animation-duration: 38s; animation-delay: -14s; }
.b4 { background: var(--blob-4); top: 45vh; left: -18vmax; width: 34vmax; height: 34vmax; animation-duration: 30s; animation-delay: -4s; }
@keyframes drift {
  0% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); border-radius: 50% 46% 54% 50%; }
  50% { transform: translate3d(6vw, 4vh, 0) scale(1.08) rotate(40deg); border-radius: 42% 58% 46% 54%; }
  100% { transform: translate3d(-4vw, 8vh, 0) scale(.94) rotate(80deg); border-radius: 56% 44% 52% 48%; }
}

.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 10px; z-index: 20;
  display: flex; align-items: center; gap: 18px;
  margin: 10px auto 0; width: min(1240px, calc(100% - 24px));
  padding: 8px 10px 8px 14px; border-radius: 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; font-size: 17px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { background: linear-gradient(135deg, var(--text) 30%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-tag { font-size: 10.5px; font-weight: 600; letter-spacing: .01em; color: var(--muted); white-space: nowrap; }
.login-tagline { color: var(--accent); font-weight: 700; margin: -2px 0 10px; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 16px -6px var(--accent);
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-mark.big { width: 48px; height: 48px; border-radius: 14px; margin-bottom: 14px; }
.brand-mark.big svg { width: 28px; height: 28px; }
.top-tabs { display: flex; gap: 2px; }
.top-tabs .tab { border: 0; background: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; color: var(--muted); cursor: pointer; }
.top-tabs .tab:hover { color: var(--text); background: var(--tag); }
.top-tabs .tab.active { color: var(--text); background: var(--glass-strong); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-button {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--line); background: var(--glass-strong); cursor: pointer;
}
.icon-button svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; }

.source-chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 650; background: var(--tag); color: var(--muted); white-space: nowrap;
}
.source-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.source-chip.ok { color: var(--up); background: var(--up-soft); }
.source-chip.ok i { background: var(--up); box-shadow: 0 0 0 0 var(--up); animation: ping 2s infinite; }
.source-chip.warn { color: var(--warn); background: var(--warn-soft); }
.source-chip.warn i { background: var(--warn); }
.source-chip.err { color: var(--down); background: var(--down-soft); }
.source-chip.err i { background: var(--down); }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(var(--flow-up), .5); } 70%, 100% { box-shadow: 0 0 0 7px rgba(var(--flow-up), 0); } }

.status-pill { padding: 6px 11px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .03em; background: var(--tag); color: var(--muted); white-space: nowrap; }
.status-running { color: var(--up); background: var(--up-soft); }

/* ---------- Layout ---------- */
.shell { width: min(1240px, calc(100% - 24px)); margin: 18px auto 40px; }
.card, .hero, .login-panel { border-radius: 22px; }
.card { padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.grid-3 { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; gap: 16px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.grid-3 > .card, .grid-2-1 > .card, .grid-2 > .card, .stat-grid > .card { margin-bottom: 16px; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card-head h2 { font-size: 16px; font-weight: 750; letter-spacing: -.01em; margin-bottom: 6px; }
.tag { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 650; background: var(--tag); color: var(--muted); }
.tag.positive, .tag-up { color: var(--up); background: var(--up-soft); }
.tag.negative, .tag-down { color: var(--down); background: var(--down-soft); }
.tag-soft { color: var(--warn); background: var(--warn-soft); }
.eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.eyebrow span + span::before { content: "·"; margin-right: 8px; }
.eyebrow .market-chip::before { content: none; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.positive { color: var(--up); }
.negative { color: var(--down); }
.error-text { color: var(--down); font-weight: 600; margin-top: 8px; }
.alert-note { color: var(--warn); background: var(--warn-soft); padding: 8px 12px; border-radius: 12px; font-size: 12.5px; margin-top: 10px; }
.empty-state { color: var(--muted); padding: 22px; text-align: center; border: 1px dashed var(--line); border-radius: 16px; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 24px; align-items: center; padding: 24px 26px; margin-bottom: 16px; }
.hero h1 { font-size: clamp(22px, 2.6vw, 30px); line-height: 1.18; font-weight: 800; letter-spacing: -.025em; margin: 12px 0 10px; max-width: 22ch; }
.hero-story { color: var(--muted); font-size: 14.5px; max-width: 52ch; }
.market-chip { padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; font-size: 11px; background: var(--tag); }
.market-chip.open { color: var(--up); background: var(--up-soft); }
.market-chip.closed { color: var(--warn); background: var(--warn-soft); }
.hero-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.mini-tile { background: var(--glass-strong); border: 1px solid var(--line); border-radius: 16px; padding: 12px; min-width: 0; }
.mini-label { display: block; color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-tile strong { display: block; font-size: 20px; font-weight: 800; letter-spacing: -.02em; margin: 4px 0 2px; }
.mini-tile small { font-size: 12px; font-weight: 650; color: var(--muted); }
.mini-tile small.positive { color: var(--up); }
.mini-tile small.negative { color: var(--down); }

.subbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 4px 0 16px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 2px; padding: 4px; border-radius: 14px; background: var(--glass); border: 1px solid var(--glass-border); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.seg .tab, .seg button { white-space: nowrap; border: 0; background: none; padding: 7px 14px; border-radius: 10px; font-weight: 650; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.seg .active { background: var(--glass-strong); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.seg-small button { padding: 5px 10px; font-size: 12.5px; }
.breadth-line { color: var(--muted); font-size: 13.5px; }
.breadth-line strong { color: var(--text); }
.breadth-line strong.positive { color: var(--up); }
.breadth-line strong.negative { color: var(--down); }
.dot-sep { display: inline-block; width: 4px; height: 4px; border-radius: 50%; background: var(--muted); margin: 0 8px 2px; opacity: .5; }
.tab-panel { animation: rise .35s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Gauges ---------- */
.gauge { position: relative; max-width: 260px; margin: 0 auto; }
.gauge svg { width: 100%; display: block; overflow: visible; }
.gauge .arc { fill: none; stroke-width: 14; stroke-linecap: round; opacity: .38; transition: opacity .4s; }
.gauge .arc.on { opacity: 1; }
.needle { transform-origin: 100px 100px; transition: transform 1.2s cubic-bezier(.34, 1.4, .64, 1); }
.needle line { stroke: var(--text); stroke-width: 3.5; stroke-linecap: round; }
.needle circle { fill: var(--glass-strong); stroke: var(--text); stroke-width: 3; }
.gauge-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: -4px; }
.gauge-score { text-align: center; margin-top: -6px; }
.gauge-score strong { font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.gauge-score span { color: var(--muted); margin-left: 3px; }
.vix-score { margin-top: 2px; }
.vix-score strong { font-size: 32px; }
.gauge-vix { margin-bottom: 10px; }
.gauge-label { font-size: 22px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 12px; }
.components { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.components li { display: grid; grid-template-columns: 1fr 70px 46px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.components b { text-align: right; font-weight: 700; }
.comp-bar { position: relative; height: 6px; border-radius: 4px; background: var(--tag); }
.comp-bar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); opacity: .4; }
.comp-bar i { position: absolute; top: 0; bottom: 0; border-radius: 4px; background: var(--muted); }
.comp-bar i.positive { background: var(--up); }
.comp-bar i.negative { background: var(--down); }

/* ---------- Index cards ---------- */
.price-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.price { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.delta { display: inline-flex; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--tag); }
.delta.positive { background: var(--up-soft); }
.delta.negative { background: var(--down-soft); }
.spark { height: 170px; margin: 10px -6px 6px; }
.spark-small { height: 90px; margin-top: 4px; }
.range-bar { margin-top: 8px; }
.range-track { display: block; position: relative; height: 6px; border-radius: 4px; background: linear-gradient(90deg, var(--down-soft), var(--tag), var(--up-soft)); }
.range-track i { position: absolute; top: -4px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: var(--accent); border: 3px solid var(--glass-strong); box-shadow: 0 2px 6px rgba(0,0,0,.2); transition: left .8s ease; }
.range-ends { display: flex; justify-content: space-between; color: var(--muted); font-size: 11.5px; margin-top: 6px; }

/* ---------- Flow ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; font-weight: 600; }
.ld { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.ld.up { background: var(--up); } .ld.down { background: var(--down); } .ld.accent { background: var(--accent); }
.link-button { border: 0; background: none; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0; }
.flow-wrap { position: relative; }
.flow-canvas { display: block; width: 100%; height: 300px; }
.flow-wrap.tall .flow-canvas { height: 560px; }
.flow-tip {
  position: absolute; z-index: 3; pointer-events: none; max-width: 260px; white-space: pre-line;
  padding: 8px 10px; border-radius: 12px; font-size: 12px; font-weight: 600;
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}

/* ---------- Sector map ---------- */
.sector-map { display: flex; flex-wrap: wrap; gap: 8px; }
.sector-block { flex: 1 1 160px; min-width: 120px; display: flex; flex-direction: column; gap: 6px; }
.sector-title { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; font-weight: 700; }
.sector-title b { font-weight: 700; }
.sector-stocks { display: flex; flex-wrap: wrap; gap: 3px; flex: 1; align-content: stretch; }
.stock-tile {
  display: flex; flex-direction: column; justify-content: center; min-height: 42px; padding: 4px 6px;
  border-radius: 8px; font-size: 11px; line-height: 1.2; overflow: hidden; cursor: default;
  transition: transform .2s ease, filter .2s ease;
}
.stock-tile:hover { transform: scale(1.04); filter: brightness(1.06); }
.stock-tile b { font-weight: 750; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stock-tile small { opacity: .85; font-weight: 600; }
.sector-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.sector-chip { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); cursor: pointer; min-width: 110px; flex: 1 1 110px; text-align: left; }
.sector-chip span { font-size: 12px; font-weight: 650; }
.sector-chip b { font-size: 15px; font-weight: 800; }

/* ---------- Money-flow stats ---------- */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat-label { color: var(--muted); font-size: 12.5px; font-weight: 650; }
.stat strong { font-size: clamp(19px, 2vw, 26px); white-space: nowrap; font-weight: 800; letter-spacing: -.03em; }
.stat small { color: var(--muted); font-size: 12px; }
.stat .tag { align-self: flex-start; }
.split-bar { display: flex; height: 6px; border-radius: 4px; overflow: hidden; gap: 2px; margin-top: auto; }
.split-bar i { display: block; height: 100%; }
.split-bar .up, .rank-bar .up { background: var(--up); }
.split-bar .down, .rank-bar .down { background: var(--down); }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rank-list li { display: grid; grid-template-columns: 110px 1fr 92px; gap: 12px; align-items: center; }
.rank-name, .rank-val { display: flex; flex-direction: column; }
.rank-name small, .rank-val small { color: var(--muted); font-size: 11.5px; }
.rank-val { text-align: right; }
.rank-val small.positive { color: var(--up); } .rank-val small.negative { color: var(--down); }
.rank-bar { height: 8px; border-radius: 6px; background: var(--tag); overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: 6px; opacity: .8; }

/* ---------- Charts ---------- */
.chart-head { flex-wrap: wrap; }
.chart-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ohlc-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12.5px; color: var(--muted); }
.ohlc-legend b { color: var(--text); font-weight: 700; }
.ohlc-legend .positive { color: var(--up); font-weight: 700; } .ohlc-legend .negative { color: var(--down); font-weight: 700; }
.symbol-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: thin; }
.chip { flex: none; border: 1px solid var(--line); background: var(--glass-strong); padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 650; cursor: pointer; color: var(--muted); }
.chip.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }
.main-chart { height: min(560px, 62vh); min-height: 320px; }
.pnl-chart { height: 260px; }

/* ---------- Controls ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--glass-strong); color: var(--text);
  padding: 9px 16px; border-radius: 12px; font-weight: 700; font-size: 13px; cursor: pointer; text-decoration: none;
  transition: transform .15s ease, box-shadow .2s ease, background .2s;
}
.button:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 18px -10px rgba(0,0,0,.35); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-primary { color: #fff; border-color: transparent; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 20px -10px var(--accent); position: relative; overflow: hidden; }
.button-primary::after { content: ""; position: absolute; inset: 0; background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.35) 50%, transparent 70%); transform: translateX(-100%); transition: transform .6s ease; }
.button-primary:hover::after { transform: translateX(100%); }
.button-danger { color: var(--down); background: var(--down-soft); border-color: transparent; }
.button-quiet { background: transparent; }
.button-small { padding: 5px 10px; font-size: 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 10px 0; }
.controls label, .login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
input, select { border: 1px solid var(--line); background: var(--glass-strong); border-radius: 12px; padding: 9px 12px; min-width: 150px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.conn-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0; border-bottom: 1px solid var(--line); }

.login-panel { max-width: 440px; margin: 9vh auto; padding: 32px; text-align: left; }
.login-panel h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; margin: 8px 0; }
.login-form { display: grid; gap: 14px; margin-top: 20px; }
.login-form input { width: 100%; }

.list { display: grid; gap: 8px; }
.list-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--tag); }
.list-row small { display: block; color: var(--muted); }
.observe-tag { margin-left: 6px; padding: 1px 6px; border-radius: 6px; font-size: 10.5px; font-weight: 700; color: var(--muted); background: var(--tag); text-transform: uppercase; letter-spacing: .04em; }
.signal-tag { padding: 3px 9px; border-radius: 8px; font-size: 11.5px; font-weight: 700; background: var(--tag); }
.signal-long { color: var(--up); background: var(--up-soft); }
.signal-short { color: var(--down); background: var(--down-soft); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 650; font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); }
/* ---------- Backtest (shadow replay) ---------- */
.bt-checks { gap: 16px; }
.bt-checks label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
.bt-checks input[type="checkbox"] { min-width: 0; width: 16px; height: 16px; padding: 0; accent-color: var(--accent); }
.bt-progress { height: 8px; border-radius: 6px; background: var(--tag); overflow: hidden; margin: 6px 0 8px; }
.bt-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .6s ease; }
.bt-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
@media (max-width: 720px) { .bt-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.bt-timer { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.bt-elapsed { font-size: 22px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.scan-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); opacity: .45; flex: none; }
.scan-dot.on { background: var(--up); opacity: 1; animation: scan-pulse 1.2s ease-in-out infinite; }
@keyframes scan-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(22,163,74,.55); } 50% { box-shadow: 0 0 0 7px rgba(22,163,74,0); } }
.scan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.scan-panel { border: 1px solid var(--line); border-radius: 16px; padding: 12px 14px; background: var(--glass-strong); }
.scan-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 4px; }
.scan-agents { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 7px; }
.scan-agents li { display: grid; grid-template-columns: 118px 74px 1fr; gap: 8px; align-items: start; font-size: 12.5px; }
.scan-agents small { color: var(--muted); line-height: 1.35; }
.scan-agent { font-weight: 650; }
.scan-decision { margin: 6px 0 0; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 12.5px; font-weight: 600; }
.scan-feed-title { font-size: 13px; margin: 16px 0 8px; color: var(--muted); }
.scan-feed { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow-y: auto; display: grid; gap: 4px; font-size: 12.5px; }
.scan-feed li { display: grid; grid-template-columns: 112px 150px 1fr; gap: 8px; padding: 5px 8px; border-radius: 8px; }
.scan-feed li.order { background: var(--accent-soft); }
.scan-feed li.fill { background: var(--tag); }
.scan-feed li.exit-up { background: var(--up-soft); }
.scan-feed li.exit-down { background: var(--down-soft); }
.scan-time { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .scan-agents li { grid-template-columns: 1fr auto; }
  .scan-agents small { grid-column: 1 / -1; }
  .scan-feed li { grid-template-columns: 1fr; gap: 2px; }
}
.weights-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px 24px; }
.weight-row { display: grid; grid-template-columns: 1fr 1.2fr 34px; gap: 10px; align-items: center; font-size: 12.5px; }
.weight-row input { min-width: 0; padding: 0; accent-color: var(--accent); }
.weight-value { text-align: right; font-weight: 700; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 12px; padding: 8px 4px 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-3 > .card:first-child { grid-column: 1 / -1; }
  .hero { grid-template-columns: 1fr; }
  .top-tabs { display: none; }
}
@media (max-width: 820px) {
  .grid-3, .grid-2-1, .grid-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .hero-tiles { grid-template-columns: 1fr 1fr; }
  .topbar .status-pill { display: none; }
  .brand-tag { display: none; }
}
@media (max-width: 520px) {
  .shell, .topbar { width: calc(100% - 32px); }
  .card { padding: 16px; }
  .hero { padding: 18px; }
  .stat-grid { grid-template-columns: 1fr; }
  .source-chip span { display: none; }
  .topbar .source-chip { padding: 8px; }
  .rank-list li { grid-template-columns: 90px 1fr 80px; }
  .flow-wrap.tall .flow-canvas { height: 640px; }
  .seg .tab { padding: 7px 10px; }
  .subbar .seg { width: 100%; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .blob, .tab-panel, .source-chip.ok i { animation: none; }
  .needle, .range-track i { transition: none; }
}
