:root {
  --bg: #313338;
  --bg-deep: #1e1f22;
  --surface: #2b2d31;
  --surface-raised: #383a40;
  --border: #3f4147;
  --text: #f2f3f5;
  --text-muted: #949ba4;
  --text-faint: #6d6f78;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --danger: #da373c;
  --danger-hover: #a12d2f;
  --warning: #f0b232;
  --success: #23a55a;
  --radius: 8px;
  --radius-lg: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.28);

  /* Each section of the panel gets its own accent identity for quick visual
     wayfinding (colored nav underline + page headers), on top of the shared
     neutral chrome above. */
  --accent-members: #5865f2;
  --accent-commands: #22c1d6;
  --accent-execute: #8b5cf6;
  --accent-warnings: #f5a623;
  --accent-cool: #ec4899;
  --accent-auditlog: #14b8a6;
  --accent-stats: #22c55e;
  --accent-bulk: #f43f5e;
  --accent-economy: #eab308;
  --accent-giveaways: #d946ef;
  --accent-tickets: #0ea5e9;
  --accent-music-library: #84cc16;
  --accent-invites: #60a5fa;
  --accent-birthdays: #c084fc;
  --accent-sticky: #a8a29e;
  --accent-chat: #fb923c;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
}

body { -webkit-font-smoothing: antialiased; }

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background-color 120ms ease, transform 80ms ease;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  font-size: 14px;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  padding: 8px 14px;
  font-size: 13px;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 14px;
  font-size: 13px;
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-raised); color: var(--text); }

input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 11px 13px;
  font-size: 14px;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
select { cursor: pointer; }

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

.label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.error-text {
  color: var(--danger);
  font-size: 13px;
  margin-top: 4px;
}

/* Searchable name picker (shared by the login page and the execute page's
   member/role/channel fields) - see buildSearchSelect() in api.js */
.search-select { position: relative; }
.search-select input { width: 100%; }
.search-select-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 5;
  display: none;
}
.search-select-results.show { display: block; }
.search-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.search-select-option:hover { background: var(--bg-deep); }
.search-select-option img { width: 22px; height: 22px; border-radius: 50%; }
.search-select-option .role-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.search-select-selected {
  display: none;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 13px;
  padding: 6px 10px;
  background: var(--bg-deep);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.search-select-selected.show { display: flex; }
.search-select-selected img { width: 20px; height: 20px; border-radius: 50%; }
.search-select-selected .role-dot { width: 9px; height: 9px; border-radius: 50%; }
.search-select-selected .clear-btn {
  margin-right: auto;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 15px;
  padding: 0 4px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 100;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-8px); }
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-raised); border-radius: 6px; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
