/* Authentication modal. */

body.pm-modal-open {
    overflow: hidden;
}

.pm-auth-overlay {
    position: fixed;
    z-index: var(--pm-z-auth);
    inset: 0;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(9, 13, 11, .48);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--pm-duration-slow) ease;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.pm-auth-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}

.pm-auth-modal {
    position: relative;
    width: min(100%, 440px);
    max-height: min(760px, calc(100dvh - 40px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 28px;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius-xl);
    background: var(--pm-popover-bg);
    box-shadow: var(--pm-shadow-modal);
    opacity: 0;
    transform: translateY(14px) scale(.985);
    transition: opacity var(--pm-duration-slow) ease,
                transform 420ms var(--pm-ease-emphasized);
    scrollbar-width: thin;
    scrollbar-color: var(--pm-line-strong) transparent;
}

.pm-auth-overlay.is-open .pm-auth-modal {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.pm-auth-close {
    position: absolute;
    z-index: 3;
    top: 14px;
    right: 14px;
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--pm-text-muted);
    cursor: pointer;
    transition: background-color var(--pm-duration-fast) ease,
                color var(--pm-duration-fast) ease;
}

.pm-auth-close:hover {
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

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

.pm-auth-step {
    min-width: 0;
}

.pm-auth-step.is-hidden,
.pm-auth-form.is-hidden {
    display: none;
}

.pm-auth-step.is-visible,
.pm-auth-form.is-active {
    display: block;
}

.pm-auth-step.is-visible {
    animation: pmAuthStepIn 340ms var(--pm-ease-emphasized);
}

.pm-auth-form.is-entering {
    animation: pmAuthFormIn 300ms var(--pm-ease-emphasized);
}

@keyframes pmAuthStepIn {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pmAuthFormIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

.pm-auth-brand-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    overflow: hidden;
    margin: 5px auto 18px;
    border-radius: 13px;
    background: var(--pm-green-soft);
    color: var(--pm-green);
}

.pm-auth-brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pm-auth-title,
.pm-auth-form-title {
    margin: 0;
    color: var(--pm-text);
    font-weight: var(--pm-weight-semibold);
    line-height: 1.2;
    text-align: center;
}

.pm-auth-title {
    font-size: 24px;
}

.pm-auth-subtitle {
    max-width: 330px;
    margin: 8px auto 0;
    color: var(--pm-text-secondary);
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.pm-auth-email-row {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    min-height: 48px;
    margin-top: 24px;
    padding: 4px 4px 4px 13px;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius-md);
    background: var(--pm-control-bg);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease,
                box-shadow var(--pm-duration-fast) ease;
}

.pm-auth-email-row:focus-within {
    border-color: var(--pm-green-border);
    background: var(--pm-surface-raised);
    box-shadow: 0 0 0 3px var(--pm-green-soft);
}

.pm-auth-email-row.is-error {
    border-color: var(--pm-red-border);
    box-shadow: 0 0 0 3px var(--pm-red-soft);
}

.pm-auth-email-icon {
    width: 19px;
    height: 19px;
    color: var(--pm-text-muted);
}

.pm-auth-input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--pm-text);
    font-size: 13px;
}

.pm-auth-input::placeholder {
    color: var(--pm-text-muted);
}

.pm-auth-continue,
.pm-auth-submit {
    min-height: 38px;
    border: 1px solid var(--pm-green);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-green);
    color: var(--pm-text-on-brand);
    cursor: pointer;
    font-size: 12px;
    font-weight: var(--pm-weight-semibold);
    transition: background-color var(--pm-duration-fast) ease,
                border-color var(--pm-duration-fast) ease,
                transform var(--pm-duration-fast) ease;
}

.pm-auth-continue {
    padding: 0 14px;
}

.pm-auth-continue:hover,
.pm-auth-submit:hover {
    border-color: var(--pm-green-hover);
    background: var(--pm-green-hover);
}

.pm-auth-continue:active,
.pm-auth-submit:active {
    transform: translateY(1px);
}

.pm-auth-continue:disabled,
.pm-auth-submit:disabled {
    cursor: wait;
    opacity: .7;
}

.pm-auth-error {
    max-height: 0;
    overflow: hidden;
    margin: 0;
    color: var(--pm-red);
    font-size: 12px;
    opacity: 0;
    transition: max-height var(--pm-duration-normal) ease,
                margin var(--pm-duration-normal) ease,
                opacity var(--pm-duration-normal) ease;
}

.pm-auth-error.is-visible {
    max-height: 36px;
    margin: 6px 2px 0;
    opacity: 1;
}

.pm-auth-divider {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    align-items: center;
    margin: 22px 0;
}

.pm-auth-divider span {
    height: 1px;
    background: var(--pm-line-soft);
}

