.account {
  position: relative;
  justify-self: end;
}

.account-menu {
  position: relative;
}

.account-menu > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.account-menu > summary::-webkit-details-marker {
  display: none;
}

.account-menu-name {
  font-weight: 800;
}

.account-menu-label {
  color: rgba(255,255,255,.68);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.account-menu-chevron {
  margin-left: 1px;
  color: rgba(255,255,255,.7);
  font-size: 16px;
  line-height: 1;
  transition: transform .15s ease;
}

.account-menu[open] .account-menu-chevron {
  transform: rotate(180deg);
}

.account-menu-popover {
  position: absolute;
  z-index: 50;
  top: calc(100% + 8px);
  right: 0;
  width: 250px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
  color: var(--text);
  box-shadow: 0 16px 38px rgba(37,49,45,.18);
}

.account-menu-heading {
  display: grid;
  gap: 2px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  background: #FFFCFA;
}

.account-menu-heading strong {
  color: var(--sheet-dark-green);
  font-size: 13px;
}

.account-menu-heading small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-menu-item {
  display: grid;
  width: 100%;
  gap: 1px;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #EEE5DF;
  border-radius: 0;
  background: white;
  color: var(--sheet-dark-green);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.account-menu-item small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}

.account-menu form {
  margin: 0;
}

.account-menu-signout {
  border-bottom: 0;
  color: var(--muted);
  cursor: pointer;
}

/* Keep hover treatment visually stable, matching the rest of the app. */
.account-menu > summary:hover,
.account-menu-item:hover,
.account-menu-signout:hover {
  background: inherit;
  color: inherit;
}

@media (max-width: 760px) {
  .account-menu-label {
    display: none;
  }

  .account-menu-popover {
    width: min(250px, calc(100vw - 24px));
  }
}
