* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #000000;
  --bg-1: #0e0e10;
  --bg-2: #16161a;
  --bg-3: #1d1d23;
  --border: #25252e;
  --border-2: #34343f;
  --text: #f5f5f7;
  --text-dim: #8e8e98;
  --text-faint: #5a5a64;
  --green: #00c805;
  --green-soft: rgba(0, 200, 5, 0.1);
  --red: #ff5000;
  --red-soft: rgba(255, 80, 0, 0.1);
  --yellow: #f0b90b;
  --blue: #4a8df1;
  --accent: #00c805;
  --shadow: rgba(0, 0, 0, 0.5);
}

body.light-mode {
  --bg: #d4d4d8;
  --bg-1: #c8c8cc;
  --bg-2: #bcbcc0;
  --bg-3: #b0b0b4;
  --border: #9a9a9e;
  --border-2: #7f7f83;
  --text: #2a2a2c;
  --text-dim: #5a5a5e;
  --text-faint: #82828a;
  --green: #1a7f25;
  --green-soft: rgba(26, 127, 37, 0.10);
  --red: #c43500;
  --red-soft: rgba(196, 53, 0, 0.10);
  --yellow: #a87500;
  --blue: #1d4ed8;
  --accent: #1a7f25;
  --shadow: rgba(0, 0, 0, 0.12);
}

/* Light mode chart tooltip override (set inline via JS, but baseline here) */
body.light-mode .chat-bubble code {
  background: rgba(0,0,0,0.06);
  color: var(--yellow);
}

body.light-mode .ticker-tape { background: var(--bg-1); }
body.light-mode .news-card,
body.light-mode .position-card,
body.light-mode .stat-card.tier-good,
body.light-mode .stat-card.tier-warn,
body.light-mode .stat-card.tier-bad {
  background-image: none;
}
body.light-mode .stat-card.tier-good { background-color: rgba(0,160,4,0.04); }
body.light-mode .stat-card.tier-warn { background-color: rgba(200,149,0,0.05); }
body.light-mode .stat-card.tier-bad  { background-color: rgba(224,68,0,0.05); }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; }

/* ─────────── Ticker Tape ─────────── */
.ticker-tape {
  background: var(--bg-1);
  border-bottom: 1px solid var(--border);
  height: 36px;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  overflow: hidden;
}

.ticker-track {
  display: flex;
  gap: 32px;
  white-space: nowrap;
  animation: scroll-left 60s linear infinite;
  padding-left: 32px;
}

.ticker-track:hover { animation-play-state: paused; }

@keyframes scroll-left {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.ticker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-family: "SF Mono", "Monaco", monospace;
}

.ticker-symbol {
  color: var(--text);
  font-weight: 600;
}

.ticker-price {
  color: var(--text-dim);
}

.ticker-change.up { color: var(--green); }
.ticker-change.down { color: var(--red); }

.ticker-loading { color: var(--text-faint); padding: 0 16px; }

.ticker-config {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 14px;
  z-index: 10;
}

.ticker-config:hover { color: var(--text); border-color: var(--border-2); }

/* ─────────── Modal ─────────── */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.modal[hidden] { display: none; }

.modal-content {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
}

