:root {
    --c-dark: #632324;
    --c-mid: #993635;
    --white: #ffffff;
    --ink: #2b1a1a;
    --muted: #8a7573;
    --field-bg: #f6f1f1;
    --field-border: #e7dcdc;
}

* { box-sizing: border-box; }

.auth-body {
    margin: 0;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1000px 500px at 10% 0%, #efe4e4, transparent 60%),
        radial-gradient(900px 500px at 100% 100%, #e9dede, transparent 55%),
        #f1e9e9;
    -webkit-font-smoothing: antialiased;
}

/* ============ Cartão dividido ============ */
.auth-split {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    width: min(940px, 100%);
    min-height: 520px;
    background: var(--white);
    border-radius: 26px;
    overflow: hidden;
    box-shadow: 0 40px 80px -30px rgba(99, 35, 36, .45);
}

/* ============ Painel decorativo ============ */
.auth-aside {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    padding: 3rem 2.75rem;
    color: var(--white);
    background: linear-gradient(150deg, var(--c-mid) 0%, var(--c-dark) 85%);
    isolation: isolate;
}
.auth-aside::before {
    content: "";
    position: absolute;
    width: 360px; height: 360px;
    right: -120px; top: -120px;
    background: radial-gradient(circle at center, rgba(255, 255, 255, .10), transparent 65%);
    border-radius: 50%;
    z-index: -1;
}
.aside-lines {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}
.aside-content { position: relative; }
.aside-content h1 {
    font-size: 2.4rem;
    line-height: 1.05;
    margin: 0 0 .9rem;
    font-weight: 800;
    letter-spacing: -.02em;
}
.aside-content p {
    margin: 0;
    max-width: 24ch;
    font-size: .98rem;
    line-height: 1.6;
    color: rgba(255, 255, 255, .82);
}

/* Elementos decorativos */
.deco { position: absolute; z-index: -1; }
.deco-circle { border-radius: 50%; border: 2px solid rgba(255, 255, 255, .30); }
.deco-circle-1 { width: 22px; height: 22px; top: 16%; left: 22%; }
.deco-circle-2 { width: 40px; height: 40px; bottom: 14%; left: 10%; border-color: rgba(255, 255, 255, .22); }
.deco-plus { color: rgba(255, 255, 255, .5); font-size: 1.4rem; font-weight: 300; line-height: 1; }
.deco-plus-1 { top: 30%; left: 12%; }
.deco-plus-2 { bottom: 28%; right: 16%; font-size: 1.1rem; }
.deco-dots {
    top: 12%; right: 12%;
    width: 74px; height: 54px;
    background-image: radial-gradient(rgba(255, 255, 255, .55) 1.6px, transparent 1.7px);
    background-size: 13px 13px;
}

/* ============ Formulário ============ */
.auth-main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 2.75rem;
}
.auth-form-wrap { width: 100%; max-width: 320px; }

.auth-logo { height: 40px; width: auto; display: block; margin: 0 auto 1.75rem; }
.auth-brand {
    text-align: right;
    font-weight: 700;
    color: var(--c-mid);
    letter-spacing: .3px;
    margin-bottom: 1.5rem;
    font-size: .95rem;
}

.auth-main h2 {
    font-size: 1.9rem;
    font-weight: 800;
    letter-spacing: -.02em;
    margin: 0 0 1.6rem;
    color: var(--ink);
}

.auth-alert {
    background: rgba(153, 54, 53, .10);
    border: 1px solid rgba(153, 54, 53, .28);
    color: var(--c-dark);
    padding: .7rem .85rem;
    border-radius: 10px;
    font-size: .88rem;
    margin-bottom: 1.1rem;
}

.auth-alert.auth-ok {
    background: rgba(18, 161, 80, .10);
    border-color: rgba(18, 161, 80, .30);
    color: #087443;
}

