.login-page {
  position: relative;
  isolation: isolate;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 40px);
  overflow-x: clip;
  background:
    radial-gradient(circle at 8% 88%, rgb(49 89 212 / 7%), transparent 26rem),
    radial-gradient(circle at 92% 12%, rgb(124 58 237 / 4.5%), transparent 24rem),
    var(--auth-page);
}

.login-page::before,
.login-page::after {
  content: "";
  position: fixed;
  z-index: -1;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(88px);
}

.login-page::before {
  right: -110px;
  top: 16%;
  background: rgb(49 89 212 / 9%);
}

.login-page::after {
  bottom: -120px;
  left: 8%;
  background: rgb(22 163 74 / 5%);
}

.login-shell {
  position: relative;
  width: min(100%, 500px);
  margin: auto;
  padding: clamp(28px, 4vw, 40px);
  overflow: hidden;
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius-card);
  background: rgb(255 255 255 / 97%);
  box-shadow:
    0 24px 70px rgb(49 89 212 / 8%),
    var(--auth-shadow);
}

.login-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-start;
  gap: 18px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--auth-line-soft);
}

.login-intro {
  margin-top: clamp(30px, 4vw, 38px);
  text-align: center;
}

.login-intro h1 {
  margin: 0;
  font-size: clamp(25px, 2.2vw, 29px);
  font-weight: 900;
  letter-spacing: -.4px;
  line-height: 1.5;
}

