/* Login do MHO Cloud no visual do mho-portal (apps/portal/src/components/auth/login-stage.css).
   Injetado no <head> pelo nginx (mhocloud.conf, sub_filter) junto com login.js. O form continua
   sendo o do TB (Angular): login, 2FA, OAuth e "esqueci a senha" seguem nativos — aqui só muda a
   pele. White-label: acento e painel usam --tb-login-primary-500 (cor primária do white-label de
   login daquele domínio, publicada pelo próprio TB); .dark-foreground (também do TB) = conteúdo
   escuro sobre ela, senão claro. Nada de cor de marca fixa aqui além do fallback. Tudo escopado em .mho-stage, classe que login.js põe no container da tela de auth
   (.tb-login-content / .tb-password-content); fora dessas telas este arquivo não casa nada. */

@font-face {
  font-family: "Mho Geist";
  src: url("/mho/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Mho DM Sans";
  src: url("/mho/fonts/DMSans-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Mho Geist Mono";
  src: url("/mho/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* ---------- palco: painel à esquerda, form à direita ---------- */
.mho-stage {
  --mho-ink: #061b31;
  --mho-muted: #64748d;
  --mho-faint: #94a3b8;
  --mho-line: #e5edf5;
  --mho-soft: #f6f9fc;
  --mho-blue: var(--tb-login-primary-500, #1d41ff);
  --mho-red: #ef4444;
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch !important;
  justify-content: stretch !important;
  gap: 18px;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  padding: 16px;
  /* PWA do white-label (services/whitelabel-worker): viewport-fit=cover + status bar translúcida no
     iOS — sem o safe-area o painel entra embaixo do notch */
  padding-top: max(16px, env(safe-area-inset-top, 0px));
  padding-bottom: max(16px, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  overflow-y: auto;
  background: #ffffff !important;
  color: var(--mho-muted);
  color-scheme: light;
  font-family: "Mho DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.mho-stage *,
.mho-stage *::before,
.mho-stage *::after { box-sizing: border-box; }

.mho-stage-panel {
  position: relative;
  overflow: hidden;
  min-height: 300px;
  border-radius: 28px;
  background: var(--mho-blue);
  --mho-fg: 255, 255, 255;
  color: rgb(var(--mho-fg));
  padding: 24px 24px 28px;
  display: flex;
  flex-direction: column;
}
.mho-stage.dark-foreground .mho-stage-panel { --mho-fg: 6, 27, 49; }
.mho-stage-grid {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}
.mho-stage-brand,
.mho-stage-copy { position: relative; z-index: 1; }
/* imagem do cliente (login.imageUrl): cobre o painel; degradês da cor primária sob o logo e o texto
   mantêm o contraste que o darkForeground do white-label escolheu, seja qual for a foto */
.mho-stage-image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.mho-stage-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom, color-mix(in srgb, var(--mho-blue) 70%, transparent), transparent 22%),
    linear-gradient(to top, var(--mho-blue) 8%, color-mix(in srgb, var(--mho-blue) 55%, transparent) 45%, transparent 75%);
}
.mho-stage-brand { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.mho-stage-brand img { height: 52px; width: auto; max-width: 240px; object-fit: contain; display: block; }
/* white-label de cliente: sem hero, o logo dele desce e cresce no lugar do título */
.mho-stage-panel--brand .mho-stage-brand { margin-top: auto; }
.mho-stage-panel--brand .mho-stage-brand img { height: 72px; max-width: 70%; }
.mho-stage-copy { margin-top: auto; display: grid; width: max-content; max-width: 100%; }
.mho-stage-copy h1 {
  margin: 0;
  font-family: "Mho Geist", system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(22px, 4.5vw, 44px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: rgba(var(--mho-fg), 0.72);
}
.mho-stage-copy h1 .line { display: block; white-space: nowrap; }
.mho-stage-copy p {
  width: 0;
  min-width: 100%;
  margin: 18px 0 0;
  color: rgba(var(--mho-fg), 0.8);
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}
.mho-stage-copy .mho-stage-proof { margin-top: 10px; color: rgba(var(--mho-fg), 0.6); font-size: 13px; }
.mho-hero-rotator {
  display: inline-grid;
  vertical-align: bottom;
  overflow: hidden;
  padding: 0 4px;
  margin: 0 -4px;
}
.mho-hero-rotator .w {
  grid-area: 1 / 1;
  justify-self: start;
  white-space: nowrap;
  color: rgb(var(--mho-fg));
  font-weight: 600;
  opacity: 0;
  transform: translateY(70%);
  filter: blur(3px);
  transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.5s ease;
}
/* revezamento (login.js › rotate): entra de baixo, sai pra cima */
.mho-hero-rotator .w.is-on { opacity: 1; transform: translateY(0); filter: blur(0); }
.mho-hero-rotator .w.is-off {
  opacity: 0;
  transform: translateY(-70%);
  filter: blur(3px);
  transition-timing-function: cubic-bezier(0.7, 0, 0.84, 0);
}
.mho-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.mho-hero-in { animation: mho-fade-in-up 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes mho-fade-in-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- coluna do form: o mat-card do TB vira o "stage-card" ---------- */
.mho-stage > .mat-mdc-card {
  align-self: center;
  justify-self: center;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 25rem !important;
  max-height: none !important;
  overflow: visible !important;
  margin: 12px 0 28px;
  background: transparent !important;
  box-shadow: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  color: var(--mho-muted);
  font-family: inherit;
}
.mho-stage .mat-mdc-card-content,
.mho-stage .mat-mdc-card-header { padding: 0 !important; }
.mho-stage .mat-mdc-card-header { justify-content: center; margin-bottom: 22px; }

/* logo do TB sai do card (vai pro painel); o espaçador e o toast ficam */
.mho-stage .tb-login-form img[aria-label="logo"] { display: none; }
.mho-stage .tb-login-form > .flex > div:first-child:has(> img[aria-label="logo"]) { display: none !important; }

/* título: "Entrar na sua conta" / "Solicitar redefinição de senha" (texto do TB, já traduzido) */
.mho-stage .tb-login-form .title,
.mho-stage .mat-mdc-card-title {
  margin: 0 0 22px !important;
  font-family: "Mho Geist", system-ui, sans-serif !important;
  font-weight: 500 !important;
  font-size: 28px !important;
  line-height: 1.2 !important;
  letter-spacing: -0.03em;
  color: var(--mho-ink) !important;
  text-align: center;
  text-wrap: balance;
}
.mho-stage .mat-mdc-card-header .mat-mdc-card-title { margin-bottom: 0 !important; }

/* ---------- campos: rótulo mono em caixa alta em cima, caixa de 48px ---------- */
.mho-stage .mho-field-label {
  display: block;
  margin: 0 0 8px;
  font-family: "Mho Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mho-faint);
  text-align: left;
}
.mho-stage .mat-mdc-form-field { width: 100%; margin-bottom: 2px !important; }
.mho-stage .mat-mdc-form-field .mdc-notched-outline,
.mho-stage .mat-mdc-form-field .mat-mdc-floating-label,
.mho-stage .mat-mdc-form-field .mat-mdc-form-field-icon-prefix { display: none !important; }
.mho-stage .mat-mdc-text-field-wrapper {
  min-height: 48px;
  padding: 0 4px 0 14px !important;
  border: 1px solid var(--mho-line);
  border-radius: 12px !important;
  background: #fff !important;
  transition: border-color 160ms ease;
}
.mho-stage .mat-mdc-form-field.mat-focused .mat-mdc-text-field-wrapper { border-color: var(--mho-blue); }
.mho-stage .mat-mdc-form-field.mat-form-field-invalid.ng-touched .mat-mdc-text-field-wrapper { border-color: var(--mho-red); }
.mho-stage .mat-mdc-form-field-flex { align-items: center; min-height: 46px; }
.mho-stage .mat-mdc-form-field-infix {
  min-height: 46px !important;
  padding: 0 !important;
  display: flex;
  align-items: center;
}
.mho-stage .mat-mdc-form-field-infix input {
  font-family: "Mho DM Sans", system-ui, sans-serif !important;
  font-size: 15px !important;
  color: var(--mho-ink) !important;
  caret-color: var(--mho-blue) !important;
}
.mho-stage .mat-mdc-form-field-infix input::placeholder { color: #c3ccd8 !important; opacity: 1; }
.mho-stage .mat-mdc-form-field-infix input:-webkit-autofill {
  -webkit-text-fill-color: var(--mho-ink);
  box-shadow: 0 0 0 1000px #fff inset;
}
.mho-stage .mat-mdc-form-field-icon-suffix .mat-icon { color: var(--mho-faint) !important; font-size: 20px; }
.mho-stage .mat-mdc-form-field-icon-suffix .mat-mdc-icon-button:hover .mat-icon { color: var(--mho-ink) !important; }
.mho-stage .mat-mdc-form-field-subscript-wrapper { min-height: 12px; }
.mho-stage .mat-mdc-form-field-error { font-size: 12px; color: var(--mho-red) !important; }

/* ---------- botões ---------- */
.mho-stage .mat-mdc-unelevated-button[type="submit"] {
  margin-top: 6px;
  min-height: 48px;
  width: 100%;
  border-radius: 980px !important;
  background: var(--mho-blue) !important;
  color: #fff !important;
  font-family: "Mho Geist", system-ui, sans-serif !important;
  font-weight: 500 !important;
  font-size: 15px !important;
  letter-spacing: 0 !important;
  transition: opacity 180ms ease;
}
/* primária clara (darkForeground no white-label): texto escuro no botão, como no painel */
.mho-stage.dark-foreground .mat-mdc-unelevated-button[type="submit"] { color: #061b31 !important; }
.mho-stage .mat-mdc-unelevated-button[type="submit"] .mdc-button__label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: gap 180ms ease;
}
.mho-stage .mat-mdc-unelevated-button[type="submit"] .mho-arrow { width: 16px; height: 16px; }
.mho-stage .mat-mdc-unelevated-button[type="submit"]:hover { opacity: 0.88; }
.mho-stage .mat-mdc-unelevated-button[type="submit"]:hover .mdc-button__label { gap: 12px; }
.mho-stage .mat-mdc-unelevated-button[type="submit"]:disabled { opacity: 0.5; }
.mho-stage .mat-mdc-unelevated-button .mat-mdc-button-persistent-ripple,
.mho-stage .mat-mdc-button .mat-mdc-button-persistent-ripple { display: none; }

/* esqueci a senha / cancelar: link cinza, sem cara de botão */
.mho-stage .forgot-password { justify-content: center !important; margin-top: 16px; }
.mho-stage .forgot-password > span:empty { display: none; }
.mho-stage .mat-mdc-button:not([type="submit"]) {
  min-height: 32px;
  height: auto;
  padding: 4px 8px !important;
  background: transparent !important;
  color: var(--mho-faint) !important;
  font-family: "Mho DM Sans", system-ui, sans-serif !important;
  font-size: 14px !important;
  font-weight: 400 !important;
  letter-spacing: 0 !important;
}
.mho-stage .mat-mdc-button:not([type="submit"]):hover { color: var(--mho-blue) !important; }
.mho-stage .tb-password-card form > .flex { flex-direction: column !important; align-items: stretch !important; gap: 12px !important; }

/* OAuth (se o white-label habilitar): botão contorno */
.mho-stage .oauth-container .mat-mdc-outlined-button,
.mho-stage .oauth-container a.mat-mdc-button-base {
  min-height: 48px;
  border-radius: 980px !important;
  border: 1px solid var(--mho-line) !important;
  color: var(--mho-ink) !important;
  font-family: "Mho Geist", system-ui, sans-serif !important;
}

/* toast do TB (erro de login, e-mail de reset enviado): no login a âncora desce pra baixo do
   form, perto do botão, em vez de cobrir o título; a pele vira aviso claro como no portal */
.mho-stage .tb-login-form span[tb-toast] { order: 1; height: 0 !important; margin-top: 16px; }
html.mho-auth .mat-mdc-snack-bar-container,
html.mho-auth .mat-mdc-snack-bar-container .mdc-snackbar__surface {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
}
html.mho-auth .tb-toast {
  min-height: 44px;
  padding: 6px 6px 6px 14px;
  border-radius: 12px;
  border: 1px solid var(--mho-line, #e5edf5);
  background: #fff !important;
  color: #061b31 !important;
  font-family: "Mho DM Sans", system-ui, sans-serif;
  font-size: 14px;
  box-shadow: none !important;
}
html.mho-auth .tb-toast.error-toast { border-color: #fecaca; background: #fef2f2 !important; color: #b91c1c !important; }
html.mho-auth .tb-toast.success-toast { border-color: #bbf7d0; background: #f0fdf4 !important; color: #15803d !important; }
html.mho-auth .tb-toast .toast-text { flex: 1; font-size: 14px !important; line-height: 1.4; }
html.mho-auth .tb-toast .mat-mdc-button {
  color: inherit !important;
  font-family: inherit !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
}

/* rodapé com a versão */
.mho-stage section.version {
  display: flex !important;
  justify-content: center !important;
  margin-top: 28px;
  text-align: center;
  font-family: "Mho Geist Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: #c3ccd8;
}

/* ---------- desktop: duas colunas, painel na altura da tela ---------- */
@media (min-width: 1024px) {
  .mho-stage {
    grid-template-columns: minmax(0, 1.05fr) minmax(340px, 0.95fr);
    padding: 20px;
    gap: 0;
  }
  .mho-stage-panel { min-height: calc(100vh - 40px); padding: 36px 44px 42px; }
  .mho-stage > .mat-mdc-card { margin: 0 28px; justify-self: center; }
}
/* celular: painel baixo e sem o parágrafo, pra o form aparecer sem rolar */
@media (max-width: 599px) {
  .mho-stage {
    padding: 12px;
    padding-top: max(12px, env(safe-area-inset-top, 0px));
    padding-bottom: max(12px, env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .mho-stage-panel { min-height: 220px; border-radius: 22px; padding: 20px 20px 22px; }
  .mho-stage-copy p { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mho-hero-in { animation: none; }
  .mho-hero-rotator .w { transition: none; }
}
