/* ===========================================================
 *  Auth pages — full-bleed split layout
 *  Uses tokens.css variables (no surface-* aliases).
 * =========================================================== */

body.auth {
  --primary: var(--brand-red);
  --color-primary: var(--brand-red);
  --text-primary: var(--text-0);
  --text-secondary: var(--text-2);
  --text-tertiary: var(--text-3);
  --bg-surface: var(--bg-1);
  --bg-hover: var(--bg-2);
  --border-color: var(--line-1);
  --border-color-light: var(--line-1);
  min-height: 100vh;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--line-strong) 20%, transparent) 1px, transparent 1.15px) 0 0 / 18px 18px,
    var(--bg-0);
  color: var(--text-1);
  font-family: var(--font-sans);
}

.auth-theme-switch {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 20;
}

.auth__shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(30rem, 1.05fr) minmax(28rem, .95fr);
}

.auth__brand {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(2rem, 5vw, 5rem);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(150deg, color-mix(in srgb, var(--brand-red) 8%, transparent), transparent 36%),
    radial-gradient(circle, color-mix(in srgb, var(--line-strong) 22%, transparent) 1px, transparent 1.15px) 0 0 / 18px 18px,
    var(--bg-1);
  border-right: 1px solid var(--line-1);
}

.auth__brand > *:not(.auth__brand-orbit) {
  position: relative;
  z-index: 2;
}

.auth__eyebrow,
.auth__card-kicker {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--brand-cyan);
  font: 400 .68rem/1 var(--font-display);
  letter-spacing: .12em;
  text-transform: uppercase;
}

.auth__eyebrow::before,
.auth__card-kicker::before {
  content: "";
  width: .5rem;
  height: .5rem;
  border: 1px solid var(--brand-orange);
  transform: rotate(45deg);
}

.auth__pitch h1 {
  max-width: 12ch;
  font-size: clamp(2.75rem, 5vw, 5.4rem);
  line-height: .94;
  font-weight: 780;
  letter-spacing: -.075em;
  margin: 1.35rem 0 1.25rem;
  color: var(--text-0);
}
.auth__pitch h1 em {
  font-style: normal;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth__pitch p { color: var(--text-2); max-width: 42rem; line-height: 1.65; }

.auth__bullets {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  gap: 10px;
  color: var(--text-1);
}
.auth__bullets li {
  display: flex; align-items: center; gap: 10px;
  background: color-mix(in srgb, var(--bg-2) 86%, transparent);
  border: 1px solid var(--line-1);
  border-radius: 0 0 var(--r-3) 0;
  padding: 12px 14px;
  font-size: var(--fs-md);
}
.auth__bullets i { color: var(--brand-orange); }

.auth__legal { color: var(--text-3); font-size: 12px; }

.auth__brand-orbit {
  position: absolute;
  z-index: 1;
  right: clamp(3rem, 9vw, 9rem);
  bottom: clamp(5rem, 12vh, 9rem);
  width: clamp(13rem, 25vw, 24rem);
  aspect-ratio: 1;
  border: 1px solid color-mix(in srgb, var(--brand-cyan) 34%, transparent);
  border-radius: 50%;
  opacity: .62;
}

.auth__brand-orbit::before,
.auth__brand-orbit::after {
  content: "";
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--line-strong) 38%, transparent);
  border-radius: 50%;
}

.auth__brand-orbit::before { inset: 18%; }
.auth__brand-orbit::after { inset: 37%; border-color: color-mix(in srgb, var(--brand-orange) 42%, transparent); }

.auth__brand-orbit span {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid var(--bg-1);
  border-radius: 50%;
}

.auth__brand-orbit span:nth-child(1) { top: 11%; left: 23%; background: var(--brand-red); }
.auth__brand-orbit span:nth-child(2) { right: 7%; top: 49%; background: var(--brand-orange); }
.auth__brand-orbit span:nth-child(3) { left: 19%; bottom: 5%; background: var(--brand-cyan); }

.auth__panel {
  position: relative;
  box-sizing: border-box;
  min-height: 100vh;
  align-self: stretch;
  padding: clamp(4rem, 7vw, 7rem) clamp(1.5rem, 5vw, 5rem);
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(135deg, transparent 0 46%, color-mix(in srgb, var(--line-1) 62%, transparent) 46% 46.15%, transparent 46.15% 100%),
    radial-gradient(circle, color-mix(in srgb, var(--line-strong) 18%, transparent) 1px, transparent 1.1px) 0 0 / 18px 18px,
    var(--bg-0);
}

