:root {
    --c-bg: #F5F7FB;
    --c-surface: #FFFFFF;
    --c-card-soft: #F2F5FA;
    --c-border: #DCE1EC;
    --c-text: #182033;
    --c-muted: #7C8499;
    --c-label: #4A5368;
    --c-primary: #427BF4;
    --c-primary-hover: #326CE8;
    --c-accent: #744FF4;
    --c-danger-bg: #FDECEC;
    --c-danger-text: #B42318;
    --c-success-bg: #EAF5FF;
    --c-success-border: #C7E4FF;
    --c-success-text: #1950AD;
    --radius-card: 18px;
}

html[data-theme=dark] {
    color-scheme: dark;
    --c-bg: #0F1420;
    --c-surface: #151B29;
    --c-card-soft: #1A2030;
    --c-border: #2A3142;
    --c-text: #E7ECF5;
    --c-muted: #9AA4B8;
    --c-label: #C2C9D6;
    --c-primary: #5C8BFF;
    --c-primary-hover: #6E98FF;
    --c-accent: #9264EF;
    --c-danger-bg: #351D25;
    --c-danger-text: #FFB4AB;
    --c-success-bg: #162642;
    --c-success-border: #274472;
    --c-success-text: #89B5FF;
}

html[data-theme=light] {
    color-scheme: light;
}

html,
body {
    min-height: 100%;
    background: var(--c-bg);
    color: var(--c-text);
}

body.loaded {
    background:
            radial-gradient(circle at top left, rgba(66, 123, 244, .14), transparent 32rem),
            radial-gradient(circle at bottom right, rgba(116, 79, 244, .12), transparent 34rem),
            var(--c-bg);
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 16px 48px;
    box-sizing: border-box;
}

.auth-header {
    width: 100%;
    max-width: 760px;
    margin: 0 auto 26px;
    text-align: center;
}

.auth-topbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    position: relative;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    text-decoration: none;
}

.auth-logo img {
    width: min(420px, 84vw);
    height: auto;
    max-height: 110px;
    object-fit: contain;
}

.auth-logo__dark {
    display: none;
}

html[data-theme=dark] .auth-logo__light {
    display: none;
}

html[data-theme=dark] .auth-logo__dark {
    display: block;
}

.auth-theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    position: absolute;
    top: 0;
    right: 0;
    min-height: 36px;
    margin-bottom: 1rem;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: color-mix(in srgb, var(--c-surface) 90%, transparent);
    color: var(--c-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: none;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
}

.auth-theme-toggle:hover,
.auth-theme-toggle:focus {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    outline: none;
    transform: translateY(-1px);
}

.auth-theme-toggle__icon {
    font-size: 15px;
    line-height: 1;
}

.auth-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.auth-nav__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--c-border);
    background: color-mix(in srgb, var(--c-surface) 88%, transparent);
    color: var(--c-muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
}

.auth-nav__link:hover,
.auth-nav__link:focus {
    background: var(--c-primary);
    border-color: var(--c-primary);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.auth-main {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.auth-main .c-wrap {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
}

.auth-card {
    background: color-mix(in srgb, var(--c-surface) 96%, transparent);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-card);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 18px 44px rgba(16, 24, 40, .08);
    padding: 28px;
    backdrop-filter: blur(10px);
}

html[data-theme=dark] .auth-card {
    box-shadow: none;
}

.auth-card__head {
    text-align: center;
    margin-bottom: 22px;
}

.auth-card__title {
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--c-text);
}

.auth-card__subtitle {
    margin: 8px 0 0;
    font-size: 14px;
    line-height: 1.45;
    color: var(--c-muted);
}

.auth-alert {
    margin: 14px 0 0;
    padding: 11px 14px;
    border-radius: 12px;
    background: var(--c-danger-bg);
    color: var(--c-danger-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
    text-align: center;
}

.auth-form {
    margin: 0;
}

.auth-field {
    margin-bottom: 14px;
}

.auth-input {
    display: block;
    width: 100%;
    height: 46px;
    box-sizing: border-box;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}

.auth-input::placeholder {
    color: var(--c-muted);
    opacity: 1;
}

.auth-input:focus {
    border-color: var(--c-primary);
    background: var(--c-surface);
    box-shadow: 0 0 0 3px rgba(66, 123, 244, .16);
}

html[data-theme=dark] .auth-input:focus {
    box-shadow: 0 0 0 3px rgba(92, 139, 255, .22);
}

.auth-link-row {
    margin-top: 7px;
    text-align: right;
}

.auth-link,
.auth-footer a {
    color: var(--c-primary);
    font-weight: 700;
    text-decoration: none;
}

.auth-link:hover,
.auth-footer a:hover {
    color: var(--c-primary-hover);
    text-decoration: none;
}

.auth-captcha {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    margin: 16px 0;
}

.auth-captcha img {
    border-radius: 12px;
    border: 1px solid var(--c-border);
    background: #fff;
}

.auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 46px;
    margin-top: 6px;
    border: 1px solid var(--c-primary);
    border-radius: 12px;
    background: var(--c-primary);
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    line-height: 1;
    box-shadow: none;
    cursor: pointer;
    transition: filter .15s, transform .15s, opacity .15s;
}

