:root {
    --auth-navy: #252a78;
    --auth-navy-dark: #181d5b;
    --auth-red: #ed1c2b;
    --auth-ink: #202534;
    --auth-muted: #616978;
    --auth-line: #d9dde5;
    --auth-paper: #ffffff;
    --auth-canvas: #f3f4f6;
    --auth-danger: #b42318;
    --auth-danger-soft: #fff4f2;
}

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

html {
    min-width: 320px;
    background: var(--auth-canvas);
}

body {
    margin: 0;
    min-height: 100dvh;
    color: var(--auth-ink);
    background:
        linear-gradient(90deg, var(--auth-navy) 0 8px, var(--auth-red) 8px 13px, transparent 13px),
        var(--auth-canvas);
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(270px, 36%) minmax(0, 1fr);
    width: min(1080px, calc(100% - 48px));
    min-height: 620px;
    margin: 48px auto;
    overflow: hidden;
    background: var(--auth-paper);
    border: 1px solid #cfd3dc;
    box-shadow: 0 16px 40px rgb(24 29 91 / 8%);
}

.auth-identity {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 42px;
    background: #f8f8fa;
    border-right: 1px solid var(--auth-line);
}

.auth-identity::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 6px;
    background: linear-gradient(90deg, var(--auth-navy) 0 68%, var(--auth-red) 68%);
}

.auth-logo {
    display: block;
    width: 156px;
    height: 156px;
    object-fit: contain;
    object-position: left center;
    margin: 12px 0 32px;
}

.auth-agency {
    margin: 0;
    color: var(--auth-navy-dark);
    font-family: "IBM Plex Serif", Georgia, serif;
    font-size: clamp(1.7rem, 3vw, 2.25rem);
    font-weight: 600;
    line-height: 1.12;
}

.auth-description {
    max-width: 30ch;
    margin: 14px 0 0;
    color: var(--auth-muted);
    font-size: 0.94rem;
}

.auth-note {
    margin-top: auto;
    padding-top: 32px;
    color: #4c5361;
    font-size: 0.82rem;
}

.auth-note strong {
    display: block;
    margin-bottom: 5px;
    color: var(--auth-navy-dark);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.auth-steps {
    display: grid;
    gap: 16px;
    margin: 34px 0 0;
    padding: 0;
    list-style: none;
}

.auth-step {
    display: grid;
    grid-template-columns: 28px 1fr;
    gap: 11px;
    align-items: start;
    color: #535b69;
    font-size: 0.84rem;
}

.auth-step-number {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    color: var(--auth-navy);
    background: #fff;
    border: 1px solid #bfc4d0;
    font-size: 0.74rem;
    font-weight: 700;
}

.auth-content {
    display: flex;
    align-items: center;
    padding: 56px clamp(36px, 7vw, 82px);
}

.auth-content--register {
    align-items: flex-start;
}

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

.auth-kicker {
    margin: 0 0 10px;
    color: var(--auth-red);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.auth-title {
    margin: 0;
    color: var(--auth-navy-dark);
    font-family: "IBM Plex Serif", Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 2.45rem);
    font-weight: 600;
    line-height: 1.16;
}

.auth-subtitle {
    margin: 10px 0 30px;
    color: var(--auth-muted);
    font-size: 0.94rem;
}

.auth-alert {
    display: flex;
    gap: 11px;
    margin-bottom: 24px;
    padding: 13px 15px;
    color: var(--auth-danger);
    background: var(--auth-danger-soft);
    border: 1px solid #f3b7b1;
    font-size: 0.84rem;
}

.auth-alert-icon {
    flex: 0 0 auto;
    font-weight: 700;
}

.auth-section {
    margin: 28px 0 16px;
    padding-bottom: 8px;
    color: var(--auth-navy-dark);
    border-bottom: 1px solid var(--auth-line);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.auth-section:first-child {
    margin-top: 0;
}

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

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

.auth-label {
    display: block;
    margin-bottom: 7px;
    color: #343b49;
    font-size: 0.82rem;
    font-weight: 600;
}

.auth-required {
    color: var(--auth-red);
}

.auth-input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    color: var(--auth-ink);
    background: #fff;
    border: 1px solid #bfc4ce;
    border-radius: 2px;
    outline: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.auth-input::placeholder {
    color: #9298a3;
}

.auth-input:hover {
    border-color: #858c99;
}

.auth-input:focus {
    border-color: var(--auth-navy);
    box-shadow: 0 0 0 3px rgb(37 42 120 / 14%);
}

.auth-input.is-invalid {
    border-color: var(--auth-danger);
}

.auth-input--code {
    color: var(--auth-navy-dark);
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.auth-hint {
    margin: 6px 0 0;
    color: #737a87;
    font-size: 0.76rem;
}

.auth-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 24px;
}

.auth-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #555d6b;
    font-size: 0.82rem;
    cursor: pointer;
}

.auth-check input {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-navy);
}

.auth-submit {
    width: 100%;
    min-height: 48px;
    padding: 11px 18px;
    color: #fff;
    background: var(--auth-navy);
    border: 1px solid var(--auth-navy);
    border-radius: 2px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

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

.auth-submit:focus-visible {
    outline: 3px solid rgb(237 28 43 / 28%);
    outline-offset: 3px;
}

.auth-switch {
    margin: 24px 0 0;
    padding-top: 20px;
    color: var(--auth-muted);
    border-top: 1px solid var(--auth-line);
    font-size: 0.86rem;
    text-align: center;
}

.auth-link {
    color: var(--auth-navy);
    font-weight: 700;
    text-underline-offset: 3px;
}

.auth-link:hover {
    color: var(--auth-red);
}

@media (max-width: 780px) {
    body {
        background: var(--auth-canvas);
    }

    .auth-shell {
        grid-template-columns: 1fr;
        width: min(100% - 28px, 560px);
        min-height: 0;
        margin: 14px auto;
    }

    .auth-identity {
        display: grid;
        grid-template-columns: 76px 1fr;
        gap: 16px;
        padding: 28px 24px 24px;
        border-right: 0;
        border-bottom: 1px solid var(--auth-line);
    }

    .auth-logo {
        width: 76px;
        height: 76px;
        margin: 0;
        grid-row: span 2;
    }

    .auth-agency {
        align-self: end;
        font-size: 1.35rem;
    }

    .auth-description {
        margin-top: 4px;
        font-size: 0.82rem;
    }

    .auth-steps,
    .auth-note {
        display: none;
    }

    .auth-content {
        padding: 34px 24px 38px;
    }
}

@media (max-width: 520px) {
    .auth-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

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

/* ── loading state ─────────────────────────────────────── */
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.btn-spinner {
    display: inline-block;
    width: 0.9em;
    height: 0.9em;
    margin-right: 0.35em;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    vertical-align: -0.15em;
    animation: btn-spin 0.65s linear infinite;
}

.auth-submit.is-loading {
    opacity: 0.78;
    cursor: not-allowed;
}

.auth-input:disabled,
.auth-input.is-loading-field {
    background: #f0f1f4;
    color: #8a8f9a;
    cursor: not-allowed;
}
