:root {
  --bg-0: #07111f;
  --bg-1: #0f1c2e;
  --bg-2: #13233a;
  --bg-3: #1b2b44;
  --bg-4: #3f3b83;
  --card: rgba(12, 22, 38, 0.72);
  --card-strong: rgba(14, 25, 44, 0.82);
  --panel: rgba(255, 255, 255, 0.04);
  --line: rgba(148, 163, 184, 0.2);
  --line-strong: rgba(148, 163, 184, 0.34);
  --text: #e5edf7;
  --muted: #93a4bb;
  --soft: #6f839d;
  --accent: #60a5fa;
  --accent-soft: #cfe2ff;
  --success: #34d399;
  --shadow-xl: 0 42px 120px rgba(2, 8, 20, 0.58);
  --shadow-lg: 0 24px 64px rgba(2, 8, 20, 0.4);
  --shadow-md: 0 16px 36px rgba(2, 8, 20, 0.28);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 34% 20% at 50% 27%, rgba(129, 140, 248, 0.22), transparent 72%),
    radial-gradient(ellipse 26% 18% at 49% 31%, rgba(96, 165, 250, 0.17), transparent 78%),
    radial-gradient(circle at 18% 82%, rgba(56, 189, 248, 0.08), transparent 24%),
    radial-gradient(circle at 84% 78%, rgba(76, 63, 145, 0.12), transparent 28%),
    linear-gradient(180deg, #12233b 0%, #0d1728 24%, #0a1322 54%, #08111f 100%);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 24px;
  -webkit-font-smoothing: antialiased;
  position: relative;
}

.login-brandbar {
  position: fixed;
  top: 22px;
  left: 22px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: rgba(236, 243, 252, 0.98);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.04em;
  opacity: 0.98;
  text-shadow: 0 0 18px rgba(125, 211, 252, 0.06);
}

.login-brandbar__mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.03));
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 10px 24px rgba(2, 8, 20, 0.16);
}

.login-brandbar__mark svg {
  width: 20px;
  height: 20px;
}

.login-copyright {
  position: fixed;
  left: 22px;
  bottom: 24px;
  z-index: 2;
  color: rgba(147, 164, 187, 0.46);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  pointer-events: none;
  user-select: none;
}

.telegram-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2;
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(22, 36, 60, 0.76), rgba(10, 18, 31, 0.72));
  border: 1px solid rgba(96, 165, 250, 0.12);
  box-shadow: 0 18px 38px rgba(2, 8, 20, 0.2), 0 0 0 1px rgba(96, 165, 250, 0.04), 0 0 18px rgba(56, 189, 248, 0.08);
  color: rgba(243, 249, 255, 0.88);
  text-decoration: none;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  opacity: 0.78;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.telegram-fab svg {
  width: 19px;
  height: 19px;
  fill: currentColor;
  filter: drop-shadow(0 0 8px rgba(125, 211, 252, 0.18));
}

.telegram-fab:hover {
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.22);
  box-shadow: 0 22px 44px rgba(2, 8, 20, 0.28), 0 0 0 1px rgba(96, 165, 250, 0.08), 0 0 24px rgba(56, 189, 248, 0.14);
  background: linear-gradient(180deg, rgba(25, 43, 70, 0.84), rgba(11, 20, 35, 0.78));
  opacity: 0.95;
}

.telegram-fab:focus-visible {
  outline: none;
  transform: translateY(-2px);
  border-color: rgba(96, 165, 250, 0.42);
  box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.14), 0 22px 44px rgba(2, 8, 20, 0.34), 0 0 30px rgba(56, 189, 248, 0.2);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 44% 24% at 50% 36%, rgba(255, 255, 255, 0.08), transparent 72%),
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0) 30%),
    radial-gradient(ellipse 38% 16% at 50% 108%, rgba(255, 255, 255, 0.045), transparent 28%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at center, rgba(0, 0, 0, 0), rgba(2, 6, 14, 0.52) 68%, rgba(1, 4, 10, 0.82) 100%),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
  mask-image: radial-gradient(circle at center, rgba(0,0,0,0.86), transparent 84%);
  pointer-events: none;
  opacity: 0.46;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.032;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 240 240' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
}

.ambient {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
  filter: blur(12px);
  animation: ambientFloat 14s ease-in-out infinite alternate;
}

.ambient--a {
  width: 40rem;
  height: 24rem;
  top: -1rem;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(96, 165, 250, 0.26), rgba(96, 165, 250, 0));
  filter: blur(24px);
}

.ambient--b {
  width: 34rem;
  height: 20rem;
  bottom: -8rem;
  left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(76, 63, 145, 0.11), rgba(255, 255, 255, 0));
  filter: blur(44px);
  animation-duration: 18s;
}

.login-scene {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  min-height: calc(100vh - 48px);
  display: grid;
  align-content: center;
  justify-items: stretch;
}