.pm-auth-divider b {
    color: var(--pm-text-muted);
    font-size: 12px;
    font-weight: var(--pm-weight-medium);
}

.pm-auth-socials {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.pm-auth-social {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 10px;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-control-bg);
    color: var(--pm-text-secondary);
    cursor: pointer;
    font-size: 12px;
    font-weight: var(--pm-weight-medium);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease,
                color var(--pm-duration-fast) ease;
}

.pm-auth-social:hover {
    border-color: var(--pm-line-strong);
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

.pm-auth-social.is-unavailable {
    border-color: var(--pm-red-border);
    background: var(--pm-red-soft);
    color: var(--pm-red);
}

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

.pm-auth-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 22px;
    color: var(--pm-text-secondary);
    font-size: 12px;
}

.pm-auth-switch button,
.pm-auth-forgot {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--pm-green);
    cursor: pointer;
    font-size: inherit;
    font-weight: var(--pm-weight-semibold);
}

.pm-auth-switch button:hover,
.pm-auth-forgot:hover {
    color: var(--pm-green-hover);
}

.pm-auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 13px;
    color: var(--pm-text-muted);
    font-size: 12px;
}

.pm-auth-links a {
    text-decoration: none;
}

.pm-auth-links a:hover {
    color: var(--pm-text-secondary);
}

.pm-auth-form-head {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 8px;
    align-items: center;
    margin-bottom: 20px;
}

.pm-auth-form-title {
    font-size: 19px;
}

.pm-auth-back {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--pm-text-muted);
    cursor: pointer;
}

.pm-auth-back:hover {
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

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

.pm-auth-loading {
    display: none;
    min-height: 180px;
    place-items: center;
}

.pm-auth-loading.is-visible {
    display: grid;
}

.pm-auth-spinner,
.pm-auth-btn-spinner {
    width: 26px;
    height: 26px;
    border: 2px solid var(--pm-green-soft-hover);
    border-top-color: var(--pm-green);
    border-radius: 50%;
    animation: pmAuthSpin .72s linear infinite;
}

.pm-auth-btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
}

@keyframes pmAuthSpin {
    to { transform: rotate(360deg); }
}

.pm-auth-form {
    position: relative;
}

.pm-auth-field {
    display: block;
}

.pm-auth-field + .pm-auth-field {
    margin-top: 14px;
}

.pm-auth-field > span {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-bottom: 7px;
    color: var(--pm-text-secondary);
    font-size: 12px;
    font-weight: var(--pm-weight-medium);
}

.pm-auth-field > span svg {
    width: 16px;
    height: 16px;
    color: var(--pm-text-muted);
}

.pm-auth-field > span em {
    margin-left: auto;
    color: var(--pm-text-muted);
    font-size: 12px;
    font-style: normal;
    font-weight: var(--pm-weight-regular);
}

.pm-auth-field > .pm-auth-input,
.pm-auth-password {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-control-bg);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease,
                box-shadow var(--pm-duration-fast) ease;
}

.pm-auth-field > .pm-auth-input:focus,
.pm-auth-password:focus-within {
    border-color: var(--pm-green-border);
    background: var(--pm-surface-raised);
    box-shadow: 0 0 0 3px var(--pm-green-soft);
}

.pm-auth-password {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pm-auth-password .pm-auth-input {
    flex: 1;
}

.pm-auth-password-toggle {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--pm-text-muted);
    cursor: pointer;
}

.pm-auth-password-toggle:hover {
    background: var(--pm-surface-hover);
    color: var(--pm-text);
}

.pm-auth-password-toggle svg {
    width: 18px;
    height: 18px;
}

.pm-auth-password-toggle .pm-eye-closed,
.pm-auth-password-toggle.is-active .pm-eye-open {
    display: none;
}

.pm-auth-password-toggle.is-active .pm-eye-closed {
    display: block;
}

.pm-auth-consents {
    display: grid;
    gap: 11px;
    margin-top: 17px;
}

.pm-auth-check {
    display: grid;
    grid-template-columns: 17px minmax(0, 1fr);
    gap: 9px;
    align-items: start;
    cursor: pointer;
}

.pm-auth-check input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.pm-auth-check-box {
    position: relative;
    width: 17px;
    height: 17px;
    margin-top: 1px;
    border: 1px solid var(--pm-line-strong);
    border-radius: 5px;
    background: var(--pm-control-bg);
    transition: border-color var(--pm-duration-fast) ease,
                background-color var(--pm-duration-fast) ease;
}

.pm-auth-check input:checked + .pm-auth-check-box {
    border-color: var(--pm-green);
    background: var(--pm-green);
}

.pm-auth-check input:checked + .pm-auth-check-box::after {
    position: absolute;
    top: 3px;
    left: 5px;
    width: 4px;
    height: 7px;
    border-right: 2px solid var(--pm-text-on-brand);
    border-bottom: 2px solid var(--pm-text-on-brand);
    content: "";
    transform: rotate(45deg);
}

