/* ============================================================
   E-246 Dashboard — Modern Black Theme
   ============================================================ */

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

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  /* Backgrounds */
  --bg-0: #000000;
  --bg-1: #0a0a0a;
  --bg-2: #111111;
  --bg-3: #181818;
  --bg-4: #222222;

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-active: rgba(255, 255, 255, 0.18);

  /* Text */
  --text-1: #ffffff;
  --text-2: #a0a0a0;
  --text-3: #666666;

  /* Accent — subtle white/grey */
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.08);
  --accent-glow: rgba(255, 255, 255, 0.04);

  /* Status */
  --success: #4ade80;
  --success-bg: rgba(74, 222, 128, 0.08);
  --danger: #f87171;
  --danger-bg: rgba(248, 113, 113, 0.08);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.08);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.08);

  /* Layout */
  --sidebar-w: 240px;
  --sidebar-collapsed: 64px;
  --topnav-h: 56px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;

  /* Transitions */
  --t-fast: 120ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.7);

  /* Legacy aliases (keep views working) */
  --bg-dark: var(--bg-0);
  --bg-mid: var(--bg-1);
  --bg-light: var(--bg-2);
  --bg-elevated: var(--bg-3);
  --primary: #888888;
  --primary-glow: rgba(136,136,136,0.15);
  --text-main: var(--text-1);
  --text-muted: var(--text-2);
  --text-secondary: #cccccc;
  --glass-bg: rgba(255,255,255,0.025);
  --glass-border: var(--border);
  --glass-hover: rgba(255,255,255,0.04);
  --radius-sm: var(--r-sm);
  --radius-md: var(--r-md);
  --radius-lg: var(--r-lg);
  --transition-base: var(--t-base);
  --transition-fast: var(--t-fast);
  --accent-glow: rgba(255,255,255,0.06);
  --shadow-elevated: var(--shadow-md);
  --sidebar-width: var(--sidebar-w);
  --topnav-height: var(--topnav-h);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'IBM Plex Sans Arabic', 'Inter', 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-0);
  color: var(--text-1);
  height: 100vh;
  overflow: hidden;
  display: flex;
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 100px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.16);
}

/* ============================================================
   TOP NAVIGATION
   ============================================================ */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topnav-h);
  background: var(--bg-0);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.top-nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 0.95rem;
}
.sidebar-toggle:hover {
  background: var(--accent-dim);
  color: var(--text-1);
  border-color: var(--border-hover);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-1);
  text-decoration: none;
  letter-spacing: -0.2px;
  transition: opacity var(--t-fast);
}
.brand:hover { opacity: 0.75; }
.brand i { color: var(--text-2); font-size: 1rem; }
.brand-logo {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
  flex: 0 0 28px;
}


.top-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 0.9rem;
  position: relative;
}
.nav-icon-btn:hover {
  background: var(--accent-dim);
  color: var(--text-1);
  border-color: var(--border);
}
.nav-icon-btn .badge {
  position: absolute;
  top: 7px; right: 7px;
  width: 7px; height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid var(--bg-0);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 12px 5px 5px;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all var(--t-fast);
  border: 1px solid transparent;
  text-decoration: none;
  color: var(--text-1);
}
.user-menu:hover {
  background: var(--accent-dim);
  border-color: var(--border);
}
.user-menu img {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
}
.user-menu span {
  font-size: 0.875rem;
  font-weight: 600;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.app-sidebar {
  position: fixed;
  top: var(--topnav-h); right: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-0);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 900;
  overflow: hidden;
  transition: width var(--t-slow);
}

.app-sidebar.collapsed { width: var(--sidebar-collapsed); }

.app-sidebar.collapsed .sidebar-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.app-sidebar.collapsed .nav-link {
  justify-content: center;
  padding: 12px;
}
.app-sidebar.collapsed .nav-link i { margin: 0; font-size: 1.1rem; }
.app-sidebar.collapsed .sidebar-header,
.app-sidebar.collapsed .sidebar-footer,
.app-sidebar.collapsed .nav-divider,
.app-sidebar.collapsed .active-server-widget {
  opacity: 0;
  pointer-events: none;
  height: 0;
  padding: 0;
  margin: 0;
  border: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sidebar-header h2 {
  font-size: 0.875rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 600;
}
.sidebar-header h2 i { color: var(--text-2); font-size: 1rem; }

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 10px 8px;
}

.nav-menu {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-menu li { margin: 0; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--r-sm);
  font-weight: 500;
  font-size: 0.875rem;
  transition: all var(--t-fast);
  position: relative;
  white-space: nowrap;
}
.nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.9rem;
  flex-shrink: 0;
  transition: color var(--t-fast);
}
.nav-link:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-1);
}
.nav-link.active {
  background: rgba(255,255,255,0.06);
  color: var(--text-1);
  border-left: 2px solid var(--text-1);
  padding-right: 10px;
}
.nav-link.active i { color: var(--text-1); }

.nav-divider {
  color: var(--text-3);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin: 16px 8px 8px;
  font-weight: 700;
  display: block;
  padding: 0 4px;
}

