/* ============================================
   AUTH (ورود / تأیید کد پیامکی)
   هماهنگ با صفحه‌ی اصلی: کاغذی، مریم‌گلی، صورتی ملایم
   ============================================ */
:root {
  --ac-paper: #f6f2e9;
  --ac-paper-dark: #eae5d9;
  --ac-ink: #262820;
  --ac-muted: #74766b;
  --ac-sage: #b8c8a9;
  --ac-sage-soft: #e4ebdb;
  --ac-sage-dark: #657b59;
  --ac-pink: #eab5bd;
  --ac-pink-soft: #f9e4e6;
  --ac-rose: #9b2c3f;
  --ac-white: #fffdf8;
  --ac-line: rgba(38, 40, 32, .14);
  --ac-ease: cubic-bezier(.22, 1, .36, 1);
}

body:has(.ac-page) { background: var(--ac-paper); }

.ac-page {
  position: relative;
  min-height: calc(100vh - 3rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 0;
  isolation: isolate;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  color: var(--ac-ink);
}

/* دو حلقه‌ی هم‌مرکز، همان نشانه‌ی صفحه‌ی اصلی */
.ac-page::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 340px; height: 340px;
  top: 4%; left: -170px;
  border: 1px solid var(--ac-sage-dark);
  border-radius: 50%;
  opacity: .35;
  box-shadow: 0 0 0 34px rgba(184,200,169,.14), 0 0 0 68px rgba(184,200,169,.10);
}

.ac-card {
  width: 100%;
  max-width: 440px;
  padding: 40px 32px 32px;
  background: var(--ac-white);
  border: 1px solid var(--ac-line);
  border-radius: 32px;
  box-shadow: 0 20px 55px rgba(38, 40, 32, .09);
}

.ac-brand {
  width: 56px; height: 56px;
  display: grid; place-items: center;
  margin-bottom: 22px;
  border-radius: 18px;
  background: var(--ac-sage);
  color: var(--ac-ink);
}
.ac-brand svg { width: 30px; height: 30px; }

.ac-title {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -.02em;
}
.ac-sub {
  margin-top: 6px;
  font-size: 13px;
  line-height: 2.1;
  color: var(--ac-muted);
}
.ac-sub strong { color: var(--ac-ink); font-weight: 700; }
.ac-sub bdi { direction: ltr; unicode-bidi: isolate; }

.ac-link {
  color: var(--ac-sage-dark);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 1px;
}
.ac-link:hover { color: var(--ac-ink); }

