.auth-stage {
    min-height: calc(100dvh - 8rem);
    display: grid;
    place-items: center;
    padding: 2.5rem 1rem 3.5rem;
}

.auth-card {
    position: relative;
    z-index: 2;
    width: min(100%, 28rem);
    border-radius: 1.6rem;
    padding: 1.6rem 1.45rem 1.45rem;
    background: var(--glass-strong);
}

.auth-card-wide { width: min(100%, 34rem); }

.auth-form .role-grid { margin-top: 0.35rem; }
.auth-form .role-card.is-selected,
.auth-form .role-card:has(input:checked) {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 8%, var(--input-bg, #fff));
    box-shadow: 0 0 0 3px var(--accent-soft);
}

@media (max-width: 640px) {
    .auth-stage { padding: 1.5rem 0.75rem 5.5rem; }
    .auth-form .role-grid { grid-template-columns: 1fr; }
}

.auth-progress {
    width: fit-content;
    margin: 0.1rem auto 1.15rem;
    display: flex;
    align-items: center;
    gap: 0.28rem;
    list-style: none;
    padding: 0.32rem 0.38rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand) 9%, transparent);
}

.auth-progress li {
    height: 0.28rem;
    width: 0.72rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--brand) 28%, transparent);
    transition: width 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), background 0.35s ease;
}

.auth-progress li.is-done {
    background: color-mix(in srgb, var(--brand) 55%, white);
}

.auth-progress li.is-current {
    width: 1.65rem;
    background: var(--brand);
}

.auth-title {
    margin: 0 0 0.4rem;
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.02em;
    text-align: center;
}

.auth-sub {
    color: var(--ink-muted);
    line-height: 1.9;
    margin: 0 0 0.35rem;
    font-size: 0.92rem;
    text-align: center;
}

.auth-sub strong {
    color: var(--ink);
    font-weight: 700;
}

.auth-phone,
.otp-box,
.auth-sub strong {
    font-family: "Vazirmatn FD", "Vazirmatn", sans-serif !important;
}

.auth-phone {
    direction: ltr;
    text-align: left;
    letter-spacing: 0.06em;
    font-size: 1.08rem;
    font-variant-numeric: tabular-nums;
}

.auth-submit {
    width: 100%;
    min-height: 3rem;
    margin-top: 1.15rem;
    font-size: 0.98rem;
}

.auth-submit:disabled {
    opacity: 0.7;
    cursor: progress;
    transform: none;
}

.auth-back {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    text-align: center;
}

.auth-feedback {
    margin: 0.75rem 0 0;
    font-size: 0.86rem;
    line-height: 1.7;
}

.auth-feedback.is-error { color: #dc2626; }
.auth-feedback.is-success { color: #15803d; }

.auth-name-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.auth-name-grid .field-label {
    margin-top: 0.55rem;
}

.otp-boxes {
    display: flex;
    justify-content: center;
    gap: 0.55rem;
    direction: ltr;
    margin-top: 1rem;
}

.otp-box {
    width: 2.85rem;
    height: 3.15rem;
    border-radius: 0.75rem;
    border: 2px solid var(--card-border);
    background: var(--input-bg);
    color: var(--ink);
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    outline: none;
    caret-color: var(--brand);
    transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, color 0.18s ease;
}

.otp-box:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.otp-box.is-success {
    border-color: #16a34a;
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.16);
}

.otp-box.is-error {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.14);
    animation: otp-shake 0.28s ease;
}

@keyframes otp-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

[data-theme="dark"] .otp-box.is-success {
    color: #86efac;
    background: rgba(22, 163, 74, 0.18);
}

[data-theme="dark"] .otp-box.is-error {
    color: #fca5a5;
    background: rgba(220, 38, 38, 0.18);
}

[data-theme="dark"] .auth-feedback.is-error { color: #fca5a5; }
[data-theme="dark"] .auth-feedback.is-success { color: #86efac; }

.auth-page .site-footer {
    margin-top: 4.5rem;
}

@media (max-width: 420px) {
    .auth-name-grid {
        grid-template-columns: 1fr;
    }

    .auth-card {
        padding-inline: 1.1rem;
    }
}
