:root {
  --bg-main: #0c0b14;
  --bg-alt: #151326;
  --bg-soft: #1e1a35;
  --text-main: #e9e7ff;
  --text-soft: #a8a0d6;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --border: #2f2a53;
}

html[data-bs-theme='light'] {
  --bg-main: #f6f5ff;
  --bg-alt: #ffffff;
  --bg-soft: #ece9ff;
  --text-main: #1f1a38;
  --text-soft: #5e5a7d;
  --accent: #6d28d9;
  --accent-2: #8b5cf6;
  --border: #d8d1ff;
}

* {
  font-family: 'Manrope', sans-serif;
}

h1, h2, h3, h4, h5, .brand {
  font-family: 'Space Grotesk', sans-serif;
}

body.app-bg {
  background: radial-gradient(circle at 20% 0%, #291e53 0%, var(--bg-main) 50%), var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.app-sidebar {
  background: linear-gradient(180deg, rgba(139,92,246,0.18), rgba(0,0,0,0)) , var(--bg-alt);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
}

.brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-2);
}

.brand-sub {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.shell-link {
  color: var(--text-soft);
  border-radius: 10px;
}

.shell-link:hover,
.shell-link.active {
  background: var(--bg-soft);
  color: var(--text-main);
}

.app-main {
  padding: 16px 20px 24px;
}

.topbar {
  background: rgba(20, 18, 35, 0.72);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px 16px;
  backdrop-filter: blur(8px);
  margin-bottom: 18px;
}

.page-title {
  font-size: 1.35rem;
}

.content-wrap {
  animation: fadeInUp 280ms ease-out;
}

.stat-card,
.panel-card,
.glass-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 14px 34px rgba(4, 2, 12, 0.35);
}

.stat-label {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  margin-top: 4px;
}

.btn-brand {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0;
  color: #fff;
}

.btn-brand:hover {
  color: #fff;
  filter: brightness(1.08);
}

.form-control,
.form-select {
  background: var(--bg-soft);
  border-color: var(--border);
  color: var(--text-main);
}

.form-control:focus,
.form-select:focus {
  background: var(--bg-soft);
  color: var(--text-main);
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(139, 92, 246, 0.2);
}

.table-dark {
  --bs-table-bg: #151327;
  --bs-table-striped-bg: #1c1833;
}

.auth-page,
.center-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.auth-card {
  width: 100%;
  max-width: 460px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-fallback {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: white;
  font-weight: 700;
}

@media (max-width: 991px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
