/* Central Marketei — login / cadastro
   Formato em duas colunas (Gateway ApexPy / IA Ads).
   Texto sempre claro. Vermelho só em superfície e alerta. */

:root {
  --bg: #03151F;
  --ink: #F4F9FC;
  --muted: #B9CAD4;
  --faint: #7E97A4;
  --line: rgba(255, 255, 255, 0.09);
  --brand: #EE3D44;
  --brand-h: #C0392B;
  --ok: #27AE60;
  --radius: 9px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

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

.auth-aside {
  padding: 20px;
  display: flex;
}

.auth-frame {
  position: relative;
  flex: 1;
  border-radius: 14px;
  overflow: hidden;
  background: #020C12;
  isolation: isolate;
}

.auth-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 42%;
  animation: driftIn 22s ease-out forwards;
}

@keyframes driftIn {
  from { transform: scale(1.06); }
  to { transform: scale(1); }
}

.auth-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(3, 21, 31, 0.55) 0%, rgba(3, 21, 31, 0.08) 34%, rgba(3, 21, 31, 0.9) 100%);
}

.auth-live {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 13px 8px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(3, 21, 31, 0.55);
  backdrop-filter: blur(14px);
  font-size: 12px;
  font-weight: 500;
  color: rgba(244, 249, 252, 0.86);
  max-width: calc(100% - 36px);
}

.auth-live b {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.auth-live b.is-out {
  opacity: 0;
  transform: translateY(-4px);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  flex: none;
  box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.6);
  animation: beat 2.4s ease-out infinite;
}

