/* Tela de login do painel — layout aprovado pelo dono (issue #69).
 *
 * A tela é SEMPRE escura (Grafite): é a porta de entrada e o fundo de curvas de
 * nível foi desenhado para o escuro. O tema que a pessoa escolheu volta a valer
 * assim que ela entra no painel.
 *
 * Duas colunas no computador (marca à esquerda, formulário à direita) e uma
 * coluna no celular (marca em cima, curta, e o formulário embaixo).
 * Movimento segue o AGENTS.md, seção 3: só transform/opacity, entrada de
 * 180–240 ms com ease-out, e nada disso com "reduzir movimento".
 */

:root {
  --grafite: #0b0c13;
  --nevoa: #f7f7fb;
  --azul: #3a5cff;
  --magenta: #d633ff;
  --aurora: linear-gradient(135deg, var(--azul) 0%, var(--magenta) 100%);
  --verde: #12a55f;
  --vermelho: #ef5560;
  --ambar: #ffcf6b;
  --papel: rgba(247, 247, 251, 0.05);
  --risco: rgba(247, 247, 251, 0.13);
  --t2: rgba(247, 247, 251, 0.72);
  --t3: rgba(247, 247, 251, 0.5);
  --foco: 0 0 0 4px rgba(58, 92, 255, 0.28);
  --curva-entrada: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; height: 100%; }
body {
  margin: 0;
  background: var(--grafite);
  color: var(--nevoa);
  font: 400 15px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { margin: 0; letter-spacing: -0.045em; line-height: 1.04; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
[hidden] { display: none !important; }

/* ícones do conjunto (js/icones.js injeta o sprite #ic-*) */
svg.ic {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

/* foco visível em tudo que se usa pelo teclado */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--azul);
  outline-offset: 3px;
  border-radius: 8px;
}

/* --- o palco --- */
.acesso { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) {
  .acesso { grid-template-columns: minmax(0, 1fr) 520px; }
}

/* --- lado da marca --- */
.marca-l {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center; gap: 30px;
  padding: clamp(34px, 6vw, 76px);
}
/* O fundo é desenhado: linhas de terreno que escorrem devagar, como curva de
   nível vista de cima. É canvas, não filtro. */
.fundo { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.fundo canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fundo .clarao {
  position: absolute; left: 6%; top: 42%; width: 62%; aspect-ratio: 1.3;
  transform: translateY(-50%); border-radius: 50%; filter: blur(90px); opacity: 0.5;
  background: radial-gradient(circle at 42% 42%, rgba(58, 92, 255, 0.55), rgba(214, 51, 255, 0.2) 52%, transparent 72%);
}
.fundo .grao {
  position: absolute; inset: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23n)'/%3E%3C/svg%3E");
}
.fundo .iris-agua {
  position: absolute; right: -14%; bottom: -20%; width: 44%;
  opacity: 0.045; filter: saturate(0) brightness(2.4);
}
/* o fundo fica de fora: sem isso ele perderia o absolute e a altura iria a zero */
.marca-l > *:not(.fundo) { position: relative; z-index: 1; }

.selo-m { display: flex; align-items: center; gap: 11px; }
.selo-m .iris { width: 38px; height: 38px; filter: drop-shadow(0 0 26px rgba(139, 69, 255, 0.55)); }
.selo-m .tipo { width: 104px; fill: var(--nevoa); }
.marca-l h1 { font-size: clamp(30px, 4.2vw, 54px); font-weight: 800; max-width: 17ch; }
.marca-l h1 span { font-weight: 200; color: var(--t2); }
.provas { display: grid; gap: 13px; max-width: 46ch; }
.provas li {
  display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 12px; align-items: start;
  font-size: 14.5px; color: var(--t2);
}
.provas li i {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(247, 247, 251, 0.07); border: 1px solid var(--risco); color: var(--nevoa);
}
.provas li i .ic { width: 13px; height: 13px; }
@media (max-width: 959px) {
  .marca-l { gap: 20px; padding: 30px 24px 26px; }
  .marca-l h1 { font-size: 27px; }
  .provas { display: none; }
}

/* --- lado do formulário --- */
.entrada {
  position: relative; display: flex; flex-direction: column; justify-content: center;
  padding: clamp(26px, 5vw, 54px) clamp(22px, 5vw, 48px);
  background: rgba(6, 6, 11, 0.72); border-left: 1px solid var(--risco);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
@media (max-width: 959px) {
  .entrada { border-left: 0; border-top: 1px solid var(--risco); justify-content: flex-start; }
}
.olho-t {
  font: 500 10.5px "JetBrains Mono", ui-monospace, monospace; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--magenta);
}
.entrada h2 { margin: 12px 0 7px; font-size: 27px; font-weight: 800; }
.entrada .sub { color: var(--t3); font-size: 14px; margin-bottom: 26px; }
.entrada .sub b { color: var(--nevoa); }

/* cada etapa entra de leve (troca de passo), e nunca com "reduzir movimento" */
.passo-entra { animation: entra 220ms var(--curva-entrada) both; }
@keyframes entra {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- campo com rótulo flutuante e ícone --- */
.campo { position: relative; margin-bottom: 13px; }
.campo > .ic-campo {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--t3); display: grid; pointer-events: none; transition: color 0.2s;
}
.campo > .ic-campo .ic { width: 17px; height: 17px; }
.campo input {
  width: 100%; border: 1px solid var(--risco); border-radius: 14px;
  background: var(--papel); color: var(--nevoa); font: inherit; font-size: 15px;
  padding: 23px 44px 9px 42px; outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
/* o preenchimento automático do navegador não pinta o campo de amarelo */
.campo input:-webkit-autofill,
.campo input:-webkit-autofill:hover,
.campo input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--nevoa);
  -webkit-box-shadow: 0 0 0 1000px #15161f inset;
  caret-color: var(--nevoa);
}
.campo label {
  position: absolute; left: 42px; top: 15px; font-size: 14px; color: var(--t3);
  pointer-events: none; transform-origin: 0 0; transition: transform 0.18s ease, color 0.18s;
}
/* com foco ou com texto, o rótulo sobe e encolhe (é o "rótulo flutuante") */
.campo input:focus + label,
.campo input:not(:placeholder-shown) + label { transform: translateY(-9px) scale(0.76); color: var(--t2); }
.campo input:focus { border-color: var(--azul); background-color: rgba(58, 92, 255, 0.09); box-shadow: var(--foco); }
.campo:focus-within > .ic-campo { color: var(--azul); }
.campo.ruim input { border-color: var(--vermelho); box-shadow: 0 0 0 4px rgba(239, 85, 96, 0.14); }
.campo .olho-b {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--t3);
}
.campo .olho-b:hover { color: var(--nevoa); background: rgba(247, 247, 251, 0.07); }
.campo .olho-b .ic { width: 18px; height: 18px; }
.olho-b .ic-esconder, .olho-b[aria-pressed="true"] .ic-ver { display: none; }
.olho-b[aria-pressed="true"] .ic-esconder { display: block; }
/* campo sem ícone à esquerda (código de recuperação) */
.campo.sem-icone input { padding-left: 16px; }
.campo.sem-icone label { left: 16px; }