.modal-content h3 { font-size: 18px; margin-bottom: 8px; }
.modal-sub { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.modal-sub code {
  background: var(--bg-3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.modal-content input {
  width: 100%;
  padding: 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: "SF Mono", monospace;
  font-size: 14px;
}

.modal-content input:focus { outline: none; border-color: var(--accent); }

.modal-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px;
}

.btn-primary {
  background: var(--accent);
  color: #000;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 600;
}

.btn-primary:hover { opacity: 0.9; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 10px 20px;
  border-radius: 8px;
}

.btn-ghost:hover { color: var(--text); border-color: var(--border-2); }

/* ─────────── App Header ─────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
  padding: 0;
}

.theme-toggle:hover {
  background: var(--bg-3);
  border-color: var(--border-2);
  transform: scale(1.05);
}

.brand .logo { font-size: 24px; }
.brand-name { font-weight: 600; font-size: 16px; }

.brand-pun {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 13px;
  font-style: italic;
  margin-left: 2px;
}

.nav-tabs { display: flex; gap: 4px; }

.nav-tab {
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}

.nav-tab:hover { color: var(--text); background: var(--bg-2); }
.nav-tab.active { color: var(--text); background: var(--bg-3); }

.header-status { display: flex; gap: 8px; align-items: center; }

.status-pill {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  display: flex; align-items: center; gap: 6px;
}

.status-pill .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}

.status-pill.ok .dot { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-pill.bad .dot { background: var(--red); box-shadow: 0 0 6px var(--red); }

.status-pill.mode {
  background: var(--green-soft);
  color: var(--green);
  border-color: rgba(0, 200, 5, 0.3);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.status-pill.mode.live {
  background: var(--red-soft);
  color: var(--red);
  border-color: rgba(255, 80, 0, 0.3);
  animation: pulse 2s infinite;
}

@keyframes pulse { 50% { opacity: 0.55; } }

/* ─────────── Hero ─────────── */
.hero {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 32px;
  padding: 32px;
  border-bottom: 1px solid var(--border);
}

.hero-label {
  color: var(--text-dim);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.hero-value {
  font-size: 48px;
  font-weight: 700;
  font-family: "SF Pro Display", -apple-system, sans-serif;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-change {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 24px;
}

.hero-change.up { color: var(--green); }
.hero-change.down { color: var(--red); }
.hero-change span {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 14px;
  margin-left: 6px;
}

.period-selector {
  display: flex;
  gap: 4px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  width: fit-content;
}

.period-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s;
}

.period-btn:hover { color: var(--text); }
.period-btn.active {
  background: var(--bg-3);
  color: var(--text);
}

.hero-right {
  position: relative;
  height: 320px;
}

.hero-right canvas { max-height: 320px; }

.chart-controls {
  position: absolute;
  top: 0;
  right: 8px;
  z-index: 5;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  background: var(--bg-1);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
}

.toggle-row input[type="checkbox"] {
  margin: 0;
  cursor: pointer;
  accent-color: var(--accent);
}

.toggle-row:hover { color: var(--text); }

/* Trade snapshot popover */
.trade-snapshot {
  position: absolute;
  bottom: -20px;
  left: 0;
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 14px 16px;
  z-index: 6;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.trade-snapshot-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
}

.trade-snapshot-close:hover { color: var(--text); background: var(--bg-3); }

.ts-header {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: 10px;
  padding-right: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ts-header .up { color: var(--green); }
.ts-header .down { color: var(--red); }

.ts-trade {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 13px;
}

.ts-trade-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.ts-trade-head strong { font-size: 13px; font-weight: 700; }

.ts-meta {
  color: var(--text-dim);
  font-size: 11px;
  font-family: "SF Mono", monospace;
}

.ts-trade-body {
  display: flex;
  justify-content: space-between;
  font-family: "SF Mono", monospace;
  font-size: 12px;
}

.ts-trade-body .up { color: var(--green); font-weight: 600; }
.ts-trade-body .down { color: var(--red); font-weight: 600; }

/* ─────────── Stats Grid ─────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--border);
  border-bottom: 1px solid var(--border);
}

.stat-card {
  background: var(--bg);
  padding: 20px 24px;
}

.stat-label {
  color: var(--text-dim);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  font-family: "SF Mono", "Monaco", monospace;
  letter-spacing: -0.01em;
}

.stat-value.up { color: var(--green); }
.stat-value.down { color: var(--red); }

.stat-sub {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
}

.stat-sub.up { color: var(--green); }
.stat-sub.down { color: var(--red); }

/* ─────────── Stat card tier tinting ─────────── */
.stat-card {
  border-left: 3px solid transparent;
  transition: border-left-color 0.2s ease;
  position: relative;
}

.stat-card.tier-good {
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(0,200,5,0.04) 0%, var(--bg) 30%);
}

.stat-card.tier-warn {
  border-left-color: var(--yellow);
  background: linear-gradient(90deg, rgba(240,185,11,0.04) 0%, var(--bg) 30%);
}

.stat-card.tier-bad {
  border-left-color: var(--red);
  background: linear-gradient(90deg, rgba(255,80,0,0.05) 0%, var(--bg) 30%);
}

/* Tooltip: hover the card to see thresholds */
.stat-card[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 10;
}

.stat-card[data-tooltip]:hover::after { opacity: 1; }

/* ─────────── Trades Section ─────────── */
.trades-section, .risk-section {
  padding: 32px;
  border-bottom: 1px solid var(--border);
}

.trades-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}

h2 { font-size: 20px; font-weight: 700; }

.trade-tabs { display: flex; gap: 4px; }

.trade-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: flex; align-items: center; gap: 8px;
}

.trade-tab:hover { color: var(--text); border-color: var(--border-2); }
.trade-tab.active { background: var(--bg-3); color: var(--text); border-color: var(--border-2); }

.badge {
  background: var(--bg-3);
  color: var(--text-dim);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.trade-tab.active .badge { background: var(--accent); color: #000; }

.trade-pane { display: none; }
.trade-pane.active { display: block; }

/* Position cards */
.position-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.position-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  transition: all 0.15s;
}

.position-card:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.position-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 12px;
}

.position-symbol { font-size: 18px; font-weight: 700; }
.position-qty { color: var(--text-dim); font-size: 13px; }

.position-pnl { font-size: 16px; font-weight: 600; text-align: right; font-family: "SF Mono", monospace; }
.position-pnl.up { color: var(--green); }
.position-pnl.down { color: var(--red); }
.position-pnl-pct { font-size: 12px; opacity: 0.85; }

.position-prices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 16px;
  font-size: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.position-prices .row {
  display: flex; justify-content: space-between;
}

.position-prices .lbl { color: var(--text-dim); }
.position-prices .val { font-family: "SF Mono", monospace; }

/* Tables */
.table-wrap {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }

th, td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tr:last-child td { border-bottom: none; }

th {
  color: var(--text-dim);
  font-weight: 500;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-1);
}