@keyframes beat {
  60% { box-shadow: 0 0 0 9px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.auth-caption {
  position: absolute;
  z-index: 2;
  left: 26px;
  right: 26px;
  bottom: 24px;
}

.auth-caption h1 {
  font-size: clamp(1.35rem, 1.9vw, 1.85rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.2;
  margin-bottom: 8px;
  max-width: 18ch;
  color: #fff;
}

.auth-caption p {
  color: rgba(244, 249, 252, 0.62);
  font-size: 13.5px;
  line-height: 1.5;
  max-width: 32ch;
}

.auth-main {
  display: flex;
  flex-direction: column;
  padding: 26px 40px 32px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
}

.auth-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.auth-brand img {
  height: 42px;
  width: auto;
  display: block;
}

.auth-top > span {
  font-size: 13px;
  color: var(--faint);
  text-align: right;
}

.auth-top a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 500;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.auth-top a:hover { color: #fff; }

.auth-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}

.auth-panel {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
}

.eyebrow {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  border: 2px solid var(--ink);
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.auth-panel h2 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 8px;
  color: #fff;
}

.auth-panel .lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 22px;
}

.auth-tabs {
  display: flex;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}

.auth-tab {
  flex: 1;
  padding: 11px 12px;
  text-align: center;
  background: none;
  border: none;
  color: var(--faint);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.auth-tab.active {
  background: var(--brand);
  color: #fff;
}

.auth-form { display: none; }
.auth-form.active { display: block; }

.form-group { margin-bottom: 16px; }

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: rgba(244, 249, 252, 0.76);
  margin-bottom: 7px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-input {
  width: 100%;
  min-height: 50px;
  padding: 13px 15px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.form-input:hover { border-color: rgba(255, 255, 255, 0.16); }

.form-input:focus {
  outline: none;
  border-color: var(--brand);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(238, 61, 68, 0.18);
}

.form-input::placeholder { color: rgba(255, 255, 255, 0.3); }
.form-input[type="date"] { color-scheme: dark; }

.password-input-container,
.password-wrap {
  position: relative;
}

.password-input-container .form-input,
.password-wrap .form-input {
  padding-right: 48px;
}

.password-toggle,
.toggle-pass {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: none;
  color: var(--faint);
  cursor: pointer;
  padding: 0;
}

.password-toggle:hover,
.toggle-pass:hover { color: #fff; }

.form-hint,
.password-requirements,
.pass-req {
  margin-top: 6px;
  font-size: 12px;
  color: var(--faint);
}

.auth-button,
.btn-reset {
  width: 100%;
  border: 0;
  border-radius: var(--radius);
  padding: 13px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 6px;
  transition: background 0.15s ease;
}

.auth-button:hover,
.btn-reset:hover { background: var(--brand-h); }

.auth-button:disabled,
.btn-reset:disabled { opacity: 0.65; cursor: progress; }

.forgot-password {
  text-align: center;
  margin-top: 16px;
}

.forgot-password a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.forgot-password a:hover { color: #fff; }

.auth-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--faint);
  font-size: 12px;
}

.auth-foot a {
  color: var(--faint);
  text-decoration: none;
}

.auth-foot a:hover { color: var(--muted); }

.message,
.alert {
  display: none;
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.45;
}

.message.success,
.alert-ok {
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid rgba(39, 174, 96, 0.32);
  color: #F4F9FC;
}

.message.error,
.alert-err {
  background: rgba(238, 61, 68, 0.1);
  border: 1px solid rgba(238, 61, 68, 0.32);
  color: #F4F9FC;
}

.alert-warn {
  background: rgba(243, 156, 18, 0.1);
  border: 1px solid rgba(243, 156, 18, 0.28);
  color: #F4F9FC;
}

.cpf-info {
  margin-bottom: 4px;
}

.field-success, .field-error, .field-warning {
  font-size: 12px;
  margin-top: 5px;
  display: block;
  color: var(--ink);
}

.loader {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(238, 61, 68, 0.3);
  border-radius: 50%;
  border-top-color: var(--brand);
  animation: spin 1s linear infinite;
  margin-left: 10px;
}

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

.terms-checkbox {
  margin-top: 4px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  width: 100%;
  margin: 0;
}

.checkbox-input { display: none; }

.checkbox-box {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.checkbox-box::after {
  content: "✓";
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
}

.checkbox-input:checked + .checkbox-container .checkbox-box {
  background: var(--brand);
  border-color: var(--brand);
}

.checkbox-input:checked + .checkbox-container .checkbox-box::after { opacity: 1; }

.checkbox-text {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.terms-link {
  color: #fff;
  text-decoration: underline;
  font-weight: 600;
}

.state-icon { text-align: center; margin-bottom: 16px; }
.state-icon i { font-size: 2.4rem; color: var(--ink); }

.back-link { text-align: center; margin-top: 18px; }
.back-link a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
}
.back-link a:hover { color: #fff; }

.pass-req span { display: inline-block; margin-right: 10px; }
.pass-req span.ok { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .auth-frame img { animation: none; }
  .dot { animation: none; }
  .auth-live b { transition: none; }
}

@media (max-width: 1060px) {
  .auth { grid-template-columns: minmax(0, 0.62fr) minmax(0, 1.38fr); }
  .auth-caption p { display: none; }
}

@media (max-width: 860px) {
  .auth {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .auth-aside {
    padding: 12px max(14px, env(safe-area-inset-left, 0px)) 0 max(14px, env(safe-area-inset-right, 0px));
  }

  .auth-frame { height: 176px; flex: none; width: 100%; }
  .auth-frame img { object-position: 50% 38%; }
  .auth-caption { left: 18px; right: 18px; bottom: 14px; }
  .auth-caption h1 { font-size: 1.2rem; max-width: 22ch; }
  .auth-live { top: 12px; left: 12px; }

  .auth-main {
    min-height: 0;
    padding: 14px max(20px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
  }

  .auth-body { padding: 22px 0 0; justify-content: flex-start; }
  .auth-panel { max-width: none; }
  .auth-panel h2 { font-size: clamp(1.5rem, 7vw, 1.75rem); }
  .form-row { grid-template-columns: 1fr; }
}
