:root {
    --auth-ink: #152033;
    --auth-muted: #5b677a;
    --auth-line: #d7dee8;
    --auth-surface: rgba(255, 255, 255, 0.88);
    --auth-brand: #0f8fa3;
    --auth-brand-deep: #0b6f80;
    --auth-accent: #e11d48;
    --auth-success: #0f766e;
    --auth-danger: #be123c;
    --auth-radius: 22px;
    --auth-shadow: 0 24px 60px rgba(21, 32, 51, 0.12);
    --auth-font: 'IranYekan', 'IranSans', iranyekan, iransans, Tahoma, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    height: 100%;
}

body.auth-body {
    margin: 0;
    min-height: 100%;
    direction: rtl;
    font-family: var(--auth-font);
    color: var(--auth-ink);
    background:
        radial-gradient(circle at 12% 18%, rgba(15, 143, 163, 0.18), transparent 34%),
        radial-gradient(circle at 88% 12%, rgba(225, 29, 72, 0.12), transparent 28%),
        linear-gradient(160deg, #f4f7fb 0%, #eef5f7 42%, #f8fafc 100%);
    -webkit-font-smoothing: antialiased;
}

body.auth-body button,
body.auth-body input,
body.auth-body textarea,
body.auth-body select {
    font-family: inherit;
}

.auth-shell {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px 16px;
    overflow: hidden;
}

.auth-shell::before,
.auth-shell::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(2px);
    pointer-events: none;
    z-index: 0;
}

.auth-shell::before {
    width: 420px;
    height: 420px;
    top: -140px;
    left: -100px;
    background: rgba(15, 143, 163, 0.12);
    animation: auth-float 12s ease-in-out infinite;
}

.auth-shell::after {
    width: 320px;
    height: 320px;
    right: -80px;
    bottom: -90px;
    background: rgba(225, 29, 72, 0.08);
    animation: auth-float 14s ease-in-out infinite reverse;
}

.auth-panel {
    position: relative;
    z-index: 1;
    width: min(100%, 440px);
    background: var(--auth-surface);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: var(--auth-radius);
    box-shadow: var(--auth-shadow);
    padding: 36px 32px 28px;
    animation: auth-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    text-align: center;
    text-decoration: none;
    color: inherit;
}

.auth-brand img {
    width: min(180px, 58vw);
    height: auto;
    display: block;
    animation: auth-logo 0.7s ease both;
}

.auth-brand-title {
    margin: 0;
    font-size: clamp(1.35rem, 2.4vw, 1.7rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--auth-ink);
}

.auth-brand-sub {
    margin: 0;
    max-width: 28ch;
    font-size: 0.95rem;
    line-height: 1.8;
    color: var(--auth-muted);
    font-weight: 300;
}

.auth-alerts {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.auth-alert {
    border-radius: 14px;
    padding: 12px 14px;
    font-size: 0.9rem;
    line-height: 1.7;
}

.auth-alert-error {
    background: #fff1f2;
    color: var(--auth-danger);
    border: 1px solid #fecdd3;
}

.auth-alert-success {
    background: #f0fdfa;
    color: var(--auth-success);
    border: 1px solid #99f6e4;
}

.auth-form {
    display: grid;
    gap: 16px;
}

.auth-field {
    display: grid;
    gap: 8px;
}

.auth-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.auth-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--auth-ink);
}