td { font-family: "SF Mono", "Monaco", monospace; }

tbody tr:hover { background: var(--bg-2); }

.empty, .empty-state {
  text-align: center;
  color: var(--text-faint);
  padding: 48px 24px;
  font-style: italic;
  font-family: -apple-system, sans-serif;
}

.empty-state {
  background: var(--bg-1);
  border: 1px dashed var(--border);
  border-radius: 12px;
}

.up { color: var(--green); }
.down { color: var(--red); }

.side-buy { color: var(--green); font-weight: 600; }
.side-sell { color: var(--red); font-weight: 600; }

/* Risk Section */
.risk-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.risk-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}

/* ── Strategy Lab ── */
.strategy-lab-section {
  padding: 28px 32px;
  border-top: 1px solid var(--border);
}

.strategy-lab-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
}

.strategy-lab-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.strategy-lab-updated {
  font-size: 12px;
  color: var(--text-faint);
}

.strategy-lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.lab-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lab-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.lab-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.lab-version-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--bg-3);
  color: var(--text-dim);
  white-space: nowrap;
  flex-shrink: 0;
}

.lab-verdict {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  border-radius: 99px;
}

.lab-verdict.pass   { background: rgba(0,200,5,0.15); color: #00c805; }
.lab-verdict.fail   { background: rgba(224,68,0,0.15); color: #e04400; }
.lab-verdict.in-progress { background: rgba(200,149,0,0.15); color: #c89500; }
.lab-verdict.research    { background: var(--bg-3); color: var(--text-dim); }

body.light-mode .lab-verdict.pass   { background: rgba(0,140,4,0.12); color: #007a02; }
body.light-mode .lab-verdict.fail   { background: rgba(200,50,0,0.12); color: #b83000; }
body.light-mode .lab-verdict.in-progress { background: rgba(170,110,0,0.12); color: #a06800; }

.lab-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
}

.lab-meta-row {
  display: flex;
  gap: 6px;
}

.lab-meta-label {
  color: var(--text-faint);
  min-width: 80px;
  flex-shrink: 0;
}

.lab-meta-value {
  color: var(--text-dim);
}

.lab-date {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 2px;
}

@media (max-width: 800px) {
  .strategy-lab-section { padding: 20px 16px; }
  .strategy-lab-grid { grid-template-columns: 1fr; }
}

footer {
  padding: 20px 32px;
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--border);
}

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; }
  .hero-value { font-size: 36px; }
  .app-header { padding: 12px 16px; }
  .trades-section, .risk-section, .hero, .news-section { padding: 20px 16px; }
}

/* ─────────── Clock + Telegram pill ─────────── */
.clock {
  font-family: "SF Mono", "Monaco", monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.nav-asset {
  background: linear-gradient(135deg, rgba(240,185,11,0.12), rgba(240,185,11,0.04));
  border: 1px solid rgba(240,185,11,0.25);
  color: #f0b90b !important;
}
.nav-asset:hover { background: rgba(240,185,11,0.18); }

.nav-secondary {
  background: linear-gradient(135deg, rgba(74,141,241,0.10), rgba(74,141,241,0.02));
  border: 1px solid rgba(74,141,241,0.25);
  color: #4a8df1 !important;
}
.nav-secondary:hover { background: rgba(74,141,241,0.16); }

.nav-news {
  background: linear-gradient(135deg, rgba(168,85,247,0.10), rgba(168,85,247,0.02));
  border: 1px solid rgba(168,85,247,0.28);
  color: #c084fc !important;
}
.nav-news:hover { background: rgba(168,85,247,0.18); }

/* News page enhancements */
.news-list-tall { max-height: 75vh; }

.news-sources-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.news-sources-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.news-sources {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.source-pill {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text);
  text-transform: capitalize;
}

.source-pill strong {
  color: var(--accent);
  font-weight: 700;
  margin-left: 4px;
}
.source-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.source-pill.active strong {
  color: #fff;
}

.strategy-list li.muted { color: var(--text-dim); }
.strategy-list li.muted::before { color: var(--text-faint); }

.strategy-footer {
  margin-top: 24px;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-dim);
  font-size: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.back-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.back-link:hover { text-decoration: underline; }

/* Win-rate window selector */
.winrate-window, .export-window {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-family: inherit;
  margin-left: 8px;
  cursor: pointer;
}

.winrate-window:focus, .export-window:focus {
  outline: none;
  border-color: var(--accent);
}

/* Trades section actions row */
.trades-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 12px !important;
}

/* ─────────── Strategy Section ─────────── */
.strategy-section {
  padding: 32px;
  border-bottom: 1px solid var(--border);
}

.strategy-tabs { display: flex; gap: 4px; }

.strategy-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.strategy-tab:hover { color: var(--text); border-color: var(--border-2); }
.strategy-tab.active { background: var(--bg-3); color: var(--text); border-color: var(--border-2); }

.strategy-pane { display: none; }
.strategy-pane.active { display: block; }

.strategy-header-card {
  background: linear-gradient(135deg, rgba(0,200,5,0.06), rgba(0,200,5,0.01));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px 28px;
  margin-bottom: 16px;
}

.strategy-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.strategy-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.strategy-sub {
  color: var(--text-dim);
  font-size: 13px;
  margin-top: 4px;
}

.strategy-status-pill {
  background: rgba(0,200,5,0.12);
  color: var(--green);
  border: 1px solid rgba(0,200,5,0.35);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.strategy-quickstats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
}

.strategy-quickstats .qs {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.qs-label {
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.qs-value {
  font-size: 18px;
  font-weight: 700;
  font-family: "SF Mono", monospace;
  color: var(--text);
}

.strategy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 12px;
}

.strategy-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  transition: border-color 0.15s;
}

.strategy-card:hover { border-color: var(--border-2); }

.strategy-card-full { grid-column: 1 / -1; }

.strategy-card h3 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.strategy-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.strategy-list li {
  position: relative;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.strategy-list li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--accent);
  font-weight: 700;
}

ol.strategy-list {
  counter-reset: step;
}

ol.strategy-list li::before {
  counter-increment: step;
  content: counter(step) ".";
  color: var(--accent);
  font-family: "SF Mono", monospace;
  font-size: 12px;
  left: 0;
}

ol.strategy-list li {
  padding-left: 24px;
}

.strategy-list code {
  background: var(--bg-3);
  color: var(--yellow);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: "SF Mono", monospace;
}

.window-table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.window-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.win-time {
  font-family: "SF Mono", monospace;
  font-size: 12px;
  color: var(--text);
  font-weight: 600;
}

.win-label {
  font-size: 12px;
  font-weight: 500;
}

.win-good { color: var(--green); }
.win-mid { color: var(--yellow); }
.win-bad { color: var(--red); }

.strategy-empty {
  background: var(--bg-1);
  border: 1px dashed var(--border-2);
  border-radius: 12px;
  padding: 56px 32px;
  text-align: center;
}

.strategy-empty-emoji {
  font-size: 56px;
  margin-bottom: 16px;
}

.strategy-empty h3 {
  font-size: 18px;
  margin-bottom: 8px;
  color: var(--text);
}

.strategy-empty p {
  color: var(--text-dim);
  font-size: 13px;
  margin-bottom: 8px;
}

.strategy-empty-sub {
  margin-top: 20px;
  color: var(--text-dim);
}

.strategy-empty-checklist {
  list-style: none;
  padding: 0;
  margin: 16px auto;
  max-width: 380px;
  text-align: left;
}

.strategy-empty-checklist li {
  position: relative;
  padding: 6px 0 6px 24px;
  color: var(--text);
  font-size: 13px;
}

.strategy-empty-checklist li::before {
  content: "☐";
  position: absolute;
  left: 0;
  color: var(--text-dim);
}

/* ─────────── News Section ─────────── */
.news-section {
  padding: 32px;
  border-bottom: 1px solid var(--border);
}

.news-tabs {
  display: flex;
  gap: 4px;
}

.news-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
}

