.site-header .header-inner > nav {
  margin-inline-start: auto;
}

.site-header .site-account-link {
  flex: 0 0 auto;
  min-height: 42px;
  padding: 0 17px;
  gap: 8px;
  color: var(--ui-secondary-text);
  background: var(--ui-secondary-bg);
  white-space: nowrap;
  box-shadow: none;
}

.site-header .site-account-link:hover {
  color: var(--ui-action);
  background: var(--ui-nav);
}

.site-account-link.has-account {
  max-width: 168px;
  padding-inline: 8px 13px;
}

.site-account-link > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

body:has(.account-dialog[open]) {
  overflow: hidden;
}

.account-dialog {
  width: min(470px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--ui-radius-card);
  background: transparent;
  color: var(--ui-text);
  box-shadow: var(--ui-shadow-card);
  overflow: visible;
  overscroll-behavior: contain;
}

.account-dialog::backdrop {
  background: #17274c45;
  backdrop-filter: blur(3px);
}

.account-card {
  position: relative;
  max-height: calc(100dvh - 32px);
  padding: 30px 30px 20px;
  overflow: auto;
  overscroll-behavior: contain;
  border-radius: inherit;
  background: var(--ui-surface);
}

.account-card h2 {
  margin: 0 42px 19px 0;
  font-size: clamp(24px, 2.35vw, 31px);
  line-height: 1.25;
  font-weight: 740;
  letter-spacing: -0.035em;
  outline: none;
}

.account-close {
  position: absolute;
  inset-block-start: 17px;
  inset-inline-end: 17px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: var(--ui-radius-control);
  background: transparent;
  color: var(--ui-muted);
}

.account-close:hover {
  background: var(--ui-bg);
  color: var(--ui-text);
}

.account-close .icon {
  width: 19px;
  height: 19px;
}

.account-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 17px;
  border-radius: 14px;
  background: var(--ui-bg);
}

.account-tab {
  min-height: 40px;
  padding: 6px;
  border-radius: 10px;
  background: transparent;
  color: var(--ui-body);
  font-size: 14px;
  font-weight: 630;
}

.account-tab[aria-selected="true"] {
  color: var(--ui-action);
  background: var(--ui-nav);
}

.account-lead {
  margin: -3px 0 17px;
  color: var(--ui-body);
  font-size: 14px;
  line-height: 1.7;
  text-indent: 2em;
}

.account-form {
  display: grid;
  gap: 10px;
}

.account-login-form {
  gap: 8px;
}

.account-login-form label:not(:first-child) {
  margin-top: 4px;
}

.account-form label {
  color: var(--ui-text);
  font-size: 14px;
  font-weight: 650;
}

.account-form label span {
  display: inline-block;
  color: var(--ui-muted);
  font-size: 11px;
  font-weight: 500;
}

.account-form input:not([type="file"]) {
  min-width: 0;
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--ui-control-border);
  border-radius: var(--ui-radius-control);
  background: var(--ui-bg);
  color: var(--ui-text);
  font: inherit;
  font-size: 16px;
}

.account-phone-field {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--ui-control-border);
  border-radius: var(--ui-radius-control);
  background: var(--ui-bg);
}

.account-phone-field > span {
  padding-inline: 10px;
  border-inline-end: 1px solid var(--ui-line);
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 650;
}

.account-phone-field input:not([type="file"]) {
  border: 0;
  background: transparent;
}

.account-phone-field:focus-within {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

.account-phone-field input:focus-visible {
  outline: none;
}

.account-code-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 7px;
}

.account-form .account-send {
  min-width: 96px;
  min-height: 44px;
  padding-inline: 8px;
  font-size: 13px;
}

.account-form input::placeholder {
  color: var(--ui-muted);
  opacity: 0.83;
}

.account-card .account-submit {
  width: 100%;
  min-height: 46px;
  justify-content: center;
  margin-top: 4px;
  font-size: 15px;
  box-shadow: none;
}

.account-card button:disabled {
  opacity: 0.56;
  cursor: default;
}

.account-register-field {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.account-bottom {
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.account-text-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  padding: 4px 0;
  background: none;
  color: var(--ui-action);
  font: inherit;
  font-size: 13px;
  font-weight: 620;
}

.account-text-button:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.account-text-button .icon {
  width: 16px;
  height: 16px;
}

.account-avatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--ui-card-task);
}

.account-avatar img {
  display: block;
  width: 70%;
  height: 70%;
  object-fit: contain;
}

