@font-face {
  font-family: "LocalNazanin";
  src: local("B Nazanin"), local("BNazanin"), local("Nazanin");
  font-display: swap;
}

:root {
  --font-main: "LocalNazanin", "B Nazanin", "Nazanin", Tahoma, serif;
  --red-950: #641017;
  --red-900: #7f111a;
  --red-800: #991b1b;
  --red-700: #bd1f25;
  --red-50: #fff1f2;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --text: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --success: #047857;
  --success-bg: #ecfdf5;
  --shadow: 0 24px 70px rgba(15, 23, 42, .12);
  --shadow-red: 0 18px 38px rgba(189,31,37,.20);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  direction: rtl;
  font-family: var(--font-main);
  font-size: 18px;
  line-height: 1.8;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 0%, rgba(220, 38, 38, .10), transparent 34%),
    linear-gradient(135deg, #fff 0%, #fff7f7 44%, var(--bg) 100%);
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.account-shell {
  width: min(1120px, calc(100% - 28px));
  min-height: 100vh;
  margin-inline: auto;
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(380px, 540px);
  gap: 26px;
  align-items: center;
  padding: 24px 0;
}

.account-topbar {
  position: fixed;
  z-index: 40;
  top: 16px;
  right: 16px;
  left: 16px;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.account-topbar > * {
  pointer-events: auto;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid rgba(229,231,235,.88);
  background: rgba(255,255,255,.90);
  backdrop-filter: blur(14px);
  border-radius: 999px;
  padding: 7px 13px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--red-700), var(--red-950));
  font-weight: 900;
}

.brand-link strong {
  color: var(--text);
  font-size: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.theme-toggle,
.back-link {
  min-height: 42px;
  border: 1px solid rgba(229,231,235,.88);
  background: rgba(255,255,255,.92);
  color: var(--text);
  backdrop-filter: blur(14px);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 13px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .07);
}

.theme-toggle {
  min-width: 86px;
}

.side-panel {
  min-height: 630px;
  border-radius: 36px;
  background:
    radial-gradient(circle at 20% 18%, rgba(255,255,255,.16), transparent 26%),
    linear-gradient(135deg, var(--red-950), var(--red-700));
  color: #fff;
  box-shadow: var(--shadow-red);
  padding: clamp(28px, 4vw, 54px);
  display: grid;
  align-content: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.side-panel::before,
.side-panel::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(255,255,255,.10);
}

.side-panel::before {
  width: 360px;
  height: 360px;
  left: -120px;
  bottom: -120px;
}

.side-panel::after {
  width: 220px;
  height: 220px;
  right: -60px;
  top: -60px;
}

.side-panel > * {
  position: relative;
  z-index: 1;
}

.side-badge {
  width: fit-content;
  border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  padding: 5px 13px;
  font-weight: 900;
}

.side-panel h1 {
  margin: 0;
  font-size: clamp(42px, 6vw, 68px);
  line-height: 1.16;
  letter-spacing: -.04em;
}

.side-panel p {
  margin: 0;
  color: rgba(255,255,255,.82);
  font-size: 21px;
}

.side-features {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.side-features span {
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.10);
  border-radius: 18px;
  padding: 10px 13px;
}

.form-card {
  width: 100%;
  border: 1px solid rgba(229,231,235,.92);
  background: rgba(255,255,255,.96);
  border-radius: 34px;
  box-shadow: var(--shadow);
  padding: clamp(22px, 4vw, 38px);
}

.form-head {
  text-align: center;
  margin-bottom: 24px;
}

.form-head .pill {
  display: inline-flex;
  width: fit-content;
  border: 1px solid rgba(189,31,37,.16);
  background: var(--red-50);
  color: var(--red-800);
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 900;
  margin-bottom: 12px;
}

.form-head h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(38px, 6vw, 58px);
  line-height: 1.16;
  letter-spacing: -.04em;
}

