:root {
  --bs-primary: #7c3aed;
  --bs-primary-rgb: 124, 58, 237;
  --bs-link-color: #7c3aed;
  --bs-link-color-rgb: 124, 58, 237;
  --bs-link-hover-color: #6d28d9;
  --bs-link-hover-color-rgb: 109, 40, 217;
  --sidebar-w: 260px;
}
[data-bs-theme="dark"] {
  --bs-link-color: #a78bfa;
  --bs-link-color-rgb: 167, 139, 250;
  --bs-link-hover-color: #c4b5fd;
  --bs-link-hover-color-rgb: 196, 181, 253;
}

.btn-primary {
  --bs-btn-bg: #7c3aed; --bs-btn-border-color: #7c3aed;
  --bs-btn-hover-bg: #6d28d9; --bs-btn-hover-border-color: #6d28d9;
  --bs-btn-active-bg: #5b21b6; --bs-btn-active-border-color: #5b21b6;
  --bs-btn-disabled-bg: #7c3aed; --bs-btn-disabled-border-color: #7c3aed;
  --bs-btn-focus-shadow-rgb: 124, 58, 237;
}
.btn-outline-primary {
  --bs-btn-color: #7c3aed; --bs-btn-border-color: #7c3aed;
  --bs-btn-hover-bg: #7c3aed; --bs-btn-hover-border-color: #7c3aed;
  --bs-btn-active-bg: #6d28d9; --bs-btn-active-border-color: #6d28d9;
  --bs-btn-focus-shadow-rgb: 124, 58, 237;
}
.form-control:focus, .form-select:focus {
  border-color: #a78bfa;
  box-shadow: 0 0 0 .25rem rgba(124, 58, 237, .25);
}
.form-check-input:checked { background-color: #7c3aed; border-color: #7c3aed; }

/* Layout */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #2e1065 0%, #4c1d95 100%);
  color: #e9d5ff;
  overflow-y: auto;
  z-index: 1040;
  transition: transform .25s ease;
}
.sidebar-brand {
  padding: 1.25rem 1.5rem;
  font-size: 1.2rem; font-weight: 700; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-nav { padding: .75rem; }
.sidebar-link, .sidebar-sublink {
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem .9rem; margin-bottom: 2px;
  color: #e9d5ff; text-decoration: none; border-radius: .5rem;
}
.sidebar-sublink { padding-left: 2.75rem; font-size: .93rem; }
.sidebar-link:hover, .sidebar-sublink:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-link.active, .sidebar-sublink.active { background: #7c3aed; color: #fff; }
.sidebar-link .chevron { transition: transform .2s; font-size: .75rem; }
.sidebar-link:not(.collapsed) .chevron { transform: rotate(180deg); }

.main-area { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.5rem;
  background: var(--bs-body-bg);
  border-bottom: 1px solid var(--bs-border-color);
  position: sticky; top: 0; z-index: 1030;
}
.content { padding: 1.5rem; flex: 1; }
.page-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 1.25rem; }

.card-stat .icon-box {
  width: 48px; height: 48px; border-radius: .75rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(124, 58, 237, .15); color: #7c3aed; font-size: 1.4rem;
}

[data-bs-theme="dark"] .icon-moon { display: none; }
[data-bs-theme="light"] .icon-sun { display: none; }

/* Login */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2e1065, #7c3aed);
  padding: 1rem;
}
.login-card { width: 100%; max-width: 400px; border: 0; border-radius: 1rem; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
}
