/* ============================================================
   Header user dropdown — all pages (toolkit, app, public)
   ============================================================ */

[hidden] {
  display: none !important;
}

.header-user {
  position: relative;
  flex-shrink: 0;
}

.header-user__toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm, 0.5rem);
  padding: 0.35rem 0.5rem 0.35rem 0.35rem;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: 999px;
  background: var(--color-white, #fff);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  max-width: 220px;
  color: var(--color-navy, #0f172a);
}

.header-user__toggle:hover,
.header-user__toggle[aria-expanded='true'] {
  border-color: var(--color-orange, #f37021);
  box-shadow: 0 0 0 3px rgba(243, 112, 33, 0.12);
}

.header-user__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-navy, #001f3f), var(--color-navy-light, #0a2d52));
  color: var(--color-white, #fff);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.header-user__avatar--lg {
  width: 44px;
  height: 44px;
  font-size: 0.85rem;
}

.header-user__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.header-user__meta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
  line-height: 1.2;
}

.header-user__name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-navy, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.header-user__role {
  font-size: 0.68rem;
  color: var(--color-text-muted, #64748b);
}

.header-user__chev {
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--color-text-muted, #64748b);
  border-bottom: 2px solid var(--color-text-muted, #64748b);
  transform: rotate(45deg);
  margin-right: 4px;
  flex-shrink: 0;
}

.header-user__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: var(--color-white, #fff);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  padding: var(--space-sm, 0.5rem);
  z-index: 1200;
}

.header-user__menu-head {
  display: flex;
  align-items: center;
  gap: var(--space-md, 1rem);
  padding: var(--space-sm, 0.5rem);
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  margin-bottom: var(--space-xs, 0.25rem);
}

.header-user__menu-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-navy, #0f172a);
  margin: 0;
}

.header-user__menu-role {
  font-size: 0.75rem;
  color: var(--color-text-muted, #64748b);
  margin: 0;
}

.header-user__menu-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm, 6px);
  color: var(--color-navy, #0f172a);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.35;
}

.header-user__menu-item + .header-user__menu-item {
  margin-top: 2px;
}

.header-user__menu-item:hover {
  background: var(--color-bg, #f4f6f9);
  color: var(--color-orange, #f37021);
}

.header-user__menu-item--logout {
  color: var(--color-danger, #ef4444);
  margin-top: var(--space-xs, 0.25rem);
  border-top: 1px solid var(--color-border, #e2e8f0);
  border-radius: 0 0 var(--radius-sm, 6px) var(--radius-sm, 6px);
  padding-top: 0.65rem;
}

.header-user__menu-item--logout:hover {
  background: rgba(239, 68, 68, 0.08);
  color: var(--color-danger, #ef4444);
}

/* Header row must not clip the dropdown */
.header,
.navbar.header,
.nav-container,
.header__inner,
.header__actions,
.nav-buttons {
  overflow: visible;
}

.is-logged-in .header__actions,
.is-logged-in .nav-buttons {
  display: flex !important;
  align-items: center;
  flex-shrink: 0;
  gap: var(--space-sm, 0.5rem);
  flex-wrap: nowrap;
}

@media (min-width: 993px) {
  .header-user__meta {
    display: flex !important;
  }
}

@media (max-width: 992px) {
  .header-user__meta {
    display: none;
  }

  .header-user__toggle {
    padding: 0.25rem;
    border-radius: 50%;
  }

  .header-user__chev {
    display: none;
  }
}
