:root {
    --mp-login-visual: #4f6f82;
    --mp-login-visual-dark: #3d5868;
    --mp-login-visual-floor: #d8dde3;
    --mp-login-accent: #e8872a;
    --mp-login-accent-hover: #f09838;
    --mp-login-bg: #e8edf2;
    --mp-login-surface: #fff;
    --mp-login-text: #334155;
    --mp-login-border: #cbd5e1;
    --mp-login-radius: 16px;
    --mp-login-info: #2563eb;
    --mp-login-info-bg: #eff6ff;
    --mp-login-warning: #b45309;
    --mp-login-warning-bg: #fffbeb;
    --mp-login-error: #dc2626;
    --mp-login-error-bg: #fef2f2;
    /* Компактная карточка: форма и персонаж масштабируются вместе */
    --mp-login-panel-height: 380px;
    --mp-login-mascot-max-height: 280px;
    --mp-login-mascot-scale: 1.2;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.login-page {
    font-family: "Trebuchet MS", Arial, sans-serif;
    background: var(--mp-login-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    color: var(--mp-login-text);
}

.login-shell {
    width: 100%;
    max-width: 820px;
}

.login-panel {
    display: flex;
    height: var(--mp-login-panel-height);
    max-height: var(--mp-login-panel-height);
    align-items: stretch;
    background: var(--mp-login-surface);
    border-radius: var(--mp-login-radius);
    overflow: hidden;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
}

.login-panel__visual {
    flex: 0 0 44%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 22px 20px 0;
    color: #fff;
    background: linear-gradient(
        180deg,
        var(--mp-login-visual) 0%,
        var(--mp-login-visual-dark) 68%,
        var(--mp-login-visual-floor) 68%,
        var(--mp-login-visual-floor) 100%
    );
}

.login-brand {
    text-align: center;
    z-index: 1;
    color: #fff;
}

.login-brand__title {
    padding: 0;
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: 0.01em;
    color: #fff;
}

.login-brand__version {
    margin-top: 4px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #fff;
}

.login-mascot {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-top: 4px;
    min-height: 0;
}

.login-mascot__img {
    display: block;
    width: auto;
    height: auto;
    max-width: 108%;
    max-height: var(--mp-login-mascot-max-height);
    object-fit: contain;
    object-position: bottom center;
    transform: scale(var(--mp-login-mascot-scale));
    transform-origin: bottom center;
}

.login-mascot--placeholder {
    min-height: 220px;
    background: url(/img/login-form-min.png) no-repeat center bottom;
    background-size: 130% auto;
    opacity: 0.35;
    filter: grayscale(0.2);
}

.login-panel__form {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px 28px;
    background: var(--mp-login-surface);
}

.auth-form-panel {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

form.maxpro-auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-alerts:empty {
    display: none;
}

.auth-greeting {
    margin: 0 0 4px;
    font-size: 20px;
    line-height: 1.35;
    font-weight: 500;
    color: var(--mp-login-text);
    text-align: left;
}

.auth-greeting strong {
    font-weight: 600;
}

.auth-alert {
    margin: 0;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.45;
    text-align: left;
    border-left: 3px solid transparent;
}

.auth-alert--info {
    color: var(--mp-login-info);
    background: var(--mp-login-info-bg);
    border-left-color: var(--mp-login-info);
}

.auth-alert--warning {
    color: var(--mp-login-warning);
    background: var(--mp-login-warning-bg);
    border-left-color: var(--mp-login-warning);
}

.auth-alert--error {
    color: var(--mp-login-error);
    background: var(--mp-login-error-bg);
    border-left-color: var(--mp-login-error);
}

.auth-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.maxpro-field__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.maxpro-field__control {
    position: relative;
}

.maxpro-field__icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #64748b;
    pointer-events: none;
}

.maxpro-field__icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

form.maxpro-auth-form input.maxpro-field__input,
form.maxpro-auth-form input {
    width: 100%;
    padding: 10px 12px 10px 40px;
    border: 1px solid var(--mp-login-border);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.35;
    color: #0f172a;
    background: #fff;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

form.maxpro-auth-form input::placeholder {
    color: #94a3b8;
}

form.maxpro-auth-form input:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

form.maxpro-auth-form select.maxpro-field__input,
form.maxpro-auth-form select.maxpro-field__select {
    width: 100%;
    padding: 10px 36px 10px 40px;
    border: 1px solid var(--mp-login-border);
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.35;
    font-family: inherit;
    color: #0f172a;
    background-color: #fff;
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, color 0.15s ease;
}

/* Пустое значение — паттерн base-select--empty (vue-webpack SelectForm.vue) */
form.maxpro-auth-form select.maxpro-field__select--empty {
    color: #999;
    border-color: #ccc;
}

form.maxpro-auth-form select.maxpro-field__select--chosen {
    color: #0f172a;
    border-color: var(--mp-login-border);
}

form.maxpro-auth-form select.maxpro-field__input:hover,
form.maxpro-auth-form select.maxpro-field__select:hover {
    border-color: #94a3b8;
}

form.maxpro-auth-form select.maxpro-field__select--empty:hover {
    border-color: #b0b8c4;
}

form.maxpro-auth-form select.maxpro-field__input:focus,
form.maxpro-auth-form select.maxpro-field__select:focus {
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
    color: #0f172a;
}

form.maxpro-auth-form select.maxpro-field__input option,
form.maxpro-auth-form select.maxpro-field__select option {
    color: #0f172a;
}

.maxpro-field--select .maxpro-field__chevron {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: #64748b;
    pointer-events: none;
}

.maxpro-field--select .maxpro-field__chevron svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.maxpro-field--select .maxpro-field__control:focus-within .maxpro-field__chevron {
    color: #3b82f6;
}

form.maxpro-auth-form input[readonly] {
    background: #f8fafc;
    color: #64748b;
}

.maxpro-auth-form__submit {
    width: 100%;
    margin-top: 2px;
    padding: 11px 16px;
    background: var(--mp-login-accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    box-shadow: 0 6px 16px rgba(232, 135, 42, 0.35);
}

.maxpro-auth-form__submit:hover {
    background: var(--mp-login-accent-hover);
}

.maxpro-auth-form__submit:active {
    transform: translateY(1px);
}

.maxpro-auth-form__submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

form.maxpro-auth-form--pending .maxpro-field__input,
form.maxpro-auth-form--pending .maxpro-field__select,
form.maxpro-auth-form--pending .maxpro-checkbox {
    pointer-events: none;
    opacity: 0.85;
}

li.text-error-small {
    color: var(--mp-login-error);
    font-size: 13px;
    text-align: left;
    list-style: none;
    margin-bottom: 8px;
}

@media (max-width: 720px) {
    body.login-page {
        align-items: flex-start;
        padding-top: 12px;
    }

    .login-panel {
        flex-direction: column;
        height: auto;
        max-height: none;
    }

    .login-panel__visual {
        flex: 0 0 auto;
        padding: 20px 16px 0;
    }

    .login-mascot,
    .login-mascot--placeholder {
        min-height: 120px;
    }

    .login-mascot__img {
        max-height: 180px;
        --mp-login-mascot-scale: 1;
    }

    .login-panel__form {
        padding: 18px 16px 22px;
    }
}

.maxpro-field--checkbox {
    margin-top: 4px;
}

.maxpro-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
    user-select: none;
}

.maxpro-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: var(--mp-login-accent);
}

.auth-form-panel--enroll {
    max-width: 300px;
}

/* Шаг с QR выше обычной формы: карточка 380px не вмещает, растягиваем */
.login-panel:has(.auth-form-panel--enroll) {
    height: auto;
    max-height: none;
    min-height: var(--mp-login-panel-height);
}

.login-panel:has(.auth-form-panel--enroll) .login-panel__form {
    justify-content: flex-start;
    padding: 16px 24px 20px;
}

.login-panel:has(.auth-form-panel--enroll) form.maxpro-auth-form {
    gap: 8px;
}

.login-panel:has(.auth-form-panel--enroll) .auth-alert {
    padding: 8px 10px;
    font-size: 12px;
}

.login-panel:has(.auth-form-panel--enroll) .login-mascot__img {
    max-height: 220px;
}

.auth-totp-qr {
    display: flex;
    justify-content: center;
    min-height: 140px;
}

.auth-totp-qr img,
.auth-totp-qr canvas {
    display: block;
}
