:root {
    --auth-ink: #111827;
    --auth-muted: #5b677a;
    --auth-soft: #eef2f7;
    --auth-line: #d7dee8;
    --auth-surface: #ffffff;
    --auth-surface-alt: #f8fafc;
    --auth-primary: #0b4f8a;
    --auth-primary-strong: #083965;
    --auth-accent: #c21f32;
    --auth-focus: #f59e0b;
    --auth-danger: #9f1239;
    --auth-danger-bg: #fff1f2;
    --auth-warning: #92400e;
    --auth-warning-bg: #fffbeb;
    --auth-success: #166534;
    --auth-success-bg: #f0fdf4;
    --auth-radius: 8px;
    --auth-shadow: 0 20px 60px rgba(15, 23, 42, 0.14);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body.auth-page {
    min-height: 100dvh;
    margin: 0;
    color: var(--auth-ink);
    background: #f3f6fa;
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
    letter-spacing: 0;
}

body.auth-page a {
    color: var(--auth-primary);
    text-decoration: none;
}

body.auth-page a:hover,
body.auth-page a:focus {
    color: var(--auth-primary-strong);
    text-decoration: underline;
}

.auth-skip {
    position: absolute;
    left: 16px;
    top: 16px;
    z-index: 20;
    transform: translateY(-150%);
    padding: 10px 14px;
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    color: var(--auth-primary-strong);
    box-shadow: var(--auth-shadow);
}

.auth-skip:focus {
    transform: translateY(0);
    outline: 3px solid var(--auth-focus);
    outline-offset: 2px;
}

.auth-shell {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
}

.auth-layout {
    width: min(1120px, 100%);
    min-height: 640px;
    display: grid;
    grid-template-columns: minmax(300px, 0.88fr) minmax(430px, 1.12fr);
    overflow: hidden;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: var(--auth-surface);
    box-shadow: var(--auth-shadow);
}

.auth-layout-compact {
    width: min(1040px, 100%);
    min-height: 570px;
}

.auth-aside {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 36px;
    color: #ffffff;
    background-color: #0a3b68;
    background-image:
        linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
        linear-gradient(0deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 32px 32px;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.auth-brand img {
    width: 74px;
    height: auto;
    flex: 0 0 auto;
    padding: 8px;
    border-radius: var(--auth-radius);
    background: #ffffff;
}

.auth-brand strong {
    display: block;
    max-width: 240px;
    color: #ffffff;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 700;
}

.auth-brand span {
    display: block;
    color: rgba(255, 255, 255, 0.78);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.25;
}

.auth-kicker {
    margin: 0 0 10px;
    color: #ffccd3;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-aside h1 {
    max-width: 430px;
    margin: 0;
    color: #ffffff;
    font-size: 36px;
    line-height: 1.12;
    font-weight: 800;
    letter-spacing: 0;
}

.auth-aside p {
    max-width: 430px;
    margin: 18px 0 0;
    color: rgba(255, 255, 255, 0.82);
    font-size: 16px;
}

.auth-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 28px;
}

.auth-meta-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.auth-meta-item i {
    width: 22px;
    margin-top: 3px;
    color: #ffd3da;
    text-align: center;
}

.auth-meta-item strong,
.auth-meta-item span {
    display: block;
}

.auth-meta-item strong {
    color: #ffffff;
    font-size: 14px;
    line-height: 1.25;
}

.auth-meta-item span {
    margin-top: 2px;
    color: rgba(255, 255, 255, 0.74);
    font-size: 13px;
    line-height: 1.4;
}

.auth-form-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    background: var(--auth-surface);
}

.auth-register .auth-form-panel {
    justify-content: flex-start;
}

.auth-form-header {
    margin-bottom: 24px;
}

.auth-form-header p {
    max-width: 620px;
    margin: 8px 0 0;
    color: var(--auth-muted);
}

.auth-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    color: var(--auth-accent);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.auth-eyebrow i {
    font-size: 14px;
}

.auth-title {
    margin: 0;
    color: var(--auth-ink);
    font-size: 28px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 0;
}

.auth-form {
    width: 100%;
}

.auth-section {
    margin: 0 0 28px;
    padding: 0;
    border: 0;
}

.auth-section + .auth-section {
    padding-top: 26px;
    border-top: 1px solid var(--auth-line);
}

.auth-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    color: var(--auth-primary-strong);
    font-size: 17px;
    font-weight: 800;
}

.auth-section-title i {
    width: 20px;
    color: var(--auth-accent);
    text-align: center;
}

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

.auth-form-grid .auth-field-full,
.auth-field-full {
    grid-column: 1 / -1;
}

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

.auth-field:last-child {
    margin-bottom: 0;
}

.auth-label,
body.auth-page label {
    display: block;
    margin: 0 0 7px;
    color: #273449;
    font-size: 14px;
    font-weight: 700;
}

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