.active-server-widget {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px;
  text-align: center;
  margin-bottom: 10px;
  transition: border-color var(--t-fast);
}
.active-server-widget:hover { border-color: var(--border-hover); }
.active-server-widget img {
  width: 56px; height: 56px;
  border-radius: var(--r-sm);
  margin: 0 auto 10px;
  border: 1px solid var(--border);
  display: block;
}
.active-server-widget .no-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-sm);
  margin: 0 auto 10px;
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--text-1);
  border: 1px solid var(--border);
}
.active-server-widget strong {
  display: block;
  font-size: 0.875rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-1);
}

.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

.user-profile-widget {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  transition: background var(--t-fast);
}
.user-profile-widget:hover { background: rgba(255,255,255,0.04); }
.user-profile-widget img {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  flex-shrink: 0;
}
.user-profile-info { display: flex; flex-direction: column; min-width: 0; }
.user-profile-info span {
  font-weight: 600;
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-profile-info small { color: var(--text-2); font-size: 0.7rem; }

/* ============================================================
   APP LAYOUT
   ============================================================ */
.app-wrapper {
  display: flex;
  width: 100%;
  height: 100vh;
  margin-right: var(--sidebar-w);
  transition: margin var(--t-slow);
}
.app-wrapper.sidebar-collapsed { margin-right: var(--sidebar-collapsed); }

.app-content {
  flex: 1;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  padding-top: calc(var(--topnav-h) + 24px);
}

/* ============================================================
   PAGE TRANSITION
   ============================================================ */
.page-transition { display: none; }
.page-transition-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-0);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

/* ============================================================
   CONTENT HEADER
   ============================================================ */
.content-header { margin-bottom: 24px; }
.content-header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-1);
  letter-spacing: -0.4px;
}
.content-header h1 i { color: var(--text-2); font-size: 1.2rem; }
.content-header p {
  color: var(--text-2);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* ============================================================
   GLASS PANELS / CARDS
   ============================================================ */
.glass-panel {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 14px;
  transition: border-color var(--t-base);
}
.glass-panel:hover { border-color: var(--border-hover); }

/* ============================================================
   BENTO GRID
   ============================================================ */
.bento-grid { display: grid; gap: 14px; margin-bottom: 18px; }
.bento-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.bento-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.bento-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.bento-grid .span-2 { grid-column: span 2; }
.bento-grid .span-3 { grid-column: span 3; }
.bento-grid .span-4 { grid-column: span 4; }

/* ============================================================
   METRIC CARDS
   ============================================================ */
.metric-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--t-base), transform var(--t-base);
  cursor: default;
}
.metric-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.02) 0%, transparent 60%);
  pointer-events: none;
}
.metric-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}
.metric-card .metric-icon {
  width: 38px; height: 38px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.06);
  color: var(--text-1);
  border: 1px solid var(--border);
}
.metric-card .metric-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--text-1);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.metric-card .metric-label {
  font-size: 0.8rem;
  color: var(--text-2);
  font-weight: 500;
  letter-spacing: 0.2px;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  margin-bottom: 7px;
  font-weight: 600;
  color: var(--text-1);
  font-size: 0.85rem;
}
.form-group small {
  display: block;
  color: var(--text-2);
  margin-top: 5px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.glass-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-1);
  font-family: inherit;
  font-size: 0.875rem;
  transition: all var(--t-fast);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.glass-input::placeholder { color: var(--text-3); }
.glass-input:focus {
  border-color: var(--border-active);
  background: rgba(255,255,255,0.06);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
}
.glass-input:hover:not(:focus) { border-color: var(--border-hover); }
.glass-input option {
  background: var(--bg-3);
  color: var(--text-1);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  padding: 10px 20px;
  border-radius: var(--r-md);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--t-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.875rem;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--text-1);
  color: var(--bg-0);
  border-color: var(--text-1);
}
.btn-primary:hover {
  background: rgba(255,255,255,0.85);
  border-color: transparent;
  box-shadow: 0 0 20px rgba(255,255,255,0.15);
}

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

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(248,113,113,0.2);
}
.btn-danger:hover {
  background: rgba(248,113,113,0.15);
  border-color: rgba(248,113,113,0.35);
}

.btn-large { padding: 12px 24px; font-size: 0.95rem; width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }

.disabled {
  opacity: 0.3;
  pointer-events: none;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--r-md);
  margin-bottom: 16px;
  font-weight: 500;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 9px;
  animation: slideDown 0.3s var(--t-fast) both;
  border: 1px solid;
}
.alert-success {
  background: var(--success-bg);
  border-color: rgba(74,222,128,0.2);
  color: var(--success);
}
.alert-danger {
  background: var(--danger-bg);
  border-color: rgba(248,113,113,0.2);
  color: var(--danger);
}

/* ============================================================
   GUILD CARDS
   ============================================================ */
.guild-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.guild-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  text-align: center;
  transition: all var(--t-base);
  cursor: pointer;
}
.guild-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.guild-card img,
.guild-card .no-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  margin: 0 auto 12px;
  display: block;
  transition: transform var(--t-base);
}
.guild-card:hover img,
.guild-card:hover .no-icon {
  transform: scale(1.06);
}
.guild-card .no-icon {
  background: var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: bold;
  color: var(--text-1);
  border: 1px solid var(--border);
}
.guild-card h3 {
  font-size: 1rem;
  margin-bottom: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-1);
}

