:root {
  /* Apelidos do tema (ver a nota em dashboard.css). */
  --surface-strong: var(--surface);
  --green: var(--accent-strong);
  --green-dark: var(--accent-deep);
  --shadow: var(--shadow-3);
}

* {
  box-sizing: border-box;
}

.login-page :where(:not(input):not(textarea):not(select):not([contenteditable="true"])),
.password-recovery-modal :where(:not(input):not(textarea):not(select):not([contenteditable="true"])) {
  caret-color: transparent;
}

.login-page :where(input, textarea, select, [contenteditable="true"]),
.password-recovery-modal :where(input, textarea, select, [contenteditable="true"]) {
  caret-color: auto;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: 'Poppins', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(var(--accent-rgb), 0.14), transparent 28%),
    radial-gradient(circle at bottom right, rgba(var(--scrim-rgb), 0.08), transparent 26%),
    linear-gradient(180deg, var(--surface-2) 0%, var(--surface-2) 100%);
}

.login-page {
  min-height: 100vh;
  padding: 32px;
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(1180px, 100%);
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 32px;
  align-items: center;
  justify-items: center;
}

.login-copy,
.login-panel {
  position: relative;
  z-index: 1;
}

.login-copy {
  width: 100%;
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 28px 12px;
}

.brand-logo {
  width: min(420px, 100%);
  height: auto;
  object-fit: cover;
  filter: drop-shadow(0 18px 40px rgba(var(--accent-rgb), 0.18));
}

.brand-slogan {
  max-width: 26ch;
  margin: 14px 0 0;
  font-family: 'Poppins', sans-serif;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  line-height: 1.55;
  letter-spacing: -0.01em;
  font-style: normal;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 34px;
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.panel-header {
  margin-bottom: 24px;
}

.panel-badge {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--green-dark);
  font-size: 0.8rem;
  font-weight: 700;
}

.panel-header h2 {
  margin: 16px 0 8px;
  font-size: 2rem;
  line-height: 1.1;
}

.panel-header p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 16px;
}

.form-message {
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(var(--danger-rgb), 0.1);
  border: 1px solid rgba(var(--danger-rgb), 0.18);
}

.form-message-item {
  margin: 0;
  color: var(--danger);
  font-size: 0.88rem;
  line-height: 1.5;
}

.login-form label {
  display: block;
  font-size: 0.92rem;
  font-weight: 600;
}

.login-field {
  display: grid;
  gap: 8px;
  font-size: 0.92rem;
  font-weight: 600;
}

.login-form span {
  color: var(--text);
}

