/* ==========================================================================
   apifacil — telas de autenticação (index.php login + verifica-2fa.php)
   --------------------------------------------------------------------------
   Folha independente (sem Bootstrap / SB Admin). Usa os mesmos tokens do
   Design System v2 (css/apifacil-ds.css): navy + amarelo, Nunito, raio 6/10/14.
   Layout: painel de marca (navy) + painel do formulário (branco).
   ========================================================================== */

:root {
    --af-primary: #1b2550;
    --af-primary-hover: #131b40;
    --af-primary-ring: rgba(27, 37, 80, 0.16);
    --af-navy: #0e1430;
    --af-navy-deep: #0a0f26;
    --af-brand: #f5b301;
    --af-brand-hover: #e2a400;
    --af-brand-bright: #fbd34d;
    --af-brand-on: #181203;
    --af-brand-ring: rgba(245, 179, 1, 0.30);

    --af-text-primary: #0f172a;
    --af-text-secondary: #475569;
    --af-text-muted: #94a3b8;
    --af-border: #e2e8f0;
    --af-border-strong: #cbd5e1;
    --af-bg-muted: #f1f5f9;

    --af-success: #10b981;  --af-success-bg: rgba(16, 185, 129, 0.10);  --af-success-text: #065f46;
    --af-warning: #ea7d0b;  --af-warning-bg: rgba(234, 125, 11, 0.10);  --af-warning-text: #7c3a05;
    --af-danger: #ef4444;   --af-danger-bg: rgba(239, 68, 68, 0.10);    --af-danger-text: #991b1b;

    --af-r-sm: 6px; --af-r-md: 10px; --af-r-lg: 14px;
    --af-font: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --af-dur: 150ms;
    --af-ease: cubic-bezier(0.2, 0, 0, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body.af-auth {
    font-family: var(--af-font);
    font-size: 14px;
    line-height: 1.55;
    color: var(--af-text-primary);
    background: #fff;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--af-primary); }
img { max-width: 100%; display: block; }
button { font: inherit; }

/* --------------------------------------------------------------------------
   Grade: marca | formulário
   -------------------------------------------------------------------------- */
.auth {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
}

/* --------------------------------------------------------------------------
   Painel de marca (navy)
   -------------------------------------------------------------------------- */
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 40px 56px 32px;
    color: #fff;
    background: var(--af-navy);
    background-image:
        radial-gradient(ellipse 70% 55% at 85% 15%, rgba(245, 179, 1, 0.14), transparent 70%),
        linear-gradient(160deg, var(--af-navy) 0%, var(--af-navy-deep) 100%);
}
/* grade sutil de pontos: textura de painel, não decoração */
.auth-brand::before {
    content: '';
    position: absolute; inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px);
    background-size: 22px 22px;
    -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent 75%);
            mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent 75%);
    pointer-events: none;
}
.auth-brand > * { position: relative; }

.auth-brand__logo img {
    width: 200px; height: auto;
    /* a "logo branca" tem o texto cinza-escuro: sobre navy vira marca monocromática branca */
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.auth-brand__main { margin: auto 0; padding: 48px 0; max-width: 480px; }
.auth-brand__title {
    margin: 0 0 14px;
    font-size: 34px;
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -0.025em;
    color: #fff;
}
.auth-brand__lead {
    margin: 0;
    font-size: 16px;
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.70);
}

