:root {
  --bg: #0f1216;
  --bg-card: #171b21;
  --bg-input: #1f242c;
  --border: #2a2f38;
  --text: #e7eaee;
  --text-dim: #9aa3af;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --green: #57f287;
  --red: #ed4245;
  --yellow: #fee75c;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

.wrap.wide { max-width: 900px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.topbar h1 {
  font-size: 22px;
  margin: 0;
}

.topbar h1 span {
  color: var(--accent);
  font-weight: 500;
}

.userbox { display: flex; align-items: center; gap: 10px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 { margin-top: 0; font-size: 17px; }

.hint { color: var(--text-dim); font-size: 14px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }

.btn-success { background: rgba(87, 242, 135, 0.15); color: var(--green); }
.btn-success:hover { background: rgba(87, 242, 135, 0.3); }

.btn-danger { background: rgba(237, 66, 69, 0.15); color: var(--red); }
.btn-danger:hover { background: rgba(237, 66, 69, 0.3); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

input[type="text"] {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
}

select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  width: 100%;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239aa3af' stroke-width='1.5' fill='none' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
select option {
  background: var(--bg-input);
  color: var(--text);
}

.inline-form {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.inline-form input { flex: 1; min-width: 180px; }

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.status-pending { background: rgba(254, 231, 92, 0.15); color: var(--yellow); }
.status-whitelisted { background: rgba(87, 242, 135, 0.15); color: var(--green); }
.status-denied { background: rgba(237, 66, 69, 0.15); color: var(--red); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--text-dim); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.section-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
}
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.error-box {
  background: rgba(237, 66, 69, 0.12);
  border: 1px solid rgba(237, 66, 69, 0.4);
  color: #ff9d9f;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

.success-box {
  background: rgba(87, 242, 135, 0.12);
  border: 1px solid rgba(87, 242, 135, 0.4);
  color: #86f5ac;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}

footer { text-align: center; color: var(--text-dim); font-size: 12px; margin-top: 20px; }
footer a { color: var(--text-dim); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}
.stat-tile {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px 14px;
  text-align: center;
}
.stat-tile .num { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-tile .label { font-size: 12px; color: var(--text-dim); margin-top: 4px; }
.stat-tile.pending .num { color: var(--yellow); }
.stat-tile.whitelisted .num { color: var(--green); }
.stat-tile.denied .num { color: var(--red); }

@media (max-width: 600px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tr { border-bottom: 1px solid var(--border); padding: 10px 0; }
  td { border: none; padding: 4px 0; }
  td::before { content: attr(data-label); display: block; color: var(--text-dim); font-size: 11px; text-transform: uppercase; margin-bottom: 2px; }
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 100;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
}
.modal-box h3 { margin: 0 0 8px; font-size: 18px; }
.modal-box .hint { margin-bottom: 20px; }
.modal-choices {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-choices .btn {
  flex: 1;
  justify-content: center;
  padding: 16px 10px;
  font-size: 15px;
}
.modal-cancel { width: 100%; justify-content: center; }