/* TradingBot Dashboard — dark theme */
:root {
  --bg:       #0f172a;
  --surface:  #1e293b;
  --border:   #334155;
  --text:     #e2e8f0;
  --muted:    #94a3b8;
  --green:    #4ade80;
  --red:      #f87171;
  --yellow:   #fbbf24;
  --blue:     #60a5fa;
  --radius:   8px;
  --font:     'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}

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

/* ---- Auth pages ---- */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 380px;
}
.auth-card-wide { max-width: 480px; }

.auth-logo { text-align: center; margin-bottom: 2rem; }
.logo-icon { font-size: 2rem; }
.auth-logo h1 { font-size: 1.5rem; font-weight: 700; margin-top: 0.5rem; }
.auth-subtitle { color: var(--muted); margin-top: 0.25rem; font-size: 0.875rem; }

.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.35rem; font-size: 0.875rem; color: var(--muted); }
.form-group input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}
.form-group input:focus { border-color: var(--blue); }

.btn-primary {
  padding: 0.65rem 1.25rem;
  background: var(--blue);
  color: #0f172a;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.btn-primary:hover { opacity: 0.85; }
.btn-full { width: 100%; margin-top: 0.5rem; }

.alert { padding: 0.65rem 0.9rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: 0.875rem; }
.alert-error { background: rgba(248,113,113,0.15); border: 1px solid var(--red); color: var(--red); }

.auth-footer { text-align: center; margin-top: 1rem; color: var(--muted); font-size: 0.8rem; }

.qr-wrapper {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem;
}
.qr-wrapper svg { width: 200px; height: 200px; }

.secret-reveal { margin: 0.5rem 0 1rem; color: var(--muted); font-size: 0.8rem; cursor: pointer; }
.totp-secret {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem;
  font-size: 0.85rem;
  word-break: break-all;
  margin-top: 0.4rem;
  letter-spacing: 0.05em;
}

/* ---- Dashboard ---- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav-brand { font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }
.topnav-right { display: flex; align-items: center; gap: 0.75rem; }
.nav-user { color: var(--muted); font-size: 0.85rem; }
.nav-logout { font-size: 0.85rem; color: var(--muted); }

.badge {
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.badge-paper { background: rgba(251,191,36,0.15); color: var(--yellow); }
.badge-live  { background: rgba(248,113,113,0.15); color: var(--red); }
.badge-ok    { background: rgba(74,222,128,0.15);  color: var(--green); }
.badge-error { background: rgba(248,113,113,0.15); color: var(--red); }

.kill-banner {
  background: rgba(248,113,113,0.15);
  border-bottom: 2px solid var(--red);
  color: var(--red);
  padding: 0.65rem 1.5rem;
  font-size: 0.875rem;
}
.kill-banner.hidden { display: none; }

.dashboard-page main,
.dashboard-page > .stats-grid,
.dashboard-page > .section-card {
  max-width: 1400px;
  margin: 0 auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem;
  padding: 1.25rem 1.5rem;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 540px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.stat-label { color: var(--muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 0.4rem; }
.stat-value { font-size: 1.35rem; font-weight: 700; }

.section-card {
  margin: 0 1.5rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.section-title { font-size: 0.9rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 1rem; }

.chart-wrap { height: 220px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 0.4rem 0.75rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 0.55rem 0.75rem; border-bottom: 1px solid rgba(51,65,85,0.5); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }
.empty-row { text-align: center; color: var(--muted); padding: 1.5rem 0; }

.dir { font-weight: 600; font-size: 0.8rem; padding: 0.15rem 0.45rem; border-radius: 3px; }
.dir-up   { background: rgba(74,222,128,0.15); color: var(--green); }
.dir-down { background: rgba(248,113,113,0.15); color: var(--red); }

.status-badge { font-size: 0.75rem; padding: 0.15rem 0.45rem; border-radius: 3px; font-weight: 600; }
.status-won  { background: rgba(74,222,128,0.15); color: var(--green); }
.status-lost { background: rgba(248,113,113,0.15); color: var(--red); }
.status-open { background: rgba(96,165,250,0.15); color: var(--blue); }
.status-cancelled, .status-error { background: rgba(148,163,184,0.15); color: var(--muted); }

.pos { color: var(--green); }
.neg { color: var(--red); }

.dash-footer { text-align: center; color: var(--muted); font-size: 0.75rem; padding: 1rem 0 2rem; }