.pm-auth-check input:focus-visible + .pm-auth-check-box {
    outline: 2px solid rgba(24, 201, 116, .62);
    outline-offset: 2px;
}

.pm-auth-check-text {
    color: var(--pm-text-secondary);
    font-size: 12px;
    line-height: 1.55;
}

.pm-auth-check-text a {
    color: var(--pm-green);
}

.pm-auth-check-text b {
    color: var(--pm-red);
}

.pm-auth-submit {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
}

.pm-auth-forgot {
    display: block;
    margin: 14px auto 0;
    font-size: 12px;
}

.pm-auth-recovery-copy {
    margin: 0 0 18px;
    color: var(--pm-text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.pm-auth-action-page {
    display: grid;
    min-height: 100dvh;
    place-items: center;
    padding: 24px;
    background: var(--pm-page-bg);
    color: var(--pm-text);
}

.pm-auth-action-card {
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid var(--pm-line-soft);
    border-radius: var(--pm-radius-lg);
    background: var(--pm-surface);
    box-shadow: 0 20px 54px rgba(0, 0, 0, .14);
    text-align: center;
}

.pm-auth-action-logo {
    width: 52px;
    height: 52px;
    margin-bottom: 18px;
    border-radius: 12px;
    object-fit: cover;
}

.pm-auth-action-card h1 {
    margin: 0;
    font-size: 24px;
}

.pm-auth-action-card p {
    margin: 10px 0 24px;
    color: var(--pm-text-secondary);
    font-size: 14px;
    line-height: 1.55;
}

.pm-auth-action-form {
    display: grid;
    gap: 14px;
    text-align: left;
}

.pm-auth-action-form label span {
    display: block;
    margin-bottom: 7px;
    color: var(--pm-text-secondary);
    font-size: 13px;
    font-weight: var(--pm-weight-medium);
}

.pm-auth-action-form input {
    width: 100%;
    min-height: 46px;
    padding: 0 13px;
    border: 1px solid var(--pm-line);
    border-radius: var(--pm-radius-sm);
    background: var(--pm-control-bg);
    color: var(--pm-text);
}

.pm-auth-action-button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    padding: 0 20px;
    border: 0;
    border-radius: var(--pm-radius-sm);
    background: var(--pm-green);
    color: var(--pm-text-on-brand);
    cursor: pointer;
    font: inherit;
    font-weight: var(--pm-weight-semibold);
    text-decoration: none;
}

.pm-auth-action-message {
    padding: 10px 12px;
    border-radius: var(--pm-radius-sm);
    background: var(--pm-green-soft);
    color: var(--pm-green);
    font-size: 13px;
}

.pm-auth-action-message.is-error {
    background: var(--pm-red-soft);
    color: var(--pm-red);
}

.pm-auth-form-message {
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0 11px;
    border-radius: var(--pm-radius-sm);
    font-size: 12px;
    line-height: 1.45;
    opacity: 0;
    transition: max-height var(--pm-duration-normal) ease,
                margin var(--pm-duration-normal) ease,
                padding var(--pm-duration-normal) ease,
                opacity var(--pm-duration-normal) ease;
}

.pm-auth-form-message.is-error,
.pm-auth-form-message.is-success {
    max-height: 72px;
    margin-bottom: 13px;
    padding-top: 9px;
    padding-bottom: 9px;
    opacity: 1;
}

.pm-auth-form-message.is-error {
    background: var(--pm-red-soft);
    color: var(--pm-red);
}

.pm-auth-form-message.is-success {
    background: var(--pm-green-soft);
    color: var(--pm-green);
}

html.is-dark .pm-auth-overlay {
    background: rgba(0, 0, 0, .58);
}

html.is-dark .pm-auth-modal {
    background: var(--pm-popover-bg);
}

@media (max-width: 520px) {
    .pm-auth-overlay {
        align-items: end;
        padding: 0;
    }

    .pm-auth-modal {
        width: 100%;
        max-height: min(88dvh, 760px);
        padding: 24px 18px calc(22px + env(safe-area-inset-bottom));
        border-right: 0;
        border-bottom: 0;
        border-left: 0;
        border-radius: 18px 18px 0 0;
        transform: translateY(32px);
    }

    .pm-auth-title {
        font-size: 22px;
    }

    .pm-auth-socials {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 360px) {
    .pm-auth-email-row {
        grid-template-columns: 18px minmax(0, 1fr);
        padding: 9px 11px;
    }

    .pm-auth-continue {
        grid-column: 1 / -1;
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pm-auth-modal,
    .pm-auth-step.is-visible,
    .pm-auth-form.is-entering,
    .pm-auth-spinner,
    .pm-auth-btn-spinner {
        animation: none;
        transition-duration: 1ms;
    }
}
