/* ========== CSS CORRIGIDO (SEM ROLAGEM LATERAL) ========== */
:root {
    --azul-900: #0a2e42;
    --azul-800: #0f4c6b;
    --azul-700: #1c6f9a;
    --azul-600: #2c8fcf;
    --azul-100: #eef8fd;
    --verde-600: #2aa17c;
    --verde-100: #eefaf5;
    --texto: #17384b;
    --texto-suave: #5a7a8e;
    --linha: rgba(15, 76, 107, 0.10);
    --input-borda: #d8e8f1;
    --input-bg: rgba(255, 255, 255, 0.86);
    --erro: #d1453b;
    --sombra-card: 0 24px 60px rgba(12, 71, 104, 0.10);
    --sombra-botao: 0 14px 30px rgba(12, 71, 104, 0.16);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* CORREÇÃO: remove qualquer rolagem horizontal no HTML e no BODY */
html {
    overflow-x: hidden;
    width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    color: var(--texto);
    background:
        radial-gradient(circle at 10% 10%, rgba(44, 143, 207, 0.10), transparent 18%),
        radial-gradient(circle at 88% 14%, rgba(42, 161, 124, 0.08), transparent 16%),
        linear-gradient(180deg, #ffffff 0%, #f5fbff 54%, #eef7fb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    position: relative;
}

body::before,
body::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    pointer-events: none;
    opacity: .35;
}

body::before {
    width: 240px;
    height: 240px;
    background: rgba(44, 143, 207, 0.08);
    left: -90px;
    bottom: -70px;
}

body::after {
    width: 220px;
    height: 220px;
    background: rgba(42, 161, 124, 0.06);
    right: -80px;
    top: -70px;
}

.login-container {
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    animation: fadeSlideUp .45s ease-out;
}

.login-card {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 34px;
    padding: 1.4rem 1.25rem 1.35rem;
    box-shadow: var(--sombra-card);
    backdrop-filter: blur(10px);
    max-width: 100%;
    /* Garante que o card não ultrapasse o container */
    word-wrap: break-word;
    /* Evita que textos longos quebrem o layout */
}

.brand-area {
    text-align: center;
    margin-bottom: .9rem;
}

.logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: .55rem;
}

.logo {
    width: min(170px, 46vw);
    max-width: 100%;
    /* Evita estouro em telas muito pequenas */
    height: auto;
    display: block;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.07));
}

.main-slogan {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    text-align: center;
    font-size: .86rem;
    font-weight: 700;
    color: var(--azul-700);
    background: linear-gradient(180deg, #f7fcff 0%, #edf7fd 100%);
    border: 1px solid rgba(44, 143, 207, 0.12);
    width: auto;
    margin: 0 auto .55rem;
    padding: .42rem .9rem;
    border-radius: 999px;
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.welcome-title {
    font-size: 1.3rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--azul-900);
    letter-spacing: -0.03em;
    margin-bottom: .3rem;
}

.welcome-subtitle {
    font-size: .92rem;
    color: var(--texto-suave);
    line-height: 1.45;
    max-width: 300px;
    margin: 0 auto;
}

.login-form {
    margin-top: 1rem;
}

.form-group {
    margin-bottom: .85rem;
}

.input-icon {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 1.5px solid var(--input-borda);
    border-radius: 18px;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease, transform .2s ease;
    min-height: 56px;
}

.input-icon:focus-within {
    border-color: var(--azul-600);
    box-shadow: 0 0 0 4px rgba(44, 143, 207, 0.12);
    background: #ffffff;
}

.input-icon span {
    width: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    color: #4b8bb4;
    flex-shrink: 0;
}

.input-icon input {
    width: 100%;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    color: #183447;
    font-size: .95rem;
    font-weight: 500;
    padding: .95rem .95rem .95rem 0;
}

.input-icon input::placeholder {
    color: #8ea9bb;
    font-weight: 400;
}

.error-message {
    font-size: .75rem;
    color: var(--erro);
    margin-top: .35rem;
    margin-left: .3rem;
    font-weight: 600;
    display: none;
}

.btn-login {
    background: linear-gradient(105deg, #1179b3, #0a5e8c);
    border: none;
    width: 100%;
    min-height: 54px;
    padding: .85rem 1rem;
    border-radius: 18px;
    font-size: 1rem;
    font-weight: 800;
    color: white;
    font-family: inherit;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
    box-shadow: var(--sombra-botao);
    margin-top: .25rem;
    margin-bottom: 1rem;
}

.btn-login:hover {
    filter: brightness(1.02);
    transform: translateY(-1px);
}

.btn-login:active {
    transform: scale(.985);
}

.btn-login:focus-visible,
.btn-first-access:focus-visible {
    outline: 3px solid rgba(44, 143, 207, 0.20);
    outline-offset: 3px;
}

.first-access-area {
    text-align: center;
    border-top: 1px solid var(--linha);
    padding-top: .95rem;
    margin-top: .1rem;
}

.helper-text {
    color: var(--texto-suave);
    font-size: .84rem;
    margin-bottom: .65rem;
    font-weight: 500;
}

.btn-first-access {
    width: 100%;
    min-height: 52px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border: 1.5px solid rgba(44, 143, 207, 0.22);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.95), rgba(238, 248, 253, 0.92));
    color: var(--azul-700);
    font-weight: 800;
    font-size: .94rem;
    text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.btn-first-access:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 24px rgba(44, 143, 207, 0.12);
    border-color: rgba(44, 143, 207, 0.32);
}

.btn-first-access:active {
    transform: scale(.985);
}

.microcopy {
    margin-top: .75rem;
    text-align: center;
    font-size: .75rem;
    color: #7894a7;
    line-height: 1.35;
}

/* CORREÇÃO: ajustes extras para telas muito pequenas (ex: 320px) */
@media (max-width: 380px) {
    .login-card {
        padding: 1rem .9rem .95rem;
    }

    .logo {
        width: min(138px, 42vw);
    }

    .main-slogan {
        font-size: .75rem;
    }

    .welcome-title {
        font-size: 1.05rem;
    }

    .welcome-subtitle {
        font-size: .8rem;
    }

    .input-icon span {
        width: 42px;
        font-size: 1rem;
    }

    .input-icon input {
        font-size: .88rem;
    }

    .btn-login,
    .btn-first-access {
        font-size: .9rem;
    }
}

/* Mantém o comportamento original em alturas reduzidas */
@media (max-height: 740px) {
    body {
        padding: .7rem;
    }

    .login-card {
        padding: 1.1rem 1rem 1.05rem;
        border-radius: 28px;
    }

    .logo {
        width: min(148px, 40vw);
    }

    .main-slogan {
        font-size: .78rem;
        padding: .36rem .75rem;
        margin-bottom: .45rem;
    }

    .welcome-title {
        font-size: 1.12rem;
        margin-bottom: .2rem;
    }

    .welcome-subtitle {
        font-size: .84rem;
        max-width: 280px;
    }

    .login-form {
        margin-top: .8rem;
    }

    .form-group {
        margin-bottom: .7rem;
    }

    .input-icon {
        min-height: 50px;
    }

    .input-icon input {
        padding-top: .82rem;
        padding-bottom: .82rem;
        font-size: .9rem;
    }

    .btn-login {
        min-height: 50px;
        margin-bottom: .8rem;
    }

    .first-access-area {
        padding-top: .8rem;
    }

    .btn-first-access {
        min-height: 48px;
        font-size: .9rem;
    }

    .microcopy {
        display: none;
    }
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

button,
.btn-first-access {
    cursor: pointer;
}