:root {
  --bg: #070707;
  --bg-panel: #0c0c0c;
  --bg-card: #121212;
  --bg-input: #0a0a0a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f5f5f5;
  --text-muted: #8a8a8a;
  --text-soft: #cfcfcf;
  --accent: #f2f2f2;
  --danger: #fb7185;
  --radius: 14px;
  --font-display: "Outfit", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

/* Critical: .login-form { display:grid } must not override [hidden] */
[hidden],
.login-form[hidden],
.login-card__switch[hidden],
.login-social[hidden],
.login-google-mount[hidden],
.login-error[hidden],
.login-demo-code[hidden],
.login-toast[hidden] {
  display: none !important;
}

body.login-body {
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
}

.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 65% 50% at 12% 18%, rgba(255, 255, 255, 0.06), transparent 55%),
    radial-gradient(ellipse 50% 40% at 88% 78%, rgba(255, 255, 255, 0.035), transparent 50%),
    linear-gradient(180deg, #070707 0%, #0b0b0b 100%);
  pointer-events: none;
}

.login-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at center, #000 28%, transparent 82%);
}

.login-back {
  position: fixed;
  top: 1.25rem;
  left: 1.25rem;
  z-index: 2;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
}

.login-back:hover {
  color: var(--text);
}

.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 2rem;
  align-items: stretch;
  width: min(1080px, calc(100% - 2.5rem));
  min-height: 100vh;
  margin: 0 auto;
  padding: 4.5rem 0 3rem;
}

.login-aside {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 7.5rem);
  padding-bottom: 0.25rem;
}

.login-aside__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-aside__brand img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.login-aside__title {
  margin: 0 0 0.9rem;
  font-family: var(--font-display);
  font-size: clamp(2.1rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.045em;
  max-width: 14ch;
}

.login-aside__sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 36ch;
}

.login-tip {
  margin-top: auto;
  max-width: 420px;
  padding: 1.1rem 1.2rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(16, 16, 16, 0.92);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.login-tip__label {
  margin: 0 0 0.45rem;
  color: #f2f2f2;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-tip__text {
  margin: 0;
  color: #a8a8a8;
  font-size: 0.92rem;
  line-height: 1.5;
  min-height: 3.2em;
  transition: opacity 0.35s ease;
}

.login-tip__text.is-fading {
  opacity: 0;
}

.login-tip__dots {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.85rem;
}

.login-tip__dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.login-tip__dot.is-active {
  background: #f0f0f0;
  transform: scale(1.15);
}

.login-card {
  width: 100%;
  max-width: 440px;
  justify-self: end;
  align-self: center;
  padding: 1.6rem 1.5rem 1.55rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: linear-gradient(180deg, rgba(18, 18, 18, 0.98), rgba(12, 12, 12, 0.99));
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.login-card__head h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.login-card__switch {
  margin: 0 0 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-card__switch button {
  border: none;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.login-card__switch button:hover {
  color: #fff;
}

.login-social {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.35rem;
}

.login-social__row {
  position: relative;
}

.login-social__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.78rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: #141414;
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.login-social__btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: #1a1a1a;
}

.login-social__note {
  margin: 0.15rem 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.login-social__note code {
  font-family: var(--font-mono);
  color: var(--text-soft);
  font-size: 0.72rem;
}

.login-google-mount {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  opacity: 0.001;
  border-radius: 10px;
}

.login-google-mount > div,
.login-google-mount iframe {
  width: 100% !important;
  min-height: 100% !important;
}

.login-or {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0.85rem 0 1rem;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

.login-form {
  display: grid;
  gap: 0.85rem;
}

.login-field {
  display: grid;
  gap: 0.4rem;
  margin: 0;
}

.login-field > span,
.login-field__row {
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.login-field__row {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.login-field__row a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.78rem;
}

.login-field__row a:hover {
  text-decoration: underline;
}

.login-field input {
  width: 100%;
  padding: 0.8rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  outline: none;
}

.login-field input:focus {
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

.login-remember {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0.1rem 0 0;
  cursor: pointer;
}

.login-remember input {
  margin-top: 0.2rem;
}

.login-remember strong {
  display: block;
  font-size: 0.88rem;
}

.login-remember em {
  display: block;
  margin-top: 0.15rem;
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.75rem;
}

.login-hint {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.86rem;
}

.login-demo-code {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px dashed var(--border-strong);
  background: rgba(18, 18, 18, 0.85);
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.login-demo-code code {
  font-family: var(--font-mono);
  color: var(--text);
  letter-spacing: 0.12em;
}

.login-submit {
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.85rem 1rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #0a0a0a;
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
}

.login-submit:hover {
  filter: brightness(1.06);
}

.login-resend {
  width: 100%;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.login-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 50;
  transform: translateX(-50%);
  padding: 0.7rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: #1a1a1a;
  color: var(--text);
  font-size: 0.86rem;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

@media (max-width: 900px) {
  .login-shell {
    grid-template-columns: 1fr;
    padding-top: 4rem;
    align-items: start;
  }

  .login-aside {
    min-height: 0;
    gap: 0;
  }

  .login-aside__sub {
    margin-bottom: 1.25rem;
  }

  .login-tip {
    margin-top: 0;
    margin-bottom: 1.25rem;
    order: 3;
  }

  .login-card {
    justify-self: center;
  }

  .login-aside__title {
    max-width: none;
  }
}

@media (max-width: 560px) {
  .login-back {
    position: static;
    display: inline-block;
    margin: 1rem 1rem 0;
  }

  .login-shell {
    width: calc(100% - 1.5rem);
    padding-top: 1.25rem;
  }
}
