.portal-account {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 14px;
  min-width: 106px;
  min-height: 44px;
  max-width: 100%;
  font-size: inherit;
}

.portal-account > .btn {
  font-family: inherit;
  font-size: inherit;
}

.portal-account [hidden] {
  display: none;
}

.portal-account__pending {
  width: 106px;
  height: 36px;
  border-radius: 6px;
  background: var(--bs-light);
}

.portal-account__trigger {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--bs-primary);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.portal-account__chevron {
  flex-shrink: 0;
}

.portal-account__trigger[aria-expanded="true"] .portal-account__chevron {
  transform: rotate(180deg);
}

.portal-account__avatar {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  object-fit: cover;
  border-radius: 50%;
}

.portal-account__menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  min-width: 190px;
  padding: 6px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(var(--bs-primary-rgb), 0.18);
}

.portal-account__menu-item {
  display: block;
  width: 100%;
  min-height: 46px;
  padding: 10px 16px;
  border: 0;
  background: transparent;
  color: var(--bs-primary);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.portal-account__menu-item:hover,
.portal-account__menu-item:focus-visible {
  background: rgba(var(--bs-primary-rgb), 0.06);
  color: var(--link-highlight);
}

.portal-account__menu-item:disabled {
  cursor: wait;
  opacity: 0.6;
}

.portal-account__name {
  overflow: hidden;
  max-width: 140px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.portal-account__action {
  flex-shrink: 0;
  padding: 7px 0;
  border: 0;
  background: transparent;
  color: var(--bs-secondary-color);
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.portal-account__action:hover,
.portal-account__action:focus-visible {
  color: var(--link-highlight);
  text-decoration: none;
}

.portal-account__action:disabled {
  cursor: wait;
  opacity: 0.6;
}

.portal-account__message {
  max-width: 90px;
  color: var(--bs-secondary-color);
  font-size: 12px;
  line-height: 1.35;
}

/* Signup completion: one bounded welcome scene, anchored to the portal. */
body:has(.signup-welcome[open]) {
  overflow: hidden;
}

.signup-welcome {
  width: min(760px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 44px 48px 44px 32px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: var(--bs-primary);
  box-shadow: 0 20px 70px rgba(var(--bs-primary-rgb), 0.16);
}

.signup-welcome::backdrop {
  background: rgba(18, 22, 40, 0.48);
}

.signup-welcome__layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  align-items: center;
  gap: 32px;
}

.signup-welcome__art {
  display: block;
  width: 100%;
  height: auto;
}

.signup-welcome h2 {
  margin: 0 0 16px;
  color: var(--bs-primary);
  font-size: 36px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -1px;
}

.signup-welcome p {
  margin: 0;
  color: var(--bs-secondary-color);
  font-size: 16px;
  line-height: 1.6;
}

.signup-welcome__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 24px;
  margin-top: 28px;
}

.signup-welcome__dismiss {
  padding: 12px 0;
  border: 0;
  background: transparent;
  color: var(--bs-secondary-color);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}

.signup-welcome__dismiss:hover {
  color: var(--link-highlight);
}

.signup-welcome__open {
  padding: 12px 26px;
  border-radius: 100px;
  background: var(--link-highlight);
  color: #fff;
  font-size: 15px;
  white-space: nowrap;
}

.signup-welcome__open:hover,
.signup-welcome__open:focus-visible {
  background: #0874c5;
  color: #fff;
  transform: none;
  box-shadow: none !important;
}

.signup-welcome :is(a, button):focus-visible {
  outline: 2px solid var(--bs-primary);
  outline-offset: 4px;
}

@media (max-width: 680px) {
  .signup-welcome {
    width: min(400px, calc(100% - 32px));
    padding: 24px 28px 32px;
  }

  .signup-welcome__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
  }

  .signup-welcome__art {
    width: 180px;
    margin: auto;
  }

  .signup-welcome h2 {
    font-size: 32px;
  }

  .signup-welcome__actions {
    gap: 20px;
  }
}

@media (max-width: 1100px) {
  .portal-account {
    gap: 10px;
  }

  .portal-account__name {
    max-width: 90px;
  }
}

@media (max-width: 767.98px) {
  .portal-account {
    justify-content: flex-start;
  }

  .portal-account__name {
    max-width: 180px;
  }

  .portal-account__menu {
    right: auto;
    left: 0;
  }
}
