/* ═══════════════════════════════════════════════════════════════
   Auth pages — login, signup e recuperação de senha
   Split layout: painel esquerdo (identidade do tenant) + formulário
   Cor da prefeitura via --auth-brand (injetada de SiteConfig);
   neutros fixos do design system Terreno Firme.
   ═══════════════════════════════════════════════════════════════ */

:root {
  --auth-brand: #5e7257;
  --auth-brand-hover: #45533f;
  /* Link legível sobre cream mesmo quando o tenant troca --auth-brand:
     puxa a cor da marca em direção ao ink. */
  --auth-link: color-mix(in srgb, var(--auth-brand) 72%, #2f3835);
  --auth-ink: #2f3835;        /* charcoal-dark — texto principal */
  --auth-ink-soft: #4a5651;   /* charcoal — texto secundário */
  --auth-paper: #f4f1ec;      /* cream — fundo do painel de formulário */
  --auth-paper-mid: #eae6de;  /* cream-mid — affix dos inputs */
  --auth-line: #d8d2c6;       /* cream-dark — bordas */
  --auth-icon: #5f6d68;       /* ícones/placeholder ≥4.5:1 sobre branco */
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  color: var(--auth-ink);
}

/* ── Layout ──────────────────────────────────────────────────── */
.auth-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Painel esquerdo — identidade ────────────────────────────── */
.auth-left {
  position: relative;
  width: 42%;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2.5rem;
  overflow: hidden;
  /* Cor da prefeitura escurecida (chapada, sem gradiente) +
     grade de carta topográfica */
  background:
    repeating-linear-gradient(0deg,
      transparent, transparent 49px,
      rgba(255,255,255,.06) 49px, rgba(255,255,255,.06) 50px),
    repeating-linear-gradient(90deg,
      transparent, transparent 49px,
      rgba(255,255,255,.06) 49px, rgba(255,255,255,.06) 50px),
    color-mix(in srgb, var(--auth-brand) 72%, #1a1e1c);
}

/* Linhas diagonais sutis — textura de hachura cartográfica */
.auth-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 28px,
    rgba(255,255,255,.025) 28px,
    rgba(255,255,255,.025) 29px
  );
  pointer-events: none;
}

.auth-brand {
  position: relative;
  z-index: 1;
  text-align: center;
  color: #fff;
}

/* Logo do tenant em cores originais sobre placa branca —
   funciona para qualquer brasão/logo municipal colorido. */
.auth-brand-logo {
  display: inline-block;
  max-height: 96px;
  max-width: 240px;
  width: auto;
  object-fit: contain;
  margin-bottom: 1.75rem;
  padding: .65rem .9rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(26,30,28,.25);
}

.auth-brand-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.01em;
  margin: 0 0 .4rem;
  line-height: 1.25;
  text-wrap: balance;
}

.auth-brand-sub {
  font-size: .82rem;
  color: rgba(255,255,255,.78);
  line-height: 1.5;
  max-width: 260px;
  margin: 0 auto;
}

/* Tags na base do painel esquerdo */
.auth-tags {
  position: relative;
  z-index: 1;
  margin-top: 3rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  justify-content: center;
}
.auth-tag {
  font-size: .68rem;
  padding: .25em .7em;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
  letter-spacing: .03em;
}

/* ── Painel direito — formulário ─────────────────────────────── */
.auth-right {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 2rem;
  background: var(--auth-paper);
  overflow-y: auto;
}

.auth-form-box {
  width: 100%;
  max-width: 420px;
}

.auth-form-box h2 {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--auth-ink);
  margin-bottom: .3rem;
  text-wrap: balance;
}

.auth-form-box .auth-subtitle {
  font-size: .875rem;
  color: var(--auth-ink-soft);
  margin-bottom: 2rem;
}

/* ── Controles de formulário ─────────────────────────────────── */
.form-control {
  padding: .65rem 1rem;
  border-radius: 8px;
  background-color: #fff;
  border: 1px solid var(--auth-line);
  color: var(--auth-ink);
  font-size: .9rem;
  transition: border-color .15s ease-out, box-shadow .15s ease-out;
}
.form-control::placeholder { color: var(--auth-icon); }
.form-control:focus {
  background-color: #fff;
  border-color: var(--auth-brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-brand) 22%, transparent);
  outline: none;
  color: var(--auth-ink);
}

.input-group-text {
  border-radius: 8px 0 0 8px;
  background-color: var(--auth-paper-mid);
  border: 1px solid var(--auth-line);
  border-right: none;
  color: var(--auth-icon);
}
.input-group .form-control {
  border-left: none;
  border-radius: 0 8px 8px 0;
}
.input-group:focus-within .input-group-text {
  border-color: var(--auth-brand);
  color: var(--auth-brand);
  background-color: var(--auth-paper-mid);
}

/* ── Botão principal ─────────────────────────────────────────── */
.btn-custom {
  background-color: var(--auth-brand);
  color: #fff;
  padding: .7rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: .9rem;
  width: 100%;
  border: none;
  transition: background-color .15s ease-out, transform .15s ease-out, box-shadow .2s ease-out;
  letter-spacing: .01em;
}
.btn-custom:hover {
  background-color: var(--auth-brand-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(26,30,28,.18);
}
.btn-custom:active {
  background-color: var(--auth-brand-hover);
  transform: translateY(0);
  box-shadow: none;
}
.btn-custom:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-brand) 35%, transparent);
}

.btn-outline-secondary {
  border-radius: 8px;
  border: 1px solid var(--auth-line);
  background-color: #fff;
  color: var(--auth-ink-soft);
  padding: .5rem 1rem;
  font-size: .85rem;
  transition: background .15s ease-out, border-color .15s ease-out, color .15s ease-out;
}
.btn-outline-secondary:hover {
  background-color: var(--auth-brand);
  border-color: var(--auth-brand);
  color: #fff;
}

/* ── Links ───────────────────────────────────────────────────── */
.auth-links {
  font-size: .875rem;
  margin-top: 1rem;
  text-align: center;
  color: var(--auth-ink-soft);
}
.auth-links a {
  text-decoration: none;
  color: var(--auth-link);
  font-weight: 600;
}
.auth-links a:hover { text-decoration: underline; }

a[href*="recover"] {
  color: var(--auth-link) !important;
}
a:focus-visible {
  outline: 2px solid var(--auth-brand);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ── Misc ────────────────────────────────────────────────────── */
.required::after { content: " *"; color: #9a4040; }
.invalid-tooltip-custom { display: none; }

/* Label acessível invisível — eMAG/WCAG (placeholder não substitui label) */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Divisor */
.auth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  color: var(--auth-ink-soft);
  font-size: .78rem;
  margin: 1.25rem 0;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--auth-line);
}

/* ── Responsivo ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .auth-wrapper { flex-direction: column; }

  /* Identidade vira faixa compacta no topo — logo e nome continuam visíveis */
  .auth-left {
    width: 100%;
    flex-direction: row;
    padding: 1rem 1.25rem;
  }
  .auth-brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    text-align: left;
  }
  .auth-brand-logo {
    max-height: 52px;
    max-width: 150px;
    margin-bottom: 0;
    padding: .35rem .5rem;
    border-radius: 8px;
  }
  .auth-brand-title { font-size: 1rem; margin: 0; }
  .auth-brand-sub, .auth-tags { display: none; }

  .auth-right { background: var(--auth-paper); padding: 2rem 1.25rem; }
  .auth-form-box { max-width: 100%; }
}

/* ── Movimento reduzido ──────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .form-control, .btn-custom, .btn-outline-secondary { transition: none; }
  .btn-custom:hover { transform: none; }
}
