/* ============================================================
   InfluQa Design System
   Single source of truth for all styles across the platform.
   Version: 2.0 — dark/light, gold accent, DM Sans + Space Grotesk
   Sections:
     1.  CSS TOKENS
     2.  LIGHT MODE OVERRIDES
     3.  RESET & BASE
     4.  TYPOGRAPHY
     5.  LAYOUT
     6.  NAVIGATION
     7.  BUTTONS
     8.  CARDS
     9.  FORM ELEMENTS
     10. DROPDOWNS
     11. BADGES
     12. BACKGROUNDS
     13. SHADOWS
     14. SPACING
     15. FOOTER
     16. PANEL LAYOUT & SIDEBAR
     17. ANIMATIONS
     18. SCROLLBAR & SELECTION
     19. RESPONSIVE BREAKPOINTS
   ============================================================ */


/* ============================================================
   1. CSS TOKENS
   ============================================================ */
:root {
  /* Backgrounds */
  --bg: #0b0b0d;
  --bg-raised: #101013;
  --bg-card: #151519;
  --bg-card-hover: #1c1c22;

  /* Foreground / text */
  --fg: #f0ece4;
  --fg-muted: #918d85;
  --fg-dim: #58545e;

  /* Accent — gold */
  --accent: #d4a843;
  --accent-soft: rgba(212, 168, 67, 0.10);
  --accent-hover: #e0b94f;
  --accent-glow: rgba(212, 168, 67, 0.25);

  /* State colors */
  --success: #3ecf8e;
  --success-soft: rgba(62, 207, 142, 0.10);
  --danger: #ef5a5a;
  --danger-soft: rgba(239, 90, 90, 0.10);
  --warning: #f0a030;
  --warning-soft: rgba(240, 160, 48, 0.10);
  --info: #5ba8f5;
  --info-soft: rgba(91, 168, 245, 0.10);

  /* Borders */
  --border: rgba(255, 255, 255, 0.06);
  --border-active: rgba(212, 168, 67, 0.30);

  /* Radius scale */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.20);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.30);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.45);

  /* Transition */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);

  /* Sidebar */
  --sidebar-width: 272px;
  --sidebar-collapsed-width: 68px;
}


/* ============================================================
   2. LIGHT MODE OVERRIDES
   ============================================================ */
html.light {
  --bg: #f5f4f1;
  --bg-raised: #edecea;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f7f4;
  --fg: #111010;
  --fg-muted: #55524e;
  --fg-dim: #99958f;
  --border: rgba(0, 0, 0, 0.08);
  --border-active: rgba(212, 168, 67, 0.35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.12);
}


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

html {
  scroll-behavior: smooth;
}

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

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

img, svg {
  display: block;
  max-width: 100%;
}

button {
  cursor: pointer;
  font-family: inherit;
}


/* ============================================================
   4. TYPOGRAPHY
   ============================================================ */
.heading {
  font-family: 'Space Grotesk', 'DM Sans', sans-serif;
  font-weight: 700;
  line-height: 1.1;
  color: var(--fg);
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: clamp(26px, 3.5vw, 40px);
  font-weight: 700;
  color: var(--fg);
  line-height: 1.12;
  margin-bottom: 16px;
}

.section-desc {
  font-size: 16px;
  color: var(--fg-muted);
  line-height: 1.7;
  max-width: 600px;
  margin-bottom: 40px;
}

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

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

.dim {
  color: var(--fg-dim);
}


/* ============================================================
   5. LAYOUT
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 100px 0;
}

.section-sm {
  padding: 64px 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.gap-sm { gap: 8px; }
.gap-md { gap: 16px; }
.gap-lg { gap: 24px; }


/* ============================================================
   6. NAVIGATION
   ============================================================ */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 24px;
  height: 72px;
  display: flex;
  align-items: center;
  background: rgba(11, 11, 13, 0.60);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: all 0.4s ease;
}

html.light .nav {
  background: rgba(245, 244, 241, 0.80);
}

.nav.scrolled {
  border-bottom-color: var(--border);
  background: rgba(11, 11, 13, 0.92);
}

html.light .nav.scrolled {
  background: rgba(245, 244, 241, 0.97);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 2px;
  text-decoration: none;
}

.nav-brand .accent { color: var(--accent); }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
}

