.account-auth-dialog {
  width: min(480px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
}

.account-auth-dialog::backdrop {
  background: var(--color-overlay);
}

.account-auth-stack {
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.account-auth-stack.is-dialog {
  width: 100%;
}

.account-auth-shell {
  width: 100%;
  position: relative;
  padding: var(--space-8);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.account-auth-shell.is-dialog {
  padding: var(--space-8);
  border: 0;
  box-shadow: var(--shadow-overlay);
}

.account-auth-close {
  position: absolute;
  top: var(--space-5);
  right: var(--space-5);
}

.account-auth-heading {
  margin-bottom: var(--space-5);
  padding-inline: 0;
  text-align: center;
}

.account-auth-heading h1,
.account-auth-heading h2 {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-24);
  line-height: 1.25;
  text-wrap: balance;
}

.account-auth-heading p,
.account-auth-identity,
.account-auth-status,
.account-auth-privacy {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: 1.5;
}

.account-auth-heading p {
  max-width: 42ch;
  margin-inline: auto;
}

.account-auth-switch {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  column-gap: var(--space-1);
}

.account-auth-flow {
  display: grid;
}

.account-auth-flow section {
  display: grid;
  gap: var(--space-4);
}

.account-auth-flow section[hidden] {
  display: none;
}

.account-auth-demo {
  padding: var(--space-3) var(--space-4);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.account-auth-demo > strong {
  font-size: var(--font-size-14);
  white-space: nowrap;
}

.account-auth-demo dt {
  color: var(--color-text-secondary);
  font-size: var(--font-size-12);
  line-height: 1.4;
}

.account-auth-demo dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: var(--space-3);
}

.account-auth-demo dl > div {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-1);
}

.account-auth-demo dt,
.account-auth-demo dd {
  margin: 0;
}

.account-auth-demo dd {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--font-size-14);
  font-weight: var(--weight-regular);
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.account-auth-demo dd > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.account-auth-demo-copy {
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  position: relative;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  background: transparent;
  cursor: pointer;
}

.account-auth-demo-copy::before {
  content: "";
  position: absolute;
  inset: -8px;
}

.account-auth-demo-copy:hover {
  color: var(--color-accent-active);
  background: transparent;
}

.account-auth-demo-copy:focus-visible {
  outline: 2px solid var(--color-field-focus);
  outline-offset: -2px;
}

.account-auth-demo-copy.is-copied {
  color: var(--color-success);
}

.account-auth-demo-copy .ds-icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

.account-auth-primary {
  width: 100%;
  margin-top: var(--space-1);
}

.account-auth-password-control {
  position: relative;
  display: block;
}

.account-auth-password-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}

.account-auth-password-control .ds-field-control {
  padding-inline-end: calc(var(--control-md) + var(--space-3));
}

.account-auth-password-toggle {
  width: var(--control-md);
  height: var(--control-md);
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--space-1);
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: var(--radius-lg);
  color: var(--color-text-secondary);
  background: transparent;
  cursor: pointer;
  transform: translateY(-50%);
}

.account-auth-password-toggle:hover {
  color: var(--color-accent-active);
  background: transparent;
}

.account-auth-password-toggle:focus-visible {
  outline: 2px solid var(--color-field-focus);
  outline-offset: -2px;
}

.account-auth-password-toggle .ds-icon {
  width: var(--icon-md);
  height: var(--icon-md);
}

.account-auth-identity {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  text-align: center;
}

.account-auth-identity span {
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

.account-auth-text-button {
  padding: 0;
  border: 0;
  color: var(--color-accent-active);
  background: transparent;
  font: inherit;
  font-weight: var(--weight-semibold);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.account-auth-text-button.account-auth-register {
  position: relative;
  font-size: var(--font-size-14);
  text-decoration: none;
}

.account-auth-text-button.account-auth-register::before {
  content: "";
  position: absolute;
  inset: -12px -4px;
}

.account-auth-text-button:hover {
  color: var(--color-accent-hover);
}

.account-auth-text-button.account-auth-back {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  font-weight: var(--weight-regular);
  text-decoration: none;
}

.account-auth-shell > .account-auth-text-button.account-auth-back {
  display: flex;
  width: fit-content;
  margin: var(--space-4) auto 0;
}

.account-auth-shell > .account-auth-back[hidden] {
  display: none;
}

.account-auth-text-button.account-auth-back:hover {
  color: var(--color-text);
  text-decoration: none;
}

.account-auth-back .ds-icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

.account-auth-privacy a,
.account-auth-privacy a:hover {
  color: var(--color-text);
  font-weight: var(--weight-semibold);
  text-decoration: none;
}

.account-auth-status {
  margin-top: var(--space-3);
  color: var(--color-danger);
  text-align: center;
}

.account-auth-status:empty {
  display: none;
}

.account-auth-meta {
  margin-top: var(--space-4);
  display: grid;
  justify-items: center;
  gap: var(--space-3);
  text-align: center;
}

.account-auth-recovery {
  min-height: auto;
  display: inline-flex;
  align-items: center;
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  font-weight: var(--weight-regular);
  text-decoration: none;
}

.account-auth-recovery:hover {
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: var(--space-1);
}

.account-auth-privacy {
  width: 100%;
  max-width: none;
  margin: 0;
  font-size: var(--font-size-12);
}

.account-recovery-flow {
  display: grid;
  gap: var(--space-4);
}

.account-recovery-flow[hidden],
.account-recovery-confirmation[hidden] {
  display: none;
}

.account-recovery-back {
  justify-self: center;
  margin-top: 0;
  gap: var(--space-1);
  color: var(--color-text-secondary);
}

.account-recovery-back:hover {
  color: var(--color-text);
}

.account-recovery-back .ds-icon {
  width: var(--icon-sm);
  height: var(--icon-sm);
}

.account-recovery-flow .account-auth-status[data-tone="info"] {
  color: var(--color-text-secondary);
  font-weight: var(--weight-regular);
}

.account-recovery-confirmation {
  display: grid;
  gap: var(--space-3);
}

.account-recovery-confirmation h2 {
  margin: 0;
  font-size: var(--font-size-20);
  line-height: 1.3;
}

.account-recovery-confirmation p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: var(--font-size-14);
  line-height: 1.5;
}

.account-recovery-confirmation .account-recovery-demo-note {
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  color: var(--color-text);
  background: var(--color-surface-muted);
}

.account-recovery-actions {
  margin-top: var(--space-2);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

@media (max-width: 640px) {
  .account-auth-dialog {
    width: calc(100vw - 20px);
  }

  .account-auth-shell.is-dialog {
    padding: var(--space-5);
  }

  .account-auth-stack > .account-auth-shell:not(.is-dialog) {
    width: calc(100% + 32px);
    margin-inline: -16px;
    padding: var(--space-5);
    border: 0;
    border-radius: 0;
  }

  .account-auth-heading {
    padding-inline: var(--space-4);
  }

  .account-auth-demo {
    padding-inline: var(--space-3);
  }

  .account-auth-demo dl {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
  }

  .account-recovery-actions .ds-button {
    width: 100%;
  }
}