.auth {
  position: relative;
  width: 100%;
  overflow: hidden;
  padding: 22px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.025)),
    var(--card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}

.auth::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0));
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.auth::after {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 92px;
  border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0));
  pointer-events: none;
}

.auth__window {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.auth__panel {
  padding: 8px 2px 2px;
  border-radius: var(--radius-lg);
}

.auth__intro {
  margin-bottom: 22px;
}

.auth__intro h1 {
  font-size: clamp(2rem, 4.6vw, 2.65rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
  font-weight: 800;
  color: #f4f8ff;
}

.auth__intro p {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
  max-width: 30ch;
}

.login-form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 10px;
}

.field__label {
  color: #aebbd0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.field__control {
  position: relative;
}

.field__control::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  background: no-repeat center/16px 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f839d' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='9' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
  opacity: 0.9;
  pointer-events: none;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.field--user .field__control::before {
  background: no-repeat center/16px 16px url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f839d' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3C/svg%3E");
}

.field__control input {
  width: 100%;
  padding: 17px 48px 17px 42px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(8, 15, 28, 0.52);
  color: var(--text);
  font: inherit;
  outline: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
}

.field__control input::placeholder {
  color: #8ea1bb;
}

.field__control input:focus {
  transform: translateY(-1px);
  border-color: rgba(139, 92, 246, 0.65);
  background: rgba(10, 17, 31, 0.52);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16), 0 0 0 1px rgba(139, 92, 246, 0.32), 0 12px 28px rgba(37, 99, 235, 0.08);
}

.field__control:focus-within::before {
  transform: translateY(-50%) scale(1.06);
  filter: brightness(1.45);
}

.field__toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--soft);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.field__toggle:hover {
  color: #dce9fb;
  background: rgba(255,255,255,0.08);
}

.field__toggle:focus-visible {
  outline: none;
  color: #dce9fb;
  background: rgba(255,255,255,0.06);
}

.field__toggle svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-eye-off {
  display: none;
}

.field__toggle.is-visible .icon-eye {
  display: none;
}

.field__toggle.is-visible .icon-eye-off {
  display: block;
}

.field__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 14px;
}

.caps-indicator {
  font-size: 11px;
  color: var(--soft);
}

.remember-me {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: #9fb3cb;
  font-size: 11px;
  font-weight: 600;
  user-select: none;
  cursor: pointer;
}

.remember-me input {
  appearance: none;
  width: 15px;
  height: 15px;
  border-radius: 4px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(8, 15, 28, 0.56);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.remember-me input:checked {
  border-color: rgba(139, 92, 246, 0.7);
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.remember-me input:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.remember-me input:focus-visible {
  outline: none;
  border-color: rgba(139, 92, 246, 0.7);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.caps-indicator {
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.caps-indicator.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.login-button {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  margin-top: 2px;
  padding: 16px 20px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 18px 34px rgba(99, 102, 241, 0.26);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.login-button::before {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: 13px;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0));
  pointer-events: none;
}

.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 24px 40px rgba(99, 102, 241, 0.3);
  filter: brightness(1.04);
}

.login-button:active {
  transform: translateY(0);
}

.login-button__loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.button-spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

.login-button.is-loading {
  pointer-events: none;
  filter: saturate(0.95) brightness(0.96);
}

.login-button.is-loading .login-button__label {
  display: none;
}

.login-button.is-loading .login-button__loading {
  display: inline-flex;
}

.auth__error {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-radius: 12px;
  background: rgba(127, 29, 29, 0.16);
  border-left: 3px solid rgba(248, 113, 113, 0.75);
  border-top: 1px solid rgba(248, 113, 113, 0.08);
  border-right: 1px solid rgba(248, 113, 113, 0.08);
  border-bottom: 1px solid rgba(248, 113, 113, 0.08);
  color: #fecaca;
  font-size: 12px;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.fade-up {
  opacity: 0;
  transform: translateY(18px);
  animation: fadeUp 0.8s cubic-bezier(.22,.9,.3,1) forwards;
}

.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes ambientFloat {
  from {
    transform: translateX(-50%) translateY(0);
  }
  to {
    transform: translateX(-50%) translateY(10px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  /* Garante que elementos fade-up fiquem visíveis sem animação */
  .fade-up {
    opacity: 1 !important;
    transform: none !important;
  }
}

@media (max-width: 640px) {
  body {
    padding: 14px;
  }

  .login-brandbar {
    top: 14px;
    left: 14px;
    font-size: 17px;
  }

  .login-copyright {
    left: 14px;
    bottom: 16px;
    font-size: 11px;
  }

  .telegram-fab {
    right: 14px;
    bottom: 14px;
    width: 46px;
    height: 46px;
  }

  .login-scene {
    width: 100%;
  }

  .auth {
    padding: 18px;
    border-radius: 24px;
  }

  .auth__panel {
    padding: 16px;
  }

  .field__meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .remember-me {
    margin-left: 0;
  }

}
