.account-header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--accent);
  font-size: .82rem;
  font-weight: 650;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: color .2s var(--ios), border-color .2s var(--ios), background-color .2s var(--ios), box-shadow .2s var(--ios);
}

.account-header-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: none;
}

.account-header-link:focus-visible {
  outline: 3px solid rgba(0, 122, 255, .22);
  outline-offset: 2px;
}

.account-header-link i { font-size: .8rem; }

.account-header-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  overflow: visible;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 750;
}

.account-header-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.account-header-avatar .account-coupon-notice { top: -4px; right: -5px; }
.account-header-chevron { color: var(--ink3); font-size: .58rem !important; }

.account-header-link.is-authenticated,
.account-header-link.is-authenticated:hover {
  gap: 5px;
  border-color: transparent;
  background: transparent;
  color: var(--ink2);
  box-shadow: none;
}

@media (min-width: 769px) {
  .header .nav-actions { position: relative; }
  /* Keep the original cart and navigation anchors; the account button stays out of flex layout. */
  .header .nav-actions .account-header-link {
    position: absolute;
    top: 50%;
    left: calc(100% + 8px);
    width: 86px;
    transform: translateY(-50%);
  }
  .header .nav-actions .account-header-link.is-authenticated {
    width: auto;
    min-width: 48px;
    padding: 0 4px;
  }
}

@media (min-width: 769px) and (max-width: 1323px) {
  /* When the outer right margin is too narrow, use the free space before the cart instead. */
  .header .nav-actions .account-header-link {
    left: auto;
    right: calc(100% + 8px);
  }
}

@media (max-width: 768px) {
  .account-header-link { display: none !important; }
  .header .cart-toggle { width: 38px; height: 38px; padding: 0; }
}

@media (max-width: 350px) {
  .header .nav-actions { right: 10px !important; }
  .header .cart-toggle { width: 34px; height: 36px; }
}

.mobile-menu-account-link {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  font-weight: 700;
}

.mobile-menu-account-link i { width: 18px; text-align: center; }
.mobile-menu-account-link .account-header-avatar { flex-basis: 32px; width: 32px; height: 32px; }

.auth-body {
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background: var(--surface);
  color: var(--ink);
}

.auth-body .header {
  transition: background-color var(--dur) var(--ios), box-shadow var(--dur) var(--ios);
}

.auth-body.cart-open .header {
  right: var(--scroll-lock-gap, 0px);
}

.auth-page {
  flex: 1 0 auto;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  padding: clamp(112px, 13vh, 150px) clamp(18px, 4vw, 48px) 88px;
  background:
    radial-gradient(circle at 8% 18%, rgba(0, 122, 255, .08), transparent 29%),
    radial-gradient(circle at 92% 82%, rgba(52, 199, 89, .06), transparent 26%),
    var(--surface);
}

.auth-layout {
  width: min(100%, 760px);
  min-width: 0;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 64px;
}

.auth-form-column {
  width: min(100%, 520px);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
}

.auth-form-column,
.auth-form-column > div,
.auth-form,
.auth-field,
.auth-input-wrap,
.auth-registration-panel,
.auth-user-panel,
.reset-step {
  min-width: 0;
  max-width: 100%;
}

.auth-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.85rem, 3.5vw, 2.55rem);
  font-weight: 750;
  line-height: 1.12;
  letter-spacing: -.04em;
  text-align: center;
}

.auth-title[tabindex="-1"]:focus { outline: none; }

.auth-user-panel > .auth-title { margin-bottom: 24px; }

.auth-subtitle {
  margin: 13px 0 32px;
  color: var(--ink3);
  font-size: .93rem;
  line-height: 1.6;
  text-align: center;
}

.auth-form { display: grid; gap: 19px; }
.auth-field { display: grid; gap: 8px; }
.auth-label { color: var(--ink2); font-size: .84rem; font-weight: 650; }
.auth-input-wrap { position: relative; }

.auth-input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: 54px;
  padding: 0 16px;
  border: 1px solid rgba(0, 0, 0, .15);
  border-radius: 13px;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  font: inherit;
  font-size: .95rem;
  outline: none;
  transition: border-color .2s var(--ios), box-shadow .2s var(--ios), background-color .2s var(--ios);
}