.login-form input {
  width: 100%;
  padding: 15px 16px;
  border: 1px solid rgba(var(--muted-rgb), 0.2);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-form input:focus {
  border-color: rgba(var(--accent-rgb), 0.65);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

.email-field {
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(var(--muted-rgb), 0.2);
  border-radius: 16px;
  background: var(--surface);
  cursor: default;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.email-field input {
  width: min(var(--email-input-width, 220px), 100%);
  border: 0;
  border-radius: 16px;
  background: transparent;
  box-shadow: none;
}

.email-field:focus-within {
  border-color: rgba(var(--accent-rgb), 0.65);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

.login-form .email-field input:focus {
  border-color: transparent;
  box-shadow: none;
}

.password-field {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  border: 1px solid rgba(var(--muted-rgb), 0.2);
  border-radius: 16px;
  background: var(--surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.password-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 16px 0 0 16px;
  background: transparent;
  box-shadow: none;
  padding-right: 8px;
}

.password-field:focus-within {
  border-color: rgba(var(--accent-rgb), 0.65);
  box-shadow: 0 0 0 4px rgba(var(--accent-rgb), 0.12);
}

.login-form .password-field input:focus {
  border-color: transparent;
  box-shadow: none;
}

.password-visibility-toggle {
  position: static;
  flex: 0 0 54px;
  width: 54px;
  height: auto;
  align-self: stretch;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 16px 16px 0;
  background: transparent;
  box-shadow: none;
  color: rgba(var(--muted-rgb), 0.72);
  caret-color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.password-visibility-toggle:hover,
.password-visibility-toggle:focus-visible {
  background: rgba(var(--scrim-rgb), 0.06);
  color: var(--green-dark);
  filter: none;
  outline: none;
}

.password-visibility-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  pointer-events: none;
}

.field-error {
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 500;
}

.login-form button {
  margin-top: 8px;
  padding: 15px 18px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--green), var(--green-dark));
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 14px 30px rgba(var(--accent-rgb), 0.24);
}

.login-form button:hover {
  filter: brightness(1.02);
}

.login-form .password-visibility-toggle {
  margin: 0;
  padding: 0;
  background: transparent;
  color: rgba(var(--muted-rgb), 0.72);
  box-shadow: none;
}

.login-form .password-visibility-toggle:hover,
.login-form .password-visibility-toggle:focus-visible {
  background: rgba(var(--scrim-rgb), 0.05);
  color: rgba(var(--accent-rgb), 0.86);
  filter: none;
}

.login-submit-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.login-form .login-submit-button span {
  color: var(--on-accent);
}

.login-submit-button:disabled {
  cursor: wait;
  filter: none;
  opacity: 0.95;
}

.login-submit-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-top-color: var(--border-strong);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.login-submit-button.is-loading .login-submit-spinner {
  opacity: 1;
  transform: scale(1);
  animation: login-spin 0.75s linear infinite;
}

.forgot-password {
  justify-self: center;
  margin-top: -4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease;
}

.forgot-password:hover {
  color: var(--green-dark);
}

@keyframes login-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 980px) {
  .login-page {
    padding: 20px;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .brand-slogan {
    max-width: 32ch;
  }
}

@media (max-width: 640px) {
  .login-page {
    padding: 14px;
  }

  .login-copy,
  .login-panel {
    padding-left: 18px;
    padding-right: 18px;
  }

  .panel-header h2 {
    font-size: 1.6rem;
  }
}

/* "Sair" da tela de troca de senha inicial: virou <button> num <form> POST
   (ver templates/accounts/_logout_form.html). Mantem a aparencia de link. */
.logout-form {
  display: contents;
}

button.logout-link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--accent, var(--accent));
  text-decoration: underline;
  cursor: pointer;
}

/* ===========================================================================
   PointZap — ACABAMENTO DA TELA DE ENTRADA
   ---------------------------------------------------------------------------
   E a primeira tela que qualquer pessoa ve, e a unica onde a marca aparece
   inteira (logo + assinatura). Por isso ela ganha o efeito mais forte do
   sistema: a AURORA — tres manchas de verde/azul girando devagar atras do
   conteudo, feitas com gradiente e `filter: blur`, sem imagem para baixar.

   Todo o movimento respeita `prefers-reduced-motion` (regra no fim deste bloco).
   =========================================================================== */

.login-page {
  position: relative;
  overflow: hidden;
}

.login-aurora {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.login-aurora-blob {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  will-change: transform;
}

.login-aurora-1 {
  width: 46vw;
  height: 46vw;
  top: -14vw;
  right: -10vw;
  background: radial-gradient(circle, rgba(var(--accent-rgb), 0.55), transparent 68%);
  animation: login-flutua-1 22s ease-in-out infinite;
}

.login-aurora-2 {
  width: 38vw;
  height: 38vw;
  bottom: -12vw;
  left: -8vw;
  background: radial-gradient(circle, rgba(var(--blue-rgb), 0.42), transparent 68%);
  animation: login-flutua-2 27s ease-in-out infinite;
}

/* A terceira e o limao do logo, bem diluido: e o que amarra a tela com a marca. */
.login-aurora-3 {
  width: 26vw;
  height: 26vw;
  top: 42%;
  left: 46%;
  background: radial-gradient(circle, rgba(159, 246, 25, 0.22), transparent 66%);
  animation: login-flutua-3 19s ease-in-out infinite;
}

:root[data-tema="claro"] .login-aurora-blob {
  opacity: 0.4;
}

@keyframes login-flutua-1 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(-4vw, 3vw, 0) scale(1.08); }
}

@keyframes login-flutua-2 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(3vw, -3vw, 0) scale(1.12); }
}

@keyframes login-flutua-3 {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.5; }
  50% { transform: translate3d(-2vw, -2vw, 0) scale(0.92); opacity: 0.8; }
}

/* ---- marca ---- */

.login-copy {
  gap: 6px;
  align-content: center;
}

