.app-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sidebar-brand {
  padding: 20px 18px;
  border-bottom: 1px solid #EDEEF5;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.sidebar-brand .brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #6a45f2, #9780ff);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 16px;
  font-weight: 700;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-shadow: 0 2px 8px rgba(106, 69, 242, 0.25);
  flex-shrink: 0;
}
.sidebar-brand .brand-name {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-weight: 700;
  font-size: 17px;
  color: #1E293B;
  letter-spacing: -0.3px;
}
.sidebar-brand .brand-sub {
  font-size: 11px;
  color: #94A3B8;
  font-weight: 500;
}
.sidebar-brand .close-sidebar {
  background: transparent;
  border: none;
  color: #64748B;
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s;
}
.sidebar-brand .close-sidebar:hover {
  background: #F8F9FC;
  color: #1E293B;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-nav-container {
  padding: 4px 0;
}

.sidebar-section {
  padding: 16px 12px 4px;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #94A3B8;
  padding: 0 8px;
  margin-bottom: 6px;
}
.sidebar-label.admin-label {
  color: #6a45f2;
}

.sidebar-divider {
  height: 1px;
  background-color: #EDEEF5;
  margin: 8px 20px;
}

.sidebar-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0;
  margin: 0;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: #64748B;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-nav a:hover {
  background: #F3F4F8;
  color: #1E293B;
}
.sidebar-nav a:hover .nav-icon {
  color: #1E293B;
}
.sidebar-nav a.active {
  background: rgba(106, 69, 242, 0.08);
  color: #6a45f2;
  font-weight: 600;
}
.sidebar-nav a.active .nav-icon {
  color: #6a45f2;
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  flex-shrink: 0;
  color: #64748B;
  transition: color 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-icon i {
  font-size: 14px;
}

.nav-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: #F3F4F8;
  color: #94A3B8;
  padding: 1px 7px;
  border-radius: 10px;
}
.nav-count.alert {
  background: rgba(220, 38, 38, 0.08);
  color: #DC2626;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border-top: 1px solid #EDEEF5;
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}
.sidebar-user:hover {
  background: #F3F4F8;
}

.user-avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #6a45f2, #A78BFA);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 12px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  flex-shrink: 0;
}

.user-meta {
  flex: 1;
  min-width: 0;
}

.user-meta-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-meta-role {
  font-size: 11px;
  color: #94A3B8;
}

.platform-label {
  color: #e94560;
}

.nav-badge-active {
  margin-left: auto;
  font-size: 9px;
  font-weight: 600;
  background-color: #EA580C;
  color: white;
  padding: 1px 6px;
  border-radius: 3px;
  letter-spacing: 0.5px;
}

.organization-menu.emulating .admin-label::after {
  content: "EMULATION";
  font-size: 9px;
  background-color: #EA580C;
  color: white;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

body.sidebar-collapsed .sidebar-brand {
  padding: 16px 10px;
  justify-content: center;
}
body.sidebar-collapsed .sidebar-brand .brand-icon {
  width: 34px;
  height: 34px;
  font-size: 14px;
}
body.sidebar-collapsed .sidebar-brand > div:not(.brand-icon):not(button) {
  display: none;
}
body.sidebar-collapsed .sidebar-brand .close-sidebar {
  display: none;
}
body.sidebar-collapsed .sidebar-label,
body.sidebar-collapsed .sidebar-divider {
  display: none;
}
body.sidebar-collapsed .sidebar-section {
  padding: 4px 6px 2px;
}
body.sidebar-collapsed .sidebar-nav a {
  padding: 9px;
  justify-content: center;
  border-radius: 8px;
}
body.sidebar-collapsed .sidebar-nav a .nav-text,
body.sidebar-collapsed .sidebar-nav a .nav-count {
  display: none;
}
body.sidebar-collapsed .sidebar-nav .nav-icon {
  width: auto;
  font-size: 16px;
}
body.sidebar-collapsed .sidebar-nav li {
  position: relative;
}
body.sidebar-collapsed .sidebar-nav li:hover .nav-text {
  display: block;
  position: absolute;
  left: 60px;
  top: 0;
  width: 180px;
  background-color: #ffffff;
  border-radius: 0 8px 8px 0;
  padding: 9px 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 4px rgba(0, 0, 0, 0.03);
  z-index: 1000;
  font-size: 13px;
}
body.sidebar-collapsed .sidebar-footer {
  padding: 8px;
}
body.sidebar-collapsed .sidebar-footer .sidebar-user {
  justify-content: center;
  padding: 6px;
}
body.sidebar-collapsed .sidebar-footer .user-meta {
  display: none;
}

@media (max-width: 991px) {
  .sidebar-brand .close-sidebar {
    display: flex !important;
  }
}
body.dark-mode .sidebar-brand {
  border-bottom-color: #555555;
}
body.dark-mode .sidebar-brand .brand-name {
  color: #e0e0e0;
}
body.dark-mode .sidebar-brand .brand-sub {
  color: #b0b0b0;
}
body.dark-mode .sidebar-label {
  color: #b0b0b0;
}
body.dark-mode .sidebar-label.admin-label {
  color: #9780ff;
}
body.dark-mode .sidebar-divider {
  background-color: #555555;
}
body.dark-mode .sidebar-nav a {
  color: #b0b0b0;
}
body.dark-mode .sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
}
body.dark-mode .sidebar-nav a:hover .nav-icon {
  color: #e0e0e0;
}
body.dark-mode .sidebar-nav a.active {
  background: rgba(151, 128, 255, 0.12);
  color: #9780ff;
}
body.dark-mode .sidebar-nav a.active .nav-icon {
  color: #9780ff;
}
body.dark-mode .nav-count {
  background: rgba(255, 255, 255, 0.08);
  color: #b0b0b0;
}
body.dark-mode .nav-count.alert {
  background: rgba(220, 38, 38, 0.15);
  color: rgb(227.0833333333, 81.9166666667, 81.9166666667);
}
body.dark-mode .sidebar-footer {
  border-top-color: #555555;
}
body.dark-mode .sidebar-user:hover {
  background: rgba(255, 255, 255, 0.08);
}
body.dark-mode .user-meta-name {
  color: #e0e0e0;
}
body.dark-mode .user-meta-role {
  color: #b0b0b0;
}
body.sidebar-collapsed body.dark-mode .sidebar-nav li:hover .nav-text {
  background-color: rgb(59.5, 59.5, 59.5);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  color: #e0e0e0;
}