.auth-input::placeholder { color: #a1a1a6; }
.auth-input:focus { border-color: rgba(0, 122, 255, .68); background: #fff; box-shadow: 0 0 0 4px rgba(0, 122, 255, .1); }
.auth-input[aria-invalid="true"] { border-color: rgba(255, 59, 48, .75); box-shadow: 0 0 0 4px rgba(255, 59, 48, .09); }
.auth-password-input { padding-right: 50px; }

.auth-field-hint {
  margin-top: -1px;
  color: var(--ink3);
  font-size: .75rem;
  line-height: 1.4;
}

.auth-field-hint.error { color: var(--error); }

.auth-field-message {
  margin-top: -1px;
  color: var(--error);
  font-size: .78rem;
  line-height: 1.4;
}

.auth-field-message:empty { display: none; }
.auth-field-message.success { color: #168247; }

.auth-forgot-link {
  color: var(--accent);
  font-weight: 650;
  text-decoration: none;
}

.auth-forgot-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.auth-password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  transform: translateY(-50%) !important;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--ink3);
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.auth-password-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.auth-password-toggle:active { top: 50%; transform: translateY(-50%) !important; }
.auth-password-toggle i { display: block; width: 1.25em; line-height: 1; text-align: center; }

.auth-submit {
  display: block;
  width: min(100%, 270px);
  min-height: 44px;
  margin: 3px auto 0;
  padding: 0 20px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: .95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0, 122, 255, .18);
  transition: background-color .2s var(--ios), transform .2s var(--ios), box-shadow .2s var(--ios);
}

.auth-submit:hover { background: var(--accent-hover); box-shadow: 0 12px 28px rgba(0, 122, 255, .23); transform: translateY(-1px); }
.auth-submit:disabled { cursor: wait; opacity: .66; transform: none; }
.auth-resend-button {
  display: block;
  width: min(100%, 270px);
  min-height: 40px;
  margin: -5px auto 0;
  padding: 0 14px;
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  background: #fff;
  color: var(--accent);
  font: inherit;
  font-size: .82rem;
  font-weight: 650;
  cursor: pointer;
}

.auth-resend-button:disabled {
  border-color: #e5e5ea;
  background: #e5e5ea;
  color: #8e8e93;
  cursor: default;
}
.auth-message { min-height: 21px; margin: -12px 0; color: var(--error); font-size: .8rem; line-height: 1.45; text-align: center; }
.auth-message.success { color: #168247; }
.auth-switch { margin: 8px 0 0; color: var(--ink3); font-size: .87rem; line-height: 1.5; text-align: center; }

.auth-title,
.auth-subtitle,
.auth-field-message,
.auth-switch,
.auth-registration-panel .auth-subtitle {
  overflow-wrap: anywhere;
}

.auth-switch-button {
  padding: 2px 3px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

.auth-home-row {
  min-height: 38px;
  margin-top: 32px;
  display: flex;
  justify-content: center;
}

.auth-home-return {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(100%, 210px);
  min-height: 38px;
  padding: 0 18px;
  border: 2px solid var(--border-hover);
  border-radius: 999px;
  background: rgba(255, 255, 255, .82);
  color: var(--accent);
  font-size: .85rem;
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
  transition: color .2s var(--ios), border-color .2s var(--ios), background-color .2s var(--ios);
}

.auth-home-return i { font-size: .78rem; }

.auth-home-return:hover {
  color: var(--accent);
  border-color: rgba(0, 122, 255, .35);
  background: var(--accent-soft);
}

.auth-registration-panel { width: 100%; }
.auth-user-panel { padding-top: 8px; text-align: center; }

.auth-user-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin: 0 auto 19px;
  border-radius: 17px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.35rem;
}

.auth-user-email { margin: 11px 0 25px; color: var(--ink2); font-size: .94rem; overflow-wrap: anywhere; }
.auth-user-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.auth-profile-avatar-wrap { margin: 25px auto 28px; }

.auth-profile-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin: 0 auto;
  overflow: visible;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
}

.auth-profile-avatar > img,
.auth-profile-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.auth-profile-avatar > img { display: block; object-fit: cover; }
.auth-profile-avatar-fallback { display: grid; place-items: center; font-size: 1.65rem; }

.auth-profile-avatar-edit {
  position: absolute;
  right: -2px;
  bottom: 1px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .72rem;
}

.account-coupon-notice {
  position: absolute;
  top: -3px;
  right: -4px;
  z-index: 2;
  display: grid;
  min-width: 18px;
  height: 18px;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ff3b30;
  color: #fff;
  font-size: 10px;
  font-weight: 750;
  line-height: 1;
}
.account-coupon-notice[hidden] { display: none !important; }

.auth-avatar-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.auth-profile-message { display: block; margin-top: 10px; text-align: center; }
.auth-profile-form { margin-bottom: 24px; text-align: left; }
.auth-profile-name-input { padding-right: 56px; }
.auth-profile-name-input[readonly] { cursor: default; }

.auth-name-action {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin: 0;
  padding: 0;
  transform: translateY(-50%) !important;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.auth-name-action:hover { background: var(--accent-soft); }
.auth-name-action:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.auth-name-action:disabled { opacity: .5; cursor: wait; }
.auth-name-action svg { display: block; }

.auth-secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border-hover);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: .86rem;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}

