* { box-sizing: border-box; margin: 0; padding: 0; }
  body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    overflow-x: hidden;
    background: #f4f6fa;
    color: #0e2a5c;
    font-family: var(--font-body);
  }
  .card {
    width: min(100%, 500px);
    padding: 32px 40px 24px;
    border: 1px solid rgba(203, 213, 225, .72);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 50px rgba(15, 42, 80, .08);
  }
  .brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e2e8f0;
  }
  .logo {
    width: 60px;
    height: 60px;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #123f7a;
    color: #fff;
  }
  .brand-copy { min-width: 0; }
  .brand .benvoo-logo-frame { display: block; }
  .brand .benvoo-logo {
    display: block;
    width: min(360px, 100%);
    max-width: 100%;
    height: auto;
    margin: 0 auto -44px;
    object-fit: contain;
    object-position: center;
    image-rendering: auto;
  }
  .brand.benvoo-brand { width: 100%; flex-direction: column; gap: 8px; text-align: center; }
  .brand.benvoo-brand .brand-copy { width: 100%; text-align: center; }
  .brand-name {
    color: #0e2a5c;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.12;
  }
  .brand-subtitle {
    margin-top: 0;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.35;
  }
  h2 {
    color: #103a76;
    font-size: 22px;
  }
  .login-heading { margin: 24px 0 20px; }
  .login-heading h1 {
    color: #123b73;
    font-family: var(--font-body) !important;
    font-size: 28px !important;
    font-weight: 700 !important;
    line-height: 1.18 !important;
    letter-spacing: -.01em !important;
  }
  .login-heading p {
    margin-top: 6px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.45;
  }
  label {
    display: block;
    margin-bottom: 8px;
    color: #1a2e4f;
    font-size: 14px;
    font-weight: 700;
  }
  .field {
    position: relative;
    margin-bottom: 18px;
  }
  .field svg.lead {
    position: absolute;
    z-index: 1;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #718096;
    pointer-events: none;
  }
  .field input {
    width: 100%;
    height: 48px;
    padding: 0 48px 0 44px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #1a2e4f;
    font: inherit;
    font-size: 15px;
    transition: border-color var(--motion-fast) var(--motion-ease-out), background-color var(--motion-fast) var(--motion-ease-out);
  }
  @media (hover: hover) and (pointer: fine) { .field input:hover:not(:disabled) { border-color: #94a3b8; } }
  .field input:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .10);
  }
  .field input[aria-invalid="true"] { border-color: #dc2626; }
  .field input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(220, 38, 38, .10); }
  .field input:disabled { background: #f1f5f9; color: #64748b; cursor: not-allowed; }
  .field input::placeholder { color: var(--text-placeholder, #64748b); opacity: 1; }
  .field.field-no-icons input { padding-inline: 14px; }
  .toggle-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-50%);
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
  }
  @media (hover: hover) and (pointer: fine) { .toggle-eye:hover { background: #f8fafc; color: #103a76; } }
  .toggle-eye .eye-slash { display: block; }
  .toggle-eye.is-visible .eye-slash { display: none; }
  .row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: -6px 0 18px;
  }
  a.link {
    color: #1763d4;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
  }
  @media (hover: hover) and (pointer: fine) { a.link:hover { text-decoration: underline; } }
  .link-button {
    min-height: 44px;
    padding: 8px 0 8px 12px;
    border: 0;
    background: transparent;
    color: #1763d4;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
  }
  @media (hover: hover) and (pointer: fine) { .link-button:hover { text-decoration: underline; } }
  .btn {
    width: 100%;
    min-height: 50px;
    padding: 12px 18px;
    border: 0;
    border-radius: 8px;
    background: #123f7a;
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color var(--motion-fast) var(--motion-ease-out), box-shadow var(--motion-fast) var(--motion-ease-out), scale var(--motion-instant) var(--motion-ease-out);
  }
  @media (hover: hover) and (pointer: fine) { .btn:hover:not(:disabled) { background: #0d3263; } }
  .btn:disabled { background: #6f85a3; cursor: wait; }
  .signup {
    margin-top: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 14px;
    text-align: center;
  }
  .footer-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-top: 18px;
    font-size: 13px;
  }
  .footer-links a.link { display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; font-weight: 500; }
  .footer-links span { color: #94a3b8; }
  a:focus-visible,
  button:focus-visible,
  summary:focus-visible {
    outline: 3px solid var(--border-focus, #2b6da9);
    outline-offset: 3px;
  }
  .modal-backdrop {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(15, 23, 42, 0.46);
    z-index: 20;
  }
  /* Entrada com os tokens; saída por opacidade, mais rápida. O atributo hidden entra na hora
     (o código que lê o estado não espera); só a pintura dura --motion-exit. */
  .modal-backdrop:not([hidden]) { animation: overlayFade var(--motion-enter) var(--motion-ease-out); }
  .modal-backdrop:not([hidden]) > .modal-card { animation: slideUp var(--motion-enter) var(--motion-ease-out); }
  .modal-backdrop[hidden] {
    display: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--motion-exit) var(--motion-ease-in),
                visibility var(--motion-exit) var(--motion-ease-linear),
                display var(--motion-exit) var(--motion-ease-linear) allow-discrete;
  }
  html[data-motion-instant] .modal-backdrop[hidden] { transition: none; }
  /* Etapas da verificação em duas etapas: a etapa que aparece entra por opacidade. */
  #mfaEnrollmentStep:not([hidden]),
  #mfaVerificationStep:not([hidden]),
  #mfaRecoveryStep:not([hidden]) { animation: overlayFade var(--motion-fast) var(--motion-ease-out); }
  .modal-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border: 1px solid #d6dde7;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.22);
  }
  .modal-card h2 { margin: 0 34px 10px 0; }
.modal-text {
    color: #4a5468;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 22px;
}

#resetDescription {
  color: #3f5269;
  font-size: 14px;
  line-height: 1.55;
}

#resetAcknowledgement:not([hidden]) {
  display: block;
  width: 100%;
  margin-top: 18px;
}

#resetForm[hidden] { display: none; }

.password-requirements {
  margin: -2px 0 14px;
  color: #53657b;
  font-size: 12px;
  line-height: 1.45;
}
  .modal-close {
    position: absolute;
    right: 16px;
    top: 14px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 10px;
    background: #f1f5f9;
    color: #4a5468;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }
  @media (hover: hover) and (pointer: fine) { .modal-close:hover { background: #e5eaf1; color: #103a76; } }
  .form-message {
    min-height: 20px;
    margin: -6px 0 14px;
    font-size: 13px;
    line-height: 1.4;
    color: #4a5468;
  }
  .login-message { margin: -6px 0 8px; }
  .form-message.ok { color: #087a3f; }
.form-message.error { color: #c0274a; }
  .auth-mfa-card { max-width: 520px; }
  .auth-mfa-card section[hidden] { display: none; }
  .auth-security-label {
    margin: 0 42px 8px 0;
    color: #1763d4;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
  }
  .mfa-setup-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin: 0 0 20px;
  }
  .mfa-qr-frame {
    width: 216px;
    height: 216px;
    margin: 0 auto;
    padding: 15px;
    border: 1px solid #d6dde7;
    border-radius: 12px;
    background: #fff;
  }
  .mfa-qr-frame[hidden] { display: none; }
  .mfa-qr-frame img { display: block; width: 184px; height: 184px; object-fit: contain; }
  .mfa-manual-setup {
    display: grid;
    gap: 8px;
    padding: 14px;
    border: 1px solid #d6dde7;
    border-radius: 10px;
    background: #f7f9fc;
  }
  .mfa-manual-setup > span { color: #4a5468; font-size: 12px; font-weight: 700; }
  .mfa-manual-setup code,
  .mfa-uri-details code {
    overflow-wrap: anywhere;
    color: #0e2a5c;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    line-height: 1.45;
  }
  .mfa-secondary-action {
    min-height: 44px;
    padding: 8px 14px;
    border: 1px solid #b9c8dc;
    border-radius: 8px;
    background: #fff;
    color: #103a76;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
  }
  @media (hover: hover) and (pointer: fine) { .mfa-secondary-action:hover { background: #eef4ff; border-color: #1763d4; } }
  .mfa-secondary-action:focus-visible,
  .auth-mfa-card button:focus-visible,
  .auth-mfa-card summary:focus-visible { outline: 3px solid var(--border-focus, #2b6da9); outline-offset: 2px; }
  .mfa-uri-details { margin: -6px 0 20px; color: #4a5468; font-size: 13px; }
  .mfa-uri-details summary { color: #1763d4; font-weight: 700; cursor: pointer; }
  .mfa-uri-details code { display: block; margin-top: 10px; padding: 10px; background: #f7f9fc; border-radius: 8px; }
  .mfa-code-field input {
    padding: 14px;
    text-align: center;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .1em;
  }
  .mfa-recovery-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    margin: 0 0 18px;
    padding: 14px;
    list-style: none;
    border: 1px solid #d6dde7;
    border-radius: 10px;
    background: #f7f9fc;
  }
  .mfa-recovery-list code {
    color: #0e2a5c;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .06em;
  }
  .mfa-recovery-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
  @media (max-width: 480px) {
    body { padding: 16px; }
    .card { padding: 24px 20px 20px; }
    .modal-card { padding: 26px 22px; }
    .brand { justify-content: center; gap: 12px; padding-bottom: 20px; }
    .brand .benvoo-logo { width: min(300px, 100%); height: auto; margin-bottom: -36px; }
    .brand-name { font-size: 22px; }
    .brand-subtitle { font-size: 13px; }
    .logo { width: 52px; height: 52px; }
    .login-heading { margin: 20px 0 18px; }
    .login-heading h1 { font-size: 25px !important; }
    .footer-links { gap: 10px; }
    .mfa-recovery-list { grid-template-columns: 1fr; }
    .mfa-recovery-actions { grid-template-columns: 1fr; }
  }
  @media (max-height: 760px) {
    body { align-items: flex-start; }
  }
  .toggle-eye:active:not(:focus-visible):not(:disabled),
  .modal-close:active:not(:focus-visible):not(:disabled) { scale: .97; }
  .toggle-eye:focus-visible, .modal-close:focus-visible { scale: 1; transition: none; }
  @media (prefers-reduced-motion: reduce) {
    .toggle-eye:active, .modal-close:active { scale: 1 !important; }
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
  }

/* ---------------------------------------------------------------------------
   Login, redefinição de senha e primeiro acesso (body.auth-login): coluna do
   formulário ao lado do painel da marca (css/auth-stage.css). As regras de
   cartão centralizado acima ficam como base e são sobrepostas aqui.
   --------------------------------------------------------------------------- */
  body.auth-login {
    display: block;
    padding: 0;
    background: #fff;
  }
  /* No login, o <main class="card"> deixa de ser cartão e vira a coluna branca. */
  body.auth-login .auth-shell > main.card {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 0;
    padding: clamp(32px, 5vw, 64px) clamp(20px, 5vw, 72px);
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
  }
  .auth-form { width: min(100%, 400px); }
  body.auth-login .brand.benvoo-brand { display: block; padding: 0; border: 0; }
  body.auth-login .brand .benvoo-logo-frame { display: block; width: 168px; }
  body.auth-login .brand .benvoo-logo { width: 100%; margin: 0; }
  body.auth-login .login-heading { margin: 40px 0 28px; }
  body.auth-login .login-heading h1 { color: #0d1b2e; }
  body.auth-login .login-heading p { margin-top: 8px; color: #586a84; font-size: 15px; }
  .label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 2px;
  }
  .label-row label { margin-bottom: 0; }
  .label-row .link-button { padding: 8px 0 8px 12px; font-size: 13.5px; }
  .caps-warning {
    margin: -8px 0 14px;
    padding: 8px 10px;
    border-radius: 8px;
    background: #fff6e0;
    color: #7a4f00;
    font-size: 13px;
    font-weight: 500;
  }
  .caps-warning[hidden] { display: none; }
  /* O preenchimento automático do Chrome pinta o campo de azul e não aceita outro fundo;
     uma transição de cerca de uma semana adia essa pintura e mantém o fundo branco do sistema. */
  body.auth-login .field input:-webkit-autofill,
  body.auth-login .field input:-webkit-autofill:hover,
  body.auth-login .field input:-webkit-autofill:focus {
    -webkit-text-fill-color: #000;
    transition: background-color calc(var(--motion-slow) * 1500000), color calc(var(--motion-slow) * 1500000);
  }
  #loginSubmit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    border-radius: 10px;
    box-shadow: 0 6px 16px -6px rgba(16, 63, 131, .55);
  }
  #loginSubmit::after {
    content: "";
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
    transition: transform var(--motion-base) var(--motion-ease-out);
  }
  @media (hover: hover) and (pointer: fine) { #loginSubmit:hover:not(:disabled)::after { transform: translateX(3px); } }
  #loginSubmit[aria-busy="true"]::after {
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    background: none;
    -webkit-mask: none;
    mask: none;
    animation: spin var(--motion-spinner) var(--motion-ease-linear) infinite;
  }
  body.auth-login .signup {
    margin-top: 22px;
    padding-bottom: 0;
    border-bottom: 0;
    color: #586a84;
  }
  body.auth-login .footer-links {
    flex-wrap: wrap;
    gap: 0 18px;
    margin-top: 32px;
    padding-top: 12px;
    border-top: 1px solid #e7edf4;
  }
  body.auth-login .footer-links a.link { color: #586a84; font-size: 12.5px; }
  @media (hover: hover) and (pointer: fine) { body.auth-login .footer-links a.link:hover { color: #0d1b2e; } }

  @media (max-width: 760px) {
    body.auth-login .auth-shell > main.card { align-items: flex-start; padding: 28px 20px 32px; }
    body.auth-login .login-heading { margin: 28px 0 22px; }
  }
  @media (prefers-reduced-motion: reduce) {
    #loginSubmit[aria-busy="true"]::after { animation-duration: calc(var(--motion-spinner) * 2); }
  }

/* Redefinição de senha e primeiro acesso no mesmo visual do login. */
  body.auth-reset .auth-form > h2 { margin: 40px 0 8px; color: #0d1b2e; }
  body.auth-reset .auth-form > .modal-text { margin-bottom: 28px; color: #586a84; font-size: 15px; }
  body.auth-reset #resetButton { margin-top: 8px; border-radius: 10px; box-shadow: 0 6px 16px -6px rgba(16, 63, 131, .55); }
  body.auth-reset #resetButton:disabled { box-shadow: none; }
  body.auth-first-access #firstAccessSubmit { margin-top: 8px; border-radius: 10px; box-shadow: 0 6px 16px -6px rgba(16, 63, 131, .55); }
  body.auth-first-access #firstAccessSubmit:disabled { box-shadow: none; }
  body.auth-reset .signup { margin-top: 22px; }
  @media (max-width: 760px) {
    body.auth-reset .auth-form > h2 { margin-top: 28px; }
  }
