/* AURA - Terminal/Bloomberg aesthetic. Default = dark. */
:root, :root[data-theme="dark"] {
  --bg-0: #07090d;
  --bg-1: #0b0f15;
  --bg-2: #11161f;
  --bg-3: #161c27;
  --line: #1f2632;
  --line-2: #2a3340;
  --text-0: #e7ecf3;
  --text-1: #a8b1bf;
  --text-2: #6b7585;
  --text-3: #4a5260;

  --accent: #00e0ff;
  --accent-dim: #00b3cc;
  --accent-glow: rgba(0, 224, 255, 0.18);

  --green: #4ade80;
  --green-dim: #16a34a;
  --green-bg: rgba(74, 222, 128, 0.10);
  --red: #ff5d6c;
  --red-dim: #c0394a;
  --red-bg: rgba(255, 93, 108, 0.10);
  --amber: #f5c451;
  --amber-bg: rgba(245, 196, 81, 0.10);
  --violet: #a78bfa;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --radius: 4px;
  --radius-lg: 8px;
}

:root[data-theme="light"] {
  --bg-0: #f4f6fa;
  --bg-1: #ffffff;
  --bg-2: #f7f9fc;
  --bg-3: #eef2f7;
  --line: #e3e8ef;
  --line-2: #d1d8e0;
  --text-0: #0d141c;
  --text-1: #4a5564;
  --text-2: #6b7585;
  --text-3: #98a1ad;
  --accent: #0891b2;
  --accent-dim: #06748d;
  --accent-glow: rgba(8, 145, 178, 0.14);
  --green: #16a34a;
  --green-dim: #15803d;
  --green-bg: rgba(22, 163, 74, 0.10);
  --red: #dc2626;
  --red-dim: #b91c1c;
  --red-bg: rgba(220, 38, 38, 0.08);
  --amber: #b45309;
  --amber-bg: rgba(180, 83, 9, 0.10);
  --violet: #7c3aed;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  background: var(--bg-0);
  color: var(--text-0);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid var(--bg-0); }

/* App shell */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 44px 1fr;
  height: 100vh;
}
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--bg-1);
  padding: 0 14px; gap: 18px; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; width: 206px; font-family: var(--font-mono); font-weight: 700; letter-spacing: 0.18em; font-size: 14px; color: var(--text-0); }
.brand-mark { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; box-shadow: 0 0 18px var(--accent-glow); }
.topbar-search { display: flex; align-items: center; gap: 8px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 10px; width: 320px; color: var(--text-2); font-family: var(--font-mono); font-size: 11.5px; }
.topbar-search input { background: transparent; border: 0; outline: 0; color: var(--text-0); flex: 1; font-family: var(--font-mono); font-size: 11.5px; }
.topbar-search kbd { font-family: var(--font-mono); font-size: 10px; padding: 1px 5px; border: 1px solid var(--line-2); border-radius: 3px; color: var(--text-2); }
.topbar-spacer { flex: 1; }
.market-pill { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 11px; padding: 5px 10px; border-radius: var(--radius); background: var(--bg-2); border: 1px solid var(--line); color: var(--text-1); }
.market-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2s infinite; }
.market-pill.closed .dot { background: var(--text-3); animation: none; box-shadow: none; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.icon-btn { width: 30px; height: 30px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: var(--radius); color: var(--text-1); position: relative; }
.icon-btn:hover { background: var(--bg-2); border-color: var(--line); color: var(--text-0); }
.icon-btn .badge { position: absolute; top: 4px; right: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; cursor: pointer; }
.user-chip:hover { border-color: var(--line-2); }
.user-chip .avatar { width: 22px; height: 22px; border-radius: 3px; background: linear-gradient(135deg, #6366f1, var(--accent)); display: grid; place-items: center; color: #001018; font-weight: 700; font-size: 10px; font-family: var(--font-mono); }

/* Sidebar */
.sidebar { border-right: 1px solid var(--line); background: var(--bg-1); display: flex; flex-direction: column; overflow-y: auto; }
.nav-section { padding: 12px 10px 4px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 14px; margin: 1px 6px; border-radius: var(--radius); color: var(--text-1); font-size: 12.5px; cursor: pointer; border: 1px solid transparent; position: relative; }
.nav-item:hover { background: var(--bg-2); color: var(--text-0); }
.nav-item.active { background: var(--bg-2); color: var(--text-0); border-color: var(--line); }
.nav-item.active::before { content: ""; position: absolute; left: -6px; top: 6px; bottom: 6px; width: 2px; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.nav-item svg { width: 14px; height: 14px; opacity: 0.8; }
.nav-item .count { margin-left: auto; font-family: var(--font-mono); font-size: 10px; color: var(--text-2); padding: 1px 5px; background: var(--bg-3); border-radius: 3px; }
.sidebar-footer { margin-top: auto; padding: 10px; border-top: 1px solid var(--line); background: var(--bg-1); }
.mini-stat { display: flex; justify-content: space-between; align-items: baseline; padding: 4px 6px; font-size: 11px; }
.mini-stat .label { color: var(--text-2); font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; }
.mini-stat .val { font-family: var(--font-mono); color: var(--text-0); font-weight: 600; }
.mini-stat .val.pos { color: var(--green); }

/* Main */
.main { overflow-y: auto; padding: 0; }
.page-header { padding: 18px 24px 12px; border-bottom: 1px solid var(--line); background: var(--bg-1); position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 16px; }
.page-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-0); margin: 0; }
.page-subtitle { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.12em; margin-top: 2px; }
.page-content { padding: 16px 24px 40px; }

/* Cards & panels */
.panel { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, rgba(255,255,255,0.015), transparent); }
.panel-title { font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-1); display: flex; align-items: center; gap: 8px; }
.panel-title .live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); animation: pulse 2s infinite; }

/* Stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; position: relative; overflow: hidden; }
.stat::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--line-2); }
.stat.pos::before { background: var(--green); }
.stat.neg::before { background: var(--red); }
.stat.accent::before { background: var(--accent); }
.stat-label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-2); display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.stat-label svg { width: 12px; height: 12px; opacity: 0.6; }
.stat-value { font-family: var(--font-mono); font-size: 26px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-0); font-variant-numeric: tabular-nums; }
.stat-value .currency { color: var(--text-2); margin-right: 4px; font-weight: 400; }
.stat-meta { margin-top: 6px; display: flex; align-items: center; justify-content: space-between; font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }
.stat-change { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.stat-change.pos { color: var(--green); }
.stat-change.neg { color: var(--red); }
.stat-spark { height: 28px; margin-top: 4px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; font-family: var(--font-mono); font-size: 12px; }
.tbl thead th { text-align: left; padding: 10px 12px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-2); font-weight: 600; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.tbl tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text-1); font-variant-numeric: tabular-nums; }
.tbl tbody tr:hover td { background: rgba(255,255,255,0.02); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl .sym { color: var(--text-0); font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; border: 1px solid currentColor; }
.pill.buy { color: var(--green); background: var(--green-bg); border-color: rgba(74,222,128,0.3); }
.pill.sell { color: var(--red); background: var(--red-bg); border-color: rgba(255,93,108,0.3); }
.pill.neutral { color: var(--text-2); border-color: var(--line-2); background: var(--bg-2); }
.pos { color: var(--green); }
.neg { color: var(--red); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; background: var(--bg-2); color: var(--text-0); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 7px 12px; font-size: 12px; font-weight: 500; font-family: var(--font-sans); transition: all 0.12s; }
.btn:hover { background: var(--bg-3); border-color: #3a4453; }
.btn svg { width: 13px; height: 13px; }
.btn.primary { background: var(--accent); color: #001018; border-color: var(--accent); }
.btn.primary:hover { box-shadow: 0 0 18px var(--accent-glow); }
.btn.danger { background: var(--red-bg); color: var(--red); border-color: rgba(255,93,108,0.3); }
.btn.danger:hover { background: rgba(255,93,108,0.18); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-1); }
.btn.ghost:hover { background: var(--bg-2); color: var(--text-0); }
.btn.sm { padding: 4px 8px; font-size: 11px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Banner */
.banner { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--bg-1); font-size: 12px; color: var(--text-1); }
.banner.warn { background: var(--amber-bg); border-color: rgba(245,196,81,0.25); color: #f0d28a; }
.banner.info { background: var(--accent-glow); border-color: rgba(0,224,255,0.25); color: #9be8f7; }
.banner .x { margin-left: auto; cursor: pointer; opacity: 0.5; }

/* Layout helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.col { display: flex; flex-direction: column; gap: 14px; }
.between { justify-content: space-between; }

/* Bot status block */
.bot-control { display: flex; align-items: stretch; gap: 0; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 18px; }
.bot-status { display: flex; align-items: center; gap: 14px; flex: 1; }
.bot-status .lamp { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(74,222,128,0.4), transparent 70%); }
.bot-status .lamp .core { width: 14px; height: 14px; border-radius: 50%; background: var(--green); box-shadow: 0 0 14px var(--green); }
.bot-status.off .lamp .core { background: var(--text-3); box-shadow: none; }
.bot-status.off .lamp { background: transparent; }
.bot-status .meta { display: flex; flex-direction: column; gap: 2px; }
.bot-status .label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--text-2); }
.bot-status .name { font-size: 16px; font-weight: 600; color: var(--text-0); display: flex; align-items: center; gap: 8px; }
.bot-status .acct { font-family: var(--font-mono); font-size: 11px; color: var(--text-2); }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tab { background: transparent; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; font-family: var(--font-mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-2); }
.tab:hover { color: var(--text-1); }
.tab.active { color: var(--accent); border-color: var(--accent); }