.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 400;
  color: var(--fg-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  border: none;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link:hover, .nav-link.active {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}

html.light .nav-link:hover,
html.light .nav-link.active {
  background: rgba(0, 0, 0, 0.05);
}

/* Dropdown */
.nav-dropdown {
  position: relative;
}

.nav-dropdown-btn {
  cursor: pointer;
}

.nav-dropdown-btn i.chevron {
  font-size: 10px;
  transition: transform var(--transition);
}

.nav-dropdown:hover .nav-dropdown-btn i.chevron,
.nav-dropdown.open .nav-dropdown-btn i.chevron {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: all 0.22s ease;
  z-index: 200;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--fg-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.nav-dropdown-menu a:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}

.nav-dropdown-menu a i {
  width: 16px;
  text-align: center;
  color: var(--fg-dim);
  font-size: 12px;
}

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

/* Mobile nav toggle */
.nav-mobile-btn {
  display: none;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  font-size: 16px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Theme toggle */
.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 14px;
}

.theme-toggle-btn:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Mobile overlay menu */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(11, 11, 13, 0.97);
  backdrop-filter: blur(20px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

html.light .mobile-menu {
  background: rgba(245, 244, 241, 0.97);
}

.mobile-menu.open {
  opacity: 1;
  pointer-events: all;
}

.mobile-menu a {
  font-size: 20px;
  font-weight: 500;
  color: var(--fg-muted);
  text-decoration: none;
  padding: 12px 24px;
  transition: color var(--transition);
}

.mobile-menu a:hover {
  color: var(--fg);
}

.mobile-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 40px;
  color: var(--fg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: all var(--transition);
}

.mobile-close-btn:hover {
  color: var(--fg);
}


/* ============================================================
   7. BUTTONS
   ============================================================ */
.btn {
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
  border: 1px solid var(--border);
}

html.light .btn-secondary {
  background: rgba(0, 0, 0, 0.04);
  color: var(--fg);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.14);
}

html.light .btn-secondary:hover {
  background: rgba(0, 0, 0, 0.07);
}

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  padding: 8px 12px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  transition: color var(--transition);
}

.btn-ghost:hover { color: var(--fg); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border: 1px solid rgba(239, 90, 90, 0.18);
}

.btn-danger:hover {
  background: rgba(239, 90, 90, 0.18);
}

.btn-success {
  background: var(--success-soft);
  color: var(--success);
  border: 1px solid rgba(62, 207, 142, 0.18);
}

.btn-success:hover {
  background: rgba(62, 207, 142, 0.18);
}

.btn-lg {
  padding: 14px 32px;
  font-size: 15px;
  border-radius: var(--radius);
}

.btn-sm {
  padding: 7px 16px;
  font-size: 13px;
  border-radius: var(--radius-xs);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.btn-full { width: 100%; justify-content: center; }


/* ============================================================
   8. CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
}

.card-sm {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all var(--transition);
}

.card-hover:hover {
  border-color: rgba(255, 255, 255, 0.10);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}

.card-accent {
  border-color: var(--border-active);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg-card) 50%);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

.card-subtitle {
  font-size: 13px;
  color: var(--fg-dim);
  margin-top: 2px;
}

/* Stat card */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: all var(--transition);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.10);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-dim);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--fg);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-change {
  font-size: 11px;
  font-weight: 600;
}

.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }


/* ============================================================
   9. FORM ELEMENTS
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 20px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-muted);
}

.form-hint {
  font-size: 12px;
  color: var(--fg-dim);
}

.form-error {
  font-size: 12px;
  color: var(--danger);
}

.input,
.select,
.textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--fg);
  transition: all var(--transition);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

html.light .input,
html.light .select,
html.light .textarea {
  background: rgba(0, 0, 0, 0.03);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--fg-dim);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  background: rgba(212, 168, 67, 0.04);
  box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.08);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2358545e' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-left: 40px;
}

.input-group-icon {
  position: absolute;
  left: 14px;
  color: var(--fg-dim);
  font-size: 14px;
  pointer-events: none;
}

/* Checkbox & radio */
.checkbox-group,
.radio-group {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"],
.radio-group input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}


/* ============================================================
   10. DROPDOWNS (UI component, not NAV)
   ============================================================ */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: all 0.2s ease;
  z-index: 150;
}

.dropdown.open .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--fg-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font-family: inherit;
}

.dropdown-item:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}

.dropdown-item.danger:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}


/* ============================================================
   11. BADGES
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--fg-muted);
}

.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(212, 168, 67, 0.15);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-info {
  background: var(--info-soft);
  color: var(--info);
}

.badge-lg {
  padding: 5px 14px;
  font-size: 12px;
}


/* ============================================================
   12. BACKGROUNDS
   ============================================================ */
