:root {
    --auth-page: var(--ui-custom-page, #071426);
    --auth-surface: var(--ui-custom-panel, #0b1a2e);
    --auth-panel: var(--ui-custom-table-row, #10223a);
    --auth-control: var(--ui-custom-control, #0a182b);
    --auth-border: var(--ui-custom-border, #334b68);
    --auth-border-strong: var(--ui-custom-border, #58718f);
    --auth-text: var(--ui-custom-text, #f8fafc);
    --auth-muted: var(--ui-custom-muted, #a9b6c8);
    --auth-accent: var(--ui-custom-accent, #22bfe8);
    --auth-accent-hover: var(--ui-custom-accent, #5bd7f4);
    --auth-accent-contrast: var(--ui-custom-accent-contrast, #031521);
    --auth-danger: #fecdd3;
    --auth-danger-bg: #3a1822;
    --auth-success: #bbf7d0;
    --auth-success-bg: #123326;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    background: var(--auth-page);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--auth-page);
    color: var(--auth-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

a {
    color: var(--auth-accent);
    text-decoration: none;
}

a:hover {
    color: var(--auth-accent-hover);
    text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

.auth-page {
    min-height: 100vh;
    min-height: 100svh;
    display: grid;
    place-items: center;
    padding: 22px;
}

.auth-shell {
    width: min(1080px, 100%);
    overflow: hidden;
    border: 1px solid var(--auth-border);
    border-radius: 14px;
    background: var(--auth-surface);
}

.auth-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 30px;
    border-bottom: 1px solid var(--auth-border);
}

.auth-brand {
    display: inline-flex;
    align-items: center;
    color: var(--auth-text);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .01em;
}

.auth-brand:hover {
    color: var(--auth-text);
    text-decoration: none;
}

.auth-brand-accent {
    color: var(--auth-accent);
}

.auth-header-link {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
}

.auth-body {
    min-height: 540px;
    display: grid;
    grid-template-columns: minmax(0, .88fr) minmax(430px, 1.12fr);
    grid-template-areas: "intro form";
}

.auth-intro {
    grid-area: intro;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 46px 42px;
    border-right: 1px solid var(--auth-border);
}

.auth-intro-heading {
    max-width: 460px;
    margin: 0 0 16px;
    font-size: clamp(30px, 3.1vw, 42px);
    line-height: 1.14;
    letter-spacing: -.025em;
}

.auth-intro-copy {
    max-width: 440px;
    margin: 0;
    color: var(--auth-muted);
    font-size: 16px;
}

.auth-services {
    margin-top: 44px;
    padding-top: 24px;
    border-top: 1px solid var(--auth-border);
}

.auth-services-title {
    margin: 0 0 14px;
    color: var(--auth-text);
    font-size: 14px;
    font-weight: 700;
}

.auth-services-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.auth-service {
    min-width: 0;
    display: grid;
    justify-items: center;
    gap: 7px;
    color: var(--auth-muted);
    font-size: 12px;
    text-align: center;
}

.auth-service-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 1px solid var(--auth-border-strong);
    border-radius: 10px;
    color: var(--auth-text);
    font-size: 23px;
}

.auth-form-panel {
    grid-area: form;
    display: flex;
    align-items: center;
    padding: 34px 44px;
    background: var(--auth-panel);
}

.auth-form {
    width: 100%;
    max-width: 510px;
    margin: 0 auto;
}

.auth-title {
    margin: 0;
    font-size: 34px;
    line-height: 1.2;
    letter-spacing: -.02em;
}

.auth-subtitle {
    margin: 8px 0 26px;
    color: var(--auth-muted);
    font-size: 15px;
}

.auth-alert {
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 14px;
}

.auth-alert--danger {
    border-color: #713243;
    background: var(--auth-danger-bg);
    color: var(--auth-danger);
}

.auth-alert--success {
    border-color: #276146;
    background: var(--auth-success-bg);
    color: var(--auth-success);
}

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

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

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

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

.auth-control-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    color: #8da8c5;
    pointer-events: none;
}

.auth-control {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 42px;
    border: 1px solid var(--auth-border-strong);
    border-radius: 10px;
    background: var(--auth-control);
    color: var(--auth-text);
    font-size: 14px;
}

.auth-control.has-toggle {
    padding-right: 48px;
}

.auth-control::placeholder {
    color: #7489a3;
}

.auth-control:focus {
    border-color: var(--auth-accent);
    outline: 2px solid var(--auth-accent);
}

.auth-password-toggle {
    position: absolute;
    top: 50%;
    right: 7px;
    width: 36px;
    height: 36px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #9ab0c8;
    cursor: pointer;
}

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

.auth-help {
    display: block;
    margin-top: 6px;
    color: var(--auth-muted);
    font-size: 12px;
}

.auth-help--error {
    color: #ff99a5;
}

.auth-control.is-invalid {
    border-color: #ff6f7d;
    outline: 2px solid rgba(255, 111, 125, .24);
}

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

.auth-check {
    display: inline-flex;
    align-items: flex-start;
    gap: 9px;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-check input {
    width: 17px;
    height: 17px;
    margin: 2px 0 0;
    accent-color: var(--auth-accent);
}

.auth-terms {
    margin: 2px 0 16px;
    font-size: 12px;
}

.auth-note {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 11px 13px;
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    color: var(--auth-muted);
    font-size: 12px;
}

.auth-note i {
    color: var(--auth-accent);
    font-size: 17px;
}

.auth-submit {
    width: 100%;
    min-height: 48px;
    padding: 11px 18px;
    border: 1px solid var(--auth-accent);
    border-radius: 10px;
    background: var(--auth-accent);
    color: var(--auth-accent-contrast);
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}

.auth-submit:hover {
    border-color: var(--auth-accent-hover);
    background: var(--auth-accent-hover);
}

.auth-footer {
    margin: 18px 0 0;
    color: var(--auth-muted);
    font-size: 13px;
    text-align: center;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.cf-turnstile {
    margin-bottom: 16px;
}

@media (max-width: 820px) {
    .auth-page {
        align-items: start;
        padding: 14px;
    }

    .auth-shell {
        max-width: 620px;
    }

    .auth-header {
        min-height: 58px;
        padding: 12px 18px;
    }

    .auth-body {
        min-height: 0;
        grid-template-columns: 1fr;
        grid-template-areas:
            "form"
            "intro";
    }

    .auth-form-panel {
        padding: 28px 24px;
    }

    .auth-intro {
        padding: 28px 24px;
        border-top: 1px solid var(--auth-border);
        border-right: 0;
    }

    .auth-intro-heading {
        font-size: 25px;
    }

    .auth-services {
        margin-top: 24px;
        padding-top: 20px;
    }
}

@media (max-width: 560px) {
    .auth-page {
        padding: 0;
    }

    .auth-shell {
        border-right: 0;
        border-left: 0;
        border-radius: 0;
    }

    .auth-header-link {
        font-size: 13px;
    }

    .auth-brand {
        font-size: 17px;
    }

    .auth-form-panel,
    .auth-intro {
        padding: 24px 18px;
    }

    .auth-title {
        font-size: 28px;
    }

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

    .auth-field-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .auth-row {
        align-items: flex-start;
    }

    .auth-services-list {
        gap: 8px;
    }

    .auth-service-icon {
        width: 42px;
        height: 42px;
        font-size: 21px;
    }

    .auth-service {
        font-size: 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
    }
}
