/* ═══════════════════════════════════════════════════
   NEVERLAND RECORDS — Dashboard Design System
   Premium dark theme with teal/cyan accents
   ═══════════════════════════════════════════════════ */

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

/* ── CSS Custom Properties (Design Tokens) ── */
:root {
  /* Background Colors */
  --bg-primary: #050508;
  --bg-secondary: #0a0a12;
  --bg-tertiary: #0f0f1a;
  --bg-card: rgba(15, 15, 30, 0.6);
  --bg-card-hover: rgba(20, 20, 40, 0.8);
  --bg-overlay: rgba(0, 0, 0, 0.7);

  /* Accent Colors */
  --accent: #00d4aa;
  --accent-dim: rgba(0, 212, 170, 0.15);
  --accent-glow: rgba(0, 212, 170, 0.3);
  --accent-light: #33e0be;
  --accent-dark: #00a884;

  /* Status Colors */
  --status-open: #00d4aa;
  --status-claimed: #f1c40f;
  --status-closed: #e74c3c;

  /* Text Colors */
  --text-primary: #e8e8f0;
  --text-secondary: #8e8ea0;
  --text-muted: #5a5a6e;
  --text-accent: #00d4aa;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(0, 212, 170, 0.2);

  /* Glassmorphism */
  --glass-bg: rgba(15, 15, 30, 0.5);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: 20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 212, 170, 0.15);

  /* Discord Colors */
  --discord-blurple: #5865f2;
  --discord-blurple-hover: #4752c4;

  /* Sizing */
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ═══════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════ */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

/* Animated background */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
}

.login-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(0, 212, 170, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(88, 101, 242, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 80%, rgba(0, 168, 132, 0.05) 0%, transparent 50%);
  animation: bgPulse 12s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(-2%, -1%) scale(1.05); }
}

/* Floating particles */
.particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0); }
  10% { opacity: 0.6; }
  90% { opacity: 0.6; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1); }
}