.form-head p {
  margin: 12px auto 0;
  max-width: 420px;
  color: var(--muted);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.step {
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 900;
}

.step span {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f3f4f6;
  font-size: 13px;
}

.step.is-active {
  color: var(--red-800);
  border-color: rgba(189,31,37,.22);
  background: var(--red-50);
}

.step.is-active span {
  background: var(--red-700);
  color: #fff;
}

.form-step {
  display: none;
}

.form-step.is-active {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field label {
  color: #1f2937;
  font-weight: 900;
}

.input-shell {
  min-height: 58px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 19px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  transition: .16s ease;
}

.input-shell.phone-shell {
  grid-template-columns: auto auto 1fr;
  direction: ltr;
}

.input-shell:focus-within {
  border-color: rgba(189,31,37,.42);
  box-shadow: 0 0 0 4px rgba(189,31,37,.08);
}

.input-icon {
  color: var(--red-800);
  font-size: 20px;
}

.phone-prefix {
  direction: ltr;
  color: var(--red-800);
  font-weight: 900;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.input-shell input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  direction: rtl;
}

.phone-shell input {
  direction: ltr;
  text-align: left;
  letter-spacing: .05em;
}

.field small {
  color: var(--muted);
  font-size: 14px;
}

.privacy-consent-card {
  border: 1px solid rgba(189,31,37,.16);
  background: linear-gradient(135deg, #fff, var(--red-50));
  border-radius: 22px;
  padding: 12px;
}

.privacy-check {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  cursor: pointer;
}

.privacy-copy strong,
.privacy-copy small {
  display: block;
}

.privacy-copy strong {
  color: var(--red-800);
  font-size: 18px;
}

.privacy-copy small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.privacy-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.custom-check {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(189,31,37,.25);
  background: #fff;
  color: transparent;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 22px;
  transition: .16s ease;
}

.privacy-check input:checked + .custom-check {
  background: var(--red-700);
  color: #fff;
  border-color: var(--red-700);
  box-shadow: 0 12px 24px rgba(189,31,37,.24);
}

.primary-action,
.secondary-action {
  min-height: 56px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  font-weight: 900;
  text-align: center;
}

.primary-action {
  background: var(--red-700);
  color: #fff;
  box-shadow: 0 16px 34px rgba(189,31,37,.24);
}

.secondary-action {
  background: #fff;
  color: var(--red-800);
  border: 1px solid rgba(189,31,37,.20);
}

.primary-action:hover {
  background: var(--red-800);
}

.form-footer {
  display: flex;
  justify-content: center;
  gap: 6px;
  color: var(--muted);
  font-size: 15px;
}

.form-footer a {
  color: var(--red-800);
  font-weight: 900;
}

.otp-boxes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  direction: ltr;
}

.otp-boxes input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 16px;
  text-align: center;
  font-size: 26px;
  outline: 0;
}

.success-card {
  border: 1px solid rgba(4,120,87,.16);
  background: var(--success-bg);
  color: #065f46;
  border-radius: 22px;
  padding: 16px;
  text-align: center;
}

.success-card strong {
  display: block;
  font-size: 22px;
}

.message {
  min-height: 24px;
  color: var(--red-800);
  text-align: center;
  font-weight: 900;
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="dark"] body {
  --bg: #0b1220;
  --surface: #121a2a;
  --surface-2: #172033;
  --text: #f8fafc;
  --muted: #aab4c5;
  --line: rgba(148,163,184,.24);
  background:
    radial-gradient(circle at 12% 0%, rgba(220, 38, 38, .16), transparent 34%),
    linear-gradient(135deg, #0b1220 0%, #111827 55%, #0f172a 100%);
  color: var(--text);
}

html[data-theme="dark"] .brand-link,
html[data-theme="dark"] .theme-toggle,
html[data-theme="dark"] .back-link,
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .input-shell,
html[data-theme="dark"] .step,
html[data-theme="dark"] .secondary-action,
html[data-theme="dark"] .otp-boxes input {
  background: rgba(18,26,42,.96);
  border-color: var(--line);
  color: var(--text);
}

html[data-theme="dark"] .form-head h2,
html[data-theme="dark"] .brand-link strong,
html[data-theme="dark"] .field label {
  color: var(--text);
}

html[data-theme="dark"] .form-head p,
html[data-theme="dark"] .field small,
html[data-theme="dark"] .form-footer,
html[data-theme="dark"] .privacy-copy small {
  color: var(--muted);
}

html[data-theme="dark"] input {
  color: var(--text);
}

html[data-theme="dark"] .privacy-consent-card {
  background: rgba(15,23,42,.72);
  border-color: rgba(248,113,113,.22);
}

html[data-theme="dark"] .privacy-copy strong,
html[data-theme="dark"] .form-footer a,
html[data-theme="dark"] .secondary-action,
html[data-theme="dark"] .back-link {
  color: #fecaca;
}

html[data-theme="dark"] .custom-check {
  background: rgba(18,26,42,.96);
  border-color: rgba(248,113,113,.28);
}

html[data-theme="dark"] .success-card {
  background: rgba(4,120,87,.16);
  border-color: rgba(52,211,153,.22);
  color: #bbf7d0;
}

@media (max-width: 920px) {
  .account-shell {
    grid-template-columns: 1fr;
    width: min(620px, calc(100% - 20px));
    padding: 76px 0 22px;
  }

  .side-panel {
    display: none;
  }

  .account-topbar {
    top: 10px;
    right: 10px;
    left: 10px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .form-card {
    border-radius: 26px;
    padding: 18px 14px;
  }

  .form-head h2 {
    font-size: 38px;
  }

  .stepper {
    gap: 6px;
  }

  .step {
    font-size: 13px;
  }

  .privacy-check {
    grid-template-columns: 1fr auto;
  }

  .theme-toggle .theme-text,
  .back-link span {
    display: none;
  }

  .theme-toggle,
  .back-link {
    min-width: 44px;
    width: 44px;
    padding: 0;
  }

  .brand-link strong {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}


/* Login OTP flow */
.login-step {
  display: none;
}

.login-step.is-active {
  display: grid;
  gap: 16px;
}

.otp-status-card {
  border: 1px solid rgba(189,31,37,.16);
  background: linear-gradient(135deg, #fff, var(--red-50));
  border-radius: 24px;
  padding: 16px;
  text-align: center;
  display: grid;
  gap: 5px;
}

.otp-status-card span {
  color: var(--muted);
  font-size: 15px;
}

.otp-status-card strong {
  direction: ltr;
  color: var(--red-800);
  font-size: 42px;
  line-height: 1.15;
  letter-spacing: .16em;
}

.otp-status-card small {
  color: var(--muted);
  font-size: 14px;
}

.login-otp-boxes input {
  transition: .16s ease;
}

.login-otp-boxes input:focus {
  border-color: rgba(189,31,37,.42);
  box-shadow: 0 0 0 4px rgba(189,31,37,.08);
}

html[data-theme="dark"] .otp-status-card {
  background: rgba(15,23,42,.72);
  border-color: rgba(248,113,113,.22);
}

html[data-theme="dark"] .otp-status-card strong {
  color: #fecaca;
}

html[data-theme="dark"] .otp-status-card span,
html[data-theme="dark"] .otp-status-card small {
  color: var(--muted);
}

@media (max-width: 560px) {
  .otp-status-card {
    border-radius: 20px;
    padding: 13px;
  }

  .otp-status-card strong {
    font-size: 34px;
  }
}



/* V25: 4-digit OTP polish */
.otp-status-card strong {
  letter-spacing: .20em;
}

.otp-boxes,
.login-otp-boxes {
  grid-template-columns: repeat(4, 1fr) !important;
}


/* V26: OTP code is no longer displayed publicly */
.otp-status-card {
  text-align: right;
}

.otp-status-card strong {
  display: none !important;
}

.otp-status-card span {
  font-weight: 900;
  color: var(--red-800);
}

.otp-status-card small {
  display: block;
  margin-top: 4px;
  font-weight: 800;
  color: var(--text);
}

html[data-theme="dark"] .otp-status-card span {
  color: #fecaca;
}

html[data-theme="dark"] .otp-status-card small {
  color: var(--text);
}


/* V27: correct left-to-right phone number typing and display */
.phone-shell {
  direction: ltr !important;
  unicode-bidi: isolate !important;
}

.phone-prefix {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  text-align: left !important;
}

.phone-shell input,
.ltr-input,
input[type="tel"] {
  direction: ltr !important;
  unicode-bidi: plaintext !important;
  text-align: left !important;
  font-family: Tahoma, Arial, sans-serif !important;
  letter-spacing: .04em;
}

.ltr-phone {
  direction: ltr !important;
  unicode-bidi: isolate !important;
  display: inline-flex;
  font-family: Tahoma, Arial, sans-serif !important;
  letter-spacing: .04em;
  color: var(--text);
  background: rgba(255,255,255,.66);
  border: 1px solid rgba(189,31,37,.12);
  border-radius: 999px;
  padding: 2px 10px;
  margin-top: 5px;
}

#loginSentPhone,
#sentPhoneText {
  display: block;
  text-align: center;
  line-height: 1.8;
}

html[data-theme="dark"] .ltr-phone {
  color: var(--text);
  background: rgba(15,23,42,.72);
  border-color: rgba(148,163,184,.24);
}


/* v39: authentication redirect notice */
.auth-redirect-notice {
  margin-bottom: 18px;
  border: 1px solid rgba(189, 31, 37, .16);
  border-radius: 16px;
  background: rgba(189, 31, 37, .07);
  color: var(--text, #2b1113);
  padding: 12px 14px;
  line-height: 1.9;
  font-size: 14px;
}
.auth-redirect-notice[hidden] { display: none !important; }
body.dark-mode .auth-redirect-notice {
  background: rgba(239, 68, 68, .12);
  border-color: rgba(248, 113, 113, .22);
  color: #fee2e2;
}
.admin-entry-link{display:block;text-align:center;margin-top:14px;color:#64748b;text-decoration:none;font-size:12px}.admin-entry-link:hover{color:#a71928}