.news-tab:hover { color: var(--text); border-color: var(--border-2); }
.news-tab.active { background: var(--bg-3); color: var(--text); border-color: var(--border-2); }

.news-pane { display: none; }
.news-pane.active { display: block; }

.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 560px; /* ~5 cards visible, then scroll */
  overflow-y: auto;
  padding-right: 4px;
}

/* Subtle scrollbar */
.news-list::-webkit-scrollbar { width: 8px; }
.news-list::-webkit-scrollbar-track { background: transparent; }
.news-list::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}
.news-list::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

.news-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: start;
  transition: border-color 0.15s, transform 0.1s;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

/* Tier bubble column */
.news-tier-col {
  display: flex;
  align-items: center;
  height: 100%;
  padding-top: 2px;
}

.news-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: help;
}

.news-tier-must {
  background: rgba(0, 200, 5, 0.12);
  color: var(--green);
  border: 1px solid rgba(0, 200, 5, 0.35);
}

.news-tier-nice {
  background: rgba(240, 185, 11, 0.12);
  color: var(--yellow);
  border: 1px solid rgba(240, 185, 11, 0.35);
}

.news-tier-general {
  background: rgba(138, 138, 150, 0.1);
  color: var(--text-dim);
  border: 1px solid rgba(138, 138, 150, 0.25);
}