/* ============================================================
   LISTS & TABLES
   ============================================================ */
.list-item {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--r-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  transition: border-color var(--t-fast);
}
.list-item:hover { border-color: var(--border-hover); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  padding: 10px 12px;
  text-align: right;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 0.875rem;
  transition: background var(--t-fast);
}
.table tr:hover td { background: rgba(255,255,255,0.02); }

.table-responsive {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-2); }
.text-primary { color: var(--text-1); }
.text-secondary { color: var(--text-2); }
.text-main { color: var(--text-1); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.fw-bold { font-weight: 700; }
.opacity-70 { opacity: 0.7; }
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow-1 { flex-grow: 1; }
.align-items-center { align-items: center; }
.cursor-pointer { cursor: pointer; }
.gap-1 { gap: 8px; }
.gap-sm { gap: 6px; }
.gap-2 { gap: 14px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 14px; }
.mt-3 { margin-top: 22px; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 14px; }

hr, .divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

.section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.section-title i { color: var(--text-2); }

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

code {
  background: rgba(255,255,255,0.07);
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.82em;
  color: var(--text-1);
  border: 1px solid var(--border);
}

/* ============================================================
   GRIDS
   ============================================================ */
.grid-2col { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-2col-sm { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-form-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.grid-form-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }
.grid-form-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-form-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-form-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.grid-form-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }

.sticky-preview {
  position: sticky;
  top: calc(var(--topnav-h) + 16px);
  align-self: start;
}
.preview-column {
  position: sticky;
  top: 20px;
  align-self: start;
}

.tickets-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 20px;
  align-items: start;
}