/* Form */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field label { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--text-2); }
.field input, .field select { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); color: var(--text-0); padding: 8px 10px; font-size: 13px; font-family: var(--font-mono); }
.field input:focus, .field select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Slider */
.slider-wrap { display: flex; align-items: center; gap: 12px; }
.slider-wrap .val { font-family: var(--font-mono); font-size: 12px; color: var(--accent); width: 56px; text-align: right; }
input[type="range"].slider { -webkit-appearance: none; appearance: none; flex: 1; height: 4px; border-radius: 4px; background: var(--bg-3); outline: none; }
input[type="range"].slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 0 8px var(--accent-glow); cursor: pointer; }

/* Activity feed */
.feed { display: flex; flex-direction: column; }
.feed-item { display: grid; grid-template-columns: 60px 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.feed-item:last-child { border-bottom: 0; }
.feed-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); }
.feed-msg { color: var(--text-1); }
.feed-amt { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }

/* Key-value list */
.kv { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 14px; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text-2); }
.kv .v { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-0); font-weight: 500; }

/* Toggle */
.toggle { position: relative; width: 32px; height: 18px; background: var(--bg-3); border-radius: 10px; cursor: pointer; border: 1px solid var(--line-2); transition: background 0.15s; }
.toggle::after { content: ""; position: absolute; left: 2px; top: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--text-2); transition: all 0.15s; }
.toggle.on { background: var(--accent); border-color: var(--accent); }
.toggle.on::after { left: 16px; background: #001018; }

/* Account card */
.acct-card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.acct-card.default { border-color: rgba(0,224,255,0.3); }
.acct-card.default::before { content: "DEFAULT"; position: absolute; top: 12px; right: 12px; font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.16em; color: var(--accent); padding: 2px 6px; background: var(--accent-glow); border-radius: 3px; }

/* Landing */
.landing-hero { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(ellipse at 20% 0%, rgba(99,102,241,0.18), transparent 50%), radial-gradient(ellipse at 80% 100%, rgba(0,224,255,0.14), transparent 50%), var(--bg-0); position: relative; overflow: hidden; }
.landing-hero::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px); background-size: 48px 48px; pointer-events: none; }

/* Auth pages */
.auth-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(ellipse at 30% 0%, rgba(99,102,241,0.15), transparent 50%), radial-gradient(ellipse at 70% 100%, rgba(0,224,255,0.12), transparent 50%), var(--bg-0); }
.auth-card { width: 420px; max-width: 92vw; background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; box-shadow: 0 24px 60px rgba(0,0,0,0.4); }
.auth-card h2 { margin: 0 0 4px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.auth-card .sub { margin: 0 0 24px; color: var(--text-2); font-size: 12px; font-family: var(--font-mono); }
.auth-divider { display: flex; align-items: center; gap: 12px; margin: 16px 0; font-size: 11px; color: var(--text-3); font-family: var(--font-mono); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.google-btn { width: 100%; display: flex; justify-content: center; align-items: center; gap: 10px; padding: 9px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--radius); font-size: 13px; color: var(--text-0); margin-bottom: 4px; transition: all 0.12s; }
.google-btn:hover { background: var(--bg-3); }
.auth-footer { margin-top: 18px; text-align: center; font-size: 12px; color: var(--text-2); }
.auth-footer a { color: var(--accent); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }
.auth-error { background: var(--red-bg); border: 1px solid rgba(255,93,108,0.3); border-radius: var(--radius); padding: 8px 12px; font-size: 12px; color: var(--red); margin-bottom: 14px; font-family: var(--font-mono); }

/* Tape ticker */
.tape { display: flex; gap: 24px; padding: 6px 14px; background: var(--bg-1); border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; overflow: hidden; }
.tape-track { display: flex; gap: 28px; animation: scroll 80s linear infinite; }
@keyframes scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tape-item { display: inline-flex; gap: 6px; align-items: center; }
.tape-item .s { color: var(--text-2); }
.tape-item .p { color: var(--text-0); }

/* Heatmap */
.heatmap { display: grid; grid-template-columns: 60px repeat(24, 1fr); gap: 2px; font-family: var(--font-mono); font-size: 9px; }
.heatmap .lbl { color: var(--text-3); padding: 3px 4px; text-transform: uppercase; letter-spacing: 0.1em; }
.heatmap .cell { aspect-ratio: 1; border-radius: 2px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: grid; place-items: center; z-index: 100; }
.modal { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--radius-lg); width: 420px; max-width: 90vw; padding: 22px; }
.modal h3 { margin: 0 0 8px; font-size: 16px; }
.modal p { margin: 0 0 16px; color: var(--text-1); font-size: 13px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Toast */
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--bg-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 10px 14px; font-size: 12px; color: var(--text-0); box-shadow: 0 8px 30px rgba(0,0,0,0.4); z-index: 50; animation: slideIn 0.2s ease-out; }
.toast.error { border-left-color: var(--red); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Signal feed (signals page) */
.signal-feed { display: flex; flex-direction: column; }
.signal-item { display: grid; grid-template-columns: 70px 60px 1fr auto; gap: 12px; align-items: start; padding: 12px 14px; border-bottom: 1px solid var(--line); font-size: 12px; }
.signal-item:last-child { border-bottom: 0; }
.signal-reasoning { color: var(--text-1); line-height: 1.5; }
