@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* ---- brand gradient (pink, matching the bot's icon) ---- */
  --brand-1: #F43F5E; /* rose */
  --brand-2: #EC4899; /* pink */
  --brand-3: #D946EF; /* fuchsia */
  --brand-gradient: linear-gradient(135deg, var(--brand-1) 0%, var(--brand-2) 55%, var(--brand-3) 100%);
  --discord-blurple: #5865F2; /* Discord's own brand color — kept fixed on Discord-specific buttons regardless of site theme */
  --discord-blurple-hover: #4752c4;

  /* ---- surfaces ---- */
  --bg-deep: #020203;
  --bg-base: #06070a;
  --bg-elevated: #0d0f16;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-hover: rgba(255, 255, 255, 0.075);
  --surface-solid: #101219;

  /* ---- text ---- */
  --fg: #F2F2F5;
  --fg-muted: #9093A6;
  --fg-faint: #5C5F70;

  /* ---- semantic ---- */
  --success: #22C55E;
  --success-bg: rgba(34, 197, 94, 0.14);
  --danger: #EF4444;
  --danger-bg: rgba(239, 68, 68, 0.14);
  --warning: #F59E0B;

  /* ---- borders / rings ---- */
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --ring: var(--brand-1);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Consolas, monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-base);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100dvh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::selection { background: var(--brand-1); color: #fff; }

:focus-visible { outline: 2px solid var(--ring); outline-offset: 2px; border-radius: 4px; }

.hidden { display: none !important; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg-base); }
* { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }

/* ================= shared motion ================= */
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94); } to { opacity: 1; transform: scale(1); } }
@keyframes blobDrift {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  50%  { transform: translate(40px, -30px) scale(1.12) rotate(8deg); }
  100% { transform: translate(-30px, 25px) scale(0.96) rotate(-6deg); }
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--success); }
  50% { opacity: 0.55; box-shadow: 0 0 16px var(--success); }
}
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

.stagger-in > * { animation: fadeUp 420ms var(--ease-out) both; }
.stagger-in > *:nth-child(1) { animation-delay: 0ms; }
.stagger-in > *:nth-child(2) { animation-delay: 40ms; }
.stagger-in > *:nth-child(3) { animation-delay: 80ms; }
.stagger-in > *:nth-child(4) { animation-delay: 120ms; }
.stagger-in > *:nth-child(5) { animation-delay: 160ms; }
.stagger-in > *:nth-child(6) { animation-delay: 200ms; }
.stagger-in > *:nth-child(n+7) { animation-delay: 240ms; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.001ms !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

/* ================= login screen ================= */
#login-screen {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 0%, rgba(244,63,94,0.16), transparent 70%),
    var(--bg-deep);
}

.login-photo {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(180deg, rgba(2,2,3,0.75) 0%, rgba(2,2,3,0.92) 70%, var(--bg-deep) 100%),
    url('https://images.unsplash.com/photo-1557683316-973673baf926?q=80&w=1600&auto=format&fit=crop');
  background-size: cover;
  background-position: center;
  filter: blur(2px) saturate(1.15);
  opacity: 0.55;
  transform: scale(1.06);
}

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  opacity: 0.32;
  pointer-events: none;
  will-change: transform;
  animation: blobDrift 22s var(--ease-out) infinite alternate;
}
.login-blob.blob-a { width: 480px; height: 480px; background: var(--brand-1); top: -160px; left: -140px; }
.login-blob.blob-b { width: 560px; height: 560px; background: var(--brand-3); bottom: -180px; right: -120px; animation-duration: 28s; animation-delay: -9s; }
.login-blob.blob-c { width: 380px; height: 380px; background: var(--brand-2); top: 40%; left: 50%; margin-left: -190px; animation-duration: 34s; animation-delay: -15s; opacity: 0.2; }

.login-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-6) var(--space-6) var(--space-5);
  animation: popIn 480ms var(--ease-spring);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.6);
  text-align: center;
}

.login-logo {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  margin: 0 auto var(--space-4);
  background: var(--brand-gradient);
  padding: 3px;
  box-shadow: 0 0 0 1px var(--border-strong), 0 12px 30px -8px rgba(244,63,94,0.55);
  animation: fadeUp 500ms var(--ease-out) 80ms both;
}
.login-logo img, .login-logo .login-logo-fallback {
  width: 100%; height: 100%; border-radius: 19px; object-fit: cover; display: block;
  background: var(--bg-elevated);
}
.login-logo-fallback {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 26px; color: #fff;
}

.login-card h1 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 var(--space-1);
  letter-spacing: -0.01em;
}

