/* Dark trading dashboard theme */
:root {
  --bg: #0d0f14;
  --surface: #161a22;
  --surface2: #1e2430;
  --border: #2a3040;
  --text: #e2e8f0;
  --text-muted: #8892a4;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --yellow: #f59e0b;
  --purple: #a855f7;
  --radius: 8px;
  --font: 'Inter', system-ui, sans-serif;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--blue); text-decoration: none; }

/* ── Layout ─────────────────────────────────────────────── */
.wrapper { max-width: 1400px; margin: 0 auto; padding: 0 20px 40px; }

/* ── Header ─────────────────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

header h1 { font-size: 18px; font-weight: 600; letter-spacing: 0.02em; }
header h1 span { color: var(--blue); }

.header-right { display: flex; align-items: center; gap: 20px; }

.status-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-badge.running { background: rgba(34,197,94,.15); color: var(--green); }
.status-badge.stopped { background: rgba(239,68,68,.15); color: var(--red); }
.status-badge.unknown  { background: rgba(248,250,252,.08); color: var(--text-muted); }

.status-badge .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.running .dot { animation: pulse 1.5s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .3; }
}

.last-cycle { font-size: 12px; color: var(--text-muted); }

/* ── Metric cards ────────────────────────────────────────── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

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

.card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
}

.card-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral  { color: var(--text); }

/* ── Chart ───────────────────────────────────────────────── */
.chart-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
}

.chart-card h2 { font-size: 14px; font-weight: 600; margin-bottom: 16px; color: var(--text-muted); }
.chart-wrapper { position: relative; height: 220px; }

/* ── Two-column grid ─────────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

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

.panel h2 { font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ── Agent status ────────────────────────────────────────── */
.agent-list { display: flex; flex-direction: column; gap: 8px; }

.agent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 6px;
}

.agent-name { font-weight: 500; font-size: 13px; }
.agent-detail { font-size: 12px; color: var(--text-muted); }

.signal-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.signal-pill.buy    { background: rgba(34,197,94,.15);  color: var(--green); }
.signal-pill.sell   { background: rgba(239,68,68,.15);  color: var(--red);   }
.signal-pill.hold   { background: rgba(148,163,184,.1); color: var(--text-muted); }
.signal-pill.market { background: rgba(59,130,246,.15); color: var(--blue);  }

/* ── Fibonacci levels ────────────────────────────────────── */
.fib-symbol-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.tab-btn {
  padding: 4px 12px;
  border-radius: 4px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all .15s;
}
.tab-btn.active, .tab-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.fib-levels { display: flex; flex-direction: column; gap: 6px; }

.fib-row {
  display: grid;
  grid-template-columns: 48px 1fr 80px;
  align-items: center;
  gap: 8px;
}

.fib-label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.fib-bar-wrap { background: var(--surface2); border-radius: 3px; height: 8px; overflow: hidden; }
.fib-bar { height: 100%; border-radius: 3px; background: var(--blue); transition: width .4s; }
.fib-bar.touched { background: var(--yellow); }
.fib-price { font-size: 11px; text-align: right; color: var(--text-muted); }

.fib-meta { font-size: 11px; color: var(--text-muted); margin-top: 10px; }
.fib-meta span { color: var(--text); font-weight: 600; }

/* ── Trades table ────────────────────────────────────────── */
.trades-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

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

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

table { width: 100%; border-collapse: collapse; font-size: 12px; }
th {
  text-align: left;
  padding: 8px 10px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 9px 10px;
  border-bottom: 1px solid rgba(42,48,64,.6);
  white-space: nowrap;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

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

.status-open   { color: var(--yellow); }
.status-closed { color: var(--text-muted); }

/* ── Refresh notice ─────────────────────────────────────── */
.footer {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 24px;
}

.run-now-btn {
  padding: 4px 12px;
  border-radius: 4px;
  background: var(--blue);
  border: 1px solid var(--blue);
  color: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: opacity .15s;
}
.run-now-btn:hover { opacity: .8; }
.run-now-btn:disabled { opacity: .4; cursor: not-allowed; }