.auth-link {
    color: var(--auth-brand);
    text-decoration: none;
    font-size: 0.84rem;
    border-bottom: 1px dashed rgba(15, 143, 163, 0.45);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-link:hover {
    color: var(--auth-brand-deep);
    border-color: var(--auth-brand-deep);
}

.auth-input-wrap {
    position: relative;
}

.auth-input-wrap svg {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #8a96a8;
    pointer-events: none;
}

.auth-input {
    width: 100%;
    height: 52px;
    border: 1px solid var(--auth-line);
    border-radius: 14px;
    background: #fff;
    padding: 0 44px 0 16px;
    font-size: 0.95rem;
    color: var(--auth-ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.auth-input::placeholder {
    color: #9aa6b5;
}

.auth-input:focus {
    border-color: rgba(15, 143, 163, 0.7);
    box-shadow: 0 0 0 4px rgba(15, 143, 163, 0.12);
}

.auth-input.is-invalid {
    border-color: #fda4af;
    box-shadow: 0 0 0 4px rgba(190, 18, 60, 0.08);
}

.auth-error {
    font-size: 0.82rem;
    color: var(--auth-danger);
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--auth-muted);
    font-size: 0.9rem;
    user-select: none;
}

.auth-remember input {
    width: 18px;
    height: 18px;
    accent-color: var(--auth-brand);
    cursor: pointer;
}

.auth-submit {
    width: 100%;
    height: 54px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--auth-brand) 0%, var(--auth-brand-deep) 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 14px 28px rgba(15, 143, 163, 0.28);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 34px rgba(15, 143, 163, 0.34);
    filter: brightness(1.03);
}

.auth-submit:active {
    transform: translateY(0);
}

.auth-submit svg {
    width: 18px;
    height: 18px;
}

.auth-footer {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid rgba(215, 222, 232, 0.9);
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.92rem;
    line-height: 1.9;
}

.auth-footer a {
    color: var(--auth-brand);
    font-weight: 700;
    text-decoration: none;
}

.auth-footer a:hover {
    color: var(--auth-brand-deep);
    text-decoration: underline;
}

.auth-legal {
    margin: 0;
    color: var(--auth-muted);
    font-size: 0.84rem;
    line-height: 1.9;
}

.auth-legal a {
    color: var(--auth-brand);
    text-decoration: none;
    border-bottom: 1px dashed rgba(15, 143, 163, 0.4);
}

@keyframes auth-rise {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes auth-logo {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes auth-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(18px); }
}

@media (max-width: 575.98px) {
    .auth-shell {
        padding: 18px 12px;
        align-items: stretch;
    }

    .auth-panel {
        width: 100%;
        min-height: calc(100vh - 36px);
        border-radius: 18px;
        padding: 28px 20px 22px;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .auth-brand {
        margin-bottom: 22px;
    }

    .auth-brand img {
        width: min(150px, 54vw);
    }

    .auth-input,
    .auth-submit {
        height: 50px;
    }
}

.auth-chip-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.auth-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 14px;
    border-radius: 999px;
    background: rgba(15, 143, 163, 0.1);
    color: var(--auth-brand-deep);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    direction: ltr;
    unicode-bidi: isolate;
}

.auth-identity {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 22px;
    padding: 16px 18px;
    border: 1px solid var(--auth-line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    text-align: center;
}

.auth-identity-inline {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 14px;
    border-radius: 999px;
}

.auth-identity-main {
    display: grid;
    gap: 6px;
    justify-items: center;
    min-width: 0;
}

.auth-identity-label {
    font-size: 0.78rem;
    color: var(--auth-muted);
    font-weight: 400;
}

.auth-phone {
    display: inline-block;
    direction: ltr;
    unicode-bidi: isolate;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--auth-ink);
    letter-spacing: 0.06em;
    font-variant-numeric: lining-nums tabular-nums;
}

.auth-identity-inline .auth-phone {
    font-size: 0.98rem;
    letter-spacing: 0.04em;
}

.auth-identity-sep {
    width: 1px;
    height: 16px;
    background: var(--auth-line);
}

.auth-identity-action {
    flex-shrink: 0;
    margin: 0;
}

.auth-field-footer {
    display: flex;
    justify-content: flex-start;
    margin-top: 4px;
}

.auth-panel-compact {
    padding: 28px 28px 22px;
}

.auth-brand-compact {
    gap: 10px;
    margin-bottom: 16px;
}

.auth-brand-compact img {
    width: min(140px, 46vw);
}

.auth-brand-compact .auth-brand-title {
    font-size: 1.25rem;
}

.auth-form-compact {
    gap: 12px;
}

.auth-divider-compact {
    margin: 14px 0 12px;
}

.auth-link-btn {
    border: 0;
    background: transparent;
    color: var(--auth-brand);
    font-size: 0.84rem;
    cursor: pointer;
    padding: 0;
    border-bottom: 1px dashed rgba(15, 143, 163, 0.45);
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
}

.auth-link-btn:hover,
.auth-link-btn:disabled {
    color: var(--auth-brand-deep);
}

.auth-link-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    border-bottom-color: transparent;
}

.auth-input-wrap-password .auth-input {
    padding-left: 72px;
}

.auth-toggle-password {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    border: 0;
    background: transparent;
    color: var(--auth-muted);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 6px;
    font-family: inherit;
}

.auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
    margin: 18px 0 14px;
    color: var(--auth-muted);
    font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    height: 1px;
    background: var(--auth-line);
}

.auth-submit-secondary {
    background: #fff;
    color: var(--auth-brand-deep);
    border: 1px solid rgba(15, 143, 163, 0.35);
    box-shadow: none;
}

.auth-submit-secondary:hover {
    filter: none;
    background: rgba(15, 143, 163, 0.06);
    box-shadow: none;
}

.auth-submit:disabled,
.auth-submit.is-loading {
    opacity: 0.72;
    cursor: wait;
    transform: none;
}

.auth-hint {
    margin: 14px 0 0;
    text-align: center;
    color: var(--auth-muted);
    font-size: 0.82rem;
    line-height: 1.7;
}

.auth-live {
    min-height: 1.5em;
    margin-bottom: 12px;
    font-size: 0.9rem;
    line-height: 1.7;
    text-align: center;
}

.auth-live-error { color: var(--auth-danger); }
.auth-live-success { color: var(--auth-success); }
.auth-live-info { color: var(--auth-muted); }

.auth-otp-inputs {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.auth-otp-digit {
    width: 100%;
    height: 54px;
    border: 1px solid var(--auth-line);
    border-radius: 12px;
    background: #fff;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--auth-ink);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.auth-otp-digit:focus {
    border-color: rgba(15, 143, 163, 0.7);
    box-shadow: 0 0 0 4px rgba(15, 143, 163, 0.12);
}

.auth-otp-digit:disabled {
    opacity: 0.65;
    background: #f8fafc;
}

.auth-otp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 8px 0 4px;
    color: var(--auth-muted);
    font-size: 0.84rem;
}

@media (prefers-reduced-motion: reduce) {
    .auth-panel,
    .auth-brand img,
    .auth-shell::before,
    .auth-shell::after {
        animation: none;
    }
}
