/* The one login form (site/auth/login.html + site/js/login.js). Uses the site's own tokens. */
.lg-card {
  --lg-h: 56px;
  --lg-r: 14px;
  --lg-field: color-mix(in srgb, var(--panel) 92%, transparent);
  --lg-focus: color-mix(in srgb, var(--accent) 22%, transparent);
  --lg-on-accent: #fff;
  position: relative; width: min(440px, 100%); padding: 22px 30px 28px;
  border-radius: 26px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
[data-theme="dark"] .lg-card { --lg-on-accent: #140c3a; }
.lg-head { display: flex; align-items: center; justify-content: space-between; min-height: 36px; margin-bottom: 10px; }
.lg-mark { margin-inline-start: auto; font-family: var(--font-glyph); font-size: 22px; color: var(--accent); }
.lg-back {
  width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .15s, color .15s;
}
.lg-back:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink); }
.lg-back svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.lg-card .pending-chip { margin-bottom: 18px; }
.lg-title { margin: 0 0 6px; font-size: 24px; line-height: 1.45; }
.lg-lead { margin: 0 0 20px; color: var(--muted); font-size: 14.5px; line-height: 1.8; }
.lg-lead bdi { color: var(--ink); font-weight: 600; }
.lg-lead .lg-edit { margin-inline-start: 6px; }
.lg-step[hidden] { display: none !important; }

/* ---------- the field: phone / email / any / code live in one cell ---------- */
.lg-field { display: grid; }
.lg-field > * { grid-area: 1 / 1; transition: opacity .22s ease, transform .28s cubic-bezier(.2,.8,.2,1); }
.lg-field > .is-parked { opacity: 0; transform: translateY(6px) scale(.985); pointer-events: none; }
.lg-input {
  width: 100%; height: var(--lg-h); padding: 0 16px; border: 1.5px solid var(--line); border-radius: var(--lg-r);
  background: var(--lg-field); color: var(--ink); font: inherit; font-size: 17px; letter-spacing: .02em;
  outline: none; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.lg-input:placeholder-shown { direction: rtl; text-align: right; letter-spacing: 0; font-size: 15.5px; }
.lg-input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); opacity: 1; }
.lg-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--lg-focus); }
.lg-input.is-invalid, .lg-otp.is-invalid .lg-slots i { border-color: var(--bad); }
.lg-solo { margin-bottom: 12px; }

