:root {
  --nx-purple: #7c5cff;
  --nx-purple-mid: #8b72ef;
  --nx-purple-dark: #6b4fe0;
  --nx-purple-light: #c4b5fd;
  --nx-bg: #f4f1fc;
  --nx-text: #2d2d4a;
  --nx-muted: #94a3b8;
  --nx-border: #e2e8f0;
  --nx-card-w: 420px;
}

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

html, body.login-page {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body.login-page {
  font-family: Poppins, Inter, "Segoe UI", sans-serif;
  color: var(--nx-text);
  background: var(--nx-bg);
}

/* ── Background ── */
.login-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(180deg, #f8f6ff 0%, #f1edff 45%, #ebe6ff 100%);
  overflow: hidden;
}

.bg-wave {
  position: absolute;
  pointer-events: none;
}

.bg-wave.tl {
  top: -6%;
  left: -10%;
  width: 62%;
  height: 48%;
  opacity: 0.85;
}

.bg-wave.br {
  bottom: -8%;
  right: -12%;
  width: 65%;
  height: 50%;
  transform: scaleX(-1) rotate(6deg);
  opacity: 0.8;
}

.bg-flow {
  position: absolute;
  left: 50%;
  top: 42%;
  width: min(900px, 95vw);
  height: 280px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0.35;
}

.bg-dots {
  position: absolute;
  width: 76px;
  height: 76px;
  opacity: 0.28;
  background-image: radial-gradient(circle, #9b8cf8 1.4px, transparent 1.4px);
  background-size: 10px 10px;
}

.bg-dots.tl { top: 24px; left: 24px; }
.bg-dots.bl { bottom: 56px; left: 28px; opacity: 0.22; }
.bg-dots.br { bottom: 56px; right: 28px; opacity: 0.22; }

.bg-hatch-circle {
  position: absolute;
  right: 10%;
  top: 36%;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 92, 255, 0.14);
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 5px,
    rgba(124, 92, 255, 0.07) 5px,
    rgba(124, 92, 255, 0.07) 6px
  );
}

.bg-lines {
  position: absolute;
  right: 0;
  top: 0;
  width: 22%;
  height: 100%;
  opacity: 0.1;
  background: repeating-linear-gradient(
    -52deg,
    transparent 0,
    transparent 14px,
    rgba(124, 92, 255, 0.45) 14px,
    rgba(124, 92, 255, 0.45) 15px
  );
  mask-image: linear-gradient(90deg, transparent, #000 35%);
}

.bg-plus {
  position: absolute;
  color: rgba(124, 92, 255, 0.22);
  font-size: 15px;
  font-weight: 300;
  line-height: 1;
}

.bg-plus.p1 { top: 24%; left: 20%; }
.bg-plus.p2 { bottom: 34%; right: 24%; font-size: 12px; opacity: 0.7; }

.bg-ring {
  position: absolute;
  border-radius: 50%;
  border: 1.5px solid rgba(124, 92, 255, 0.18);
}

.bg-ring.r1 { width: 18px; height: 18px; top: 32%; right: 28%; }
.bg-ring.r2 { width: 11px; height: 11px; bottom: 38%; left: 18%; opacity: 0.65; }

.bg-tri {
  position: absolute;
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-bottom: 12px solid rgba(124, 92, 255, 0.16);
}

.bg-tri.t1 { top: 22%; right: 22%; transform: rotate(10deg); }
.bg-tri.t2 { bottom: 32%; left: 24%; transform: rotate(-16deg); }

.bg-mesh {
  position: absolute;
  width: 130px;
  height: 130px;
  opacity: 0.07;
  background-image:
    linear-gradient(rgba(124, 92, 255, 0.55) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, 0.55) 1px, transparent 1px);
  background-size: 14px 14px;
}

