@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

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

/* ── Tokens — Identidade Averus (espelham layout.css) ─────────────────────── */
:root {
  --bg:          #fafafa;
  --surface:     #ffffff;
  --border:      #e5e5e5;
  --text:        #171717;
  --text-muted:  #525252;
  --text-subtle: #737373;
  --accent:      #0a0a0a;
  --accent-fg:   #ffffff;
  --danger:      #e5484d;
  --transition:  0.18s ease;
  --focus-ring:  rgba(10,10,10,.08);
  --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 8px 24px rgba(0,0,0,.06);
  --login-line: rgba(10,10,10,.075);
  --login-line-soft: rgba(10,10,10,.04);
  --login-panel: rgba(255,255,255,.66);
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Manrope', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, "SFMono-Regular", Consolas, monospace;
}

[data-theme="dark"] {
  --bg:          #0a0a0a;
  --surface:     #141414;
  --border:      #262626;
  --text:        #fafafa;
  --text-muted:  #a3a3a3;
  --text-subtle: #737373;
  --accent:      #fafafa;
  --accent-fg:   #0a0a0a;
  --danger:      #e5484d;
  --focus-ring:  rgba(250,250,250,.08);
  --shadow-card: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  --login-line: rgba(255,255,255,.07);
  --login-line-soft: rgba(255,255,255,.035);
  --login-panel: rgba(255,255,255,.038);
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 44%, var(--bg)) 0%, var(--bg) 62%),
    var(--bg);
  font-family: var(--font-ui);
  color: var(--text);
  padding: 24px;
  transition: background-color var(--transition), color var(--transition);
  overflow-x: hidden;
  position: relative;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

/* Símbolo da marca em grande escala, sangrando pela lateral */
body::before {
  inset: 0;
  background-color: var(--text);
  opacity: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='201 250 598 499'%3E%3Cpath d='M201 749L497.98 250C563.975 348.992 665.662 530.814 665.662 530.814C641.419 517.884 589.565 517.345 566.669 518.692L497.98 405.559L354.541 637.887C580.811 490.409 689.905 569.198 689.905 569.198C552.527 574.047 383.498 691.086 316.155 749H201Z'/%3E%3Cpath d='M799 749H695.966L613.135 613.644C626.065 602.33 681.824 600.849 708.088 601.522L799 749Z'/%3E%3C/svg%3E") no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='201 250 598 499'%3E%3Cpath d='M201 749L497.98 250C563.975 348.992 665.662 530.814 665.662 530.814C641.419 517.884 589.565 517.345 566.669 518.692L497.98 405.559L354.541 637.887C580.811 490.409 689.905 569.198 689.905 569.198C552.527 574.047 383.498 691.086 316.155 749H201Z'/%3E%3Cpath d='M799 749H695.966L613.135 613.644C626.065 602.33 681.824 600.849 708.088 601.522L799 749Z'/%3E%3C/svg%3E") no-repeat;
  -webkit-mask-position: 118% 50%;
  mask-position: 118% 50%;
  -webkit-mask-size: min(900px, 96vh) auto;
  mask-size: min(900px, 96vh) auto;
  animation: brandFade 1.3s cubic-bezier(.22, 1, .36, 1) .15s forwards;
}

/* Brilho suave atrás do card */
body::after {
  width: 760px;
  height: 760px;
  right: -160px;
  top: 50%;
  transform: translateY(-50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--text) 7%, transparent), transparent 62%);
}

@keyframes brandFade {
  to { opacity: .07; }
}

@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; opacity: .07; }
}

/* ── Theme toggle button ──────────────────────────────────────────────────── */
.login-topbar {
  width: 100%;
  max-width: 880px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 1;
}

.back-btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-card);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.back-btn:hover { color: var(--text); }
.back-btn svg   { width: 15px; height: 15px; flex-shrink: 0; }

.theme-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-card);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  flex-shrink: 0;
}

.theme-toggle-btn:hover { color: var(--text); }
.theme-toggle-btn svg   { width: 18px; height: 18px; pointer-events: none; }

/* ── Wrapper ──────────────────────────────────────────────────────────────── */
.login-wrapper {
  display: flex;
  align-items: center;
  gap: 72px;
  width: 100%;
  max-width: 880px;
  position: relative;
  z-index: 1;
  margin-top: auto;
  margin-bottom: auto;
}

/* ── Promo panel ──────────────────────────────────────────────────────────── */
.login-promo {
  flex: 1;
  min-width: 0;
}

.promo-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 10px;
  margin-bottom: 20px;
}

.promo-title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--text);
  margin-bottom: 12px;
}

.promo-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.promo-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.promo-features li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.promo-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-top: 1px;
}

.promo-icon svg { width: 16px; height: 16px; }

.promo-feature-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.promo-feature-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Card ─────────────────────────────────────────────────────────────────── */
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  flex-shrink: 0;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

[data-theme="light"] .login-card {
  background: rgba(255,255,255,.55);
}

[data-theme="dark"] .login-card {
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  box-shadow: 0 18px 52px rgba(0,0,0,.58);
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.login-header { margin-bottom: 32px; }

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.login-logo-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.login-logo-icon svg {
  width: 18px;
  height: 18px;
  color: var(--accent-fg);
}

.login-logo-name {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.login-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.3;
}

.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Form ─────────────────────────────────────────────────────────────────── */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.input-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-wrap input.has-toggle { padding-right: 44px; }
.input-wrap input.error      { border-color: var(--danger); }

.toggle-password {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition);
  border-radius: 4px;
}

.toggle-password:hover  { color: var(--text); }
.toggle-password svg    { width: 18px; height: 18px; pointer-events: none; }

.field-error          { font-size: 12px; color: var(--danger); display: none; }
.field-error.visible  { display: block; }

/* ── Footer do form ───────────────────────────────────────────────────────── */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
}

.remember-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  user-select: none;
}

.remember-label input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition), border-color var(--transition);
}

.remember-label input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}

.remember-label input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: 2px solid var(--accent-fg);
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ── Botão submit ─────────────────────────────────────────────────────────── */
.btn-submit {
  width: 100%;
  height: 44px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}

.btn-submit:hover  { opacity: .88; }
.btn-submit:active { transform: scale(0.99); }

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-submit .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(128,128,128,.35);
  border-top-color: var(--accent-fg);
  border-radius: 50%;
  animation: loginSpin 0.7s linear infinite;
  display: none;
}

.btn-submit.loading .btn-label { display: none; }
.btn-submit.loading .spinner   { display: block; }

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

/* ── Erro global ──────────────────────────────────────────────────────────── */
.alert-error {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--danger);
  display: none;
  margin-bottom: 4px;
}

.alert-error.visible { display: block; }

[data-theme="dark"] .alert-error {
  background: rgba(127,29,29,.13);
  border-color: rgba(127,29,29,.4);
}

/* ── Rodapé ───────────────────────────────────────────────────────────────── */
.login-footer {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.login-footer a {
  color: var(--text);
  font-weight: 500;
  text-decoration: none;
  transition: opacity var(--transition);
}

.login-footer a:hover { opacity: 0.7; }

/* ── Responsivo ───────────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .login-promo { display: none; }

  .login-wrapper {
    justify-content: center;
  }

  .login-topbar {
    max-width: 400px;
  }
}

@media (max-width: 440px) {
  body { padding: 18px; }

  body::after {
    width: 96vw;
    height: 58vh;
    transform: translate(-50%, -48%) rotate(-3deg);
  }

  .login-card { padding: 32px 24px; }
}
