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

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Background & Overlay (shared with portal) ── */

#bg {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #1e3a5f, #0f172a);
  z-index: 0;
  transition: background 0.5s;
}

#overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.15);
  z-index: 1;
  pointer-events: none;
}

/* ── Centered layout ── */

#login-wrap {
  position: relative; z-index: 2;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* ── Portal branding above card ── */

#login-brand {
  text-align: center;
  margin-bottom: 28px;
  animation: loginFadeDown 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#login-logo-wrap {
  margin-bottom: 14px;
}
#login-logo-img {
  max-height: 48px;
  max-width: 180px;
  object-fit: contain;
  filter: brightness(0) invert(1);   /* make logo white to fit dark bg */
  opacity: 0.9;
}

#login-brand-title {
  font-size: 30px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.03em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
  line-height: 1.1;
}

#login-brand-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 6px;
}

/* ── Card ── */

#login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  padding: 36px 32px 28px;
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 24px 64px rgba(0, 0, 0, 0.5);
  animation: loginFadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.05s;
}

@keyframes loginFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes loginFadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Card heading ── */

#login-card-heading {
  font-size: 17px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 22px;
  letter-spacing: -0.01em;
}

#cpw-hint {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.45);
  margin: -14px 0 20px;
  line-height: 1.5;
}

/* ── Fields ── */

.login-field { margin-bottom: 16px; }

.login-field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.login-field input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9px;
  color: #fff;
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.login-field input::placeholder { color: rgba(255, 255, 255, 0.18); }

.login-field input:focus {
  border-color: rgba(99, 130, 255, 0.65);
  background: rgba(0, 0, 0, 0.28);
  box-shadow: 0 0 0 3px rgba(99, 130, 255, 0.15);
}

/* Password row */
.login-pass-wrap { position: relative; }
.login-pass-wrap input { padding-right: 42px; }

.login-eye {
  position: absolute; right: 11px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: rgba(255, 255, 255, 0.28);
  padding: 3px;
  display: flex; align-items: center;
  transition: color 0.15s;
}
.login-eye:hover { color: rgba(255, 255, 255, 0.7); }

/* ── Error message ── */

#login-error {
  display: none;
  margin-bottom: 14px;
  padding: 9px 13px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.28);
  border-radius: 8px;
  font-size: 13px;
  color: #fca5a5;
  text-align: center;
  animation: loginFadeUp 0.2s ease both;
}
#login-error.show { display: block; }

/* ── Submit button ── */

#login-btn,
.login-submit-btn {
  width: 100%;
  margin-top: 6px;
  padding: 12px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b6ef5 0%, #6d41d6 100%);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 18px rgba(59, 110, 245, 0.35);
  transition: filter 0.18s, transform 0.15s, box-shadow 0.18s;
}
#login-btn:hover,
.login-submit-btn:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
  box-shadow: 0 8px 26px rgba(59, 110, 245, 0.45);
}
#login-btn:active,
.login-submit-btn:active {
  transform: translateY(0);
  filter: brightness(0.95);
  transition-duration: 0.06s;
}
#login-btn .btn-arrow,
.login-submit-btn .btn-arrow { transition: transform 0.2s; }
#login-btn:hover .btn-arrow,
.login-submit-btn:hover .btn-arrow { transform: translateX(3px); }

/* ── Loading state ── */
#login-btn.loading,
.login-submit-btn.loading { pointer-events: none; opacity: 0.75; }
#login-btn.loading .btn-label,
.login-submit-btn.loading .btn-label { opacity: 0.6; }

/* ── Footer ── */

#login-footer {
  margin-top: 22px;
  text-align: center;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.22);
  letter-spacing: 0.01em;
}
#login-footer strong {
  font-weight: 600;
  color: rgba(255, 255, 255, 0.38);
}

/* ── Shake ── */
@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-7px); }
  40%       { transform: translateX(7px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}
#login-card.shake { animation: loginShake 0.38s ease; }
