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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #23273a;
  --border: #2e3347;
  --accent: #6c63ff;
  --accent-hover: #7c73ff;
  --danger: #e05555;
  --success: #3ecf8e;
  --warn: #f5a623;
  --text: #e8eaf6;
  --text-muted: #8892a4;
  --radius: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

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

/* ── Layout ── */
.page { display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.topbar-brand svg { color: var(--accent); }

.topbar-actions { display: flex; gap: 8px; }

.main { flex: 1; padding: 32px 24px; max-width: 1100px; margin: 0 auto; width: 100%; }

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

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 18px;
  color: var(--text);
}

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 160px; }

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

input:focus { border-color: var(--accent); }

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

.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-ghost   { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }
.btn-success { background: var(--success); color: #000; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); background: var(--surface2); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,0.02); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-active { background: rgba(62,207,142,0.15); color: var(--success); }
.badge-inactive { background: rgba(224,85,85,0.15); color: var(--danger); }

/* ── Flash ── */
.flash {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  background: rgba(108,99,255,0.15);
  border: 1px solid rgba(108,99,255,0.3);
  color: #b0aaff;
  font-size: 13px;
}

/* ── Alert/error ── */
.alert-error {
  background: rgba(224,85,85,0.12);
  border: 1px solid rgba(224,85,85,0.3);
  color: #f08080;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}

/* ── Code block ── */
.code-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 12px;
  color: #a8c8f8;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.7;
}

/* ── Center auth card ── */
.auth-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo h1 { font-size: 20px; font-weight: 700; }
.auth-logo p  { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ── Stats row ── */
.stats { display: flex; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.stat-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  min-width: 130px;
}
.stat-card .stat-val { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-card .stat-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Actions cell ── */
.actions { display: flex; gap: 6px; }