.auth__card {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 32rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--bg-1);
  border: 1px solid var(--line-1);
  border-radius: 0 0 24px 0;
  box-shadow: 9px 9px 0 color-mix(in srgb, var(--brand-cyan) 16%, transparent), var(--shadow-3);
}

.auth__card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: var(--gradient-stripes);
}

.auth__heading h2 {
  font-size: clamp(2rem, 4vw, 3.15rem);
  font-weight: 760;
  line-height: 1;
  letter-spacing: -.065em;
  margin: .85rem 0 0;
  color: var(--text-0);
}
.auth__heading p { color: var(--text-2); margin: .55rem 0 1.75rem; line-height: 1.55; }

.auth__panel-register {
  position: absolute;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 5rem;
  height: 5rem;
  opacity: .8;
}

.auth__panel-register::before,
.auth__panel-register::after,
.auth__panel-register span::before,
.auth__panel-register span::after {
  content: "";
  position: absolute;
  background: var(--brand-orange);
}

.auth__panel-register::before { top: 50%; left: 0; width: 100%; height: 1px; }
.auth__panel-register::after { left: 50%; top: 0; width: 1px; height: 100%; }
.auth__panel-register span::before { inset: calc(50% - 5px) auto auto calc(50% - 5px); width: 10px; height: 10px; border-radius: 50%; background: var(--bg-0); border: 1px solid var(--brand-orange); }
.auth__panel-register span::after { top: 50%; left: 50%; width: 1px; height: 1px; border: 3px solid var(--brand-orange); border-radius: 50%; transform: translate(-50%, -50%); background: transparent; }

/* Hubit identity components compatibility — these classes come from
   the HubitIdentity Razor components and need our token bindings.
   Exclui o label do switch "Lembrar-me" (hubit-login-remember__label), que
   tem de permanecer inline-flex + linha, não em bloco. */
.auth__card label:not(.hubit-login-remember__label),
.auth__card .form-label {
  display: block;
  color: var(--text-1);
  font-weight: 500;
  margin: 12px 0 6px;
  font-size: var(--fs-sm);
}
.auth__card .form-control,
.auth__card input[type="text"],
.auth__card input[type="email"],
.auth__card input[type="password"] {
  width: 100%;
  background: var(--bg-2);
  color: var(--text-0);
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
  padding: 12px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
  font-family: inherit;
}
.auth__card .form-control:focus,
.auth__card input:focus {
  border-color: var(--brand-cyan);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-cyan) 18%, transparent);
}

.auth__card .btn,
.auth__card button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--r-2);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  margin-top: 18px;
  background: var(--brand-red);
  color: var(--brand-cream);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  font-size: var(--fs-md);
  font-family: inherit;
}
.auth__card .btn:hover,
.auth__card button[type="submit"]:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.auth__card .btn-secondary,
.auth__card .btn-outline-secondary {
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--line-2);
}

.auth .auth__card a:not(.btn) { color: var(--brand-cyan); text-decoration: none; font-weight: 600; }
.auth__card a:hover { text-decoration: underline; }

.auth .auth__brand a.brand--mais {
  color: var(--text-0);
}

