:root {
  --bg: #0f0f13;
  --surface: #1a1a24;
  --surface2: #22222f;
  --border: #2e2e40;
  --accent: #8b5cf6;
  --accent2: #6d28d9;
  --text: #e2e2f0;
  --text-muted: #8888aa;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --radius: 10px;
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo svg { width: 24px; height: 24px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  transition: background 0.15s, color 0.15s;
}

.nav-link:hover, .nav-link.active {
  background: var(--surface2);
  color: var(--text);
}

.nav-link.active { color: var(--accent); }

.nav-icon { opacity: 0.7; }

/* ── Main ────────────────────────────────────────────── */
.main {
  margin-left: 220px;
  flex: 1;
  padding: 32px;
  max-width: 1200px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}

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

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

/* ── Stats grid ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

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

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Tables ──────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #166534; color: #86efac; }
.badge-red   { background: #7f1d1d; color: #fca5a5; }
.badge-yellow{ background: #78350f; color: #fcd34d; }
.badge-gray  { background: #1f2937; color: #9ca3af; }
.badge-purple{ background: #4c1d95; color: #c4b5fd; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: opacity 0.15s;
  text-decoration: none;
}

.btn:hover { opacity: 0.85; }

.btn-primary { background: var(--accent); color: white; }
.btn-danger  { background: var(--error); color: white; }
.btn-ghost   {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Forms ───────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus { border-color: var(--accent); }

textarea { resize: vertical; min-height: 80px; }
select option { background: var(--surface2); }

/* ── Alert ───────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
}
.alert-success { background: #14532d; color: #86efac; border: 1px solid #166534; }
.alert-error   { background: #450a0a; color: #fca5a5; border: 1px solid #7f1d1d; }

/* ── Account card ────────────────────────────────────── */
.account-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--surface2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.account-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}

.account-avatar img { width: 100%; height: 100%; object-fit: cover; }

.account-info { flex: 1; }
.account-name { font-weight: 600; font-size: 15px; }
.account-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.account-actions { display: flex; gap: 8px; }

/* ── Empty state ─────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-text { font-size: 15px; margin-bottom: 8px; }
.empty-sub  { font-size: 13px; opacity: 0.7; }

/* ── Log row ─────────────────────────────────────────── */
.log-row-error td { color: #fca5a5; }
.log-row-warning td { color: #fcd34d; }

/* ── Checkbox toggle ─────────────────────────────────── */
.toggle {
  position: relative; display: inline-block;
  width: 36px; height: 20px;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider:before {
  content: "";
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ── Scrollbar ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
