/* ============================================================
   login.css — acesso ao painel, 2026-09-07.

   Direção: editorial + operacional. A tela usa os mesmos tokens/temas do
   painel, mas sua composição é própria: contexto da Central, uma pequena
   pauta de áreas e o formulário em etapas. O cartão é opaco e legível; o
   ambiente, não o conteúdo, recebe textura e profundidade.
   ============================================================ */

[hidden] { display: none !important; }

/* ---------- ambiente ---------- */

.auth-body {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

.auth-body::before {
  content: "";
  position: fixed;
  inset: 54px 0 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--border) 34%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--border) 24%, transparent) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 78% 70% at 38% 32%, #000 12%, transparent 78%);
  mask-image: radial-gradient(ellipse 78% 70% at 38% 32%, #000 12%, transparent 78%);
  opacity: .72;
}

.auth-body .main { min-height: 100dvh; }

.auth-topbar {
  min-height: 54px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.auth-brand__mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 7%, transparent);
}

.auth-brand__mark svg { width: 19px; height: 19px; }

.auth-brand__copy {
  display: grid;
  line-height: 1.1;
}

.auth-brand__copy strong {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.02em;
}

.auth-brand__copy small {
  margin-top: 3px;
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .04em;
}

.topbar--nav .auth-chip {
  height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--text-2);
  font-size: 11.5px;
  font-weight: 650;
}

.auth-chip svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--accent);
}

.auth-body .content.auth {
  display: grid;
  width: 100%;
  max-width: 1280px;
  padding: clamp(38px, 6vh, 68px) clamp(24px, 4vw, 52px) clamp(48px, 8vh, 88px);
}

.auth-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(400px, .82fr);
  align-items: center;
  gap: clamp(52px, 8vw, 112px);
  width: 100%;
  min-width: 0;
}

/* ---------- contexto editorial ---------- */

.auth-context {
  width: min(100%, 600px);
  min-width: 0;
  padding: 12px 0;
  animation: authContextIn .42s cubic-bezier(0, 0, .2, 1) both;
}

.auth-context__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.auth-context__eyebrow i {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-ring);
}

.auth-context__title {
  margin-top: 22px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(44px, 5.2vw, 72px);
  font-weight: 680;
  letter-spacing: -.055em;
  line-height: .98;
  text-wrap: balance;
}

.auth-context__title span { color: var(--accent); }

.auth-context__lead {
  max-width: 500px;
  margin-top: 22px;
  color: var(--text-2);
  font-size: clamp(14px, 1.3vw, 16px);
  line-height: 1.65;
  text-wrap: pretty;
}

.auth-ledger {
  width: min(100%, 520px);
  margin-top: 42px;
  border-top: 1px solid var(--border-strong);
}

.auth-ledger__row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  min-height: 70px;
  border-bottom: 1px solid var(--border);
}

.auth-ledger__num {
  align-self: start;
  padding-top: 18px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
}

.auth-ledger__row p { display: grid; gap: 2px; min-width: 0; }

.auth-ledger__row strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 650;
}

.auth-ledger__row small {
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.4;
}

.auth-ledger__row > svg {
  width: 18px;
  height: 18px;
  color: var(--text-3);
}

@keyframes authContextIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* ---------- painel de acesso ---------- */

.auth-panel {
  width: min(100%, 470px);
  justify-self: end;
  min-width: 0;
}

.auth-card {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: clamp(26px, 3.2vw, 34px);
  border: 1px solid var(--border-strong);
  border-radius: clamp(18px, 2vw, 24px);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  box-shadow: var(--shadow-card), 0 34px 90px -52px color-mix(in srgb, var(--accent) 64%, transparent);
  animation: authCardIn .42s .05s cubic-bezier(0, 0, .2, 1) both;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: clamp(26px, 3.2vw, 34px);
  width: 74px;
  height: 3px;
  border-radius: 0 0 999px 999px;
  background: var(--accent);
  box-shadow: 0 0 24px var(--accent-ring);
}

.auth-card--enroll { width: 100%; }

@keyframes authCardIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- etapas ---------- */

.auth-steps {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 0 0 30px;
  padding: 0;
  list-style: none;
}

.auth-steps::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 28px;
  right: 28px;
  height: 1px;
  background: var(--border-strong);
}

.auth-step {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--text-3);
}

.auth-step:last-child { justify-self: end; }

.auth-step > span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-3);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
}

.auth-step > span svg { width: 14px; height: 14px; }