.brand-logo {
  width: min(460px, 100%);
  object-fit: contain;
  filter: drop-shadow(0 18px 60px rgba(var(--accent-rgb), 0.35));
  animation: zp-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* A assinatura do logo repetida em texto: o PNG nao e selecionavel nem lido por
   leitor de tela, e essa frase e a promessa do produto. */
.brand-slogan {
  max-width: 30ch;
  margin: 4px 0 0;
  font-size: clamp(1.05rem, 1.9vw, 1.32rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  background: var(--accent-grad-lime);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: zp-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) 90ms both;
}

.brand-support {
  max-width: 44ch;
  margin: 10px 0 0;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.65;
  font-weight: 500;
  color: var(--muted);
  animation: zp-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) 160ms both;
}

/* ---- cartao de acesso ---- */

.login-panel {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(22px) saturate(150%);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow-3), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  animation: zp-rise 700ms cubic-bezier(0.16, 1, 0.3, 1) 120ms both;
}

@supports not (backdrop-filter: blur(2px)) {
  .login-panel { background: var(--surface); }
}

/* Fio de luz verde no topo do cartao: o mesmo degrade do logo, 1px. */
.login-panel::after {
  content: '';
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(var(--accent-rgb), 0.9), transparent);
}

/* BRILHO QUE PASSA uma vez, ao abrir a tela. Nao fica em loop de proposito: em
   loop viraria distracao numa tela onde a pessoa esta digitando senha. */
.login-panel::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  animation: zp-sheen 1.5s ease-out 500ms 1 both;
  pointer-events: none;
}

.panel-badge {
  background: rgba(var(--accent-rgb), 0.16);
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-submit-button {
  background: var(--accent-grad);
  border: 1px solid rgba(var(--accent-rgb), 0.5);
  box-shadow: var(--glow-soft);
  transition: transform var(--t-fast), box-shadow var(--t), filter var(--t);
}

.login-submit-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--glow);
  filter: saturate(115%);
}

.login-submit-button:active:not(:disabled) {
  transform: translateY(0) scale(0.995);
}

/* ---- botao de tema (canto da tela) ---- */

.login-theme-toggle {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-soft);
  font: 600 0.8rem/1 'Poppins', sans-serif;
  cursor: pointer;
  transition: color var(--t), border-color var(--t), background var(--t);
}

.login-theme-toggle:hover {
  color: var(--text);
  border-color: rgba(var(--accent-rgb), 0.45);
  background: rgba(var(--accent-rgb), 0.12);
}

@media (max-width: 900px) {
  .login-aurora-blob { filter: blur(60px); }
  .brand-support { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .login-aurora-blob,
  .login-panel::before,
  .brand-logo,
  .brand-slogan,
  .brand-support,
  .login-panel {
    animation: none !important;
  }
}

/* ───────────────────────────────────────────────────────────────────────────
   MARCA da tela de entrada: simbolo (imagem) + nome (TEXTO).

   O nome NAO fica dentro da imagem, e isso foi aprendido errando: um SVG com o
   nome escrito e `currentColor` parecia resolver os dois temas num arquivo so,
   mas SVG carregado por <img> e documento isolado — `currentColor` nao herda a
   cor da pagina, cai no preto, e o nome sumia no tema escuro. Foi pego na
   conferencia visual, nao nos testes (o HTML estava correto).

   Com o nome em texto: o token do tema o colore, ele e selecionavel, lido por
   leitor de tela, escala sem borrar, e trocar `PLATFORM_NAME` muda esta tela.
   ─────────────────────────────────────────────────────────────────────────── */
/* O LOGOTIPO POR EXTENSO (icone em cima, "pointzap" embaixo). Largura fluida com
   teto, e `height: auto` para a proporcao (~1,3:1) nunca ser espremida.
   ⚠️ `display: block` + `margin` zero a esquerda: como <img> e inline por padrao,
   ele ganharia a folga de linha de base embaixo e a marca pareceria desalinhada do
   slogan que vem logo abaixo. */
.brand-logo {
  display: block;
  width: clamp(230px, 30vw, 380px);
  height: auto;
  filter: drop-shadow(0 18px 40px rgba(var(--accent-rgb), 0.28));
}

@media (max-width: 720px) {
  .brand-logo {
    margin-inline: auto;
  }
}

/* "Ainda nao tem conta? Assine" — o caminho para a inscricao (templates/publico/). */
.login-assinar {
  margin: 18px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

.login-assinar a {
  color: var(--accent-strong);
  font-weight: 700;
}
