:root {
  --bg: #0b0e11;
  --bg-panel: #181a20;
  --bg-panel-alt: #1e2329;
  --border: #2b3139;
  --text: #eaecef;
  --text-dim: #848e9c;
  --accent: #f0b90b;
  --positive: #0ecb81;
  --negative: #f6465d;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", "Roboto Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  margin: 0;
  overflow-x: hidden;
}

.mono { font-family: var(--font-mono); }

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 20px 32px;
}

h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 0 0 12px;
}

/* Status bar */

#status-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  padding: 10px 20px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.status-left, .status-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.badge-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-dim);
}

.mode-live { background: rgba(246, 70, 93, 0.12); color: var(--negative); border-color: rgba(246, 70, 93, 0.4); }
.mode-testnet { background: rgba(240, 185, 11, 0.1); color: var(--accent); border-color: rgba(240, 185, 11, 0.35); }
.halted { background: rgba(246, 70, 93, 0.12); color: var(--negative); border-color: rgba(246, 70, 93, 0.4); }
.active { background: rgba(14, 203, 129, 0.1); color: var(--positive); border-color: rgba(14, 203, 129, 0.35); }

.pnl-meter {
  display: flex;
  align-items: center;
  gap: 10px;
}

.meter-track {
  width: 90px;
  height: 5px;
  border-radius: 3px;
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0%;
  background: var(--negative);
  transition: width 0.3s ease;
}

.meter-fill-neutral { background: var(--accent); }

.positive { color: var(--positive); }
.negative { color: var(--negative); }

/* Strategy cards */

#strategy-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin: 16px 0 20px;
}

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

.strategy-card:hover { border-color: #3a4048; }

.card-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 2px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}

.dot-active { background: var(--positive); box-shadow: 0 0 0 3px rgba(14, 203, 129, 0.15); }
.dot-flat { background: var(--text-dim); }

.strategy-card h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-sub {
  margin: 0 0 10px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
}

.card-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.stat-label {
  display: block;
  color: var(--text-dim);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.stat-value {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

/* Panels (positions, chart) */

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.table-scroll { overflow-x: auto; }

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

th, td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  color: var(--text-dim);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

th.num, td.num {
  text-align: right;
  font-family: var(--font-mono);
}

td.params {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: normal;
  overflow-wrap: break-word;
  max-width: 260px;
}

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

.side-long { color: var(--positive); font-weight: 600; }
.side-short { color: var(--negative); font-weight: 600; }

.stop-danger { color: var(--negative); font-weight: 700; }

.empty-state {
  color: var(--text-dim);
  font-size: 12px;
  margin: 4px 0 0;
}

/* Equity chart */

#chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--text-dim);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex: none;
}

#equity-chart {
  width: 100%;
  height: 420px;
}

/* Per-symbol equity chart */

#symbol-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 10px;
  font-size: 11px;
  color: var(--text-dim);
}

#symbol-equity-chart {
  width: 100%;
  height: 320px;
}
