:root {
  --ink: #0b132b;
  --muted: #64748b;
  --line: #e2e8f0;
  --panel: #ffffff;
  --brand-blue: #1b44ff;
  --brand-blue-hover: #002ad6;
  --radius: 18px;
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Outfit", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(circle at 75% 30%, #1d4ed8 0%, #021268 55%, #010a3a 100%);
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  position: relative;
}

/* Flowing 'X' Background Graphic */
body::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 5%;
  width: 520px;
  height: 520px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0.02) 100%);
  clip-path: polygon(20% 0%, 50% 35%, 80% 0%, 100% 20%, 65% 50%, 100% 80%, 80% 100%, 50% 65%, 20% 100%, 0% 80%, 35% 50%, 0% 20%);
  filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.3));
  pointer-events: none;
  animation: floatX 9s ease-in-out infinite alternate;
  z-index: 0;
}

@keyframes floatX {
  0% { transform: translateY(-54%) rotate(-12deg) scale(0.96); }
  100% { transform: translateY(-46%) rotate(-6deg) scale(1.02); }
}

.shell {
  position: relative;
  z-index: 1;
  width: min(100%, 400px);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  text-decoration: none;
}

.brand-logo {
  height: 38px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1); /* Ensures logo renders crisp white over dark background */
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 2.25rem 1.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

h1 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.lede {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

form {
  display: grid;
  gap: 1.1rem;
}

.label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  padding: 0.8rem 0.9rem;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  outline: none;
  transition: all 0.2s ease;
}

input:focus {
  border-color: var(--brand-blue);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(27, 68, 255, 0.15);
}

/* Password Field Wrapper & Toggle Icon */
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 2.75rem !important;
}

.toggle-password {
  position: absolute;
  right: 0.4rem;
  width: auto;
  padding: 0.4rem;
  background: transparent;
  border: none;
  box-shadow: none;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.toggle-password:hover {
  background: #f1f5f9;
  color: #0f172a;
  transform: none;
  box-shadow: none;
}

.toggle-password.showing {
  color: var(--brand-blue);
}

.eye-icon {
  width: 18px;
  height: 18px;
}

/* Buttons */
button[type="submit"],
.button {
  appearance: none;
  display: inline-block;
  width: 100%;
  border: 0;
  border-radius: 28px;
  background: var(--brand-blue);
  color: #ffffff;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 1.25rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(27, 68, 255, 0.35);
}

button[type="submit"]:hover,
.button:hover {
  background: var(--brand-blue-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(27, 68, 255, 0.45);
}

.button.secondary {
  background: #ffffff;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}

.button.secondary:hover {
  background: #f1f5f9;
  transform: none;
}

.alert {
  margin: 0 0 1.25rem;
  padding: 0.85rem 0.95rem;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 0.9rem;
}

.actions {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.foot {
  margin-top: 1.5rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.8rem;
}

@media (max-width: 640px) {
  body::before {
    width: 320px;
    height: 320px;
    right: -20%;
  }
}
