:root {
  --sidebar-width: 264px;
  --sidebar-bg: #111827;
  --sidebar-fg: #cbd5e1;
  --sidebar-hover: rgba(255, 255, 255, 0.06);
  --sidebar-active: #2563eb;
}

body { font-size: 0.95rem; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bs-tertiary-bg); }
.app-content { flex: 1; }
.topbar { background: var(--bs-body-bg); position: sticky; top: 0; z-index: 1020; min-height: 60px; }
.app-footer { background: var(--bs-body-bg); }

/* ---------- sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg) !important;
  color: var(--sidebar-fg);
  display: flex;
  flex-direction: column;
}
@media (min-width: 992px) {
  .sidebar { position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
}
.sidebar-brand { padding: 1rem 1.25rem; border-bottom: 1px solid rgba(255, 255, 255, 0.08); min-height: 60px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.75rem 0.6rem; }
.sidebar-footer { padding: 0.9rem 1.25rem; border-top: 1px solid rgba(255, 255, 255, 0.08); color: var(--sidebar-fg); }

.sidebar .nav-link {
  color: var(--sidebar-fg);
  border-radius: 0.5rem;
  padding: 0.55rem 0.75rem;
  margin-bottom: 2px;
  transition: background 0.15s, color 0.15s;
}
.sidebar .nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.sidebar .nav-link.active { background: var(--sidebar-active); color: #fff; }
.sidebar .nav-link.active-parent { color: #fff; }
.sidebar .menu-icon { width: 1.4rem; margin-right: 0.6rem; font-size: 1.05rem; }
.sidebar .chevron { font-size: 0.75rem; transition: transform 0.2s; }
.sidebar .nav-link.collapsed .chevron { transform: rotate(-90deg); }
.sidebar .submenu { padding-left: 1.1rem; border-left: 1px solid rgba(255, 255, 255, 0.08); margin-left: 1.05rem; }
.sidebar .submenu .nav-link { font-size: 0.9rem; padding: 0.4rem 0.7rem; }

/* ---------- branding ---------- */
.brand-logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #7c3aed); color: #fff;
}
.brand-logo-lg { width: 60px; height: 60px; font-size: 1.6rem; border-radius: 14px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis);
  font-weight: 600; font-size: 0.8rem;
}

/* ---------- cards ---------- */
.stat-card { transition: transform 0.15s, box-shadow 0.15s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.08) !important; }
.stat-icon { width: 42px; height: 42px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; }
.card-header { padding-top: 0.85rem; padding-bottom: 0.85rem; }
.table > :not(caption) > * > * { padding-top: 0.7rem; padding-bottom: 0.7rem; }
.flash-stack .alert { margin-bottom: 0.75rem; }
.perm-group { background: var(--bs-body-bg); }

/* ---------- auth ---------- */
.auth-body { background: radial-gradient(circle at top left, #1e3a8a, #0f172a 60%); min-height: 100vh; }
.auth-wrapper { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem; }
.auth-card { width: 100%; max-width: 420px; border-radius: 1rem; }

/* ---------- content pages ---------- */
.content-page img { max-width: 100%; height: auto; }
.content-page table { width: 100%; margin-bottom: 1rem; }
