/* ── Reset & Variables ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:         #0d0d0f;
  --sidebar:    #111115;
  --content:    #17171c;
  --card:       #1c1c23;
  --card-hover: #222230;
  --border:     rgba(255,255,255,0.07);
  --accent:     #5865f2;
  --accent-dim: rgba(88,101,242,0.15);
  --text:       #e5e5ea;
  --text-muted: #71717a;
  --success:    #22c55e;
  --gold:       #f59e0b;
  --danger:     #ef4444;
  --radius:     12px;
}

html, body { height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

/* Slim dark scrollbar — sidebar only */
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.22); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0.5rem 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  text-decoration: none;
  color: inherit;
}
.sidebar-brand:hover { opacity: 0.85; }

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--accent);
}
.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent), #a78bfa);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.brand-name {
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
}

/* User profile in sidebar */
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.85rem;
  background: rgba(255,255,255,0.04);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.sidebar-user img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.user-avatar-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.sidebar-user-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #fff;
}
.sidebar-user-tag {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Nav items */
.sidebar-nav { flex: 1; }
.sidebar-nav-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin-bottom: 0.5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0.7rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s;
  cursor: pointer;
  margin-bottom: 2px;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-item.active { color: #fff; background: var(--accent-dim); font-weight: 600; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

/* Server selector */
.server-selector {
  margin-bottom: 1.5rem;
}
.server-selector label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
  padding-left: 0.5rem;
}

.server-select-wrap {
  position: relative;
}

select {
  width: 100%;
  padding: 0.65rem 2rem 0.65rem 0.85rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.88rem;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
select:focus { outline: none; border-color: var(--accent); }
select option { background: var(--sidebar); }

.select-arrow {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Sidebar footer */
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
  margin-top: auto;
}

.sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  transition: all 0.2s;
}
.sidebar-footer-link:hover { color: var(--text); background: rgba(255,255,255,0.05); }

/* ── Main content ──────────────────────────────────────────────────────────── */
.main-content {
  background: var(--content);
  min-height: 100vh;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 2rem;
  border-bottom: 1px solid var(--border);
  background: var(--content);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.topbar-home {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: background 0.2s, color 0.2s;
}
.topbar-home:hover { background: var(--accent); color: #fff; }
.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-area { padding: 2.5rem 2.25rem; }

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

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: rgba(88,101,242,0.3); transform: translateY(-2px); }

.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: #fff;
  line-height: 1;
}
.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 10px;
}

/* ── Overview XP progress ──────────────────────────────────────────────────── */
.ov-xp-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.75rem;
  margin-bottom: 1.5rem;
}
.ov-xp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.ov-xp-title { font-size: 0.82rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.ov-xp-nums  { font-size: 0.85rem; color: var(--text-muted); }
.ov-xp-track {
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.ov-xp-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #7c5cfc, #a78bfa);
  border-radius: 999px;
  transition: width 0.8s cubic-bezier(.4,0,.2,1);
}
.ov-xp-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Overview quick access ──────────────────────────────────────────────────── */
.ov-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.ov-quick-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, background 0.2s;
  color: var(--text);
}
.ov-quick-card:hover {
  border-color: rgba(124,92,252,0.4);
  background: rgba(124,92,252,0.06);
  transform: translateY(-2px);
}
.ov-quick-icon { font-size: 1.5rem; display: block; margin-bottom: 0.6rem; }
.ov-quick-label { font-size: 0.95rem; font-weight: 700; margin-bottom: 0.25rem; }
.ov-quick-sub { font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; }

/* ── Rank card ─────────────────────────────────────────────────────────────── */
.rank-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
}

.rank-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #a78bfa, #f472b6);
}

.rank-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}

.rank-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  object-fit: cover;
}

.rank-avatar-placeholder {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 3px solid var(--accent);
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}

.level-badge {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: var(--gold);
  color: #000;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 99px;
  border: 2px solid var(--card);
}

.rank-info { flex: 1; min-width: 240px; }

.rank-username {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}
.rank-position {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.rank-position span { color: var(--accent); font-weight: 700; }

.xp-bar-wrap { margin-bottom: 8px; }
.xp-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.xp-bar-labels strong { color: var(--text); }

.xp-bar-track {
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 99px;
  overflow: hidden;
}

.xp-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #a78bfa);
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 12px rgba(88,101,242,0.5);
}