.caps { display: flex; align-items: center; gap: 7px; margin: -4px 0 11px; font-size: 12px; color: var(--ambar); }
.caps:empty { display: none; }
.caps .ic { width: 14px; height: 14px; }

.linha-op {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  margin: 4px 0 18px; font-size: 13px;
}
.link-b { color: var(--t2); font-weight: 600; font-size: 13px; text-decoration: none; }
.link-b:hover { color: var(--nevoa); text-decoration: underline; }

.nota {
  margin: -8px 0 16px; padding: 11px 13px; border-radius: 13px; font-size: 13px; color: var(--t2);
  background: rgba(58, 92, 255, 0.1); border: 1px solid rgba(58, 92, 255, 0.3);
}

/* --- mensagem de erro (e aviso, em âmbar) --- */
.erro {
  display: none; align-items: flex-start; gap: 9px; margin-bottom: 14px; padding: 11px 13px;
  border-radius: 13px; background: rgba(239, 85, 96, 0.12); border: 1px solid rgba(239, 85, 96, 0.32);
  font-size: 13px; color: #ffb7bd;
}
.erro.on { display: flex; }
.erro .ic { width: 15px; height: 15px; margin-top: 1px; color: var(--vermelho); }
.erro.aviso { background: rgba(255, 207, 107, 0.1); border-color: rgba(255, 207, 107, 0.34); color: #ffe3a8; }
.erro.aviso .ic { color: var(--ambar); }

/* Desafio contra robô (Cloudflare Turnstile): no modo "interaction-only" a
   caixa só ganha altura quando precisa de um clique. */
.login-desafio { display: flex; justify-content: center; margin-bottom: 12px; }

/* --- botão principal --- */
.btn-login {
  position: relative; width: 100%; border-radius: 14px; padding: 15px 20px;
  font-size: 15px; font-weight: 800; color: #fff; background: var(--aurora);
  display: flex; align-items: center; justify-content: center; gap: 9px; overflow: hidden;
  box-shadow: 0 18px 30px -18px rgba(58, 92, 255, 0.95); transition: filter 0.2s, transform 0.2s;
}
.btn-login:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-login:active { transform: none; }
.btn-login:disabled { filter: grayscale(0.4) brightness(0.8); cursor: progress; transform: none; }
.btn-login .ic { width: 17px; height: 17px; }
/* carregando: o círculo gira no lugar da seta e o texto diz o que acontece */
.btn-login .girando {
  width: 17px; height: 17px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff; animation: gira 0.7s linear infinite; display: none;
}
@keyframes gira { to { transform: rotate(360deg); } }
.btn-login.carregando .ic { display: none; }
.btn-login.carregando .girando { display: block; }

.volta-e {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 16px;
  font-size: 13px; font-weight: 700; color: var(--t2);
}
.volta-e:hover { color: var(--nevoa); }
.volta-e .ic { width: 15px; height: 15px; }
.acoes-etapa { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; }

/* --- segunda etapa: o código em seis caixas --- */
.digitos { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin: 4px 0 16px; }
.digitos input {
  width: 100%; min-width: 0; aspect-ratio: 1; text-align: center; font: inherit; font-size: 22px; font-weight: 800;
  border: 1px solid var(--risco); border-radius: 13px; background: var(--papel); color: var(--nevoa);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s; padding: 0;
}
.digitos input:focus { border-color: var(--azul); box-shadow: var(--foco); }
.digitos input.cheio { border-color: rgba(58, 92, 255, 0.5); }
.digitos.ruim input { border-color: var(--vermelho); }
.alterna { display: block; margin: 14px auto 0; }

/* configurar o autenticador: o QR e a chave */
.qr { display: flex; justify-content: center; margin: 0 0 12px; }
.qr img { width: 180px; height: 180px; background: #fff; border-radius: 14px; padding: 8px; }
.chave-mfa {
  display: block; text-align: center; margin: 0 0 14px; font: 500 14px "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.08em; color: var(--nevoa); word-break: break-all; user-select: all;
}
.passos { margin: 0 0 16px; padding-left: 20px; color: var(--t2); font-size: 13.5px; display: grid; gap: 4px; }

/* códigos de recuperação */
.codigos {
  margin: 0 0 14px; padding: 12px; border-radius: 14px; background: var(--papel); border: 1px solid var(--risco);
  font: 500 15px/1.9 "JetBrains Mono", ui-monospace, monospace; letter-spacing: 0.06em; text-align: center;
  user-select: all; white-space: pre;
}
.marca-c { position: relative; display: flex; align-items: center; gap: 9px; margin: 0 0 16px; color: var(--t2); cursor: pointer; font-size: 13.5px; user-select: none; }
/* a caixa de verdade fica invisível EM CIMA do desenho: o clique cai nela e o
   leitor de tela continua vendo um checkbox */
.marca-c input { position: absolute; left: 0; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.marca-c i {
  width: 19px; height: 19px; border-radius: 6px; border: 1px solid var(--risco);
  background: var(--papel); display: grid; place-items: center; transition: background-color 0.2s, border-color 0.2s;
}
.marca-c i .ic { width: 13px; height: 13px; opacity: 0; color: #fff; }
.marca-c input:checked + i { background: var(--aurora); border-color: transparent; }
.marca-c input:checked + i .ic { opacity: 1; }
.marca-c input:focus-visible + i { box-shadow: 0 0 0 3px rgba(58, 92, 255, 0.45); }

/* entrou: o selo verde enquanto o painel abre */
.ok-fim { text-align: center; padding: 18px 0 6px; }
.ok-fim i {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 16px;
  background: rgba(18, 165, 95, 0.16); border: 1px solid rgba(18, 165, 95, 0.4); color: var(--verde);
}
.ok-fim i .ic { width: 26px; height: 26px; stroke-width: 2; }
.ok-fim b { display: block; font-size: 19px; font-weight: 800; letter-spacing: -0.03em; }
.ok-fim span { display: block; margin-top: 6px; font-size: 13.5px; color: var(--t3); }

/* --- rodapé de ajuda --- */
.ajuda {
  margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--risco);
  font-size: 13px; color: var(--t3); display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 8px 12px;
}
.ajuda a { display: inline-flex; align-items: center; gap: 7px; color: var(--nevoa); font-weight: 700; text-decoration: none; }
.ajuda a:hover { text-decoration: underline; }
.ajuda .ic { width: 15px; height: 15px; }

/* "Reduzir movimento": troca instantânea; o fundo já para no JS. O círculo do
   botão continua — ele é o aviso de que algo está acontecendo, não enfeite. */
@media (prefers-reduced-motion: reduce) {
  .passo-entra { animation: none; }
  .campo label, .campo input, .btn-login, .digitos input, .marca-c i, .campo > .ic-campo { transition: none; }
  .btn-login:hover { transform: none; }
}
