.topbar-user[hidden] { display: none !important; }

.app-topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  min-height: 4.25rem;
  padding: 0.65rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid #252731;
  background: rgba(17, 18, 24, 0.96);
  backdrop-filter: blur(16px);
}

.topbar-brand {
  flex: 0 0 auto;
  color: #f2f3f5;
  font-weight: 850;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.topbar-link,
.topbar-menu-label {
  display: flex;
  align-items: center;
  min-height: 2.65rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.65rem;
  color: #b5bac1;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.topbar-menu-label { border: 0; background: transparent; font: inherit; }
.topbar-menu-label::after { content: "▾"; margin-left: 0.45rem; color: #777e89; font-size: 0.7rem; }
.topbar-link:hover,
.topbar-menu-label:hover,
.topbar-link.active,
.topbar-menu.active .topbar-menu-label { background: #252731; color: #f2f3f5; }

.topbar-menu { position: relative; }

.topbar-submenu {
  position: absolute;
  top: 100%;
  left: 0;
  display: grid;
  min-width: 10rem;
  padding: 0.4rem;
  border: 1px solid #30323d;
  border-radius: 0.75rem;
  background: #181920;
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.35);
}

.topbar-submenu { display: none; }
.topbar-menu:hover .topbar-submenu,
.topbar-menu.open .topbar-submenu { display: grid; }

@media (hover: none) {
  .topbar-menu:focus-within .topbar-submenu { display: grid; }
}

.topbar-submenu .topbar-link { min-height: 2.35rem; }
.topbar-submenu .topbar-link.active { background: #5865f2; color: white; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
  margin-left: auto;
}

.topbar-identity {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-width: 0;
}

.topbar-avatar {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  object-fit: cover;
  background: #2b2d31;
}

.topbar-avatar:not([src]),
.topbar-avatar[src=""] {
  content: "";
  display: block;
  color: transparent;
  font-size: 0;
}

.topbar-name {
  overflow: hidden;
  max-width: 11rem;
  color: #f2f3f5;
  font-size: 0.9rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-logout {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 2.35rem;
  height: 2.35rem;
  padding: 0;
  border: 0;
  border-radius: 0.6rem;
  background: transparent;
  color: #949ba4;
  cursor: pointer;
}

.topbar-logout:hover { background: #2b2d31; color: #f2f3f5; }
.topbar-logout svg { width: 1.2rem; height: 1.2rem; }
.app-main { width: auto; margin: 0; }

@media (max-width: 42rem) {
  .app-topbar { flex-wrap: wrap; gap: 0.35rem 0.65rem; padding-block: 0.55rem; }
  .topbar-brand { flex: 1 1 auto; }
  .topbar-nav { order: 3; width: 100%; }
  .topbar-user { margin-left: 0; }
  .topbar-name { display: none; }
  .topbar-link,
  .topbar-menu-label { min-height: 2.35rem; padding: 0.5rem 0.7rem; }
}