.rank-meta {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.rank-meta-item { font-size: 0.84rem; color: var(--text-muted); }
.rank-meta-item span { color: var(--text); font-weight: 600; }

/* ── Leaderboard ───────────────────────────────────────────────────────────── */
.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.leaderboard-list { display: flex; flex-direction: column; gap: 8px; }

.lb-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.2rem;
  transition: border-color 0.2s, background 0.2s;
}
.lb-entry:hover { border-color: rgba(88,101,242,0.3); background: var(--card-hover); }

.lb-rank {
  width: 28px;
  font-size: 0.9rem;
  font-weight: 800;
  text-align: center;
  flex-shrink: 0;
}
.lb-rank.gold   { color: #f59e0b; font-size: 1.1rem; }
.lb-rank.silver { color: #a1a1aa; font-size: 1.1rem; }
.lb-rank.bronze { color: #cd7f32; font-size: 1.1rem; }

.lb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.lb-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.lb-name { flex: 1; font-weight: 600; font-size: 0.92rem; }
.lb-level { font-size: 0.8rem; color: var(--text-muted); margin-top: 1px; }

.lb-xp-wrap { text-align: right; }
.lb-xp-val { font-size: 0.92rem; font-weight: 700; color: var(--gold); }
.lb-xp-label { font-size: 0.75rem; color: var(--text-muted); }

/* ── Loading / Empty states ────────────────────────────────────────────────── */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--text-muted);
  gap: 1rem;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Button ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  transition: all 0.2s;
  text-decoration: none;
}
.btn:hover { color: #fff; background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }
.btn-danger { border-color: rgba(239,68,68,0.3); color: #ef4444; }
.btn-danger:hover { background: rgba(239,68,68,0.1); }

/* ── Fade in ───────────────────────────────────────────────────────────────── */
.fade-in {
  animation: fadeIn 0.4s ease forwards;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .content-area { padding: 1rem; }
  .rank-card { flex-direction: column; text-align: center; }
  .rank-meta { justify-content: center; }
}

/* ── Config cards ──────────────────────────────────────────────────────────── */
.config-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem 2.25rem;
  max-width: 880px;
}
.config-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.6rem;
}
.config-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.75rem;
}
.config-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}
.config-notice {
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--text-muted);
  font-size: 0.87rem;
  text-align: center;
}
.config-form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 140px;
}
.config-field label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.config-input, .config-select {
  background: var(--surface2, #1c1c23);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
.config-input:focus, .config-select:focus { border-color: var(--accent); }
.config-select option { background: #1c1c23; }

/* Level rewards list */
.reward-list {
  margin-top: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reward-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.85rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.reward-row-info { font-size: 0.9rem; color: var(--text); }
.reward-row-info span { color: var(--accent); font-weight: 600; }
.reward-delete {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.2s;
}
.reward-delete:hover { background: rgba(239,68,68,0.12); }

/* Toggle switch */
.config-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.config-label { font-size: 0.95rem; font-weight: 600; color: var(--text); }
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 26px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 4px; bottom: 4px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* Module pill toggle (am-toggle / am-slider) */
.am-toggle {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.am-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.am-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.am-slider::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.5);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}
.am-toggle input:checked + .am-slider {
  background: var(--accent);
  border-color: var(--accent);
}
.am-toggle input:checked + .am-slider::before {
  transform: translateY(-50%) translateX(20px);
  background: #fff;
}

/* btn-primary */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  padding: 0.55rem 1.2rem;
  align-self: flex-end;
}
.btn-primary:hover { background: #4752c4; border-color: #4752c4; color: #fff; }

/* ── Logging UI ──────────────────────────────────────────────────────────────── */
.log-category-block {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.log-category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: rgba(255,255,255,0.04);
  font-weight: 600;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.log-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--border);
}
.log-toggle-row:last-child { border-bottom: none; }
.log-event-label { font-size: 0.85rem; color: var(--text); }
.log-event-label code {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.05);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  margin-left: 0.4rem;
}

/* Log viewer table */
.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.log-table thead th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}
.log-table tbody tr { border-bottom: 1px solid var(--border); }
.log-table tbody tr:last-child { border-bottom: none; }
.log-table tbody tr:hover { background: rgba(255,255,255,0.02); }
.log-table td { padding: 0.5rem 0.75rem; vertical-align: top; }
.log-ts { color: var(--text-muted); white-space: nowrap; font-size: 0.78rem; }
.log-title { color: var(--text); }
.log-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  opacity: 0.9;
}

