.sidebar {
  position: fixed;
  left: 16px;
  top: 16px;
  bottom: 16px;
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-2xl);
  display: flex;
  flex-direction: column;
  z-index: 100;
  padding: 24px 16px;
  box-shadow: var(--shadow-card);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  padding: 0 8px;
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--violet-mid), var(--violet-bright));
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: white;
  box-shadow: 0 0 16px rgba(139, 92, 246, 0.35);
  flex-shrink: 0;
}

.logo-text {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--violet-light), var(--violet-bright));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 0 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 3px;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(109, 59, 158, 0.35), rgba(139, 92, 246, 0.18));
  color: var(--violet-glow);
  border-color: var(--border-bright);
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.12);
}

.nav-item .nav-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-spacer {
  flex: 1;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--violet-mid), var(--violet-bright));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--violet-glow);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  transition: color 0.2s;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logout-btn:hover {
  color: var(--text-primary);
  background: var(--surface);
}

.main {
  margin-left: 272px;
  min-height: 100vh;
  position: relative;
  z-index: 10;
  padding-right: 16px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 50;
  background: rgba(30, 30, 30, 0.85);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

.topbar-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text-secondary);
}

.stat-pill strong {
  color: var(--violet-glow);
}

.content {
  padding: 0 24px 32px;
}

.section-tabs {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 28px;
  width: fit-content;
  box-shadow: var(--shadow-card);
}

.stab {
  padding: 10px 22px;
  border-radius: var(--r-sm);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stab.active {
  background: linear-gradient(135deg, var(--violet-mid), var(--violet-bright));
  color: #fff;
  box-shadow: 0 4px 16px rgba(139, 92, 246, 0.3);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
  animation: panelIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.keys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.keys-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.keys-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 22px;
}

.keys-count {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 4px 14px;
  font-size: 13px;
  color: var(--violet-glow);
  font-weight: 600;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main {
    margin-left: 0;
    padding-right: 0;
  }
  .topbar {
    top: 0;
    border-radius: 0;
    margin-bottom: 16px;
  }
  .section-tabs {
    width: 100%;
  }
  .stab {
    flex: 1;
    justify-content: center;
  }
}

.nav-item-parent {
  position: relative;
  cursor: pointer;
}

.nav-arrow {
  margin-left: auto;
  font-size: 12px;
  transition: transform 0.3s ease;
  color: var(--text-muted);
}

.nav-item-parent.active .nav-arrow {
  transform: rotate(180deg);
}

.nav-submenu {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.3s ease;
  opacity: 0;
  padding-left: 0;
}

.nav-submenu.open {
  max-height: 500px;
  opacity: 1;
}

.nav-subitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 42px;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s;
  border-left: 2px solid transparent;
  margin-bottom: 2px;
}

.nav-subitem:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
}

.nav-subitem.active {
  background: var(--surface-3);
  color: var(--violet-glow);
  border-left-color: var(--violet-bright);
}

.nav-subitem .subitem-count {
  margin-left: auto;
  background: var(--surface-2);
  border-radius: 99px;
  padding: 0 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.nav-subitem.active .subitem-count {
  background: rgba(139, 92, 246, 0.2);
  color: var(--violet-glow);
}

.nav-subitem .subitem-icon {
  font-size: 12px;
  width: 16px;
  text-align: center;
  flex-shrink: 0;
  margin-left: -26px;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.user-pill:hover {
  border-color: var(--border-bright);
  background: var(--surface-3);
}

.dropdown-menu {
  display: none;
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  min-width: 190px;
  background: rgba(30, 30, 30, 0.97);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 6px 0;
  box-shadow: var(--shadow-float);
  z-index: 200;
  backdrop-filter: blur(14px);
}

.dropdown-menu.open {
  display: block;
  animation: dropdownFadeIn 0.2s ease;
}

@keyframes dropdownFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: transparent;
  border: none;
  width: 100%;
  color: var(--text-secondary);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.dropdown-item:hover {
  background: var(--surface-2);
  color: var(--text-primary);
}

.dropdown-item i {
  width: 20px;
  font-size: 15px;
  text-align: center;
}

.dropdown-item.danger:hover {
  color: var(--error);
  background: rgba(239, 68, 68, 0.08);
}