:root {
    --azul-profundo: #03174b;
    --azul-botao:    #1e2447;
    --azul-ativo:    #007ab2;
    --azul-link:     #0079ad;
    --azul-primeiro: #5063ce;
    --cinza-texto:   #333333;
    --cinza-label:   #666666;
    --cinza-input:   #6e6e6e;
    --cinza-borda:   #8192a2;
    --cinza-aba:     #8192a2;
    --cinza-fundo:   #f5f5f5;
    --branco:        #ffffff;
    --erro:          #e42618;

    --raio:          4px;
    --transicao:     180ms ease;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Open Sans', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.42857143;
    color: var(--cinza-texto);
    background-color: var(--azul-profundo);
    background-image:
        linear-gradient(rgba(3, 23, 75, 0.55), rgba(3, 23, 75, 0.75)),
        url("../img/bg-navegador.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
}

img { max-width: 100%; height: auto; vertical-align: middle; }

a { color: var(--azul-link); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--azul-profundo);
    color: #fff;
    padding: 10px 16px;
    border-radius: 0 0 var(--raio) 0;
    z-index: 1000;
}
.skip-link:focus { left: 0; }

/* ===== Logo ===== */
.topo {
    padding-top: 100px;
    text-align: center;
    font-size: 0;
    white-space: nowrap;
}
.logo { white-space: nowrap; }
.safra-logo-novo {
    position: relative;
    z-index: 999;
    display: inline-block;
    outline: none;
    cursor: pointer;
}
.safra-logo-novo:focus-visible {
    outline: 2px solid var(--azul-ativo);
    outline-offset: 6px;
    border-radius: 4px;
}
.safra-logo-novo img { display: block; margin: auto; }

