/* ── App Shell ─────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; background: var(--bg-base); }

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  height: 100vh; width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 100;
  transition: transform var(--transition-slow), width var(--transition),
              background-color 0.25s var(--ease), border-color 0.25s var(--ease);
  overflow-y: auto; overflow-x: hidden;
}

.sidebar-logo {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 0 var(--space-5);
  min-height: var(--topbar-height);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.logo-icon {
  width: 34px; height: 34px; background: var(--accent-violet);
  border-radius: var(--radius-md); display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; box-shadow: var(--shadow-glow);
  color: white;
}
.logo-icon svg { width: 18px; height: 18px; }
.logo-text {
  font-size: var(--text-lg); font-weight: 800;
  white-space: nowrap; overflow: hidden;
}

.sidebar-nav { flex: 1; padding: var(--space-3) 0; overflow-y: auto; }
.nav-section { margin-bottom: var(--space-4); }
.nav-section-label {
  display: block; font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); padding: var(--space-2) var(--space-5) var(--space-1);
}
.nav-item {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 10px var(--space-5);
  color: var(--text-secondary); font-size: var(--text-sm); font-weight: 500;
  transition: all var(--transition); position: relative;
  text-decoration: none; white-space: nowrap;
}
.nav-item:hover { color: var(--text-primary); background: var(--hover-item); }
.nav-item.router-link-active,
.nav-item.router-link-exact-active {
  color: var(--accent-violet-light);
  background: var(--accent-violet-dim);
}
.nav-item.router-link-active::before,
.nav-item.router-link-exact-active::before {
  content: ''; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; background: var(--accent-violet);
  border-radius: 0 var(--radius-full) var(--radius-full) 0;
}
.nav-item .icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.nav-item .icon svg { width: 18px; height: 18px; }
.nav-badge {
  margin-left: auto; background: var(--accent-violet); color: white;
  font-size: var(--text-xs); font-weight: 700; padding: 1px 7px;
  border-radius: var(--radius-full); min-width: 20px; text-align: center;
}
.sidebar-user {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border); margin-top: auto; flex-shrink: 0;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: var(--radius-full);
  background: var(--gradient-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 700; color: white; flex-shrink: 0;
}
.user-info { overflow: hidden; flex: 1; min-width: 0; }
.user-name {
  display: block; font-size: var(--text-sm); font-weight: 600;
  color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-email {
  display: block; font-size: var(--text-xs); color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Main Content ──────────────────────────────────────────── */
.main-content {
  flex: 1; margin-left: var(--sidebar-width);
  display: flex; flex-direction: column; min-height: 100vh; min-width: 0;
}

/* ── Topbar ────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-height);
  background: var(--topbar-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  transition: background-color 0.25s var(--ease), border-color 0.25s var(--ease);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 var(--space-6); flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: var(--space-4); }
.topbar-right { display: flex; align-items: center; gap: var(--space-3); }
.hamburger {
  display: none; width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: var(--radius-md); color: var(--text-secondary);
  transition: all var(--transition); cursor: pointer;
}
.hamburger:hover { background: var(--bg-elevated); color: var(--text-primary); }
.hamburger svg { width: 20px; height: 20px; }
.page-title { font-size: var(--text-lg); font-weight: 700; color: var(--text-primary); }

/* ── Page Content ──────────────────────────────────────────── */
.page-content { padding: var(--space-6); flex: 1; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--space-6); gap: var(--space-4); flex-wrap: wrap;
}
.page-header-left { display: flex; flex-direction: column; gap: var(--space-1); }
.page-header h2 { font-size: var(--text-2xl); font-weight: 800; margin: 0; }
.page-header p { color: var(--text-muted); font-size: var(--text-sm); margin: 0; }

/* ── Overlay (mobile) ──────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 90; backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
}

/* ── Grid utils ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }

/* ── Flex utils ────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ── Spacing utils ─────────────────────────────────────────── */
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-auto { margin-top: auto; }
.ml-auto { margin-left: auto; }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.w-full { width: 100%; }

/* ── Tablet ────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .sidebar { width: var(--sidebar-collapsed); }
  .sidebar .logo-text,
  .sidebar .nav-section-label,
  .sidebar .nav-item span:not(.nav-badge),
  .sidebar .nav-badge,
  .sidebar .user-info { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 10px; }
  .sidebar .nav-item::before { display: none; }
  .sidebar .sidebar-user { justify-content: center; padding: var(--space-4) var(--space-3); }
  .sidebar .sidebar-logo { justify-content: center; }
  .main-content { margin-left: var(--sidebar-collapsed); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
    box-shadow: var(--shadow-lg);
  }
  .sidebar .logo-text,
  .sidebar .nav-section-label,
  .sidebar .nav-item span,
  .sidebar .user-info { display: block; }
  .sidebar .nav-badge { display: inline-block; }
  .sidebar .nav-item { justify-content: flex-start; padding: 10px var(--space-5); }
  .sidebar .nav-item::before { display: block; }
  .sidebar .sidebar-user { justify-content: flex-start; padding: var(--space-4) var(--space-5); }
  .sidebar .sidebar-logo { justify-content: flex-start; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: var(--space-4); }
  .topbar { padding: 0 var(--space-4); }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}