.auth-step small {
  padding: 0 4px;
  background: var(--surface);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.auth-step.is-current { color: var(--text); }

.auth-step.is-current > span {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 0 0 5px var(--accent-ring);
}

.auth-step.is-done { color: var(--text-2); }

.auth-step.is-done > span {
  border-color: var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ---------- cabeçalho ---------- */

.auth-head { margin-bottom: 24px; }

.auth-kicker,
.auth-head .in-lab {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: .09em;
  text-transform: uppercase;
}

.auth-title {
  color: var(--text);
  font-family: var(--font-display);
  font-size: clamp(25px, 3vw, 31px);
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.08;
  text-wrap: balance;
}

.auth-sub {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.55;
  text-wrap: pretty;
}

.auth-sub b {
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* ---------- formulário ---------- */

.auth-form { display: grid; gap: 18px; }
.auth-fields { display: grid; gap: 16px; }
.auth-field { display: grid; min-width: 0; }

.auth-label {
  display: block;
  width: fit-content;
  margin-bottom: 7px;
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
}

.auth-control {
  display: flex;
  align-items: center;
  min-height: 50px;
  gap: 11px;
  padding-left: 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 54%, var(--surface));
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.auth-control:hover { border-color: color-mix(in srgb, var(--text-3) 60%, transparent); }

.auth-control:focus-within {
  border-color: var(--accent-border);
  background: var(--surface-2);
  box-shadow: 0 0 0 4px var(--accent-ring);
}

.auth-control:has(input[aria-invalid="true"]) {
  border-color: var(--rose-border);
  box-shadow: 0 0 0 3px var(--rose-soft);
}

.auth-control__ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  color: var(--text-3);
  transition: color .15s ease;
}

.auth-control:focus-within .auth-control__ico { color: var(--accent); }

.auth-control input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font: inherit;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
  appearance: none;
}

.auth-control input:disabled { color: var(--text-3); cursor: not-allowed; }

.auth-control input:-webkit-autofill,
.auth-control input:-webkit-autofill:hover,
.auth-control input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset;
  box-shadow: 0 0 0 1000px var(--surface-2) inset;
  caret-color: var(--text);
}

.auth-toggle {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: 3px;
  flex-shrink: 0;
  border-radius: calc(var(--radius) - 4px);
  color: var(--text-3);
  transition: color .15s ease, background .15s ease;
  touch-action: manipulation;
}

.auth-toggle:hover:not(:disabled) { color: var(--text); background: var(--accent-soft); }
.auth-toggle:disabled { opacity: .4; cursor: not-allowed; }
.auth-toggle svg { width: 18px; height: 18px; }
.auth-toggle .icon-eye-off { display: none; }
.auth-toggle.is-visible .icon-eye { display: none; }
.auth-toggle.is-visible .icon-eye-off { display: block; }

.auth-field__note,
.auth-hint {
  min-height: 17px;
  margin-top: 6px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.45;
}

.auth-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--gold);
  font-weight: 650;
}

.auth-hint svg { display: none; width: 13px; height: 13px; flex-shrink: 0; }
.auth-hint.is-on svg { display: block; }

.auth-hint--nota {
  min-height: auto;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 500;
}

.auth-expira { font-variant-numeric: tabular-nums; }

/* ---------- alertas ---------- */

.auth-alert {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px 9px;
  padding: 11px 12px;
  border: 1px solid var(--rose-border);
  border-radius: var(--radius-sm);
  background: var(--rose-soft);
  color: var(--danger-text);
  font-size: 12.5px;
  line-height: 1.5;
}

.auth-alert:focus { outline: none; }
.auth-alert:focus-visible { outline: 2px solid var(--rose-border); outline-offset: 2px; }

.auth-alert--locked {
  border-color: var(--gold-border);
  background: var(--gold-soft);
  color: var(--text);
}

.auth-alert--locked .auth-alert__ico { color: var(--gold); }
.auth-alert--locked:focus-visible { outline-color: var(--gold-border); }
.auth-alert__ico { width: 17px; height: 17px; margin-top: 1px; flex-shrink: 0; }

.auth-alert__count {
  grid-column: 2;
  min-height: 18px;
  color: var(--gold);
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* ---------- código e cadastramento do autenticador ---------- */

.auth-field--totp .auth-control { padding-left: 0; }
.auth-field--totp .auth-control__ico { display: none; }

.auth-field--totp .auth-control input {
  height: 54px;
  padding: 0 12px;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: .42em;
  text-indent: .42em;
  text-align: center;
}

.enroll {
  display: grid;
  gap: 11px;
  justify-items: center;
}

.enroll__qr {
  display: grid;
  place-items: center;
  width: min(184px, 100%);
  aspect-ratio: 1;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: #fff;
  color-scheme: only light;
  forced-color-adjust: none;
  box-shadow: 0 14px 40px -28px var(--border-strong);
  box-shadow: 0 14px 40px -28px color-mix(in srgb, var(--text) 60%, transparent);
}

.enroll__qr svg,
.enroll__qr img {
  display: block;
  width: 100%;
  height: 100%;
  aspect-ratio: 1;
  image-rendering: pixelated;
}

.enroll__hint {
  color: var(--text-2);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.enroll__chave {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
}

.enroll__secret {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .04em;
  line-height: 1.5;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}

.enroll__copiar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 12px;
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 12.5px;
  font-weight: 650;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
  touch-action: manipulation;
}

.enroll__copiar svg { width: 15px; height: 15px; }
.enroll__copiar:hover { color: var(--text); border-color: var(--accent-border); }
.enroll__copiar.is-ok { color: var(--accent); border-color: var(--accent-border); background: var(--accent-soft); }

/* ---------- ação principal ---------- */

.auth-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 750;
  box-shadow: 0 16px 34px -22px var(--accent-border);
  box-shadow: 0 16px 34px -22px color-mix(in srgb, var(--accent) 80%, transparent);
  transition: filter .15s ease, transform .1s ease, box-shadow .15s ease;
  touch-action: manipulation;
}