.login-card {
  position: relative;
  z-index: 1;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cardAppear {
  0% { opacity: 0; transform: translateY(30px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.login-logo {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  margin: 0 auto 20px;
  background: linear-gradient(135deg, #0d1b1e, #1a4a4a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  border: 2px solid var(--border-accent);
  box-shadow: 0 0 30px rgba(0, 212, 170, 0.2);
}

.login-card h1 {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 6px;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card .subtitle {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 32px;
}

.login-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  background: var(--discord-blurple);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 15px rgba(88, 101, 242, 0.3);
}

.login-btn:hover {
  background: var(--discord-blurple-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 25px rgba(88, 101, 242, 0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.login-btn svg {
  width: 22px;
  height: 22px;
}

.login-footer {
  margin-top: 28px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   DASHBOARD LAYOUT
   ═══════════════════════════════════════ */

.dashboard {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition-slow);
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #0d1b1e, #1a4a4a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  border: 1px solid var(--border-accent);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.sidebar-title span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 12px;
  margin-bottom: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.nav-item .icon {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border-accent);
}

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

.user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

/* ── Main Content ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.content-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
  background: rgba(5, 5, 8, 0.8);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.content-header h2 {
  font-size: 1.15rem;
  font-weight: 700;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.content-body {
  padding: 28px;
}

/* ═══════════════════════════════════════
   STAT CARDS
   ═══════════════════════════════════════ */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-2px);
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.15;
}

.stat-card.open::after { background: var(--status-open); }
.stat-card.claimed::after { background: var(--status-claimed); }
.stat-card.closed::after { background: var(--status-closed); }
.stat-card.total::after { background: var(--discord-blurple); }

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card.open .stat-value { color: var(--status-open); }
.stat-card.claimed .stat-value { color: var(--status-claimed); }
.stat-card.closed .stat-value { color: var(--status-closed); }
.stat-card.total .stat-value { color: var(--discord-blurple); }

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.stat-icon {
  position: absolute;
  top: 18px;
  right: 18px;
  font-size: 1.5rem;
  opacity: 0.4;
}

/* ═══════════════════════════════════════
   TICKET TABLE
   ═══════════════════════════════════════ */

.table-section {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}

.table-title {
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-select,
.filter-input {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--accent);
}

.filter-input {
  width: 200px;
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.tickets-table {
  width: 100%;
  border-collapse: collapse;
}

.tickets-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  border-bottom: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.2);
}

.tickets-table td {
  padding: 14px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.02);
  vertical-align: middle;
}

.tickets-table tr {
  transition: background var(--transition-fast);
}

.tickets-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge.open {
  background: rgba(0, 212, 170, 0.12);
  color: var(--status-open);
}

.badge.claimed {
  background: rgba(241, 196, 15, 0.12);
  color: var(--status-claimed);
}

.badge.closed {
  background: rgba(231, 76, 60, 0.12);
  color: var(--status-closed);
}

/* Pulse animation for open tickets */
.badge.open::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--status-open);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

.category-tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-cell img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
}

.time-ago {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Action Buttons in Table */
.action-buttons {
  display: flex;
  gap: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.72rem;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 0 15px rgba(0, 212, 170, 0.3);
}

.btn-danger {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
}

.btn-danger:hover {
  background: rgba(231, 76, 60, 0.25);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
}

.btn-warning {
  background: rgba(241, 196, 15, 0.15);
  color: #f1c40f;
}

.btn-warning:hover {
  background: rgba(241, 196, 15, 0.25);
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
}

.pagination-info {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.pagination-buttons {
  display: flex;
  gap: 6px;
}

.page-btn {
  padding: 6px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

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

.page-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

/* ═══════════════════════════════════════
   CHART SECTION
   ═══════════════════════════════════════ */

.charts-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.chart-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
}

.chart-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Simple CSS bar chart */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 160px;
  padding-top: 10px;
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.bar {
  width: 100%;
  max-width: 24px;
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height var(--transition-slow);
}

.bar.opened {
  background: linear-gradient(to top, var(--accent-dark), var(--accent));
}

.bar.closed-bar {
  background: linear-gradient(to top, #c0392b, #e74c3c);
}

.bar-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  writing-mode: horizontal-tb;
}

/* Leaderboard */
.leaderboard-list {
  list-style: none;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.leaderboard-rank {
  font-size: 1.1rem;
  width: 28px;
  text-align: center;
}

.leaderboard-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
}

.leaderboard-count {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
}

/* ═══════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════ */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 20px;
}

.settings-card {
  background: var(--bg-card);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.settings-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group select,
.form-group input,
.form-group textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 212, 170, 0.1);
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.form-group .hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.toggle-group:last-child {
  border-bottom: none;
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
}

.toggle-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Toggle Switch */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.toggle input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle input:checked + .toggle-slider::before {
  background: #fff;
  transform: translateX(20px);
}

/* ═══════════════════════════════════════
   MODAL
   ═══════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  margin: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.modal p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ═══════════════════════════════════════
   TOAST NOTIFICATIONS
   ═══════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.3s ease-out;
  min-width: 280px;
  max-width: 400px;
}

.toast.success { border-left: 3px solid var(--status-open); }
.toast.error { border-left: 3px solid var(--status-closed); }
.toast.warning { border-left: 3px solid var(--status-claimed); }
.toast.info { border-left: 3px solid var(--discord-blurple); }

.toast-icon { font-size: 1.1rem; }

.toast.exiting {
  animation: toastOut 0.3s ease-in forwards;
}

@keyframes toastIn {
  0% { opacity: 0; transform: translateX(40px); }
  100% { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
  0% { opacity: 1; transform: translateX(0); }
  100% { opacity: 0; transform: translateX(40px); }
}

/* ═══════════════════════════════════════
   LOADING SKELETON
   ═══════════════════════════════════════ */

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-tertiary) 25%,
    rgba(255,255,255,0.05) 50%,
    var(--bg-tertiary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text {
  height: 14px;
  margin-bottom: 8px;
}

.skeleton-heading {
  height: 24px;
  width: 60%;
  margin-bottom: 12px;
}

.skeleton-card {
  height: 100px;
  border-radius: var(--radius-lg);
}

/* ═══════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 60px 20px;
}

.empty-state .icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.empty-state p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   REFRESH BUTTON
   ═══════════════════════════════════════ */

.refresh-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.refresh-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.refresh-btn.spinning {
  animation: spin 0.8s linear;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════
   CATEGORY MANAGER
   ═══════════════════════════════════════ */

.category-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.category-section-header h3 {
  margin-bottom: 0 !important;
}

.category-manager {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.category-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-normal);
  position: relative;
}

.category-item:hover {
  border-color: var(--border-accent);
  background: var(--bg-card-hover);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.05);
}

.category-item-emoji {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.category-item-info {
  flex: 1;
  min-width: 0;
}

.category-item-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.category-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-item-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.category-item-channel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 12px;
}

.category-item-channel.has-channel {
  color: var(--accent);
  background: var(--accent-dim);
}

.category-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.category-item-actions .btn {
  opacity: 0.6;
  transition: all var(--transition-fast);
}

.category-item:hover .category-item-actions .btn {
  opacity: 1;
}

.category-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.category-empty .icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.category-item-id {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-family: 'Courier New', monospace;
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 6px;
}

/* ═══════════════════════════════════════
   COOLDOWN BADGES
   ═══════════════════════════════════════ */

.cooldown-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
  font-family: 'Courier New', monospace;
}

.cooldown-badge.active {
  color: var(--accent);
  background: var(--accent-dim);
  animation: cooldownPulse 2s ease-in-out infinite;
}

.cooldown-badge.expired {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
}

@keyframes cooldownPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ═══════════════════════════════════════
   TOGGLE SWITCH
   ═══════════════════════════════════════ */

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 24px;
  transition: all var(--transition-normal);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: all var(--transition-normal);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: var(--accent);
}

