:root {
  --bg: #041126;
  --bg-2: #081a3b;
  --card: rgba(8, 19, 43, 0.72);
  --card-border: rgba(255,255,255,0.10);
  --text: #edf3ff;
  --muted: #9fb3d7;
  --blue: #4f8cff;
  --purple: #7f5bff;
  --cyan: #4fd8ff;
  --danger-bg: rgba(255, 86, 110, 0.14);
  --danger-border: rgba(255, 86, 110, 0.35);
  --danger-text: #ffd4db;
  --input-border: rgba(160, 188, 255, 0.12);
  --shadow: 0 20px 70px rgba(0,0,0,0.38);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #0a214a 0%, var(--bg) 52%, #030a19 100%);
  overflow: hidden;
}

.login-bg, .grid-overlay, .noise, .orb { position: fixed; inset: 0; pointer-events: none; }
.login-bg { overflow: hidden; }
.orb {
  border-radius: 50%;
  filter: blur(20px);
  opacity: .45;
  animation: floatOrb 16s ease-in-out infinite;
}
.orb-1 {
  width: 34rem; height: 34rem;
  background: radial-gradient(circle, rgba(79,216,255,.55), rgba(79,216,255,0));
  top: -12rem; left: -8rem;
}
.orb-2 {
  width: 30rem; height: 30rem;
  background: radial-gradient(circle, rgba(127,91,255,.50), rgba(127,91,255,0));
  right: -8rem; bottom: -9rem;
  animation-delay: -5s;
}
.orb-3 {
  width: 22rem; height: 22rem;
  background: radial-gradient(circle, rgba(79,140,255,.42), rgba(79,140,255,0));
  left: 45%; top: 20%;
  animation-delay: -9s;
}
.grid-overlay {
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(circle at center, black 30%, transparent 85%);
}
.noise {
  opacity: .12;
  background-image: radial-gradient(rgba(255,255,255,.32) 0.7px, transparent 0.7px);
  background-size: 18px 18px;
}

.login-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  position: relative;
  width: min(100%, 520px);
  padding: 30px;
  border-radius: 30px;
  background: linear-gradient(180deg, rgba(10, 26, 56, 0.88), rgba(5, 17, 39, 0.82));
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
  animation: cardIn .9s cubic-bezier(.16,1,.3,1);
  transform-style: preserve-3d;
  transition: transform .16s ease;
}

.login-glow {
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: conic-gradient(from 160deg, rgba(79,140,255,.24), rgba(79,216,255,.06), rgba(127,91,255,.25), rgba(79,140,255,.22));
  filter: blur(22px);
  z-index: -1;
}

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .55rem .85rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,.08);
  color: #d9e6ff;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.brand-pill-centered {
  display: flex;
  width: fit-content;
  margin: 0 auto 22px;
}

.brand-dot {
  width: .62rem; height: .62rem; border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--blue));
  box-shadow: 0 0 14px rgba(79,216,255,.6);
}

.brand-block {
  display: flex;
  gap: 18px;
  align-items: center;
  margin: 0 0 22px;
}
.brand-icon {
  flex: 0 0 76px;
  width: 76px; height: 76px;
  border-radius: 22px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.10);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.brand-icon svg { width: 52px; height: 52px; }

h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 3vw, 2.45rem);
  line-height: 1.02;
  letter-spacing: -0.04em;
}
.subtitle {
  margin: 0;
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.6;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 20px 0 16px;
  padding: 14px 16px;
  border-radius: 18px;
  font-size: .95rem;
  line-height: 1.5;
  animation: fadeUp .45s ease;
}
.alert-error {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger-text);
}
.alert-icon {
  width: 1.6rem; height: 1.6rem; flex: 0 0 1.6rem;
  border-radius: 50%;
  display: grid; place-items:center;
  background: rgba(255,255,255,.10);
  font-weight: 800;
}

