.has-frontend-auth-modal {
    overflow: hidden;
}

.frontend-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 0;
}

.frontend-auth-modal.is-open {
    display: block;
}

.frontend-auth-modal__backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.58);
    backdrop-filter: blur(3px);
}

.frontend-auth-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(100% - 32px, 760px);
    margin: 0 auto;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28);
    overflow: hidden;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    display: flex;
    flex-direction: column;
}

.frontend-auth-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: #f1f5f9;
    color: #0f172a;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
}

.frontend-auth-modal__head {
    padding: 28px 28px 18px;
    border-bottom: 1px solid #eaf2f7;
    background: linear-gradient(180deg, #ffffff 0%, #f9fcfe 100%);
    flex: 0 0 auto;
}

.frontend-auth-modal__eyebrow {
    display: inline-block;
    margin-bottom: 10px;
    color: #0891b2;
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.frontend-auth-modal__head h2 {
    margin: 0 0 8px;
    color: #0f172a;
    font-size: 28px;
    line-height: 1.15;
}

.frontend-auth-modal__head p {
    margin: 0;
    color: #64748b;
    line-height: 1.7;
}

.frontend-auth-modal__tabs {
    display: flex;
    gap: 8px;
    padding: 16px 28px 0;
    flex: 0 0 auto;
}

.frontend-auth-modal__tab {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #dbe7ee;
    border-radius: 14px;
    background: #f8fbfd;
    color: #475569;
    font-weight: 700;
    cursor: pointer;
}

.frontend-auth-modal__tab.is-active {
    background: #0891b2;
    border-color: #0891b2;
    color: #ffffff;
}

.frontend-auth-modal__flash {
    margin: 16px 28px 0;
    padding: 14px 16px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.65;
    flex: 0 0 auto;
}

.frontend-auth-modal__flash--success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.frontend-auth-modal__flash--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.frontend-auth-modal__flash--warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.frontend-auth-modal__flash--info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.frontend-auth-modal__panels {
    padding: 24px 28px 28px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.frontend-auth-form {
    display: grid;
    gap: 16px;
}

.frontend-auth-form__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.frontend-auth-form__group {
    display: grid;
    gap: 8px;
}

.frontend-auth-form__group label {
    color: #334155;
    font-size: 14px;
    font-weight: 700;
}

.frontend-auth-form__group input {
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid #d9e6ee;
    border-radius: 14px;
    background: #fcfeff;
    color: #0f172a;
    font-size: 14px;
}

.frontend-auth-form__group input:focus {
    outline: none;
    border-color: #7dd3e6;
    box-shadow: 0 0 0 4px rgba(8, 145, 178, 0.10);
    background: #ffffff;
}

.frontend-auth-form__actions {
    padding-top: 6px;
}

.frontend-auth-form__submit {
    min-height: 48px;
    padding: 0 20px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, #0891b2 0%, #0ea5e9 100%);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 16px 30px rgba(14, 165, 233, 0.22);
}

.frontend-auth-toast {
    position: fixed;
    top: 22px;
    right: 22px;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: min(100% - 24px, 420px);
    padding: 16px 18px;
    border-radius: 16px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.frontend-auth-toast--success {
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
}

.frontend-auth-toast--error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.frontend-auth-toast--warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.frontend-auth-toast--info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.frontend-auth-toast__content {
    flex: 1 1 auto;
    font-size: 14px;
    line-height: 1.6;
    font-weight: 600;
}

.frontend-auth-toast__close {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: inherit;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 768px) {
    .frontend-auth-modal {
        padding: 10px 0;
    }

    .frontend-auth-modal__dialog {
        width: min(100% - 16px, 760px);
        border-radius: 18px;
        max-height: calc(100vh - 20px);
        max-height: calc(100dvh - 20px);
    }

    .frontend-auth-modal__head {
        padding: 22px 18px 16px;
    }

    .frontend-auth-modal__tabs {
        padding: 14px 18px 0;
        flex-wrap: wrap;
    }

    .frontend-auth-modal__panels {
        padding: 18px;
    }

    .frontend-auth-modal__flash {
        margin: 14px 18px 0;
    }

    .frontend-auth-form__grid {
        grid-template-columns: 1fr;
    }

    .frontend-auth-toast {
        top: 14px;
        right: 12px;
        left: 12px;
        width: auto;
    }
}

@media (max-width: 480px) {
    .frontend-auth-modal__head h2 {
        font-size: 24px;
    }

    .frontend-auth-form__group input {
        min-height: 46px;
    }

    .frontend-auth-form__submit {
        width: 100%;
    }
}