.bg-card   { background: var(--bg-card); }
.bg-raised { background: var(--bg-raised); }
.bg-accent-soft { background: var(--accent-soft); }


/* ============================================================
   13. SHADOWS
   ============================================================ */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow    { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: var(--shadow-lg); }


/* ============================================================
   14. SPACING
   ============================================================ */
.p-card    { padding: 28px; }
.p-card-sm { padding: 20px; }
.p-section { padding: 100px 0; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mb-8 { margin-bottom: 32px; }


/* ============================================================
   15. FOOTER
   ============================================================ */
.footer {
  padding: 64px 0 32px;
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 48px;
}

.footer-brand-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 12px;
  display: inline-block;
  text-decoration: none;
}

.footer-brand-name .accent { color: var(--accent); }

.footer-desc {
  font-size: 13px;
  color: var(--fg-dim);
  line-height: 1.7;
  max-width: 280px;
  margin-bottom: 20px;
}

.footer-socials {
  display: flex;
  gap: 8px;
}

.footer-social {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-dim);
  font-size: 14px;
  text-decoration: none;
  transition: all var(--transition);
}

.footer-social:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.footer-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--fg-muted);
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--fg-dim);
  text-decoration: none;
  padding: 4px 0;
  transition: color var(--transition);
}

.footer-col a:hover { color: var(--fg); }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--fg-dim);
  flex-wrap: wrap;
  gap: 12px;
}

.footer-bottom-links {
  display: flex;
  gap: 20px;
}

.footer-bottom-links a {
  color: var(--fg-dim);
  text-decoration: none;
  transition: color var(--transition);
}

.footer-bottom-links a:hover { color: var(--fg); }


/* ============================================================
   16. PANEL LAYOUT & SIDEBAR
   ============================================================ */
.panel-layout {
  display: flex;
  min-height: 100vh;
}

.panel-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  display: flex;
  flex-direction: column;
  transition: width var(--transition), transform var(--transition);
}

.panel-sidebar::-webkit-scrollbar { width: 4px; }
.panel-sidebar::-webkit-scrollbar-track { background: transparent; }
.panel-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.panel-sidebar::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.12); }

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

.panel-sidebar.collapsed .logo-text,
.panel-sidebar.collapsed .sidebar-search,
.panel-sidebar.collapsed .panel-user-details,
.panel-sidebar.collapsed .nav-section-title,
.panel-sidebar.collapsed .nav-section-chevron,
.panel-sidebar.collapsed .nav-item-label,
.panel-sidebar.collapsed .nav-item-badge,
.panel-sidebar.collapsed .footer-link span {
  opacity: 0;
  visibility: hidden;
  width: 0;
  overflow: hidden;
}

.panel-sidebar.collapsed .sidebar-header { justify-content: center; }
.panel-sidebar.collapsed .panel-user-info { justify-content: center; }
.panel-sidebar.collapsed .nav-section-header,
.panel-sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.panel-sidebar.collapsed .panel-sidebar-footer { padding: 12px 8px; }
.panel-sidebar.collapsed .footer-link { justify-content: center; }

/* Sidebar header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--fg);
  text-decoration: none;
  transition: opacity var(--transition);
}

.panel-logo .accent { color: var(--accent); }

.logo-icon {
  font-size: 18px;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 6px;
  cursor: pointer;
  color: var(--fg-muted);
  transition: all var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg);
}

/* Sidebar search */
.sidebar-search {
  position: relative;
  padding: 14px 16px 8px;
}

.search-icon {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--fg-dim);
  pointer-events: none;
}

.search-input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  color: var(--fg);
  font-size: 13px;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

html.light .search-input {
  background: rgba(0, 0, 0, 0.04);
}

.search-input::placeholder { color: var(--fg-dim); }

.search-input:focus {
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* User info block */
.panel-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: 8px 12px;
  background: rgba(212, 168, 67, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}

.panel-user-info:hover {
  border-color: var(--border-active);
}

.user-avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.panel-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #c4882a);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--bg);
  font-family: 'Space Grotesk', sans-serif;
}

.user-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.user-status-dot.online  { background: var(--success); }
.user-status-dot.away    { background: var(--warning); }
.user-status-dot.offline { background: var(--fg-dim); }

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