.auth-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow: 0 18px 40px -20px color-mix(in srgb, var(--accent) 88%, transparent);
}

.auth-btn:active:not(:disabled) { transform: translateY(1px); }
.auth-btn:disabled { cursor: not-allowed; opacity: .55; filter: saturate(.6); }
.auth-btn.is-loading { cursor: wait; }

.auth-btn[data-locked]:disabled {
  opacity: 1;
  filter: none;
  border: 1px solid var(--gold-border);
  background: var(--gold-soft);
  color: var(--gold);
  box-shadow: none;
}

.auth-btn[data-locked] .auth-btn__arrow { display: none; }
.auth-btn__arrow,
.auth-btn__spinner { width: 17px; height: 17px; flex-shrink: 0; }
.auth-btn__arrow { transition: transform .15s ease; }
.auth-btn:hover:not(:disabled) .auth-btn__arrow { transform: translateX(3px); }
.auth-btn__spinner { display: none; }
.auth-btn.is-loading .auth-btn__arrow { display: none; }
.auth-btn.is-loading .auth-btn__spinner { display: block; animation: authSpin .8s linear infinite; }

@keyframes authSpin { to { transform: rotate(360deg); } }

/* ---------- rodapé ---------- */

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 18px;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.45;
  text-align: center;
}

.auth-foot svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--accent); }

.auth-foot__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  color: var(--text-2);
  font-weight: 650;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 4px;
}

.auth-foot__link:hover { color: var(--accent); text-decoration-color: currentColor; }

/* ---------- responsivo ---------- */

@media (max-width: 980px) {
  .auth-body .content.auth {
    max-width: 620px;
    padding: 34px 20px 56px;
  }

  .auth-stage { grid-template-columns: 1fr; gap: 28px; }
  .auth-stage--verify .auth-context { display: none; }
  .auth-context { width: 100%; padding: 0 10px; }
  .auth-context__title { margin-top: 14px; font-size: clamp(32px, 7vw, 46px); line-height: 1.04; }
  .auth-context__lead { max-width: 540px; margin-top: 12px; font-size: 13.5px; }
  .auth-ledger { display: none; }
  .auth-panel { width: 100%; max-width: 500px; justify-self: center; }
}

@media (max-width: 560px) {
  .auth-topbar { padding-inline: 12px; }
  .auth-brand__copy small { display: none; }
  .auth-chip { padding-inline: 10px !important; }
  .auth-chip span { font-size: 0; }
  .auth-chip span::after { content: "Protegido"; font-size: 11px; }

  .auth-body::before {
    background-size: 48px 48px;
    -webkit-mask-image: linear-gradient(#000, transparent 74%);
    mask-image: linear-gradient(#000, transparent 74%);
  }

  .auth-body .content.auth { padding: 24px 12px 40px; }
  .auth-stage { gap: 20px; }
  .auth-context { padding: 0 8px; }
  .auth-context__eyebrow { font-size: 10px; }
  .auth-context__title { margin-top: 11px; font-size: clamp(28px, 9vw, 36px); }
  .auth-context__lead { margin-top: 9px; line-height: 1.5; }
  .auth-card { padding: 24px 18px 22px; border-radius: 18px; }
  .auth-card::before { left: 18px; }
  .auth-steps { margin-bottom: 24px; }
  .auth-step { grid-template-columns: 28px; gap: 0; }
  .auth-step small { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .auth-title { font-size: 25px; }
  .auth-head { margin-bottom: 21px; }
  .auth-form { gap: 17px; }
  .auth-fields { gap: 14px; }
  .auth-control input { font-size: 16px; }
  .auth-foot { padding-inline: 8px; }
  .enroll__copiar span { display: none; }
  .enroll__copiar { padding: 0 11px; }
}

@media (max-width: 360px) {
  .auth-body .content.auth { padding-inline: 10px; }
  .auth-context__lead { font-size: 13px; }
  .auth-card { padding-inline: 16px; }
  .auth-card::before { left: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-context,
  .auth-card { animation: none; }

  .auth-btn,
  .auth-btn__arrow,
  .auth-control,
  .auth-control__ico,
  .auth-toggle,
  .enroll__copiar { transition: none; }

  .auth-btn.is-loading .auth-btn__spinner { animation-duration: 1.6s; }
}

@media (forced-colors: active) {
  .auth-context__eyebrow i,
  .auth-card::before { background: CanvasText; }

  .auth-step.is-current > span { border: 2px solid CanvasText; }
}