.login-card p.subtitle {
  color: var(--fg-muted);
  margin: 0 0 var(--space-5);
  font-size: 14px;
}

.login-features {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin: 0 0 var(--space-5);
}
.login-features span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--fg-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 5px 10px;
  border-radius: var(--radius-pill);
}

/* ================= shared form elements ================= */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: var(--space-2); color: var(--fg-muted); }
.field { margin-bottom: var(--space-4); }

input[type="text"], input[type="password"], input[type="time"], input[type="number"],
input[type="url"], input[type="search"], select, textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  min-height: 44px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}
textarea { min-height: 88px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand-1);
  box-shadow: 0 0 0 3px rgba(244,63,94,0.22);
  outline: none;
  background: var(--surface-solid);
}
select { cursor: pointer; }

.helper-text { font-size: 12px; color: var(--fg-faint); margin-top: var(--space-1); }
.error-text { font-size: 13px; color: var(--danger); margin-top: var(--space-2); min-height: 18px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 10px 20px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600; font-size: 14px; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, transform 100ms ease, opacity 150ms ease, box-shadow 200ms ease;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--brand-gradient); color: #fff; box-shadow: 0 6px 16px -4px rgba(244,63,94,0.5); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 8px 22px -4px rgba(244,63,94,0.65); }

.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--fg); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--border-strong); }

.btn-destructive { background: transparent; border-color: rgba(239,68,68,0.4); color: var(--danger); }
.btn-destructive:hover:not(:disabled) { background: var(--danger-bg); border-color: var(--danger); }

.btn-block { width: 100%; }

.btn-discord { background: var(--discord-blurple); color: #fff; text-decoration: none; }
.btn-discord:hover { background: var(--discord-blurple-hover); box-shadow: 0 0 0 4px rgba(244,63,94,0.25); }
.btn-disabled-config { opacity: 0.5; pointer-events: none; }

.btn-icon { min-height: 36px; min-width: 36px; padding: 0; border-radius: var(--radius-sm); background: var(--surface); border-color: var(--border); }
.btn-icon:hover { background: var(--surface-hover); }
.btn-icon svg { width: 16px; height: 16px; }

/* toggle switch */
.switch { position: relative; display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }
.switch .track { width: 42px; height: 24px; border-radius: 999px; background: var(--surface-hover); border: 1px solid var(--border); transition: background-color 150ms ease, border-color 150ms ease; position: relative; flex-shrink: 0; }
.switch .thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: var(--fg-muted); transition: transform 200ms var(--ease-spring), background-color 150ms ease; }
.switch input:checked + .track { background: var(--brand-1); border-color: var(--brand-1); }
.switch input:checked + .track .thumb { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .track { outline: 2px solid var(--ring); outline-offset: 2px; }
.switch .switch-label { font-size: 14px; font-weight: 500; }

/* chip / tag input (banned words) */
.chip-input { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: var(--space-2); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm); min-height: 44px; }
.chip-input:focus-within { border-color: var(--brand-1); box-shadow: 0 0 0 3px rgba(244,63,94,0.22); }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-hover); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 4px 6px 4px 12px; font-size: 13px; font-weight: 500; animation: popIn 180ms var(--ease-out); }
.chip button { background: none; border: none; color: var(--fg-muted); cursor: pointer; width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.chip button:hover { background: var(--danger-bg); color: var(--danger); }
.chip-input input { flex: 1; min-width: 120px; border: none; background: none; min-height: 32px; padding: 4px; box-shadow: none !important; }

/* role pill picker (autorole) */
.role-picker { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.role-pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 13px; font-weight: 600; transition: all 150ms ease; user-select: none; }
.role-pill:hover { border-color: var(--border-strong); background: var(--surface-hover); }
.role-pill.active { background: rgba(244,63,94,0.16); border-color: var(--brand-1); color: #fff; }
.role-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--fg-faint); flex-shrink: 0; }

/* ================= app shell ================= */
#app-shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100dvh; animation: fadeIn 300ms var(--ease-out); }

#sidebar {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-base));
  border-right: 1px solid var(--border);
  padding: var(--space-5) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2); }
.brand-logo { width: 30px; height: 30px; border-radius: 9px; object-fit: cover; background: var(--brand-gradient); flex-shrink: 0; box-shadow: 0 4px 12px -2px rgba(244,63,94,0.5); }
.brand-name { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em; font-size: 16px; }
.brand .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); animation: dotPulse 2.4s ease-in-out infinite; margin-left: 2px; }