.login-form { display: grid; gap: 16px; margin-top: 12px; }
.fake-autofill-field {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  left: -9999px;
}
.field { display: grid; gap: 8px; }
label {
  color: #d9e6ff;
  font-weight: 600;
  font-size: .92rem;
}
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 60px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border: 1px solid var(--input-border);
  overflow: hidden;
  transition: transform .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.input-wrap:focus-within {
  transform: translateY(-1px);
  border-color: rgba(111, 162, 255, 0.42);
  box-shadow: 0 0 0 4px rgba(79, 140, 255, .14), 0 14px 32px rgba(1, 9, 22, .34);
}
.input-icon, .toggle-password {
  position: relative;
  z-index: 1;
  color: #adc4ef;
}
.input-icon {
  display: grid; place-items: center;
  width: 52px;
}
.input-icon svg, .toggle-password svg { width: 20px; height: 20px; }
input {
  flex: 1;
  height: 58px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 1rem;
  font-weight: 500;
  padding: 0 16px 0 2px;
}
input::placeholder { color: #7f98c5; }

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  transition: background-color 9999s ease-in-out 0s;
  box-shadow: 0 0 0 1000px rgba(8, 19, 43, 0.96) inset !important;
  caret-color: var(--text);
}

.toggle-password {
  width: 52px; height: 52px;
  display: grid; place-items: center;
  background: transparent; border: 0; cursor: pointer;
}
.hidden { display: none; }
.input-shine {
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 36%, rgba(255,255,255,.10) 50%, transparent 64%);
  transform: translateX(-120%);
}
.input-wrap:focus-within .input-shine { animation: shine 1.2s ease; }

.submit-btn {
  position: relative;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 58px;
  border-radius: 18px;
  border: 0;
  cursor: pointer;
  margin-top: 8px;
  color: white;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: .01em;
  background: linear-gradient(135deg, var(--blue), var(--purple));
  box-shadow: 0 20px 28px rgba(45, 103, 229, .34), inset 0 1px 0 rgba(255,255,255,.2);
  transition: transform .22s ease, filter .22s ease, box-shadow .22s ease;
}
.submit-btn:hover { transform: translateY(-2px); filter: brightness(1.05); }
.submit-btn:active { transform: translateY(0); }
.submit-btn.loading { pointer-events: none; opacity: .95; }
.submit-loader {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.25);
  border-top-color: rgba(255,255,255,.95);
  display: none;
  animation: spin .75s linear infinite;
}
.submit-btn.loading .submit-loader { display: inline-block; }
.submit-btn.loading .submit-text { opacity: .92; }

@keyframes floatOrb {
  0%, 100% { transform: translate3d(0,0,0) scale(1); }
  33% { transform: translate3d(24px,-18px,0) scale(1.06); }
  66% { transform: translate3d(-18px,20px,0) scale(.97); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(22px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeUp {
  from { opacity:0; transform: translateY(8px); }
  to { opacity:1; transform: translateY(0); }
}
@keyframes shine {
  from { transform: translateX(-120%); }
  to { transform: translateX(120%); }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .login-card { padding: 22px; border-radius: 24px; }
  .brand-block { align-items: flex-start; }
  .brand-icon { width: 68px; height: 68px; flex-basis: 68px; }
  h1 { font-size: 1.8rem; }
  .subtitle { font-size: .92rem; }
}

.alert-success {
  border-color: rgba(34, 197, 94, .28);
  background: rgba(34, 197, 94, .12);
  color: #dcfce7;
}

.login-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: .92rem;
}

.login-links a {
  color: #c7d2fe;
  text-decoration: none;
  font-weight: 700;
}

.login-links a:hover {
  color: #ffffff;
  text-decoration: underline;
}

.secure-note {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  margin-bottom: 18px;
  color: #dbeafe;
  background: rgba(91, 140, 255, .12);
  border: 1px solid rgba(147, 197, 253, .2);
}

.secure-note strong {
  color: #ffffff;
  font-size: .98rem;
}

.secure-note span {
  color: #a9b8d8;
  font-size: .86rem;
}
