.auth-page {
  min-height: calc(100vh - var(--header-h));
  display: grid;
  align-items: center;
  padding: 72px 0;
}

.auth-grid {
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: 42px;
  align-items: center;
}

.auth-card {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-bottom: 12px;
  color: var(--text-strong);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.auth-card > p {
  margin-bottom: 24px;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form.is-loading {
  pointer-events: none;
}

.auth-form.is-loading .auth-field input,
.auth-form.is-loading .auth-checkbox,
.auth-form.is-loading .auth-row {
  opacity: 0.68;
}

.auth-field {
  display: grid;
  gap: 7px;
}

.auth-field label {
  color: var(--text-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-alt);
  color: var(--text);
  outline: none;
}

.auth-field input:disabled {
  cursor: wait;
}

.auth-field input:focus {
  border-color: rgba(71, 120, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(71, 120, 255, 0.15);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-row a,
.auth-switch a {
  color: var(--brand-3);
  font-weight: 700;
}

.auth-checkbox {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-checkbox input {
  width: 16px;
  height: 16px;
  margin-top: 3px;
  accent-color: var(--brand);
}

.auth-submit {
  width: 100%;
  margin-top: 6px;
}

.auth-submit.is-loading,
.auth-page .button.is-loading {
  cursor: wait;
  opacity: 0.94;
}

.auth-submit.is-loading {
  gap: 10px;
}

.auth-loading-spinner {
  width: 1.08em;
  height: 1.08em;
  display: inline-block;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #ffffff;
  border-radius: 999px;
  animation: authSpin 0.72s linear infinite;
}

.auth-loading-text {
  display: inline-block;
}

.auth-switch {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-message {
  display: none;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.9rem;
}

.auth-message.is-visible {
  display: block;
}

.auth-message.is-info {
  border-color: rgba(39, 199, 255, 0.32);
  color: var(--muted);
  background: rgba(39, 199, 255, 0.08);
}

.auth-message.is-success {
  border-color: rgba(126, 226, 170, 0.35);
  color: var(--success);
  background: rgba(126, 226, 170, 0.08);
}

.auth-message.is-error {
  border-color: rgba(255, 109, 109, 0.4);
  color: #ff9b9b;
  background: rgba(255, 109, 109, 0.08);
}

html[data-theme="light"] .auth-message.is-error {
  color: #b42318;
}

.auth-dev-link {
  display: block;
  margin-top: 10px;
  color: var(--brand-3);
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.auth-verification-loading {
  display: flex !important;
  align-items: center;
  gap: 12px;
}

.auth-verification-loading strong {
  display: block;
  color: var(--text-strong);
  font-size: 0.95rem;
}

.auth-verification-loading small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.auth-page-spinner {
  width: 34px;
  height: 34px;
  display: inline-block;
  flex: 0 0 auto;
  border: 3px solid rgba(143, 108, 255, 0.24);
  border-top-color: var(--brand-2);
  border-radius: 999px;
  animation: authSpin 0.78s linear infinite;
}

.auth-preview-card {
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 18% 8%, rgba(71, 120, 255, 0.16), transparent 22rem),
    radial-gradient(circle at 88% 12%, rgba(143, 108, 255, 0.14), transparent 20rem),
    var(--surface);
  box-shadow: var(--shadow);
}

.auth-preview-brand {
  min-height: 260px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(71, 120, 255, 0.12), rgba(143, 108, 255, 0.12)),
    var(--bg-alt);
}

.auth-preview-logo {
  width: min(260px, 70%);
  height: auto;
  object-fit: contain;
  background: transparent;
}

.auth-preview-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
  color: var(--muted);
  font-size: 0.94rem;
}

.auth-preview-list span {
  display: flex;
  gap: 10px;
}

.auth-preview-list strong {
  color: var(--success);
}

.auth-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-page .button.button-primary,
.auth-page .button.button-primary:visited,
html[data-theme="light"] .auth-page .button.button-primary,
html[data-theme="light"] .auth-page .button.button-primary:visited {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 12px 28px rgba(71, 120, 255, 0.28);
}

.auth-page .button.button-primary:hover,
html[data-theme="light"] .auth-page .button.button-primary:hover {
  border-color: transparent;
  background: linear-gradient(135deg, #3f70f4, #805cff);
  color: #fff;
}

@keyframes authSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 900px) {
  .auth-grid {
    grid-template-columns: 1fr;
  }

  .auth-preview-card {
    display: none;
  }
}

@media (max-width: 640px) {
  .auth-page {
    padding: 46px 0;
  }

  .auth-card {
    padding: 24px;
  }

  .auth-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-header-actions .button {
    min-height: 38px;
    padding: 0 12px;
    font-size: 0.86rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-loading-spinner,
  .auth-page-spinner {
    animation: none;
  }
}

.auth-password-wrap {
  position: relative;
  display: grid;
}

.auth-password-wrap input {
  padding-right: 48px;
}

.auth-password-reveal {
  position: absolute;
  top: 50%;
  right: 8px;
  width: 34px;
  height: 34px;

  display: inline-grid;
  place-items: center;

  border: 1px solid transparent;
  border-radius: 10px;

  color: var(--muted);
  background: transparent;
  cursor: pointer;

  transform: translateY(-50%);

  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.auth-password-reveal:hover,
.auth-password-reveal:focus-visible,
.auth-password-wrap.is-revealing .auth-password-reveal {
  color: var(--text-strong);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
}

html[data-theme="light"] .auth-password-reveal:hover,
html[data-theme="light"] .auth-password-reveal:focus-visible,
html[data-theme="light"] .auth-password-wrap.is-revealing .auth-password-reveal {
  background: rgba(15, 23, 42, 0.055);
}

.auth-password-reveal:active {
  transform: translateY(-50%) scale(0.96);
}

.auth-password-reveal:focus-visible {
  outline: 3px solid rgba(71, 120, 255, 0.25);
  outline-offset: 2px;
}

.auth-password-reveal svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: currentColor;
}

.auth-password-reveal:disabled {
  cursor: wait;
  opacity: 0.55;
}

html[dir="rtl"] .auth-password-wrap input {
  padding-right: 13px;
  padding-left: 48px;
}

html[dir="rtl"] .auth-password-reveal {
  right: auto;
  left: 8px;
}

.auth-password-reveal .auth-eye-icon {
  width: 19px;
  height: 19px;
  display: block;
  fill: currentColor;
}

.auth-password-reveal .auth-eye-open {
  display: none;
}

.auth-password-wrap.is-revealing .auth-eye-closed {
  display: none;
}

.auth-password-wrap.is-revealing .auth-eye-open {
  display: block;
}

/* =========================================================
   Auth language selector + upgraded right-side visual
========================================================= */

/* =========================================================
   Arabic + Persian fonts for account/auth pages
========================================================= */

@font-face {
  font-family: 'Dubai';
  src: url('/fonts/arabic/DUBAI-LIGHT.TTF') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Dubai';
  src: url('/fonts/arabic/DUBAI-REGULAR.TTF') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Dubai';
  src: url('/fonts/arabic/DUBAI-MEDIUM.TTF') format('truetype');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Dubai';
  src: url('/fonts/arabic/DUBAI-BOLD.TTF') format('truetype');
  font-weight: 800 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn RD';
  src: url('/fonts/persian/Vazirmatn-RD-Light.TTF') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn RD';
  src: url('/fonts/persian/Vazirmatn-RD-Regular.TTF') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn RD';
  src: url('/fonts/persian/Vazirmatn-RD-Medium.TTF') format('truetype');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn RD';
  src: url('/fonts/persian/Vazirmatn-RD-Bold.TTF') format('truetype');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn RD';
  src: url('/fonts/persian/Vazirmatn-RD-Black.TTF') format('truetype');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

/* Arabic account pages */
html[lang="ar"],
html[lang="ar"] body,
html[lang="ar"] button,
html[lang="ar"] input,
html[lang="ar"] select,
html[lang="ar"] textarea,
html[lang="ar"] .auth-card,
html[lang="ar"] .auth-card h1,
html[lang="ar"] .auth-card p,
html[lang="ar"] .auth-field label,
html[lang="ar"] .auth-checkbox,
html[lang="ar"] .auth-row,
html[lang="ar"] .auth-switch,
html[lang="ar"] .auth-message,
html[lang="ar"] .auth-preview-copy,
html[lang="ar"] .auth-preview-copy h2,
html[lang="ar"] .auth-preview-copy p,
html[lang="ar"] .auth-preview-list,
html[lang="ar"] .auth-language-select,
html[lang="ar"] .auth-mobile-menu,
html[lang="ar"] .auth-mobile-menu-item,
html[lang="ar"] .button,
html[lang="ar"] .icon-button,
html[lang="ar"] [data-i18n] {
  font-family: 'Dubai', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Persian/Farsi account pages */
html[lang="fa"],
html[lang="fa"] body,
html[lang="fa"] button,
html[lang="fa"] input,
html[lang="fa"] select,
html[lang="fa"] textarea,
html[lang="fa"] .auth-card,
html[lang="fa"] .auth-card h1,
html[lang="fa"] .auth-card p,
html[lang="fa"] .auth-field label,
html[lang="fa"] .auth-checkbox,
html[lang="fa"] .auth-row,
html[lang="fa"] .auth-switch,
html[lang="fa"] .auth-message,
html[lang="fa"] .auth-preview-copy,
html[lang="fa"] .auth-preview-copy h2,
html[lang="fa"] .auth-preview-copy p,
html[lang="fa"] .auth-preview-list,
html[lang="fa"] .auth-language-select,
html[lang="fa"] .auth-mobile-menu,
html[lang="fa"] .auth-mobile-menu-item,
html[lang="fa"] .button,
html[lang="fa"] .icon-button,
html[lang="fa"] [data-i18n] {
  font-family: 'Vazirmatn RD', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Preserve ARTHOUSE brand text */
html[lang="ar"] .brand span,
html[lang="fa"] .brand span {
  font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-weight: 900;
}

/* RTL account-page refinements */
html[dir="rtl"] body {
  direction: rtl;
}

html[dir="rtl"] .auth-nav,
html[dir="rtl"] .auth-header-actions,
html[dir="rtl"] .auth-mobile-menu,
html[dir="rtl"] .auth-grid,
html[dir="rtl"] .auth-row,
html[dir="rtl"] .auth-checkbox,
html[dir="rtl"] .auth-preview-list span {
  direction: rtl;
}

html[dir="rtl"] .auth-card,
html[dir="rtl"] .auth-preview-card,
html[dir="rtl"] .auth-preview-copy,
html[dir="rtl"] .auth-message,
html[dir="rtl"] .auth-field label,
html[dir="rtl"] .auth-switch {
  text-align: right;
}

html[dir="rtl"] .auth-header-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .auth-preview-list span {
  flex-direction: row-reverse;
}

html[dir="rtl"] .auth-checkbox {
  flex-direction: row-reverse;
  justify-content: flex-end;
}

html[dir="rtl"] .auth-checkbox input {
  margin-left: 0;
  margin-right: 0;
}

/* Language dropdown arrow position for RTL */
html[dir="rtl"] .auth-language-select {
  padding-right: 14px;
  padding-left: 38px;
}

/* Password eye already moves in your existing CSS, keep this as a safety override */
html[dir="rtl"] .auth-password-wrap input {
  padding-right: 13px;
  padding-left: 48px;
}

html[dir="rtl"] .auth-password-reveal {
  right: auto;
  left: 8px;
}

/* Mobile menu alignment for Arabic/Persian */
html[dir="rtl"] .auth-mobile-menu-item {
  text-align: right;
}

html[dir="rtl"] .auth-mobile-menu .auth-language-select {
  text-align: right;
}

/* Slightly improve RTL title spacing */
html[lang="ar"] .auth-card h1,
html[lang="fa"] .auth-card h1,
html[lang="ar"] .auth-preview-copy h2,
html[lang="fa"] .auth-preview-copy h2 {
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.auth-language-select {
  min-height: 42px;
  max-width: 170px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--bg-alt);
  outline: none;
  cursor: pointer;
  font-weight: 750;
}

.auth-language-select:focus {
  border-color: rgba(71, 120, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(71, 120, 255, 0.15);
}

.auth-preview-card {
  position: relative;
  overflow: hidden;
}

.auth-preview-card::before {
  content: "";
  position: absolute;
  inset: -18% -10% auto auto;
  width: 320px;
  height: 320px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(71, 120, 255, 0.22), transparent 66%);
  pointer-events: none;
}

.auth-preview-card::after {
  content: "";
  position: absolute;
  inset: auto auto -22% -14%;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(143, 108, 255, 0.2), transparent 66%);
  pointer-events: none;
}

.auth-account-visual {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 48%, rgba(39, 199, 255, 0.16), transparent 12rem),
    linear-gradient(135deg, rgba(71, 120, 255, 0.12), rgba(143, 108, 255, 0.12)),
    var(--bg-alt);
  overflow: hidden;
}

.auth-orbit {
  position: absolute;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  pointer-events: none;
}

.auth-orbit-one {
  width: 230px;
  height: 230px;
  animation: authOrbit 18s linear infinite;
}

.auth-orbit-two {
  width: 310px;
  height: 160px;
  transform: rotate(-18deg);
  animation: authOrbitReverse 22s linear infinite;
}

.auth-security-core {
  position: relative;
  z-index: 2;
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 36px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    var(--surface);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.auth-security-core img {
  width: 86px;
  height: 86px;
  object-fit: contain;
}

.auth-security-lock {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 3px solid var(--surface);
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 14px 30px rgba(71, 120, 255, 0.28);
  font-weight: 900;
}

.auth-floating-pill {
  position: absolute;
  z-index: 3;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-strong);
  background: rgba(255, 255, 255, 0.065);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.14);
  font-size: 0.78rem;
  font-weight: 850;
}

.auth-floating-pill-one {
  top: 42px;
  left: 42px;
}

.auth-floating-pill-two {
  right: 46px;
  top: 86px;
}

.auth-floating-pill-three {
  left: 64px;
  bottom: 58px;
}

.auth-preview-copy {
  position: relative;
  z-index: 1;
  margin-top: 22px;
}

.auth-preview-copy h2 {
  margin: 0 0 10px;
  color: var(--text-strong);
  font-size: clamp(1.45rem, 2.6vw, 2.15rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.auth-preview-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

html[dir="rtl"] .auth-header-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .auth-row {
  direction: rtl;
}

html[dir="rtl"] .auth-switch,
html[dir="rtl"] .auth-card,
html[dir="rtl"] .auth-preview-card {
  text-align: right;
}

html[dir="rtl"] .auth-preview-list span {
  flex-direction: row-reverse;
  text-align: right;
}

html[data-theme="light"] .auth-floating-pill {
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .auth-security-lock {
  border-color: #fff;
}

@keyframes authOrbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes authOrbitReverse {
  to {
    transform: rotate(-378deg);
  }
}

@media (max-width: 900px) {
  .auth-preview-card {
    display: none;
  }
}

@media (max-width: 720px) {
  .auth-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .auth-language-select {
    max-width: 132px;
    min-height: 38px;
    font-size: 0.84rem;
  }
}

@media (max-width: 520px) {
  .auth-language-select {
    flex: 1 1 100%;
    max-width: 100%;
    order: 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-orbit-one,
  .auth-orbit-two {
    animation: none;
  }
}

/* =========================================================
   Auth language selector + image preview
========================================================= */

.auth-language-select {
  min-height: 42px;
  max-width: 170px;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--bg-alt);
  outline: none;
  cursor: pointer;
  font-weight: 750;
}

.auth-language-select:focus {
  border-color: rgba(71, 120, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(71, 120, 255, 0.15);
}

/* Right-side image card */

.auth-preview-image-card {
  position: relative;
  overflow: hidden;
}

.auth-preview-image-card::before {
  content: "";
  position: absolute;
  inset: -22% -16% auto auto;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(71, 120, 255, 0.18), transparent 68%);
  pointer-events: none;
}

.auth-preview-image-card::after {
  content: "";
  position: absolute;
  inset: auto auto -24% -16%;
  width: 360px;
  height: 360px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(143, 108, 255, 0.16), transparent 68%);
  pointer-events: none;
}

.auth-account-visual {
  position: relative;
  z-index: 1;
  min-height: 320px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, rgba(71, 120, 255, 0.1), rgba(143, 108, 255, 0.08)),
    var(--bg-alt);
  overflow: hidden;
}

.auth-preview-image {
  width: 100%;
  height: 100%;
  min-height: 320px;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: inherit;
}

.auth-preview-copy {
  position: relative;
  z-index: 1;
  margin-top: 22px;
}

.auth-preview-copy h2 {
  margin: 0 0 10px;
  color: var(--text-strong);
  font-size: clamp(1.45rem, 2.6vw, 2.15rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
}

.auth-preview-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.auth-preview-list {
  position: relative;
  z-index: 1;
}

/* Remove old generated visual pieces if they still exist in HTML/CSS */
.auth-orbit,
.auth-security-core,
.auth-floating-pill {
  display: none;
}

/* RTL */

html[dir="rtl"] .auth-header-actions {
  flex-direction: row-reverse;
}

html[dir="rtl"] .auth-row {
  direction: rtl;
}

html[dir="rtl"] .auth-switch,
html[dir="rtl"] .auth-card,
html[dir="rtl"] .auth-preview-card {
  text-align: right;
}

html[dir="rtl"] .auth-preview-list span {
  flex-direction: row-reverse;
  text-align: right;
}

/* Light theme */

html[data-theme="light"] .auth-account-visual {
  background:
    linear-gradient(135deg, rgba(71, 120, 255, 0.08), rgba(143, 108, 255, 0.07)),
    var(--bg-alt);
}

/* Responsive */

@media (max-width: 900px) {
  .auth-preview-card {
    display: none;
  }
}

@media (max-width: 720px) {
  .auth-header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .auth-language-select {
    max-width: 132px;
    min-height: 38px;
    font-size: 0.84rem;
  }
}

@media (max-width: 520px) {
  .auth-language-select {
    flex: 1 1 100%;
    max-width: 100%;
    order: 3;
  }
}

/* =========================================================
   Auth responsive hamburger header
========================================================= */

.auth-site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
}

.auth-nav {
  position: relative;
}

.auth-menu-toggle {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text-strong);
  background: var(--bg-alt);
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.auth-menu-toggle span {
  width: 19px;
  height: 2px;
  display: block;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition:
    transform 0.22s ease,
    opacity 0.18s ease;
}

.auth-menu-toggle:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.auth-menu-toggle:active {
  transform: scale(0.96);
}

.auth-menu-toggle.is-open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.auth-menu-toggle.is-open span:nth-child(2) {
  opacity: 0;
}

.auth-menu-toggle.is-open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.auth-mobile-menu {
  width: min(100% - 32px, 1120px);
  max-height: 0;
  display: grid;
  gap: 10px;
  margin: 0 auto;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background:
    radial-gradient(circle at 12% 0%, rgba(71, 120, 255, 0.14), transparent 18rem),
    radial-gradient(circle at 88% 0%, rgba(143, 108, 255, 0.12), transparent 18rem),
    var(--surface);
  box-shadow: none;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition:
    max-height 0.28s ease,
    padding 0.28s ease,
    opacity 0.2s ease,
    transform 0.22s ease,
    border-color 0.22s ease,
    box-shadow 0.22s ease;
}

.auth-mobile-menu.is-open {
  max-height: 420px;
  padding: 14px;
  border-color: var(--line);
  box-shadow: var(--shadow);
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.auth-mobile-menu .auth-language-select {
  width: 100%;
  max-width: none;
  min-height: 44px;
  flex: none;
  order: initial;
}

.auth-mobile-menu-item {
  width: 100%;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: var(--bg-alt);
  text-decoration: none;
  cursor: pointer;
  font-weight: 800;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}

.auth-mobile-menu-item:hover {
  color: var(--text-strong);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.06);
}

.auth-mobile-menu-item:active {
  transform: scale(0.98);
}

.auth-mobile-menu-primary {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 12px 28px rgba(71, 120, 255, 0.24);
}

.auth-mobile-menu-primary:hover {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, #3f70f4, #805cff);
}

html[data-theme="light"] .auth-menu-toggle:hover,
html[data-theme="light"] .auth-mobile-menu-item:hover {
  background: rgba(15, 23, 42, 0.055);
}

html[data-theme="light"] .auth-mobile-menu {
  background:
    radial-gradient(circle at 12% 0%, rgba(71, 120, 255, 0.08), transparent 18rem),
    radial-gradient(circle at 88% 0%, rgba(143, 108, 255, 0.08), transparent 18rem),
    var(--surface);
}

html[dir="rtl"] .auth-mobile-menu {
  direction: rtl;
}

@media (max-width: 760px) {
  .auth-desktop-actions {
    display: none !important;
  }

  .auth-menu-toggle {
    display: inline-flex;
  }

  .auth-header-actions {
    flex-wrap: nowrap;
  }

  .auth-nav {
    min-height: var(--header-h);
  }

  .auth-site-header .brand span {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .auth-mobile-menu {
    width: min(100% - 20px, 1120px);
  }

  .auth-site-header .brand span {
    max-width: 118px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-menu-toggle,
  .auth-menu-toggle span,
  .auth-mobile-menu,
  .auth-mobile-menu-item {
    transition: none;
  }
}