.nav-group-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-faint); padding: var(--space-3) var(--space-3) 6px; }
nav.nav-list { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  position: relative; display: flex; align-items: center; gap: var(--space-3);
  padding: 9px 12px 9px 16px; border-radius: var(--radius-sm); color: var(--fg-muted);
  cursor: pointer; border: 1px solid transparent; min-height: 40px; font-size: 13.5px; font-weight: 500;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
  background: none; text-align: left; width: 100%;
}
.nav-item svg { flex-shrink: 0; width: 17px; height: 17px; }
.nav-item:hover { background: var(--surface); color: var(--fg); }
.nav-item[aria-current="page"] { background: rgba(244,63,94,0.14); color: #fff; border-color: rgba(244,63,94,0.35); }
.nav-item[aria-current="page"]::before {
  content: ''; position: absolute; left: 0; top: 7px; bottom: 7px; width: 3px; border-radius: 999px;
  background: var(--brand-gradient); box-shadow: 0 0 8px var(--brand-1);
}

#sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: var(--space-3); padding: 0 var(--space-2); }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-hover) center/cover no-repeat; border: 1px solid var(--border); flex-shrink: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#main { padding: var(--space-6); max-width: 1080px; }

#topbar {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  margin-bottom: var(--space-6); flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
}
#guild-select { min-width: 260px; }

.server-card { display: flex; align-items: center; gap: var(--space-3); }
.server-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--surface-hover) center/cover no-repeat; border: 1px solid var(--border); flex-shrink: 0; transition: background-image 200ms ease; }
.server-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.server-meta { font-size: 12px; color: var(--fg-muted); }

h1.page-title { font-family: var(--font-display); font-size: 26px; margin: 0 0 var(--space-1); letter-spacing: -0.01em; }
p.page-subtitle { color: var(--fg-muted); margin: 0 0 var(--space-5); font-size: 14px; max-width: 640px; }

[data-page-section]:not(.hidden) { animation: fadeUp 340ms var(--ease-out); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
  transition: border-color 200ms ease, background-color 200ms ease;
}
.card:hover { border-color: var(--border-strong); }
.card h2 { font-size: 15px; margin: 0 0 var(--space-4); font-weight: 700; font-family: var(--font-display); }

.row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.row + .row { margin-top: var(--space-3); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }

.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.02em; }
.badge-on { background: var(--success-bg); color: var(--success); }
.badge-off { background: var(--surface-hover); color: var(--fg-muted); }
.badge-brand { background: rgba(244,63,94,0.16); color: #F9A8D4; }

.schedule-item { display: flex; align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: var(--space-2); gap: var(--space-3); flex-wrap: wrap; animation: fadeUp 250ms var(--ease-out); background: var(--bg-elevated); }
.schedule-item .meta { font-size: 13px; color: var(--fg-muted); }
.schedule-item .chan { font-family: var(--font-mono); font-weight: 600; }

.empty-state { text-align: center; color: var(--fg-muted); padding: var(--space-6) var(--space-4); font-size: 14px; }
.empty-state code { background: var(--surface-hover); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); }

/* ================= ticket option editor ================= */
.ticket-option-card {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-4); animation: fadeUp 250ms var(--ease-out) both;
}
.ticket-option-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }
.ticket-option-title { font-family: var(--font-display); font-weight: 700; font-size: 13.5px; color: var(--fg-muted); }
.ticket-option-actions { display: flex; gap: 4px; }
.ticket-option-fields { display: grid; grid-template-columns: 70px 1fr 1fr; gap: var(--space-3); margin-bottom: var(--space-3); }
.ticket-option-fields .field { margin-bottom: 0; }
.ticket-option-qtitles { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-3); }
.ticket-option-qtitles .field { margin-bottom: 0; }
@media (max-width: 860px) {
  .ticket-option-fields, .ticket-option-qtitles { grid-template-columns: 1fr; }
}

/* ================= live badge & activity feed ================= */
.live-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--success);
  background: var(--success-bg); border: 1px solid rgba(34,197,94,0.3);
  padding: 4px 10px 4px 8px; border-radius: var(--radius-pill);
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); animation: dotPulse 1.6s ease-in-out infinite; }
.live-badge.is-paused { color: var(--fg-muted); background: var(--surface); border-color: var(--border); }
.live-badge.is-paused .live-dot { background: var(--fg-faint); animation: none; }
#overview-updated { font-size: 12.5px; color: var(--fg-faint); }