/* پیام‌ها داخل کارت */
.ac-alerts { margin-top: 22px; display: grid; gap: 8px; }
.ac-alert {
  padding: 11px 14px;
  border-radius: 14px;
  font-size: 12.5px;
  line-height: 1.9;
  border: 1px solid transparent;
}
.ac-alert-success { background: var(--ac-sage-soft); border-color: rgba(101,123,89,.3); color: #2f4326; }
.ac-alert-info    { background: var(--ac-paper); border-color: var(--ac-line); color: var(--ac-ink); }
.ac-alert-error,
.ac-alert-danger  { background: var(--ac-pink-soft); border-color: rgba(155,44,63,.28); color: var(--ac-rose); }
.ac-alert-warning { background: #fbf1d8; border-color: rgba(146,100,14,.3); color: #6d4a07; }

.ac-form { margin-top: 26px; }

.ac-label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}
.ac-input {
  width: 100%;
  height: 58px;
  padding: 0 18px;
  direction: ltr;
  text-align: center;
  font: 600 20px/1 'Vazirmatn', Tahoma, sans-serif;
  letter-spacing: .08em;
  color: var(--ac-ink);
  background: var(--ac-paper);
  border: 1.5px solid var(--ac-line);
  border-radius: 18px;
  outline: none;
  transition: border-color .25s, box-shadow .25s, background .25s;
}
.ac-input::placeholder { color: #b3b3a6; font-weight: 400; letter-spacing: .06em; }
.ac-input:focus {
  background: var(--ac-white);
  border-color: var(--ac-sage-dark);
  box-shadow: 0 0 0 4px rgba(184, 200, 169, .45);
}
.ac-hint { display: block; margin-top: 10px; font-size: 11.5px; color: var(--ac-muted); line-height: 2; }

.ac-btn {
  width: 100%;
  min-height: 56px;
  margin-top: 22px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 0 24px;
  font: 700 14px/1 'Vazirmatn', Tahoma, sans-serif;
  color: #fff;
  background: var(--ac-ink);
  border: 1px solid var(--ac-ink);
  border-radius: 100px;
  cursor: pointer;
  transition: background .3s, color .3s, border-color .3s, transform .3s var(--ac-ease), box-shadow .3s;
}
.ac-btn:hover:not(:disabled) {
  background: var(--ac-sage);
  color: var(--ac-ink);
  border-color: var(--ac-sage);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(101, 123, 89, .2);
}
.ac-btn:disabled { opacity: .6; cursor: progress; }
.ac-btn:focus-visible, .ac-link:focus-visible, .ac-resend-btn:focus-visible {
  outline: 2px solid var(--ac-sage-dark);
  outline-offset: 4px;
}

/* ---------- کد ۶ رقمی ---------- */
.ac-otp {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  direction: ltr;
}
.ac-otp-box {
  width: 100%;
  aspect-ratio: 1 / 1.2;
  min-width: 0;
  padding: 0;
  text-align: center;
  font: 800 26px/1 'Vazirmatn', Tahoma, sans-serif;
  color: var(--ac-ink);
  background: var(--ac-paper);
  border: 1.5px solid var(--ac-line);
  border-radius: 16px;
  outline: none;
  caret-color: var(--ac-sage-dark);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.ac-otp-box:focus {
  background: var(--ac-white);
  border-color: var(--ac-sage-dark);
  box-shadow: 0 0 0 4px rgba(184, 200, 169, .45);
}
.ac-otp-box.is-filled { background: var(--ac-sage-soft); border-color: var(--ac-sage-dark); }
.ac-otp.is-error .ac-otp-box {
  background: var(--ac-pink-soft);
  border-color: var(--ac-rose);
  animation: ac-shake .45s var(--ac-ease);
}
@keyframes ac-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ---------- ارسال مجدد ---------- */
.ac-resend {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--ac-line);
  display: flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 72px;
  font-size: 12.5px;
  color: var(--ac-muted);
}
.ac-ring { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.ac-ring svg { width: 52px; height: 52px; transform: rotate(-90deg); }
.ac-ring circle { fill: none; stroke-width: 3; }
.ac-ring .track { stroke: var(--ac-paper-dark); }
.ac-ring .bar { stroke: var(--ac-sage-dark); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ac-ring span {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: var(--ac-ink);
  direction: ltr;
}
.ac-resend-btn {
  padding: 11px 22px;
  font: 700 13px/1 'Vazirmatn', Tahoma, sans-serif;
  color: var(--ac-ink);
  background: transparent;
  border: 1.5px solid var(--ac-ink);
  border-radius: 100px;
  cursor: pointer;
  transition: background .3s, color .3s;
}
.ac-resend-btn:hover { background: var(--ac-pink-soft); }
.ac-resend [hidden] { display: none !important; }

.ac-foot {
  margin-top: 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-size: 11.5px; color: var(--ac-muted);
}

.ac-seal img { width: 72px; height: auto; display: block; opacity: .95; }

@media (max-width: 480px) {
  .ac-card { padding: 32px 22px 26px; border-radius: 28px; }
  .ac-title { font-size: 23px; }
  .ac-otp { gap: 7px; }
  .ac-otp-box { font-size: 22px; border-radius: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .ac-ring .bar, .ac-btn, .ac-input, .ac-otp-box { transition: none; }
  .ac-otp.is-error .ac-otp-box { animation: none; }
}

/* حالت آزمایشی: نمایش کد روی صفحه (فقط وقتی پیامک فعال نیست) */
.ac-devcode {
  margin-top: 22px;
  padding: 12px 14px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  background: #fbf1d8;
  border: 1px dashed rgba(146, 100, 14, .5);
  border-radius: 14px;
  font-size: 12px;
  color: #6d4a07;
}
.ac-devcode strong { font-size: 20px; letter-spacing: .3em; font-family: monospace; }
.ac-devcode button {
  padding: 6px 12px;
  font: 600 12px/1 'Vazirmatn', Tahoma, sans-serif;
  color: #fff; background: #6d4a07;
  border: 0; border-radius: 100px; cursor: pointer;
}