/* Code: one real input (so SMS autofill and paste just work) drawn as separate slots. */
.lg-otp { position: relative; height: var(--lg-h); direction: ltr; }
.lg-otp-input {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; padding: 0; border: 0; outline: none;
  background: transparent; color: transparent; caret-color: transparent; font-size: 16px; letter-spacing: 2em;
  -webkit-text-fill-color: transparent; cursor: text;
}
.lg-otp-input::selection { background: transparent; }
.lg-slots { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); gap: 10px; }
.lg-slots i {
  display: grid; place-items: center; font-style: normal; font-size: 25px; font-weight: 700;
  font-variant-numeric: tabular-nums; border: 1.5px solid var(--line); border-radius: var(--lg-r);
  background: var(--lg-field); color: var(--ink); transition: border-color .15s, box-shadow .15s, background .2s, color .2s;
}
.lg-otp.is-focus .lg-slots i.on { border-color: var(--accent); box-shadow: 0 0 0 4px var(--lg-focus); }
.lg-otp.is-focus .lg-slots i.on:empty::after {
  content: ""; width: 2px; height: 26px; border-radius: 2px; background: var(--accent); animation: lgBlink 1s steps(2) infinite;
}
.lg-slots i.filled { border-color: color-mix(in srgb, var(--muted) 70%, transparent); }
.lg-otp.is-ok .lg-slots i { border-color: var(--ok); color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.lg-otp.is-busy .lg-slots i { opacity: .6; }

/* ---------- password fields ---------- */
.lg-pw { position: relative; }
.lg-pw .lg-input { padding-left: 84px; }
.lg-pw + .lg-pw, .lg-reqs + .lg-pw { margin-top: 12px; }
.lg-eye {
  position: absolute; top: 50%; left: 6px; transform: translateY(-50%); width: 42px; height: 42px;
  display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer;
}
.lg-eye:hover { color: var(--ink); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.lg-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lg-eye[aria-pressed="true"] svg { stroke: var(--accent); }
.lg-tick {
  position: absolute; top: 50%; left: 50px; width: 24px; height: 24px; margin-top: -12px; border-radius: 50%;
  display: grid; place-items: center; background: var(--ok); color: #fff; transform: scale(0); opacity: 0;
  transition: transform .25s cubic-bezier(.3,1.6,.5,1), opacity .2s;
}
.lg-tick svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.lg-tick.on { transform: scale(1); opacity: 1; }
.lg-reqs { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 9px 2px 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.lg-reqs li::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 6px; border-radius: 50%; background: currentColor; vertical-align: middle; transition: background .2s; }
.lg-reqs li.ok { color: var(--ok); }
.lg-account { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: 13px; color: var(--muted); }
.lg-account input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font: inherit; font-size: 14.5px; font-weight: 600; text-align: left; outline: none; }

/* ---------- messages ---------- */
.lg-msg { min-height: 0; margin-top: 10px; font-size: 13.5px; line-height: 1.7; }
.lg-msg:empty { display: none; }
.lg-msg.error { color: var(--bad); }
.lg-msg.ok { color: var(--ok); }
.lg-msg.info { color: var(--muted); }
.lg-dev { margin-top: 10px; padding: 8px 12px; border-radius: 10px; border: 1px dashed var(--gold); font-size: 12.5px; color: var(--muted); }
.lg-dev button { margin-inline-start: 8px; border: 0; background: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
/* The code did not fill itself: «چسباندن کد از پیامک» (hidden until it is needed). */

/* ---------- buttons ---------- */
.lg-btn {
  position: relative; width: 100%; height: 54px; margin-top: 16px; display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: var(--lg-r); background: var(--accent); color: var(--lg-on-accent);
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; transition: background .15s, transform .1s, opacity .15s;
}
.lg-btn:hover { background: var(--accent-soft); }
.lg-btn:active { transform: scale(.99); }
.lg-btn:focus-visible, .lg-resend:focus-visible, .lg-alt:focus-visible, .lg-link-quiet:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--lg-focus); }
.lg-btn:disabled { opacity: .6; cursor: progress; }
.lg-spin { position: absolute; width: 20px; height: 20px; border: 2.5px solid currentColor; border-top-color: transparent; border-radius: 50%; opacity: 0; animation: lgSpin .7s linear infinite; }
.lg-btn.is-loading .lg-btn-label { opacity: 0; }
.lg-btn.is-loading .lg-spin { opacity: 1; }

.lg-resend {
  width: 100%; height: 48px; margin-top: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--accent); border-radius: var(--lg-r); background: transparent; color: var(--accent);
  font: inherit; font-size: 14.5px; font-weight: 600; cursor: pointer; transition: color .25s, border-color .25s, background .25s;
}
.lg-resend:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.lg-resend:disabled { border-color: var(--line); color: var(--muted); background: color-mix(in srgb, var(--muted) 7%, transparent); cursor: default; }
.lg-resend time { font-variant-numeric: tabular-nums; font-weight: 700; }
.lg-resend time:empty { display: none; }
.lg-ring { width: 18px; height: 18px; transform: rotate(-90deg); flex: none; }
.lg-ring circle { fill: none; stroke-width: 2.5; }
.lg-ring .trk { stroke: var(--line); }
.lg-ring .bar { stroke: var(--muted); stroke-linecap: round; transition: stroke-dashoffset .25s linear; }
.lg-resend:not(:disabled) .lg-ring { display: none; }