/* ============================================================
   SPECIAL COMPONENTS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
}
.chart-card h3 {
  margin: 0 0 14px;
  font-size: 0.95rem;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.chart-container { position: relative; height: 240px; width: 100%; }

.role-row {
  background: rgba(255,255,255,0.025);
  padding: 14px;
  border-radius: var(--r-md);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  position: relative;
  transition: border-color var(--t-fast);
}
.role-row:hover { border-color: var(--border-hover); }

.question-row {
  background: rgba(255,255,255,0.025);
  padding: 14px;
  border-radius: var(--r-md);
  margin-bottom: 12px;
  border: 1px solid var(--border);
  position: relative;
  transition: border-color var(--t-fast);
}
.question-row:hover { border-color: var(--border-hover); }

.preview-container {
  position: relative;
  width: 100%;
  max-width: 800px;
  height: 400px;
  background-color: rgba(255,255,255,0.025);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top left;
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
  margin-bottom: 16px;
  overflow: hidden;
  user-select: none;
}

.preview-avatar {
  position: absolute;
  border: 2px solid var(--success);
  border-radius: 50%;
  background-color: rgba(255,255,255,0.1);
  cursor: move;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-username {
  position: absolute;
  cursor: move;
  font-family: 'CustomFont', sans-serif;
  font-weight: bold;
  white-space: nowrap;
}

.emoji-preview-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

.log-card {
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--r-md);
  margin-bottom: 0;
  transition: border-color var(--t-fast);
}
.log-card:hover { border-color: var(--border-hover); }

.info-box {
  padding: 13px 16px;
  border-radius: var(--r-md);
  background: var(--info-bg);
  border: 1px solid rgba(96,165,250,0.2);
  color: var(--info);
  font-size: 0.875rem;
}

/* Discord embed preview */
.discord-preview-container {
  background: var(--bg-2);
  border-radius: var(--r-md);
  padding: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--text-2);
  margin-top: 16px;
  display: flex;
  border: 1px solid var(--border);
}
.discord-embed {
  background-color: var(--bg-3);
  border-radius: var(--r-sm);
  border-left: 4px solid #888;
  padding: 14px;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  width: 100%;
}
.discord-button {
  background-color: #4f6fe0;
  color: white;
  padding: 9px 16px;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
}
.discord-select {
  background-color: #2b2d31;
  color: #dbdee1;
  border: 1px solid #3e4047;
  padding: 9px 12px;
  border-radius: 4px;
  font-size: 0.875rem;
  width: 100%;
  max-width: 400px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.embed-author { display: flex; align-items: center; margin-bottom: 7px; font-size: 14px; font-weight: 600; color: var(--text-1); }
.embed-author img { width: 24px; height: 24px; border-radius: 50%; margin-left: 7px; display: none; }
.embed-title { font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 7px; display: none; }
.embed-description { font-size: 14px; line-height: 1.375; white-space: pre-wrap; display: none; }
.embed-thumbnail { max-width: 80px; max-height: 80px; border-radius: 4px; margin-right: 14px; display: none; }
.embed-image { max-width: 100%; border-radius: 4px; margin-top: 14px; display: none; }
.embed-footer { display: flex; align-items: center; margin-top: 7px; font-size: 12px; color: var(--text-2); }
.embed-footer img { width: 20px; height: 20px; border-radius: 50%; margin-left: 7px; display: none; }
.embed-footer span { display: none; }
.embed-content-wrapper { display: flex; justify-content: space-between; }

/* ============================================================
   MOBILE NAVBAR
   ============================================================ */
.mobile-navbar { display: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .bento-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .bento-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
  .bento-grid .span-2,
  .bento-grid .span-3,
  .bento-grid .span-4 { grid-column: span 2; }
}

@media (max-width: 768px) {
  body { overflow: hidden; height: 100vh; }

  .top-nav { display: none; }
  .brand span { display: none; }

  .mobile-navbar {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-0);
    border-bottom: 1px solid var(--border);
    padding: 0 16px;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    z-index: 1000;
  }

  .mobile-menu-btn {
    background: transparent;
    border: none;
    color: var(--text-1);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: var(--r-sm);
    transition: background var(--t-fast);
  }
  .mobile-menu-btn:hover { background: var(--accent-dim); }

  .mobile-logo {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-1);
    display: flex;
    align-items: center;
    gap: 7px;
  }
  .mobile-logo i { color: var(--text-2); }
  .mobile-brand-logo {
    width: 25px;
    height: 25px;
    flex: 0 0 25px;
  }
  .mobile-spacer { width: 36px; }

  .app-sidebar {
    top: 0;
    right: -300px;
    bottom: 0;
    height: 100vh;
    width: 280px;
    z-index: 900;
    border-left: 1px solid var(--border);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 24px rgba(0,0,0,0.85);
  }
  .app-sidebar.active { right: 0; }
  .app-sidebar.collapsed { width: 280px; }
  .app-sidebar.collapsed .sidebar-text { opacity: 1; width: auto; }
  .app-sidebar.collapsed .nav-link { justify-content: flex-start; padding: 10px 14px; }
  .app-sidebar.collapsed .nav-link i { margin: 0; font-size: 0.95rem; }
  .app-sidebar.collapsed .sidebar-header,
  .app-sidebar.collapsed .sidebar-footer,
  .app-sidebar.collapsed .nav-divider,
  .app-sidebar.collapsed .active-server-widget {
    opacity: 1;
    pointer-events: auto;
    height: auto;
    padding: 12px 16px;
    margin: 0;
    overflow: visible;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 850;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--t-base), visibility var(--t-base);
  }
  .sidebar-overlay.active { opacity: 1; visibility: visible; }

  .app-wrapper { margin-right: 0 !important; padding-top: var(--topnav-h); }
  .app-content { 
    padding: 16px; 
    height: calc(100vh - var(--topnav-h)); 
    overflow-y: auto; 
    -webkit-overflow-scrolling: touch; 
  }

  .content-header h1 { font-size: 1.35rem; }
  .glass-panel { padding: 16px; border-radius: var(--r-md); }
  .btn { width: 100%; margin-bottom: 8px; }
  .guild-grid { grid-template-columns: 1fr; gap: 14px; }

  .grid-2col, .grid-2col-sm, .grid-3col { grid-template-columns: 1fr !important; gap: 14px !important; }
  .grid-form-2-1, .grid-form-1-2 { grid-template-columns: 1fr !important; gap: 12px !important; }
  .grid-form-2 { grid-template-columns: 1fr !important; gap: 12px !important; }
  .grid-form-3, .grid-form-4, .grid-form-5 { grid-template-columns: 1fr !important; gap: 12px !important; }

  .bento-grid.cols-4 { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  .bento-grid.cols-3 { grid-template-columns: repeat(2, 1fr) !important; gap: 12px !important; }
  .bento-grid.cols-2 { grid-template-columns: 1fr !important; gap: 12px !important; }
  .bento-grid .span-2,
  .bento-grid .span-3,
  .bento-grid .span-4 { grid-column: span 1; }

  .metric-card .metric-value { font-size: 1.4rem; }
  .sticky-preview, .preview-column { position: static !important; top: auto !important; }
  .tickets-layout { grid-template-columns: 1fr !important; }
  .tickets-layout .sticky-preview { position: static !important; }
  
  /* Discord preview responsive */
  .discord-preview-container {
    flex-direction: column !important;
    gap: 12px;
  }
  
  /* Welcome card canvas workspace scale container */
  .canvas-workspace {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
  }
  .greet-canvas-container {
    min-width: 600px;
  }
}

@media (max-width: 480px) {
  .app-content { 
    padding: 10px; 
  }
  .glass-panel { 
    padding: 10px; 
  }
  
  .bento-grid.cols-4,
  .bento-grid.cols-3,
  .bento-grid.cols-2 { 
    grid-template-columns: 1fr !important; 
    gap: 10px !important; 
  }
  
  .metric-card {
    padding: 12px !important;
  }
  .metric-card .metric-value {
    font-size: 1.25rem !important;
  }
}



