/* HubFy — login, criar conta e recuperar senha (index.html)
 * Desktop/iPad paisagem: painel azul da marca à esquerda + card do formulário à direita
 * iPad retrato e celular: painel vira faixa compacta no topo; o card sobe por cima dela
 */

.auth { display: grid; grid-template-columns: minmax(0, 46fr) minmax(0, 54fr); min-height: 100vh; min-height: 100dvh; }

/* ---------- Painel da marca ---------- */
.brand {
  position: relative;
  display: flex;
  overflow: hidden;
  padding: 44px 48px;
  color: #fff;
  background: linear-gradient(160deg, #1F6FF6 0%, #0B55DD 55%, #0349D0 100%);
}
.brand::before, .brand::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.brand::before { width: 420px; height: 420px; right: -160px; bottom: -200px; border: 44px solid rgba(255, 255, 255, .07); }
.brand::after { width: 260px; height: 260px; left: -120px; top: -120px; background: rgba(255, 224, 27, .12); }
.brand__inner { position: relative; z-index: 1; display: flex; flex-direction: column; width: 100%; max-width: 520px; margin: 0 auto; }
.brand__eyebrow { margin: 0 0 12px; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hf-yellow); }
.brand__title { margin: 0 0 12px; font-size: 40px; line-height: 1.12; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
.brand__title mark { padding: 0 .12em; border-radius: 6px; background: var(--hf-yellow); color: var(--hf-navy); }
.brand__lead { margin: 0; max-width: 460px; font-size: 16px; line-height: 1.5; color: rgba(255, 255, 255, .88); }

.brand__visual { position: relative; width: 100%; max-width: 440px; margin: 30px 0 28px; }
.brand__art { display: block; width: 100%; height: auto; border-radius: 18px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .12); }
.brand__chip {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px 8px 9px;
  border-radius: var(--hf-radius-pill);
  background: #fff;
  color: var(--hf-navy);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .22);
  animation: chip-float 6s ease-in-out infinite alternate;
}
.brand__chip svg { width: 18px; height: 18px; padding: 2px; border-radius: 50%; }
.brand__chip--1 { top: -14px; right: -12px; }
.brand__chip--1 svg { background: var(--hf-green); color: #fff; }
.brand__chip--2 { bottom: -14px; left: -12px; animation-delay: -3s; }
.brand__chip--2 svg { background: var(--hf-blue-soft); color: var(--hf-blue); }
@keyframes chip-float { to { transform: translateY(-6px); } }

.benefits { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.benefits li { display: flex; align-items: flex-start; gap: 12px; }
.benefits__icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .14); color: var(--hf-yellow); }
.benefits__icon svg { width: 20px; height: 20px; }
.benefits li > span:last-child { display: grid; gap: 1px; }
.benefits strong { font-size: 14.5px; font-weight: 600; }
.benefits small { font-size: 13px; line-height: 1.4; color: rgba(255, 255, 255, .78); }
.brand__foot { display: flex; align-items: center; gap: 10px; margin: auto 0 0; padding-top: 28px; font-size: 12.5px; color: rgba(255, 255, 255, .72); }
.brand__foot img { display: block; width: 34px; height: auto; }

/* ---------- Formulário ---------- */
.panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 32px calc(28px + env(safe-area-inset-bottom));
  background: var(--hf-bg);
}
.card {
  width: 100%;
  max-width: 460px;
  padding: 32px 36px 28px;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 27, 61, .05), 0 18px 48px rgba(15, 27, 61, .08);
}
.card__logo { display: inline-block; margin-bottom: 22px; border-radius: 6px; }
.card__logo img { display: block; height: 44px; width: auto; }
.card__logo:focus-visible { outline: none; box-shadow: var(--hf-focus); }
.panel__foot { max-width: 460px; margin: 18px 0 0; font-size: 12px; line-height: 1.5; text-align: center; color: var(--hf-text-muted); }