/* ===== Conteúdo ===== */
.conteudo {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== Caixa de login ===== */
.login {
    width: 424px;
    max-width: calc(100% - 24px);
    background: var(--branco);
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    margin: 48px auto 0;
    position: relative;
    padding: 36px 40px 32px;
}

.login__barra {
    width: 60%;
    height: 11px;
    margin: 0 auto;
    background: var(--azul-profundo);
}
.login__barra:first-of-type { margin-bottom: 40px; }
.login__barra:last-of-type  { margin-top: 27px; }

.login__titulo {
    color: var(--azul-profundo);
    font-size: 24px;
    letter-spacing: 0;
    line-height: 33px;
    font-weight: 700;
    text-align: center;
    margin: 0 0 20px;
}

/* ===== Abas ===== */
.abas ul {
    list-style: none;
    margin: 0 0 20px;
    padding: 0;
    text-align: center;
    border-bottom: 1px solid #eee;
}
.abas__item {
    display: inline-block;
    vertical-align: middle;
    margin: 0 7px;
    font-size: 14px;
    letter-spacing: 0;
    line-height: 19px;
    color: var(--cinza-aba);
    cursor: pointer;
    transition: color var(--transicao);
}
.abas__item span {
    display: block;
    padding-bottom: 4px;
    border-bottom: 4px solid var(--branco);
    transition: border-color var(--transicao);
}
.abas__item--ativo { color: var(--azul-ativo); }
.abas__item--ativo span { border-color: var(--azul-ativo); }
.abas__item:focus-visible { outline: 2px solid var(--azul-ativo); outline-offset: 2px; }

/* ===== Formulário ===== */
.form-acesso[hidden] { display: none; }

.campo {
    position: relative;
    margin-bottom: 20px;
}
.campo label {
    display: block;
    margin-bottom: 5px;
    font-size: 13px;
    font-weight: 400;
    color: var(--cinza-label);
}
.campo input {
    width: 100%;
    padding: 10px;
    font-size: 14px;
    color: var(--cinza-input);
    background: transparent;
    border: 1px solid var(--cinza-borda);
    border-radius: var(--raio);
    transition: border-color var(--transicao), box-shadow var(--transicao);
}
.campo input::placeholder { color: #aab2bd; }
.campo input:focus {
    outline: none;
    border-color: var(--azul-ativo);
    box-shadow: 0 0 0 3px rgba(0, 122, 178, 0.15);
}

/* Ícone mostrar senha (cut-eye) */
.campo__olho {
    position: absolute;
    top: 33px;
    right: 8px;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.campo__olho-icone {
    display: block;
    width: 22px;
    height: 22px;
    background: url("../img/cut-eye-blue.svg") center / contain no-repeat;
}

.campo__rodape {
    margin-top: 8px;
    text-align: left;
}
.link-esqueci {
    color: var(--azul-link);
    font-size: 12px;
    letter-spacing: 0;
    line-height: 17px;
    text-decoration: underline;
}

.mensagem-erro {
    color: var(--erro);
    font-size: 13px;
    margin: 16px 0 24px;
}
.mensagem-erro[hidden] { display: none; }
.mensagem-erro.mensagem-sucesso { color: #1f9d6b; }

/* ===== Botão ===== */
.form-acesso__acao { text-align: center; }

.btn {
    display: inline-block;
    width: 45%;
    height: 40px;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    text-align: center;
    border: 1px solid transparent;
    border-radius: 2px;
    cursor: pointer;
    transition: background var(--transicao), opacity var(--transicao), box-shadow var(--transicao);
}
.btn--primario {
    color: #fff;
    background: var(--azul-botao);
    box-shadow: 0 1px 5px 0 rgba(102, 102, 102, 0.5);
}
.btn--primario:hover { background: #0f1223; }
.btn--primario:active { background: #04050a; }
.btn--primario:disabled {
    background: #e9e9e9;
    color: #787878;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 1;
}
.btn--secundario {
    color: var(--azul-botao);
    background: transparent;
    border-color: var(--azul-botao);
}
.btn--secundario:hover { background: rgba(30, 36, 71, 0.06); }

.form-acesso__acao--duplo {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.form-acesso__acao--duplo .btn { width: auto; min-width: 120px; }

/* ===== Etapas (login / token / senha) ===== */
.etapa[hidden] { display: none; }
.etapa { animation: surgir 200ms ease both; }
@keyframes surgir {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.etapa__descricao {
    margin: 0 0 22px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--cinza-label);
    text-align: center;
}

/* Caixas de código (token e senha de 4 dígitos) */
.campo--codigo {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}
.codigo__caixa {
    width: 46px;
    height: 54px;
    padding: 0;
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--cinza-input);
    background: #fff;
    border: 1px solid var(--cinza-borda);
    border-radius: var(--raio);
    transition: border-color var(--transicao), box-shadow var(--transicao);
}
.codigo__caixa:focus {
    outline: none;
    border-color: var(--azul-ativo);
    box-shadow: 0 0 0 3px rgba(0, 122, 178, 0.15);
}
.codigo__caixa--preenchida { border-color: var(--azul-ativo); }

.campo--codigo-4 { gap: 14px; }
.campo--codigo-4 .codigo__caixa { width: 54px; }

@media (max-width: 380px) {
    .campo--codigo { gap: 6px; }
    .codigo__caixa { width: 40px; height: 50px; font-size: 20px; }
}

/* ===== Primeiro acesso / política ===== */
.primeiro-acesso {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 271px;
    max-width: 100%;
    margin: 27px auto 0;
    font-weight: 400;
    font-size: 16px;
    line-height: 22px;
}
.primeiro-acesso span { color: #374280; }
.primeiro-acesso a {
    color: var(--azul-primeiro);
    text-decoration: underline;
    cursor: pointer;
}

.politica {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 271px;
    max-width: 100%;
    margin: 20px auto 0;
    font-weight: 400;
    font-size: 16px;
    line-height: 22px;
}
.politica span { color: #ffffff; }
.politica a {
    color: #aeb9ff;
    text-decoration: underline;
    cursor: pointer;
}

/* ===== Rodapé ===== */
.rodape {
    flex-shrink: 0;
    text-align: center;
    padding: 24px 16px;
    color: #8b94a3;
}

@media (max-width: 480px) {
    .login { padding: 0 20px; }
    .topo { padding-top: 56px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}

/* ===== Loading overlay ===== */
.is-hidden { display: none !important; }

.overlay-loading {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.overlay-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 36px 42px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.90);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.12);
}

.overlay-loading-box p {
    margin: 0;
    color: #03174b;
    font-size: 14px;
    font-weight: 600;
}

.loading-ring {
    width: 48px;
    height: 48px;
    border: 4px solid #d0d7e3;
    border-top-color: #03174b;
    border-radius: 50%;
    animation: safra-spin 1s linear infinite;
}

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

/* ===== Tela aguardando (inicial) ===== */
.aguardando-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 48px 24px;
    text-align: center;
    min-height: 260px;
}

.aguardando-titulo {
    font-size: 1.25rem;
    font-weight: 700;
    color: #03174b;
    margin: 0;
}

.aguardando-msg {
    font-size: 0.9rem;
    color: #5a6478;
    margin: 0;
    max-width: 280px;
    line-height: 1.5;
    transition: opacity 0.4s ease;
}