.auth-submit:hover,
.auth-submit:focus,
.auth-submit.active {
    color: #fff;
    filter: brightness(1.06);
    transform: translateY(-1px);
}


.auth-card--success {
    padding: 34px 30px;
}

.auth-result {
    text-align: center;
}

.auth-result__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 22px;
    background:
            radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .85), transparent 36%),
            linear-gradient(135deg, var(--c-success-bg), color-mix(in srgb, var(--c-primary) 18%, var(--c-success-bg)));
    border: 1px solid var(--c-success-border);
    box-shadow: 0 12px 26px rgba(66, 123, 244, .14);
}

html[data-theme=dark] .auth-result__badge {
    box-shadow: none;
}

.auth-result__badge-icon,
.auth-result__icon {
    display: block;
    width: 42px;
    height: 42px;
    object-fit: contain;
}

.auth-result__title {
    margin-top: 0;
    margin-bottom: 10px;
}

.auth-result__text {
    max-width: 340px;
    margin: 0 auto;
    color: var(--c-label);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.55;
}

.auth-result__note {
    max-width: 360px;
    margin: 18px auto 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--c-border);
    background: var(--c-card-soft);
    color: var(--c-muted);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
}

.auth-result__note strong {
    color: var(--c-text);
    font-weight: 800;
}

.auth-result__actions {
    display: flex;
    justify-content: center;
    margin-top: 22px;
}

.auth-result__actions .auth-submit {
    max-width: 260px;
    margin-top: 0;
}

.auth-footer,
.auth-note,
.auth-footer-links {
    margin: 16px 0 0;
    text-align: center;
    font-size: 14px;
    line-height: 1.45;
    color: var(--c-muted) !important;
}

.auth-footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.auth-footer-links .auth-note {
    margin: 0;
}

.auth-footer a,
.auth-note a,
.auth-footer-links a,
.auth-footer-links .auth-link {
    color: var(--c-primary) !important;
    font-weight: 800;
    text-decoration: none;
}

.auth-footer a:hover,
.auth-footer a:focus,
.auth-note a:hover,
.auth-note a:focus,
.auth-footer-links a:hover,
.auth-footer-links a:focus,
.auth-footer-links .auth-link:hover,
.auth-footer-links .auth-link:focus {
    color: var(--c-primary-hover) !important;
    text-decoration: none;
}

html[data-theme=dark] .auth-footer,
html[data-theme=dark] .auth-note,
html[data-theme=dark] .auth-footer-links {
    color: #C2C9D6 !important;
}

html[data-theme=dark] .auth-footer a,
html[data-theme=dark] .auth-note a,
html[data-theme=dark] .auth-footer-links a,
html[data-theme=dark] .auth-footer-links .auth-link {
    color: #89B5FF !important;
}

.icon-load .ball {
    background: var(--c-primary);
}

@media (max-width: 520px) {
    .auth-wrapper {
        padding: 20px 12px 34px;
    }

    .auth-topbar {
        flex-direction: column;
    }

    .auth-theme-toggle {
        position: static;
        margin-top: -8px;
    }

    .auth-card {
        padding: 22px 18px;
        border-radius: 16px;
    }

    .auth-card__title {
        font-size: 23px;
    }

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


.auth-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-label, var(--c-text));
}

.auth-checkbox {
    display: block;
    position: relative;
    margin: 6px 0 18px;
    padding: 12px 14px;
    border: 1px solid var(--c-border);
    border-radius: 12px;
    background: var(--c-card-soft, rgba(66, 123, 244, .06));
    color: var(--c-muted);
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
    user-select: none;
}

.auth-checkbox input[type=checkbox] {
    position: absolute;
    left: 14px;
    top: 14px;
    width: 20px;
    height: 20px;
    margin: 0;
    opacity: 0;
    z-index: 2;
    cursor: pointer;
}

.auth-checkbox span {
    display: block;
    position: relative;
    min-height: 22px;
    padding-left: 34px;
    color: inherit;
}