.in-group { position: relative; margin-bottom: 1rem; }
.in-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    width: 19px; height: 19px;
    color: var(--c-mid);
    opacity: .8;
    pointer-events: none;
}
.in-group input {
    width: 100%;
    padding: .85rem 1rem .85rem 2.75rem;
    font-size: .98rem;
    color: var(--ink);
    background: var(--field-bg);
    border: 1.5px solid var(--field-border);
    border-radius: 11px;
    outline: none;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.in-group input::placeholder { color: #a9938f; }
.in-group input:focus {
    background: var(--white);
    border-color: var(--c-mid);
    box-shadow: 0 0 0 4px rgba(153, 54, 53, .15);
}

.auth-btn {
    width: 100%;
    margin-top: .5rem;
    padding: .9rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--white);
    background: linear-gradient(135deg, var(--c-mid), var(--c-dark));
    border: none;
    border-radius: 11px;
    cursor: pointer;
    box-shadow: 0 12px 24px -10px rgba(99, 35, 36, .6);
    transition: filter .15s, transform .05s;
}
.auth-btn:hover { filter: brightness(1.07); }
.auth-btn:active { transform: translateY(1px); }

/* Alternativa: entrar com QR code */
.auth-sep { display: flex; align-items: center; gap: .8rem; margin: 1.1rem 0 .3rem; color: var(--muted); font-size: .82rem; }
.auth-sep::before, .auth-sep::after { content: ""; height: 1px; flex: 1; background: rgba(0, 0, 0, .12); }
.auth-btn-ghost {
    background: #fff; color: var(--c-dark);
    border: 1px solid rgba(99, 35, 36, .35); box-shadow: none;
}
.auth-btn-ghost:hover { filter: none; background: rgba(99, 35, 36, .06); }
.auth-link {
    display: inline-block; margin-top: .3rem; background: none; border: none;
    color: var(--c-mid); font-size: .85rem; cursor: pointer; text-decoration: underline;
}
.qr-login { text-align: center; margin-top: .4rem; }
.qr-login-hint { color: var(--muted); font-size: .88rem; margin: .2rem 0 .8rem; }
.qr-wrap { display: inline-flex; align-items: center; justify-content: center; padding: 10px; background: #fff; border: 1px solid rgba(0, 0, 0, .12); border-radius: 12px; min-width: 208px; min-height: 208px; }
.qr-wrap img, .qr-wrap canvas { display: block; }
.qr-login-status { margin: .7rem 0 .2rem; font-size: .9rem; font-weight: 600; color: var(--c-dark); }
.qr-login-timer { margin: .1rem 0 0; font-size: .8rem; color: var(--muted); }
.qr-login-timer span { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--c-mid); }

.auth-note {
    text-align: center;
    color: var(--muted);
    font-size: .82rem;
    margin: 1.4rem 0 0;
}

/* Subtítulo e campo de código (2FA) */
.auth-sub {
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.5;
    margin: -.9rem 0 1.3rem;
}
.auth-otp {
    width: 100%;
    padding: .9rem 1rem;
    margin-bottom: .5rem;
    background: var(--field-bg);
    border: 1.5px solid var(--field-border);
    border-radius: 11px;
    color: var(--ink);
    outline: none;
    text-align: center;
    letter-spacing: .5em;
    padding-left: 1.5em;
    font-size: 1.5rem;
    font-variant-numeric: tabular-nums;
    transition: border-color .15s, box-shadow .15s, background .15s;
}
.auth-otp::placeholder { color: #cbb6b3; letter-spacing: .5em; }
.auth-otp:focus {
    background: var(--white);
    border-color: var(--c-mid);
    box-shadow: 0 0 0 4px rgba(153, 54, 53, .15);
}
.auth-logout { margin-top: .4rem; }
.auth-linkbtn {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: var(--c-mid);
    cursor: pointer;
    text-decoration: underline;
}
.auth-linkbtn:hover { color: var(--c-dark); }

/* ============ Responsivo ============ */
@media (max-width: 780px) {
    .auth-split { grid-template-columns: 1fr; min-height: 0; max-width: 420px; }
    .auth-aside {
        align-items: center;
        text-align: center;
        padding: 2.5rem 2rem;
    }
    .aside-content { display: flex; flex-direction: column; align-items: center; }
    .aside-content h1 { font-size: 2rem; }
    .aside-content p { max-width: 30ch; }
    .deco-circle-1, .deco-plus-1, .deco-plus-2 { display: none; }
    .auth-main { padding: 2.5rem 2rem; }
    .auth-form-wrap { max-width: 100%; }
}

@media (max-width: 420px) {
    .auth-body { padding: 0; }
    .auth-split { border-radius: 0; min-height: 100dvh; }
}

/* Utilitarios usados pelas telas de login. Duplicados do app.css de proposito:
   este layout nao carrega o app.css. Vieram de atributos style="" que a CSP
   deixou de permitir. */
.u-d-block_ta-center_td-none.u-d-block_ta-center_td-none { display:block; text-align:center; text-decoration:none; }
.u-w-auto_p-d4rem-d7rem_fs-d8rem.u-w-auto_p-d4rem-d7rem_fs-d8rem { width:auto; padding:.4rem .7rem; font-size:.8rem; }

/* Marca do Operations Center nas telas de login (login/2FA do public_noc). */
.auth-brand.noc-brand { font-size: 1.02rem; line-height: 1.3; }

/* ==========================================================================
   Prova de vida (página pública, aberta no celular)
   ========================================================================== */
.pv-wrap { max-width: 460px; }
.pv-passo { margin-top: .8rem; }

/* Topo compacto SÓ nesta página: no celular o cabeçalho grande empurrava o
   botão de tirar a foto para fora da tela, e a pessoa nem via que existia.
   As telas de login seguem com o topo cheio.

   `:has()` para alcançar o <body>, que a view não consegue marcar — é a única
   forma de zerar a margem em volta do cartão sem mexer no layout do login. */
.auth-body:has(.pv-split) { padding: 0; align-items: flex-start; }
.pv-split { max-width: 100%; border-radius: 0; box-shadow: none; }

.pv-split .auth-aside {
    padding: .9rem 1.2rem;
    align-items: center; justify-content: center; text-align: center;
}
.pv-split .aside-content { align-items: center; }
/* Título numa linha só, e sem quebrar mesmo em tela estreita. */
.pv-split .aside-content h1 {
    font-size: 1.35rem; line-height: 1.2; margin: 0 0 .15rem; white-space: nowrap;
}
.pv-split .aside-content p { font-size: .8rem; max-width: 38ch; margin: 0; }

.pv-split .auth-main { padding: .9rem 1rem 1.2rem; }
/* Saudação e instrução na MESMA frase: eram dois blocos, um alinhado à direita
   e outro à esquerda, que se atropelavam no celular. */
.pv-ola { margin: 0 0 .7rem; font-size: .92rem; line-height: 1.45; color: #4a3f3f; text-align: center; }

@media (max-width: 780px) {
    .pv-split .auth-aside { padding: .7rem 1rem; }
    .pv-split .aside-content h1 { font-size: 1.15rem; }
    .pv-split .aside-content p { font-size: .76rem; }
    .pv-split .auth-main { padding: .8rem .9rem 1rem; }
    .pv-split .deco { display: none; }
    .pv-ola { font-size: .86rem; }
}

.pv-status {
    display: flex; align-items: flex-start; gap: .5rem;
    padding: .75rem .85rem; margin-bottom: .9rem;
    background: #f5f2f2; border-radius: 10px; font-size: .9rem; line-height: 1.45;
}
.pv-ic { font-size: 1.1rem; line-height: 1.2; }

/* Espelhado: a câmera frontal mostra a imagem invertida, e a pessoa estranha
   ao se ver "ao contrário". O arquivo enviado NÃO é espelhado — só a
   pré-visualização, para o RH receber a foto real. */
/* 4/5 em vez de 3/4: a altura sobrando era o que jogava o botão para baixo
   da dobra no celular. */
.pv-camera {
    position: relative; width: 100%; aspect-ratio: 4 / 5;
    max-height: 42vh;
    background: #1f1717; border-radius: 14px; overflow: hidden; margin-bottom: .5rem;
}
/* O <canvas> nunca é exibido — serve só como área de desenho. A revisão é a
   <img>, que renderiza igual em todo navegador (o canvas revelado aparecia
   preto no Safari do iPhone). */
.pv-camera canvas { display: none; }
.pv-camera video,
.pv-camera img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    /* Espelhado: a câmera frontal mostra a imagem invertida e a pessoa estranha
       ao se ver "ao contrário". O ARQUIVO enviado não é espelhado — isto é só
       apresentação, e o RH recebe a foto real. */
    transform: scaleX(-1);
}
.pv-camera video[hidden], .pv-camera img[hidden] { display: none; }

/* Guia do rosto: o buraco no meio é feito com box-shadow gigante, que escurece
   tudo em volta sem precisar de imagem nem de SVG. */
.pv-mascara {
    position: absolute; inset: 0; pointer-events: none;
}
.pv-mascara::before {
    content: ""; position: absolute;
    left: 50%; top: 46%; transform: translate(-50%, -50%);
    width: 62%; aspect-ratio: 3 / 4;
    border: 2px dashed rgba(255, 255, 255, .85);
    border-radius: 50%;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, .45);
}
.pv-dica { margin: 0 0 .6rem; font-size: .82rem; color: #6b7280; text-align: center; }

.pv-link {
    display: block; width: 100%; margin-top: .6rem; padding: .5rem;
    background: none; border: 0; color: #993635; font: inherit; font-size: .88rem;
    text-decoration: underline; cursor: pointer;
}
.pv-btn-arquivo { display: block; text-align: center; cursor: pointer; }
.pv-fallback { margin-top: .9rem; }

/* ============================================================
   Utilitários usados pelas telas de autenticação
   ============================================================
   ⚠️ As telas de login/2FA carregam SÓ este arquivo, nunca o app.css. Classe
   usada aqui precisa existir aqui — foi o que deixou o botão do 2FA e o texto
   auxiliar sem estilo nos portais da Operadora e do Tele Atendimento.
   Os valores espelham os do app.css; mudou lá, confira aqui. */
.hint { color: var(--muted); font-size: .82rem; margin: 0 0 .5rem; }
/* Seletor dobrado, como no app.css: vence o alinhamento do .auth-main. */
.u-m-auto.u-m-auto { margin: auto; }
