/* Dashboard styles — palette matched to the marketing site. */
:root {
  --bg-base: #050505;
  --bg-elev: #0c0c0c;
  --bg-card: #111111;
  --border: #1f1f1f;
  --border-bright: #2a2a2a;
  --text: #f5f5f5;
  --text-dim: #a1a1aa;
  --text-faint: #71717a;
  --accent: #22ff88;
  --accent-deep: #16a34a;
  --accent-glow: rgba(34, 255, 136, 0.18);
  --danger: #ef4444;
  --radius: 6px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-base);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); }

.logo { font-weight: 700; font-size: 1.25rem; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }

code { font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Consolas, monospace; }

/* ===================================================================
   Auth card (login / signup)
   =================================================================== */
.auth-card {
  max-width: 380px;
  margin: 8vh auto;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.auth-card .logo { display: block; text-align: center; margin-bottom: 1.5rem; font-size: 1.5rem; }
.tabs { display: flex; gap: 0.5rem; margin-bottom: 1.25rem; }
.tab {
  flex: 1;
  padding: 0.6rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(34, 255, 136, 0.06);
}

form { display: flex; flex-direction: column; gap: 0.9rem; }
label { display: flex; flex-direction: column; gap: 0.35rem; font-size: 0.82rem; color: var(--text-dim); }
input {
  padding: 0.65rem 0.75rem;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.93rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===================================================================
   Buttons — match marketing site
   =================================================================== */
.submit, .btn-accent {
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: #052012;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.05s;
}
.submit:hover, .btn-accent:hover {
  background: #44ff9c;
  box-shadow: 0 0 20px var(--accent-glow);
}
.submit:active, .btn-accent:active { transform: translateY(1px); }
.submit:disabled, .btn-accent:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

.ghost {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
  transition: color 0.15s, border-color 0.15s;
}
.ghost:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.ghost.small, .btn-accent.small { padding: 0.35rem 0.75rem; font-size: 0.78rem; }

.hint { font-size: 0.78rem; color: var(--text-faint); }
.error { font-size: 0.85rem; color: var(--danger); }

/* ===================================================================
   Top bar + dashboard layout
   =================================================================== */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(5, 5, 5, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.dash { max-width: 920px; margin: 2rem auto; padding: 0 1.5rem; }
.page-title { font-size: 1.7rem; letter-spacing: -0.02em; margin-bottom: 1.2rem; }
.dash h2 { font-size: 1.05rem; margin-bottom: 0.5rem; font-weight: 600; }
.dash h3 { font-size: 0.93rem; margin-bottom: 0.3rem; font-weight: 600; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  margin: 1.25rem 0;
}
.row { display: flex; justify-content: space-between; padding: 0.4rem 0; }
.row + .row { border-top: 1px solid var(--border); }
.muted { color: var(--text-dim); }
.small { font-size: 0.8rem; }

/* status pill (small chip) */
.badge {
  display: inline-block;
  font-size: 0.74rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  text-transform: capitalize;
  background: var(--bg-elev);
  color: var(--text-dim);
  border: 1px solid var(--border-bright);
}
.badge.ok {
  background: rgba(34, 255, 136, 0.1);
  color: var(--accent);
  border-color: rgba(34, 255, 136, 0.3);
}
.badge.warn {
  background: rgba(161, 161, 170, 0.08);
  color: var(--text-dim);
  border-color: var(--border-bright);
}

/* ===================================================================
   Subscription / TV grant status cards
   =================================================================== */
.status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.status-card { margin: 0; }
.status-text {
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: capitalize;
  margin: 0.3rem 0 0.4rem;
  color: var(--text);
}
.status-text.ok { color: var(--accent); }
.status-text.warn { color: var(--text-dim); }
@media (max-width: 600px) {
  .status-grid { grid-template-columns: 1fr; }
}

/* ===================================================================
   Setup steps + forms
   =================================================================== */
.setup-step { margin-bottom: 1.4rem; }
.setup-step:last-child { margin-bottom: 0; }

.form-row { display: flex; gap: 0.6rem; flex-direction: row; }
.form-row.form-stack { flex-direction: column; }
.form-row input { flex: 1; }
.form-row button { flex-shrink: 0; }

/* tokens / monospace URL blobs */
.token {
  display: inline-block;
  padding: 0.45rem 0.7rem;
  background: var(--bg-elev);
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  color: var(--text);
}
.token-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}
.token-row .token { flex: 1; min-width: 0; }

/* ===================================================================
   P&L stat grid
   =================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.9rem;
  margin: 0.6rem 0;
}
.stat-num {
  font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 1.2rem;
  font-weight: 700;
  margin-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}
.pnl-pos { color: var(--accent); }
.pnl-neg { color: var(--danger); }

/* ===================================================================
   Tables (positions, history, admin queue)
   =================================================================== */
.table-wrap { overflow-x: auto; margin-top: 0.4rem; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.table th, .table td {
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { font-variant-numeric: tabular-nums; }
.table th {
  color: var(--text-faint);
  font-weight: 500;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.015); }

/* empty states */
.empty {
  padding: 1.2rem 0;
  text-align: center;
  color: var(--text-faint);
}

/* webhook list rows */
.webhooks-list { margin-top: 0.8rem; }
.webhook-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.6rem 0;
  border-top: 1px solid var(--border);
}
.webhook-row:first-child { border-top: none; }
.webhook-label { font-weight: 600; flex: 1; }