.activity-list { display: flex; flex-direction: column; gap: 2px; max-height: 320px; overflow-y: auto; }
.activity-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 4px;
  border-bottom: 1px solid var(--border); font-size: 13px; animation: fadeUp 300ms var(--ease-out) both;
}
.activity-item:last-child { border-bottom: none; }
.activity-icon {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  background: var(--surface-hover); color: var(--fg-muted); margin-top: 1px;
}
.activity-icon svg { width: 13px; height: 13px; }
.activity-text { flex: 1; line-height: 1.5; }
.activity-text b { font-weight: 700; }
.activity-time { font-size: 11.5px; color: var(--fg-faint); white-space: nowrap; margin-top: 2px; }

/* ================= overview stat cards ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--space-4); margin-bottom: var(--space-4); }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: ''; position: absolute; top: -40%; right: -30%; width: 140px; height: 140px; border-radius: 50%;
  background: var(--brand-gradient); opacity: 0.12; filter: blur(30px);
}
.stat-card .stat-label { font-size: 12px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-card .stat-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; letter-spacing: -0.02em; transition: color 200ms ease; }
.stat-card .stat-icon { position: absolute; top: var(--space-4); right: var(--space-4); width: 18px; height: 18px; color: var(--fg-faint); }
.stat-card.flash-up .stat-value { color: var(--success); animation: flashPop 900ms var(--ease-out); }
.stat-card.flash-down .stat-value { color: var(--danger); animation: flashPop 900ms var(--ease-out); }
@keyframes flashPop { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* ================= skeleton loaders ================= */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-hover) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--radius-sm); }
.skeleton-line { height: 14px; margin-bottom: 8px; }
.skeleton-card { height: 90px; border-radius: var(--radius); }

.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.25); border-top-color: #fff; border-radius: 50%; animation: spin 700ms linear infinite; display: inline-block; }

/* ================= commands catalog page ================= */
.commands-toolbar { display: flex; gap: var(--space-3); margin-bottom: var(--space-4); flex-wrap: wrap; align-items: center; }
.commands-search { flex: 1; min-width: 220px; }
.commands-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  font-size: 12.5px; font-weight: 600; padding: 7px 14px; border-radius: var(--radius-pill);
  background: var(--surface); border: 1px solid var(--border); color: var(--fg-muted); cursor: pointer;
  transition: all 150ms ease; white-space: nowrap;
}
.filter-chip:hover { color: var(--fg); border-color: var(--border-strong); }
.filter-chip.active { background: var(--brand-gradient); color: #fff; border-color: transparent; }

.commands-summary { font-size: 13px; color: var(--fg-muted); margin-bottom: var(--space-3); }

.commands-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-3); }
.command-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-4); display: flex; flex-direction: column; gap: 10px;
  transition: border-color 150ms ease, transform 150ms ease, background-color 150ms ease;
}
.command-card:hover { border-color: var(--border-strong); transform: translateY(-1px); background: var(--surface-hover); }
.command-card.is-disabled { opacity: 0.55; }
.command-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.command-card-name { font-family: var(--font-mono); font-weight: 700; font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.command-card-desc { font-size: 13px; color: var(--fg-muted); line-height: 1.45; flex: 1; }
.command-card-foot { display: flex; align-items: center; justify-content: space-between; }
.type-pill { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; }
.type-pill.type-slash { background: rgba(244,63,94,0.16); color: #F9A8D4; }
.type-pill.type-prefix { background: rgba(236,72,153,0.16); color: #F5A8CE; }

/* ================= toast ================= */
#toast {
  position: fixed; bottom: var(--space-5); right: var(--space-5);
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: 14px; max-width: 340px; box-shadow: 0 12px 32px rgba(0,0,0,0.5);
  transform: translateY(12px); opacity: 0; pointer-events: none;
  transition: transform 200ms var(--ease-out), opacity 200ms ease; z-index: 1000;
  display: flex; align-items: center; gap: 10px;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.toast-error { border-color: var(--danger); }
#toast.toast-ok { border-color: var(--success); }

/* ================= responsive ================= */
@media (max-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  #app-shell { grid-template-columns: 1fr; }
  #sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border); padding: var(--space-3); }
  .brand-name, .nav-group-label { display: none; }
  nav.nav-list { flex-direction: row; }
  .nav-item { padding: 9px 12px; }
  #sidebar-footer { margin-top: 0; margin-left: auto; border-top: none; padding-top: 0; flex-direction: row; align-items: center; }
  .user-name { display: none; }
  #main { padding: var(--space-4); }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .login-card { padding: var(--space-5) var(--space-4); }
  #topbar { flex-direction: column; align-items: stretch; }
  #guild-select { min-width: 0; width: 100%; }
}