.view[hidden] { display: none; }
.view.is-entering { animation: view-in var(--hf-mid) var(--hf-ease); }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }
.view__title { margin: 0 0 4px; font-size: 26px; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.view__lead { margin: 0 0 22px; font-size: 14.5px; line-height: 1.5; color: var(--hf-text-muted); }

.form { display: grid; gap: 16px; }
.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field__label { font-size: 13.5px; font-weight: 600; color: var(--hf-navy); }
.field__label small { font-weight: 400; color: var(--hf-text-muted); }
.field__control { position: relative; }
.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--hf-gray-200);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 16px;
  color: var(--hf-navy);
  transition: border-color var(--hf-fast), box-shadow var(--hf-fast);
}
.input::placeholder { color: #9AA4B5; }
.input:hover { border-color: var(--hf-gray-300); }
.input:focus { outline: none; border-color: var(--hf-blue); box-shadow: var(--hf-focus); }
.input--pwd { padding-right: 50px; }
.field.has-error .input { border-color: var(--hf-danger); background: #FFF8F8; }
.field.has-error .input:focus { box-shadow: 0 0 0 4px rgba(220, 38, 38, .14); }
.field__error { display: flex; align-items: flex-start; gap: 5px; margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--hf-danger); }
.field__error:empty { display: none; }
.field__error::before { content: "!"; flex: none; display: grid; place-items: center; width: 15px; height: 15px; margin-top: 1px; border-radius: 50%; background: var(--hf-danger); color: #fff; font-size: 10px; font-weight: 700; }

.toggle-pwd { position: absolute; right: 4px; top: 50%; display: grid; place-items: center; width: 44px; height: 44px; margin-top: -22px; border: 0; border-radius: 50%; background: none; color: #6B7385; cursor: pointer; transition: background-color var(--hf-fast), color var(--hf-fast); }
.toggle-pwd:hover { background: var(--hf-gray-100); color: var(--hf-navy); }
.toggle-pwd:focus-visible { outline: none; box-shadow: var(--hf-focus); }
.toggle-pwd svg { width: 20px; height: 20px; }
.toggle-pwd .icon-hide { display: none; }
.toggle-pwd[aria-pressed="true"] .icon-show { display: none; }
.toggle-pwd[aria-pressed="true"] .icon-hide { display: block; }

.strength { display: grid; gap: 6px; margin-top: -6px; }
.strength__bars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.strength__bars i { height: 5px; border-radius: 5px; background: var(--hf-gray-200); transition: background-color var(--hf-mid); }
.strength[data-level="1"] i:nth-child(1) { background: var(--hf-danger); }
.strength[data-level="2"] i:nth-child(-n+2) { background: var(--hf-warning); }
.strength[data-level="3"] i { background: var(--hf-green); }
.strength__text { margin: 0; font-size: 12.5px; color: var(--hf-text-muted); }
.strength[data-level="1"] .strength__text { color: var(--hf-danger); }
.strength[data-level="2"] .strength__text { color: #B7791F; }
.strength[data-level="3"] .strength__text { color: #0E8A45; }

.check { display: flex; align-items: flex-start; gap: 10px; min-height: 24px; font-size: 13.5px; line-height: 1.45; color: var(--hf-gray-700); cursor: pointer; }
.check input { flex: none; width: 20px; height: 20px; margin: 1px 0 0; appearance: none; -webkit-appearance: none; border: 1.5px solid var(--hf-gray-300); border-radius: 6px; background: #fff; cursor: pointer; display: grid; place-items: center; transition: background-color var(--hf-fast), border-color var(--hf-fast); }
.check input:hover { border-color: var(--hf-blue); }
.check input:focus-visible { outline: none; box-shadow: var(--hf-focus); }
.check input:checked { border-color: var(--hf-blue); background: var(--hf-blue); }
.check input:checked::after { content: ""; width: 10px; height: 6px; border: 2.4px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.field.has-error .check input { border-color: var(--hf-danger); }

.link { color: var(--hf-blue); font-weight: 600; text-decoration: none; border-radius: 4px; }
.link:hover { text-decoration: underline; }
.link:focus-visible { outline: none; box-shadow: var(--hf-focus); }
.link--sm { font-size: 13px; padding: 6px 0; margin: -6px 0; }
.link--back::before { content: "← "; }

/* Botões */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 48px; padding: 0 20px; border: 1.5px solid transparent; border-radius: 10px; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; transition: background-color var(--hf-fast), border-color var(--hf-fast), box-shadow var(--hf-fast), transform var(--hf-fast); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--hf-focus); }
.btn:disabled { cursor: progress; opacity: .85; }
.btn--block { width: 100%; }
.btn--primary { background: var(--hf-yellow); color: var(--hf-navy); box-shadow: 0 4px 12px rgba(200, 160, 0, .25); }
.btn--primary:hover:not(:disabled) { background: var(--hf-yellow-strong); }
/* Travado (pausa de tentativas): cinza, sem parecer clicável. Carregando continua amarelo com o spinner. */
.btn--primary:disabled:not(.is-loading) { background: var(--hf-gray-100); color: #8A93A6; box-shadow: none; opacity: 1; cursor: not-allowed; }
.btn--ghost { background: #fff; border-color: var(--hf-gray-200); color: var(--hf-navy); }
.btn--ghost:hover:not(:disabled) { border-color: var(--hf-blue); color: var(--hf-blue); }
.btn--google { background: #fff; border-color: var(--hf-gray-200); color: var(--hf-navy); }
.btn--google:hover:not(:disabled) { border-color: var(--hf-gray-300); background: var(--hf-gray-50); }
.btn__google-ic { display: grid; width: 20px; height: 20px; }
.btn__google-ic svg { width: 20px; height: 20px; }
.btn__spinner { display: none; width: 18px; height: 18px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.is-loading .btn__spinner { display: inline-block; }
.btn.is-loading .btn__google-ic { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.google-hint { margin: 10px 0 0; font-size: 12.5px; line-height: 1.45; text-align: center; color: var(--hf-text-muted); }
.divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; font-size: 12.5px; color: var(--hf-text-muted); }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--hf-gray-100); }
.switch { margin: 20px 0 0; font-size: 14px; text-align: center; color: var(--hf-text-muted); }
.switch .link { display: inline-block; padding: 8px 2px; margin: -8px 0; }

.success { display: flex; flex-direction: column; align-items: center; text-align: center; }
.success[hidden] { display: none; }
.success__icon--mail { background: var(--hf-blue); box-shadow: 0 0 0 10px var(--hf-blue-soft); }
.success .btn { margin-top: 4px; }
.view.is-confirming > :not(#signup-confirm) { display: none; }
.newpass__hint { margin: -4px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--hf-warning-soft); color: #7A5B00; font-size: 13px; }
.newpass__hint[hidden] { display: none; }
.success__icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 14px; border-radius: 50%; background: var(--hf-green); color: #fff; box-shadow: 0 0 0 10px var(--hf-green-soft); animation: pop .35s var(--hf-ease); }
.success__icon svg { width: 30px; height: 30px; }
.success .view__lead strong { color: var(--hf-navy); }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }

/* ---------- Recuperar senha: etapas, e-mail mascarado e código de 6 dígitos ---------- */
.rstep[hidden] { display: none; }
.rsteps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.rsteps li { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: #8A93A6; }
.rsteps li::before { content: ""; height: 4px; border-radius: 4px; background: var(--hf-gray-200); }
.rsteps li.is-done { color: #0E8A45; }
.rsteps li.is-done::before { background: var(--hf-green); }
.rsteps li.is-current { color: var(--hf-blue); }
.rsteps li.is-current::before { background: var(--hf-blue); }

.masked { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--hf-gray-200); border-radius: 12px; background: var(--hf-gray-50); }
.masked[hidden] { display: none; }
.masked__avatar { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--hf-blue); color: #fff; font-size: 17px; font-weight: 700; }
.masked__text { display: grid; gap: 1px; min-width: 0; }
.masked__text small { font-size: 12px; color: var(--hf-text-muted); }
.masked__text strong { font-size: 16px; font-weight: 600; letter-spacing: .02em; color: var(--hf-navy); overflow-wrap: anywhere; }

.field__hint { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--hf-text-muted); }
.field__hint[hidden] { display: none; }
.field__hint.is-lock, .otp__lock { padding: 9px 12px; border-radius: 9px; background: var(--hf-warning-soft); color: #7A5B00; font-weight: 500; }
.input:disabled { background: var(--hf-gray-50); color: #8A93A6; cursor: not-allowed; }

.link--btn { padding: 10px 2px; margin: -10px 0; border: 0; background: none; font: inherit; font-size: 13.5px; font-weight: 600; color: var(--hf-blue); cursor: pointer; }
.reset-other { margin: -2px 0 0; text-align: center; }
.reset-other[hidden] { display: none; }

.code-lead { margin-bottom: 10px; }
.code-to { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; margin: 0 0 18px; padding: 8px 12px; border-radius: 10px; background: var(--hf-gray-50); font-size: 13.5px; color: var(--hf-gray-700); }
.code-to strong { color: var(--hf-navy); overflow-wrap: anywhere; }

.otp { display: grid; grid-template-columns: repeat(6, minmax(0, 56px)); justify-content: center; gap: 10px; min-width: 0; margin: 0; padding: 0; border: 0; }
.otp__box {
  width: 100%; height: 60px; padding: 0;
  border: 1.5px solid var(--hf-gray-200); border-radius: 12px; background: #fff;
  font: inherit; font-size: 26px; font-weight: 700; line-height: 1; text-align: center; font-variant-numeric: tabular-nums;
  color: var(--hf-navy); caret-color: var(--hf-blue);
  transition: border-color var(--hf-fast), box-shadow var(--hf-fast), background-color var(--hf-fast);
}
.otp__box:hover { border-color: var(--hf-gray-300); }
.otp__box.is-filled { border-color: #9DB8EE; }
.otp__box:focus { outline: none; border-color: var(--hf-blue); box-shadow: var(--hf-focus); }
.otp__box:disabled { background: var(--hf-gray-50); color: #9AA4B5; cursor: not-allowed; }
.otp.is-error .otp__box { border-color: var(--hf-danger); background: #FFF8F8; }
.otp.is-shaking { animation: otp-shake .4s var(--hf-ease); }
@keyframes otp-shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.otp__error { justify-content: center; text-align: center; }
.otp__lock { margin: 0; text-align: center; font-size: 13px; }
.otp__lock[hidden] { display: none; }

.resend { display: grid; gap: 10px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hf-gray-100); }
.resend__text { margin: 0; font-size: 13px; line-height: 1.45; text-align: center; color: var(--hf-text-muted); }
#code-resend:disabled:not(.is-loading) { opacity: 1; cursor: not-allowed; background: var(--hf-gray-50); border-color: var(--hf-gray-100); color: #6A7385; font-variant-numeric: tabular-nums; }

/* Toasts (mesmo visual do app) */
.toasts { position: fixed; z-index: 90; top: calc(16px + env(safe-area-inset-top)); right: 16px; left: 16px; display: grid; justify-items: end; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; max-width: 400px; padding: 14px 16px; border-radius: var(--hf-radius); background: #fff; border-left: 4px solid var(--hf-blue); box-shadow: var(--hf-shadow-lg); font-size: 14px; font-weight: 500; animation: toast-in var(--hf-mid) var(--hf-ease); }
.toast--success { border-left-color: var(--hf-success); }
.toast--error { border-left-color: var(--hf-danger); }
.toast__icon { flex: none; width: 22px; height: 22px; }
.toast--success .toast__icon { color: var(--hf-success); }
.toast--error .toast__icon { color: var(--hf-danger); }
.toast.is-leaving { animation: toast-out var(--hf-mid) var(--hf-ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- Responsivo ---------- */

/* iPad paisagem (1024): colunas mais justas */
@media (max-width: 1199px) {
  .auth { grid-template-columns: minmax(0, 44fr) minmax(0, 56fr); }
  .brand { padding: 36px 36px; }
  .brand__title { font-size: 32px; }
  .brand__visual { max-width: 380px; margin: 24px 0 22px; }
  .benefits { gap: 10px; }
  .card { padding: 28px 28px 24px; }
}

/* iPad retrato e celular: faixa no topo + card por cima */
@media (max-width: 1023px) {
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .brand { padding: 36px 32px 96px; }
  .brand::before { width: 300px; height: 300px; right: -120px; top: -140px; bottom: auto; border-width: 36px; }
  .brand::after { width: 200px; height: 200px; left: auto; right: 120px; top: -140px; }
  .brand__inner { max-width: 640px; display: grid; grid-template-columns: minmax(0, 1fr) 220px; grid-template-areas: "eyebrow visual" "title visual" "lead visual"; column-gap: 28px; align-items: center; }
  .brand__eyebrow { grid-area: eyebrow; }
  .brand__title { grid-area: title; font-size: 30px; margin-bottom: 8px; }
  .brand__lead { grid-area: lead; font-size: 15px; }
  .brand__visual { grid-area: visual; max-width: none; margin: 0; }
  .brand__chip { font-size: 11.5px; padding: 6px 10px 6px 7px; }
  .brand__chip--1 { top: -10px; right: -8px; }
  .brand__chip--2 { bottom: -10px; left: -8px; }
  .benefits, .brand__foot { display: none; }
  .panel { justify-content: flex-start; margin-top: -72px; padding: 0 32px calc(32px + env(safe-area-inset-bottom)); background: transparent; }
  .card { max-width: 560px; }
}

/* Celular */
@media (max-width: 767px) {
  .brand { padding: calc(28px + env(safe-area-inset-top)) 20px 84px; }
  .brand__inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "eyebrow" "title" "lead"; }
  .brand__title { font-size: 26px; }
  .brand__lead { font-size: 14px; }
  .brand__visual { display: none; }
  .panel { margin-top: -60px; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); }
  .card { padding: 24px 20px 22px; border-radius: 18px; }
  .card__logo { margin-bottom: 18px; }
  .card__logo img { height: 40px; }
  .view__title { font-size: 23px; }
  .form__row { grid-template-columns: minmax(0, 1fr); }
  .otp { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
  .otp__box { height: 56px; font-size: 24px; border-radius: 10px; }
  .code-to { padding: 8px 10px; }
  .toasts { justify-items: stretch; }
  .toast { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .brand__chip { animation: none; }
  .otp.is-shaking { animation: none; }
}