/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Staggered card entrance */
.metric-card,
.glass-panel,
.guild-card {
  animation: fadeInUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.metric-card:nth-child(1), .glass-panel:nth-child(1), .guild-card:nth-child(1) { animation-delay: 0.03s; }
.metric-card:nth-child(2), .glass-panel:nth-child(2), .guild-card:nth-child(2) { animation-delay: 0.07s; }
.metric-card:nth-child(3), .glass-panel:nth-child(3), .guild-card:nth-child(3) { animation-delay: 0.11s; }
.metric-card:nth-child(4), .glass-panel:nth-child(4), .guild-card:nth-child(4) { animation-delay: 0.15s; }
.metric-card:nth-child(5), .glass-panel:nth-child(5), .guild-card:nth-child(5) { animation-delay: 0.19s; }
.metric-card:nth-child(6), .glass-panel:nth-child(6), .guild-card:nth-child(6) { animation-delay: 0.23s; }
.metric-card:nth-child(7), .glass-panel:nth-child(7), .guild-card:nth-child(7) { animation-delay: 0.27s; }
.metric-card:nth-child(8), .glass-panel:nth-child(8), .guild-card:nth-child(8) { animation-delay: 0.31s; }

.section-title {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: 0.08s;
}

.content-header {
  animation: fadeIn 0.4s ease both;
}

/* Scroll reveal */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Skeleton loading shimmer */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--r-sm);
}

/* Loading pulse */
.loading-pulse { animation: pulse 1.5s ease infinite; }

/* Logout & login buttons */
.logout-btn,
.login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
}
.logout-btn .sidebar-text,
.login-btn .sidebar-text { white-space: nowrap; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ============================================================
   🇸🇦 SAUDI NATIONAL DAY THEME
   ============================================================ */
:root {
  --saudi-green: #0b8f4d;
  --saudi-green-dark: #063d27;
  --saudi-green-deep: #052b1d;
  --saudi-glow: rgba(11, 143, 77, 0.22);
  --saudi-line: rgba(42, 196, 117, 0.28);
  --accent: #18a957;
  --accent-dim: rgba(24, 169, 87, 0.14);
  --accent-glow: rgba(24, 169, 87, 0.10);
  --primary: #18a957;
  --primary-glow: rgba(24, 169, 87, 0.18);
}

body {
  background:
    radial-gradient(circle at 15% 20%, rgba(11,143,77,.10), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(11,143,77,.08), transparent 28%),
    linear-gradient(135deg, #020604 0%, #06130d 48%, #020604 100%);
}

/* Elegant Saudi emblem watermark behind the whole dashboard */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url('/images/saudi-emblem.svg');
  background-repeat: no-repeat;
  background-position: center center;
  background-size: min(58vw, 620px);
  opacity: .035;
  filter: drop-shadow(0 0 35px rgba(18, 169, 87, .18));
}

body::after {
  content: "اليوم الوطني السعودي";
  position: fixed;
  left: 24px;
  bottom: 18px;
  z-index: 1;
  pointer-events: none;
  color: rgba(76, 201, 130, .12);
  font-size: clamp(18px, 2vw, 30px);
  font-weight: 700;
  letter-spacing: .5px;
}

.top-nav {
  background: rgba(2, 10, 6, .88);
  border-bottom-color: var(--saudi-line);
  box-shadow: 0 4px 30px rgba(0,0,0,.35), 0 1px 0 rgba(24,169,87,.08);
}

.brand i,
.brand-logo,
.nav-icon-btn:hover,
.sidebar-toggle:hover {
  color: #39c978;
}

.app-sidebar {
  background:
    linear-gradient(180deg, rgba(4,20,13,.98), rgba(2,9,6,.98));
  border-left-color: var(--saudi-line);
  box-shadow: -12px 0 40px rgba(0,0,0,.18);
}

.nav-link:hover {
  background: rgba(24,169,87,.08);
  color: #f5fff9;
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(24,169,87,.17), rgba(24,169,87,.04));
  color: #ffffff;
  border-left-color: #18a957;
  box-shadow: inset 0 0 22px rgba(24,169,87,.05);
}

.nav-link.active i,
.active-server-widget strong {
  color: #39c978;
}

.nav-divider {
  color: rgba(92, 211, 143, .55);
}

.active-server-widget {
  background: linear-gradient(135deg, rgba(24,169,87,.09), rgba(255,255,255,.02));
  border-color: rgba(24,169,87,.20);
}

.active-server-widget:hover {
  border-color: rgba(24,169,87,.38);
}

.app-content {
  position: relative;
  z-index: 2;
}

.app-content::before {
  content: "";
  position: absolute;
  top: 82px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(24,169,87,.30), transparent);
  pointer-events: none;
}

.glass-panel,
.metric-card,
.guild-card {
  border-color: rgba(24,169,87,.10);
}

.glass-panel:hover,
.metric-card:hover,
.guild-card:hover {
  border-color: rgba(24,169,87,.26);
  box-shadow: 0 8px 30px rgba(0,0,0,.28), 0 0 0 1px rgba(24,169,87,.04);
}

