.account-area {
  --account-navy: #172b4d;
  --account-ink: #17212b;
  --account-muted: #5f6b7a;
  --account-border: #d7dde5;
  --account-canvas: #f4f6f9;
  --account-panel: #fff;

  background: var(--account-canvas);
}

.site-main.account-main {
  width: 100%;
  max-width: none;
  padding: clamp(2.5rem, 6vw, 5.5rem) clamp(1rem, 4vw, 3rem);
  background:
    linear-gradient(180deg, rgb(23 43 77 / 5%), transparent 18rem),
    var(--account-canvas);
}

.auth-card {
  --bs-card-border-color: var(--account-border);
  --bs-card-border-radius: 0.25rem;

  width: min(100%, 29rem);
  margin: 0 auto;
  border-top: 0.25rem solid var(--primary-colour);
  box-shadow: 0 0.75rem 2.5rem rgb(23 43 77 / 12%);
}

.auth-card--wide {
  width: min(100%, 43rem);
}

.auth-card__body {
  padding: clamp(1.75rem, 5vw, 2.75rem);
}

.auth-card__eyebrow {
  margin: 0 0 0.5rem;
  color: var(--primary-colour);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.auth-card__title {
  margin: 0;
  color: var(--account-ink);
  font-size: clamp(1.65rem, 4vw, 2rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.auth-card__intro {
  margin: 0.65rem 0 1.75rem;
  color: var(--account-muted);
}

.auth-form .mb-3 {
  margin-bottom: 1.15rem !important;
}

.auth-form label,
.profile-form label {
  margin-bottom: 0.4rem;
  color: var(--account-ink);
  font-size: 0.875rem;
  font-weight: 600;
}

.auth-form .form-control,
.profile-form .form-control {
  min-height: 2.875rem;
  border-color: #aeb8c5;
  border-radius: 0.2rem;
  color: var(--account-ink);
}

.auth-form .form-control:focus,
.profile-form .form-control:focus {
  border-color: var(--primary-colour);
  box-shadow: 0 0 0 0.2rem rgb(var(--theme-color-brand-rgb) / 18%);
}

.auth-form .form-text,
.auth-form .helptext,
.profile-form .form-text {
  color: var(--account-muted);
  font-size: 0.8125rem;
}

.auth-form[data-password-change-form]:not(.auth-form--invalid) .form-text,
.auth-form[data-password-change-form]:not(.auth-form--invalid) .helptext {
  display: none;
}

.auth-form .errorlist {
  padding: 0;
  margin: 0.4rem 0 0;
  color: #a61b1b;
  font-size: 0.875rem;
  list-style: none;
}

.account-area .btn {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.2rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.account-area .btn-primary {
  --bs-btn-bg: var(--primary-colour);
  --bs-btn-border-color: var(--primary-colour);
  --bs-btn-hover-bg: color-mix(in srgb, var(--primary-colour) 84%, #000);
  --bs-btn-hover-border-color: var(--bs-btn-hover-bg);
  --bs-btn-active-bg: color-mix(in srgb, var(--primary-colour) 76%, #000);
  --bs-btn-active-border-color: var(--bs-btn-active-bg);
  --bs-btn-focus-shadow-rgb: var(--theme-color-brand-rgb);
}

.account-area .btn-outline-primary {
  --bs-btn-color: var(--primary-colour);
  --bs-btn-border-color: var(--primary-colour);
  --bs-btn-hover-bg: var(--primary-colour);
  --bs-btn-hover-border-color: var(--primary-colour);
  --bs-btn-focus-shadow-rgb: var(--theme-color-brand-rgb);
}

.auth-links {
  padding-top: 1.25rem;
  border-top: 0.0625rem solid var(--account-border);
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.auth-links a,
.mfa-authentication__fallback a {
  font-weight: 600;
  text-decoration: none;
}

.auth-links a:hover,
.mfa-authentication__fallback a:hover {
  text-decoration: underline;
}

.profile-shell {
  width: min(100%, 72rem);
  margin: 0 auto;
}

.profile-header {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1.25rem;
}

.profile-header h1 {
  margin: 0;
  color: var(--account-ink);
  font-size: clamp(1.8rem, 4vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.profile-avatar {
  display: grid;
  width: 4.5rem;
  height: 4.5rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--account-navy);
  box-shadow: inset 0 0 0 0.25rem rgb(255 255 255 / 22%);
  color: #fff;
  font-size: 1.6rem;
  font-weight: 600;
  place-items: center;
}

.profile-layout {
  display: grid;
  align-items: start;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 2rem;
}

.profile-nav {
  display: grid;
  position: sticky;
  top: 1.5rem;
  border-left: 0.1875rem solid var(--account-border);
}

.profile-nav a {
  padding: 0.65rem 0.9rem;
  margin-left: -0.1875rem;
  border-left: 0.1875rem solid transparent;
  color: var(--account-muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.profile-nav a:hover,
.profile-nav a:focus-visible {
  border-left-color: var(--primary-colour);
  background: rgb(var(--theme-color-brand-rgb) / 7%);
  color: var(--account-ink);
}

.profile-content {
  display: grid;
  gap: 1.5rem;
}

.profile-panel {
  --bs-card-border-color: var(--account-border);
  --bs-card-border-radius: 0.25rem;

  box-shadow: 0 0.2rem 0.75rem rgb(23 43 77 / 6%);
}

.profile-panel .card-body {
  padding: clamp(1.4rem, 3vw, 2rem);
}

.profile-panel__heading {
  padding-bottom: 1.25rem;
  border-bottom: 0.0625rem solid var(--account-border);
  margin-bottom: 1.5rem;
}

.profile-panel__heading h2 {
  margin: 0;
  color: var(--account-ink);
  font-size: 1.25rem;
  font-weight: 600;
}

.profile-panel__heading p {
  margin: 0.35rem 0 0;
  color: var(--account-muted);
  font-size: 0.9rem;
}

.profile-form {
  max-width: 40rem;
}

.profile-form__meta {
  display: grid;
  padding: 0.85rem 1rem;
  border: 0.0625rem solid var(--account-border);
  border-radius: 0.2rem;
  margin: 0 0 1.25rem;
  grid-template-columns: 8rem 1fr;
  background: var(--account-canvas);
  font-size: 0.875rem;
}

.profile-form__meta span {
  color: var(--account-muted);
}

.profile-form__meta strong {
  color: var(--account-muted);
  font-weight: 500;
}

.security-list {
  display: grid;
}

.security-item {
  display: grid;
  align-items: center;
  padding: 1.25rem 0;
  border-bottom: 0.0625rem solid var(--account-border);
  grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  gap: 1rem;
}

.security-item:first-child {
  padding-top: 0;
}

.security-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.security-item__icon {
  display: grid;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.25rem;
  background: rgb(var(--theme-color-brand-rgb) / 9%);
  color: var(--primary-colour);
  place-items: center;
}

.security-item__icon .icon-mask {
  width: 1.35rem;
  height: 1.35rem;
}

.security-item__content h3 {
  margin: 0;
  color: var(--account-ink);
  font-size: 1rem;
  font-weight: 600;
}

.security-item__content p {
  margin: 0.25rem 0 0;
  color: var(--account-muted);
  font-size: 0.85rem;
}

.security-item__managed {
  color: var(--account-muted);
  font-size: 0.8rem;
  text-align: right;
}

.security-item__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.authenticator-change__warning {
  padding: 0.875rem 1rem;
  border: 0.0625rem solid #d99b9b;
  border-radius: 0.2rem;
  margin: 1.25rem 0;
  background: #fff5f5;
  color: #742424;
  font-size: 0.875rem;
}

.totp-enrolment__feedback:empty,
.recovery-codes__status:empty,
.recovery-codes__list[hidden] {
  display: none;
}

.totp-enrolment__alert,
.mfa-authentication__error,
.recovery-codes__notice {
  padding: 0.8rem 1rem;
  border: 0.0625rem solid var(--account-border);
  border-radius: 0.2rem;
  margin: 1rem 0;
  background: var(--account-canvas);
}

.totp-enrolment__alert--success {
  border-color: #68a67a;
}

.totp-enrolment__alert--error,
.mfa-authentication__error,
.recovery-codes__notice--warning {
  border-color: #c77979;
}

.totp-enrolment__qr {
  display: grid;
  min-height: 13.75rem;
  margin: 1.5rem 0;
  place-items: center;
}

.totp-enrolment__qr img {
  display: block;
  max-width: 100%;
  image-rendering: pixelated;
}

.totp-enrolment__loading,
.totp-enrolment__manual p,
.totp-enrolment__hint,
.mfa-authentication__intro,
.recovery-codes__intro {
  color: var(--account-muted);
}

.mfa-authentication__fallback {
  padding-top: 1.25rem;
  border-top: 0.0625rem solid var(--account-border);
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.mfa-authentication__fallback p {
  margin: 0 0 0.25rem;
  color: var(--account-muted);
}

.verification-code-input,
.recovery-code-input {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 1.125rem;
  letter-spacing: 0.12em;
}

.verification-code-input {
  max-width: 12rem;
}

.authentication-methods {
  display: grid;
  border: 0.0625rem solid var(--account-border);
  border-radius: 0.2rem;
}

.authentication-method {
  display: grid;
  align-items: center;
  padding: 1rem;
  grid-template-columns: 1.5rem minmax(0, 1fr) 1rem;
  gap: 0.875rem;
  color: var(--account-ink);
  text-decoration: none;
}

.authentication-method + .authentication-method {
  border-top: 0.0625rem solid var(--account-border);
}

.authentication-method:hover,
.authentication-method:focus-visible {
  background: var(--account-canvas);
  color: var(--account-ink);
}

.authentication-method:focus-visible {
  outline: 0.1875rem solid var(--primary-colour);
  outline-offset: -0.1875rem;
}

.authentication-method .icon-mask {
  width: 1rem;
  height: 1rem;
  color: var(--account-muted);
}

.authentication-method .authentication-method__icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--primary-colour);
}

.authentication-method strong,
.authentication-method small {
  display: block;
}

.authentication-method strong {
  font-size: 0.9375rem;
}

.authentication-method small {
  margin-top: 0.2rem;
  color: var(--account-muted);
  font-size: 0.8rem;
}

.totp-enrolment__manual {
  padding: 1rem 0;
  border-top: 0.0625rem solid var(--account-border);
}

.auth-link-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary-colour);
  font: inherit;
  font-weight: 600;
}

.totp-enrolment__key-row,
.totp-enrolment__actions,
.recovery-codes__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.totp-enrolment__key-row code {
  overflow-wrap: anywhere;
}

.totp-enrolment__form,
.totp-enrolment__actions {
  margin-top: 1.5rem;
}

.totp-enrolment__form input {
  max-width: 13rem;
}

.recovery-codes__list {
  display: grid;
  padding: 1rem;
  border: 0.0625rem solid var(--account-border);
  border-radius: 0.2rem;
  margin: 1.5rem 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.625rem;
  background: var(--account-canvas);
  list-style: none;
}

.recovery-codes__list code {
  display: block;
  padding: 0.5rem;
  background: var(--account-panel);
  color: var(--account-ink);
  text-align: center;
}

@media (max-width: 50rem) {
  .profile-layout {
    grid-template-columns: 1fr;
  }

  .profile-nav {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-bottom: 0.1875rem solid var(--account-border);
    border-left: 0;
  }

  .profile-nav a {
    margin: 0 0 -0.1875rem;
    border-bottom: 0.1875rem solid transparent;
    border-left: 0;
  }

  .profile-nav a:hover,
  .profile-nav a:focus-visible {
    border-bottom-color: var(--primary-colour);
    border-left-color: transparent;
  }

  .security-item {
    grid-template-columns: 2.75rem minmax(0, 1fr) auto;
  }

  .security-item > :last-child {
    grid-column: 2 / -1;
    justify-self: start;
    text-align: left;
  }

  .security-item__actions {
    justify-content: flex-start;
  }
}

@media (max-width: 34rem) {
  .site-main.account-main {
    padding: 2rem 1rem;
  }

  .profile-header {
    align-items: flex-start;
  }

  .profile-avatar {
    width: 3.5rem;
    height: 3.5rem;
  }

  .security-item {
    grid-template-columns: 2.75rem minmax(0, 1fr);
  }

  .security-item > :last-child {
    grid-column: 2;
    justify-self: start;
  }

  .recovery-codes__list {
    grid-template-columns: 1fr;
  }
}
