:root {
  --bg: #0a0e14;
  --panel: #11161e;
  --panel-2: #161d28;
  --line: #1f2937;
  --line-soft: #1a2230;
  --text: #e6edf3;
  --muted: #8b97a7;
  --accent: #60a5fa;
  --accent-soft: #3b82f6;
  --good: #22c55e;
  --good-soft: #14532d;
  --bad: #ef4444;
  --bad-soft: #5b1414;
  --warn: #f59e0b;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Top nav */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10,14,20,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px;
}
.nav .brand {
  font-weight: 700; font-size: 16px;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav .links { display: flex; gap: 14px; }
.nav .links a {
  color: var(--muted); padding: 6px 10px; border-radius: 6px;
  font-size: 13px;
}
.nav .links a:hover, .nav .links a.active { color: var(--text); background: var(--line-soft); text-decoration: none; }
.nav .user { margin-left: auto; display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: 13px; }
.nav .user .equity { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.nav .user .tick-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--good); box-shadow: 0 0 8px var(--good); }

/* Layout */
.wrap { max-width: 1500px; margin: 0 auto; padding: 18px; }
.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-side { grid-template-columns: 1fr 360px; }
@media (max-width: 900px) {
  .grid-2, .grid-3, .grid-side { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 {
  margin: 0 0 10px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  font-weight: 600;
}
.card h1 { margin: 0 0 14px; font-size: 22px; }

/* Quote ticker / table */
table.t {
  width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums;
}
table.t th, table.t td { padding: 8px 10px; text-align: right; font-size: 13px; }
table.t th:first-child, table.t td:first-child { text-align: left; }
table.t th {
  color: var(--muted); font-weight: 500; text-transform: uppercase; letter-spacing: .04em; font-size: 11px;
  border-bottom: 1px solid var(--line);
}
table.t tr { border-bottom: 1px solid var(--line-soft); }
table.t tr:last-child { border-bottom: none; }
table.t tr:hover { background: var(--panel-2); }
.up { color: var(--good); }
.down { color: var(--bad); }
.neutral { color: var(--muted); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill-up { background: var(--good-soft); color: var(--good); }
.pill-down { background: var(--bad-soft); color: var(--bad); }
.pill-flat { background: var(--line); color: var(--muted); }

button.btn {
  background: var(--accent-soft); color: white; border: none;
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600;
  cursor: pointer;
}
button.btn:hover { background: var(--accent); }
button.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
button.btn.ghost:hover { background: var(--panel-2); border-color: var(--accent); }
button.btn.danger { background: var(--bad); }
button.btn.danger:hover { background: #f87171; }
button.btn.good { background: var(--good); }
button.btn.good:hover { background: #34d399; }
button.btn:disabled { opacity: .4; cursor: not-allowed; }

input.in, select.in {
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; font-variant-numeric: tabular-nums; width: 100%;
}
input.in:focus, select.in:focus { outline: none; border-color: var(--accent); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; }
.kv .k { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.kv .v { font-weight: 600; font-variant-numeric: tabular-nums; }

.stat-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}
.stat {
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 10px; padding: 12px;
}
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.stat .value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Order ticket */
.ticket-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.ticket-grid .span-2 { grid-column: span 2; }
.ticket-grid label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: block; margin-bottom: 4px; }
.tab-bar { display: flex; gap: 4px; margin-bottom: 10px; }
.tab-bar button {
  flex: 1; background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 6px; border-radius: 6px; font-size: 12px; cursor: pointer;
}
.tab-bar button.active { background: var(--accent-soft); color: white; border-color: var(--accent-soft); }

/* Chart */
canvas.chart { width: 100%; display: block; background: var(--panel-2); border-radius: 10px; }

/* News */
.news-item { padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: 13px; }
.news-item:last-child { border-bottom: none; }
.news-item .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* AI panel */
.ai-thought {
  background: linear-gradient(135deg, #1a1d2e 0%, #161826 100%);
  border: 1px solid #2a3149;
  padding: 12px 14px; border-radius: 10px; margin-bottom: 10px;
  font-size: 13px; line-height: 1.6;
}
.ai-thought .meta { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.ai-thought .orders { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.ai-thought .order-chip {
  background: var(--panel); border: 1px solid var(--line);
  padding: 3px 8px; border-radius: 6px; font-size: 11px;
}

/* Leaderboard */
.leader-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.leader-row:last-child { border-bottom: none; }
.leader-row .rank { font-size: 18px; font-weight: 700; width: 24px; color: var(--muted); }
.leader-row.rank-1 .rank { color: #fbbf24; }
.leader-row.rank-2 .rank { color: #9ca3af; }
.leader-row.rank-3 .rank { color: #b45309; }
.leader-row .name { flex: 1; font-weight: 600; }
.leader-row .bot-tag { font-size: 10px; background: var(--line); color: var(--muted); padding: 2px 6px; border-radius: 4px; margin-left: 6px; }
.leader-row .return { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 80px; text-align: right; }
.leader-row .equity { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 100px; text-align: right; font-size: 12px; }

/* Toast / banner */
.toast {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 16px; box-shadow: var(--shadow);
  max-width: 380px;
  animation: slideIn .25s ease;
}
.toast.good { border-color: var(--good); }
.toast.bad { border-color: var(--bad); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Login modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 200; display: flex; align-items: center; justify-content: center;
}
.modal {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px; width: 360px; box-shadow: var(--shadow);
}
.modal h2 { margin-top: 0; font-size: 18px; }
.modal label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.modal input { width: 100%; margin: 6px 0 14px; }