.auth-secondary-action:hover { border-color: rgba(0, 122, 255, .3); color: var(--accent); background: var(--accent-soft); }
.auth-body .footer { flex: 0 0 auto; }
.auth-body .footer-content,
.auth-body .footer-links,
.auth-body .footer-section { min-width: 0; max-width: 100%; }
.auth-body .footer-section a { overflow-wrap: anywhere; }

.reset-page .auth-layout { width: min(100%, 620px); }
.reset-form-column { width: min(100%, 520px); }

.reset-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 280px);
  margin: 0 auto 34px;
}

.reset-progress-dot {
  display: grid;
  place-items: center;
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border-hover);
  border-radius: 50%;
  background: #fff;
  color: var(--ink3);
  font-size: .76rem;
  font-weight: 700;
  transition: color .2s var(--ios), border-color .2s var(--ios), background-color .2s var(--ios);
}

.reset-progress-line {
  flex: 1 1 auto;
  height: 2px;
  margin: 0 8px;
  border-radius: 999px;
  background: var(--border);
  transition: background-color .2s var(--ios);
}

.reset-progress-dot.active,
.reset-progress-dot.completed {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.reset-progress-line.completed { background: var(--accent); }
.reset-step { width: 100%; }
.auth-code-inputs { display: flex; justify-content: center; gap: 8px; width: 100%; }
.auth-code-digit {
  width: 42px;
  height: 52px;
  padding: 0;
  border: 1px solid #d6d9de;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  text-align: center;
  font-family: inherit;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  caret-color: var(--accent);
  box-sizing: border-box;
}
.auth-code-digit:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(8,124,255,.14); }
.auth-code-value { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.reset-success { text-align: center; }

.reset-success-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: rgba(52, 199, 89, .13);
  color: #168247;
  font-size: 1.3rem;
}

.reset-login-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.reset-back-row { margin-top: 30px; }
[hidden] { display: none !important; }

@media (max-width: 900px) {
  .auth-page { padding: 112px 24px 72px; }
  .auth-layout { gap: 54px; }
}

@media (max-width: 520px) {
  .auth-page {
    padding: 94px max(16px, env(safe-area-inset-right, 0px)) 56px max(16px, env(safe-area-inset-left, 0px));
  }
  .auth-layout { gap: 44px; }
  .auth-title { font-size: 1.8rem; }
  .auth-subtitle { margin-bottom: 25px; }
  .auth-user-actions { grid-template-columns: 1fr; }
  .auth-body .footer-links { grid-template-columns: 1fr; gap: 1.25rem; }
  .reset-progress { margin-bottom: 28px; }
  .auth-code-inputs { gap: 6px; }
  .auth-code-digit { width: 39px; height: 48px; }
}

@media (max-width: 768px) {
  .auth-body.mobile-navigation-open { overflow: hidden; }
}

@media (max-width: 768px), (pointer: coarse) {
  .auth-input { font-size: 16px; }

  .auth-body .auth-submit:hover,
  .auth-body .auth-submit:active,
  .auth-body .auth-resend-button:hover,
  .auth-body .auth-resend-button:active,
  .auth-body .auth-switch-button:hover,
  .auth-body .auth-switch-button:active,
  .auth-body .auth-secondary-action:hover,
  .auth-body .auth-secondary-action:active {
    transform: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .account-header-link, .auth-submit, .auth-input { transition: none; }
}
