[hidden] {
  display: none !important;
}

.app-topbar {
  position: relative;
  z-index: 1000;
  width: min(1480px, calc(100% - 32px));
  margin: 24px auto 16px;
  padding: 16px 18px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 42px rgba(15, 23, 42, 0.08);
  overflow: visible;
}

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

.app-shell > .app-topbar,
.admin-shell > .app-topbar {
  width: 100%;
  margin: 0 0 16px;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex: 0 0 auto;
}

.app-brand .eyebrow,
.app-brand-kicker {
  margin: 0 0 3px;
  color: #2563eb;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.app-brand h1 {
  margin: 0;
  color: #111827;
  font-size: 22px;
  line-height: 1.2;
}

.app-brand p {
  margin: 3px 0 0;
  color: #667085;
  font-size: 13px;
  line-height: 1.45;
}

.app-nav,
.nav-section {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.app-nav {
  justify-content: flex-end;
  position: relative;
  z-index: 1;
  overflow: visible;
}

.app-nav-compact {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  overflow: visible;
}

.nav-section {
  padding: 4px;
  border: 1px solid #e3ebf6;
  border-radius: 8px;
  background: #f8fbff;
}

.nav-main {
  background: rgba(255, 255, 255, 0.72);
}

.nav-actions {
  background: #fff;
  max-width: min(100%, 420px);
  overflow-x: auto;
  scrollbar-width: thin;
}

.nav-actions:has(.nav-dropdown[open]) {
  overflow: visible;
}

.nav-dropdown {
  position: relative;
  z-index: 1;
}

.nav-dropdown[open] {
  z-index: 1100;
}

.nav-dropdown > summary {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.58);
  color: #334155;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.nav-dropdown > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.72;
  transform: rotate(45deg);
  transition: transform 0.18s ease, margin 0.18s ease;
}

.nav-dropdown[open] > summary::after {
  margin-top: 3px;
  transform: rotate(225deg);
}

.nav-dropdown > summary:hover,
.nav-dropdown[open] > summary {
  border-color: #c9d6ea;
  background: #fff;
  color: #234f9c;
  box-shadow: 0 8px 18px rgba(47, 102, 200, 0.08);
}

.nav-dropdown-panel {
  min-width: 184px;
  display: grid;
  gap: 5px;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 1200;
  padding: 9px;
  border: 1px solid #dbeafe;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 20px 48px rgba(11, 40, 72, 0.16);
  backdrop-filter: blur(16px);
}

.nav-dropdown-panel::before {
  content: "";
  width: 10px;
  height: 10px;
  position: absolute;
  top: -6px;
  right: 20px;
  border-left: 1px solid #dbeafe;
  border-top: 1px solid #dbeafe;
  background: rgba(255, 255, 255, 0.98);
  transform: rotate(45deg);
}

.nav-dropdown-panel .nav-link,
.nav-dropdown-panel .nav-button,
.nav-dropdown-panel .file-button,
.nav-dropdown-panel .session-user-badge,
.nav-dropdown-panel .current-user-badge {
  justify-content: flex-start;
  width: 100%;
}

.nav-dropdown-panel .nav-link,
.nav-dropdown-panel .nav-button,
.nav-dropdown-panel .file-button {
  border-radius: 10px;
  padding: 0 12px;
}

.nav-dropdown-panel .file-button {
  min-height: 34px;
}

.nav-dropdown-panel .session-user-badge,
.nav-dropdown-panel .current-user-badge {
  max-width: 100%;
  background: #f8fbff;
}

.nav-account-panel {
  min-width: 220px;
}

.nav-action-menu .nav-dropdown-panel {
  min-width: 168px;
}

.session-user-badge {
  max-width: 190px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  overflow: hidden;
  border: 1px solid #c9d6ea;
  border-radius: 999px;
  padding: 0 11px;
  color: #183b6b;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-link,
.nav-button,
.app-topbar .file-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 0 11px;
  background: transparent;
  color: #334155;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
}

.nav-link:hover,
.nav-button:hover,
.app-topbar .file-button:hover {
  border-color: #c9d6ea;
  background: #fff;
  color: #234f9c;
  box-shadow: none;
  transform: none;
}

.nav-link.active,
.nav-button.active {
  background: #eaf2ff;
  color: #234f9c;
  border-color: #c9d6ea;
}

.nav-primary,
.app-topbar .nav-primary {
  background: #2f66c8;
  color: #fff;
  border-color: #2f66c8;
}

.nav-primary:hover,
.app-topbar .nav-primary:hover {
  background: #234f9c;
  color: #fff;
  border-color: #234f9c;
}

.nav-secondary {
  color: #475569;
}

.app-topbar .file-button input {
  display: none;
}

@media (max-width: 1080px) {
  .app-topbar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .app-nav,
  .nav-section {
    justify-content: flex-start;
  }

  .app-nav-compact {
    justify-content: flex-start;
  }
}

@media (max-width: 680px) {
  .app-topbar {
    width: min(100% - 20px, 1480px);
    margin-top: 10px;
    padding: 12px;
  }

  .nav-link,
  .nav-button,
  .app-topbar .file-button,
  .session-user-badge {
    flex: 1 1 auto;
  }

  .nav-dropdown {
    width: 100%;
  }

  .nav-dropdown > summary {
    width: 100%;
  }

  .nav-dropdown-panel {
    position: static;
    width: 100%;
    margin-top: 6px;
    box-shadow: none;
  }

  .nav-dropdown-panel::before {
    display: none;
  }
}

@media print {
  .app-nav {
    display: none !important;
  }
}