.lg-alt {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%; margin-top: 12px; padding: 10px;
  border: 0; border-radius: 12px; background: transparent; color: var(--accent); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.lg-alt:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.lg-alt svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lg-alt[hidden] { display: none; }
/* «ورود با ایمیل»: there for whoever looks for it, quiet for everyone else. */
.lg-quiet { margin: 22px 0 0; padding-top: 14px; border-top: 1px dashed var(--line); text-align: center; }
.lg-quiet:not(:has(> button:not([hidden]))) { display: none; }
.lg-link-quiet { border: 0; padding: 2px 6px; border-radius: 6px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; opacity: .85; }
.lg-link-quiet:hover { color: var(--accent); opacity: 1; text-decoration: underline; }
.lg-link-quiet[hidden] { display: none; }
.lg-edit { border: 0; padding: 0; background: none; color: var(--accent); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.lg-edit:hover { text-decoration: underline; }
.lg-legal { max-width: 360px; margin: 16px auto 0; text-align: center; font-size: 12.5px; color: var(--muted); }

.lg-step.is-entering { animation: lgIn .32s cubic-bezier(.2,.8,.2,1); }
.lg-shake { animation: lgShake .4s ease; }
@keyframes lgIn { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }
@keyframes lgShake { 0%, 100% { transform: none; } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
@keyframes lgSpin { to { transform: rotate(360deg); } }
@keyframes lgBlink { 50% { opacity: 0; } }
@media (max-width: 480px) {
  .lg-card { padding: 16px 18px 22px; border-radius: 22px; }
  .lg-title { font-size: 21px; }
  .lg-slots { gap: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .lg-field > *, .lg-step.is-entering, .lg-shake, .lg-tick { animation: none !important; transition: none !important; }
}

/* ---------- progress header (as in the sample: method + step, thin bars) ---------- */
.lg-head { gap: 12px; margin-bottom: 18px; }
.lg-progress { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.lg-progress-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }
.lg-method { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.lg-method svg { width: 15px; height: 15px; fill: none; stroke: var(--accent); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.lg-track { display: grid; grid-template-columns: repeat(var(--steps, 2), 1fr); gap: 6px; }
.lg-track i { position: relative; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.lg-track i.gone { display: none; }
.lg-track i::after { content: ""; position: absolute; inset: 0; background: var(--accent); transform: scaleX(0); transform-origin: right; transition: transform .45s cubic-bezier(.2,.8,.2,1), background .3s; }
.lg-track i.on::after { transform: scaleX(1); }
.lg-progress.done .lg-track i::after { background: var(--ok); }

/* ---------- label + phone with a +98 box ---------- */
.lg-label { display: block; margin: 0 2px 8px; font-size: 13.5px; font-weight: 600; color: var(--ink); }
.lg-label[hidden] { display: none; }
.lg-phone {
  display: flex; direction: ltr; height: var(--lg-h); border: 1.5px solid var(--line); border-radius: var(--lg-r);
  background: var(--lg-field); transition: border-color .15s, box-shadow .15s, opacity .22s ease, transform .28s cubic-bezier(.2,.8,.2,1);
}
.lg-phone:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--lg-focus); }
.lg-phone.is-invalid { border-color: var(--bad); }
.lg-cc {
  flex: none; display: flex; align-items: center; gap: 7px; padding: 0 12px; border-right: 1px solid var(--line);
  font-size: 16px; font-weight: 700; color: var(--ink); direction: ltr;
}
.lg-cc-iso { padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.lg-phone .lg-input { flex: 1; min-width: 0; height: 100%; border: 0; border-radius: 0; background: transparent; box-shadow: none !important; font-size: 18px; letter-spacing: .04em; }
.lg-phone .lg-input:placeholder-shown { direction: ltr; text-align: left; font-size: 18px; letter-spacing: .04em; }

/* ---------- messages with an icon ---------- */
.lg-msg { display: flex; align-items: flex-start; gap: 8px; }
.lg-msg svg { flex: none; width: 17px; height: 17px; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- signed in ---------- */
.lg-done { text-align: center; padding: 6px 0 4px; }
.lg-check { display: block; width: 78px; height: 78px; margin: 0 auto 14px; }
.lg-check circle { fill: color-mix(in srgb, var(--ok) 12%, transparent); stroke: var(--ok); stroke-width: 3; stroke-dasharray: 208; stroke-dashoffset: 208; animation: lgDraw .6s cubic-bezier(.2,.8,.2,1) forwards; }
.lg-check path { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 44; stroke-dashoffset: 44; animation: lgDraw .35s .45s cubic-bezier(.2,.8,.2,1) forwards; }
.lg-loadbar { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.lg-loadbar span { display: block; height: 100%; width: 0; background: var(--ok); animation: lgGrow 1.2s linear forwards; }
@keyframes lgDraw { to { stroke-dashoffset: 0; } }
@keyframes lgGrow { to { width: 100%; } }

/* No slide-in on first paint, only for later changes. */
.lg-card:not(.is-ready) .lg-field > *, .lg-card:not(.is-ready) .lg-track i::after { transition: none; }

/* Phones: the keyboard takes the lower half of the screen; keep the first step short so the button stays
   above it (login.js also scrolls it into the part the keyboard leaves free). */
@media (max-width: 480px) {
  .auth-wrap:has(.lg-card) { padding-top: 10px; }
  .lg-head { margin-bottom: 12px; }
  .lg-lead { margin-bottom: 14px; font-size: 14px; line-height: 1.75; }
  .lg-btn { margin-top: 12px; }
}
