/*
 * SANETER authentication pages — refined Vercel-inspired minimal SaaS layout.
 * Scoped to .sn-auth and authentication body classes only.
 */
:root {
    --sn-brand: #533AFD;
    --sn-brand-hover: #4429E7;
    --sn-bg: #fafafa;
    --sn-surface: #ffffff;
    --sn-ink: #171717;
    --sn-muted: #666666;
    --sn-border: #e5e5e5;
    --sn-border-strong: #d4d4d4;
    --sn-danger: #dc2626;
    --sn-radius: 8px;
    --sn-shadow-focus: 0 0 0 3px rgba(83, 58, 253, .14);
}

body.page-login,
body.page-signup,
body.page-password-reset,
body.page-set-password,
body.page-reset-invalid {
    margin: 0;
    min-height: 100vh;
    background: var(--sn-bg);
}

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

.sn-auth {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sn-bg);
    color: var(--sn-ink);
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.sn-auth a { color: inherit; }

.sn-auth__topbar {
    width: 100%;
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 32px;
}

.sn-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #111111;
    text-decoration: none;
}

.sn-brand__mark {
    width: 20px;
    height: 20px;
    position: relative;
    display: inline-block;
}

.sn-brand__mark::before,
.sn-brand__mark::after,
.sn-brand__mark span {
    content: "";
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--sn-brand);
    border-radius: 2px;
}
.sn-brand__mark::before { left: 1px; top: 1px; }
.sn-brand__mark::after { right: 1px; top: 1px; }
.sn-brand__mark span { left: 6px; bottom: 1px; }

.sn-brand__name {
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: .12em;
}

.sn-auth__main {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 44px 24px 56px;
}

.sn-auth--signup .sn-auth__main { padding-top: 20px; padding-bottom: 34px; }

.sn-auth__panel {
    width: 100%;
    max-width: 380px;
    margin: 0 auto;
}

.sn-auth__panel--signup { max-width: 420px; }

.sn-auth__heading {
    text-align: center;
    margin: 0 0 28px;
}

.sn-auth__title {
    margin: 0;
    color: var(--sn-ink);
    font-size: clamp(28px, 4vw, 34px);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -.035em;
}

.sn-auth__subtitle {
    margin: 12px 0 0;
    color: var(--sn-muted);
    font-size: 14px;
    line-height: 1.6;
}

.sn-auth__subtitle a,
.sn-auth__back a,
.sn-auth__footer a,
.sn-auth .sn-link,
.sn-auth .sn-card__legal a,
.sn-auth .sn-tos a {
    color: var(--sn-brand);
    font-weight: 500;
    text-decoration: none;
}

.sn-auth__subtitle a:hover,
.sn-auth__back a:hover,
.sn-auth__footer a:hover,
.sn-auth .sn-link:hover,
.sn-auth .sn-card__legal a:hover,
.sn-auth .sn-tos a:hover { text-decoration: underline; }

.sn-auth .sn-inline-error { margin: 0 0 18px; }

.sn-auth .sn-form { width: 100%; }

.sn-auth .sn-field { margin: 0 0 18px; }
.sn-auth .sn-field:last-of-type { margin-bottom: 18px; }