.account-avatar img.account-avatar-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-avatar img.account-avatar-photo[hidden],
.account-avatar-reset[hidden] {
  display: none;
}

.account-avatar.small {
  width: 29px;
  height: 29px;
}

.account-avatar-picker {
  position: relative;
  justify-self: center;
  margin: -3px 0 3px;
  border-radius: 50%;
}

.account-avatar-picker .account-avatar {
  width: 78px;
  height: 78px;
}

.account-avatar-picker:focus-within {
  outline: 2px solid var(--ui-focus);
  outline-offset: 3px;
}

.account-avatar-tools {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  overflow: hidden;
  border-radius: inherit;
  background: #17274cbd;
  opacity: 0;
  transition: opacity .16s ease;
}

.account-avatar-picker:hover .account-avatar-tools,
.account-avatar-picker:focus-within .account-avatar-tools {
  opacity: 1;
}

.account-avatar-tools button {
  min-height: 33px;
  padding: 0;
  background: transparent;
  color: #fff;
  font-size: 11px;
  font-weight: 630;
}

.account-avatar-tools button:focus-visible,
.account-avatar-tools button:hover {
  background: #ffffff29;
  outline: none;
}

.account-avatar-pick:only-child,
.account-avatar-tools:has(.account-avatar-reset[hidden]) .account-avatar-pick {
  height: 78px;
}

.account-avatar-reset {
  border-top: 1px solid #ffffff60;
}

.account-profile {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 12px;
  padding: 14px;
  margin-bottom: 12px;
  border-radius: var(--ui-radius-control);
  background: var(--ui-bg);
}

.account-profile-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
  overflow-wrap: anywhere;
}

.account-profile-copy strong {
  font-size: 18px;
  font-weight: 700;
}

.account-profile-copy span {
  color: var(--ui-muted);
  font-size: 13px;
}

.account-ready-actions {
  display: grid;
  justify-items: center;
  gap: 7px;
}

.account-toast {
  position: absolute;
  z-index: 1;
  inset-inline-start: 50%;
  inset-block-end: calc(100% + 12px);
  translate: -50% 0;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100% - 16px);
  padding: 9px 14px 9px 10px;
  border-radius: 14px;
  background: var(--ui-surface);
  color: var(--ui-text);
  box-shadow: var(--ui-shadow-floating);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  pointer-events: none;
  animation: account-toast-in .16s ease-out;
}

.account-toast.is-inset {
  inset-block: 10px auto;
}

.account-toast[hidden],
.account-toast:not(.is-error) .account-toast-error,
.account-toast.is-error .account-toast-success {
  display: none;
}

.account-toast-icon {
  display: grid;
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: var(--ui-card-task);
  color: var(--ui-action);
}

.account-toast.is-error .account-toast-icon {
  background: #fce9e4;
  color: #923225;
}

.account-toast-icon .icon {
  width: 15px;
  height: 15px;
}

@keyframes account-toast-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .account-toast { animation: none; }
}

@media (max-height: 600px) {
  .account-dialog {
    margin-block: 80px 12px;
    max-height: calc(100dvh - 92px);
  }

  .account-card {
    max-height: calc(100dvh - 92px);
  }
}

@media (hover: none) {
  .account-avatar-tools {
    opacity: 1;
    align-content: end;
    background: linear-gradient(transparent 40%, #17274cd9);
  }

  .account-avatar-tools:has(.account-avatar-reset[hidden]) .account-avatar-pick {
    height: 100%;
    min-height: 78px;
    padding-top: 46px;
  }
}

@media (max-width: 620px) {
  .site-header {
    height: auto;
  }

  .site-header .header-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    min-height: 98px;
    grid-template-rows: 57px 41px;
    gap: 0 10px;
  }

  .site-header .header-inner > nav {
    grid-area: 2 / 1 / 3 / -1;
    justify-content: center;
    gap: clamp(18px, 8vw, 34px);
    margin: 0;
  }

  .site-header nav a[aria-current]:after {
    bottom: 4px;
  }

  .site-header .site-account-link {
    grid-area: 1 / 2;
    min-height: 44px;
    padding-inline: 12px;
    font-size: 13px;
  }

  .account-card {
    padding: 25px 20px 15px;
  }

  .account-close {
    inset-block-start: 13px;
    inset-inline-end: 11px;
  }

  .account-register-field {
    grid-template-columns: 66px minmax(0, 1fr);
    gap: 6px;
  }

  .account-form .account-send {
    min-width: 84px;
    padding-inline: 6px;
    font-size: 12px;
  }
}
