@media (max-width: 1023px) {
    html,
    body {
        width: 100%;
        min-height: 100%;
        overflow-x: clip;
    }

    .login-screen {
        box-sizing: border-box;
        width: 100%;
        min-height: 100vh;
        min-height: 100dvh;
        padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    }

    .login-screen > div {
        gap: 0;
    }

    .login-content {
        min-width: 0;
    }

    .login-hero {
        padding-bottom: 8px;
    }

    .login-logo {
        display: block;
        width: clamp(140px, 42vw, 200px);
        max-height: 100px;
        height: auto;
        margin-bottom: 4px;
        object-fit: contain;
    }

    .login-hero > div:nth-child(2) {
        gap: 8px;
    }

    .login-hero h2,
    .login-hero #heroIcon {
        font-size: 22px;
        line-height: 26px;
    }

    .login-hero > div:last-child {
        height: 25px;
        margin-top: 0;
    }

    .login-hero #heroText {
        font-size: 17px;
    }

    .login-card {
        padding: 12px 14px;
    }

    .login-card > div:first-child {
        margin-bottom: 8px;
    }

    .login-card > div:first-child h2 {
        font-size: 24px;
        line-height: 28px;
    }

    .login-card > div:first-child p {
        margin-top: 2px;
        font-size: 13px;
        line-height: 18px;
    }

    .login-card #boxTipo {
        padding: 8px 10px;
        margin-bottom: 8px;
    }

    .login-card #tituloTipo {
        font-size: 16px;
        line-height: 20px;
    }

    .login-card #descricaoTipo {
        margin-top: 3px;
        font-size: 12px;
        line-height: 16px;
    }

    .login-field {
        margin-bottom: 6px;
    }

    .login-field > label {
        display: block;
        font-size: 12px;
        line-height: 16px;
    }

    .login-card input[type="email"],
    .login-card input[type="password"],
    .login-card input[type="text"] {
        min-width: 0;
        padding-top: 10px;
        padding-bottom: 10px;
        font-size: 16px;
        line-height: 20px;
    }

    .login-field > div {
        margin-top: 3px;
    }

    .login-remember {
        margin-top: 6px;
        margin-bottom: 6px;
    }

    .login-remember > span {
        font-size: 13px;
    }

    .login-card #btnLogin {
        margin-top: 6px;
        padding-top: 11px;
        padding-bottom: 11px;
        line-height: 20px;
    }

    .login-card #btnLogin + div {
        margin-top: 8px;
        line-height: 18px;
    }

    .login-card > div:last-child {
        margin-top: 5px;
        font-size: 13px;
        line-height: 18px;
    }
}

@media (max-width: 1023px) and (max-height: 700px) {
    .login-logo {
        width: 140px;
        max-height: 64px;
    }

    .login-hero {
        padding-bottom: 4px;
    }

    .login-card {
        padding-top: 9px;
        padding-bottom: 9px;
    }

    .login-card #boxTipo {
        padding-top: 6px;
        padding-bottom: 6px;
    }
}

/* Keep the fields reachable when the virtual keyboard leaves too little space. */
@media (max-width: 1023px) and (max-height: 500px) {
    html,
    body,
    .login-screen {
        height: auto;
        overflow-y: auto;
    }

    .login-screen {
        min-height: 100dvh;
    }
}

/* Touch targets remain usable even on compact screens. */
.login-card #toggleSenha {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    flex-shrink: 0;
    touch-action: manipulation;
}
.login-card a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    text-align: center;
    touch-action: manipulation;
}
.login-remember > label {
    min-height: 44px;
}
.login-remember > label > div::after {
    top: 50%;
    margin-top: -10px;
}
.login-card #btnLogin {
    min-height: 48px;
    touch-action: manipulation;
}
.login-field > div:focus-within {
    border-color: #438128;
    box-shadow: 0 0 0 3px rgb(168 232 95 / 25%);
}
.login-card :is(button, a):focus-visible,
.login-remember > label:has(input:focus-visible) {
    outline: 2px solid #438128;
    outline-offset: 3px;
}
@media (max-width: 1023px) {
    .login-screen > div { min-width: 0; }
    .login-card { border-radius: 24px; }
    .login-card #descricaoTipo { display: none; }
    .login-field input { scroll-margin-block: 24px; }
}
@media (max-width: 1023px) and (max-height: 600px) {
    .login-hero > div { display: none; }
    .login-logo { max-height: 48px; width: 120px; }
}
@media (prefers-reduced-motion: reduce) {
    .login-screen *, .login-screen *::after {
        transition: none !important;
        animation: none !important;
    }
}