.auth-checkbox span::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 20px;
    height: 20px;
    box-sizing: border-box;
    border: 2px solid var(--c-border);
    border-radius: 6px;
    background: var(--c-surface);
    box-shadow: inset 0 0 0 2px transparent;
    transition: background .15s, border-color .15s, box-shadow .15s;
}

.auth-checkbox span::after {
    content: "";
    position: absolute;
    left: 7px;
    top: 3px;
    width: 6px;
    height: 11px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) scale(0);
    transform-origin: center;
    transition: transform .12s ease-in-out;
}

.auth-checkbox input[type=checkbox]:checked + span::before {
    background: var(--c-primary);
    border-color: var(--c-primary);
}

.auth-checkbox input[type=checkbox]:checked + span::after {
    transform: rotate(45deg) scale(1);
}

.auth-checkbox input[type=checkbox]:focus-visible + span::before {
    box-shadow: 0 0 0 3px rgba(66, 123, 244, .18);
    border-color: var(--c-primary);
}

.auth-checkbox a {
    color: var(--c-primary) !important;
    font-weight: 800;
    text-decoration: none;
}

.auth-checkbox a:hover,
.auth-checkbox a:focus {
    text-decoration: underline;
}

.auth-result__symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 30px;
    font-weight: 900;
    color: var(--c-primary);
    line-height: 1;
}

.auth-result__badge--error {
    background: rgba(116, 79, 244, .12);
    border-color: rgba(116, 79, 244, .28);
}

.auth-result__badge--error .auth-result__symbol {
    color: var(--c-accent, #744FF4);
}

.auth-result__badge--locked .auth-result__symbol {
    font-size: 28px;
}

.auth-card--locked .auth-alert--compact {
    margin-top: 14px;
    margin-bottom: 0;
}

html[data-theme=dark] .auth-checkbox {
    background: rgba(255, 255, 255, .025);
    color: #C2C9D6;
}

html[data-theme=dark] .auth-checkbox span::before {
    background: #0F1420;
    border-color: #3A4358;
}

html[data-theme=dark] .auth-checkbox input[type=checkbox]:checked + span::before {
    background: var(--c-primary);
    border-color: var(--c-primary);
}

html[data-theme=dark] .auth-checkbox input[type=checkbox]:focus-visible + span::before {
    box-shadow: 0 0 0 3px rgba(92, 139, 255, .24);
}

html[data-theme=dark] .auth-checkbox a {
    color: #89B5FF !important;
}


/* ==================== AUTH PROVIDER-THEME COMPATIBILITY ==================== */
.auth-card .text-center { text-align: center; }
.auth-card .text-right { text-align: right; }
.auth-card .font-600 { font-weight: 700; }
.auth-card .c-title { color: var(--c-text); }
.auth-card .c-text { color: var(--c-muted); }
.auth-card .text-color { color: var(--c-text) !important; }
.auth-card .link { color: var(--c-primary) !important; font-weight: 800; text-decoration: none; }
.auth-card .link:hover,
.auth-card .link:focus { color: var(--c-primary-hover) !important; text-decoration: none; }
.auth-card .form-text { padding: 0; margin-top: 7px; color: var(--c-muted); }
.auth-card .form-field { margin-bottom: 14px; }
.auth-card .btn,
.auth-card a.btn { width: 100%; max-width: none; color: #fff; background: var(--c-primary); border: 1px solid var(--c-primary); border-radius: 12px; }
.auth-card .btn:hover,
.auth-card .btn:focus,
.auth-card .btn.active { color: #fff; background: var(--c-primary-hover); border-color: var(--c-primary-hover); text-decoration: none; }
.auth-card .sign-footer { margin-top: 18px; }
.auth-card .sign-footer__text { margin-top: 14px; color: var(--c-muted); }
.auth-card .sign-footer__text a { color: var(--c-primary) !important; font-weight: 800; text-decoration: none; }
.auth-card .sign-footer__text a:hover,
.auth-card .sign-footer__text a:focus { color: var(--c-primary-hover) !important; text-decoration: none; }
.auth-card .c-img { margin: 26px 0; display: flex; justify-content: center; }
.auth-card .c-img img { max-width: 120px; }
.auth-loading-state { display: none; text-align: center; padding: 18px 0 8px; color: var(--c-muted); font-size: 16px; font-weight: 800; }
.auth-loading-state.is-visible { display: block; }
.auth-hidden { display: none !important; }
@supports not (color: color-mix(in srgb, #000 50%, #fff)) {
    .auth-card,
    .auth-nav__link,
    .auth-theme-toggle { background: var(--c-surface); }
    .auth-result__badge { background: var(--c-success-bg); }
}