.news-card:hover {
  border-color: var(--border-2);
  transform: translateY(-1px);
}

.news-headline {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.4;
}

.news-summary {
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
}

.news-symbols {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.news-sym-pill {
  background: var(--bg-3);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  font-family: "SF Mono", monospace;
}

.news-source {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 10px;
}

/* ─────────── AI Chat ─────────── */
.chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, #00c805, #00a004);
  color: #000;
  border: none;
  padding: 14px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 24px rgba(0, 200, 5, 0.35);
  z-index: 50;
  transition: transform 0.15s, box-shadow 0.15s;
}

.chat-toggle:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(0, 200, 5, 0.5);
}

.chat-toggle-icon { font-size: 18px; }

.chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 200;
}

.chat-backdrop.show {
  opacity: 1;
  pointer-events: auto;
}

.chat-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  max-width: 100%;
  height: 100vh;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 300;
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}

.chat-panel.open { transform: translateX(0); }

.chat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-title-icon {
  font-size: 22px;
  background: var(--bg-3);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.chat-title-name {
  font-weight: 600;
  font-size: 15px;
}

.chat-title-sub {
  color: var(--text-dim);
  font-size: 12px;
}

.chat-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
}

.chat-close:hover {
  color: var(--text);
  background: var(--bg-3);
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-welcome {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-dim);
}

.chat-welcome-emoji {
  font-size: 48px;
  margin-bottom: 12px;
}

.chat-welcome h3 {
  color: var(--text);
  font-size: 18px;
  margin-bottom: 8px;
}

.chat-welcome p {
  font-size: 13px;
  margin-bottom: 24px;
  line-height: 1.6;
}

.chat-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.quick-prompt {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.quick-prompt:hover {
  background: var(--bg-3);
  border-color: var(--accent);
  color: var(--text);
}

.chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 90%;
}

.chat-msg-user { align-self: flex-end; }
.chat-msg-assistant { align-self: flex-start; }

