:root {
  --bg: #0a0d0c;
  --panel: #101512;
  --panel-2: #0d1210;
  --border: #1c2622;
  --green: #22c55e;
  --green-dim: #16532f;
  --green-glow: rgba(34, 197, 94, 0.18);
  --red: #ef4444;
  --text: #e8ede9;
  --text-dim: #8b9c93;
  --text-faint: #566159;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100%;
  overflow: hidden;
}

.bg-glow {
  position: fixed;
  top: -30%;
  left: -10%;
  width: 120%;
  height: 60%;
  background: radial-gradient(ellipse at top, rgba(20, 90, 55, 0.35), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.shell {
  position: relative;
  z-index: 1;
  display: flex;
  height: 100vh;
  padding: 14px;
  gap: 14px;
}

/* Sidebar */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
  font-size: 15px;
  margin-bottom: 24px;
}
.brand span { color: var(--green); }

.welcome-title { font-size: 15px; font-weight: 600; }
.welcome-sub { font-size: 11px; color: var(--text-faint); margin-top: 4px; margin-bottom: 22px; }

.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
  padding: 0 10px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.03); color: var(--text); }
.nav-item.active {
  background: linear-gradient(180deg, rgba(34,197,94,0.16), rgba(34,197,94,0.04));
  color: var(--text);
  border: 1px solid rgba(34,197,94,0.25);
}
.nav-ico { width: 16px; text-align: center; opacity: 0.85; }

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-faint);
  padding: 10px;
  border-top: 1px solid var(--border);
}
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.status-dot.live { background: var(--green); box-shadow: 0 0 8px var(--green); }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 14px;
}

.topbar {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.breadcrumb { font-size: 13px; color: var(--text-faint); display: flex; gap: 8px; white-space: nowrap; }
.breadcrumb .active { color: var(--text); }

.search {
  flex: 1;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}
.search input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 13px;
  width: 100%;
}
.search-ico { opacity: 0.5; font-size: 12px; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
}
.badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--green);
  color: #05130a;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  min-width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.wallet {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 6px 14px;
}
.wallet-label { font-size: 10px; color: var(--text-faint); }
.wallet-value { font-size: 13px; font-weight: 600; }

.content {
  flex: 1;
  display: flex;
  gap: 14px;
  min-height: 0;
}

.col { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.chart-col { flex: 1; min-width: 0; }
.side-col { width: 340px; flex-shrink: 0; overflow-y: auto; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

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

.panel-title { font-size: 13px; font-weight: 600; color: var(--text); }

.symbol-tag {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.tf-group { display: flex; gap: 4px; }
.tf-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 7px;
  cursor: pointer;
}
.tf-btn.active { background: var(--green-dim); color: var(--text); border-color: var(--green); }

.chart-panel { flex: 1; display: flex; flex-direction: column; min-height: 300px; }
.chart-box { flex: 1; border-radius: 10px; overflow: hidden; }

.watch-panel { height: 260px; display: flex; flex-direction: column; }
.tabs { display: flex; gap: 6px; }
.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-faint);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
}
.tab-btn.active { background: var(--panel-2); color: var(--text); }
.ghost-btn {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  font-size: 11px;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
}

.watch-table { width: 100%; border-collapse: collapse; font-size: 12px; overflow-y: auto; display: block; flex: 1; }
.watch-table thead, .watch-table tbody { display: table; width: 100%; table-layout: fixed; }
.watch-table th {
  text-align: left;
  color: var(--text-faint);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  text-transform: uppercase;
}
.watch-table td { padding: 8px; border-bottom: 1px solid rgba(255,255,255,0.03); }
.watch-table tr:hover td { background: rgba(255,255,255,0.02); }
.chg-up { color: var(--green); }
.chg-down { color: var(--red); }
.sig-buy { color: var(--green); font-weight: 600; }
.sig-sell { color: var(--red); font-weight: 600; }
.sig-none { color: var(--text-faint); }

/* Order panel */
.order-tabs { display: flex; gap: 4px; background: var(--panel-2); border-radius: 8px; padding: 3px; width: 100%; }
.order-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  padding: 7px;
  border-radius: 6px;
  cursor: pointer;
}
.order-tab.active { background: var(--green-dim); color: var(--text); }