/* Placa da certificação — o único elemento com destaque */
.auth-plaque-wrap { position: relative; margin-top: 36px; max-width: 440px; }
.auth-plaque-wrap::before {
    content: '';
    position: absolute;
    inset: -28px -40px;
    background: radial-gradient(ellipse at 50% 60%, rgba(245, 179, 1, 0.28), transparent 65%);
    filter: blur(6px);
    pointer-events: none;
}
.auth-plaque {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px 20px 14px 14px;
    background: #fff;
    border-radius: var(--af-r-lg);
    color: var(--af-text-primary);
    text-decoration: none;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.40),
        0 2px 6px rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    transition: transform var(--af-dur) var(--af-ease), box-shadow var(--af-dur) var(--af-ease);
    animation: auth-plaque-in 520ms var(--af-ease) both;
}
.auth-plaque:hover,
.auth-plaque:focus-visible {
    transform: translateY(-2px);
    box-shadow:
        0 30px 70px rgba(0, 0, 0, 0.45),
        0 4px 10px rgba(0, 0, 0, 0.25),
        inset 0 0 0 1px rgba(255, 255, 255, 0.6);
    outline: none;
}
.auth-plaque:focus-visible { box-shadow: 0 0 0 3px var(--af-brand-ring), 0 24px 60px rgba(0, 0, 0, 0.40); }
.auth-plaque__badge {
    width: 156px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1px solid var(--af-border);
}
.auth-plaque__text { min-width: 0; }
.auth-plaque__text strong {
    display: block;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.auth-plaque__text span {
    display: block;
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.45;
    color: var(--af-text-secondary);
}
.auth-plaque__text .auth-plaque__cta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--af-primary);
}
.auth-plaque__text .auth-plaque__cta svg { width: 12px; height: 12px; }
@keyframes auth-plaque-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-brand__foot {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.42);
    max-width: 480px;
}

/* --------------------------------------------------------------------------
   Painel do formulário
   -------------------------------------------------------------------------- */
.auth-pane {
    display: flex;
    flex-direction: column;
    padding: 40px 32px;
}
.auth-form {
    width: 100%;
    max-width: 384px;
    margin: auto;
}
.auth-form__title {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.auth-form__sub {
    margin: 0 0 28px;
    font-size: 14px;
    color: var(--af-text-secondary);
}
.auth-form__sub b { color: var(--af-text-primary); font-weight: 800; }

.auth-field { margin-bottom: 18px; }
.auth-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
}
.auth-input-wrap { position: relative; }
.auth-input {
    display: block;
    width: 100%;
    height: 46px;
    padding: 0 14px;
    font: inherit;
    font-size: 15px;
    color: var(--af-text-primary);
    background: #fff;
    border: 1px solid var(--af-border-strong);
    border-radius: 8px;
    outline: none;
    transition: border-color var(--af-dur) var(--af-ease), box-shadow var(--af-dur) var(--af-ease);
}
.auth-input::placeholder { color: var(--af-text-muted); }
.auth-input:hover { border-color: #94a3b8; }
.auth-input:focus {
    border-color: var(--af-primary);
    box-shadow: 0 0 0 3px var(--af-primary-ring);
}
.auth-input-wrap .auth-input { padding-right: 46px; }
.auth-input--code {
    height: 60px;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.42em;
    text-indent: 0.42em; /* compensa o espaçamento do último dígito */
    font-variant-numeric: tabular-nums;
}
.auth-eye {
    position: absolute;
    top: 0; right: 0;
    height: 46px; width: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    color: var(--af-text-muted);
    cursor: pointer;
    border-radius: 0 8px 8px 0;
}
.auth-eye:hover { color: var(--af-text-secondary); }
.auth-eye:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--af-primary-ring); }
.auth-eye svg { width: 18px; height: 18px; }
.auth-eye .ico-off { display: none; }
.auth-eye.is-on .ico-on { display: none; }
.auth-eye.is-on .ico-off { display: block; }

.auth-check {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--af-text-secondary);
    cursor: pointer;
    user-select: none;
}
.auth-check input {
    width: 16px; height: 16px;
    margin: 0;
    accent-color: var(--af-primary);
    cursor: pointer;
}