.panel-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel-user-email {
  font-size: 11px;
  color: var(--fg-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 2px 0;
}

.panel-user-tier {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 20px;
  border: 1px solid rgba(212, 168, 67, 0.15);
}

/* Panel navigation */
.panel-nav {
  flex: 1;
  padding: 8px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-standalone { margin-bottom: 4px; }

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

.nav-section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--fg-dim);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  transition: color var(--transition);
  border-radius: var(--radius-xs);
}

.nav-section-header:hover { color: var(--fg-muted); }

.nav-section-icon { font-size: 13px; }
.nav-section-title { flex: 1; text-align: left; }
.nav-section-chevron { transition: transform var(--transition); }
.nav-section-header[aria-expanded="false"] .nav-section-chevron { transform: rotate(-90deg); }

/* Nav items */
.nav-section-content {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease;
}

.nav-section-content.open { max-height: 1000px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 400;
  color: var(--fg-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.nav-item-indicator {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 0;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
  transition: height var(--transition);
}

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

html.light .nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

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

.nav-item.active .nav-item-indicator {
  height: 60%;
}

.nav-item-icon { font-size: 15px; flex-shrink: 0; }
.nav-item-label { flex: 1; }

.nav-item-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
}

.nav-item-badge.notification {
  background: var(--danger);
  color: white;
}

/* Admin section accent */
.admin-section .nav-section-header { color: var(--accent); }

/* Panel main content area */
.panel-main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  transition: margin-left var(--transition);
  padding: 32px;
}

.panel-main.expanded { margin-left: var(--sidebar-collapsed-width); }

.panel-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.panel-page-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--fg);
}

.panel-page-subtitle {
  font-size: 14px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* Mobile sidebar */
.mobile-menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  width: 40px;
  height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.panel-mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  backdrop-filter: blur(4px);
}

/* Panel sidebar footer */
.panel-sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.footer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--fg-dim);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.footer-link:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}

/* Panel tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table.panel-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.panel-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-dim);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.panel-table td {
  padding: 14px 16px;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
}

.panel-table tbody tr:last-child td { border-bottom: none; }

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

/* Panel empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  color: var(--fg-dim);
}

.empty-state-icon {
  font-size: 40px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-muted);
  margin-bottom: 8px;
}

.empty-state-desc {
  font-size: 13px;
  max-width: 300px;
  margin-bottom: 20px;
}

/* Panel list items */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.list-item:last-child { border-bottom: none; }
.list-item:hover { background: rgba(255, 255, 255, 0.02); }

/* Alert / notice box */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}

.alert-info    { background: var(--info-soft); color: var(--info); border: 1px solid rgba(91,168,245,.15); }
.alert-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(62,207,142,.15); }
.alert-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(240,160,48,.15); }
.alert-danger  { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(239,90,90,.15); }


/* ============================================================
   17. ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-10px); }
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50%       { box-shadow: 0 0 0 6px transparent; }
}

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

.anim-fade-up { animation: fadeUp 0.6s ease both; }
.anim-fade-in { animation: fadeIn 0.4s ease both; }
.anim-float   { animation: float 6s ease-in-out infinite; }

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: pulse-glow 2s infinite;
  display: inline-block;
}


/* ============================================================
   18. SCROLLBAR & SELECTION
   ============================================================ */
::selection {
  background: var(--accent);
  color: var(--bg);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.15); }

html.light ::-webkit-scrollbar-track { background: var(--bg-raised); }
html.light ::-webkit-scrollbar-thumb { background: rgba(0, 0, 0, 0.12); }
html.light ::-webkit-scrollbar-thumb:hover { background: rgba(0, 0, 0, 0.20); }


/* ============================================================
   19. RESPONSIVE BREAKPOINTS
   ============================================================ */
@media (max-width: 1100px) {
  .footer-grid { grid-template-columns: 1fr 1fr 1fr; }
  .footer-grid > div:first-child { grid-column: 1 / -1; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .nav-actions .btn-secondary { display: none; }
  .nav-mobile-btn { display: flex; }
  .mobile-menu { display: flex; }

  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }

  .panel-sidebar { transform: translateX(-100%); }
  .panel-sidebar.mobile-open { transform: translateX(0); }
  .panel-mobile-overlay { display: block; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
  .panel-mobile-overlay.open { opacity: 1; pointer-events: all; }
  .mobile-menu-toggle { display: flex; }
  .panel-main { margin-left: 0; padding: 16px; padding-top: 72px; }
}

@media (max-width: 640px) {
  .container { padding: 0 16px; }
  .section, .p-section { padding: 64px 0; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .card { padding: 20px; }
  .stat-value { font-size: 22px; }
  .section-title { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