.login-intro p {
  max-width: 38ch;
  margin: 6px auto 0;
  color: var(--auth-muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.9;
}

.login-access {
  width: min(100%, 380px);
  margin: clamp(25px, 4vw, 32px) auto 0;
}

.login-form {
  display: grid;
  width: 100%;
  gap: 16px;
}

.login-field {
  display: grid;
  gap: 7px;
  color: #30394a;
  font-size: 12px;
  font-weight: 800;
}

.login-field > span:first-child { padding-right: 3px; }
.input-wrap { position: relative; display: block; }

.input-wrap input {
  width: 100%;
  min-height: 50px;
  padding: 10px 14px 10px 46px;
  border: 1px solid #dfe6f2;
  border-radius: var(--auth-radius-control);
  outline: 0;
  background: var(--auth-surface-soft);
  color: var(--auth-text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 140ms ease, box-shadow 140ms ease, background-color 140ms ease;
}

.input-wrap input::placeholder { color: #667085; opacity: 1; }
.input-wrap input:-webkit-autofill { -webkit-text-fill-color: var(--auth-text); box-shadow: 0 0 0 1000px #fff inset; }
.input-wrap input:hover { border-color: #c9d3e2; }
.input-wrap input:focus { border-color: var(--auth-blue); background: #fff; box-shadow: 0 0 0 3px var(--auth-focus); }

.password-field input {
  direction: ltr;
  font-family: Tahoma, "Segoe UI", sans-serif;
  letter-spacing: .04em;
  text-align: left;
}

.password-field input::placeholder {
  direction: rtl;
  font-family: var(--auth-font);
  letter-spacing: 0;
  text-align: right;
}

.field-icon,
.password-toggle {
  position: absolute;
  top: 50%;
  left: 7px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  transform: translateY(-50%);
}

.field-icon {
  border: 1px solid #dce5fb;
  background: #f0f4ff;
  color: var(--auth-blue);
  pointer-events: none;
}

.field-icon svg,
.password-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.password-toggle {
  border: 1px solid #e3e8f1;
  background: #f7f9fc;
  color: #596579;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.password-toggle:hover,
.password-toggle.is-visible {
  border-color: var(--auth-blue-line);
  background: var(--auth-blue-soft);
  color: var(--auth-blue-dark);
}

.eye-icon-slash { opacity: 0; }
.password-toggle.is-visible .eye-icon-slash { opacity: 1; }

.forgot-password {
  justify-self: start;
  min-height: 34px;
  margin-top: -7px;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--auth-blue-dark);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.forgot-password:hover { color: #1f43b1; }

.login-submit,
.otp-login {
  width: 100%;
  min-height: 48px;
  border-radius: var(--auth-radius-control);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, transform 140ms ease, opacity 140ms ease;
}

.login-submit {
  border: 0;
  background: var(--auth-blue);
  color: #fff;
  box-shadow: 0 7px 16px rgb(49 89 212 / 18%);
}

.login-submit:hover { background: var(--auth-blue-dark); box-shadow: 0 9px 20px rgb(49 89 212 / 22%); }
.login-submit:active,
.otp-login:active { transform: translateY(1px); }
.login-submit:disabled { cursor: wait; opacity: .68; }

.login-divider {
  display: grid;
  margin: 17px 0 0;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 13px;
  color: #667085;
}

.login-divider span { height: 1px; background: var(--auth-line); }
.login-divider b { font-size: 10px; font-weight: 600; }

.otp-login {
  display: flex;
  margin-top: 15px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid #dbe3f2;
  background: var(--auth-surface);
  color: var(--auth-blue-dark);
}

.otp-login:hover { border-color: var(--auth-blue-line); background: #f8faff; }
.otp-icon { position: relative; width: 14px; height: 11px; border: 1.4px solid currentColor; border-radius: 2px; }
.otp-icon::before,
.otp-icon::after { content: ""; position: absolute; right: 2px; left: 2px; height: 1px; background: currentColor; }
.otp-icon::before { top: 3px; }
.otp-icon::after { top: 7px; right: 5px; }

.login-note {
  min-height: 20px;
  margin: 7px auto 0;
  color: var(--auth-blue-dark);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.7;
  text-align: center;
}

.signup-callout {
  width: min(100%, 380px);
  margin: 10px auto 0;
  padding: 15px 16px;
  border: 1px solid #dce5fb;
  border-radius: 10px;
  background: #f6f8ff;
  text-align: center;
}

.signup-callout p { margin: 0; color: #4f5b6e; font-size: 12px; font-weight: 700; }

.signup-callout a {
  display: flex;
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--auth-blue-line);
  border-radius: 8px;
  background: var(--auth-surface);
  color: var(--auth-blue-dark);
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 6px 16px rgb(49 89 212 / 7%);
  text-decoration: none;
  transition: border-color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.signup-callout a:hover { border-color: var(--auth-blue); background: var(--auth-blue-soft); }
.signup-callout a:active { transform: translateY(1px); }
.signup-callout a span { direction: ltr; font-family: Tahoma, sans-serif; font-size: 16px; }

.auth-message {
  margin: -8px 0 0;
  padding: 9px 11px;
  border: 1px solid var(--auth-blue-line);
  border-radius: 7px;
  background: var(--auth-blue-soft);
  color: #2849ae;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.7;
  text-align: center;
}

.auth-message.is-error { border-color: #f0c5ce; background: #fff4f6; color: #a72d46; }

.login-footer {
  margin-top: clamp(22px, 4vw, 30px);
  color: #667085;
  font-size: 10px;
  font-weight: 650;
  text-align: center;
}

.magnetis-brand:focus-visible,
.password-toggle:focus-visible,
.forgot-password:focus-visible,
.login-submit:focus-visible,
.otp-login:focus-visible,
.signup-callout a:focus-visible { outline: 3px solid var(--auth-focus); outline-offset: 2px; }

@media (min-width: 1024px) {
  .login-shell { width: min(100%, 500px); min-height: min(650px, calc(100dvh - 64px)); }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .login-shell { width: min(100%, 520px); padding: clamp(34px, 5vw, 46px); }
  .login-access,
  .signup-callout { width: min(100%, 400px); }
}

@media (max-width: 767px) {
  .login-page { place-items: stretch; padding: 0; background: var(--auth-surface); }
  .login-shell { width: 100%; min-height: 100dvh; padding: clamp(20px, 6vw, 30px) clamp(16px, 6vw, 28px); border: 0; border-radius: 0; box-shadow: none; }
  .login-page::before,
  .login-page::after { display: none; }
  .login-header { padding-bottom: 18px; }
  .login-intro { margin-top: clamp(28px, 9vw, 40px); }
  .login-access { margin-top: clamp(24px, 7vw, 32px); }
  .login-footer { margin-top: clamp(26px, 8vw, 40px); }
}

@media (max-width: 420px) {
  .login-header { align-items: center; }
}

@media (min-width: 768px) and (max-height: 720px) {
  .login-page { padding-block: 6px; }
  .login-shell { min-height: 0; padding: 18px 36px; }
  .login-header { padding-bottom: 10px; }
  .login-intro { margin-top: 14px; }
  .login-access { margin-top: 14px; }
  .login-form { gap: 10px; }
  .input-wrap input { min-height: 46px; }
  .forgot-password { min-height: 30px; }
  .login-submit,
  .otp-login { min-height: 44px; }
  .login-divider { margin-top: 10px; }
  .otp-login { margin-top: 10px; }
  .signup-callout { margin-top: 4px; padding-block: 8px; }
  .login-footer { margin-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .input-wrap input,
  .password-toggle,
  .login-submit,
  .otp-login,
  .signup-callout a { transition: none; }
}