/* ── AutoMod ──────────────────────────────────────────────────────────────── */
.am-section-header {
  max-width: 880px;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.am-section-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.55;
}

/* Rule cards */
.am-rules-list {
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.am-rule-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s;
}

.am-rule-card:hover { border-color: rgba(88,101,242,0.25); }

.am-rule-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1.25rem;
}

.am-rule-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
  background: rgba(88,101,242,0.1);
}

.am-rule-info { flex: 1; min-width: 0; }

.am-rule-name {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
}

.am-rule-meta {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 1px;
}

.am-rule-controls {
  display: flex;
  gap: 1rem;
  padding: 0.7rem 1.25rem 0.8rem;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.12);
  flex-wrap: wrap;
  align-items: flex-end;
}

.am-control {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.am-control label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
}

.am-control select,
.am-control input[type="number"],
.am-control input[type="text"] {
  background: var(--bg, #0d0d0f);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.87rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.am-control input[type="number"] { width: 80px; }
.am-control select { min-width: 130px; }

.am-control select:focus,
.am-control input[type="number"]:focus,
.am-control input[type="text"]:focus { border-color: var(--accent); }
.am-control input[type="text"] { width: 80px; }
.am-control select option { background: #1c1c23; }

/* Tag chips (bad words, domains, roles, channels) */
.am-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.65rem;
  border-radius: 20px;
  background: rgba(88,101,242,0.12);
  border: 1px solid rgba(88,101,242,0.25);
  font-size: 0.8rem;
  color: var(--text);
}

.am-tag button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 0.9rem;
  transition: color 0.15s;
}

.am-tag button:hover { color: var(--danger); }

/* Below-rules 2-column grid */
.am-lower-grid {
  max-width: 880px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) { .am-lower-grid { grid-template-columns: 1fr; } }

.am-sub-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.am-sub-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.am-add-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.am-add-row input,
.am-add-row select {
  flex: 1;
  background: var(--bg, #0d0d0f);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.am-add-row input:focus,
.am-add-row select:focus { border-color: var(--accent); }
.am-add-row select option { background: #1c1c23; }

.am-tag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  min-height: 1.5rem;
}

.am-empty {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ── General config cards ───────────────────────────────────────────────────── */
.gc-cards { display: flex; flex-direction: column; gap: 0.5rem; max-width: 880px; }
.gc-status-badge { font-size: 0.72rem; font-weight: 500; color: var(--text-muted); margin-left: 0.5rem; vertical-align: middle; }

/* ── No-guild modal ─────────────────────────────────────────────────────────── */
.ngm-backdrop {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.ngm-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 2rem;
  max-width: 400px; width: 100%;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  animation: ngm-in 0.18s ease;
}
@keyframes ngm-in {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0);   }
}
.ngm-icon  { font-size: 2.5rem; margin-bottom: 1rem; }
.ngm-title { font-size: 1.15rem; font-weight: 700; color: var(--text); margin-bottom: 0.6rem; }
.ngm-body  { font-size: 0.88rem; color: var(--text-muted); line-height: 1.6; margin-bottom: 1.75rem; }
.ngm-actions { display: flex; gap: 0.75rem; justify-content: center; flex-wrap: wrap; }

/* ── Module banner ─────────────────────────────────────────────────────────── */
.module-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  max-width: 880px;
  background: rgba(88,101,242,0.07);
  border: 1px solid rgba(88,101,242,0.22);
  border-radius: 8px;
  padding: 0.55rem 0.9rem 0.55rem 1rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s, background 0.2s;
}
.module-banner.mb-off {
  background: rgba(239,68,68,0.06);
  border-color: rgba(239,68,68,0.28);
}
.mb-left {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}
.mb-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  box-shadow: 0 0 5px var(--success);
  transition: background 0.2s, box-shadow 0.2s;
}
.mb-dot.off {
  background: var(--danger);
  box-shadow: 0 0 5px var(--danger);
}
.mb-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
  letter-spacing: 0.01em;
}
.module-section-disabled {
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
  filter: grayscale(25%);
  transition: opacity 0.25s, filter 0.25s;
}

/* ── Login modal ────────────────────────────────────────────────────────────── */
#login-modal { z-index: 1000; }
