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

:root {
  --bg: #0f0f13;
  --surface: #1a1a22;
  --surface2: #22222d;
  --border: #2e2e3d;
  --red: #e53935;
  --red-hover: #c62828;
  --green: #2e7d32;
  --orange: #e65100;
  --text: #e8e8f0;
  --text-muted: #888;
  --sidebar-w: 220px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  padding: 0;
}
.sidebar-logo {
  padding: 20px 16px;
  font-size: 18px;
  font-weight: bold;
  border-bottom: 1px solid var(--border);
  color: var(--red);
}
.nav-links {
  list-style: none;
  flex: 1;
  padding: 12px 0;
}
.nav-links li a {
  display: block;
  padding: 12px 20px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
.nav-links li a:hover,
.nav-links li a.active {
  background: var(--surface2);
  color: var(--text);
  border-left-color: var(--red);
}
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.admin-name { display: block; color: var(--text-muted); margin-bottom: 8px; }
.btn-logout {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  width: 100%;
}
.btn-logout:hover { background: var(--surface2); color: var(--text); }

/* ── Main content ───────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 32px 28px;
  max-width: calc(100vw - var(--sidebar-w));
}

/* ── Page header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 22px; font-weight: 700; }

/* ── Stats grid ─────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}
.stat-value { font-size: 36px; font-weight: bold; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-green .stat-value { color: #4caf50; }
.stat-orange .stat-value { color: #ff9800; }
.stat-red .stat-value { color: var(--red); }

/* ── Cards ──────────────────────────────────────────────── */
.cards-row { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; flex: 1; min-width: 280px; }
.card-header { padding: 14px 18px; font-weight: 600; border-bottom: 1px solid var(--border); font-size: 14px; }
.card-body { padding: 18px; }
.card-body p { margin-bottom: 8px; font-size: 14px; line-height: 1.6; }

/* ── Table ──────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.table th {
  background: var(--surface2);
  padding: 12px 14px;
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table td {
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:hover td { background: var(--surface2); }
.row-expired td { opacity: 0.6; }
.score { text-align: center; font-size: 15px; }

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-active { background: rgba(76,175,80,0.2); color: #81c784; }
.badge-suspended { background: rgba(255,152,0,0.2); color: #ffb74d; }
.badge-cancelled { background: rgba(229,57,53,0.2); color: #e57373; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  border: none;
  transition: background 0.15s;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: rgba(229,57,53,0.15); color: #e57373; border: 1px solid rgba(229,57,53,0.3); }
.btn-danger:hover { background: rgba(229,57,53,0.3); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-full { width: 100%; text-align: center; }

/* ── Forms ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-row { display: flex; gap: 16px; }
.form-row .form-group { flex: 1; }
label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
input, select, textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--red);
}
textarea { resize: vertical; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ── Alerts ──────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 20px; font-size: 14px; }
.alert-error { background: rgba(229,57,53,0.12); border: 1px solid rgba(229,57,53,0.3); color: #e57373; }
.alert-success { background: rgba(76,175,80,0.12); border: 1px solid rgba(76,175,80,0.3); color: #81c784; }

/* ── Filter tabs ─────────────────────────────────────────── */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.filter-tabs a {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  text-decoration: none;
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.filter-tabs a.active, .filter-tabs a:hover { background: var(--red); color: #fff; border-color: var(--red); }

/* ── Token display ───────────────────────────────────────── */
.token-display {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 10px;
}
.token-display code { font-size: 12px; color: #90caf9; flex: 1; }
.token-box { background: var(--surface2); border: 1px solid var(--border); border-radius: 8px; padding: 14px; margin-bottom: 16px; }

/* ── Modals ──────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px 40px;
  overflow-y: auto;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  margin: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; font-weight: 600; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 3px 7px;
  border-radius: 4px;
  line-height: 1;
}
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body {
  padding: 20px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ── Misc ────────────────────────────────────────────────── */
.text-muted { color: var(--text-muted); font-size: 12px; }
.text-warning { color: #ff9800; }
.empty-state { padding: 40px; text-align: center; color: var(--text-muted); }

/* ── Login ───────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin-left: 0;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  font-size: 22px;
  font-weight: bold;
  color: var(--red);
  margin-bottom: 8px;
}
.login-card h2 { font-size: 16px; color: var(--text-muted); margin-bottom: 28px; }