/* Login “Lembrar-me” — switch (HubitIdentity hubit-login-remember) */
.auth__card .hubit-login-remember {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 0;
  margin: 0 0 0.5rem 0;
}
.auth__card label.hubit-login-remember__label,
.auth__card .hubit-login-remember__label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 4px 0;
  color: var(--text-1);
  font-weight: 500;
  font-size: var(--fs-md);
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  box-sizing: border-box;
}
.auth__card .hubit-login-remember__text {
  flex: 1;
  min-width: 0;
}
.auth__card .hubit-login-remember__switch {
  --hi-remember-track-off: var(--line-2);
  flex-shrink: 0;
  border: 1px solid var(--line-1);
  background: var(--bg-3);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
}
.auth__card .hubit-login-remember__input:checked + .hubit-login-remember__label .hubit-login-remember__switch {
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2));
  border-color: transparent;
  box-shadow: none;
}
.auth__card .hubit-login-remember__input:focus-visible + .hubit-login-remember__label {
  outline: 2px solid var(--brand-1);
  outline-offset: 2px;
  border-radius: var(--r-2);
}
.auth__card .hubit-login-remember__input + .hubit-login-remember__label .hubit-login-remember__switch::after {
  background: var(--text-0);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

/* SelectTenant — tiles (HubitIdentity) não herdam "label" em bloco */
.auth__card label.hi-tenant-tile {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin: 0;
  max-width: 100%;
  font-weight: inherit;
  color: inherit;
  font-size: inherit;
  cursor: pointer;
  box-sizing: border-box;
}
.auth__card .hi-tenant-hero__title { color: var(--text-0); }
.auth__card .hi-tenant-hero__lead { color: var(--text-2); }
/* lista única: cores do DS dark STUDIO (HubitIdentity usa fallbacks claros) */
.auth__card .hi-tenant-pick--list {
  --hi-line: var(--line-1);
  --hi-surface-hover: color-mix(in srgb, var(--text-0) 10%, transparent);
  --hi-tint: color-mix(in srgb, var(--brand-1) 20%, transparent);
  --hi-accent: var(--brand-1);
  --hi-accent-ink: var(--brand-1);
  --hi-text: var(--text-0);
  --hi-muted: var(--text-3);
}

.auth__card .alert,
.alert {
  padding: 12px 14px;
  border-radius: var(--r-2);
  background: rgba(255, 90, 54, .10);
  border: 1px solid rgba(255, 90, 54, .32);
  color: var(--text-1);
  margin-bottom: 16px;
  font-size: var(--fs-sm);
}
.auth__card .text-danger,
.auth__card .field-validation-error {
  color: #ff8a82;
  font-size: 13px;
  display: block;
  margin-top: 6px;
}

/* -----------------------------------------------------------------
   Form floating (HubitIdentity LoginForm) — labels irmãs do input
   e botão "mostrar senha" no eixo do campo (não no meio do bloco
   com label quebrada por .auth__card .form-label em display block).
   ----------------------------------------------------------------- */
.auth__card .form-floating {
  position: relative;
  margin-bottom: 1rem;
}
.auth__card .form-floating > .form-control {
  min-height: 56px;
  height: 56px;
  padding: 18px 14px 4px;
  line-height: 1.2;
}
.auth__card .form-floating.hubit-pwd-toggle-wrap > .form-control.hubit-pwd-input {
  padding-right: 48px;
}
.auth__card .form-floating > .form-control::placeholder {
  color: transparent;
}
.auth__card .form-floating > .form-label,
.auth__card .form-floating > label {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  height: 100%;
  margin: 0;
  padding: 16px 14px;
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.16s ease, color 0.16s ease, opacity 0.16s ease;
  color: var(--text-3);
  font-weight: 500;
  font-size: 14px;
  line-height: 1.2;
  border: 1px solid transparent;
  border-radius: var(--r-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - 8px);
}
.auth__card .form-floating > .form-control:focus ~ .form-label,
.auth__card .form-floating > .form-control:focus ~ label,
.auth__card .form-floating > .form-control:not(:placeholder-shown) ~ .form-label,
.auth__card .form-floating > .form-control:not(:placeholder-shown) ~ label {
  transform: translateY(-9px) scale(0.78);
  color: var(--text-2);
  opacity: 0.95;
}
.auth__card .form-floating > .form-control:focus ~ .form-label,
.auth__card .form-floating > .form-control:focus ~ label {
  color: var(--brand-1);
}

.auth__card .hubit-pwd-toggle-wrap { position: relative; }
.auth__card .hubit-pwd-toggle-wrap .hubit-pwd-toggle-btn {
  position: absolute;
  /* 28px = metade da altura do .form-control (56px) — evita 50% incluir
     labels em fluxo errado ou spans de validação e puxar o olho p/ baixo */
  top: 28px;
  right: 8px;
  transform: translateY(-50%);
  z-index: 4;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  border-radius: var(--r-2);
  color: var(--text-3);
  cursor: pointer;
  line-height: 1;
  box-shadow: none;
}
.auth__card .hubit-pwd-toggle-wrap .hubit-pwd-toggle-btn:hover {
  background: var(--bg-2);
  color: var(--text-1);
}
.auth__card .hubit-pwd-toggle-wrap .hubit-pwd-toggle-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--line-1), 0 0 0 4px rgba(255, 90, 54, 0.35);
}
.auth__card .hubit-pwd-toggle-wrap .hubit-pwd-toggle-icon {
  display: block;
  font-size: 1rem;
  line-height: 1;
}

