.identity-menu-host {
  --identity-accent: var(--accent, var(--brand, #1f7a63));
  --identity-accent-strong: var(--accent-strong, #17624f);
  --identity-accent-soft: var(--accent-soft, var(--soft, #e7f4ef));
  --identity-text: var(--text, var(--ink, #1d2430));
  --identity-muted: var(--muted, #66736d);
  --identity-line: var(--line, #d9dee7);
  --identity-surface-soft: var(--surface-2, var(--soft, #f4f7f5));
  position: relative;
  z-index: 40;
}

.identity-menu {
  position: relative;
}

.identity-trigger {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 16px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 190px;
  min-height: 52px;
  padding: 7px 10px;
  border: 1px solid #b7dfd2;
  border-radius: 8px;
  color: var(--identity-text);
  background: var(--identity-accent-soft);
  cursor: pointer;
  text-align: left;
}

.identity-trigger:hover,
.identity-trigger:focus-visible,
.identity-menu[data-open="true"] .identity-trigger {
  border-color: var(--identity-accent);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(31, 122, 99, 0.12);
}

.identity-avatar {
  display: inline-flex;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #fff;
  background: var(--identity-accent);
  font-size: 16px;
  font-weight: 750;
}

.identity-trigger-copy,
.identity-profile-copy,
.identity-option-copy {
  min-width: 0;
}

.identity-trigger-copy strong,
.identity-trigger-copy span,
.identity-profile-copy strong,
.identity-profile-copy span,
.identity-option-copy strong,
.identity-option-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-trigger-copy strong {
  color: var(--identity-accent-strong);
  font-size: 14px;
}

.identity-trigger-copy span {
  margin-top: 2px;
  color: var(--identity-muted);
  font-size: 12px;
}

.identity-chevron {
  width: 8px;
  height: 8px;
  justify-self: center;
  border-right: 2px solid var(--identity-muted);
  border-bottom: 2px solid var(--identity-muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.identity-menu[data-open="true"] .identity-chevron {
  transform: rotate(225deg) translate(-1px, -1px);
}

.identity-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(410px, calc(100vw - 32px));
  padding: 20px;
  border: 1px solid var(--identity-line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 52px rgba(31, 41, 55, 0.2);
}

.identity-menu:not([data-open="true"]) .identity-popover {
  display: none;
}

.identity-profile {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.identity-profile .identity-avatar {
  width: 46px;
  height: 46px;
  font-size: 18px;
}

.identity-profile-copy strong {
  color: var(--identity-text);
  font-size: 17px;
}

.identity-profile-copy span {
  margin-top: 4px;
  color: var(--identity-muted);
  font-size: 13px;
}

.identity-section {
  margin-top: 16px;
}

.identity-section-title {
  margin: 0 0 9px;
  color: var(--identity-muted);
  font-size: 13px;
  font-weight: 700;
}

.identity-options {
  display: grid;
  gap: 7px;
}

.identity-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid var(--identity-line);
  border-radius: 8px;
  color: var(--identity-text);
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.identity-option:hover,
.identity-option:focus-visible {
  border-color: #9fd0c2;
  outline: 0;
  background: var(--identity-accent-soft);
}

.identity-option.is-active {
  border-color: var(--identity-accent);
  background: var(--identity-accent-soft);
}

.identity-option-copy strong {
  font-size: 14px;
}

.identity-option-copy span {
  margin-top: 3px;
  color: var(--identity-muted);
  font-size: 12px;
}

.identity-active-mark {
  color: var(--identity-accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.identity-organization {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-height: 52px;
  padding: 9px 12px;
  border: 1px solid var(--identity-line);
  border-radius: 8px;
  background: var(--identity-surface-soft);
}

.identity-organization span {
  color: var(--identity-muted);
  font-size: 12px;
}

.identity-organization strong {
  overflow: hidden;
  color: var(--identity-text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-menu-footer {
  display: grid;
  margin-top: 16px;
}

.identity-logout {
  min-height: 42px;
  border: 1px solid var(--identity-line);
  border-radius: 8px;
  color: var(--identity-text);
  background: #fff;
  cursor: pointer;
  font-size: 14px;
}

.identity-logout:hover,
.identity-logout:focus-visible {
  border-color: #9fd0c2;
  outline: 0;
  background: var(--identity-accent-soft);
}

.identity-menu-message {
  margin: 10px 0 0;
  color: #b42318;
  font-size: 12px;
}

@media (hover: hover) {
  .identity-menu:hover .identity-popover,
  .identity-menu:focus-within .identity-popover {
    display: block;
  }
}

@media (max-width: 640px) {
  .identity-trigger {
    min-width: 168px;
  }

  .identity-popover {
    position: fixed;
    top: 76px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 92px);
    overflow-y: auto;
  }
}