/* ═══════════════════════════════════════
   LAYOUT UTILITIES
   ═══════════════════════════════════════ */

.full-width {
  grid-column: 1 / -1;
}

.color-input {
  height: 40px;
  cursor: pointer;
}

.cat-modal-grid {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.emoji-input {
  text-align: center;
  font-size: 1.3rem;
  padding: 8px;
}

.form-group--no-mb {
  margin-bottom: 0;
}

.form-group--toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.label--tight {
  margin-bottom: 2px;
}

.hint--no-mt {
  margin-top: 0;
}

.hint--mb {
  margin-bottom: 16px;
}

.blacklist-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.blacklist-row .filter-input:first-child {
  flex: 1;
  min-width: 200px;
}

.blacklist-row .filter-input:nth-child(2) {
  flex: 2;
  min-width: 200px;
}

.modal--sm {
  max-width: 540px;
}

.modal--xs {
  max-width: 420px;
}

.label-optional {
  color: var(--text-muted);
  font-weight: 400;
}

.chart-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  justify-content: center;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.chart-legend-dot--accent {
  background: var(--accent);
}

.chart-legend-dot--danger {
  background: #e74c3c;
}

.leaderboard-name--muted {
  color: var(--text-muted);
}

.stat-value--sm {
  font-size: 1.4rem;
}

.empty-state--padded {
  padding: 30px;
}

.text-muted {
  color: var(--text-muted);
}

/* ═══════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════ */

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
  .settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .table-header {
    flex-direction: column;
    align-items: stretch;
  }
  .filter-input {
    width: 100%;
  }
  .content-body {
    padding: 16px;
  }
  .category-item {
    flex-wrap: wrap;
  }
  .category-item-meta {
    align-items: flex-start;
    flex-direction: row;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .login-card {
    margin: 16px;
    padding: 32px 24px;
  }
  .category-section-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
}