.sn-auth .sn-field__label {
    display: block;
    margin: 0 0 8px;
    color: #262626;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.sn-auth .sn-field__wrap { position: relative; }

.sn-auth .sn-field__input,
.sn-auth .sn-field__select,
.sn-auth input[type="text"],
.sn-auth input[type="email"],
.sn-auth input[type="password"],
.sn-auth input[type="date"],
.sn-auth select,
.sn-auth textarea {
    width: 100%;
    min-height: 46px;
    margin: 0;
    padding: 11px 13px;
    border: 1px solid var(--sn-border-strong);
    border-radius: var(--sn-radius);
    background: var(--sn-surface);
    color: var(--sn-ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .025);
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.sn-auth .sn-field__input::placeholder,
.sn-auth input::placeholder,
.sn-auth textarea::placeholder { color: #a3a3a3; opacity: 1; }

/* Keep browser autofill inside the neutral visual system. */
.sn-auth input:-webkit-autofill,
.sn-auth input:-webkit-autofill:hover,
.sn-auth input:-webkit-autofill:focus,
.sn-auth input:-webkit-autofill:active {
    -webkit-text-fill-color: var(--sn-ink);
    caret-color: var(--sn-ink);
    -webkit-box-shadow: 0 0 0 1000px var(--sn-surface) inset, 0 1px 2px rgba(0, 0, 0, .025);
    transition: background-color 9999s ease-out 0s;
}

.sn-auth .sn-field__input:hover,
.sn-auth .sn-field__select:hover,
.sn-auth input:hover,
.sn-auth select:hover,
.sn-auth textarea:hover { border-color: #bdbdbd; }

.sn-auth .sn-field__input:focus,
.sn-auth .sn-field__select:focus,
.sn-auth input:focus,
.sn-auth select:focus,
.sn-auth textarea:focus {
    border-color: var(--sn-brand);
    box-shadow: var(--sn-shadow-focus);
}

.sn-auth .sn-field__input--with-icon { padding-right: 46px; }

.sn-auth .sn-field__icon-btn {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #737373;
    cursor: pointer;
}
.sn-auth .sn-field__icon-btn:hover { background: #f5f5f5; color: #262626; }
.sn-auth .sn-field__icon-btn:focus-visible { outline: 2px solid var(--sn-brand); outline-offset: 1px; }
.sn-auth .sn-field__icon-btn svg { width: 18px; height: 18px; }

.sn-auth .sn-field__hint {
    margin-top: 8px;
    color: var(--sn-muted);
    font-size: 12px;
    line-height: 1.55;
}

.sn-auth .sn-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: -2px 0 20px;
    color: var(--sn-muted);
    font-size: 13px;
}

.sn-auth .sn-check {
    display: inline-flex;
    align-items: flex-start;
    gap: 9px;
    color: #525252;
    font-size: 13px;
    line-height: 1.5;
    cursor: pointer;
}

.sn-auth .sn-check input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.sn-auth .sn-check__box {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-top: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #c7c7c7;
    border-radius: 4px;
    background: #ffffff;
    color: #ffffff;
}
.sn-auth .sn-check__box svg { width: 11px; height: 11px; stroke: currentColor; stroke-width: 3; }
.sn-auth .sn-check input:checked + .sn-check__box { background: var(--sn-brand); border-color: var(--sn-brand); }
.sn-auth .sn-check input:focus-visible + .sn-check__box { box-shadow: var(--sn-shadow-focus); border-color: var(--sn-brand); }

.sn-auth .sn-submit {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 2px 0 0;
    padding: 11px 16px;
    border: 1px solid var(--sn-brand);
    border-radius: var(--sn-radius);
    background: var(--sn-brand);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(32, 20, 116, .12);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.sn-auth .sn-submit:hover { background: var(--sn-brand-hover); border-color: var(--sn-brand-hover); color: #ffffff; text-decoration: none; }
.sn-auth .sn-submit:active { transform: translateY(1px); }
.sn-auth .sn-submit:focus-visible { outline: 0; box-shadow: var(--sn-shadow-focus); }
.sn-auth .sn-submit:disabled { opacity: .62; cursor: not-allowed; transform: none; }
.sn-auth .sn-submit--link { margin-top: 4px; }

.sn-auth .sn-divider {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0 18px;
    color: #a3a3a3;
    font-size: 12px;
    text-transform: lowercase;
}
.sn-auth .sn-divider::before,
.sn-auth .sn-divider::after { content: ""; height: 1px; flex: 1; background: var(--sn-border); }

.sn-auth .sn-social { display: grid; gap: 10px; }

.sn-auth .sn-social__btn {
    width: 100%;
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 15px;
    border: 1px solid var(--sn-border-strong);
    border-radius: var(--sn-radius);
    background: #ffffff;
    color: #262626;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .025);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}
.sn-auth .sn-social__btn:hover { border-color: #bdbdbd; background: #fdfdfd; }
.sn-auth .sn-social__btn:focus-visible { outline: 0; border-color: var(--sn-brand); box-shadow: var(--sn-shadow-focus); }
.sn-auth .sn-social__btn svg { width: 18px; height: 18px; flex: 0 0 auto; }

.sn-auth__back { margin-top: 24px; text-align: center; font-size: 13px; }

.sn-auth__footer {
    flex: 0 0 auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 96px 24px;
    color: #737373;
    font-size: 12px;
    line-height: 1.4;
}
.sn-auth__footer a { color: #666666; font-weight: 400; }

/* Signup's optional and dynamic fields */
.sn-auth .sn-phone { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; }
.sn-auth .sn-recaptcha { margin: 4px 0 18px; overflow: hidden; }
.sn-auth .sn-tos { margin: 2px 0 18px; }
.sn-auth .sn-tos-error { color: var(--sn-danger); font-size: 12px; line-height: 1.5; margin: 7px 0 0; }
.sn-auth .sn-card__legal { margin-top: 12px; color: var(--sn-muted); font-size: 12px; line-height: 1.6; text-align: center; }
.sn-auth .sn-signup-affiliate-field { margin-top: 2px; }


/* Signup is intentionally denser so the full flow fits common laptop heights. */
.sn-auth--signup .sn-auth__heading { margin-bottom: 22px; }
.sn-auth--signup .sn-field,
.sn-auth--signup .sn-field:last-of-type { margin-bottom: 14px; }
.sn-auth--signup .sn-tos { margin-top: 0; margin-bottom: 14px; }
.sn-auth--signup .sn-divider { margin: 18px 0 14px; }
.sn-auth--signup .sn-social { gap: 8px; }
.sn-auth--signup .sn-social__btn { min-height: 44px; }

@keyframes sn-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-3px); }
}
.sn-auth .sn-tos.sn-shake { animation: sn-shake .32s ease; }

/* Email verification panel */
.sn-auth .sn-verify { margin-top: 2px; }
.sn-auth .sn-verify__title { margin: 0 0 8px; color: var(--sn-ink); font-size: 24px; font-weight: 600; letter-spacing: -.025em; text-align: center; }
.sn-auth .sn-verify__hint { margin: 0 0 20px; color: var(--sn-muted); font-size: 14px; line-height: 1.6; text-align: center; }
.sn-auth .sn-otp { display: flex; justify-content: center; gap: 10px; margin: 0; }
.sn-auth .sn-otp__box { width: 58px !important; height: 62px; min-height: 62px !important; padding: 4px !important; text-align: center; font-size: 26px !important; font-weight: 600; }
.sn-auth .sn-verify__error { margin: 13px 0 0; color: var(--sn-danger); font-size: 12px; line-height: 1.5; text-align: center; }
.sn-auth .sn-verify #sn-verify-btn { margin-top: 18px; }
.sn-auth .sn-verify__resend { width: 100%; margin-top: 8px; padding: 9px; border: 0; background: transparent; color: var(--sn-brand); font: inherit; font-size: 13px; cursor: pointer; }
.sn-auth .sn-verify__resend:disabled { color: #a3a3a3; cursor: default; }

/* Language switcher — compact flag + chevron, matching the reference structure. */
.sn-auth .sn-lang { position: relative; z-index: 20; }
.sn-auth .sn-lang__btn {
    min-width: 64px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 11px;
    border: 1px solid var(--sn-border);
    border-radius: 8px;
    background: #ffffff;
    color: #525252;
    cursor: pointer;
}
.sn-auth .sn-lang__btn:hover { border-color: #c9c9c9; background: #ffffff; }
.sn-auth .sn-lang__btn:focus-visible { outline: 0; border-color: var(--sn-brand); box-shadow: var(--sn-shadow-focus); }
.sn-auth .sn-lang__chevron { display: inline-flex; align-items: center; justify-content: center; }
.sn-auth .sn-lang__chevron svg { width: 12px; height: 12px; }
.sn-auth .sn-lang__flag { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; opacity: 0; transition: opacity .15s ease; }
.sn-auth .sn-lang__flag.is-loaded { opacity: 1; }
.sn-auth .sn-lang__menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 220px;
    max-height: min(420px, calc(100vh - 120px));
    overflow: auto;
    padding: 6px;
    border: 1px solid var(--sn-border);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 14px 38px rgba(0,0,0,.11);
}
.sn-auth .sn-lang__menu[hidden] { display: none !important; }
.sn-auth .sn-lang__option {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: #404040;
    font: inherit;
    font-size: 13px;
    text-align: left;
    cursor: pointer;
}
.sn-auth .sn-lang__option:hover,
.sn-auth .sn-lang__option.is-active { background: #f5f5f5; }
.sn-auth .sn-lang__option.is-active { color: var(--sn-brand); font-weight: 600; }
.sn-auth .sn-lang__option-flag { width: 24px; height: 16px; border-radius: 2px; object-fit: cover; opacity: 0; }
.sn-auth .sn-lang__option-flag.is-loaded { opacity: 1; }

.sn-auth__status-icon {
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 22px;
    border: 1px solid #ddd7ff;
    border-radius: 50%;
    background: #f5f2ff;
    color: var(--sn-brand);
}
.sn-auth__status-icon svg { width: 22px; height: 22px; }

/* Keep Chatwoot's bottom-right launcher free; no selector targets it. */
@media (min-width: 641px) and (max-height: 900px) {
    .sn-auth__topbar { min-height: 68px; padding-top: 16px; padding-bottom: 16px; }
    .sn-auth__main { padding-top: 30px; padding-bottom: 38px; }
    .sn-auth--signup .sn-auth__main { padding-top: 10px; padding-bottom: 24px; }
    .sn-auth--signup .sn-auth__heading { margin-bottom: 18px; }
    .sn-auth--signup .sn-field,
    .sn-auth--signup .sn-field:last-of-type { margin-bottom: 12px; }
    .sn-auth--signup .sn-tos { margin-bottom: 12px; }
    .sn-auth--signup .sn-divider { margin: 15px 0 12px; }
    .sn-auth__footer { min-height: 54px; padding-top: 12px; padding-bottom: 16px; }
}
@media (max-width: 640px) {
    .sn-auth__topbar { min-height: 66px; padding: 16px 18px; }
    .sn-brand__name { font-size: 13px; }
    .sn-auth__main { padding: 32px 20px 88px; }
    .sn-auth--signup .sn-auth__main { padding: 24px 20px 80px; }
    .sn-auth__title { font-size: 28px; }
    .sn-auth__heading { margin-bottom: 26px; }
    .sn-auth__footer { min-height: 72px; padding: 16px 88px 22px 20px; justify-content: flex-start; }
    .sn-auth .sn-row { align-items: flex-start; }
    .sn-auth .sn-phone { grid-template-columns: 78px minmax(0, 1fr); }
    .sn-auth .sn-otp { gap: 8px; }
    .sn-auth .sn-otp__box { width: 52px !important; height: 58px; min-height: 58px !important; }
}

@media (prefers-reduced-motion: reduce) {
    .sn-auth *, .sn-auth *::before, .sn-auth *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Stage 6: quieter legal links and signup consent, without hiding required consent. */
.sn-auth__footer {
    gap: 8px;
    color: #a3a3a3;
    font-size: 11px;
}
.sn-auth__footer a {
    color: #929292;
    font-weight: 400;
}
.sn-auth__footer a:hover { color: #737373; }

.sn-auth .sn-tos .sn-check {
    gap: 7px;
    color: #858585;
    font-size: 11px;
    line-height: 1.45;
}
.sn-auth .sn-tos .sn-check__box {
    width: 13px;
    height: 13px;
    margin-top: 1px;
    border-color: #d6d6d6;
    border-radius: 3px;
}
.sn-auth .sn-tos .sn-check__box svg {
    width: 9px;
    height: 9px;
}
.sn-auth .sn-tos .sn-check a {
    color: #777777;
    font-weight: 400;
    text-decoration: none;
}
.sn-auth .sn-tos .sn-check a:hover { color: #595959; }

.sn-auth .sn-card__legal {
    color: #969696;
    font-size: 11px;
}
.sn-auth .sn-card__legal a {
    color: #777777;
    font-weight: 400;
}
.sn-auth .sn-card__legal a:hover { color: #595959; }

/* Stage 10: remove ineffective remember control and center password recovery link. */
.sn-auth .sn-forgot-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -2px 0 20px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.sn-auth .sn-forgot-row .sn-link {
    display: inline-block;
    text-align: center;
}

/* Stage 14: shared geometry and typography for all four authentication flows. */
.sn-auth__main,
.sn-auth--signup .sn-auth__main {
    padding: 44px 24px 56px;
}

.sn-auth__panel,
.sn-auth__panel--signup {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.sn-auth__heading,
.sn-auth--signup .sn-auth__heading {
    margin: 0 0 28px;
    text-align: center;
}

.sn-auth__title {
    margin: 0;
    font-size: 32px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.035em;
}

.sn-auth__subtitle {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
}

.sn-auth .sn-field,
.sn-auth .sn-field:last-of-type,
.sn-auth--signup .sn-field,
.sn-auth--signup .sn-field:last-of-type {
    margin: 0 0 18px;
}

.sn-auth .sn-field__label {
    margin: 0 0 8px;
    font-size: 14px;
    line-height: 1.4;
}

.sn-auth .sn-field__input,
.sn-auth .sn-field__select,
.sn-auth input[type="text"],
.sn-auth input[type="email"],
.sn-auth input[type="password"],
.sn-auth input[type="date"],
.sn-auth select {
    min-height: 46px;
    height: 46px;
    padding-top: 11px;
    padding-bottom: 11px;
    font-size: 14px;
    line-height: 1.45;
}

.sn-auth .sn-submit,
.sn-auth .sn-social__btn,
.sn-auth--signup .sn-social__btn {
    min-height: 46px;
    height: 46px;
    font-size: 14px;
    line-height: 1.4;
}

.sn-auth .sn-divider,
.sn-auth--signup .sn-divider {
    margin: 24px 0 18px;
}

.sn-auth .sn-social,
.sn-auth--signup .sn-social {
    gap: 10px;
}

.sn-auth__back {
    margin-top: 24px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
}

.sn-auth .sn-forgot-row {
    margin: -2px 0 20px;
    font-size: 13px;
    line-height: 1.5;
}

@media (min-width: 641px) and (max-height: 900px) {
    .sn-auth__main,
    .sn-auth--signup .sn-auth__main {
        padding-top: 34px;
        padding-bottom: 40px;
    }

    .sn-auth__heading,
    .sn-auth--signup .sn-auth__heading {
        margin-bottom: 24px;
    }
}

@media (max-width: 640px) {
    .sn-auth__main,
    .sn-auth--signup .sn-auth__main {
        padding: 32px 20px 88px;
    }

    .sn-auth__panel,
    .sn-auth__panel--signup {
        max-width: 400px;
    }

    .sn-auth__title {
        font-size: 28px;
    }

    .sn-auth__heading,
    .sn-auth--signup .sn-auth__heading {
        margin-bottom: 26px;
    }
}
