.auth-body {
    min-height: 100vh;
    margin: 0;
    background: var(--soft);
    color: var(--ink);
    font-family: var(--app-font);
}

.auth-language-control {
    position: absolute;
    top: 16px;
    right: 20px;
    z-index: 3;
}

.auth-language-control select {
    width: 184px;
    height: 32px;
    padding: 4px 8px;
    border: 1px solid var(--auth-input-border);
    border-radius: 6px;
    background: var(--app-field-bg);
    color: var(--blue-dark);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.auth-language-control select:focus-visible {
    outline: 2px solid var(--auth-focus-outline);
    outline-offset: 2px;
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(460px, 1fr) minmax(420px, 520px);
    overflow: hidden;
}

.auth-brand-panel,
.auth-form-panel {
    min-width: 0;
}

.auth-brand-panel {
    position: relative;
    display: grid;
    align-items: center;
    padding: 56px clamp(38px, 6vw, 94px);
    color: var(--ink);
    background: url("endosoft_assets/backgrounds/login-blue-wave.png?v=1") center / cover no-repeat;
}

.auth-brand-panel::after {
    content: "";
    position: absolute;
    top: -10vh;
    right: -82px;
    bottom: -10vh;
    width: 170px;
    background: var(--soft);
    transform: skewX(-9deg);
    transform-origin: center;
    box-shadow: var(--auth-divider-shadow);
    z-index: 0;
}

.auth-product {
    position: relative;
    z-index: 1;
    width: min(100%, 680px);
    display: grid;
    place-items: center;
    justify-self: center;
}

.auth-logo {
    width: 414px;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0;
    filter: var(--auth-logo-shadow);
}

.auth-form-panel {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: center;
    padding: 42px clamp(28px, 4vw, 54px);
    background: var(--soft);
}

.auth-form-card {
    width: 100%;
    max-width: 420px;
    justify-self: center;
}

.auth-copy {
    margin-bottom: 24px;
}

.auth-copy h2 {
    margin: 0 0 8px;
    color: var(--auth-heading);
    font-size: 29px;
    line-height: 1.16;
    font-weight: 600;
}

.auth-copy p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.auth-form {
    display: grid;
    gap: 15px;
}

/* Reserve one compact feedback line so messages leave the form in place. */
.auth-form::after {
    content: "";
    height: 20px;
    margin-block: -7px;
    order: 1;
}

.auth-form:has(> .auth-message)::after {
    display: none;
}

.auth-form label {
    display: grid;
    gap: 7px;
}

.auth-form label > span:first-child {
    color: var(--auth-label);
    font-size: 13px;
    font-weight: 600;
}

.auth-form input {
    width: 100%;
    min-height: 48px;
    padding: 0 14px;
    border: 1px solid var(--auth-input-border);
    border-radius: 10px;
    background: var(--app-field-bg);
    color: var(--ink);
    font: inherit;
    /* Match the browser's saved-login preview before the first interaction. */
    font: -webkit-small-control;
    box-shadow: var(--auth-input-shadow);
}

.auth-form input:focus {
    outline: none;
    border-color: var(--app-primary-border);
    box-shadow: 0 0 0 3px var(--auth-focus-ring);
}

.password-field {
    position: relative;
    display: block;
}

.password-field input {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--auth-muted-link);
    cursor: pointer;
}

.password-toggle:hover,
.password-toggle:focus-visible {
    background: var(--auth-control-hover-bg);
    color: var(--blue-dark);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--auth-focus-outline);
    outline-offset: 1px;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.password-toggle .eye-closed {
    display: none;
}

.password-toggle[aria-pressed="true"] .eye-open {
    display: none;
}

.password-toggle[aria-pressed="true"] .eye-closed {
    display: block;
}

.auth-message {
    height: 20px;
    margin-block: -7px;
    overflow-y: auto;
    order: 1;
    padding: 0;
    font-size: 13px;
    line-height: 1.4;
}

.auth-message.error {
    color: var(--auth-error-text);
}

.auth-message.success {
    color: var(--auth-success-text);
}

.auth-recovery-form::after {
    height: 5.6em;
    font-size: 13px;
}

.auth-recovery-form > .auth-message {
    height: auto;
    min-height: 5.6em;
    overflow: visible;
}

.auth-submit {
    order: 2;
    min-height: 48px;
    margin-top: 4px;
    border: 1px solid var(--auth-submit-border);
    border-radius: 10px;
    background: var(--auth-submit-bg);
    color: var(--app-on-dark);
    font: inherit;
    font-weight: 650;
    cursor: pointer;
    box-shadow: var(--auth-submit-shadow);
}

.auth-submit:hover {
    background: var(--auth-submit-hover-bg);
    box-shadow: var(--auth-submit-hover-shadow);
}

.auth-submit:disabled {
    background: var(--muted);
    border-color: var(--muted);
    box-shadow: none;
    cursor: wait;
}

.auth-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    color: var(--muted);
    font-size: 13px;
}

.auth-links.single {
    justify-content: flex-start;
}

.auth-links form {
    display: contents;
}

.auth-text-links {
    justify-content: flex-end;
    margin-top: 13px;
}

.auth-links.auth-text-links :is(a, button) {
    min-height: auto;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--blue);
    font-size: 13px;
    font-weight: 600;
    box-shadow: none;
}

.auth-links.auth-text-links :is(a, button):hover {
    background: transparent;
    text-decoration: underline;
}

.auth-links :is(a, button) {
    font: inherit;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    border: 1px solid var(--auth-input-border-soft);
    border-radius: 10px;
    background: var(--auth-link-bg);
    color: var(--blue-dark);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.auth-links :is(a, button):hover {
    border-color: var(--auth-link-hover-border);
    background: var(--app-field-bg);
}

.auth-footer {
    align-self: end;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px 14px;
    margin-top: 28px;
    color: var(--auth-footer-text);
    font-size: 12px;
    line-height: 1.4;
    text-align: center;
}

.auth-footer a {
    color: var(--blue-dark);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-footer > [data-i18n] {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.auth-footer-links {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px 14px;
}

@media (min-width: 981px) {
    .auth-footer {
        /* Reserve two rows without moving the English form or footer baseline. */
        min-height: calc(2.8em + 8px);
        margin-top: calc(28px - 1.4em - 8px);
        align-content: flex-end;
    }
}

.auth-version {
    position: fixed;
    right: 10px;
    bottom: 8px;
    color: var(--auth-version-text);
    font-size: 11px;
}

@media (max-width: 980px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

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

    .auth-brand-panel::after {
        display: none;
    }

    .auth-logo {
        width: 224px;
    }

    .auth-form-panel {
        align-items: start;
        min-height: 52vh;
        box-shadow: var(--auth-mobile-panel-shadow);
    }

    .auth-footer {
        justify-content: flex-start;
        text-align: left;
    }
}

@media (max-width: 560px) {
    .auth-brand-panel {
        padding: 24px 20px 20px;
    }

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

    .auth-links {
        flex-wrap: wrap;
    }

}

.auth-translation-box {
    height: var(--auth-translation-height);
    min-height: 0;
    overflow: clip;
    /* Preserve glyph overhang without changing the fixed layout or scrolling. */
    overflow-clip-margin: .2em;
}

.auth-copy h2.auth-translation-box {
    white-space: nowrap;
    text-overflow: ellipsis;
}