.price-box {
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 10px;
  border: 1px solid var(--border);
}
.price-box.sell { background: rgba(239,68,68,0.08); border-color: rgba(239,68,68,0.25); }
.price-box.buy { background: rgba(34,197,94,0.1); border-color: rgba(34,197,94,0.3); }
.price-label { font-size: 11px; color: var(--text-dim); }
.price-val { font-size: 20px; font-weight: 700; margin-top: 2px; }

.spread-row { font-size: 11px; color: var(--text-faint); margin-top: 10px; }

.field-row { margin-top: 14px; }
.field-row label { font-size: 11px; color: var(--text-faint); display: block; margin-bottom: 6px; }
.stepper { display: flex; align-items: center; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.stepper button {
  background: transparent; border: none; color: var(--text-dim);
  width: 32px; height: 34px; cursor: pointer; font-size: 14px;
}
.stepper input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); text-align: center; font-size: 13px;
}

.place-order-btn {
  width: 100%;
  margin-top: 16px;
  background: linear-gradient(180deg, #2fe07a, #1ea856);
  border: none;
  color: #05130a;
  font-weight: 700;
  font-size: 13px;
  padding: 12px;
  border-radius: 10px;
  cursor: pointer;
}
.place-order-btn:hover { filter: brightness(1.08); }

/* Signals */
.win-rate { font-size: 11px; color: var(--text-faint); }
.signal-list { display: flex; flex-direction: column; gap: 8px; max-height: 160px; overflow-y: auto; }
.empty-state { font-size: 12px; color: var(--text-faint); padding: 14px 4px; }
.signal-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px;
}

/* DOM */
.dom-table { display: flex; gap: 10px; }
.dom-col { flex: 1; }
.dom-head { font-size: 10px; color: var(--text-faint); text-transform: uppercase; margin-bottom: 6px; }
.dom-row { display: flex; justify-content: space-between; font-size: 11px; padding: 4px 6px; border-radius: 5px; margin-bottom: 3px; }
.dom-row.bid { background: rgba(34,197,94,0.1); }
.dom-row.ask { background: rgba(239,68,68,0.1); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Auth overlay */
.auth-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.auth-card {
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex; flex-direction: column; gap: 4px;
}
.auth-sub { font-size: 12px; color: var(--text-faint); margin: 0 0 16px; }
.auth-label { font-size: 11px; color: var(--text-dim); margin-top: 10px; margin-bottom: 6px; }
.auth-input {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; color: var(--text); font-size: 13px; outline: none;
}
.auth-input:focus { border-color: var(--green); }
.auth-error { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 8px; }
.auth-card .place-order-btn { margin-top: 14px; }

/* Alert banner */
.alert-banner {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 12px;
  display: flex; justify-content: space-between; align-items: center;
}
.alert-banner button {
  background: transparent; border: none; color: #fca5a5; cursor: pointer; font-size: 12px;
}

/* Auto-trader panel */
.switch { position: relative; display: inline-block; width: 38px; height: 21px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 20px; transition: 0.15s;
}
.switch-track::before {
  content: ""; position: absolute; height: 15px; width: 15px; left: 2px; top: 2px;
  background: var(--text-faint); border-radius: 50%; transition: 0.15s;
}
.switch input:checked + .switch-track { background: var(--green-dim); border-color: var(--green); }
.switch input:checked + .switch-track::before { transform: translateX(17px); background: var(--green); }

.auto-sub { font-size: 11px; color: var(--text-faint); line-height: 1.5; margin-bottom: 12px; }
.auto-stats { display: flex; gap: 10px; }
.auto-stats div {
  flex: 1; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px;
}
.auto-stats span { display: block; font-size: 10px; color: var(--text-faint); }
.auto-stats b { font-size: 14px; }

.positions-panel { max-height: 220px; display: flex; flex-direction: column; }
.positions-panel .signal-list { overflow-y: auto; }
.pos-item {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; margin-bottom: 8px;
}
.pos-item .pos-meta { color: var(--text-faint); font-size: 10px; margin-top: 2px; }