.bg-mesh.ml { bottom: 0; left: 0; mask-image: radial-gradient(circle at bottom left, #000, transparent 72%); }
.bg-mesh.mr { bottom: 0; right: 0; mask-image: radial-gradient(circle at bottom right, #000, transparent 72%); }

/* ── Shell ── */
.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 20px 44px;
  overflow: hidden;
}

.login-brand {
  text-align: center;
  flex-shrink: 0;
  margin-bottom: 18px;
}

.login-brand-logo {
  display: block;
  width: min(260px, 70vw);
  height: auto;
  margin: 0 auto 6px;
  object-fit: contain;
  background: transparent;
}

.brand-tagline {
  margin: 4px 0 0;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 400;
}

/* ── Card ── */
.login-card {
  width: min(400px, 92vw);
  flex-shrink: 0;
  background: #fff;
  border-radius: 20px;
  padding: 26px 28px 22px;
  box-shadow: 0 18px 48px rgba(124, 92, 255, 0.12), 0 4px 14px rgba(45, 55, 72, 0.05);
  border: 1px solid rgba(237, 233, 254, 0.95);
}

.login-card h2 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 800;
  color: #2d2d4a;
  letter-spacing: -0.3px;
}

.login-card .subtitle {
  margin: 0 0 20px;
  color: #94a3b8;
  font-size: 12.5px;
  font-weight: 400;
}

.field-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
  color: #334155;
}

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1.5px solid var(--nx-border);
  border-radius: 11px;
  padding: 11px 14px;
  background: #fff;
  margin-bottom: 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-wrap:focus-within {
  border-color: rgba(124, 92, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.07);
}

.input-wrap i.icon {
  font-size: 15px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.input-wrap i.icon-user { color: #cbd5e1; }
.input-wrap i.icon-lock { color: var(--nx-purple); }

.icon-lock-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--nx-purple);
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 10px;
}

.input-wrap input {
  border: 0;
  outline: none;
  width: 100%;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--nx-text);
  background: transparent;
  min-width: 0;
}

.input-wrap input::placeholder { color: #b8c4d0; }

.toggle-pwd {
  border: 0;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  padding: 0;
  font-size: 15px;
  flex-shrink: 0;
  line-height: 1;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  font-size: 12.5px;
}

.remember {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  cursor: pointer;
  user-select: none;
  font-size: 12.5px;
}

.remember input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid #cbd5e1;
  border-radius: 3px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

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

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

.forgot-link {
  color: var(--nx-purple);
  text-decoration: none;
  font-weight: 600;
  font-size: 12.5px;
}

.forgot-link:hover { text-decoration: underline; }

.btn-login {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 13px 16px;
  background: linear-gradient(90deg, #8b6cf5 0%, #7c5cff 50%, #6f52f0 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(124, 92, 255, 0.34);
  transition: box-shadow 0.15s, filter 0.15s;
}

.btn-login:hover {
  filter: brightness(1.04);
  box-shadow: 0 12px 30px rgba(124, 92, 255, 0.42);
}

.login-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 12px;
  color: #a0aec0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.login-or::before,
.login-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e8edf3;
}

.login-or span { flex-shrink: 0; }

.login-install {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 11px 11px 12px;
  border-radius: 14px;
  background: #f0edf8;
  border: 1px solid #e8e3f4;
}

.login-install-ico {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #7c5cff;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(124, 92, 255, 0.28);
}

.login-install-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.login-install-text strong {
  font-size: 12px;
  font-weight: 700;
  color: #2d2d4a;
  line-height: 1.25;
}

.login-install-text span {
  font-size: 10.5px;
  color: #64748b;
  line-height: 1.3;
}

.login-install-btn {
  flex-shrink: 0;
  border: 1.5px solid #7c5cff;
  background: #fff;
  color: #7c5cff;
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.login-install-btn:hover {
  background: #f8f6ff;
}

.login-error {
  color: #e53e3e;
  font-size: 12px;
  margin-top: 10px;
  text-align: center;
}

.login-footer {
  position: fixed;
  bottom: 14px;
  left: 0;
  right: 0;
  text-align: center;
  color: #a0aec0;
  font-size: 11px;
  z-index: 2;
  pointer-events: none;
}

@media (max-height: 700px) {
  .login-shell { padding-bottom: 36px; }
  .login-brand { margin-bottom: 12px; }
  .login-card { padding: 20px 22px 18px; }
  .input-wrap { padding: 9px 12px; margin-bottom: 12px; }
  .login-row { margin-bottom: 14px; }
  .login-or { margin: 14px 0 10px; }
}

@media (max-height: 580px) {
  .login-shell { transform: scale(0.9); transform-origin: center; }
}