.auth__card hr {
  border: 0; border-top: 1px solid var(--line-1); margin: 18px 0;
}

.auth__card h3,
.auth__card h4 {
  font-size: 13px; color: var(--text-2);
  text-align: center; font-weight: 500;
  margin: 18px 0 10px;
}

.auth__card .muted { color: var(--text-3); font-size: var(--fs-sm); }

.auth-status {
  display: grid;
  justify-items: center;
  gap: 1rem;
  text-align: center;
}

.auth-status__icon {
  width: 4rem;
  height: 4rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-1);
  border-radius: 50%;
  background: var(--bg-2);
  font-size: 1.65rem;
}

.auth-status__icon--warning {
  color: var(--brand-orange);
  border-color: color-mix(in srgb, var(--brand-orange) 42%, var(--line-1));
  background: color-mix(in srgb, var(--brand-orange) 10%, var(--bg-2));
}

.auth-status__resource {
  width: 100%;
  margin-top: .25rem;
  text-align: left;
}

.auth-status__actions {
  width: 100%;
  display: grid;
  gap: .5rem;
}

.auth-status--loading {
  min-height: 8rem;
  place-content: center;
}

.auth-status__loader {
  width: 2.5rem;
  height: 2.5rem;
  border: 2px solid var(--line-1);
  border-top-color: var(--brand-red);
  border-right-color: var(--brand-orange);
  border-bottom-color: var(--brand-cyan);
  border-radius: 50%;
  animation: auth-status-spin .8s linear infinite;
}

@keyframes auth-status-spin {
  to { transform: rotate(360deg); }
}

/* External provider buttons (HubitIdentity) */
.auth__card div:has(button[name="provider"]) {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.auth__card button[name="provider"] {
  flex: 1; padding: 10px 12px; font-size: 13px;
  background: var(--bg-2);
  color: var(--text-1);
  border: 1px solid var(--line-1);
  border-radius: var(--r-2);
  cursor: pointer;
  margin-top: 0;
  background-image: none;
}
.auth__card button[name="provider"]:hover {
  border-color: var(--brand-cyan);
  transform: none;
}

@media (max-width: 980px) {
  .auth__shell {
    grid-template-columns: 1fr;
  }

  .auth__brand {
    min-height: auto;
    padding: 1.4rem 1.5rem 1.75rem;
    border-right: 0;
    border-bottom: 1px solid var(--line-1);
  }

  .auth__brand .brand__official-lockup {
    width: min(15rem, 68vw);
  }

  .auth__brand .brand__product-name,
  .auth__pitch,
  .auth__legal,
  .auth__brand-orbit {
    display: none;
  }

  .auth__panel {
    min-height: calc(100vh - 7rem);
    padding: 4.5rem 1rem 3rem;
  }

  .auth-theme-switch {
    top: 1rem;
    right: 1rem;
  }
}

@media (max-width: 560px) {
  .auth__brand {
    padding-inline: 1rem;
  }

  .auth__card {
    padding: 1.5rem 1.2rem;
    border-radius: 0 0 16px 0;
    box-shadow: 6px 6px 0 color-mix(in srgb, var(--brand-cyan) 14%, transparent);
  }

  .auth__heading h2 {
    font-size: 2.1rem;
  }

  .auth__panel-register {
    display: none;
  }
}

/* Brand mark (auth aside) — from MaestroImage shell.css */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-0);
  font-weight: 700;
  letter-spacing: .02em;
}
.brand__mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--gradient-hero);
  color: white;
  border-radius: 9px;
  font-weight: 800;
  font-size: 16px;
  box-shadow: 0 4px 14px rgba(255, 45, 177, .35);
}
.brand__text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.05;
  font-size: var(--fs-lg);
}
.brand__text small {
  font-size: 9px;
  color: var(--text-3);
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 600;
}
