:root {
  color-scheme: light;
  --auth-green: #087348;
  --auth-green-deep: #075c3b;
  --auth-ink: #19392b;
  --auth-muted: #718279;
  --auth-line: #dce9e1;
  --auth-danger: #a53d39;
  font-family: Vazirmatn, Tahoma, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body.auth-page {
  min-height: 100dvh;
  margin: 0;
  color: var(--auth-ink);
  background: #f6f8f7;
  font: 13px/1.8 Vazirmatn, Tahoma, sans-serif;
}

.auth-topbar {
  width: min(460px, calc(100% - 32px));
  min-height: calc(68px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--auth-green-deep);
  font-size: 15px;
  font-weight: 900;
  text-decoration: none;
}

.auth-brand img { width: 32px; height: 32px; object-fit: contain; }
.auth-top-link { min-height: 38px; display: inline-flex; align-items: center; color: var(--auth-green); font-size: 11px; font-weight: 900; text-decoration: underline; text-underline-offset: 4px; }
.auth-top-link:hover { color: var(--auth-green); text-decoration: underline; text-underline-offset: 4px; }

.auth-layout {
  width: min(460px, calc(100% - 32px));
  min-height: calc(100dvh - 68px - env(safe-area-inset-top));
  margin: 0 auto;
  display: grid;
  align-content: center;
  padding: 0 0 34px;
}

.auth-card {
  min-width: 0;
  padding: clamp(22px, 5vw, 34px);
  border: 1px solid #e2eae5;
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 12px 38px #183b290d;
}

.auth-card-heading { margin-bottom: 20px; }
.is-code-step .auth-card-heading { margin-bottom: 12px; }
.auth-eyebrow { display: block; margin-bottom: 3px; color: var(--auth-green); font-size: 10px; font-weight: 800; }
.auth-card h1 { margin: 0; color: var(--auth-ink); font-size: 21px; line-height: 1.65; }
.auth-card-heading p { margin: 4px 0 0; color: var(--auth-muted); font-size: 11px; line-height: 1.9; }
[data-auth-root].is-code-step .auth-card-heading p { display: none; }

.auth-progress { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 20px; }
.auth-progress-step { min-height: 32px; display: flex; align-items: center; gap: 7px; color: #8a968f; font-size: 10px; font-weight: 700; }
.auth-progress-step span { width: 21px; height: 21px; display: grid; place-items: center; flex: none; border-radius: 50%; color: #77867c; background: #edf1ee; font-size: 10px; }
.auth-progress-step.is-current, .auth-progress-step.is-done { color: var(--auth-green-deep); }
.auth-progress-step.is-current span, .auth-progress-step.is-done span { color: #fff; background: var(--auth-green); }

.auth-step-title { margin: 0 0 3px; color: var(--auth-ink); font-size: 14px; font-weight: 900; }
.auth-step-description { margin: 0 0 14px; color: var(--auth-muted); font-size: 11px; line-height: 1.9; }
.auth-field { display: grid; gap: 6px; margin-top: 12px; }
.auth-field label { color: #3e5b4b; font-size: 11px; font-weight: 800; }

.auth-phone-input {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  border: 1px solid #d6e4da;
  border-radius: 11px;
  outline: none;
  color: var(--auth-ink);
  background: #fff;
  direction: ltr;
  text-align: right;
  font: 700 15px/1.2 Vazirmatn, Tahoma, sans-serif;
  letter-spacing: .02em;
}
.auth-phone-input::placeholder { color: #a4b0a9; font-weight: 500; }
.auth-phone-input:focus { border-color: #70ad87; box-shadow: 0 0 0 3px #e4f1e8; }
.auth-phone-input[aria-invalid="true"] { border-color: #cf7770; background: #fff8f7; box-shadow: 0 0 0 3px #fff0ef; }

.auth-button {
  width: 100%;
  min-height: 47px;
  margin-top: 14px;
  padding: 0 15px;
  border: 0;
  border-radius: 11px;
  color: #fff;
  background: var(--auth-green);
  font: 800 12px Vazirmatn, Tahoma, sans-serif;
  cursor: pointer;
  transition: background .18s ease;
}
.auth-button:hover:not(:disabled) { background: #06623d; }
.auth-button:disabled { opacity: .62; cursor: wait; }
.auth-button:focus-visible, .auth-top-link:focus-visible, .auth-edit-phone:focus-visible, .auth-resend:focus-visible { outline: 3px solid #a4ceb1; outline-offset: 3px; }

.auth-code-heading { margin-bottom: 10px; }
.auth-edit-phone { display: inline-flex; min-height: 36px; align-items: center; gap: 6px; margin: 0 0 9px; padding: 0 3px; border: 0; color: var(--auth-green); background: transparent; font: 800 10px Vazirmatn, Tahoma, sans-serif; cursor: pointer; }
.auth-edit-phone:hover { color: #064c32; text-decoration: underline; text-underline-offset: 4px; }
.auth-edit-phone span { font-size: 14px; line-height: 1; }
.auth-otp-label { display: block; margin-bottom: 8px; color: #3e5b4b; font-size: 10px; font-weight: 800; }
.auth-otp-fields { width: min(100%, 280px); margin: 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(7px, 2vw, 12px); direction: ltr; }
.auth-otp-digit { width: 100%; aspect-ratio: 1; min-width: 0; padding: 0; border: 1px solid #d5e4da; border-radius: 10px; outline: none; color: var(--auth-green-deep); background: #f8fbf9; direction: ltr; text-align: center; font: 800 clamp(18px, 5vw, 24px)/1 Vazirmatn, Tahoma, sans-serif; caret-color: var(--auth-green); }
.auth-otp-digit:focus { border-color: #56a678; background: #fff; box-shadow: 0 0 0 3px #e0f0e5; }
.auth-otp-digit[aria-invalid="true"] { border-color: #cf7770; background: #fff8f7; }
.auth-resend-row { min-height: 30px; margin-top: 13px; display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; color: var(--auth-muted); font-size: 10px; }
.auth-resend { min-height: 32px; padding: 3px 4px; border: 0; color: var(--auth-green); background: transparent; font: 800 10px Vazirmatn, Tahoma, sans-serif; cursor: pointer; }
.auth-resend:disabled { color: #8a9990; cursor: default; }
.auth-timer { min-width: 35px; color: #74867b; direction: ltr; unicode-bidi: isolate; font-size: 10px; font-weight: 800; }

.auth-message { margin: 12px 0 0; padding: 8px 10px; border: 1px solid #d4eadd; border-radius: 9px; color: #236442; background: #f0f8f2; font-size: 10px; line-height: 1.8; }
.auth-message.is-error { border-color: #f0d5d1; color: var(--auth-danger); background: #fff4f2; }
.auth-legal { margin: 16px 0 0; color: #829087; text-align: center; font-size: 9px; line-height: 1.9; }
.auth-legal a { color: var(--auth-green); font-weight: 700; text-underline-offset: 3px; }
.auth-role-path { display: flex; min-height: 40px; align-items: center; justify-content: center; margin-top: 12px; color: var(--auth-green); text-align: center; font-size: 14px; font-weight: 900; text-decoration: underline; text-underline-offset: 4px; }
.auth-role-path:hover { text-decoration: underline; text-underline-offset: 4px; }

@media (max-width: 420px) {
  .auth-topbar { min-height: calc(58px + env(safe-area-inset-top)); }
  .auth-layout { min-height: calc(100dvh - 58px - env(safe-area-inset-top)); padding-bottom: 20px; }
  .auth-card { padding: 21px 18px; border-radius: 17px; }
  .auth-card h1 { font-size: 19px; }
  .auth-otp-fields { gap: 5px; }
  .auth-otp-digit { border-radius: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
