/* ───────────── ورود و ثبت‌نام — همان Design System صفحه Home ───────────── */
[hidden] { display: none !important; }

.auth {
  max-width: 390px;
  margin: 0 auto;
  padding: 0 8px 40px;             /* + حاشیه ۸px صفحه = فاصله ۱۶px از لبه‌ها (calc(100% - 32px)) */
}

.auth-back-row {
  display: flex;
  justify-content: flex-end;       /* RTL: سمت چپ (مطابق طراحی) */
  height: 44px;
  margin-top: 12px;
}
.auth-back {
  width: 44px;
  height: 44px;
  margin-inline-end: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--black);
}
.auth-back:active { opacity: .6; }

.auth-title {
  margin-top: 14px;
  font: 700 24px/34px var(--font);
  color: var(--navy);
  text-align: center;
}
.auth-desc {
  margin-top: 8px;
  font: 400 14px/24px var(--font);
  color: var(--gray);
  text-align: center;
}
.otp-mobile {
  display: inline-block;
  font-weight: 600;
  color: var(--navy);
  unicode-bidi: isolate;
}

.auth-form { margin-top: 28px; }

/* فیلدها */
.field {
  display: block;
  position: relative;
  height: 56px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: text;
}
.field:focus-within { border-color: var(--green); }
.field.is-error { border-color: var(--badge-red); }
.field-error {
  min-height: 20px;                 /* جای پیام همیشه رزرو است تا Layout نپرد */
  margin: 6px 4px 6px;
  font: 500 12px/20px var(--font);
  color: var(--badge-red);
}
.field-error--center { text-align: center; }

.phone-field {
  display: flex;
  align-items: center;
  direction: ltr;
  padding: 0 16px;
}
.phone-field__prefix {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding-right: 14px;
  margin-right: 14px;
  border-right: 1px solid var(--border);
  font: 600 16px/1 var(--font);
  color: var(--green);
}
.phone-field__input,
.name-field__input {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--black);
  font: 500 16px/24px var(--font);  /* ≥ 16px تا iOS هنگام فوکوس Zoom نکند */
  -webkit-appearance: none;
  appearance: none;
}
.phone-field__input { flex: 1; text-align: left; }
.phone-field__input::placeholder,
.name-field__input::placeholder { color: #B4B7C2; opacity: 1; font-weight: 400; }

.name-field { margin-top: 16px; }
.name-field:first-child { margin-top: 0; }
.name-field__label {
  position: absolute;
  top: 7px;
  right: 16px;
  font: 400 12px/16px var(--font);
  color: var(--gray);
  pointer-events: none;
}
.name-field__input {
  height: 100%;
  padding: 22px 16px 6px 52px;
  text-align: right;
}
.name-field__icon {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: var(--gray);
  pointer-events: none;
}

/* دکمه اصلی */
.btn-primary {
  position: relative;
  width: 100%;
  height: 52px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 10px;
  background: var(--green);
  color: var(--white);
  font: 600 15px/1 var(--font);
}
.btn-primary:active:not(:disabled) { background: var(--green-dark); }
.btn-primary:disabled { background: #C9DDD8; cursor: default; }
.btn-primary.is-loading:disabled { background: var(--green); opacity: .85; }
.btn-primary.is-loading::before {
  content: "";
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: auth-spin .7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* OTP */
.otp {
  display: flex;
  justify-content: center;
  gap: 8px;
  direction: ltr;
}
.otp__box {
  width: 48px;
  height: 52px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: 0;
  background: var(--white);
  color: var(--navy);
  caret-color: var(--green);
  font: 500 20px/1 var(--font);
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
}
.otp__box:focus { border-color: var(--green); }
.otp.is-error .otp__box { border-color: var(--badge-red); }

.otp-timer {
  height: 44px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 400 14px/1 var(--font);
  color: var(--gray);
}
.otp-timer__time { font-weight: 700; color: var(--green); font-variant-numeric: tabular-nums; }

/* لینک‌های متنی (Hit Area ≥ 44px) */
.text-link {
  color: var(--green);
  font: 600 14px/1 var(--font);
  cursor: pointer;
}
.text-link--block {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
}
.text-link:disabled { opacity: .5; cursor: default; }
.text-link.is-loading { opacity: .6; }
.text-link:active { opacity: .7; }

.auth-terms {
  margin-top: 16px;
  font: 400 13px/26px var(--font);
  color: var(--gray);
  text-align: center;
}
.auth-terms .text-link { display: inline; padding: 9px 2px; font-size: 13px; }   /* ظاهر خطی؛ ناحیه لمس بزرگ‌تر */

/* Toast موفقیت */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--bar-h) + var(--bar-gap) * 2 + 8px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 20;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--navy);
  color: var(--white);
  font: 600 12px/1.6 var(--font);
  white-space: nowrap;
  pointer-events: none;
}