/* reCAPTCHA: reserva a altura para o layout não pular */
.auth-captcha { min-height: 78px; margin-bottom: 18px; }
.auth-captcha-aviso {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--af-r-md);
    background: var(--af-warning-bg);
    border: 1px solid rgba(234, 125, 11, 0.25);
    color: var(--af-warning-text);
    font-size: 13px;
    line-height: 1.5;
}
.auth-captcha-aviso[hidden] { display: none; }
.auth-captcha-aviso a { color: inherit; font-weight: 800; }

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    border: 0;
    border-radius: 8px;
    background: var(--af-brand);
    color: var(--af-brand-on);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.005em;
    cursor: pointer;
    box-shadow: 0 1px 2px var(--af-brand-ring);
    transition: background var(--af-dur) var(--af-ease), transform var(--af-dur) var(--af-ease), box-shadow var(--af-dur) var(--af-ease), color var(--af-dur) var(--af-ease);
}
.auth-btn:hover { background: var(--af-brand-hover); }
.auth-btn:active { transform: translateY(1px); }
.auth-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--af-brand-ring); }
.auth-btn:disabled {
    background: var(--af-bg-muted);
    color: var(--af-text-muted);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}
.auth-btn__spinner {
    display: none;
    width: 16px; height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: auth-spin 0.7s linear infinite;
}
.auth-btn.is-loading .auth-btn__spinner { display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-btn--link {
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    color: var(--af-primary);
    font-size: 13px;
    font-weight: 700;
    box-shadow: none;
}
.auth-btn--link:hover { background: transparent; text-decoration: underline; }
.auth-btn--link:disabled { background: transparent; color: var(--af-text-muted); text-decoration: none; }

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    margin-bottom: 20px;
    border-radius: var(--af-r-md);
    border: 1px solid transparent;
    font-size: 13px;
    line-height: 1.5;
}
.auth-alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 2px; }
.auth-alert--danger  { background: var(--af-danger-bg);  border-color: rgba(239, 68, 68, 0.2);  color: var(--af-danger-text); }
.auth-alert--success { background: var(--af-success-bg); border-color: rgba(16, 185, 129, 0.2); color: var(--af-success-text); }
.auth-alert--warning { background: var(--af-warning-bg); border-color: rgba(234, 125, 11, 0.25); color: var(--af-warning-text); }

.auth-links {
    margin-top: 28px;
    text-align: center;
    font-size: 13px;
    color: var(--af-text-secondary);
}
.auth-links a { font-weight: 700; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }
.auth-links p { margin: 0 0 8px; }
.auth-links p:last-child { margin-bottom: 0; }

.auth-pane__foot {
    display: none; /* o aviso legal vive no painel de marca; aparece aqui só no mobile */
    margin-top: 28px;
    font-size: 12px;
    color: var(--af-text-muted);
    text-align: center;
}

/* --------------------------------------------------------------------------
   Responsivo
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
    .auth-brand { padding: 36px 40px 28px; }
    .auth-brand__title { font-size: 30px; }
}
@media (max-width: 900px) {
    .auth { grid-template-columns: 1fr; min-height: auto; }
    .auth-brand { padding: 24px 20px 28px; }
    .auth-brand__logo img { width: 150px; }
    .auth-brand__main { padding: 22px 0 0; margin: 0; max-width: none; }
    .auth-brand__title { font-size: 22px; margin-bottom: 8px; }
    .auth-brand__lead { font-size: 14px; }
    .auth-plaque-wrap { margin-top: 20px; max-width: none; }
    .auth-plaque { gap: 14px; padding: 10px 14px 10px 10px; }
    .auth-plaque__badge { width: 118px; }
    .auth-plaque__text strong { font-size: 14px; }
    .auth-plaque__text span { font-size: 12px; }
    .auth-plaque__text .auth-plaque__cta { display: none; }
    .auth-brand__foot { display: none; }
    .auth-pane { padding: 32px 20px 28px; }
    .auth-form { margin: 0 auto; }
    .auth-pane__foot { display: block; }
}
@media (max-width: 380px) {
    .auth-plaque__badge { width: 100px; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-plaque { animation: none; }
    .auth-plaque, .auth-input, .auth-btn { transition: none; }
}
