:root {
  --bg: #0b0e14;
  --bg-elev: #131823;
  --bg-elev-2: #1a2030;
  --border: #232a3b;
  --text: #e6e9f0;
  --text-dim: #8b94a7;
  --accent: #2f81f7;
  --accent-dim: #1f5fbf;
  --green: #2ecc71;
  --red: #ff5c5c;
  --amber: #f5a623;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #16203a 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

.hidden { display: none !important; }

/* ─── Top bar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.7);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand .logo { font-size: 22px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-email { color: var(--text-dim); font-size: 14px; }

/* ─── Layout ─────────────────────────────────────────── */
.container { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ─── Cards ─────────────────────────────────────────── */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.card h2 .sub { text-transform: none; letter-spacing: 0; font-weight: 400; }

/* ─── Auth ─────────────────────────────────────────── */
.auth-wrap { min-height: calc(100vh - 70px); display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 24px; margin-bottom: 4px; }
.auth-card .tagline { color: var(--text-dim); margin-bottom: 24px; font-size: 14px; }
.tabs { display: flex; gap: 6px; margin-bottom: 18px; background: var(--bg-elev-2); padding: 4px; border-radius: 10px; }
.tabs button { flex: 1; background: transparent; border: none; color: var(--text-dim); padding: 9px; border-radius: 7px; cursor: pointer; font-size: 14px; font-weight: 600; }
.tabs button.active { background: var(--accent); color: white; }

/* ─── Forms ─────────────────────────────────────────── */
label { display: block; font-size: 13px; color: var(--text-dim); margin: 14px 0 6px; }
input, select {
  width: 100%;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus { border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: white; border: none;
  border-radius: 9px; padding: 12px 18px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.15s, opacity 0.15s; width: 100%;
}
.btn:hover { background: var(--accent-dim); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.secondary { background: var(--bg-elev-2); border: 1px solid var(--border); }
.btn.secondary:hover { background: #222a3d; }
.btn.danger { background: transparent; border: 1px solid var(--red); color: var(--red); }
.btn.danger:hover { background: rgba(255, 92, 92, 0.1); }
.btn.green { background: var(--green); }
.btn.green:hover { background: #25a85d; }
.btn.small { width: auto; padding: 8px 14px; font-size: 13px; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1; }

.note { font-size: 12.5px; color: var(--text-dim); margin-top: 12px; }
.note.secure { background: rgba(46, 204, 113, 0.08); border: 1px solid rgba(46, 204, 113, 0.25); padding: 10px 12px; border-radius: 8px; color: #9fe3bd; }

.msg { margin-top: 14px; padding: 11px 14px; border-radius: 9px; font-size: 14px; display: none; }
.msg.show { display: block; }
.msg.error { background: rgba(255, 92, 92, 0.12); border: 1px solid rgba(255,92,92,0.3); color: #ffb3b3; }
.msg.ok { background: rgba(46, 204, 113, 0.12); border: 1px solid rgba(46,204,113,0.3); color: #a6e9c4; }
.msg.info { background: rgba(47, 129, 247, 0.12); border: 1px solid rgba(47,129,247,0.3); color: #b9d4ff; }

/* ─── Stats ─────────────────────────────────────────── */
.stat-row { display: flex; flex-wrap: wrap; gap: 24px; }
.stat { min-width: 120px; }
.stat .label { font-size: 12px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 2px; }
.value.pos { color: var(--green); }
.value.neg { color: var(--red); }

/* ─── Tables ─────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag.long { background: rgba(46,204,113,0.15); color: var(--green); }
.tag.short { background: rgba(255,92,92,0.15); color: var(--red); }
.tag.kind { background: var(--bg-elev-2); color: var(--text-dim); }

/* ─── Badges ─────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 20px; font-size: 12.5px; font-weight: 600; }
.badge.running { background: rgba(46,204,113,0.15); color: var(--green); }
.badge.paused { background: rgba(245,166,35,0.15); color: var(--amber); }
.badge.stopped { background: var(--bg-elev-2); color: var(--text-dim); }
.badge.error { background: rgba(255,92,92,0.15); color: var(--red); }
.badge.paper { background: rgba(47,129,247,0.15); color: #b9d4ff; }
.badge.live { background: rgba(46,204,113,0.18); color: var(--green); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.muted { color: var(--text-dim); }
.empty { color: var(--text-dim); font-size: 14px; padding: 14px 0; text-align: center; }
.feed-time { color: var(--text-dim); font-size: 12px; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