body.auth-page .form-control {
    width: 100%;
    min-height: 48px;
    padding: 11px 13px;
    border: 1px solid #c7d0dc;
    border-radius: var(--auth-radius);
    background: #ffffff;
    color: var(--auth-ink);
    font-size: 16px;
    line-height: 1.35;
    box-shadow: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

body.auth-page select.form-control:not([size]):not([multiple]) {
    height: 48px;
}

body.auth-page .form-control::placeholder {
    color: #8793a6;
}

body.auth-page .form-control:focus {
    border-color: var(--auth-primary);
    outline: 0;
    box-shadow: 0 0 0 3px rgba(11, 79, 138, 0.17);
}

body.auth-page input[type="file"].form-control {
    padding: 8px 10px;
}

body.auth-page input[type="file"]::file-selector-button {
    min-height: 32px;
    margin-right: 12px;
    padding: 6px 12px;
    border: 1px solid #b8c2cf;
    border-radius: 6px;
    background: var(--auth-soft);
    color: #273449;
    font-weight: 700;
    cursor: pointer;
}

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

.auth-password-wrap .form-control {
    padding-right: 50px;
}

.auth-password-toggle {
    position: absolute;
    right: 6px;
    top: 6px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
}

.auth-password-toggle:hover,
.auth-password-toggle:focus {
    background: var(--auth-soft);
    color: var(--auth-primary-strong);
    outline: 0;
}

.auth-helper,
body.auth-page .form-text {
    display: block;
    margin-top: 7px;
    color: var(--auth-muted);
    font-size: 13px;
    line-height: 1.45;
}

body.auth-page .has-danger .form-control,
body.auth-page .form-control.error {
    border-color: var(--auth-danger);
    box-shadow: 0 0 0 3px rgba(159, 18, 57, 0.12);
}

body.auth-page .form-control-feedback,
body.auth-page label.error {
    display: block;
    margin-top: 7px;
    color: var(--auth-danger);
    font-size: 13px;
    font-weight: 700;
}

.auth-alert {
    margin: 0 0 20px;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: var(--auth-radius);
    font-size: 14px;
    font-weight: 650;
}

.auth-alert p {
    margin: 0;
}

.auth-alert a {
    font-weight: 800;
}

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

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

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

.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.auth-actions-centered {
    justify-content: center;
}

.auth-button {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 18px;
    border: 1px solid transparent;
    border-radius: var(--auth-radius);
    font-size: 15px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: transform 140ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.auth-button:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.auth-button:active {
    transform: translateY(0);
}

.auth-button:focus {
    outline: 3px solid rgba(245, 158, 11, 0.45);
    outline-offset: 2px;
}

.auth-button-primary {
    background: var(--auth-primary);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(11, 79, 138, 0.22);
}

.auth-button-primary:hover,
.auth-button-primary:focus {
    background: var(--auth-primary-strong);
    color: #ffffff;
}

.auth-button-secondary {
    border-color: #c7d0dc;
    background: #ffffff;
    color: var(--auth-primary-strong);
}

.auth-button-secondary:hover,
.auth-button-secondary:focus {
    border-color: var(--auth-primary);
    background: #f8fbff;
    color: var(--auth-primary-strong);
}

.auth-link {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
}

.auth-divider {
    height: 1px;
    margin: 28px 0;
    background: var(--auth-line);
}

.auth-secondary-box {
    margin-top: 28px;
    padding: 18px;
    border: 1px solid var(--auth-line);
    border-radius: var(--auth-radius);
    background: var(--auth-surface-alt);
}

.auth-secondary-box p {
    margin: 0 0 12px;
    color: var(--auth-muted);
    font-size: 14px;
}

.auth-footer {
    margin-top: 30px;
    padding-top: 18px;
    border-top: 1px solid var(--auth-line);
    color: var(--auth-muted);
    font-size: 13px;
}

.auth-footer small {
    display: block;
    color: var(--auth-muted);
}

.auth-footer p {
    margin: 6px 0 0;
}

.auth-footer a {
    font-weight: 700;
}

.auth-register .auth-layout {
    width: min(1180px, 100%);
    min-height: 720px;
    grid-template-columns: minmax(290px, 0.78fr) minmax(520px, 1.22fr);
}

.auth-register .auth-aside {
    min-height: 720px;
}

.auth-register .auth-form-panel {
    padding: 34px 40px;
}

.auth-register .auth-actions {
    margin-top: 10px;
}

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

.auth-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

.auth-button.is-loading .auth-loader {
    display: inline-block;
}

.auth-button.is-loading i:not(.auth-loader) {
    display: none;
}

@keyframes auth-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 920px) {
    .auth-shell {
        align-items: stretch;
        padding: 20px;
    }

    .auth-layout,
    .auth-register .auth-layout {
        min-height: 0;
        grid-template-columns: 1fr;
    }

    .auth-aside,
    .auth-register .auth-aside {
        min-height: 0;
        padding: 28px;
    }

    .auth-aside h1 {
        font-size: 30px;
    }

    .auth-meta {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .auth-form-panel,
    .auth-register .auth-form-panel {
        padding: 30px 28px;
    }
}

@media (max-width: 620px) {
    body.auth-page {
        background: var(--auth-surface);
    }

    .auth-shell {
        padding: 0;
    }

    .auth-layout,
    .auth-register .auth-layout {
        width: 100%;
        min-height: 100dvh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-aside,
    .auth-register .auth-aside {
        padding: 22px;
    }

    .auth-brand img {
        width: 60px;
    }

    .auth-aside h1 {
        font-size: 26px;
    }

    .auth-aside p {
        font-size: 15px;
    }

    .auth-meta {
        grid-template-columns: 1fr;
        margin-top: 18px;
    }

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

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

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

    .auth-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .auth-actions-centered {
        flex-direction: column;
    }

    .auth-button,
    .auth-link {
        width: 100%;
        justify-content: center;
    }

    .auth-secondary-box {
        padding: 16px;
    }
}

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