.login-page,
.login-page * {
    box-sizing: border-box;
}

.login-page {
    margin: 0;
    min-width: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(140deg, #8b0000 0%, #650000 58%, #410000 100%);
    color: #fff;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: clip;
    isolation: isolate;
}

.login-page::before,
.login-page::after {
    content: '';
    position: fixed;
    z-index: -1;
    pointer-events: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .055);
}

.login-page::before {
    width: min(70vw, 500px);
    aspect-ratio: 1;
    top: -140px;
    left: -120px;
}

.login-page::after {
    width: min(75vw, 420px);
    aspect-ratio: 1;
    right: -140px;
    bottom: -160px;
}

.login-main {
    flex: 1;
    display: grid;
    place-items: center;
    width: 100%;
    padding: clamp(24px, 6vw, 64px) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
}

.login-container {
    width: 100%;
    max-width: 440px;
    min-width: 0;
    padding: clamp(24px, 6vw, 40px);
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 24px;
    background: rgba(255, 255, 255, .13);
    backdrop-filter: blur(18px);
    box-shadow: 0 24px 64px rgba(35, 0, 0, .26);
}

.login-brand {
    margin: 0 0 20px;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #ffe1d9;
}

.login-container h1 {
    margin: 0 0 8px;
    text-align: center;
    font-size: clamp(28px, 6vw, 34px);
    line-height: 1.2;
}

.login-description {
    margin: 0 0 30px;
    text-align: center;
    color: #ffe4e4;
    font-size: 15px;
    line-height: 1.5;
}

#login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

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

.login-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
}

.login-field input {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 52px;
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, .27);
    border-radius: 12px;
    background: rgba(0, 0, 0, .12);
    color: #fff;
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
    transition: border-color .2s, box-shadow .2s, background .2s;
}

.login-field input::placeholder {
    color: #f2cece;
    opacity: 1;
}

.login-field input:focus {
    outline: none;
    border-color: #fff;
    background: rgba(0, 0, 0, .18);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .18);
}

.password-field {
    position: relative;
}

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

.password-toggle {
    position: absolute;
    top: 50%;
    right: 4px;
    transform: translateY(-50%);
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #fff;
    cursor: pointer;
}

.password-toggle:hover {
    background: rgba(255, 255, 255, .12);
}

.password-toggle svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.password-toggle .icon-hide,
.password-toggle[aria-pressed='true'] .icon-show {
    display: none;
}

.password-toggle[aria-pressed='true'] .icon-hide {
    display: block;
}

.login-submit,
#open-register {
    min-height: 50px;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

.login-submit {
    background: #fff;
    color: #8b0000;
    box-shadow: 0 4px 12px rgba(35, 0, 0, .1);
}

.login-submit:hover {
    background: #fff0ed;
}

#open-register {
    border-color: rgba(255, 255, 255, .4);
    background: transparent;
    color: #fff;
}

.login-page button:focus-visible,
.login-page a:focus-visible {
    outline: 3px solid #ffd2bd;
    outline-offset: 3px;
}

#error-message {
    margin: 0;
    padding: 12px;
    border: 1px solid rgba(255, 210, 210, .4);
    border-radius: 10px;
    background: rgba(45, 0, 0, .24);
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
    overflow-wrap: anywhere;
}

.login-financial-link {
    margin: 24px 0 0;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .18);
    text-align: center;
    font-size: 13px;
    line-height: 1.6;
}

.login-financial-link a {
    color: #ffe2d9;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.login-footer {
    position: relative;
    padding: 0 16px max(16px, env(safe-area-inset-bottom));
    color: #e6bcbc;
    font-size: 12px;
    line-height: 1.5;
    text-align: center;
}

.dialog-overlay {
    position: fixed;
    inset: 0;
    display: none;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    z-index: 999;
}

.dialog-cadastro {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    width: calc(100% - 32px);
    max-width: 400px;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: clamp(20px, 5vw, 30px);
    border-radius: 20px;
    background: #fff;
    color: #444;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
    z-index: 1000;
}

.dialog-cadastro h2 {
    margin: 0 0 20px;
    color: #8b0000;
    font-size: 24px;
}

.dialog-cadastro label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.dialog-cadastro input {
    width: 100%;
    min-width: 0;
    margin-bottom: 15px;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 10px;
    font: inherit;
    font-size: 16px;
}

.dialog-cadastro input:focus {
    outline: 2px solid #8b0000;
    outline-offset: 2px;
}

.dialog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.dialog-cadastro button {
    min-height: 44px;
    padding: 12px 18px;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

#register-user,
#fechar-usuario-desativado {
    background: #8b0000;
    color: #fff;
}

#close-dialog {
    background: #e5e5e5;
    color: #333;
}

#mensagem-usuario-desativado {
    margin: 0 0 24px;
    line-height: 1.6;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

#fechar-usuario-desativado {
    width: 100%;
}

@media (max-height: 560px) {
    .login-main { padding-top: 20px; }
    .login-brand { margin-bottom: 12px; }
    .login-description { margin-bottom: 24px; }
}

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