.btn-primary {
  background: linear-gradient(135deg, #0b8f4d, #16a85b);
  color: #fff;
  border-color: #18a957;
  box-shadow: 0 6px 18px rgba(11,143,77,.18);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #10a456, #1cbb68);
  color: #fff;
  border-color: #39c978;
  box-shadow: 0 0 24px rgba(24,169,87,.28);
}

.btn-secondary {
  background: rgba(24,169,87,.07);
  border-color: rgba(24,169,87,.18);
}

.btn-secondary:hover {
  background: rgba(24,169,87,.13);
  border-color: rgba(24,169,87,.30);
}

.sidebar-footer {
  border-top-color: rgba(24,169,87,.15);
}

.user-profile-widget:hover {
  background: rgba(24,169,87,.06);
}

.mobile-navbar {
  background: rgba(2,10,6,.95) !important;
  border-bottom-color: var(--saudi-line) !important;
}

.mobile-logo {
  color: #fff;
}

.mobile-logo i {
  color: #20b965;
}

/* Small national-day ribbon in the top bar */
.top-nav::after {
  content: "🇸🇦  اليوم الوطني السعودي";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  color: rgba(142, 239, 177, .72);
  font-size: .72rem;
  font-weight: 700;
  padding: 5px 12px;
  border: 1px solid rgba(24,169,87,.16);
  border-radius: 999px;
  background: rgba(24,169,87,.045);
  pointer-events: none;
}

@media (max-width: 768px) {
  body::before {
    background-size: 330px;
    background-position: 50% 55%;
    opacity: .028;
  }

  body::after {
    left: 12px;
    bottom: 12px;
    font-size: 15px;
  }
}

@media (max-width: 900px) {
  .top-nav::after { display: none; }
}


/* RC-SYSTEM neutral theme + click-to-open navigation (replaces seasonal styling) */
:root {
  --accent: #d4d4d4 !important;
  --accent-dim: rgba(255,255,255,.08) !important;
  --accent-glow: rgba(255,255,255,.045) !important;
  --primary: #bdbdbd !important;
  --primary-glow: rgba(255,255,255,.08) !important;
  --saudi-green: #777 !important;
  --saudi-green-dark: #111 !important;
  --saudi-green-deep: #080808 !important;
  --saudi-glow: rgba(255,255,255,.04) !important;
  --saudi-line: rgba(255,255,255,.10) !important;
}
body {
  background: radial-gradient(ellipse at 50% 0%, #171717 0%, #090909 48%, #050505 100%) !important;
}
body::before, body::after, .top-nav::after { display: none !important; content: none !important; }
.top-nav, .mobile-navbar {
  background: rgba(9,9,9,.96) !important;
  border-color: rgba(255,255,255,.09) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,.28) !important;
}
.brand i, .brand-logo, .nav-icon-btn:hover, .sidebar-toggle:hover, .mobile-logo i, .nav-link.active i, .active-server-widget strong { color: #e5e5e5 !important; }
.app-sidebar {
  right: -300px !important;
  width: min(280px, 86vw) !important;
  background: linear-gradient(180deg, #111 0%, #080808 100%) !important;
  border-left: 1px solid rgba(255,255,255,.10) !important;
  box-shadow: -12px 0 36px rgba(0,0,0,.45) !important;
  transition: right .26s ease !important;
}
.app-sidebar.active { right: 0 !important; width: min(280px, 86vw) !important; }
.app-sidebar.collapsed { width: min(280px, 86vw) !important; }
.app-sidebar.collapsed .sidebar-text { opacity: 1 !important; width: auto !important; }
.app-sidebar.collapsed .nav-link { justify-content: flex-start !important; padding: 10px 14px !important; }
.app-sidebar.collapsed .nav-link i { margin: 0 !important; font-size: .95rem !important; }
.app-sidebar.collapsed .sidebar-header, .app-sidebar.collapsed .sidebar-footer, .app-sidebar.collapsed .nav-divider, .app-sidebar.collapsed .active-server-widget { opacity: 1 !important; pointer-events: auto !important; height: auto !important; padding: initial !important; margin: initial !important; overflow: visible !important; }
.app-wrapper, .app-wrapper.sidebar-collapsed { margin-right: 0 !important; width: 100% !important; }
.nav-link:hover { background: rgba(255,255,255,.06) !important; color: #fff !important; }
.nav-link.active { background: rgba(255,255,255,.10) !important; color: #fff !important; border-left-color: #ddd !important; box-shadow: none !important; }
.nav-divider { color: #888 !important; }
.active-server-widget, .active-server-widget:hover { background: #111 !important; border-color: #2b2b2b !important; }
.glass-panel, .metric-card, .guild-card { border-color: rgba(255,255,255,.08) !important; }
.glass-panel:hover, .metric-card:hover, .guild-card:hover { border-color: rgba(255,255,255,.16) !important; box-shadow: 0 8px 28px rgba(0,0,0,.30) !important; }
.btn-primary { background: linear-gradient(135deg,#f1f1f1,#c8c8c8) !important; color: #111 !important; border-color: #ddd !important; box-shadow: none !important; }
.btn-primary:hover { background: #fff !important; color: #000 !important; border-color: #fff !important; box-shadow: 0 0 18px rgba(255,255,255,.08) !important; }
.btn-secondary { background: #151515 !important; border-color: #333 !important; }
.sidebar-footer { border-top-color: rgba(255,255,255,.09) !important; }
.sidebar-overlay { z-index: 850; }
.sidebar-overlay.active { opacity: 1; visibility: visible; }
@media (min-width: 769px) {
  .top-nav { display: flex !important; }
  .app-content { width: 100%; }
  .app-sidebar { top: var(--topnav-h) !important; bottom: 0 !important; height: auto !important; }
}
@media (max-width: 768px) {
  .top-nav { display: none !important; }
  .mobile-navbar { display: flex !important; }
  .app-sidebar { top: 0 !important; height: 100dvh !important; }
  .app-wrapper, .app-wrapper.sidebar-collapsed { margin-right: 0 !important; padding-top: var(--topnav-h) !important; }
  .app-content { width: 100% !important; max-width: 100vw !important; }
}


/* Sidebar category layout — scoped to sidebar to avoid affecting page layouts */
.active-server-card {
  margin: 2px 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--bg-1);
}
.active-server-banner {
  height: 74px;
  width: 100%;
  background-position: center;
  background-size: cover;
  background-color: #171717;
}
.active-server-banner-fallback {
  background-image: radial-gradient(ellipse at top, #303030 0%, #141414 65%, #090909 100%);
}
.active-server-identity {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 7px;
  padding: 0 10px 12px;
  text-align: center;
}
.active-server-avatar {
  width: 58px;
  height: 58px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid var(--bg-1);
  margin-top: -29px;
  background: var(--bg-2);
  position: relative;
}
.active-server-identity strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-1);
  font-size: .82rem;
}
.nav-top-links { margin-bottom: 8px; }
.nav-category {
  margin: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,.055);
  padding-bottom: 5px;
}
.nav-category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  min-height: 38px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 650;
  user-select: none;
  white-space: nowrap;
}
.nav-category-title::-webkit-details-marker { display: none; }
.nav-category-title:hover { background: rgba(255,255,255,.045); color: var(--text-1); }
.nav-category-title > .nav-icon { width: 18px; text-align: center; flex-shrink: 0; }
.category-chevron {
  margin-right: auto;
  font-size: .65rem;
  transition: transform var(--t-fast);
}
.nav-category[open] > .nav-category-title .category-chevron { transform: rotate(180deg); }
.nav-submenu {
  margin: 2px 0 3px 8px;
  padding: 3px 0 3px 7px;
  border-right: 1px solid rgba(255,255,255,.12);
  gap: 1px;
}
.nav-submenu .nav-link {
  padding-top: 8px;
  padding-bottom: 8px;
  font-size: .82rem;
}
.app-sidebar.collapsed .active-server-card,
.app-sidebar.collapsed .nav-category-title .sidebar-text,
.app-sidebar.collapsed .category-chevron {
  display: none;
}
.app-sidebar.collapsed .nav-category { border: 0; }
.app-sidebar.collapsed .nav-submenu { margin: 0; padding: 0; border: 0; }
@media (max-width: 768px) {
  .active-server-banner { height: 62px; }
  .active-server-avatar { width: 52px; height: 52px; margin-top: -26px; }
}

/* ============================================================
   RC-SYSTEM Dashboard polish pack (responsive + accessible)
   Safe visual overrides shared by all dashboard pages.
   ============================================================ */
:root {
  --ui-surface: #101010;
  --ui-surface-raised: #151515;
  --ui-surface-hover: #1b1b1b;
  --ui-border: rgba(255,255,255,.085);
  --ui-border-strong: rgba(255,255,255,.16);
  --ui-muted: #a1a1aa;
  --ui-focus: rgba(220,220,220,.55);
}

html { min-height: 100%; }
body { min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; }

/* Stable page frame: no horizontal drift or oversized content on mobile. */
.app-wrapper { min-width: 0; }
.app-content {
  min-width: 0;
  max-width: 100%;
  overflow-x: clip;
  scrollbar-gutter: stable;
}
.app-content > * { min-width: 0; }
.content-header {
  position: relative;
  padding: 2px 0 16px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--ui-border);
}
.content-header h1 { line-height: 1.45; overflow-wrap: anywhere; }
.content-header h1 i { opacity: .82; }
.content-header p { max-width: 76ch; line-height: 1.85; }

/* Sidebar: consistent rhythm, server identity at top, independent categories. */
.app-sidebar { isolation: isolate; }
.sidebar-content { scrollbar-width: thin; scrollbar-color: #363636 transparent; overscroll-behavior: contain; }
.active-server-card {
  margin: 8px 10px 12px;
  border-color: var(--ui-border);
  background: linear-gradient(180deg, #151515, #0c0c0c);
  box-shadow: 0 8px 24px rgba(0,0,0,.16);
}
.active-server-banner { min-height: 52px; }
.active-server-identity { padding-bottom: 13px; }
.active-server-avatar { box-shadow: 0 0 0 1px rgba(255,255,255,.06); }
.nav-top-links { padding: 0 8px; }
.nav-category {
  margin: 8px 10px;
  padding: 4px 0 7px;
  border-bottom: 1px solid rgba(255,255,255,.075);
}
.nav-category-title {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.nav-category-title:hover { border-color: var(--ui-border); }
.nav-category[open] > .nav-category-title { color: #f0f0f0; }
.nav-submenu {
  margin-top: 5px;
  margin-right: 7px;
  padding-right: 8px;
  border-right-color: rgba(255,255,255,.15);
}
.nav-link {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 8px;
  line-height: 1.45;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.nav-link:active { transform: scale(.99); }
.nav-link.active { border-color: rgba(255,255,255,.07); }
.nav-link .sidebar-text { overflow-wrap: anywhere; }
.sidebar-footer { background: linear-gradient(180deg, transparent, rgba(0,0,0,.25)); }
.user-profile-widget { border-radius: 10px; }

/* Cards and statistic panels share one quiet visual language. */
.glass-panel, .metric-card, .guild-card, .settings-card, .form-card,
.panel, .card, .command-card, .feature-card, .log-card {
  border-color: var(--ui-border);
  border-radius: var(--r-lg);
}
.glass-panel, .metric-card, .guild-card {
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.glass-panel { background: linear-gradient(145deg, rgba(255,255,255,.035), rgba(255,255,255,.012)); }
.metric-card, .guild-card { background: linear-gradient(145deg, #141414, #0e0e0e); }
.metric-card:hover, .guild-card:hover, .glass-panel:hover {
  border-color: var(--ui-border-strong);
  transform: translateY(-1px);
}
.guild-card { min-width: 0; overflow: hidden; }
.guild-card h3 { overflow-wrap: anywhere; }
.metric-label { line-height: 1.6; }
.bento-grid { align-items: stretch; }

/* Inputs, selects, toggles and text areas. */
input:not([type="checkbox"]):not([type="radio"]),
select, textarea, .form-control, .glass-input {
  max-width: 100%;
  min-width: 0;
  border-color: #303036;
  border-radius: 10px;
  background-color: #171719;
  color: #f4f4f5;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
input:not([type="checkbox"]):not([type="radio"]):hover,
select:hover, textarea:hover, .form-control:hover, .glass-input:hover { border-color: #414148; }
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus, .form-control:focus, .glass-input:focus {
  border-color: #777780;
  box-shadow: 0 0 0 3px rgba(180,180,190,.09);
  outline: none;
}
input::placeholder, textarea::placeholder { color: #73737d; opacity: 1; }
label { line-height: 1.65; }
.form-group { min-width: 0; }
.form-group label { display: inline-block; margin-bottom: 7px; }

/* Buttons: consistent sizing without forcing full-width on desktop. */
.btn {
  min-height: 38px;
  border-radius: 9px;
  font-weight: 600;
  letter-spacing: 0;
  transition: transform var(--t-fast), background var(--t-fast), border-color var(--t-fast), box-shadow var(--t-fast);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, button:disabled { opacity: .48; cursor: not-allowed; box-shadow: none !important; }
.btn-secondary, .btn-outline, .btn-light {
  background: #171717;
  border-color: #343434;
  color: #e5e5e5;
}
.btn-secondary:hover, .btn-outline:hover, .btn-light:hover { background: #222; border-color: #4a4a4a; color: #fff; }

/* Tables and long technical values must not break the whole viewport. */
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { border-color: var(--ui-border); vertical-align: middle; }
th { color: #d4d4d8; font-weight: 650; }
td { overflow-wrap: anywhere; }
pre, code, .code-block { max-width: 100%; overflow-wrap: anywhere; }
pre { overflow: auto; border-radius: 10px; }
img, svg, canvas, video, iframe { max-width: 100%; }

/* Feedback, alerts, empty states and loading states. */
.alert, .notice, .status-message { border-radius: 10px; line-height: 1.75; }
.empty-state { max-width: 680px; margin: 28px auto; padding: clamp(20px, 4vw, 36px); border: 1px dashed var(--ui-border-strong); border-radius: 16px; text-align: center; }
.empty-state p { color: var(--text-2); line-height: 1.85; }
hr { border: 0; border-top: 1px solid var(--ui-border); }

/* Responsive grids and forms. */
@media (min-width: 769px) {
  .app-content { padding-left: clamp(20px, 2.6vw, 38px); padding-right: clamp(20px, 2.6vw, 38px); }
  .guild-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr)); }
}
@media (max-width: 768px) {
  .app-content { padding: 16px 12px calc(22px + env(safe-area-inset-bottom)); }
  .content-header { margin-bottom: 17px; padding-bottom: 13px; }
  .content-header h1 { font-size: clamp(1.15rem, 4.8vw, 1.4rem); }
  .content-header p { font-size: .86rem; }
  .active-server-card { margin: 8px 8px 12px; }
  .nav-category { margin-right: 8px; margin-left: 8px; }
  .btn { max-width: 100%; white-space: normal; }
  .owner-guild-actions { flex-wrap: wrap; }
  .owner-guild-actions form, .owner-guild-actions a { flex: 1 1 90px; }
  .table-responsive, .table-wrap { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 520px; }
}
@media (max-width: 480px) {
  .app-content { padding: 13px 10px calc(18px + env(safe-area-inset-bottom)); }
  .glass-panel { padding: 13px; }
  .content-header h1 { gap: 8px; }
  .bento-grid.cols-4, .bento-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .bento-grid .span-2, .bento-grid .span-3, .bento-grid .span-4 { grid-column: span 2; }
  .metric-card { min-width: 0; }
  .metric-card .metric-value { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