.chat-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.chat-msg-user .chat-bubble {
  background: var(--accent);
  color: #000;
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant .chat-bubble {
  background: var(--bg-3);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-bubble p { margin: 0 0 8px 0; }
.chat-bubble p:last-child { margin: 0; }

.chat-bubble strong { font-weight: 700; }
.chat-bubble em { font-style: italic; }

.chat-bubble code {
  background: rgba(0,0,0,0.4);
  color: #f0b90b;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: "SF Mono", monospace;
  font-size: 12px;
}

.chat-msg-user .chat-bubble code {
  background: rgba(0,0,0,0.2);
  color: #000;
}

.chat-bubble pre {
  background: var(--bg);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 8px 0;
}

.chat-bubble pre code {
  background: transparent;
  color: var(--text);
  padding: 0;
}

.chat-bubble ul {
  margin: 8px 0;
  padding-left: 20px;
}

.chat-bubble li { margin: 4px 0; }

.chat-typing {
  display: flex;
  gap: 4px;
  padding: 4px 0;
}

.chat-typing span {
  width: 8px;
  height: 8px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: chat-typing 1.4s infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chat-typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.chat-input-area {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-1);
}

#chat-input {
  flex: 1;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  line-height: 1.4;
  max-height: 160px;
  min-height: 40px;
  transition: border-color 0.15s;
}

#chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

#chat-input:disabled { opacity: 0.5; }

.chat-send {
  background: var(--accent);
  color: #000;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s, transform 0.15s;
}

.chat-send:hover:not(:disabled) { transform: scale(1.05); }
.chat-send:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 600px) {
  .chat-panel { width: 100%; }
  .chat-toggle-label { display: none; }
  .chat-toggle { padding: 14px; }
}

/* ── Economic Calendar ─────────────────────────────────────────── */
.news-main-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.5rem;
  align-items: start;
  padding: 0 1rem 1rem;
}
@media (max-width: 900px) {
  .news-main-layout { grid-template-columns: 1fr; }
}
.news-right-col { min-width: 0; }

.econ-calendar-panel {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  position: sticky;
  top: 72px;
}

.econ-cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}
.cal-month-label {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}
.cal-nav-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.cal-nav-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 0.5rem;
}
.cal-dow {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 2px 0 4px;
}
.cal-day {
  border-radius: 6px;
  padding: 3px 2px 2px;
  min-height: 38px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 0.1s;
  position: relative;
}
.cal-day:hover { background: var(--bg-2); }
.cal-day-empty { cursor: default; }
.cal-day-empty:hover { background: transparent; }
.cal-day-num {
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}
.cal-weekend .cal-day-num { color: var(--text-muted); }
.cal-today { background: var(--accent) !important; border-radius: 6px; }
.cal-today .cal-day-num { color: #fff !important; font-weight: 700; }
.cal-selected { background: var(--bg-2); outline: 2px solid var(--accent); }
.cal-has-events .cal-day-num { font-weight: 700; }

.cal-dots {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 2px;
}
.cal-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}
.cal-leg-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: var(--text-muted);
}
.cal-leg-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.cal-events-panel {
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-event-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 6px;
  background: var(--bg-2);
  font-size: 11px;
  color: var(--text);
}
.cal-event-past { opacity: 0.45; }
.cal-event-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-event-date {
  color: var(--text-muted);
  font-size: 10px;
  flex-shrink: 0;
  width: 28px;
}
.cal-event-emoji { flex-shrink: 0; }
.cal-event-name { flex: 1; }
.cal-event-tag {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  flex-shrink: 0;
}
.cal-panel-empty {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

/* ── Calendar mobile toggle ─────────────────────────────────────── */
.cal-mobile-toggle {
  display: none;
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  margin-bottom: 0.75rem;
}
.cal-mobile-toggle:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 900px) {
  .cal-mobile-toggle { display: block; }
  .econ-calendar-panel {
    display: none;
    position: static;
    margin-bottom: 1rem;
  }
  .econ-calendar-panel.cal-mobile-open { display: block; }
}

/* ── Header menu dropdown ───────────────────────────────────────── */
.header-menu-wrap {
  position: relative;
}
.header-menu-btn {
  background: var(--bg-2);
  border: 1px solid var(--border);
  color: var(--text);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.header-menu-btn:hover,
.header-menu-btn[aria-expanded="true"] {
  background: var(--bg-3);
  border-color: var(--border-2);
}
.header-menu-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 24px var(--shadow);
  min-width: 160px;
  z-index: 500;
  overflow: hidden;
  padding: 4px;
}
.header-menu-dropdown.open { display: block; }
.header-menu-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 7px;
  cursor: pointer;
  text-align: left;
  transition: background 0.1s;
}
.header-menu-dropdown button:hover { background: var(--bg-3); }
.menu-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 8px;
}
